aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-08-27 20:04:52 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-28 01:59:40 -0400
commit5aed85cec29882d1c4b4b2a01cb75a99efdbe4ed (patch)
treec2a68a4275a8aefb66c4d1e359d76704c6894817 /net/dsa
parent0d8bcdd383b8865e752a7e8edb4712c2e3902052 (diff)
net: dsa: allow switches to work without tagging
In case switch port tagging is disabled (voluntarily, or the switch just does not support it), allow us to continue using the defined set of dsa_device_ops in net/dsa/slave.c. We introduce dsa_protocol_is_tagged() to check whether we need to override skb->protocol and go through the DSA-specifif packet_type function, or if we just go on and receive the SKB through the normal path. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/slave.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 03d2894a0f8a..241c2a1684cb 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -181,6 +181,17 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
181 return dst->ops->xmit(skb, dev); 181 return dst->ops->xmit(skb, dev);
182} 182}
183 183
184static netdev_tx_t dsa_slave_notag_xmit(struct sk_buff *skb,
185 struct net_device *dev)
186{
187 struct dsa_slave_priv *p = netdev_priv(dev);
188
189 skb->dev = p->parent->dst->master_netdev;
190 dev_queue_xmit(skb);
191
192 return NETDEV_TX_OK;
193}
194
184 195
185/* ethtool operations *******************************************************/ 196/* ethtool operations *******************************************************/
186static int 197static int
@@ -314,6 +325,11 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
314 .ndo_do_ioctl = dsa_slave_ioctl, 325 .ndo_do_ioctl = dsa_slave_ioctl,
315}; 326};
316 327
328static const struct dsa_device_ops notag_netdev_ops = {
329 .xmit = dsa_slave_notag_xmit,
330 .rcv = NULL,
331};
332
317static void dsa_slave_adjust_link(struct net_device *dev) 333static void dsa_slave_adjust_link(struct net_device *dev)
318{ 334{
319 struct dsa_slave_priv *p = netdev_priv(dev); 335 struct dsa_slave_priv *p = netdev_priv(dev);
@@ -415,7 +431,8 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
415 break; 431 break;
416#endif 432#endif
417 default: 433 default:
418 BUG(); 434 ds->dst->ops = &notag_netdev_ops;
435 break;
419 } 436 }
420 437
421 SET_NETDEV_DEV(slave_dev, parent); 438 SET_NETDEV_DEV(slave_dev, parent);