aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2008-12-25 19:45:19 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-25 19:45:19 -0500
commitf7d1b9f5aafa371d7f51f644aa3c38bc914e9205 (patch)
tree7120c076df7226818a416822fe972de2efc74b12 /net
parentd45227391c70ea12ec129ebfa97841e9b7ff34fd (diff)
vlan: fix convertion to net_device_ops
commit 656299f706e52e0409733d704c2761f1b12d6954 (vlan: convert to net_device_ops) added a net_device_ops with a NULL ndo_start_xmit field. This gives a crash in dev_hard_start_xmit() Fix it using two net_device_ops structures, one for hwaccel vlan, one for non hwaccel vlan. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_dev.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 71193a6b10e6..89a3bbdfca3f 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -593,6 +593,8 @@ static const struct header_ops vlan_header_ops = {
593 .parse = eth_header_parse, 593 .parse = eth_header_parse,
594}; 594};
595 595
596static const struct net_device_ops vlan_netdev_ops, vlan_netdev_accel_ops;
597
596static int vlan_dev_init(struct net_device *dev) 598static int vlan_dev_init(struct net_device *dev)
597{ 599{
598 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 600 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
@@ -619,11 +621,11 @@ static int vlan_dev_init(struct net_device *dev)
619 if (real_dev->features & NETIF_F_HW_VLAN_TX) { 621 if (real_dev->features & NETIF_F_HW_VLAN_TX) {
620 dev->header_ops = real_dev->header_ops; 622 dev->header_ops = real_dev->header_ops;
621 dev->hard_header_len = real_dev->hard_header_len; 623 dev->hard_header_len = real_dev->hard_header_len;
622 dev->hard_start_xmit = vlan_dev_hwaccel_hard_start_xmit; 624 dev->netdev_ops = &vlan_netdev_accel_ops;
623 } else { 625 } else {
624 dev->header_ops = &vlan_header_ops; 626 dev->header_ops = &vlan_header_ops;
625 dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN; 627 dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN;
626 dev->hard_start_xmit = vlan_dev_hard_start_xmit; 628 dev->netdev_ops = &vlan_netdev_ops;
627 } 629 }
628 630
629 if (is_vlan_dev(real_dev)) 631 if (is_vlan_dev(real_dev))
@@ -704,6 +706,22 @@ static const struct net_device_ops vlan_netdev_ops = {
704 .ndo_uninit = vlan_dev_uninit, 706 .ndo_uninit = vlan_dev_uninit,
705 .ndo_open = vlan_dev_open, 707 .ndo_open = vlan_dev_open,
706 .ndo_stop = vlan_dev_stop, 708 .ndo_stop = vlan_dev_stop,
709 .ndo_start_xmit = vlan_dev_hard_start_xmit,
710 .ndo_validate_addr = eth_validate_addr,
711 .ndo_set_mac_address = vlan_dev_set_mac_address,
712 .ndo_set_rx_mode = vlan_dev_set_rx_mode,
713 .ndo_set_multicast_list = vlan_dev_set_rx_mode,
714 .ndo_change_rx_flags = vlan_dev_change_rx_flags,
715 .ndo_do_ioctl = vlan_dev_ioctl,
716};
717
718static const struct net_device_ops vlan_netdev_accel_ops = {
719 .ndo_change_mtu = vlan_dev_change_mtu,
720 .ndo_init = vlan_dev_init,
721 .ndo_uninit = vlan_dev_uninit,
722 .ndo_open = vlan_dev_open,
723 .ndo_stop = vlan_dev_stop,
724 .ndo_start_xmit = vlan_dev_hwaccel_hard_start_xmit,
707 .ndo_validate_addr = eth_validate_addr, 725 .ndo_validate_addr = eth_validate_addr,
708 .ndo_set_mac_address = vlan_dev_set_mac_address, 726 .ndo_set_mac_address = vlan_dev_set_mac_address,
709 .ndo_set_rx_mode = vlan_dev_set_rx_mode, 727 .ndo_set_rx_mode = vlan_dev_set_rx_mode,