vlan, qeth: neigh_setup
Subsystems (4)
cover vlan, qeth: neigh_setup
Hi Dave,
the qeth_l3 driver uses the neigh_setup function to turn off ARP for IPv4. But since the vlan driver does not support a neigh_setup function I had to add an ugly hack to the qeth_l3_add_vid function (set the neigh_setup function of the vlan device to the function of the real device). With the new net_device_ops this hack will not work any longer so I want to add neigh_setup to the vlan driver.
Following patches add the neigh_setup to vlan and change qeth to use the net_device_ops. Do you see any problems?
Or is there a better way to turn off ARP for IPv4 (we still need neighbour solicitation for IPv6 so IFF_NOARP is no option)?
Thanks,
Frank
PATCH 1/2 vlan: add neigh_setup
From: Frank Blaschka <[email protected]>
In case the real device has a neigh_setup function, this neigh_setup function should be used for the vlan device.
--- net/8021q/vlan_dev.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
net/8021q/vlan_dev.c +14 -0
@@ -546,6 +546,18 @@ static int vlan_dev_ioctl(struct net_devreturn err; } +static int vlan_dev_neigh_setup (struct net_device *dev,struct neigh_parms *pa) +{ +struct net_device *real_dev =vlan_dev_info (dev)->real_dev; +const struct net_device_ops *ops = real_dev->netdev_ops; +int err =0 ; + +if (netif_device_present (real_dev) && ops->ndo_neigh_setup) + err = ops->ndo_neigh_setup (dev, pa); + +return err; +} +static void vlan_dev_change_rx_flags (struct net_device *dev,int change) {struct net_device *real_dev =vlan_dev_info (dev)->real_dev;
@@ -713,6 +725,7 @@ static const struct net_device_ops vlan_ .ndo_set_multicast_list = vlan_dev_set_rx_mode, .ndo_change_rx_flags = vlan_dev_change_rx_flags, .ndo_do_ioctl = vlan_dev_ioctl, + .ndo_neigh_setup = vlan_dev_neigh_setup, };static const struct net_device_ops vlan_netdev_accel_ops = {
@@ -728,6 +741,7 @@ static const struct net_device_ops vlan_ .ndo_set_multicast_list = vlan_dev_set_rx_mode, .ndo_change_rx_flags = vlan_dev_change_rx_flags, .ndo_do_ioctl = vlan_dev_ioctl, + .ndo_neigh_setup = vlan_dev_neigh_setup, };void vlan_setup (struct net_device *dev)
David Miller
maintainerRe: [patch 1/2] vlan: add neigh_setup
From: [email protected]
Date: Wed, 07 Jan 2009 13:15:51 +0100
Quoted 4 lines
In case the real device has a
neigh_setupfunction, thisneigh_setupfunction should be used for the vlan device.Signed-off-by Frank Blaschka <[email protected]>
This looks fine, applied.
PATCH 2/2 qeth: convert to net_device_ops
In reply to [email protected]From: Frank Blaschka <[email protected]>
qeth_l2, qeth_l3 convert to net_device_ops.qeth_l3 remove vlan neigh_setup hack since it does not work any longer with the new net_device_ops.
--- drivers/s390/net/qeth_l2_main.c | 27 ++++++++++++-------- drivers/s390/net/qeth_l3_main.c | 53 +++++++++++++--------------------------- 2 files changed, 34 insertions(+), 46 deletions(-)
drivers/s390/net/qeth_l2_main.c +16 -11
@@ -916,6 +916,21 @@ static struct ethtool_ops qeth_l2_osn_op .get_drvinfo = qeth_core_get_drvinfo, }; +static struct net_device_ops qeth_l2_netdev_ops = { + .ndo_open = qeth_l2_open, + .ndo_stop = qeth_l2_stop, + .ndo_get_stats = qeth_get_stats, + .ndo_start_xmit = qeth_l2_hard_start_xmit, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_multicast_list = qeth_l2_set_multicast_list, + .ndo_do_ioctl = qeth_l2_do_ioctl, + .ndo_set_mac_address = qeth_l2_set_mac_address, + .ndo_change_mtu = qeth_change_mtu, + .ndo_vlan_rx_add_vid = qeth_l2_vlan_rx_add_vid, + .ndo_vlan_rx_kill_vid = qeth_l2_vlan_rx_kill_vid, + .ndo_tx_timeout = qeth_tx_timeout, +}; +static int qeth_l2_setup_netdev (struct qeth_card *card) {switch (card->info.type) {
@@ -937,19 +952,9 @@ static int qeth_l2_setup_netdev(struct qreturn -ENODEV ; card->dev->ml_priv = card; - card->dev->tx_timeout = &qeth_tx_timeout; card->dev->watchdog_timeo =QETH_TX_TIMEOUT ; - card->dev->open = qeth_l2_open; - card->dev->stop = qeth_l2_stop; - card->dev->hard_start_xmit = qeth_l2_hard_start_xmit; - card->dev->do_ioctl = qeth_l2_do_ioctl; - card->dev->get_stats = qeth_get_stats; - card->dev->change_mtu = qeth_change_mtu; - card->dev->set_multicast_list = qeth_l2_set_multicast_list; - card->dev->vlan_rx_kill_vid = qeth_l2_vlan_rx_kill_vid; - card->dev->vlan_rx_add_vid = qeth_l2_vlan_rx_add_vid; - card->dev->set_mac_address = qeth_l2_set_mac_address; card->dev->mtu = card->info.initial_mtu; + card->dev->netdev_ops = &qeth_l2_netdev_ops;if (card->info.type !=QETH_CARD_TYPE_OSN )SET_ETHTOOL_OPS (card->dev, &qeth_l2_ethtool_ops);else
drivers/s390/net/qeth_l3_main.c +18 -35
80 lines not on this page · raw message
David Miller
maintainerRe: [patch 2/2] qeth: convert to net_device_ops
From: [email protected]
Date: Wed, 07 Jan 2009 13:15:52 +0100
Quoted 5 lines
qeth_l2,qeth_l3convert tonet_device_ops.qeth_l3remove vlanneigh_setuphack since it does not work any longer with the newnet_device_ops.Signed-off-by Frank Blaschka <[email protected]>
Also applied, thanks.