diff options
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index a3a410d20da0..a68fd79e9eca 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -286,6 +286,42 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = { | |||
286 | .get_sset_count = dsa_slave_get_sset_count, | 286 | .get_sset_count = dsa_slave_get_sset_count, |
287 | }; | 287 | }; |
288 | 288 | ||
289 | #ifdef CONFIG_NET_DSA_TAG_DSA | ||
290 | static const struct net_device_ops dsa_netdev_ops = { | ||
291 | .ndo_open = dsa_slave_open, | ||
292 | .ndo_stop = dsa_slave_close, | ||
293 | .ndo_start_xmit = dsa_xmit, | ||
294 | .ndo_change_rx_flags = dsa_slave_change_rx_flags, | ||
295 | .ndo_set_rx_mode = dsa_slave_set_rx_mode, | ||
296 | .ndo_set_multicast_list = dsa_slave_set_rx_mode, | ||
297 | .ndo_set_mac_address = dsa_slave_set_mac_address, | ||
298 | .ndo_do_ioctl = dsa_slave_ioctl, | ||
299 | }; | ||
300 | #endif | ||
301 | #ifdef CONFIG_NET_DSA_TAG_EDSA | ||
302 | static const struct net_device_ops edsa_netdev_ops = { | ||
303 | .ndo_open = dsa_slave_open, | ||
304 | .ndo_stop = dsa_slave_close, | ||
305 | .ndo_start_xmit = edsa_xmit, | ||
306 | .ndo_change_rx_flags = dsa_slave_change_rx_flags, | ||
307 | .ndo_set_rx_mode = dsa_slave_set_rx_mode, | ||
308 | .ndo_set_multicast_list = dsa_slave_set_rx_mode, | ||
309 | .ndo_set_mac_address = dsa_slave_set_mac_address, | ||
310 | .ndo_do_ioctl = dsa_slave_ioctl, | ||
311 | }; | ||
312 | #endif | ||
313 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | ||
314 | static const struct net_device_ops trailer_netdev_ops = { | ||
315 | .ndo_open = dsa_slave_open, | ||
316 | .ndo_stop = dsa_slave_close, | ||
317 | .ndo_start_xmit = trailer_xmit, | ||
318 | .ndo_change_rx_flags = dsa_slave_change_rx_flags, | ||
319 | .ndo_set_rx_mode = dsa_slave_set_rx_mode, | ||
320 | .ndo_set_multicast_list = dsa_slave_set_rx_mode, | ||
321 | .ndo_set_mac_address = dsa_slave_set_mac_address, | ||
322 | .ndo_do_ioctl = dsa_slave_ioctl, | ||
323 | }; | ||
324 | #endif | ||
289 | 325 | ||
290 | /* slave device setup *******************************************************/ | 326 | /* slave device setup *******************************************************/ |
291 | struct net_device * | 327 | struct net_device * |
@@ -306,32 +342,27 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, | |||
306 | SET_ETHTOOL_OPS(slave_dev, &dsa_slave_ethtool_ops); | 342 | SET_ETHTOOL_OPS(slave_dev, &dsa_slave_ethtool_ops); |
307 | memcpy(slave_dev->dev_addr, master->dev_addr, ETH_ALEN); | 343 | memcpy(slave_dev->dev_addr, master->dev_addr, ETH_ALEN); |
308 | slave_dev->tx_queue_len = 0; | 344 | slave_dev->tx_queue_len = 0; |
345 | |||
309 | switch (ds->tag_protocol) { | 346 | switch (ds->tag_protocol) { |
310 | #ifdef CONFIG_NET_DSA_TAG_DSA | 347 | #ifdef CONFIG_NET_DSA_TAG_DSA |
311 | case htons(ETH_P_DSA): | 348 | case htons(ETH_P_DSA): |
312 | slave_dev->hard_start_xmit = dsa_xmit; | 349 | slave_dev->netdev_ops = &dsa_netdev_ops; |
313 | break; | 350 | break; |
314 | #endif | 351 | #endif |
315 | #ifdef CONFIG_NET_DSA_TAG_EDSA | 352 | #ifdef CONFIG_NET_DSA_TAG_EDSA |
316 | case htons(ETH_P_EDSA): | 353 | case htons(ETH_P_EDSA): |
317 | slave_dev->hard_start_xmit = edsa_xmit; | 354 | slave_dev->netdev_ops = &edsa_netdev_ops; |
318 | break; | 355 | break; |
319 | #endif | 356 | #endif |
320 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | 357 | #ifdef CONFIG_NET_DSA_TAG_TRAILER |
321 | case htons(ETH_P_TRAILER): | 358 | case htons(ETH_P_TRAILER): |
322 | slave_dev->hard_start_xmit = trailer_xmit; | 359 | slave_dev->netdev_ops = &trailer_netdev_ops; |
323 | break; | 360 | break; |
324 | #endif | 361 | #endif |
325 | default: | 362 | default: |
326 | BUG(); | 363 | BUG(); |
327 | } | 364 | } |
328 | slave_dev->open = dsa_slave_open; | 365 | |
329 | slave_dev->stop = dsa_slave_close; | ||
330 | slave_dev->change_rx_flags = dsa_slave_change_rx_flags; | ||
331 | slave_dev->set_rx_mode = dsa_slave_set_rx_mode; | ||
332 | slave_dev->set_multicast_list = dsa_slave_set_rx_mode; | ||
333 | slave_dev->set_mac_address = dsa_slave_set_mac_address; | ||
334 | slave_dev->do_ioctl = dsa_slave_ioctl; | ||
335 | SET_NETDEV_DEV(slave_dev, parent); | 366 | SET_NETDEV_DEV(slave_dev, parent); |
336 | slave_dev->vlan_features = master->vlan_features; | 367 | slave_dev->vlan_features = master->vlan_features; |
337 | 368 | ||