File tree Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ enum dsa_tag_protocol {
3838 DSA_TAG_PROTO_EDSA ,
3939 DSA_TAG_PROTO_GSWIP ,
4040 DSA_TAG_PROTO_KSZ9477 ,
41+ DSA_TAG_PROTO_KSZ9893 ,
4142 DSA_TAG_PROTO_LAN9303 ,
4243 DSA_TAG_PROTO_MTK ,
4344 DSA_TAG_PROTO_QCA ,
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = {
5757#endif
5858#ifdef CONFIG_NET_DSA_TAG_KSZ9477
5959 [DSA_TAG_PROTO_KSZ9477 ] = & ksz9477_netdev_ops ,
60+ [DSA_TAG_PROTO_KSZ9893 ] = & ksz9893_netdev_ops ,
6061#endif
6162#ifdef CONFIG_NET_DSA_TAG_LAN9303
6263 [DSA_TAG_PROTO_LAN9303 ] = & lan9303_netdev_ops ,
@@ -93,6 +94,7 @@ const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops)
9394#endif
9495#ifdef CONFIG_NET_DSA_TAG_KSZ9477
9596 [DSA_TAG_PROTO_KSZ9477 ] = "ksz9477" ,
97+ [DSA_TAG_PROTO_KSZ9893 ] = "ksz9893" ,
9698#endif
9799#ifdef CONFIG_NET_DSA_TAG_LAN9303
98100 [DSA_TAG_PROTO_LAN9303 ] = "lan9303" ,
Original file line number Diff line number Diff line change @@ -216,6 +216,7 @@ extern const struct dsa_device_ops gswip_netdev_ops;
216216
217217/* tag_ksz.c */
218218extern const struct dsa_device_ops ksz9477_netdev_ops ;
219+ extern const struct dsa_device_ops ksz9893_netdev_ops ;
219220
220221/* tag_lan9303.c */
221222extern const struct dsa_device_ops lan9303_netdev_ops ;
Original file line number Diff line number Diff line change 1616
1717/* Typically only one byte is used for tail tag. */
1818#define KSZ_EGRESS_TAG_LEN 1
19+ #define KSZ_INGRESS_TAG_LEN 1
1920
2021static struct sk_buff * ksz_common_xmit (struct sk_buff * skb ,
2122 struct net_device * dev , int len )
@@ -141,3 +142,36 @@ const struct dsa_device_ops ksz9477_netdev_ops = {
141142 .rcv = ksz9477_rcv ,
142143 .overhead = KSZ9477_INGRESS_TAG_LEN ,
143144};
145+
146+ #define KSZ9893_TAIL_TAG_OVERRIDE BIT(5)
147+ #define KSZ9893_TAIL_TAG_LOOKUP BIT(6)
148+
149+ static struct sk_buff * ksz9893_xmit (struct sk_buff * skb ,
150+ struct net_device * dev )
151+ {
152+ struct dsa_port * dp = dsa_slave_to_port (dev );
153+ struct sk_buff * nskb ;
154+ u8 * addr ;
155+ u8 * tag ;
156+
157+ nskb = ksz_common_xmit (skb , dev , KSZ_INGRESS_TAG_LEN );
158+ if (!nskb )
159+ return NULL ;
160+
161+ /* Tag encoding */
162+ tag = skb_put (nskb , KSZ_INGRESS_TAG_LEN );
163+ addr = skb_mac_header (nskb );
164+
165+ * tag = BIT (dp -> index );
166+
167+ if (is_link_local_ether_addr (addr ))
168+ * tag |= KSZ9893_TAIL_TAG_OVERRIDE ;
169+
170+ return nskb ;
171+ }
172+
173+ const struct dsa_device_ops ksz9893_netdev_ops = {
174+ .xmit = ksz9893_xmit ,
175+ .rcv = ksz9477_rcv ,
176+ .overhead = KSZ_INGRESS_TAG_LEN ,
177+ };
You can’t perform that action at this time.
0 commit comments