* [PATCH 2/8] bonding: use net_device_ops
2009-01-05 20:14 [PATCH 0/8] More net_device ops Stephen Hemminger
@ 2009-01-05 20:14 ` Stephen Hemminger
2009-01-06 18:42 ` David Miller
2009-01-05 20:14 ` [PATCH 3/8] wireless: convert wireless ioctl to net_device_ops Stephen Hemminger
` (6 subsequent siblings)
7 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 20:14 UTC (permalink / raw)
To: David Miller, Jay Vosburgh; +Cc: netdev, bonding-devel
[-- Attachment #1: bonding-fix.patch --]
[-- Type: text/plain, Size: 552 bytes --]
Use the correct pointer in debug message.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/bonding/bond_main.c 2009-01-01 22:44:01.785587952 -0800
+++ b/drivers/net/bonding/bond_main.c 2009-01-01 22:45:06.886088340 -0800
@@ -4148,7 +4148,7 @@ static int bond_change_mtu(struct net_de
bond_for_each_slave(bond, slave, i) {
pr_debug("s %p s->p %p c_m %p\n", slave,
- slave->prev, slave->dev->change_mtu);
+ slave->prev, slave->dev->netdev_ops->ndo_change_mtu);
res = dev_set_mtu(slave->dev, new_mtu);
--
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 3/8] wireless: convert wireless ioctl to net_device_ops
2009-01-05 20:14 [PATCH 0/8] More net_device ops Stephen Hemminger
2009-01-05 20:14 ` [PATCH 2/8] bonding: use net_device_ops Stephen Hemminger
@ 2009-01-05 20:14 ` Stephen Hemminger
[not found] ` <20090105201514.442703045-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2009-01-05 20:14 ` [PATCH 4/8] dsa: convert " Stephen Hemminger
` (5 subsequent siblings)
7 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 20:14 UTC (permalink / raw)
To: David Miller, linville; +Cc: netdev, linux-wireless
[-- Attachment #1: wext.patch --]
[-- Type: text/plain, Size: 538 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/wireless/wext.c 2009-01-05 08:40:34.045826527 -0800
+++ b/net/wireless/wext.c 2009-01-05 09:33:27.362505126 -0800
@@ -1055,8 +1055,8 @@ static int wireless_process_ioctl(struct
return private(dev, iwr, cmd, info, handler);
}
/* Old driver API : call driver ioctl handler */
- if (dev->do_ioctl)
- return dev->do_ioctl(dev, ifr, cmd);
+ if (dev->netdev_ops->ndo_do_ioctl)
+ return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
return -EOPNOTSUPP;
}
--
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 4/8] dsa: convert to net_device_ops
2009-01-05 20:14 [PATCH 0/8] More net_device ops Stephen Hemminger
2009-01-05 20:14 ` [PATCH 2/8] bonding: use net_device_ops Stephen Hemminger
2009-01-05 20:14 ` [PATCH 3/8] wireless: convert wireless ioctl to net_device_ops Stephen Hemminger
@ 2009-01-05 20:14 ` Stephen Hemminger
[not found] ` <20090106060705.GG4414@server.marvell.com>
2009-01-05 20:14 ` [PATCH 5/8] virtio: " Stephen Hemminger
` (4 subsequent siblings)
7 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 20:14 UTC (permalink / raw)
To: David Miller, Lennert Buytenhek; +Cc: netdev
[-- Attachment #1: dsa.patch --]
[-- Type: text/plain, Size: 2450 bytes --]
Convert this driver to use net_device_ops
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/dsa/slave.c 2009-01-01 23:05:35.001587658 -0800
+++ b/net/dsa/slave.c 2009-01-01 23:11:20.485585998 -0800
@@ -286,6 +286,39 @@ static const struct ethtool_ops dsa_slav
.get_sset_count = dsa_slave_get_sset_count,
};
+static int dsa_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+ struct dsa_slave_priv *p = netdev_priv(dev);
+ struct dsa_switch *ds = p->parent;
+
+ switch (ds->tag_protocol) {
+#ifdef CONFIG_NET_DSA_TAG_DSA
+ case htons(ETH_P_DSA):
+ return dsa_xmit(skb, dev);
+#endif
+#ifdef CONFIG_NET_DSA_TAG_EDSA
+ case htons(ETH_P_EDSA):
+ return edsa_xmit(skb, dev);
+#endif
+#ifdef CONFIG_NET_DSA_TAG_TRAILER
+ case htons(ETH_P_TRAILER):
+ return trailer_xmit(skb, dev);
+#endif
+ default:
+ BUG();
+ }
+}
+
+static const struct net_device_ops dsa_netdev_ops = {
+ .ndo_open = dsa_slave_open,
+ .ndo_stop = dsa_slave_close,
+ .ndo_start_xmit = dsa_start_xmit,
+ .ndo_change_rx_flags = dsa_slave_change_rx_flags,
+ .ndo_set_rx_mode = dsa_slave_set_rx_mode,
+ .ndo_set_multicast_list = dsa_slave_set_rx_mode,
+ .ndo_set_mac_address = dsa_slave_set_mac_address,
+ .ndo_do_ioctl = dsa_slave_ioctl,
+};
/* slave device setup *******************************************************/
struct net_device *
@@ -306,32 +339,7 @@ dsa_slave_create(struct dsa_switch *ds,
SET_ETHTOOL_OPS(slave_dev, &dsa_slave_ethtool_ops);
memcpy(slave_dev->dev_addr, master->dev_addr, ETH_ALEN);
slave_dev->tx_queue_len = 0;
- switch (ds->tag_protocol) {
-#ifdef CONFIG_NET_DSA_TAG_DSA
- case htons(ETH_P_DSA):
- slave_dev->hard_start_xmit = dsa_xmit;
- break;
-#endif
-#ifdef CONFIG_NET_DSA_TAG_EDSA
- case htons(ETH_P_EDSA):
- slave_dev->hard_start_xmit = edsa_xmit;
- break;
-#endif
-#ifdef CONFIG_NET_DSA_TAG_TRAILER
- case htons(ETH_P_TRAILER):
- slave_dev->hard_start_xmit = trailer_xmit;
- break;
-#endif
- default:
- BUG();
- }
- slave_dev->open = dsa_slave_open;
- slave_dev->stop = dsa_slave_close;
- slave_dev->change_rx_flags = dsa_slave_change_rx_flags;
- slave_dev->set_rx_mode = dsa_slave_set_rx_mode;
- slave_dev->set_multicast_list = dsa_slave_set_rx_mode;
- slave_dev->set_mac_address = dsa_slave_set_mac_address;
- slave_dev->do_ioctl = dsa_slave_ioctl;
+ slave_dev->netdev_ops = &dsa_netdev_ops;
SET_NETDEV_DEV(slave_dev, parent);
slave_dev->vlan_features = master->vlan_features;
--
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 5/8] virtio: convert to net_device_ops
2009-01-05 20:14 [PATCH 0/8] More net_device ops Stephen Hemminger
` (2 preceding siblings ...)
2009-01-05 20:14 ` [PATCH 4/8] dsa: convert " Stephen Hemminger
@ 2009-01-05 20:14 ` Stephen Hemminger
2009-01-06 9:40 ` Mark McLoughlin
2009-01-05 20:14 ` [PATCH 6/8] xen-netfront: " Stephen Hemminger
` (3 subsequent siblings)
7 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 20:14 UTC (permalink / raw)
To: David Miller, Mark McLoughlin; +Cc: netdev
[-- Attachment #1: virtio.patch --]
[-- Type: text/plain, Size: 1231 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/virtio_net.c 2009-01-05 11:24:44.578819161 -0800
+++ b/drivers/net/virtio_net.c 2009-01-05 12:11:17.169569416 -0800
@@ -624,6 +624,18 @@ static int virtnet_change_mtu(struct net
return 0;
}
+static const struct net_device_ops virtnet_netdev = {
+ .ndo_open = virtnet_open,
+ .ndo_stop = virtnet_close,
+ .ndo_start_xmit = start_xmit,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_change_mtu = virtnet_change_mtu,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = virtnet_netpoll,
+#endif
+};
+
static int virtnet_probe(struct virtio_device *vdev)
{
int err;
@@ -636,14 +648,8 @@ static int virtnet_probe(struct virtio_d
return -ENOMEM;
/* Set up network device as normal. */
- dev->open = virtnet_open;
- dev->stop = virtnet_close;
- dev->hard_start_xmit = start_xmit;
- dev->change_mtu = virtnet_change_mtu;
+ dev->netdev_ops = &virtnet_netdev;
dev->features = NETIF_F_HIGHDMA;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = virtnet_netpoll;
-#endif
SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
SET_NETDEV_DEV(dev, &vdev->dev);
--
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 5/8] virtio: convert to net_device_ops
2009-01-05 20:14 ` [PATCH 5/8] virtio: " Stephen Hemminger
@ 2009-01-06 9:40 ` Mark McLoughlin
2009-01-06 18:44 ` David Miller
0 siblings, 1 reply; 26+ messages in thread
From: Mark McLoughlin @ 2009-01-06 9:40 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
On Mon, 2009-01-05 at 12:14 -0800, Stephen Hemminger wrote:
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
>
> --- a/drivers/net/virtio_net.c 2009-01-05 11:24:44.578819161 -0800
> +++ b/drivers/net/virtio_net.c 2009-01-05 12:11:17.169569416 -0800
> @@ -624,6 +624,18 @@ static int virtnet_change_mtu(struct net
> return 0;
> }
>
> +static const struct net_device_ops virtnet_netdev = {
> + .ndo_open = virtnet_open,
> + .ndo_stop = virtnet_close,
> + .ndo_start_xmit = start_xmit,
> + .ndo_validate_addr = eth_validate_addr,
> + .ndo_set_mac_address = eth_mac_addr,
> + .ndo_change_mtu = virtnet_change_mtu,
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> + .ndo_poll_controller = virtnet_netpoll,
> +#endif
> +};
> +
> static int virtnet_probe(struct virtio_device *vdev)
> {
> int err;
> @@ -636,14 +648,8 @@ static int virtnet_probe(struct virtio_d
> return -ENOMEM;
>
> /* Set up network device as normal. */
> - dev->open = virtnet_open;
> - dev->stop = virtnet_close;
> - dev->hard_start_xmit = start_xmit;
> - dev->change_mtu = virtnet_change_mtu;
> + dev->netdev_ops = &virtnet_netdev;
> dev->features = NETIF_F_HIGHDMA;
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> - dev->poll_controller = virtnet_netpoll;
> -#endif
Looks good to me.
Acked-by: Mark McLoughlin <markmc@redhat.com>
Thanks,
Mark.
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 6/8] xen-netfront: convert to net_device_ops
2009-01-05 20:14 [PATCH 0/8] More net_device ops Stephen Hemminger
` (3 preceding siblings ...)
2009-01-05 20:14 ` [PATCH 5/8] virtio: " Stephen Hemminger
@ 2009-01-05 20:14 ` Stephen Hemminger
2009-01-06 0:17 ` Jeremy Fitzhardinge
2009-01-06 18:45 ` David Miller
2009-01-05 20:14 ` [PATCH 7/8] infiniband: driver API update Stephen Hemminger
` (2 subsequent siblings)
7 siblings, 2 replies; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 20:14 UTC (permalink / raw)
To: David Miller, Jeremy Fitzhardinge; +Cc: netdev
[-- Attachment #1: xen-netfront.patch --]
[-- Type: text/plain, Size: 1307 bytes --]
Convert Xen device to new API.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/xen-netfront.c 2009-01-05 12:10:31.373819168 -0800
+++ b/drivers/net/xen-netfront.c 2009-01-05 12:11:22.754068943 -0800
@@ -1105,6 +1105,16 @@ static void xennet_uninit(struct net_dev
gnttab_free_grant_references(np->gref_rx_head);
}
+static const struct net_device_ops xennet_netdev_ops = {
+ .ndo_open = xennet_open,
+ .ndo_uninit = xennet_uninit,
+ .ndo_stop = xennet_close,
+ .ndo_start_xmit = xennet_start_xmit,
+ .ndo_change_mtu = xennet_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev)
{
int i, err;
@@ -1161,12 +1171,9 @@ static struct net_device * __devinit xen
goto exit_free_tx;
}
- netdev->open = xennet_open;
- netdev->hard_start_xmit = xennet_start_xmit;
- netdev->stop = xennet_close;
+ netdev->netdev_ops = &xennet_netdev_ops;
+
netif_napi_add(netdev, &np->napi, xennet_poll, 64);
- netdev->uninit = xennet_uninit;
- netdev->change_mtu = xennet_change_mtu;
netdev->features = NETIF_F_IP_CSUM;
SET_ETHTOOL_OPS(netdev, &xennet_ethtool_ops);
--
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 7/8] infiniband: driver API update
2009-01-05 20:14 [PATCH 0/8] More net_device ops Stephen Hemminger
` (4 preceding siblings ...)
2009-01-05 20:14 ` [PATCH 6/8] xen-netfront: " Stephen Hemminger
@ 2009-01-05 20:14 ` Stephen Hemminger
2009-01-05 21:02 ` Roland Dreier
2009-01-05 20:14 ` [PATCH 8/8] sch_teql: convert to net_device_ops Stephen Hemminger
[not found] ` <20090105201514.192918670@vyatta.com>
7 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 20:14 UTC (permalink / raw)
To: David Miller, Roland Dreier, Sean Hefty, Hal Rosenstock; +Cc: netdev, general
[-- Attachment #1: ib.patch --]
[-- Type: text/plain, Size: 6119 bytes --]
Do some driver API updates on the IB drivers:
* remove last_rx
* use internal net_device_stats
* convert to use net_device_ops
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/infiniband/hw/amso1100/c2.c 2009-01-05 12:11:28.942819613 -0800
+++ b/drivers/infiniband/hw/amso1100/c2.c 2009-01-05 12:11:32.537821389 -0800
@@ -76,7 +76,6 @@ static irqreturn_t c2_interrupt(int irq,
static void c2_tx_timeout(struct net_device *netdev);
static int c2_change_mtu(struct net_device *netdev, int new_mtu);
static void c2_reset(struct c2_port *c2_port);
-static struct net_device_stats *c2_get_stats(struct net_device *netdev);
static struct pci_device_id c2_pci_table[] = {
{ PCI_DEVICE(0x18b8, 0xb001) },
@@ -531,7 +530,6 @@ static void c2_rx_interrupt(struct net_d
netif_rx(skb);
- netdev->last_rx = jiffies;
c2_port->netstats.rx_packets++;
c2_port->netstats.rx_bytes += buflen;
}
@@ -880,6 +878,17 @@ static int c2_change_mtu(struct net_devi
return ret;
}
+static const struct net_device_ops c2_netdev_ops = {
+ .ndo_open = c2_up,
+ .ndo_stop = c2_down,
+ .ndo_start_xmit = c2_xmit_frame,
+ .ndo_get_stats = c2_get_stats,
+ .ndo_tx_timeout = c2_tx_timeout,
+ .ndo_change_mtu = c2_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
/* Initialize network device */
static struct net_device *c2_devinit(struct c2_dev *c2dev,
void __iomem * mmio_addr)
@@ -894,12 +903,7 @@ static struct net_device *c2_devinit(str
SET_NETDEV_DEV(netdev, &c2dev->pcidev->dev);
- netdev->open = c2_up;
- netdev->stop = c2_down;
- netdev->hard_start_xmit = c2_xmit_frame;
- netdev->get_stats = c2_get_stats;
- netdev->tx_timeout = c2_tx_timeout;
- netdev->change_mtu = c2_change_mtu;
+ netdev->netdev_ops = &c2_netdev_ops;
netdev->watchdog_timeo = C2_TX_TIMEOUT;
netdev->irq = c2dev->pcidev->irq;
--- a/drivers/infiniband/hw/amso1100/c2_provider.c 2009-01-05 12:11:28.930819448 -0800
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c 2009-01-05 12:11:32.537821389 -0800
@@ -719,15 +719,17 @@ static int c2_pseudo_change_mtu(struct n
return ret;
}
+static const struct net_device_ops c2_netdev_ops = {
+ .ndo_open = c2_pseudo_up,
+ .ndo_stop = c2_pseudo_down,
+ .ndo_start_xmit = c2_pseudo_xmit_frame,
+ .ndo_change_mtu = c2_pseudo_change_mtu,
+};
+
+
static void setup(struct net_device *netdev)
{
- netdev->open = c2_pseudo_up;
- netdev->stop = c2_pseudo_down;
- netdev->hard_start_xmit = c2_pseudo_xmit_frame;
- netdev->get_stats = NULL;
- netdev->tx_timeout = NULL;
- netdev->set_mac_address = NULL;
- netdev->change_mtu = c2_pseudo_change_mtu;
+ netdev->netdev_ops = &c2_netdev_ops;
netdev->watchdog_timeo = 0;
netdev->type = ARPHRD_ETHER;
netdev->mtu = 1500;
@@ -735,7 +737,6 @@ static void setup(struct net_device *net
netdev->addr_len = ETH_ALEN;
netdev->tx_queue_len = 0;
netdev->flags |= IFF_NOARP;
- return;
}
static struct net_device *c2_pseudo_netdev_init(struct c2_dev *c2dev)
--- a/drivers/infiniband/hw/nes/nes_nic.c 2009-01-05 12:11:28.958819510 -0800
+++ b/drivers/infiniband/hw/nes/nes_nic.c 2009-01-05 12:11:32.541819495 -0800
@@ -1568,6 +1568,19 @@ static void nes_netdev_vlan_rx_register(
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
}
+static const struct net_device_ops nes_netdev_ops = {
+ .ndo_open = nes_netdev_open,
+ .ndo_stop = nes_netdev_stop,
+ .ndo_start_xmit = nes_netdev_start_xmit,
+ .ndo_get_stats = nes_netdev_get_stats,
+ .ndo_tx_timeout = nes_netdev_tx_timeout,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = nes_netdev_set_mac_address,
+ .ndo_set_multicast_list = nes_netdev_set_multicast_list,
+ .ndo_change_mtu = nes_netdev_change_mtu,
+ .ndo_vlan_rx_register = nes_netdev_vlan_rx_register,
+};
+
/**
* nes_netdev_init - initialize network device
@@ -1596,14 +1609,7 @@ struct net_device *nes_netdev_init(struc
nesvnic = netdev_priv(netdev);
memset(nesvnic, 0, sizeof(*nesvnic));
- netdev->open = nes_netdev_open;
- netdev->stop = nes_netdev_stop;
- netdev->hard_start_xmit = nes_netdev_start_xmit;
- netdev->get_stats = nes_netdev_get_stats;
- netdev->tx_timeout = nes_netdev_tx_timeout;
- netdev->set_mac_address = nes_netdev_set_mac_address;
- netdev->set_multicast_list = nes_netdev_set_multicast_list;
- netdev->change_mtu = nes_netdev_change_mtu;
+ netdev->netdev_ops = &nes_netdev_ops;
netdev->watchdog_timeo = NES_TX_TIMEOUT;
netdev->irq = nesdev->pcidev->irq;
netdev->mtu = ETH_DATA_LEN;
@@ -1615,7 +1621,6 @@ struct net_device *nes_netdev_init(struc
netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
- netdev->vlan_rx_register = nes_netdev_vlan_rx_register;
netdev->features |= NETIF_F_LLTX;
/* Fill in the port structure */
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c 2009-01-05 12:11:28.922818928 -0800
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c 2009-01-05 12:11:32.541819495 -0800
@@ -1013,18 +1013,22 @@ static void ipoib_lro_setup(struct ipoib
priv->lro.lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
}
+static const struct net_device_ops ipoib_netdev_ops = {
+ .ndo_open = ipoib_open,
+ .ndo_stop = ipoib_stop,
+ .ndo_change_mtu = ipoib_change_mtu,
+ .ndo_start_xmit = ipoib_start_xmit,
+ .ndo_tx_timeout = ipoib_timeout,
+ .ndo_set_multicast_list = ipoib_set_mcast_list,
+ .ndo_neigh_setup = ipoib_neigh_setup_dev,
+};
+
static void ipoib_setup(struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
- dev->open = ipoib_open;
- dev->stop = ipoib_stop;
- dev->change_mtu = ipoib_change_mtu;
- dev->hard_start_xmit = ipoib_start_xmit;
- dev->tx_timeout = ipoib_timeout;
- dev->header_ops = &ipoib_header_ops;
- dev->set_multicast_list = ipoib_set_mcast_list;
- dev->neigh_setup = ipoib_neigh_setup_dev;
+ dev->netdev_ops = &ipoib_netdev_ops;
+ dev->header_ops = &ipoib_header_ops;
ipoib_set_ethtool_ops(dev);
--
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 7/8] infiniband: driver API update
2009-01-05 20:14 ` [PATCH 7/8] infiniband: driver API update Stephen Hemminger
@ 2009-01-05 21:02 ` Roland Dreier
2009-01-05 21:22 ` [ofa-general] [PATCH 1/3] infiniband: amso100 convert to net_device_ops Stephen Hemminger
2009-01-06 18:45 ` [ofa-general] Re: [PATCH 7/8] infiniband: driver API update David Miller
0 siblings, 2 replies; 26+ messages in thread
From: Roland Dreier @ 2009-01-05 21:02 UTC (permalink / raw)
To: Stephen Hemminger
Cc: David Miller, Roland Dreier, Sean Hefty, Hal Rosenstock, netdev,
general
Looks good enough, so Dave if you want to merge it, you can add
Acked-by: Roland Dreier <rolandd@cisco.com>
or let me know if you want me to pull it in through my tree. A couple
of nits that are probably not worth fixing. First, globally, it might
be slightly nicer to merge this as one patch per module, rather than all
lumped together. And also:
> +static const struct net_device_ops c2_netdev_ops = {
> + .ndo_open = c2_pseudo_up,
> + .ndo_stop = c2_pseudo_down,
> + .ndo_start_xmit = c2_pseudo_xmit_frame,
> + .ndo_change_mtu = c2_pseudo_change_mtu,
> +};
> +
> +
would have preferred only one empty line here.
> @@ -735,7 +737,6 @@ static void setup(struct net_device *net
> netdev->addr_len = ETH_ALEN;
> netdev->tx_queue_len = 0;
> netdev->flags |= IFF_NOARP;
> - return;
> }
>
> static struct net_device *c2_pseudo_netdev_init(struct c2_dev *c2dev)
would preferred to leave out unrelated changes.
> +static const struct net_device_ops nes_netdev_ops = {
> + .ndo_open = nes_netdev_open,
> + .ndo_stop = nes_netdev_stop,
> + .ndo_start_xmit = nes_netdev_start_xmit,
> + .ndo_get_stats = nes_netdev_get_stats,
> + .ndo_tx_timeout = nes_netdev_tx_timeout,
> + .ndo_validate_addr = eth_validate_addr,
> + .ndo_set_mac_address = nes_netdev_set_mac_address,
> + .ndo_set_multicast_list = nes_netdev_set_multicast_list,
> + .ndo_change_mtu = nes_netdev_change_mtu,
> + .ndo_vlan_rx_register = nes_netdev_vlan_rx_register,
> +};
> +
>
> /**
extra blank line here too.
- R.
^ permalink raw reply [flat|nested] 26+ messages in thread
* [ofa-general] [PATCH 1/3] infiniband: amso100 convert to net_device_ops
2009-01-05 21:02 ` Roland Dreier
@ 2009-01-05 21:22 ` Stephen Hemminger
2009-01-05 21:22 ` [ofa-general] [PATCH 2/3] infiniband: nes_nic " Stephen Hemminger
2009-01-06 18:45 ` [ofa-general] Re: [PATCH 7/8] infiniband: driver API update David Miller
1 sibling, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 21:22 UTC (permalink / raw)
To: Roland Dreier; +Cc: netdev, general, David Miller
Convert to net_device_ops and remove leftover last_rx.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/infiniband/hw/amso1100/c2.c 2009-01-05 13:14:20.990323888 -0800
+++ b/drivers/infiniband/hw/amso1100/c2.c 2009-01-05 13:16:48.581570680 -0800
@@ -76,7 +76,6 @@ static irqreturn_t c2_interrupt(int irq,
static void c2_tx_timeout(struct net_device *netdev);
static int c2_change_mtu(struct net_device *netdev, int new_mtu);
static void c2_reset(struct c2_port *c2_port);
-static struct net_device_stats *c2_get_stats(struct net_device *netdev);
static struct pci_device_id c2_pci_table[] = {
{ PCI_DEVICE(0x18b8, 0xb001) },
@@ -531,7 +530,6 @@ static void c2_rx_interrupt(struct net_d
netif_rx(skb);
- netdev->last_rx = jiffies;
c2_port->netstats.rx_packets++;
c2_port->netstats.rx_bytes += buflen;
}
@@ -880,6 +878,17 @@ static int c2_change_mtu(struct net_devi
return ret;
}
+static const struct net_device_ops c2_netdev_ops = {
+ .ndo_open = c2_up,
+ .ndo_stop = c2_down,
+ .ndo_start_xmit = c2_xmit_frame,
+ .ndo_get_stats = c2_get_stats,
+ .ndo_tx_timeout = c2_tx_timeout,
+ .ndo_change_mtu = c2_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
/* Initialize network device */
static struct net_device *c2_devinit(struct c2_dev *c2dev,
void __iomem * mmio_addr)
@@ -894,12 +903,7 @@ static struct net_device *c2_devinit(str
SET_NETDEV_DEV(netdev, &c2dev->pcidev->dev);
- netdev->open = c2_up;
- netdev->stop = c2_down;
- netdev->hard_start_xmit = c2_xmit_frame;
- netdev->get_stats = c2_get_stats;
- netdev->tx_timeout = c2_tx_timeout;
- netdev->change_mtu = c2_change_mtu;
+ netdev->netdev_ops = &c2_netdev_ops;
netdev->watchdog_timeo = C2_TX_TIMEOUT;
netdev->irq = c2dev->pcidev->irq;
--- a/drivers/infiniband/hw/amso1100/c2_provider.c 2009-01-05 13:14:20.978323767 -0800
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c 2009-01-05 13:17:09.911803913 -0800
@@ -719,15 +719,16 @@ static int c2_pseudo_change_mtu(struct n
return ret;
}
+static const struct net_device_ops c2_netdev_ops = {
+ .ndo_open = c2_pseudo_up,
+ .ndo_stop = c2_pseudo_down,
+ .ndo_start_xmit = c2_pseudo_xmit_frame,
+ .ndo_change_mtu = c2_pseudo_change_mtu,
+};
+
static void setup(struct net_device *netdev)
{
- netdev->open = c2_pseudo_up;
- netdev->stop = c2_pseudo_down;
- netdev->hard_start_xmit = c2_pseudo_xmit_frame;
- netdev->get_stats = NULL;
- netdev->tx_timeout = NULL;
- netdev->set_mac_address = NULL;
- netdev->change_mtu = c2_pseudo_change_mtu;
+ netdev->netdev_ops = &c2_netdev_ops;
netdev->watchdog_timeo = 0;
netdev->type = ARPHRD_ETHER;
netdev->mtu = 1500;
^ permalink raw reply [flat|nested] 26+ messages in thread
* [ofa-general] [PATCH 2/3] infiniband: nes_nic convert to net_device_ops
2009-01-05 21:22 ` [ofa-general] [PATCH 1/3] infiniband: amso100 convert to net_device_ops Stephen Hemminger
@ 2009-01-05 21:22 ` Stephen Hemminger
2009-01-05 21:23 ` [ofa-general] [PATCH 3/3] infiniband: ipoib " Stephen Hemminger
0 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 21:22 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Hal, netdev, Roland Dreier, general, David Miller
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/infiniband/hw/nes/nes_nic.c 2009-01-05 13:14:21.022323208 -0800
+++ b/drivers/infiniband/hw/nes/nes_nic.c 2009-01-05 13:18:32.554124317 -0800
@@ -1568,6 +1568,18 @@ static void nes_netdev_vlan_rx_register(
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
}
+static const struct net_device_ops nes_netdev_ops = {
+ .ndo_open = nes_netdev_open,
+ .ndo_stop = nes_netdev_stop,
+ .ndo_start_xmit = nes_netdev_start_xmit,
+ .ndo_get_stats = nes_netdev_get_stats,
+ .ndo_tx_timeout = nes_netdev_tx_timeout,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = nes_netdev_set_mac_address,
+ .ndo_set_multicast_list = nes_netdev_set_multicast_list,
+ .ndo_change_mtu = nes_netdev_change_mtu,
+ .ndo_vlan_rx_register = nes_netdev_vlan_rx_register,
+};
/**
* nes_netdev_init - initialize network device
@@ -1596,14 +1608,7 @@ struct net_device *nes_netdev_init(struc
nesvnic = netdev_priv(netdev);
memset(nesvnic, 0, sizeof(*nesvnic));
- netdev->open = nes_netdev_open;
- netdev->stop = nes_netdev_stop;
- netdev->hard_start_xmit = nes_netdev_start_xmit;
- netdev->get_stats = nes_netdev_get_stats;
- netdev->tx_timeout = nes_netdev_tx_timeout;
- netdev->set_mac_address = nes_netdev_set_mac_address;
- netdev->set_multicast_list = nes_netdev_set_multicast_list;
- netdev->change_mtu = nes_netdev_change_mtu;
+ netdev->netdev_ops = &nes_netdev_ops;
netdev->watchdog_timeo = NES_TX_TIMEOUT;
netdev->irq = nesdev->pcidev->irq;
netdev->mtu = ETH_DATA_LEN;
@@ -1615,7 +1620,6 @@ struct net_device *nes_netdev_init(struc
netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
- netdev->vlan_rx_register = nes_netdev_vlan_rx_register;
netdev->features |= NETIF_F_LLTX;
/* Fill in the port structure */
^ permalink raw reply [flat|nested] 26+ messages in thread
* [ofa-general] [PATCH 3/3] infiniband: ipoib convert to net_device_ops
2009-01-05 21:22 ` [ofa-general] [PATCH 2/3] infiniband: nes_nic " Stephen Hemminger
@ 2009-01-05 21:23 ` Stephen Hemminger
2009-01-06 5:07 ` Roland Dreier
0 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 21:23 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Hal, netdev, Roland Dreier, general, David Miller
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c 2009-01-05 13:14:20.970318942 -0800
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c 2009-01-05 13:19:46.657819176 -0800
@@ -1013,18 +1013,22 @@ static void ipoib_lro_setup(struct ipoib
priv->lro.lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
}
+static const struct net_device_ops ipoib_netdev_ops = {
+ .ndo_open = ipoib_open,
+ .ndo_stop = ipoib_stop,
+ .ndo_change_mtu = ipoib_change_mtu,
+ .ndo_start_xmit = ipoib_start_xmit,
+ .ndo_tx_timeout = ipoib_timeout,
+ .ndo_set_multicast_list = ipoib_set_mcast_list,
+ .ndo_neigh_setup = ipoib_neigh_setup_dev,
+};
+
static void ipoib_setup(struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
- dev->open = ipoib_open;
- dev->stop = ipoib_stop;
- dev->change_mtu = ipoib_change_mtu;
- dev->hard_start_xmit = ipoib_start_xmit;
- dev->tx_timeout = ipoib_timeout;
- dev->header_ops = &ipoib_header_ops;
- dev->set_multicast_list = ipoib_set_mcast_list;
- dev->neigh_setup = ipoib_neigh_setup_dev;
+ dev->netdev_ops = &ipoib_netdev_ops;
+ dev->header_ops = &ipoib_header_ops;
ipoib_set_ethtool_ops(dev);
^ permalink raw reply [flat|nested] 26+ messages in thread
* [ofa-general] Re: [PATCH 7/8] infiniband: driver API update
2009-01-05 21:02 ` Roland Dreier
2009-01-05 21:22 ` [ofa-general] [PATCH 1/3] infiniband: amso100 convert to net_device_ops Stephen Hemminger
@ 2009-01-06 18:45 ` David Miller
1 sibling, 0 replies; 26+ messages in thread
From: David Miller @ 2009-01-06 18:45 UTC (permalink / raw)
To: rdreier; +Cc: netdev, general, shemminger
From: Roland Dreier <rdreier@cisco.com>
Date: Mon, 05 Jan 2009 13:02:15 -0800
> Looks good enough, so Dave if you want to merge it, you can add
>
> Acked-by: Roland Dreier <rolandd@cisco.com>
>
> or let me know if you want me to pull it in through my tree. A couple
> of nits that are probably not worth fixing. First, globally, it might
> be slightly nicer to merge this as one patch per module, rather than all
> lumped together. And also:
This is superceded by the 3 patch set Roland took into his tree
so this patch doesn't need to be applied :-)
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 8/8] sch_teql: convert to net_device_ops
2009-01-05 20:14 [PATCH 0/8] More net_device ops Stephen Hemminger
` (5 preceding siblings ...)
2009-01-05 20:14 ` [PATCH 7/8] infiniband: driver API update Stephen Hemminger
@ 2009-01-05 20:14 ` Stephen Hemminger
2009-01-06 18:46 ` David Miller
[not found] ` <20090105201514.192918670@vyatta.com>
7 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2009-01-05 20:14 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: sch_teql.patch --]
[-- Type: text/plain, Size: 1862 bytes --]
Convert this driver to net_device_ops.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/sched/sch_teql.c 2009-01-04 21:54:09.746040057 -0800
+++ b/net/sched/sch_teql.c 2009-01-04 22:12:59.598053054 -0800
@@ -289,9 +289,9 @@ restart:
do {
struct net_device *slave = qdisc_dev(q);
- struct netdev_queue *slave_txq;
+ struct netdev_queue *slave_txq = netdev_get_tx_queue(slave, 0);
+ const struct net_device_ops *slave_ops = slave->netdev_ops;
- slave_txq = netdev_get_tx_queue(slave, 0);
if (slave_txq->qdisc_sleeping != q)
continue;
if (__netif_subqueue_stopped(slave, subq) ||
@@ -305,7 +305,7 @@ restart:
if (__netif_tx_trylock(slave_txq)) {
if (!netif_tx_queue_stopped(slave_txq) &&
!netif_tx_queue_frozen(slave_txq) &&
- slave->hard_start_xmit(skb, slave) == 0) {
+ slave_ops->ndo_start_xmit(skb, slave) == 0) {
__netif_tx_unlock(slave_txq);
master->slaves = NEXT_SLAVE(q);
netif_wake_queue(dev);
@@ -420,6 +420,14 @@ static int teql_master_mtu(struct net_de
return 0;
}
+static const struct net_device_ops teql_netdev_ops = {
+ .ndo_open = teql_master_open,
+ .ndo_stop = teql_master_close,
+ .ndo_start_xmit = teql_master_xmit,
+ .ndo_get_stats = teql_master_stats,
+ .ndo_change_mtu = teql_master_mtu,
+};
+
static __init void teql_master_setup(struct net_device *dev)
{
struct teql_master *master = netdev_priv(dev);
@@ -436,11 +444,7 @@ static __init void teql_master_setup(str
ops->destroy = teql_destroy;
ops->owner = THIS_MODULE;
- dev->open = teql_master_open;
- dev->hard_start_xmit = teql_master_xmit;
- dev->stop = teql_master_close;
- dev->get_stats = teql_master_stats;
- dev->change_mtu = teql_master_mtu;
+ dev->netdev_ops = &teql_netdev_ops;
dev->type = ARPHRD_VOID;
dev->mtu = 1500;
dev->tx_queue_len = 100;
--
^ permalink raw reply [flat|nested] 26+ messages in thread
[parent not found: <20090105201514.192918670@vyatta.com>]