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 {
38
38
DSA_TAG_PROTO_EDSA ,
39
39
DSA_TAG_PROTO_GSWIP ,
40
40
DSA_TAG_PROTO_KSZ9477 ,
41
+ DSA_TAG_PROTO_KSZ9893 ,
41
42
DSA_TAG_PROTO_LAN9303 ,
42
43
DSA_TAG_PROTO_MTK ,
43
44
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] = {
57
57
#endif
58
58
#ifdef CONFIG_NET_DSA_TAG_KSZ9477
59
59
[DSA_TAG_PROTO_KSZ9477 ] = & ksz9477_netdev_ops ,
60
+ [DSA_TAG_PROTO_KSZ9893 ] = & ksz9893_netdev_ops ,
60
61
#endif
61
62
#ifdef CONFIG_NET_DSA_TAG_LAN9303
62
63
[DSA_TAG_PROTO_LAN9303 ] = & lan9303_netdev_ops ,
@@ -93,6 +94,7 @@ const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops)
93
94
#endif
94
95
#ifdef CONFIG_NET_DSA_TAG_KSZ9477
95
96
[DSA_TAG_PROTO_KSZ9477 ] = "ksz9477" ,
97
+ [DSA_TAG_PROTO_KSZ9893 ] = "ksz9893" ,
96
98
#endif
97
99
#ifdef CONFIG_NET_DSA_TAG_LAN9303
98
100
[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;
216
216
217
217
/* tag_ksz.c */
218
218
extern const struct dsa_device_ops ksz9477_netdev_ops ;
219
+ extern const struct dsa_device_ops ksz9893_netdev_ops ;
219
220
220
221
/* tag_lan9303.c */
221
222
extern const struct dsa_device_ops lan9303_netdev_ops ;
Original file line number Diff line number Diff line change 16
16
17
17
/* Typically only one byte is used for tail tag. */
18
18
#define KSZ_EGRESS_TAG_LEN 1
19
+ #define KSZ_INGRESS_TAG_LEN 1
19
20
20
21
static struct sk_buff * ksz_common_xmit (struct sk_buff * skb ,
21
22
struct net_device * dev , int len )
@@ -141,3 +142,36 @@ const struct dsa_device_ops ksz9477_netdev_ops = {
141
142
.rcv = ksz9477_rcv ,
142
143
.overhead = KSZ9477_INGRESS_TAG_LEN ,
143
144
};
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