* [PATCH 01/42] appletalk: convert aarp to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:21 ` David Miller
2009-01-07 0:33 ` [PATCH 02/42] appletalk: convert ipddp " Stephen Hemminger
` (39 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, acme; +Cc: netdev
[-- Attachment #1: atalk-aarp.patch --]
[-- Type: text/plain, Size: 977 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/appletalk/aarp.c 2009-01-03 20:42:09.251514959 -0800
+++ b/net/appletalk/aarp.c 2009-01-03 20:44:24.182763615 -0800
@@ -443,13 +443,14 @@ static void aarp_send_probe_phase1(struc
{
struct ifreq atreq;
struct sockaddr_at *sa = (struct sockaddr_at *)&atreq.ifr_addr;
+ const struct net_device_ops *ops = iface->dev->netdev_ops;
sa->sat_addr.s_node = iface->address.s_node;
sa->sat_addr.s_net = ntohs(iface->address.s_net);
/* We pass the Net:Node to the drivers/cards by a Device ioctl. */
- if (!(iface->dev->do_ioctl(iface->dev, &atreq, SIOCSIFADDR))) {
- (void)iface->dev->do_ioctl(iface->dev, &atreq, SIOCGIFADDR);
+ if (!(ops->ndo_do_ioctl(iface->dev, &atreq, SIOCSIFADDR))) {
+ ops->ndo_do_ioctl(iface->dev, &atreq, SIOCGIFADDR);
if (iface->address.s_net != htons(sa->sat_addr.s_net) ||
iface->address.s_node != sa->sat_addr.s_node)
iface->status |= ATIF_PROBE_FAIL;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 01/42] appletalk: convert aarp to net_device_ops
2009-01-07 0:33 ` [PATCH 01/42] appletalk: convert aarp to net_device_ops Stephen Hemminger
@ 2009-01-08 1:21 ` David Miller
2009-01-08 3:09 ` Joe Perches
0 siblings, 1 reply; 95+ messages in thread
From: David Miller @ 2009-01-08 1:21 UTC (permalink / raw)
To: shemminger; +Cc: acme, netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 06 Jan 2009 16:33:17 -0800
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [PATCH 01/42] appletalk: convert aarp to net_device_ops
2009-01-08 1:21 ` David Miller
@ 2009-01-08 3:09 ` Joe Perches
2009-01-08 4:39 ` David Miller
0 siblings, 1 reply; 95+ messages in thread
From: Joe Perches @ 2009-01-08 3:09 UTC (permalink / raw)
To: David Miller; +Cc: shemminger, acme, netdev
On Wed, 2009-01-07 at 17:21 -0800, David Miller wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> Applied.
Was it necessary to preface ndo_ to all the netdev_ops members?
It's a bit hungarian compared to most all kernel sources.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [PATCH 01/42] appletalk: convert aarp to net_device_ops
2009-01-08 3:09 ` Joe Perches
@ 2009-01-08 4:39 ` David Miller
0 siblings, 0 replies; 95+ messages in thread
From: David Miller @ 2009-01-08 4:39 UTC (permalink / raw)
To: joe; +Cc: shemminger, acme, netdev
From: Joe Perches <joe@perches.com>
Date: Wed, 07 Jan 2009 19:09:32 -0800
> On Wed, 2009-01-07 at 17:21 -0800, David Miller wrote:
> > From: Stephen Hemminger <shemminger@vyatta.com>
> > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > Applied.
>
> Was it necessary to preface ndo_ to all the netdev_ops members?
> It's a bit hungarian compared to most all kernel sources.
Yes, so that it is easily grep'able, I explicitly asked
Stephen Hemminger to make it this way.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [PATCH 02/42] appletalk: convert ipddp to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
2009-01-07 0:33 ` [PATCH 01/42] appletalk: convert aarp to net_device_ops Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:22 ` David Miller
2009-01-07 0:33 ` [PATCH 03/42] bluetooth: driver API update Stephen Hemminger
` (38 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, acme; +Cc: netdev
[-- Attachment #1: atalk-ipddp.patch --]
[-- Type: text/plain, Size: 2484 bytes --]
Use internal element in network device for stats as well.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/appletalk/ipddp.c 2009-01-03 20:46:13.188014787 -0800
+++ b/drivers/net/appletalk/ipddp.c 2009-01-03 20:49:05.822763901 -0800
@@ -48,12 +48,18 @@ static int ipddp_mode = IPDDP_DECAP;
/* Index to functions, as function prototypes. */
static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev);
-static struct net_device_stats *ipddp_get_stats(struct net_device *dev);
static int ipddp_create(struct ipddp_route *new_rt);
static int ipddp_delete(struct ipddp_route *rt);
static struct ipddp_route* ipddp_find_route(struct ipddp_route *rt);
static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
+static const struct net_device_ops ipddp_netdev_ops = {
+ .ndo_start_xmit = ipddp_xmit,
+ .ndo_do_ioctl = ipddp_ioctl,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
static struct net_device * __init ipddp_init(void)
{
@@ -61,7 +67,7 @@ static struct net_device * __init ipddp_
struct net_device *dev;
int err;
- dev = alloc_etherdev(sizeof(struct net_device_stats));
+ dev = alloc_etherdev(0);
if (!dev)
return ERR_PTR(-ENOMEM);
@@ -71,9 +77,7 @@ static struct net_device * __init ipddp_
printk(version);
/* Initalize the device structure. */
- dev->hard_start_xmit = ipddp_xmit;
- dev->get_stats = ipddp_get_stats;
- dev->do_ioctl = ipddp_ioctl;
+ dev->netdev_ops = &ipddp_netdev_ops;
dev->type = ARPHRD_IPDDP; /* IP over DDP tunnel */
dev->mtu = 585;
@@ -103,13 +107,6 @@ static struct net_device * __init ipddp_
return dev;
}
-/*
- * Get the current statistics. This may be called with the card open or closed.
- */
-static struct net_device_stats *ipddp_get_stats(struct net_device *dev)
-{
- return netdev_priv(dev);
-}
/*
* Transmit LLAP/ELAP frame using aarp_send_ddp.
@@ -170,8 +167,8 @@ static int ipddp_xmit(struct sk_buff *sk
skb->protocol = htons(ETH_P_ATALK); /* Protocol has changed */
- ((struct net_device_stats *) netdev_priv(dev))->tx_packets++;
- ((struct net_device_stats *) netdev_priv(dev))->tx_bytes += skb->len;
+ dev->stats.tx_packets++;
+ dev->stats.tx_bytes += skb->len;
if(aarp_send_ddp(rt->dev, skb, &rt->at, NULL) < 0)
dev_kfree_skb(skb);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 03/42] bluetooth: driver API update
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
2009-01-07 0:33 ` [PATCH 01/42] appletalk: convert aarp to net_device_ops Stephen Hemminger
2009-01-07 0:33 ` [PATCH 02/42] appletalk: convert ipddp " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
[not found] ` <20090107003345.753201945-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2009-01-07 0:33 ` [PATCH 05/42] cassini: update to net_device_ops Stephen Hemminger
` (37 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, marcel; +Cc: netdev, linux-bluetooth
[-- Attachment #1: bluetooth.patch --]
[-- Type: text/plain, Size: 3912 bytes --]
Convert to net_device_ops and use internal net_device_stats in bnep
device.
Note: no need for bnep_net_ioctl since if ioctl is not set, then
dev_ifsioc handles it by returning -EOPNOTSUPP
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
net/bluetooth/bnep/bnep.h | 1 -
net/bluetooth/bnep/core.c | 12 ++++++------
net/bluetooth/bnep/netdev.c | 33 +++++++++++++--------------------
3 files changed, 19 insertions(+), 27 deletions(-)
--- a/net/bluetooth/bnep/bnep.h 2009-01-06 15:36:57.660614286 -0800
+++ b/net/bluetooth/bnep/bnep.h 2009-01-06 15:49:48.920360342 -0800
@@ -165,7 +165,6 @@ struct bnep_session {
struct socket *sock;
struct net_device *dev;
- struct net_device_stats stats;
};
void bnep_net_setup(struct net_device *dev);
--- a/net/bluetooth/bnep/netdev.c 2009-01-06 15:36:57.652614285 -0800
+++ b/net/bluetooth/bnep/netdev.c 2009-01-06 16:13:10.628360045 -0800
@@ -55,12 +55,6 @@ static int bnep_net_close(struct net_dev
return 0;
}
-static struct net_device_stats *bnep_net_get_stats(struct net_device *dev)
-{
- struct bnep_session *s = netdev_priv(dev);
- return &s->stats;
-}
-
static void bnep_net_set_mc_list(struct net_device *dev)
{
#ifdef CONFIG_BT_BNEP_MC_FILTER
@@ -128,11 +122,6 @@ static void bnep_net_timeout(struct net_
netif_wake_queue(dev);
}
-static int bnep_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
- return -EINVAL;
-}
-
#ifdef CONFIG_BT_BNEP_MC_FILTER
static inline int bnep_net_mc_filter(struct sk_buff *skb, struct bnep_session *s)
{
@@ -217,6 +206,18 @@ static int bnep_net_xmit(struct sk_buff
return 0;
}
+static const struct net_device_ops bnep_netdev_ops = {
+ .ndo_open = bnep_net_open,
+ .ndo_stop = bnep_net_close,
+ .ndo_start_xmit = bnep_net_xmit,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_multicast_list = bnep_net_set_mc_list,
+ .ndo_set_mac_address = bnep_net_set_mac_addr,
+ .ndo_tx_timeout = bnep_net_timeout,
+ .ndo_change_mtu = eth_change_mtu,
+
+};
+
void bnep_net_setup(struct net_device *dev)
{
@@ -224,15 +225,7 @@ void bnep_net_setup(struct net_device *d
dev->addr_len = ETH_ALEN;
ether_setup(dev);
-
- dev->open = bnep_net_open;
- dev->stop = bnep_net_close;
- dev->hard_start_xmit = bnep_net_xmit;
- dev->get_stats = bnep_net_get_stats;
- dev->do_ioctl = bnep_net_ioctl;
- dev->set_mac_address = bnep_net_set_mac_addr;
- dev->set_multicast_list = bnep_net_set_mc_list;
+ dev->netdev_ops = &bnep_netdev_ops;
dev->watchdog_timeo = HZ * 2;
- dev->tx_timeout = bnep_net_timeout;
}
--- a/net/bluetooth/bnep/core.c 2009-01-06 15:36:57.668614314 -0800
+++ b/net/bluetooth/bnep/core.c 2009-01-06 15:49:48.920360342 -0800
@@ -306,7 +306,7 @@ static inline int bnep_rx_frame(struct b
struct sk_buff *nskb;
u8 type;
- s->stats.rx_bytes += skb->len;
+ dev->stats.rx_bytes += skb->len;
type = *(u8 *) skb->data; skb_pull(skb, 1);
@@ -343,7 +343,7 @@ static inline int bnep_rx_frame(struct b
* may not be modified and because of the alignment requirements. */
nskb = alloc_skb(2 + ETH_HLEN + skb->len, GFP_KERNEL);
if (!nskb) {
- s->stats.rx_dropped++;
+ dev->stats.rx_dropped++;
kfree_skb(skb);
return -ENOMEM;
}
@@ -378,14 +378,14 @@ static inline int bnep_rx_frame(struct b
skb_copy_from_linear_data(skb, __skb_put(nskb, skb->len), skb->len);
kfree_skb(skb);
- s->stats.rx_packets++;
+ dev->stats.rx_packets++;
nskb->ip_summed = CHECKSUM_NONE;
nskb->protocol = eth_type_trans(nskb, dev);
netif_rx_ni(nskb);
return 0;
badframe:
- s->stats.rx_errors++;
+ dev->stats.rx_errors++;
kfree_skb(skb);
return 0;
}
@@ -448,8 +448,8 @@ send:
kfree_skb(skb);
if (len > 0) {
- s->stats.tx_bytes += len;
- s->stats.tx_packets++;
+ s->dev->stats.tx_bytes += len;
+ s->dev->stats.tx_packets++;
return 0;
}
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 05/42] cassini: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (2 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 03/42] bluetooth: driver API update Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:25 ` David Miller
2009-01-07 0:33 ` [PATCH 06/42] ipg: " Stephen Hemminger
` (36 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: cassini.patch --]
[-- Type: text/plain, Size: 1650 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/cassini.c 2009-01-03 21:36:30.471764781 -0800
+++ b/drivers/net/cassini.c 2009-01-03 21:39:40.431264020 -0800
@@ -4977,6 +4977,22 @@ static void __devinit cas_program_bridge
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xff);
}
+static const struct net_device_ops cas_netdev_ops = {
+ .ndo_open = cas_open,
+ .ndo_stop = cas_close,
+ .ndo_start_xmit = cas_start_xmit,
+ .ndo_get_stats = cas_get_stats,
+ .ndo_set_multicast_list = cas_set_multicast,
+ .ndo_do_ioctl = cas_ioctl,
+ .ndo_tx_timeout = cas_tx_timeout,
+ .ndo_change_mtu = cas_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = cas_netpoll,
+#endif
+};
+
static int __devinit cas_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -5165,23 +5181,14 @@ static int __devinit cas_init_one(struct
for (i = 0; i < N_RX_FLOWS; i++)
skb_queue_head_init(&cp->rx_flows[i]);
-
- dev->open = cas_open;
- dev->stop = cas_close;
- dev->hard_start_xmit = cas_start_xmit;
- dev->get_stats = cas_get_stats;
- dev->set_multicast_list = cas_set_multicast;
- dev->do_ioctl = cas_ioctl;
+
+ dev->netdev_ops = &cas_netdev_ops;
dev->ethtool_ops = &cas_ethtool_ops;
- dev->tx_timeout = cas_tx_timeout;
dev->watchdog_timeo = CAS_TX_TIMEOUT;
- dev->change_mtu = cas_change_mtu;
+
#ifdef USE_NAPI
netif_napi_add(dev, &cp->napi, cas_poll, 64);
#endif
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = cas_netpoll;
-#endif
dev->irq = pdev->irq;
dev->dma = 0;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 06/42] ipg: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (3 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 05/42] cassini: update to net_device_ops Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-07 7:59 ` Pekka Enberg
2009-01-07 0:33 ` [PATCH 07/42] plip: " Stephen Hemminger
` (35 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Pekka Enberg; +Cc: netdev
[-- Attachment #1: ipg.patch --]
[-- Type: text/plain, Size: 1395 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/ipg.c 2009-01-05 16:45:32.729571177 -0800
+++ b/drivers/net/ipg.c 2009-01-05 16:48:07.518569219 -0800
@@ -2210,6 +2210,19 @@ static void __devexit ipg_remove(struct
pci_set_drvdata(pdev, NULL);
}
+static const struct net_device_ops ipg_netdev_ops = {
+ .ndo_open = ipg_nic_open,
+ .ndo_stop = ipg_nic_stop,
+ .ndo_start_xmit = ipg_nic_hard_start_xmit,
+ .ndo_get_stats = ipg_nic_get_stats,
+ .ndo_set_multicast_list = ipg_nic_set_multicast_list,
+ .ndo_do_ioctl = ipg_ioctl,
+ .ndo_tx_timeout = ipg_tx_timeout,
+ .ndo_change_mtu = ipg_nic_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __devinit ipg_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
@@ -2258,15 +2271,7 @@ static int __devinit ipg_probe(struct pc
/* Declare IPG NIC functions for Ethernet device methods.
*/
- dev->open = &ipg_nic_open;
- dev->stop = &ipg_nic_stop;
- dev->hard_start_xmit = &ipg_nic_hard_start_xmit;
- dev->get_stats = &ipg_nic_get_stats;
- dev->set_multicast_list = &ipg_nic_set_multicast_list;
- dev->do_ioctl = ipg_ioctl;
- dev->tx_timeout = ipg_tx_timeout;
- dev->change_mtu = &ipg_nic_change_mtu;
-
+ dev->netdev_ops = &ipg_netdev_ops;
SET_NETDEV_DEV(dev, &pdev->dev);
SET_ETHTOOL_OPS(dev, &ipg_ethtool_ops);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 06/42] ipg: update to net_device_ops
2009-01-07 0:33 ` [PATCH 06/42] ipg: " Stephen Hemminger
@ 2009-01-07 7:59 ` Pekka Enberg
2009-01-08 1:26 ` David Miller
0 siblings, 1 reply; 95+ messages in thread
From: Pekka Enberg @ 2009-01-07 7:59 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev, romieu, sorbica, jesse
On Tue, 2009-01-06 at 16:33 -0800, Stephen Hemminger wrote:
> plain text document attachment (ipg.patch)
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Looks good to me.
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
> --- a/drivers/net/ipg.c 2009-01-05 16:45:32.729571177 -0800
> +++ b/drivers/net/ipg.c 2009-01-05 16:48:07.518569219 -0800
> @@ -2210,6 +2210,19 @@ static void __devexit ipg_remove(struct
> pci_set_drvdata(pdev, NULL);
> }
>
> +static const struct net_device_ops ipg_netdev_ops = {
> + .ndo_open = ipg_nic_open,
> + .ndo_stop = ipg_nic_stop,
> + .ndo_start_xmit = ipg_nic_hard_start_xmit,
> + .ndo_get_stats = ipg_nic_get_stats,
> + .ndo_set_multicast_list = ipg_nic_set_multicast_list,
> + .ndo_do_ioctl = ipg_ioctl,
> + .ndo_tx_timeout = ipg_tx_timeout,
> + .ndo_change_mtu = ipg_nic_change_mtu,
> + .ndo_set_mac_address = eth_mac_addr,
> + .ndo_validate_addr = eth_validate_addr,
> +};
> +
> static int __devinit ipg_probe(struct pci_dev *pdev,
> const struct pci_device_id *id)
> {
> @@ -2258,15 +2271,7 @@ static int __devinit ipg_probe(struct pc
>
> /* Declare IPG NIC functions for Ethernet device methods.
> */
> - dev->open = &ipg_nic_open;
> - dev->stop = &ipg_nic_stop;
> - dev->hard_start_xmit = &ipg_nic_hard_start_xmit;
> - dev->get_stats = &ipg_nic_get_stats;
> - dev->set_multicast_list = &ipg_nic_set_multicast_list;
> - dev->do_ioctl = ipg_ioctl;
> - dev->tx_timeout = ipg_tx_timeout;
> - dev->change_mtu = &ipg_nic_change_mtu;
> -
> + dev->netdev_ops = &ipg_netdev_ops;
> SET_NETDEV_DEV(dev, &pdev->dev);
> SET_ETHTOOL_OPS(dev, &ipg_ethtool_ops);
>
>
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 06/42] ipg: update to net_device_ops
2009-01-07 7:59 ` Pekka Enberg
@ 2009-01-08 1:26 ` David Miller
0 siblings, 0 replies; 95+ messages in thread
From: David Miller @ 2009-01-08 1:26 UTC (permalink / raw)
To: penberg; +Cc: shemminger, netdev, romieu, sorbica, jesse
From: Pekka Enberg <penberg@cs.helsinki.fi>
Date: Wed, 07 Jan 2009 09:59:58 +0200
> On Tue, 2009-01-06 at 16:33 -0800, Stephen Hemminger wrote:
> > plain text document attachment (ipg.patch)
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> Looks good to me.
>
> Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [PATCH 07/42] plip: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (4 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 06/42] ipg: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:26 ` David Miller
2009-01-07 0:33 ` [PATCH 08/42] tlan: " Stephen Hemminger
` (34 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Mikulas Patocka; +Cc: netdev
[-- Attachment #1: plip.patch --]
[-- Type: text/plain, Size: 1058 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/plip.c 2009-01-05 16:54:45.381820105 -0800
+++ b/drivers/net/plip.c 2009-01-05 16:59:08.254569570 -0800
@@ -265,6 +265,13 @@ static const struct header_ops plip_head
.cache = plip_hard_header_cache,
};
+static const struct net_device_ops plip_netdev_ops = {
+ .ndo_open = plip_open,
+ .ndo_stop = plip_close,
+ .ndo_start_xmit = plip_tx_packet,
+ .ndo_do_ioctl = plip_ioctl,
+};
+
/* Entry point of PLIP driver.
Probe the hardware, and register/initialize the driver.
@@ -280,15 +287,11 @@ plip_init_netdev(struct net_device *dev)
struct net_local *nl = netdev_priv(dev);
/* Then, override parts of it */
- dev->hard_start_xmit = plip_tx_packet;
- dev->open = plip_open;
- dev->stop = plip_close;
- dev->do_ioctl = plip_ioctl;
-
dev->tx_queue_len = 10;
dev->flags = IFF_POINTOPOINT|IFF_NOARP;
memset(dev->dev_addr, 0xfc, ETH_ALEN);
+ dev->netdev_ops = &plip_netdev_ops;
dev->header_ops = &plip_header_ops;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 08/42] tlan: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (5 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 07/42] plip: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:27 ` David Miller
2009-01-07 0:33 ` [PATCH 09/42] epic100: " Stephen Hemminger
` (33 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Sakari Ailus; +Cc: netdev
[-- Attachment #1: tlan.patch --]
[-- Type: text/plain, Size: 1300 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tlan.c 2009-01-05 17:21:57.919070541 -0800
+++ b/drivers/net/tlan.c 2009-01-05 22:45:26.054570112 -0800
@@ -831,6 +831,21 @@ static void TLan_Poll(struct net_device
}
#endif
+static const struct net_device_ops TLan_netdev_ops = {
+ .ndo_open = TLan_Open,
+ .ndo_stop = TLan_Close,
+ .ndo_start_xmit = TLan_StartTx,
+ .ndo_tx_timeout = TLan_tx_timeout,
+ .ndo_get_stats = TLan_GetStats,
+ .ndo_set_multicast_list = TLan_SetMulticastList,
+ .ndo_do_ioctl = TLan_ioctl,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = TLan_Poll,
+#endif
+};
@@ -892,16 +907,7 @@ static int TLan_Init( struct net_device
netif_carrier_off(dev);
/* Device methods */
- dev->open = &TLan_Open;
- dev->hard_start_xmit = &TLan_StartTx;
- dev->stop = &TLan_Close;
- dev->get_stats = &TLan_GetStats;
- dev->set_multicast_list = &TLan_SetMulticastList;
- dev->do_ioctl = &TLan_ioctl;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = &TLan_Poll;
-#endif
- dev->tx_timeout = &TLan_tx_timeout;
+ dev->netdev_ops = &TLan_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT;
return 0;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 09/42] epic100: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (6 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 08/42] tlan: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:27 ` David Miller
2009-01-07 0:33 ` [PATCH 10/42] sunhme: " Stephen Hemminger
` (32 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: epic100.patch --]
[-- Type: text/plain, Size: 1512 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/epic100.c 2009-01-05 17:21:57.791070052 -0800
+++ b/drivers/net/epic100.c 2009-01-05 22:31:16.209590402 -0800
@@ -308,7 +308,18 @@ static int epic_close(struct net_device
static struct net_device_stats *epic_get_stats(struct net_device *dev);
static void set_rx_mode(struct net_device *dev);
-
+static const struct net_device_ops epic_netdev_ops = {
+ .ndo_open = epic_open,
+ .ndo_stop = epic_close,
+ .ndo_start_xmit = epic_start_xmit,
+ .ndo_tx_timeout = epic_tx_timeout,
+ .ndo_get_stats = epic_get_stats,
+ .ndo_set_multicast_list = set_rx_mode,
+ .ndo_do_ioctl = netdev_ioctl,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
static int __devinit epic_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent)
@@ -483,15 +494,9 @@ static int __devinit epic_init_one (stru
dev->if_port = ep->default_port = option;
/* The Epic-specific entries in the device structure. */
- dev->open = &epic_open;
- dev->hard_start_xmit = &epic_start_xmit;
- dev->stop = &epic_close;
- dev->get_stats = &epic_get_stats;
- dev->set_multicast_list = &set_rx_mode;
- dev->do_ioctl = &netdev_ioctl;
+ dev->netdev_ops = &epic_netdev_ops;
dev->ethtool_ops = &netdev_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT;
- dev->tx_timeout = &epic_tx_timeout;
netif_napi_add(dev, &ep->napi, epic_poll, 64);
ret = register_netdev(dev);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 10/42] sunhme: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (7 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 09/42] epic100: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:28 ` David Miller
2009-01-07 0:33 ` [PATCH 11/42] sungem: " Stephen Hemminger
` (31 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: sunhme.patch --]
[-- Type: text/plain, Size: 1796 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/sunhme.c 2009-01-05 22:20:10.258069867 -0800
+++ b/drivers/net/sunhme.c 2009-01-05 22:24:21.754819916 -0800
@@ -2607,6 +2607,18 @@ static struct quattro * __devinit quattr
}
#endif /* CONFIG_PCI */
+static const struct net_device_ops hme_netdev_ops = {
+ .ndo_open = happy_meal_open,
+ .ndo_stop = happy_meal_close,
+ .ndo_start_xmit = happy_meal_start_xmit,
+ .ndo_tx_timeout = happy_meal_tx_timeout,
+ .ndo_get_stats = happy_meal_get_stats,
+ .ndo_set_multicast_list = happy_meal_set_multicast,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
#ifdef CONFIG_SBUS
static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
{
@@ -2750,12 +2762,7 @@ static int __devinit happy_meal_sbus_pro
init_timer(&hp->happy_timer);
hp->dev = dev;
- dev->open = &happy_meal_open;
- dev->stop = &happy_meal_close;
- dev->hard_start_xmit = &happy_meal_start_xmit;
- dev->get_stats = &happy_meal_get_stats;
- dev->set_multicast_list = &happy_meal_set_multicast;
- dev->tx_timeout = &happy_meal_tx_timeout;
+ dev->netdev_ops = &hme_netdev_ops;
dev->watchdog_timeo = 5*HZ;
dev->ethtool_ops = &hme_ethtool_ops;
@@ -3076,12 +3083,7 @@ static int __devinit happy_meal_pci_prob
init_timer(&hp->happy_timer);
hp->dev = dev;
- dev->open = &happy_meal_open;
- dev->stop = &happy_meal_close;
- dev->hard_start_xmit = &happy_meal_start_xmit;
- dev->get_stats = &happy_meal_get_stats;
- dev->set_multicast_list = &happy_meal_set_multicast;
- dev->tx_timeout = &happy_meal_tx_timeout;
+ dev->netdev_ops = &hme_netdev_ops;
dev->watchdog_timeo = 5*HZ;
dev->ethtool_ops = &hme_ethtool_ops;
dev->irq = pdev->irq;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 11/42] sungem: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (8 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 10/42] sunhme: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:29 ` David Miller
2009-01-07 0:33 ` [PATCH 12/42] pcnet32: " Stephen Hemminger
` (30 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: sungem.patch --]
[-- Type: text/plain, Size: 1428 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/sungem.c 2009-01-05 22:32:32.234069564 -0800
+++ b/drivers/net/sungem.c 2009-01-05 22:34:34.221571178 -0800
@@ -2989,6 +2989,19 @@ static void gem_remove_one(struct pci_de
}
}
+static const struct net_device_ops gem_netdev_ops = {
+ .ndo_open = gem_open,
+ .ndo_stop = gem_close,
+ .ndo_start_xmit = gem_start_xmit,
+ .ndo_get_stats = gem_get_stats,
+ .ndo_set_multicast_list = gem_set_multicast,
+ .ndo_do_ioctl = gem_ioctl,
+ .ndo_tx_timeout = gem_tx_timeout,
+ .ndo_change_mtu = gem_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __devinit gem_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -3142,17 +3155,10 @@ static int __devinit gem_init_one(struct
if (gem_get_device_address(gp))
goto err_out_free_consistent;
- dev->open = gem_open;
- dev->stop = gem_close;
- dev->hard_start_xmit = gem_start_xmit;
- dev->get_stats = gem_get_stats;
- dev->set_multicast_list = gem_set_multicast;
- dev->do_ioctl = gem_ioctl;
+ dev->netdev_ops = &gem_netdev_ops;
netif_napi_add(dev, &gp->napi, gem_poll, 64);
dev->ethtool_ops = &gem_ethtool_ops;
- dev->tx_timeout = gem_tx_timeout;
dev->watchdog_timeo = 5 * HZ;
- dev->change_mtu = gem_change_mtu;
dev->irq = pdev->irq;
dev->dma = 0;
dev->set_mac_address = gem_set_mac_address;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 12/42] pcnet32: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (9 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 11/42] sungem: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:29 ` David Miller
2009-01-07 0:33 ` [PATCH 13/42] typhoon: " Stephen Hemminger
` (29 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Don Fry; +Cc: netdev
[-- Attachment #1: pcnet32.patch --]
[-- Type: text/plain, Size: 1755 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/pcnet32.c 2009-01-05 22:35:10.546318919 -0800
+++ b/drivers/net/pcnet32.c 2009-01-05 22:45:01.278569923 -0800
@@ -1568,6 +1568,22 @@ pcnet32_probe_pci(struct pci_dev *pdev,
return err;
}
+static const struct net_device_ops pcnet32_netdev_ops = {
+ .ndo_open = pcnet32_open,
+ .ndo_stop = pcnet32_close,
+ .ndo_start_xmit = pcnet32_start_xmit,
+ .ndo_tx_timeout = pcnet32_tx_timeout,
+ .ndo_get_stats = pcnet32_get_stats,
+ .ndo_set_multicast_list = pcnet32_set_multicast_list,
+ .ndo_do_ioctl = pcnet32_ioctl,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = pcnet32_poll_controller,
+#endif
+};
+
/* pcnet32_probe1
* Called from both pcnet32_probe_vlbus and pcnet_probe_pci.
* pdev will be NULL when called from pcnet32_probe_vlbus.
@@ -1934,20 +1950,10 @@ pcnet32_probe1(unsigned long ioaddr, int
lp->watchdog_timer.function = (void *)&pcnet32_watchdog;
/* The PCNET32-specific entries in the device structure. */
- dev->open = &pcnet32_open;
- dev->hard_start_xmit = &pcnet32_start_xmit;
- dev->stop = &pcnet32_close;
- dev->get_stats = &pcnet32_get_stats;
- dev->set_multicast_list = &pcnet32_set_multicast_list;
- dev->do_ioctl = &pcnet32_ioctl;
+ dev->netdev_ops = &pcnet32_netdev_ops;
dev->ethtool_ops = &pcnet32_ethtool_ops;
- dev->tx_timeout = pcnet32_tx_timeout;
dev->watchdog_timeo = (5 * HZ);
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = pcnet32_poll_controller;
-#endif
-
/* Fill in the generic fields of the device structure. */
if (register_netdev(dev))
goto err_free_ring;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 13/42] typhoon: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (10 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 12/42] pcnet32: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:29 ` David Miller
2009-01-07 0:33 ` [PATCH 14/42] enc28j60: " Stephen Hemminger
` (28 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: typhoon.patch --]
[-- Type: text/plain, Size: 1453 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/typhoon.c 2009-01-05 22:40:41.830818586 -0800
+++ b/drivers/net/typhoon.c 2009-01-05 22:42:52.110068563 -0800
@@ -2296,6 +2296,19 @@ out:
return mode;
}
+static const struct net_device_ops typhoon_netdev_ops = {
+ .ndo_open = typhoon_open,
+ .ndo_stop = typhoon_close,
+ .ndo_start_xmit = typhoon_start_tx,
+ .ndo_set_multicast_list = typhoon_set_rx_mode,
+ .ndo_tx_timeout = typhoon_tx_timeout,
+ .ndo_get_stats = typhoon_get_stats,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = typhoon_set_mac_address,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_vlan_rx_register = typhoon_vlan_rx_register,
+};
+
static int __devinit
typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
@@ -2495,16 +2508,9 @@ typhoon_init_one(struct pci_dev *pdev, c
}
/* The chip-specific entries in the device structure. */
- dev->open = typhoon_open;
- dev->hard_start_xmit = typhoon_start_tx;
- dev->stop = typhoon_close;
- dev->set_multicast_list = typhoon_set_rx_mode;
- dev->tx_timeout = typhoon_tx_timeout;
+ dev->netdev_ops = &typhoon_netdev_ops;
netif_napi_add(dev, &tp->napi, typhoon_poll, 16);
dev->watchdog_timeo = TX_TIMEOUT;
- dev->get_stats = typhoon_get_stats;
- dev->set_mac_address = typhoon_set_mac_address;
- dev->vlan_rx_register = typhoon_vlan_rx_register;
SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 14/42] enc28j60: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (11 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 13/42] typhoon: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:30 ` David Miller
2009-01-07 0:33 ` [PATCH 16/42] de600: " Stephen Hemminger
` (27 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Baruch Siach; +Cc: netdev
[-- Attachment #1: enc28j60.patch --]
[-- Type: text/plain, Size: 1308 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/enc28j60.c 2009-01-05 09:43:14.970576391 -0800
+++ b/drivers/net/enc28j60.c 2009-01-05 09:46:16.138139560 -0800
@@ -1529,6 +1529,17 @@ static int enc28j60_chipset_init(struct
return enc28j60_hw_init(priv);
}
+static const struct net_device_ops enc28j60_netdev_ops = {
+ .ndo_open = enc28j60_net_open,
+ .ndo_stop = enc28j60_net_close,
+ .ndo_start_xmit = enc28j60_send_packet,
+ .ndo_set_multicast_list = enc28j60_set_multicast_list,
+ .ndo_set_mac_address = enc28j60_set_mac_address,
+ .ndo_tx_timeout = enc28j60_tx_timeout,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __devinit enc28j60_probe(struct spi_device *spi)
{
struct net_device *dev;
@@ -1583,12 +1594,7 @@ static int __devinit enc28j60_probe(stru
dev->if_port = IF_PORT_10BASET;
dev->irq = spi->irq;
- dev->open = enc28j60_net_open;
- dev->stop = enc28j60_net_close;
- dev->hard_start_xmit = enc28j60_send_packet;
- dev->set_multicast_list = &enc28j60_set_multicast_list;
- dev->set_mac_address = enc28j60_set_mac_address;
- dev->tx_timeout = &enc28j60_tx_timeout;
+ dev->netdev_ops = &enc28j60_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT;
SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 16/42] de600: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (12 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 14/42] enc28j60: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:35 ` David Miller
2009-01-07 0:33 ` [PATCH 17/42] sis190: " Stephen Hemminger
` (26 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: de620.patch --]
[-- Type: text/plain, Size: 2002 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/de600.c 2009-01-05 09:57:00.313823290 -0800
+++ b/drivers/net/de600.c 2009-01-05 09:58:37.145589173 -0800
@@ -378,6 +378,16 @@ static void de600_rx_intr(struct net_dev
*/
}
+static const struct net_device_ops de600_netdev_ops = {
+ .ndo_open = de600_open,
+ .ndo_stop = de600_close,
+ .ndo_start_xmit = de600_start_xmit,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
+
static struct net_device * __init de600_probe(void)
{
int i;
@@ -439,9 +449,7 @@ static struct net_device * __init de600_
printk(", Ethernet Address: %pM\n", dev->dev_addr);
- dev->open = de600_open;
- dev->stop = de600_close;
- dev->hard_start_xmit = &de600_start_xmit;
+ dev->netdev_ops = &de600_netdev_ops;
dev->flags&=~IFF_MULTICAST;
--- a/drivers/net/de620.c 2009-01-05 09:54:40.509573827 -0800
+++ b/drivers/net/de620.c 2009-01-05 09:56:31.049569488 -0800
@@ -784,6 +784,17 @@ static int adapter_init(struct net_devic
return 0; /* all ok */
}
+static const struct net_device_ops de620_netdev_ops = {
+ .ndo_open = de620_open,
+ .ndo_stop = de620_close,
+ .ndo_start_xmit = de620_start_xmit,
+ .ndo_tx_timeout = de620_timeout,
+ .ndo_set_multicast_list = de620_set_multicast_list,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
/******************************************************************************
*
* Only start-up code below
@@ -861,12 +872,8 @@ struct net_device * __init de620_probe(i
else
printk(" UTP)\n");
- dev->open = de620_open;
- dev->stop = de620_close;
- dev->hard_start_xmit = de620_start_xmit;
- dev->tx_timeout = de620_timeout;
+ dev->netdev_ops = &de620_netdev_ops;
dev->watchdog_timeo = HZ*2;
- dev->set_multicast_list = de620_set_multicast_list;
/* base_addr and irq are already set, see above! */
--
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 16/42] de600: update to net_device_ops
2009-01-07 0:33 ` [PATCH 16/42] de600: " Stephen Hemminger
@ 2009-01-08 1:35 ` David Miller
2009-01-08 1:48 ` [PATCH 15/42] hp100: " Stephen Hemminger
0 siblings, 1 reply; 95+ messages in thread
From: David Miller @ 2009-01-08 1:35 UTC (permalink / raw)
To: shemminger; +Cc: netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 06 Jan 2009 16:33:32 -0800
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied.
Note that I don't have patch #15 from this series in my
inbox, patchwork didn't pick it up and neither did any
of the netdev archives.
I can only assume that it didn't go out at all :-)
^ permalink raw reply [flat|nested] 95+ messages in thread
* [PATCH 15/42] hp100: update to net_device_ops
2009-01-08 1:35 ` David Miller
@ 2009-01-08 1:48 ` Stephen Hemminger
2009-01-08 2:13 ` David Miller
0 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-08 1:48 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/hp100.c 2009-01-06 15:51:25.736859949 -0800
+++ b/drivers/net/hp100.c 2009-01-06 16:04:57.553361920 -0800
@@ -425,6 +425,28 @@ struct net_device * __init hp100_probe(i
}
#endif /* !MODULE && CONFIG_ISA */
+static const struct net_device_ops hp100_bm_netdev_ops = {
+ .ndo_open = hp100_open,
+ .ndo_stop = hp100_close,
+ .ndo_start_xmit = hp100_start_xmit_bm,
+ .ndo_get_stats = hp100_get_stats,
+ .ndo_set_multicast_list = hp100_set_multicast_list,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
+static const struct net_device_ops hp100_netdev_ops = {
+ .ndo_open = hp100_open,
+ .ndo_stop = hp100_close,
+ .ndo_start_xmit = hp100_start_xmit,
+ .ndo_get_stats = hp100_get_stats,
+ .ndo_set_multicast_list = hp100_set_multicast_list,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
u_char bus, struct pci_dev *pci_dev)
{
@@ -657,16 +679,10 @@ static int __devinit hp100_probe1(struct
lp->virt_memory_size = virt_memory_size;
lp->rx_ratio = hp100_rx_ratio; /* can be conf'd with insmod */
- dev->open = hp100_open;
- dev->stop = hp100_close;
-
if (lp->mode == 1) /* busmaster */
- dev->hard_start_xmit = hp100_start_xmit_bm;
+ dev->netdev_ops = &hp100_bm_netdev_ops;
else
- dev->hard_start_xmit = hp100_start_xmit;
-
- dev->get_stats = hp100_get_stats;
- dev->set_multicast_list = &hp100_set_multicast_list;
+ dev->netdev_ops = &hp100_netdev_ops;
/* Ask the card for which IRQ line it is configured */
if (bus == HP100_BUS_PCI) {
^ permalink raw reply [flat|nested] 95+ messages in thread
* [PATCH 17/42] sis190: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (13 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 16/42] de600: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:35 ` David Miller
2009-01-07 0:33 ` [PATCH 18/42] ns83820: fix net_device_ops support Stephen Hemminger
` (25 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: sis190.patch --]
[-- Type: text/plain, Size: 1599 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/sis190.c 2009-01-05 11:06:13.882579097 -0800
+++ b/drivers/net/sis190.c 2009-01-05 11:09:18.773568969 -0800
@@ -1782,6 +1782,21 @@ static int sis190_ioctl(struct net_devic
generic_mii_ioctl(&tp->mii_if, if_mii(ifr), cmd, NULL);
}
+static const struct net_device_ops sis190_netdev_ops = {
+ .ndo_open = sis190_open,
+ .ndo_stop = sis190_close,
+ .ndo_do_ioctl = sis190_ioctl,
+ .ndo_start_xmit = sis190_start_xmit,
+ .ndo_tx_timeout = sis190_tx_timeout,
+ .ndo_set_multicast_list = sis190_set_rx_mode,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = sis190_netpoll,
+#endif
+};
+
static int __devinit sis190_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -1815,19 +1830,12 @@ static int __devinit sis190_init_one(str
INIT_WORK(&tp->phy_task, sis190_phy_task);
- dev->open = sis190_open;
- dev->stop = sis190_close;
- dev->do_ioctl = sis190_ioctl;
- dev->tx_timeout = sis190_tx_timeout;
- dev->watchdog_timeo = SIS190_TX_TIMEOUT;
- dev->hard_start_xmit = sis190_start_xmit;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = sis190_netpoll;
-#endif
- dev->set_multicast_list = sis190_set_rx_mode;
+ dev->netdev_ops = &sis190_netdev_ops;
+
SET_ETHTOOL_OPS(dev, &sis190_ethtool_ops);
dev->irq = pdev->irq;
dev->base_addr = (unsigned long) 0xdead;
+ dev->watchdog_timeo = SIS190_TX_TIMEOUT;
spin_lock_init(&tp->lock);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 18/42] ns83820: fix net_device_ops support
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (14 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 17/42] sis190: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:36 ` David Miller
2009-01-07 0:33 ` [PATCH 19/42] sb1000: update to net_device_ops Stephen Hemminger
` (24 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: ns83820.patch --]
[-- Type: text/plain, Size: 902 bytes --]
The vlan_rx_register fuction is now in net_device_ops
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/ns83820.c 2009-01-05 11:09:58.413568915 -0800
+++ b/drivers/net/ns83820.c 2009-01-05 11:10:50.579012963 -0800
@@ -1957,6 +1957,9 @@ static const struct net_device_ops netde
.ndo_set_multicast_list = ns83820_set_multicast,
.ndo_validate_addr = eth_validate_addr,
.ndo_tx_timeout = ns83820_tx_timeout,
+#ifdef NS83820_VLAN_ACCEL_SUPPORT
+ .ndo_vlan_rx_register = ns83820_vlan_rx_register,
+#endif
};
static int __devinit ns83820_init_one(struct pci_dev *pci_dev,
@@ -2216,7 +2219,6 @@ static int __devinit ns83820_init_one(st
#ifdef NS83820_VLAN_ACCEL_SUPPORT
/* We also support hardware vlan acceleration */
ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
- ndev->vlan_rx_register = ns83820_vlan_rx_register;
#endif
if (using_dac) {
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 19/42] sb1000: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (15 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 18/42] ns83820: fix net_device_ops support Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:57 ` David Miller
2009-01-07 0:33 ` [PATCH 20/42] natsemi: " Stephen Hemminger
` (23 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: sb1000.patch --]
[-- Type: text/plain, Size: 1167 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/sb1000.c 2009-01-05 11:11:10.425571186 -0800
+++ b/drivers/net/sb1000.c 2009-01-05 11:12:59.757816689 -0800
@@ -134,6 +134,16 @@ static const struct pnp_device_id sb1000
};
MODULE_DEVICE_TABLE(pnp, sb1000_pnp_ids);
+static const struct net_device_ops sb1000_netdev_ops = {
+ .ndo_open = sb1000_open,
+ .ndo_start_xmit = sb1000_start_xmit,
+ .ndo_do_ioctl = sb1000_dev_ioctl,
+ .ndo_stop = sb1000_close,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int
sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id)
{
@@ -192,11 +202,7 @@ sb1000_probe_one(struct pnp_dev *pdev, c
if (sb1000_debug > 0)
printk(KERN_NOTICE "%s", version);
- /* The SB1000-specific entries in the device structure. */
- dev->open = sb1000_open;
- dev->do_ioctl = sb1000_dev_ioctl;
- dev->hard_start_xmit = sb1000_start_xmit;
- dev->stop = sb1000_close;
+ dev->netdev_ops = &sb1000_netdev_ops;
/* hardware address is 0:0:serial_number */
dev->dev_addr[2] = serial_number >> 24 & 0xff;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 20/42] natsemi: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (16 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 19/42] sb1000: update to net_device_ops Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:57 ` David Miller
2009-01-07 0:33 ` [PATCH 21/42] fealnx: " Stephen Hemminger
` (22 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: natsemi.patch --]
[-- Type: text/plain, Size: 1571 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/natsemi.c 2009-01-05 16:37:41.039070167 -0800
+++ b/drivers/net/natsemi.c 2009-01-05 17:22:10.793568537 -0800
@@ -779,6 +779,22 @@ static void __devinit natsemi_init_media
}
+static const struct net_device_ops natsemi_netdev_ops = {
+ .ndo_open = netdev_open,
+ .ndo_stop = netdev_close,
+ .ndo_start_xmit = start_tx,
+ .ndo_get_stats = get_stats,
+ .ndo_set_multicast_list = set_rx_mode,
+ .ndo_change_mtu = natsemi_change_mtu,
+ .ndo_do_ioctl = netdev_ioctl,
+ .ndo_tx_timeout = ns_tx_timeout,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = natsemi_poll_controller,
+#endif
+};
+
static int __devinit natsemi_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -911,20 +927,9 @@ static int __devinit natsemi_probe1 (str
if (find_cnt < MAX_UNITS && full_duplex[find_cnt])
np->full_duplex = 1;
- /* The chip-specific entries in the device structure. */
- dev->open = &netdev_open;
- dev->hard_start_xmit = &start_tx;
- dev->stop = &netdev_close;
- dev->get_stats = &get_stats;
- dev->set_multicast_list = &set_rx_mode;
- dev->change_mtu = &natsemi_change_mtu;
- dev->do_ioctl = &netdev_ioctl;
- dev->tx_timeout = &ns_tx_timeout;
+ dev->netdev_ops = &natsemi_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = &natsemi_poll_controller;
-#endif
SET_ETHTOOL_OPS(dev, ðtool_ops);
if (mtu)
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 21/42] fealnx: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (17 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 20/42] natsemi: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:57 ` David Miller
2009-01-07 0:33 ` [PATCH 22/42] starfire: " Stephen Hemminger
` (21 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: fealnx.patch --]
[-- Type: text/plain, Size: 1305 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/fealnx.c 2009-01-05 16:37:40.999073216 -0800
+++ b/drivers/net/fealnx.c 2009-01-05 16:54:57.478318812 -0800
@@ -467,6 +467,18 @@ static void stop_nic_rxtx(void __iomem *
}
}
+static const struct net_device_ops netdev_ops = {
+ .ndo_open = netdev_open,
+ .ndo_stop = netdev_close,
+ .ndo_start_xmit = start_tx,
+ .ndo_get_stats = get_stats,
+ .ndo_set_multicast_list = set_rx_mode,
+ .ndo_do_ioctl = mii_ioctl,
+ .ndo_tx_timeout = fealnx_tx_timeout,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
static int __devinit fealnx_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
@@ -649,15 +661,8 @@ static int __devinit fealnx_init_one(str
np->mii.force_media = 1;
}
- /* The chip-specific entries in the device structure. */
- dev->open = &netdev_open;
- dev->hard_start_xmit = &start_tx;
- dev->stop = &netdev_close;
- dev->get_stats = &get_stats;
- dev->set_multicast_list = &set_rx_mode;
- dev->do_ioctl = &mii_ioctl;
+ dev->netdev_ops = &netdev_ops;
dev->ethtool_ops = &netdev_ethtool_ops;
- dev->tx_timeout = &fealnx_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
err = register_netdev(dev);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 22/42] starfire: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (18 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 21/42] fealnx: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:58 ` David Miller
2009-01-07 0:33 ` [PATCH 23/42] sundance: " Stephen Hemminger
` (20 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: starfire.patch --]
[-- Type: text/plain, Size: 2106 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/starfire.c 2009-01-05 16:37:40.967072819 -0800
+++ b/drivers/net/starfire.c 2009-01-05 16:54:24.702569118 -0800
@@ -642,6 +642,24 @@ static void netdev_vlan_rx_kill_vid(stru
#endif /* VLAN_SUPPORT */
+static const struct net_device_ops netdev_ops = {
+ .ndo_open = netdev_open,
+ .ndo_stop = netdev_close,
+ .ndo_start_xmit = start_tx,
+ .ndo_tx_timeout = tx_timeout,
+ .ndo_get_stats = get_stats,
+ .ndo_set_multicast_list = &set_rx_mode,
+ .ndo_do_ioctl = netdev_ioctl,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef VLAN_SUPPORT
+ .ndo_vlan_rx_register = netdev_vlan_rx_register,
+ .ndo_vlan_rx_add_vid = netdev_vlan_rx_add_vid,
+ .ndo_vlan_rx_kill_vid = netdev_vlan_rx_kill_vid,
+#endif
+};
+
static int __devinit starfire_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -704,11 +722,9 @@ static int __devinit starfire_init_one(s
if (enable_hw_cksum)
dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
#endif /* ZEROCOPY */
+
#ifdef VLAN_SUPPORT
dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
- dev->vlan_rx_register = netdev_vlan_rx_register;
- dev->vlan_rx_add_vid = netdev_vlan_rx_add_vid;
- dev->vlan_rx_kill_vid = netdev_vlan_rx_kill_vid;
#endif /* VLAN_RX_KILL_VID */
#ifdef ADDR_64BITS
dev->features |= NETIF_F_HIGHDMA;
@@ -804,18 +820,12 @@ static int __devinit starfire_init_one(s
}
}
- /* The chip-specific entries in the device structure. */
- dev->open = &netdev_open;
- dev->hard_start_xmit = &start_tx;
- dev->tx_timeout = tx_timeout;
+ dev->netdev_ops = &netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT;
- netif_napi_add(dev, &np->napi, netdev_poll, max_interrupt_work);
- dev->stop = &netdev_close;
- dev->get_stats = &get_stats;
- dev->set_multicast_list = &set_rx_mode;
- dev->do_ioctl = &netdev_ioctl;
SET_ETHTOOL_OPS(dev, ðtool_ops);
+ netif_napi_add(dev, &np->napi, netdev_poll, max_interrupt_work);
+
if (mtu)
dev->mtu = mtu;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 23/42] sundance: update to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (19 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 22/42] starfire: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 1:58 ` David Miller
2009-01-07 0:33 ` [PATCH 24/42] tulip: convert devices to new API Stephen Hemminger
` (19 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: sundance.patch --]
[-- Type: text/plain, Size: 1365 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/sundance.c 2009-01-05 11:21:54.202319462 -0800
+++ b/drivers/net/sundance.c 2009-01-05 11:24:13.205569835 -0800
@@ -449,6 +449,19 @@ static void sundance_reset(struct net_de
}
}
+static const struct net_device_ops netdev_ops = {
+ .ndo_open = netdev_open,
+ .ndo_stop = netdev_close,
+ .ndo_start_xmit = start_tx,
+ .ndo_get_stats = get_stats,
+ .ndo_set_multicast_list = set_rx_mode,
+ .ndo_do_ioctl = netdev_ioctl,
+ .ndo_tx_timeout = tx_timeout,
+ .ndo_change_mtu = change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __devinit sundance_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -530,16 +543,10 @@ static int __devinit sundance_probe1 (st
np->mii_if.reg_num_mask = 0x1f;
/* The chip-specific entries in the device structure. */
- dev->open = &netdev_open;
- dev->hard_start_xmit = &start_tx;
- dev->stop = &netdev_close;
- dev->get_stats = &get_stats;
- dev->set_multicast_list = &set_rx_mode;
- dev->do_ioctl = &netdev_ioctl;
+ dev->netdev_ops = &netdev_ops;
SET_ETHTOOL_OPS(dev, ðtool_ops);
- dev->tx_timeout = &tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
- dev->change_mtu = &change_mtu;
+
pci_set_drvdata(pdev, dev);
i = register_netdev(dev);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 24/42] tulip: convert devices to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (20 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 23/42] sundance: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-07 7:49 ` Grant Grundler
2009-01-07 0:33 ` [PATCH 25/42] de2104x: convert to net_device_ops Stephen Hemminger
` (18 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Grant Grundler, Kyle McMartin; +Cc: netdev
[-- Attachment #1: tulip.patch --]
[-- Type: text/plain, Size: 1760 bytes --]
Convert to net_device_ops and internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/net/tulip/tulip_core.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
--- a/drivers/net/tulip/tulip_core.c 2009-01-06 16:22:22.016610626 -0800
+++ b/drivers/net/tulip/tulip_core.c 2009-01-06 16:22:24.210112411 -0800
@@ -1225,6 +1225,22 @@ static int tulip_uli_dm_quirk(struct pci
return 0;
}
+static const struct net_device_ops tulip_netdev_ops = {
+ .ndo_open = tulip_open,
+ .ndo_start_xmit = tulip_start_xmit,
+ .ndo_tx_timeout = tulip_tx_timeout,
+ .ndo_stop = tulip_close,
+ .ndo_get_stats = tulip_get_stats,
+ .ndo_do_ioctl = private_ioctl,
+ .ndo_set_multicast_list = set_rx_mode,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = poll_tulip,
+#endif
+};
+
static int __devinit tulip_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -1601,20 +1617,11 @@ static int __devinit tulip_init_one (str
}
/* The Tulip-specific entries in the device structure. */
- dev->open = tulip_open;
- dev->hard_start_xmit = tulip_start_xmit;
- dev->tx_timeout = tulip_tx_timeout;
+ dev->netdev_ops = &tulip_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT;
#ifdef CONFIG_TULIP_NAPI
netif_napi_add(dev, &tp->napi, tulip_poll, 16);
#endif
- dev->stop = tulip_close;
- dev->get_stats = tulip_get_stats;
- dev->do_ioctl = private_ioctl;
- dev->set_multicast_list = set_rx_mode;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = &poll_tulip;
-#endif
SET_ETHTOOL_OPS(dev, &ops);
if (register_netdev(dev))
--
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 24/42] tulip: convert devices to new API
2009-01-07 0:33 ` [PATCH 24/42] tulip: convert devices to new API Stephen Hemminger
@ 2009-01-07 7:49 ` Grant Grundler
2009-01-08 1:59 ` David Miller
0 siblings, 1 reply; 95+ messages in thread
From: Grant Grundler @ 2009-01-07 7:49 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, Grant Grundler, Kyle McMartin, netdev
On Tue, Jan 06, 2009 at 04:33:40PM -0800, Stephen Hemminger wrote:
> Convert to net_device_ops and internal net_device_stats
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
thanks,
grant
>
> ---
> drivers/net/tulip/tulip_core.c | 27 +++++++++++++++++----------
> 1 file changed, 17 insertions(+), 10 deletions(-)
>
> --- a/drivers/net/tulip/tulip_core.c 2009-01-06 16:22:22.016610626 -0800
> +++ b/drivers/net/tulip/tulip_core.c 2009-01-06 16:22:24.210112411 -0800
> @@ -1225,6 +1225,22 @@ static int tulip_uli_dm_quirk(struct pci
> return 0;
> }
>
> +static const struct net_device_ops tulip_netdev_ops = {
> + .ndo_open = tulip_open,
> + .ndo_start_xmit = tulip_start_xmit,
> + .ndo_tx_timeout = tulip_tx_timeout,
> + .ndo_stop = tulip_close,
> + .ndo_get_stats = tulip_get_stats,
> + .ndo_do_ioctl = private_ioctl,
> + .ndo_set_multicast_list = set_rx_mode,
> + .ndo_change_mtu = eth_change_mtu,
> + .ndo_set_mac_address = eth_mac_addr,
> + .ndo_validate_addr = eth_validate_addr,
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> + .ndo_poll_controller = poll_tulip,
> +#endif
> +};
> +
> static int __devinit tulip_init_one (struct pci_dev *pdev,
> const struct pci_device_id *ent)
> {
> @@ -1601,20 +1617,11 @@ static int __devinit tulip_init_one (str
> }
>
> /* The Tulip-specific entries in the device structure. */
> - dev->open = tulip_open;
> - dev->hard_start_xmit = tulip_start_xmit;
> - dev->tx_timeout = tulip_tx_timeout;
> + dev->netdev_ops = &tulip_netdev_ops;
> dev->watchdog_timeo = TX_TIMEOUT;
> #ifdef CONFIG_TULIP_NAPI
> netif_napi_add(dev, &tp->napi, tulip_poll, 16);
> #endif
> - dev->stop = tulip_close;
> - dev->get_stats = tulip_get_stats;
> - dev->do_ioctl = private_ioctl;
> - dev->set_multicast_list = set_rx_mode;
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> - dev->poll_controller = &poll_tulip;
> -#endif
> SET_ETHTOOL_OPS(dev, &ops);
>
> if (register_netdev(dev))
>
> --
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 24/42] tulip: convert devices to new API
2009-01-07 7:49 ` Grant Grundler
@ 2009-01-08 1:59 ` David Miller
0 siblings, 0 replies; 95+ messages in thread
From: David Miller @ 2009-01-08 1:59 UTC (permalink / raw)
To: grundler; +Cc: shemminger, kyle, netdev
From: Grant Grundler <grundler@parisc-linux.org>
Date: Wed, 7 Jan 2009 00:49:49 -0700
> On Tue, Jan 06, 2009 at 04:33:40PM -0800, Stephen Hemminger wrote:
> > Convert to net_device_ops and internal net_device_stats
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> Acked-by: Grant Grundler <grundler@parisc-linux.org>
Applied.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [PATCH 25/42] de2104x: convert to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (21 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 24/42] tulip: convert devices to new API Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-07 7:50 ` Grant Grundler
2009-01-08 1:59 ` David Miller
2009-01-07 0:33 ` [PATCH 26/42] de4x5: " Stephen Hemminger
` (17 subsequent siblings)
40 siblings, 2 replies; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Grant Grundler, Kyle McMartin; +Cc: netdev
[-- Attachment #1: tulip-de1.patch --]
[-- Type: text/plain, Size: 1210 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tulip/de2104x.c 2009-01-06 16:08:31.161363983 -0800
+++ b/drivers/net/tulip/de2104x.c 2009-01-06 16:14:57.956742918 -0800
@@ -1922,6 +1922,18 @@ bad_srom:
goto fill_defaults;
}
+static const struct net_device_ops de_netdev_ops = {
+ .ndo_open = de_open,
+ .ndo_stop = de_close,
+ .ndo_set_multicast_list = de_set_rx_mode,
+ .ndo_start_xmit = de_start_xmit,
+ .ndo_get_stats = de_get_stats,
+ .ndo_tx_timeout = de_tx_timeout,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __devinit de_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -1944,14 +1956,9 @@ static int __devinit de_init_one (struct
if (!dev)
return -ENOMEM;
+ dev->netdev_ops = &de_netdev_ops;
SET_NETDEV_DEV(dev, &pdev->dev);
- dev->open = de_open;
- dev->stop = de_close;
- dev->set_multicast_list = de_set_rx_mode;
- dev->hard_start_xmit = de_start_xmit;
- dev->get_stats = de_get_stats;
dev->ethtool_ops = &de_ethtool_ops;
- dev->tx_timeout = de_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
de = netdev_priv(dev);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 25/42] de2104x: convert to net_device_ops
2009-01-07 0:33 ` [PATCH 25/42] de2104x: convert to net_device_ops Stephen Hemminger
@ 2009-01-07 7:50 ` Grant Grundler
2009-01-08 1:59 ` David Miller
1 sibling, 0 replies; 95+ messages in thread
From: Grant Grundler @ 2009-01-07 7:50 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, Grant Grundler, Kyle McMartin, netdev
On Tue, Jan 06, 2009 at 04:33:41PM -0800, Stephen Hemminger wrote:
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
thanks,
grant
>
> --- a/drivers/net/tulip/de2104x.c 2009-01-06 16:08:31.161363983 -0800
> +++ b/drivers/net/tulip/de2104x.c 2009-01-06 16:14:57.956742918 -0800
> @@ -1922,6 +1922,18 @@ bad_srom:
> goto fill_defaults;
> }
>
> +static const struct net_device_ops de_netdev_ops = {
> + .ndo_open = de_open,
> + .ndo_stop = de_close,
> + .ndo_set_multicast_list = de_set_rx_mode,
> + .ndo_start_xmit = de_start_xmit,
> + .ndo_get_stats = de_get_stats,
> + .ndo_tx_timeout = de_tx_timeout,
> + .ndo_change_mtu = eth_change_mtu,
> + .ndo_set_mac_address = eth_mac_addr,
> + .ndo_validate_addr = eth_validate_addr,
> +};
> +
> static int __devinit de_init_one (struct pci_dev *pdev,
> const struct pci_device_id *ent)
> {
> @@ -1944,14 +1956,9 @@ static int __devinit de_init_one (struct
> if (!dev)
> return -ENOMEM;
>
> + dev->netdev_ops = &de_netdev_ops;
> SET_NETDEV_DEV(dev, &pdev->dev);
> - dev->open = de_open;
> - dev->stop = de_close;
> - dev->set_multicast_list = de_set_rx_mode;
> - dev->hard_start_xmit = de_start_xmit;
> - dev->get_stats = de_get_stats;
> dev->ethtool_ops = &de_ethtool_ops;
> - dev->tx_timeout = de_tx_timeout;
> dev->watchdog_timeo = TX_TIMEOUT;
>
> de = netdev_priv(dev);
>
> --
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 25/42] de2104x: convert to net_device_ops
2009-01-07 0:33 ` [PATCH 25/42] de2104x: convert to net_device_ops Stephen Hemminger
2009-01-07 7:50 ` Grant Grundler
@ 2009-01-08 1:59 ` David Miller
1 sibling, 0 replies; 95+ messages in thread
From: David Miller @ 2009-01-08 1:59 UTC (permalink / raw)
To: shemminger; +Cc: grundler, kyle, netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 06 Jan 2009 16:33:41 -0800
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [PATCH 26/42] de4x5: convert to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (22 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 25/42] de2104x: convert to net_device_ops Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:00 ` David Miller
2009-01-07 0:33 ` [PATCH 27/42] xircom: convert devices to new API Stephen Hemminger
` (16 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Grant Grundler, Kyle McMartin; +Cc: netdev
[-- Attachment #1: tulip-de2.patch --]
[-- Type: text/plain, Size: 1376 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tulip/de4x5.c 2009-01-06 16:08:31.193364166 -0800
+++ b/drivers/net/tulip/de4x5.c 2009-01-06 16:13:50.841110201 -0800
@@ -1077,6 +1077,18 @@ static int (*dc_infoblock[])(struct net_
mdelay(2); /* Wait for 2ms */\
}
+static const struct net_device_ops de4x5_netdev_ops = {
+ .ndo_open = de4x5_open,
+ .ndo_stop = de4x5_close,
+ .ndo_start_xmit = de4x5_queue_pkt,
+ .ndo_get_stats = de4x5_get_stats,
+ .ndo_set_multicast_list = set_multicast_list,
+ .ndo_do_ioctl = de4x5_ioctl,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address= eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __devinit
de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
@@ -1258,13 +1270,7 @@ de4x5_hw_init(struct net_device *dev, u_
/* The DE4X5-specific entries in the device structure. */
SET_NETDEV_DEV(dev, gendev);
- dev->open = &de4x5_open;
- dev->hard_start_xmit = &de4x5_queue_pkt;
- dev->stop = &de4x5_close;
- dev->get_stats = &de4x5_get_stats;
- dev->set_multicast_list = &set_multicast_list;
- dev->do_ioctl = &de4x5_ioctl;
-
+ dev->netdev_ops = &de4x5_netdev_ops;
dev->mem_start = 0;
/* Fill in the generic fields of the device structure. */
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 27/42] xircom: convert devices to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (23 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 26/42] de4x5: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:01 ` David Miller
2009-01-07 0:33 ` [PATCH 28/42] dmfe: convert " Stephen Hemminger
` (15 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Grant Grundler, Kyle McMartin; +Cc: netdev
[-- Attachment #1: tulip-xircom.patch --]
[-- Type: text/plain, Size: 3528 bytes --]
Convert to net_device_ops and internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tulip/xircom_cb.c 2009-01-06 16:22:21.996610716 -0800
+++ b/drivers/net/tulip/xircom_cb.c 2009-01-06 16:26:51.124360713 -0800
@@ -104,10 +104,8 @@ struct xircom_private {
*/
spinlock_t lock;
-
struct pci_dev *pdev;
struct net_device *dev;
- struct net_device_stats stats;
};
@@ -119,7 +117,6 @@ static int xircom_start_xmit(struct sk_b
static int xircom_open(struct net_device *dev);
static int xircom_close(struct net_device *dev);
static void xircom_up(struct xircom_private *card);
-static struct net_device_stats *xircom_get_stats(struct net_device *dev);
#ifdef CONFIG_NET_POLL_CONTROLLER
static void xircom_poll_controller(struct net_device *dev);
#endif
@@ -194,6 +191,18 @@ static const struct ethtool_ops netdev_e
.get_drvinfo = netdev_get_drvinfo,
};
+static const struct net_device_ops netdev_ops = {
+ .ndo_open = xircom_open,
+ .ndo_stop = xircom_close,
+ .ndo_start_xmit = xircom_start_xmit,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = xircom_poll_controller,
+#endif
+};
+
/* xircom_probe is the code that gets called on device insertion.
it sets up the hardware and registers the device to the networklayer.
@@ -266,13 +275,7 @@ static int __devinit xircom_probe(struct
read_mac_address(private);
setup_descriptors(private);
- dev->open = &xircom_open;
- dev->hard_start_xmit = &xircom_start_xmit;
- dev->stop = &xircom_close;
- dev->get_stats = &xircom_get_stats;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = &xircom_poll_controller;
-#endif
+ dev->netdev_ops = &netdev_ops;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
pci_set_drvdata(pdev, dev);
@@ -497,14 +500,6 @@ static int xircom_close(struct net_devic
}
-
-static struct net_device_stats *xircom_get_stats(struct net_device *dev)
-{
- struct xircom_private *card = netdev_priv(dev);
- return &card->stats;
-}
-
-
#ifdef CONFIG_NET_POLL_CONTROLLER
static void xircom_poll_controller(struct net_device *dev)
{
@@ -1193,7 +1188,7 @@ static void investigate_read_descriptor(
skb = dev_alloc_skb(pkt_len + 2);
if (skb == NULL) {
- card->stats.rx_dropped++;
+ dev->stats.rx_dropped++;
goto out;
}
skb_reserve(skb, 2);
@@ -1201,8 +1196,8 @@ static void investigate_read_descriptor(
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
- card->stats.rx_packets++;
- card->stats.rx_bytes += pkt_len;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += pkt_len;
out:
/* give the buffer back to the card */
@@ -1232,16 +1227,16 @@ static void investigate_write_descriptor
#endif
if (status > 0) { /* bit 31 is 0 when done */
if (card->tx_skb[descnr]!=NULL) {
- card->stats.tx_bytes += card->tx_skb[descnr]->len;
+ dev->stats.tx_bytes += card->tx_skb[descnr]->len;
dev_kfree_skb_irq(card->tx_skb[descnr]);
}
card->tx_skb[descnr] = NULL;
/* Bit 8 in the status field is 1 if there was a collision */
if (status&(1<<8))
- card->stats.collisions++;
+ dev->stats.collisions++;
card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
netif_wake_queue (dev);
- card->stats.tx_packets++;
+ dev->stats.tx_packets++;
}
leave("investigate_write_descriptor");
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 28/42] dmfe: convert to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (24 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 27/42] xircom: convert devices to new API Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 21:16 ` Grant Grundler
2009-01-07 0:33 ` [PATCH 29/42] uli526x: convert devices " Stephen Hemminger
` (14 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Grant Grundler, Kyle McMartin; +Cc: netdev
[-- Attachment #1: tulip-dmfe.patch --]
[-- Type: text/plain, Size: 4357 bytes --]
Convert to internal net_device-stats and net_device_ops
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tulip/dmfe.c 2009-01-06 16:08:31.169364168 -0800
+++ b/drivers/net/tulip/dmfe.c 2009-01-06 16:13:50.841110201 -0800
@@ -257,9 +257,6 @@ struct dmfe_board_info {
u8 wol_mode; /* user WOL settings */
struct timer_list timer;
- /* System defined statistic counter */
- struct net_device_stats stats;
-
/* Driver defined statistic counter */
unsigned long tx_fifo_underrun;
unsigned long tx_loss_carrier;
@@ -316,7 +313,6 @@ static u8 SF_mode; /* Special Function:
static int dmfe_open(struct DEVICE *);
static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
static int dmfe_stop(struct DEVICE *);
-static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
static void dmfe_set_filter_mode(struct DEVICE *);
static const struct ethtool_ops netdev_ethtool_ops;
static u16 read_srom_word(long ,int);
@@ -351,6 +347,19 @@ static void dmfe_set_phyxcer(struct dmfe
/* DM910X network board routine ---------------------------- */
+static const struct net_device_ops netdev_ops = {
+ .ndo_open = dmfe_open,
+ .ndo_stop = dmfe_stop,
+ .ndo_start_xmit = dmfe_start_xmit,
+ .ndo_set_multicast_list = dmfe_set_filter_mode,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = poll_dmfe,
+#endif
+};
+
/*
* Search DM910X board ,allocate space and register it
*/
@@ -442,14 +451,7 @@ static int __devinit dmfe_init_one (stru
dev->base_addr = db->ioaddr;
dev->irq = pdev->irq;
pci_set_drvdata(pdev, dev);
- dev->open = &dmfe_open;
- dev->hard_start_xmit = &dmfe_start_xmit;
- dev->stop = &dmfe_stop;
- dev->get_stats = &dmfe_get_stats;
- dev->set_multicast_list = &dmfe_set_filter_mode;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = &poll_dmfe;
-#endif
+ dev->netdev_ops = &netdev_ops;
dev->ethtool_ops = &netdev_ethtool_ops;
netif_carrier_off(dev);
spin_lock_init(&db->lock);
@@ -867,15 +869,15 @@ static void dmfe_free_tx_pkt(struct DEVI
/* A packet sent completed */
db->tx_packet_cnt--;
- db->stats.tx_packets++;
+ dev->stats.tx_packets++;
/* Transmit statistic counter */
if ( tdes0 != 0x7fffffff ) {
/* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
- db->stats.collisions += (tdes0 >> 3) & 0xf;
- db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
+ dev->stats.collisions += (tdes0 >> 3) & 0xf;
+ dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
if (tdes0 & TDES0_ERR_MASK) {
- db->stats.tx_errors++;
+ dev->stats.tx_errors++;
if (tdes0 & 0x0002) { /* UnderRun */
db->tx_fifo_underrun++;
@@ -969,13 +971,13 @@ static void dmfe_rx_packet(struct DEVICE
if (rdes0 & 0x8000) {
/* This is a error packet */
//printk(DRV_NAME ": rdes0: %lx\n", rdes0);
- db->stats.rx_errors++;
+ dev->stats.rx_errors++;
if (rdes0 & 1)
- db->stats.rx_fifo_errors++;
+ dev->stats.rx_fifo_errors++;
if (rdes0 & 2)
- db->stats.rx_crc_errors++;
+ dev->stats.rx_crc_errors++;
if (rdes0 & 0x80)
- db->stats.rx_length_errors++;
+ dev->stats.rx_length_errors++;
}
if ( !(rdes0 & 0x8000) ||
@@ -1008,8 +1010,8 @@ static void dmfe_rx_packet(struct DEVICE
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
- db->stats.rx_packets++;
- db->stats.rx_bytes += rxlen;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += rxlen;
}
} else {
/* Reuse SKB buffer when the packet is error */
@@ -1024,20 +1026,6 @@ static void dmfe_rx_packet(struct DEVICE
db->rx_ready_ptr = rxptr;
}
-
-/*
- * Get statistics from driver.
- */
-
-static struct net_device_stats * dmfe_get_stats(struct DEVICE *dev)
-{
- struct dmfe_board_info *db = netdev_priv(dev);
-
- DMFE_DBUG(0, "dmfe_get_stats", 0);
- return &db->stats;
-}
-
-
/*
* Set DM910X multicast address
*/
@@ -1161,7 +1149,7 @@ static void dmfe_timer(unsigned long dat
/* Operating Mode Check */
if ( (db->dm910x_chk_mode & 0x1) &&
- (db->stats.rx_packets > MAX_CHECK_PACKET) )
+ (dev->stats.rx_packets > MAX_CHECK_PACKET) )
db->dm910x_chk_mode = 0x4;
/* Dynamic reset DM910X : system error or transmit time-out */
--
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 28/42] dmfe: convert to new API
2009-01-07 0:33 ` [PATCH 28/42] dmfe: convert " Stephen Hemminger
@ 2009-01-08 21:16 ` Grant Grundler
2009-01-08 21:32 ` David Miller
0 siblings, 1 reply; 95+ messages in thread
From: Grant Grundler @ 2009-01-08 21:16 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, Grant Grundler, Kyle McMartin, netdev
On Tue, Jan 06, 2009 at 04:33:44PM -0800, Stephen Hemminger wrote:
> Convert to internal net_device-stats and net_device_ops
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
Davem - this one get overlooked?
I didn't see an "applied" email like the others in the series.
thanks,
grant
>
>
> --- a/drivers/net/tulip/dmfe.c 2009-01-06 16:08:31.169364168 -0800
> +++ b/drivers/net/tulip/dmfe.c 2009-01-06 16:13:50.841110201 -0800
> @@ -257,9 +257,6 @@ struct dmfe_board_info {
> u8 wol_mode; /* user WOL settings */
> struct timer_list timer;
>
> - /* System defined statistic counter */
> - struct net_device_stats stats;
> -
> /* Driver defined statistic counter */
> unsigned long tx_fifo_underrun;
> unsigned long tx_loss_carrier;
> @@ -316,7 +313,6 @@ static u8 SF_mode; /* Special Function:
> static int dmfe_open(struct DEVICE *);
> static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
> static int dmfe_stop(struct DEVICE *);
> -static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
> static void dmfe_set_filter_mode(struct DEVICE *);
> static const struct ethtool_ops netdev_ethtool_ops;
> static u16 read_srom_word(long ,int);
> @@ -351,6 +347,19 @@ static void dmfe_set_phyxcer(struct dmfe
>
> /* DM910X network board routine ---------------------------- */
>
> +static const struct net_device_ops netdev_ops = {
> + .ndo_open = dmfe_open,
> + .ndo_stop = dmfe_stop,
> + .ndo_start_xmit = dmfe_start_xmit,
> + .ndo_set_multicast_list = dmfe_set_filter_mode,
> + .ndo_change_mtu = eth_change_mtu,
> + .ndo_set_mac_address = eth_mac_addr,
> + .ndo_validate_addr = eth_validate_addr,
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> + .ndo_poll_controller = poll_dmfe,
> +#endif
> +};
> +
> /*
> * Search DM910X board ,allocate space and register it
> */
> @@ -442,14 +451,7 @@ static int __devinit dmfe_init_one (stru
> dev->base_addr = db->ioaddr;
> dev->irq = pdev->irq;
> pci_set_drvdata(pdev, dev);
> - dev->open = &dmfe_open;
> - dev->hard_start_xmit = &dmfe_start_xmit;
> - dev->stop = &dmfe_stop;
> - dev->get_stats = &dmfe_get_stats;
> - dev->set_multicast_list = &dmfe_set_filter_mode;
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> - dev->poll_controller = &poll_dmfe;
> -#endif
> + dev->netdev_ops = &netdev_ops;
> dev->ethtool_ops = &netdev_ethtool_ops;
> netif_carrier_off(dev);
> spin_lock_init(&db->lock);
> @@ -867,15 +869,15 @@ static void dmfe_free_tx_pkt(struct DEVI
>
> /* A packet sent completed */
> db->tx_packet_cnt--;
> - db->stats.tx_packets++;
> + dev->stats.tx_packets++;
>
> /* Transmit statistic counter */
> if ( tdes0 != 0x7fffffff ) {
> /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
> - db->stats.collisions += (tdes0 >> 3) & 0xf;
> - db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
> + dev->stats.collisions += (tdes0 >> 3) & 0xf;
> + dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
> if (tdes0 & TDES0_ERR_MASK) {
> - db->stats.tx_errors++;
> + dev->stats.tx_errors++;
>
> if (tdes0 & 0x0002) { /* UnderRun */
> db->tx_fifo_underrun++;
> @@ -969,13 +971,13 @@ static void dmfe_rx_packet(struct DEVICE
> if (rdes0 & 0x8000) {
> /* This is a error packet */
> //printk(DRV_NAME ": rdes0: %lx\n", rdes0);
> - db->stats.rx_errors++;
> + dev->stats.rx_errors++;
> if (rdes0 & 1)
> - db->stats.rx_fifo_errors++;
> + dev->stats.rx_fifo_errors++;
> if (rdes0 & 2)
> - db->stats.rx_crc_errors++;
> + dev->stats.rx_crc_errors++;
> if (rdes0 & 0x80)
> - db->stats.rx_length_errors++;
> + dev->stats.rx_length_errors++;
> }
>
> if ( !(rdes0 & 0x8000) ||
> @@ -1008,8 +1010,8 @@ static void dmfe_rx_packet(struct DEVICE
>
> skb->protocol = eth_type_trans(skb, dev);
> netif_rx(skb);
> - db->stats.rx_packets++;
> - db->stats.rx_bytes += rxlen;
> + dev->stats.rx_packets++;
> + dev->stats.rx_bytes += rxlen;
> }
> } else {
> /* Reuse SKB buffer when the packet is error */
> @@ -1024,20 +1026,6 @@ static void dmfe_rx_packet(struct DEVICE
> db->rx_ready_ptr = rxptr;
> }
>
> -
> -/*
> - * Get statistics from driver.
> - */
> -
> -static struct net_device_stats * dmfe_get_stats(struct DEVICE *dev)
> -{
> - struct dmfe_board_info *db = netdev_priv(dev);
> -
> - DMFE_DBUG(0, "dmfe_get_stats", 0);
> - return &db->stats;
> -}
> -
> -
> /*
> * Set DM910X multicast address
> */
> @@ -1161,7 +1149,7 @@ static void dmfe_timer(unsigned long dat
>
> /* Operating Mode Check */
> if ( (db->dm910x_chk_mode & 0x1) &&
> - (db->stats.rx_packets > MAX_CHECK_PACKET) )
> + (dev->stats.rx_packets > MAX_CHECK_PACKET) )
> db->dm910x_chk_mode = 0x4;
>
> /* Dynamic reset DM910X : system error or transmit time-out */
>
> --
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 28/42] dmfe: convert to new API
2009-01-08 21:16 ` Grant Grundler
@ 2009-01-08 21:32 ` David Miller
0 siblings, 0 replies; 95+ messages in thread
From: David Miller @ 2009-01-08 21:32 UTC (permalink / raw)
To: grundler; +Cc: shemminger, kyle, netdev
From: Grant Grundler <grundler@parisc-linux.org>
Date: Thu, 8 Jan 2009 14:16:08 -0700
> On Tue, Jan 06, 2009 at 04:33:44PM -0800, Stephen Hemminger wrote:
> > Convert to internal net_device-stats and net_device_ops
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> Acked-by: Grant Grundler <grundler@parisc-linux.org>
>
> Davem - this one get overlooked?
> I didn't see an "applied" email like the others in the series.
I got this one, I must have skipped the reply.
But patchwork did get updated properly :-)
http://patchwork.ozlabs.org/patch/17024/
^ permalink raw reply [flat|nested] 95+ messages in thread
* [PATCH 29/42] uli526x: convert devices to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (25 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 28/42] dmfe: convert " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:01 ` David Miller
2009-01-07 0:33 ` [PATCH 30/42] windbond: " Stephen Hemminger
` (13 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Grant Grundler, Kyle McMartin; +Cc: netdev
[-- Attachment #1: tulip-uli.patch --]
[-- Type: text/plain, Size: 4418 bytes --]
Convert to net_device_ops and internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tulip/uli526x.c 2009-01-06 16:08:31.181361709 -0800
+++ b/drivers/net/tulip/uli526x.c 2009-01-06 16:13:50.845109956 -0800
@@ -168,9 +168,6 @@ struct uli526x_board_info {
u8 wait_reset; /* Hardware failed, need to reset */
struct timer_list timer;
- /* System defined statistic counter */
- struct net_device_stats stats;
-
/* Driver defined statistic counter */
unsigned long tx_fifo_underrun;
unsigned long tx_loss_carrier;
@@ -220,7 +217,6 @@ static int mode = 8;
static int uli526x_open(struct net_device *);
static int uli526x_start_xmit(struct sk_buff *, struct net_device *);
static int uli526x_stop(struct net_device *);
-static struct net_device_stats * uli526x_get_stats(struct net_device *);
static void uli526x_set_filter_mode(struct net_device *);
static const struct ethtool_ops netdev_ethtool_ops;
static u16 read_srom_word(long, int);
@@ -251,6 +247,19 @@ static void uli526x_set_phyxcer(struct u
/* ULI526X network board routine ---------------------------- */
+static const struct net_device_ops netdev_ops = {
+ .ndo_open = uli526x_open,
+ .ndo_stop = uli526x_stop,
+ .ndo_start_xmit = uli526x_start_xmit,
+ .ndo_set_multicast_list = uli526x_set_filter_mode,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = uli526x_poll,
+#endif
+};
+
/*
* Search ULI526X board, allocate space and register it
*/
@@ -335,15 +344,9 @@ static int __devinit uli526x_init_one (s
pci_set_drvdata(pdev, dev);
/* Register some necessary functions */
- dev->open = &uli526x_open;
- dev->hard_start_xmit = &uli526x_start_xmit;
- dev->stop = &uli526x_stop;
- dev->get_stats = &uli526x_get_stats;
- dev->set_multicast_list = &uli526x_set_filter_mode;
+ dev->netdev_ops = &netdev_ops;
dev->ethtool_ops = &netdev_ethtool_ops;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = &uli526x_poll;
-#endif
+
spin_lock_init(&db->lock);
@@ -733,7 +736,8 @@ static void uli526x_poll(struct net_devi
* Free TX resource after TX complete
*/
-static void uli526x_free_tx_pkt(struct net_device *dev, struct uli526x_board_info * db)
+static void uli526x_free_tx_pkt(struct net_device *dev,
+ struct uli526x_board_info * db)
{
struct tx_desc *txptr;
u32 tdes0;
@@ -747,15 +751,15 @@ static void uli526x_free_tx_pkt(struct n
/* A packet sent completed */
db->tx_packet_cnt--;
- db->stats.tx_packets++;
+ dev->stats.tx_packets++;
/* Transmit statistic counter */
if ( tdes0 != 0x7fffffff ) {
/* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
- db->stats.collisions += (tdes0 >> 3) & 0xf;
- db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
+ dev->stats.collisions += (tdes0 >> 3) & 0xf;
+ dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
if (tdes0 & TDES0_ERR_MASK) {
- db->stats.tx_errors++;
+ dev->stats.tx_errors++;
if (tdes0 & 0x0002) { /* UnderRun */
db->tx_fifo_underrun++;
if ( !(db->cr6_data & CR6_SFT) ) {
@@ -825,13 +829,13 @@ static void uli526x_rx_packet(struct net
if (rdes0 & 0x8000) {
/* This is a error packet */
//printk(DRV_NAME ": rdes0: %lx\n", rdes0);
- db->stats.rx_errors++;
+ dev->stats.rx_errors++;
if (rdes0 & 1)
- db->stats.rx_fifo_errors++;
+ dev->stats.rx_fifo_errors++;
if (rdes0 & 2)
- db->stats.rx_crc_errors++;
+ dev->stats.rx_crc_errors++;
if (rdes0 & 0x80)
- db->stats.rx_length_errors++;
+ dev->stats.rx_length_errors++;
}
if ( !(rdes0 & 0x8000) ||
@@ -854,8 +858,8 @@ static void uli526x_rx_packet(struct net
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
- db->stats.rx_packets++;
- db->stats.rx_bytes += rxlen;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += rxlen;
} else {
/* Reuse SKB buffer when the packet is error */
@@ -872,19 +876,6 @@ static void uli526x_rx_packet(struct net
/*
- * Get statistics from driver.
- */
-
-static struct net_device_stats * uli526x_get_stats(struct net_device *dev)
-{
- struct uli526x_board_info *db = netdev_priv(dev);
-
- ULI526X_DBUG(0, "uli526x_get_stats", 0);
- return &db->stats;
-}
-
-
-/*
* Set ULI526X multicast address
*/
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 30/42] windbond: convert devices to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (26 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 29/42] uli526x: convert devices " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:02 ` David Miller
2009-01-07 0:33 ` [PATCH 31/42] dvb: update network device to current API Stephen Hemminger
` (12 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Grant Grundler, Kyle McMartin; +Cc: netdev
[-- Attachment #1: tulip-winb.patch --]
[-- Type: text/plain, Size: 1812 bytes --]
Convert to net_device_ops and internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tulip/winbond-840.c 2009-01-06 16:08:31.185364727 -0800
+++ b/drivers/net/tulip/winbond-840.c 2009-01-06 16:13:50.845109956 -0800
@@ -343,7 +343,18 @@ static int netdev_ioctl(struct net_devic
static const struct ethtool_ops netdev_ethtool_ops;
static int netdev_close(struct net_device *dev);
-
+static const struct net_device_ops netdev_ops = {
+ .ndo_open = netdev_open,
+ .ndo_stop = netdev_close,
+ .ndo_start_xmit = start_tx,
+ .ndo_get_stats = get_stats,
+ .ndo_set_multicast_list = set_rx_mode,
+ .ndo_do_ioctl = netdev_ioctl,
+ .ndo_tx_timeout = tx_timeout,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
static int __devinit w840_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent)
@@ -420,14 +431,8 @@ static int __devinit w840_probe1 (struct
np->mii_if.force_media = 1;
/* The chip-specific entries in the device structure. */
- dev->open = &netdev_open;
- dev->hard_start_xmit = &start_tx;
- dev->stop = &netdev_close;
- dev->get_stats = &get_stats;
- dev->set_multicast_list = &set_rx_mode;
- dev->do_ioctl = &netdev_ioctl;
+ dev->netdev_ops = &netdev_ops;
dev->ethtool_ops = &netdev_ethtool_ops;
- dev->tx_timeout = &tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
i = register_netdev(dev);
@@ -1555,7 +1560,7 @@ static void __devexit w840_remove1 (stru
* rtnl_lock, & netif_device_detach after the rtnl_unlock.
* - get_stats:
* spin_lock_irq(np->lock), doesn't touch hw if not present
- * - hard_start_xmit:
+ * - start_xmit:
* synchronize_irq + netif_tx_disable;
* - tx_timeout:
* netif_device_detach + netif_tx_disable;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 31/42] dvb: update network device to current API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (27 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 30/42] windbond: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:02 ` David Miller
2009-01-07 0:33 ` [PATCH 32/42] hysdn: convert to net_device_ops and other updates Stephen Hemminger
` (11 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, v4l-dvb-maintainer; +Cc: netdev
[-- Attachment #1: dvb.patch --]
[-- Type: text/plain, Size: 5085 bytes --]
Use internal network_device_stats that exist in network device and
net_device_ops. Compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/media/dvb/dvb-core/dvb_net.c 2009-01-03 21:41:52.667265286 -0800
+++ b/drivers/media/dvb/dvb-core/dvb_net.c 2009-01-03 21:46:40.886764565 -0800
@@ -125,7 +125,6 @@ static void hexdump( const unsigned char
struct dvb_net_priv {
int in_use;
- struct net_device_stats stats;
u16 pid;
struct net_device *net;
struct dvb_net *host;
@@ -384,8 +383,8 @@ static void dvb_net_ule( struct net_devi
if (priv->ule_skb) {
dev_kfree_skb( priv->ule_skb );
/* Prepare for next SNDU. */
- priv->stats.rx_errors++;
- priv->stats.rx_frame_errors++;
+ dev->stats.rx_errors++;
+ dev->stats.rx_frame_errors++;
}
reset_ule(priv);
priv->need_pusi = 1;
@@ -438,8 +437,8 @@ static void dvb_net_ule( struct net_devi
dev_kfree_skb( priv->ule_skb );
/* Prepare for next SNDU. */
// reset_ule(priv); moved to below.
- priv->stats.rx_errors++;
- priv->stats.rx_frame_errors++;
+ dev->stats.rx_errors++;
+ dev->stats.rx_frame_errors++;
}
reset_ule(priv);
/* skip to next PUSI. */
@@ -460,8 +459,8 @@ static void dvb_net_ule( struct net_devi
/* Drop partly decoded SNDU, reset state, resync on PUSI. */
if (priv->ule_skb) {
dev_kfree_skb( priv->ule_skb );
- priv->stats.rx_errors++;
- priv->stats.rx_frame_errors++;
+ dev->stats.rx_errors++;
+ dev->stats.rx_frame_errors++;
}
reset_ule(priv);
priv->need_pusi = 1;
@@ -477,8 +476,8 @@ static void dvb_net_ule( struct net_devi
if (priv->ule_sndu_remain > 183) {
/* Current SNDU lacks more data than there could be available in the
* current TS cell. */
- priv->stats.rx_errors++;
- priv->stats.rx_length_errors++;
+ dev->stats.rx_errors++;
+ dev->stats.rx_length_errors++;
printk(KERN_WARNING "%lu: Expected %d more SNDU bytes, but "
"got PUSI (pf %d, ts_remain %d). Flushing incomplete payload.\n",
priv->ts_count, priv->ule_sndu_remain, ts[4], ts_remain);
@@ -520,8 +519,8 @@ static void dvb_net_ule( struct net_devi
if (priv->ule_sndu_len < 5) {
printk(KERN_WARNING "%lu: Invalid ULE SNDU length %u. "
"Resyncing.\n", priv->ts_count, priv->ule_sndu_len);
- priv->stats.rx_errors++;
- priv->stats.rx_length_errors++;
+ dev->stats.rx_errors++;
+ dev->stats.rx_length_errors++;
priv->ule_sndu_len = 0;
priv->need_pusi = 1;
new_ts = 1;
@@ -573,7 +572,7 @@ static void dvb_net_ule( struct net_devi
if (priv->ule_skb == NULL) {
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
dev->name);
- priv->stats.rx_dropped++;
+ dev->stats.rx_dropped++;
return;
}
@@ -637,8 +636,8 @@ static void dvb_net_ule( struct net_devi
ule_dump = 1;
#endif
- priv->stats.rx_errors++;
- priv->stats.rx_crc_errors++;
+ dev->stats.rx_errors++;
+ dev->stats.rx_crc_errors++;
dev_kfree_skb(priv->ule_skb);
} else {
/* CRC32 verified OK. */
@@ -744,8 +743,8 @@ static void dvb_net_ule( struct net_devi
* receive the packet anyhow. */
/* if (priv->ule_dbit && skb->pkt_type == PACKET_OTHERHOST)
priv->ule_skb->pkt_type = PACKET_HOST; */
- priv->stats.rx_packets++;
- priv->stats.rx_bytes += priv->ule_skb->len;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += priv->ule_skb->len;
netif_rx(priv->ule_skb);
}
sndu_done:
@@ -800,8 +799,7 @@ static void dvb_net_sec(struct net_devic
{
u8 *eth;
struct sk_buff *skb;
- struct net_device_stats *stats =
- &((struct dvb_net_priv *) netdev_priv(dev))->stats;
+ struct net_device_stats *stats = &dev->stats;
int snap = 0;
/* note: pkt_len includes a 32bit checksum */
@@ -1216,28 +1214,29 @@ static int dvb_net_stop(struct net_devic
return dvb_net_feed_stop(dev);
}
-static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
-{
- return &((struct dvb_net_priv *) netdev_priv(dev))->stats;
-}
-
static const struct header_ops dvb_header_ops = {
.create = eth_header,
.parse = eth_header_parse,
.rebuild = eth_rebuild_header,
};
+
+static const struct net_device_ops dvb_netdev_ops = {
+ .ndo_open = dvb_net_open,
+ .ndo_stop = dvb_net_stop,
+ .ndo_start_xmit = dvb_net_tx,
+ .ndo_set_multicast_list = dvb_net_set_multicast_list,
+ .ndo_set_mac_address = dvb_net_set_mac,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static void dvb_net_setup(struct net_device *dev)
{
ether_setup(dev);
dev->header_ops = &dvb_header_ops;
- dev->open = dvb_net_open;
- dev->stop = dvb_net_stop;
- dev->hard_start_xmit = dvb_net_tx;
- dev->get_stats = dvb_net_get_stats;
- dev->set_multicast_list = dvb_net_set_multicast_list;
- dev->set_mac_address = dvb_net_set_mac;
+ dev->netdev_ops = &dvb_netdev_ops;
dev->mtu = 4096;
dev->mc_count = 0;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 32/42] hysdn: convert to net_device_ops and other updates
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (28 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 31/42] dvb: update network device to current API Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:03 ` David Miller
2009-01-07 0:33 ` [PATCH 33/42] I4l: convert to net_device_ops Stephen Hemminger
` (10 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: hysdn.patch --]
[-- Type: text/plain, Size: 5847 bytes --]
Several API problems fixed:
* use proper allocation
* handle renames
* convert to net_device_ops
* use internal net_device_stats
This driver is putrid (as in old and rotten), so I doubt any one uses it.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/isdn/hysdn/hysdn_net.c | 77 ++++++++++++++++-------------------------
1 file changed, 31 insertions(+), 46 deletions(-)
--- a/drivers/isdn/hysdn/hysdn_net.c 2009-01-03 21:48:10.166764790 -0800
+++ b/drivers/isdn/hysdn/hysdn_net.c 2009-01-03 22:03:32.319014167 -0800
@@ -38,16 +38,12 @@ char *hysdn_net_revision = "$Revision: 1
/* inside the definition. */
/****************************************************************************/
struct net_local {
- struct net_device netdev; /* the network device */
- struct net_device_stats stats;
- /* additional vars may be added here */
- char dev_name[9]; /* our own device name */
-
/* Tx control lock. This protects the transmit buffer ring
* state along with the "tx full" state of the driver. This
* means all netif_queue flow control actions are protected
* by this lock as well.
*/
+ struct net_device *dev;
spinlock_t lock;
struct sk_buff *skbs[MAX_SKB_BUFFERS]; /* pointers to tx-skbs */
int in_idx, out_idx; /* indexes to buffer ring */
@@ -55,15 +51,6 @@ struct net_local {
}; /* net_local */
-/*****************************************************/
-/* Get the current statistics for this card. */
-/* This may be called with the card open or closed ! */
-/*****************************************************/
-static struct net_device_stats *
-net_get_stats(struct net_device *dev)
-{
- return (&((struct net_local *) dev)->stats);
-} /* net_device_stats */
/*********************************************************************/
/* Open/initialize the board. This is called (in the current kernel) */
@@ -182,8 +169,8 @@ hysdn_tx_netack(hysdn_card * card)
if (!lp->sk_count)
return; /* error condition */
- lp->stats.tx_packets++;
- lp->stats.tx_bytes += lp->skbs[lp->out_idx]->len;
+ lp->dev->stats.tx_packets++;
+ lp->dev->stats.tx_bytes += lp->skbs[lp->out_idx]->len;
dev_kfree_skb(lp->skbs[lp->out_idx++]); /* free skb */
if (lp->out_idx >= MAX_SKB_BUFFERS)
@@ -200,29 +187,30 @@ void
hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len)
{
struct net_local *lp = card->netif;
+ struct net_device *dev = lp->dev;
struct sk_buff *skb;
if (!lp)
return; /* non existing device */
- lp->stats.rx_bytes += len;
+ dev->stats.rx_bytes += len;
skb = dev_alloc_skb(len);
if (skb == NULL) {
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
- lp->netdev.name);
- lp->stats.rx_dropped++;
+ dev->name);
+ dev->stats.rx_dropped++;
return;
}
/* copy the data */
memcpy(skb_put(skb, len), buf, len);
/* determine the used protocol */
- skb->protocol = eth_type_trans(skb, &lp->netdev);
+ skb->protocol = eth_type_trans(skb, dev);
- netif_rx(skb);
- lp->stats.rx_packets++; /* adjust packet count */
+ dev->stats.rx_packets++; /* adjust packet count */
+ netif_rx(skb);
} /* hysdn_rx_netpkt */
/*****************************************************/
@@ -242,24 +230,15 @@ hysdn_tx_netget(hysdn_card * card)
return (lp->skbs[lp->out_idx]); /* next packet to send */
} /* hysdn_tx_netget */
+static const struct net_device_ops hysdn_netdev_ops = {
+ .ndo_open = net_open,
+ .ndo_stop = net_close,
+ .ndo_start_xmit = net_send_packet,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
-/*******************************************/
-/* init function called by register device */
-/*******************************************/
-static int
-net_init(struct net_device *dev)
-{
- /* setup the function table */
- dev->open = net_open;
- dev->stop = net_close;
- dev->hard_start_xmit = net_send_packet;
- dev->get_stats = net_get_stats;
-
- /* Fill in the fields of the device structure with ethernet values. */
- ether_setup(dev);
-
- return (0); /* success */
-} /* net_init */
/*****************************************************************************/
/* hysdn_net_create creates a new net device for the given card. If a device */
@@ -271,28 +250,34 @@ hysdn_net_create(hysdn_card * card)
{
struct net_device *dev;
int i;
+ struct net_local *lp;
+
if(!card) {
printk(KERN_WARNING "No card-pt in hysdn_net_create!\n");
return (-ENOMEM);
}
hysdn_net_release(card); /* release an existing net device */
- if ((dev = kzalloc(sizeof(struct net_local), GFP_KERNEL)) == NULL) {
+
+ dev = alloc_etherdev(sizeof(struct net_local));
+ if (!dev) {
printk(KERN_WARNING "HYSDN: unable to allocate mem\n");
return (-ENOMEM);
}
+ lp = netdev_priv(dev);
+ lp->dev = dev;
+
+ dev->netdev_ops = &hysdn_netdev_ops;
spin_lock_init(&((struct net_local *) dev)->lock);
/* initialise necessary or informing fields */
dev->base_addr = card->iobase; /* IO address */
dev->irq = card->irq; /* irq */
- dev->init = net_init; /* the init function of the device */
- if(dev->name) {
- strcpy(dev->name, ((struct net_local *) dev)->dev_name);
- }
+
+ dev->netdev_ops = &hysdn_netdev_ops;
if ((i = register_netdev(dev))) {
printk(KERN_WARNING "HYSDN: unable to create network device\n");
- kfree(dev);
+ free_netdev(dev);
return (i);
}
dev->ml_priv = card; /* remember pointer to own data structure */
@@ -316,7 +301,7 @@ hysdn_net_release(hysdn_card * card)
return (0); /* non existing */
card->netif = NULL; /* clear out pointer */
- dev->stop(dev); /* close the device */
+ net_close(dev);
flush_tx_buffers((struct net_local *) dev); /* empty buffers */
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 33/42] I4l: convert to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (29 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 32/42] hysdn: convert to net_device_ops and other updates Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-07 0:33 ` [PATCH 34/42] fusion: convert devices to new API Stephen Hemminger
` (9 subsequent siblings)
40 siblings, 0 replies; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Karsten Keil; +Cc: netdev
[-- Attachment #1: i4l.patch --]
[-- Type: text/plain, Size: 4049 bytes --]
Add net_device_ops and use interal stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/isdn/i4l/isdn_net.c 2009-01-03 22:04:20.322771793 -0800
+++ b/drivers/isdn/i4l/isdn_net.c 2009-01-03 22:25:41.290763701 -0800
@@ -1485,6 +1485,24 @@ isdn_ciscohdlck_dev_ioctl(struct net_dev
return (rc);
}
+
+static int isdn_net_ioctl(struct net_device *dev,
+ struct ifreq *ifr, int cmd)
+{
+ isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev);
+
+ switch (lp->p_encap) {
+#ifdef CONFIG_ISDN_PPP
+ case ISDN_NET_ENCAP_SYNCPPP:
+ return isdn_ppp_dev_ioctl(dev, ifr, cmd);
+#endif
+ case ISDN_NET_ENCAP_CISCOHDLCK:
+ return isdn_ciscohdlck_dev_ioctl(dev, ifr, cmd);
+ default:
+ return -EINVAL;
+ }
+}
+
/* called via cisco_timer.function */
static void
isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
@@ -1998,23 +2016,6 @@ isdn_net_init(struct net_device *ndev)
ushort max_hlhdr_len = 0;
int drvidx;
- ether_setup(ndev);
- ndev->header_ops = NULL;
-
- /* Setup the generic properties */
- ndev->mtu = 1500;
- ndev->flags = IFF_NOARP|IFF_POINTOPOINT;
- ndev->type = ARPHRD_ETHER;
- ndev->addr_len = ETH_ALEN;
- ndev->validate_addr = NULL;
-
- /* for clients with MPPP maybe higher values better */
- ndev->tx_queue_len = 30;
-
- /* The ISDN-specific entries in the device structure. */
- ndev->open = &isdn_net_open;
- ndev->hard_start_xmit = &isdn_net_start_xmit;
-
/*
* up till binding we ask the protocol layer to reserve as much
* as we might need for HL layer
@@ -2026,9 +2027,6 @@ isdn_net_init(struct net_device *ndev)
max_hlhdr_len = dev->drv[drvidx]->interface->hl_hdrlen;
ndev->hard_header_len = ETH_HLEN + max_hlhdr_len;
- ndev->stop = &isdn_net_close;
- ndev->get_stats = &isdn_net_get_stats;
- ndev->do_ioctl = NULL;
return 0;
}
@@ -2508,6 +2506,19 @@ isdn_net_force_dial(char *name)
return (isdn_net_force_dial_lp(p->local));
}
+/* The ISDN-specific entries in the device structure. */
+static const struct net_device_ops isdn_netdev_ops = {
+ .ndo_init = isdn_net_init,
+ .ndo_open = isdn_net_open,
+ .ndo_stop = isdn_net_close,
+ .ndo_do_ioctl = isdn_net_ioctl,
+
+ .ndo_validate_addr = NULL,
+ .ndo_start_xmit = isdn_net_start_xmit,
+ .ndo_get_stats = isdn_net_get_stats,
+ .ndo_tx_timeout = isdn_net_tx_timeout,
+};
+
/*
* Helper for alloc_netdev()
*/
@@ -2515,7 +2526,20 @@ static void _isdn_setup(struct net_devic
{
isdn_net_local *lp = netdev_priv(dev);
+ ether_setup(dev);
+
dev->flags = IFF_NOARP | IFF_POINTOPOINT;
+ /* Setup the generic properties */
+ dev->mtu = 1500;
+ dev->flags = IFF_NOARP|IFF_POINTOPOINT;
+ dev->type = ARPHRD_ETHER;
+ dev->addr_len = ETH_ALEN;
+ dev->header_ops = NULL;
+ dev->netdev_ops = &isdn_netdev_ops;
+
+ /* for clients with MPPP maybe higher values better */
+ dev->tx_queue_len = 30;
+
lp->p_encap = ISDN_NET_ENCAP_RAWIP;
lp->magic = ISDN_NET_MAGIC;
lp->last = lp;
@@ -2570,7 +2594,7 @@ isdn_net_new(char *name, struct net_devi
return NULL;
}
netdev->local = netdev_priv(netdev->dev);
- netdev->dev->init = isdn_net_init;
+
if (master) {
/* Device shall be a slave */
struct net_device *p = MASTER_TO_SLAVE(master);
@@ -2588,7 +2612,6 @@ isdn_net_new(char *name, struct net_devi
/*
* Watchdog timer (currently) for master only.
*/
- netdev->dev->tx_timeout = isdn_net_tx_timeout;
netdev->dev->watchdog_timeo = ISDN_NET_TX_TIMEOUT;
if (register_netdev(netdev->dev) != 0) {
printk(KERN_WARNING "isdn_net: Could not register net-device\n");
@@ -2704,7 +2727,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg
#else
p->dev->type = ARPHRD_PPP; /* change ARP type */
p->dev->addr_len = 0;
- p->dev->do_ioctl = isdn_ppp_dev_ioctl;
#endif
break;
case ISDN_NET_ENCAP_X25IFACE:
@@ -2718,7 +2740,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg
#endif
break;
case ISDN_NET_ENCAP_CISCOHDLCK:
- p->dev->do_ioctl = isdn_ciscohdlck_dev_ioctl;
break;
default:
if( cfg->p_encap >= 0 &&
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 34/42] fusion: convert devices to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (30 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 33/42] I4l: convert to net_device_ops Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:04 ` David Miller
2009-01-07 0:33 ` [PATCH 35/42] xpnet: " Stephen Hemminger
` (8 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Eric.Moore; +Cc: netdev
[-- Attachment #1: fusion.patch --]
[-- Type: text/plain, Size: 3762 bytes --]
Convert to net_device_ops and internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/message/fusion/mptlan.c 2009-01-03 22:26:32.399766978 -0800
+++ b/drivers/message/fusion/mptlan.c 2009-01-03 22:30:48.831765189 -0800
@@ -106,7 +106,6 @@ struct mpt_lan_priv {
u32 total_posted;
u32 total_received;
- struct net_device_stats stats; /* Per device statistics */
struct delayed_work post_buckets_task;
struct net_device *dev;
@@ -548,15 +547,6 @@ mpt_lan_close(struct net_device *dev)
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-static struct net_device_stats *
-mpt_lan_get_stats(struct net_device *dev)
-{
- struct mpt_lan_priv *priv = netdev_priv(dev);
-
- return (struct net_device_stats *) &priv->stats;
-}
-
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static int
mpt_lan_change_mtu(struct net_device *dev, int new_mtu)
{
@@ -594,8 +584,8 @@ mpt_lan_send_turbo(struct net_device *de
ctx = GET_LAN_BUFFER_CONTEXT(tmsg);
sent = priv->SendCtl[ctx].skb;
- priv->stats.tx_packets++;
- priv->stats.tx_bytes += sent->len;
+ dev->stats.tx_packets++;
+ dev->stats.tx_bytes += sent->len;
dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n",
IOC_AND_NETDEV_NAMES_s_s(dev),
@@ -636,7 +626,7 @@ mpt_lan_send_reply(struct net_device *de
switch (le16_to_cpu(pSendRep->IOCStatus) & MPI_IOCSTATUS_MASK) {
case MPI_IOCSTATUS_SUCCESS:
- priv->stats.tx_packets += count;
+ dev->stats.tx_packets += count;
break;
case MPI_IOCSTATUS_LAN_CANCELED:
@@ -644,13 +634,13 @@ mpt_lan_send_reply(struct net_device *de
break;
case MPI_IOCSTATUS_INVALID_SGL:
- priv->stats.tx_errors += count;
+ dev->stats.tx_errors += count;
printk (KERN_ERR MYNAM ": %s/%s: ERROR - Invalid SGL sent to IOC!\n",
IOC_AND_NETDEV_NAMES_s_s(dev));
goto out;
default:
- priv->stats.tx_errors += count;
+ dev->stats.tx_errors += count;
break;
}
@@ -661,7 +651,7 @@ mpt_lan_send_reply(struct net_device *de
ctx = GET_LAN_BUFFER_CONTEXT(le32_to_cpu(*pContext));
sent = priv->SendCtl[ctx].skb;
- priv->stats.tx_bytes += sent->len;
+ dev->stats.tx_bytes += sent->len;
dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n",
IOC_AND_NETDEV_NAMES_s_s(dev),
@@ -842,8 +832,8 @@ mpt_lan_receive_skb(struct net_device *d
"delivered to upper level.\n",
IOC_AND_NETDEV_NAMES_s_s(dev), skb->len));
- priv->stats.rx_bytes += skb->len;
- priv->stats.rx_packets++;
+ dev->stats.rx_bytes += skb->len;
+ dev->stats.rx_packets++;
skb->dev = dev;
netif_rx(skb);
@@ -1308,6 +1298,14 @@ mpt_lan_post_receive_buckets_work(struct
post_buckets_task.work));
}
+static const struct net_device_ops mpt_netdev_ops = {
+ .ndo_open = mpt_lan_open,
+ .ndo_stop = mpt_lan_close,
+ .ndo_start_xmit = mpt_lan_sdu_send,
+ .ndo_change_mtu = mpt_lan_change_mtu,
+ .ndo_tx_timeout = mpt_lan_tx_timeout,
+};
+
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static struct net_device *
mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
@@ -1372,15 +1370,7 @@ mpt_register_lan_device (MPT_ADAPTER *mp
priv->tx_max_out = (tx_max_out_p <= MPT_TX_MAX_OUT_LIM) ?
tx_max_out_p : MPT_TX_MAX_OUT_LIM;
- dev->open = mpt_lan_open;
- dev->stop = mpt_lan_close;
- dev->get_stats = mpt_lan_get_stats;
- dev->set_multicast_list = NULL;
- dev->change_mtu = mpt_lan_change_mtu;
- dev->hard_start_xmit = mpt_lan_sdu_send;
-
-/* Not in 2.3.42. Need 2.3.45+ */
- dev->tx_timeout = mpt_lan_tx_timeout;
+ dev->netdev_ops = &mpt_netdev_ops;
dev->watchdog_timeo = MPT_LAN_TX_TIMEOUT;
dlprintk((KERN_INFO MYNAM ": Finished registering dev "
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 35/42] xpnet: convert devices to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (31 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 34/42] fusion: convert devices to new API Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:05 ` David Miller
2009-01-07 0:33 ` [PATCH 36/42] gadget: " Stephen Hemminger
` (7 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: xpnet.patch --]
[-- Type: text/plain, Size: 4671 bytes --]
Convert to net_device_ops and internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/misc/sgi-xp/xpnet.c 2009-01-03 22:31:54.138766578 -0800
+++ b/drivers/misc/sgi-xp/xpnet.c 2009-01-03 22:44:08.668261847 -0800
@@ -95,11 +95,6 @@ struct xpnet_pending_msg {
atomic_t use_count;
};
-/* driver specific structure pointed to by the device structure */
-struct xpnet_dev_private {
- struct net_device_stats stats;
-};
-
struct net_device *xpnet_device;
/*
@@ -153,7 +148,6 @@ xpnet_receive(short partid, int channel,
struct sk_buff *skb;
void *dst;
enum xp_retval ret;
- struct xpnet_dev_private *priv = netdev_priv(xpnet_device);
if (!XPNET_VALID_MSG(msg)) {
/*
@@ -161,7 +155,7 @@ xpnet_receive(short partid, int channel,
*/
xpc_received(partid, channel, (void *)msg);
- priv->stats.rx_errors++;
+ xpnet_device->stats.rx_errors++;
return;
}
@@ -176,7 +170,7 @@ xpnet_receive(short partid, int channel,
xpc_received(partid, channel, (void *)msg);
- priv->stats.rx_errors++;
+ xpnet_device->stats.rx_errors++;
return;
}
@@ -226,7 +220,7 @@ xpnet_receive(short partid, int channel,
xpc_received(partid, channel, (void *)msg);
- priv->stats.rx_errors++;
+ xpnet_device->stats.rx_errors++;
return;
}
@@ -247,8 +241,8 @@ xpnet_receive(short partid, int channel,
skb_end_pointer(skb), skb->len);
xpnet_device->last_rx = jiffies;
- priv->stats.rx_packets++;
- priv->stats.rx_bytes += skb->len + ETH_HLEN;
+ xpnet_device->stats.rx_packets++;
+ xpnet_device->stats.rx_bytes += skb->len + ETH_HLEN;
netif_rx_ni(skb);
xpc_received(partid, channel, (void *)msg);
@@ -353,26 +347,6 @@ xpnet_dev_change_mtu(struct net_device *
}
/*
- * Required for the net_device structure.
- */
-static int
-xpnet_dev_set_config(struct net_device *dev, struct ifmap *new_map)
-{
- return 0;
-}
-
-/*
- * Return statistics to the caller.
- */
-static struct net_device_stats *
-xpnet_dev_get_stats(struct net_device *dev)
-{
- struct xpnet_dev_private *priv = netdev_priv(dev);
-
- return &priv->stats;
-}
-
-/*
* Notification that the other end has received the message and
* DMA'd the skb information. At this point, they are done with
* our side. When all recipients are done processing, we
@@ -453,7 +427,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff
struct xpnet_pending_msg *queued_msg;
u64 start_addr, end_addr;
short dest_partid;
- struct xpnet_dev_private *priv = netdev_priv(dev);
u16 embedded_bytes = 0;
dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
@@ -476,7 +449,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff
dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping "
"packet\n", sizeof(struct xpnet_pending_msg));
- priv->stats.tx_errors++;
+ dev->stats.tx_errors++;
return -ENOMEM;
}
@@ -526,8 +499,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff
kfree(queued_msg);
}
- priv->stats.tx_packets++;
- priv->stats.tx_bytes += skb->len;
+ dev->stats.tx_packets++;
+ dev->stats.tx_bytes += skb->len;
return 0;
}
@@ -538,12 +511,19 @@ xpnet_dev_hard_start_xmit(struct sk_buff
static void
xpnet_dev_tx_timeout(struct net_device *dev)
{
- struct xpnet_dev_private *priv = netdev_priv(dev);
-
- priv->stats.tx_errors++;
- return;
+ dev->stats.tx_errors++;
}
+static const struct net_device_ops xpnet_netdev_ops = {
+ .ndo_open = xpnet_dev_open,
+ .ndo_stop = xpnet_dev_stop,
+ .ndo_start_xmit = xpnet_dev_hard_start_xmit,
+ .ndo_change_mtu = xpnet_dev_change_mtu,
+ .ndo_tx_timeout = xpnet_dev_tx_timeout,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __init
xpnet_init(void)
{
@@ -563,8 +543,7 @@ xpnet_init(void)
* use ether_setup() to init the majority of our device
* structure and then override the necessary pieces.
*/
- xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private),
- XPNET_DEVICE_NAME, ether_setup);
+ xpnet_device = alloc_netdev(0, XPNET_DEVICE_NAME, ether_setup);
if (xpnet_device == NULL) {
kfree(xpnet_broadcast_partitions);
return -ENOMEM;
@@ -573,13 +552,6 @@ xpnet_init(void)
netif_carrier_off(xpnet_device);
xpnet_device->mtu = XPNET_DEF_MTU;
- xpnet_device->change_mtu = xpnet_dev_change_mtu;
- xpnet_device->open = xpnet_dev_open;
- xpnet_device->get_stats = xpnet_dev_get_stats;
- xpnet_device->stop = xpnet_dev_stop;
- xpnet_device->hard_start_xmit = xpnet_dev_hard_start_xmit;
- xpnet_device->tx_timeout = xpnet_dev_tx_timeout;
- xpnet_device->set_config = xpnet_dev_set_config;
/*
* Multicast assumes the LSB of the first octet is set for multicast
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 36/42] gadget: convert devices to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (32 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 35/42] xpnet: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:05 ` David Miller
2009-01-07 0:33 ` [PATCH 37/42] synclink: " Stephen Hemminger
` (6 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, David Brownell; +Cc: netdev
[-- Attachment #1: gadget.patch --]
[-- Type: text/plain, Size: 1097 bytes --]
Convert to net_device_ops
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/usb/gadget/u_ether.c 2009-01-04 22:14:36.959037978 -0800
+++ b/drivers/usb/gadget/u_ether.c 2009-01-04 22:18:45.758033254 -0800
@@ -716,6 +716,14 @@ static int __init get_ether_addr(const c
static struct eth_dev *the_dev;
+static const struct net_device_ops eth_netdev_ops = {
+ .ndo_open = eth_open,
+ .ndo_stop = eth_stop,
+ .ndo_start_xmit = eth_start_xmit,
+ .ndo_change_mtu = ueth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
/**
* gether_setup - initialize one ethernet-over-usb link
@@ -764,12 +772,8 @@ int __init gether_setup(struct usb_gadge
if (ethaddr)
memcpy(ethaddr, dev->host_mac, ETH_ALEN);
- net->change_mtu = ueth_change_mtu;
- net->hard_start_xmit = eth_start_xmit;
- net->open = eth_open;
- net->stop = eth_stop;
- /* watchdog_timeo, tx_timeout ... */
- /* set_multicast_list */
+ net->netdev_ops = ð_netdev_ops;
+
SET_ETHTOOL_OPS(net, &ops);
/* two kinds of host-initiated state changes:
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 37/42] synclink: convert devices to new API
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (33 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 36/42] gadget: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-07 23:48 ` [PATCH 37/42] synclink: convert devices to new API (rev2) Stephen Hemminger
2009-01-07 0:33 ` [PATCH 38/42] uwb: convert devices to net_device_ops Stephen Hemminger
` (5 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, Alan Cox; +Cc: netdev
[-- Attachment #1: synclink.patch --]
[-- Type: text/plain, Size: 6840 bytes --]
Convert to net_device_ops and internal net_device_stats.
Remove unneeded last_rx update.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/char/pcmcia/synclink_cs.c | 15 +++++++++------
drivers/char/synclink.c | 15 +++++++++------
drivers/char/synclink_gt.c | 15 +++++++++------
drivers/char/synclinkmp.c | 15 +++++++++------
drivers/net/wan/hdlc.c | 17 +++--------------
include/linux/hdlc.h | 2 ++
6 files changed, 41 insertions(+), 38 deletions(-)
--- a/drivers/char/pcmcia/synclink_cs.c 2009-01-04 21:53:17.002282444 -0800
+++ b/drivers/char/pcmcia/synclink_cs.c 2009-01-04 21:53:51.974533932 -0800
@@ -4311,10 +4311,16 @@ static void hdlcdev_rx(MGSLPC_INFO *info
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -4341,10 +4347,7 @@ static int hdlcdev_init(MGSLPC_INFO *inf
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclink.c 2009-01-04 21:53:17.010282322 -0800
+++ b/drivers/char/synclink.c 2009-01-04 21:53:51.978533634 -0800
@@ -8007,10 +8007,16 @@ static void hdlcdev_rx(struct mgsl_struc
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -8033,15 +8039,12 @@ static int hdlcdev_init(struct mgsl_stru
}
/* for network layer reporting purposes only */
+ dev->netdev_ops = &hdlcdev_ops;
dev->base_addr = info->io_base;
dev->irq = info->irq_level;
dev->dma = info->dma_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclink_gt.c 2009-01-04 21:53:17.010282322 -0800
+++ b/drivers/char/synclink_gt.c 2009-01-04 21:53:51.982533169 -0800
@@ -1766,10 +1766,16 @@ static void hdlcdev_rx(struct slgt_info
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -1797,10 +1803,7 @@ static int hdlcdev_init(struct slgt_info
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclinkmp.c 2009-01-04 21:53:17.010282322 -0800
+++ b/drivers/char/synclinkmp.c 2009-01-04 21:53:51.986533063 -0800
@@ -1907,10 +1907,16 @@ static void hdlcdev_rx(SLMP_INFO *info,
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -1938,10 +1944,7 @@ static int hdlcdev_init(SLMP_INFO *info)
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/net/wan/hdlc.c 2009-01-04 21:43:07.402034096 -0800
+++ b/drivers/net/wan/hdlc.c 2009-01-04 21:53:51.986533063 -0800
@@ -44,22 +44,14 @@ static const char* version = "HDLC suppo
static struct hdlc_proto *first_proto;
-static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
+int hdlc_change_mtu(struct net_device *dev, int new_mtu)
{
if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
return -EINVAL;
dev->mtu = new_mtu;
return 0;
}
-
-
-
-static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
-{
- return &dev->stats;
-}
-
-
+EXPORT_SYMBOL(hdlc_change_mtu);
static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *p, struct net_device *orig_dev)
@@ -106,7 +98,7 @@ static int hdlc_device_event(struct noti
if (dev_net(dev) != &init_net)
return NOTIFY_DONE;
- if (dev->get_stats != hdlc_get_stats)
+ if (dev->header_ops != &hdlc_null_ops)
return NOTIFY_DONE; /* not an HDLC device */
if (event != NETDEV_CHANGE)
@@ -233,15 +225,12 @@ static void hdlc_setup_dev(struct net_de
/* Re-init all variables changed by HDLC protocol drivers,
* including ether_setup() called from hdlc_raw_eth.c.
*/
- dev->get_stats = hdlc_get_stats;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->mtu = HDLC_MAX_MTU;
dev->type = ARPHRD_RAWHDLC;
dev->hard_header_len = 16;
dev->addr_len = 0;
dev->header_ops = &hdlc_null_ops;
-
- dev->change_mtu = hdlc_change_mtu;
}
static void hdlc_setup(struct net_device *dev)
--- a/include/linux/hdlc.h 2009-01-04 21:43:07.466037830 -0800
+++ b/include/linux/hdlc.h 2009-01-04 21:53:51.986533063 -0800
@@ -103,6 +103,8 @@ int hdlc_open(struct net_device *dev);
/* Must be called by hardware driver when HDLC device is being closed */
void hdlc_close(struct net_device *dev);
+int hdlc_change_mtu(struct net_device *dev, int new_mtu);
+
int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
size_t size);
/* May be used by hardware driver to gain control over HDLC device */
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 37/42] synclink: convert devices to new API (rev2)
2009-01-07 0:33 ` [PATCH 37/42] synclink: " Stephen Hemminger
@ 2009-01-07 23:48 ` Stephen Hemminger
2009-01-08 2:08 ` David Miller
0 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 23:48 UTC (permalink / raw)
To: David Miller, Krzysztof Halasa; +Cc: netdev
Convert to net_device_ops and internal net_device_stats.
Remove unneeded last_rx update.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/char/pcmcia/synclink_cs.c | 15 +++++++++------
drivers/char/synclink.c | 15 +++++++++------
drivers/char/synclink_gt.c | 15 +++++++++------
drivers/char/synclinkmp.c | 15 +++++++++------
drivers/net/wan/hdlc.c | 21 +++++----------------
include/linux/hdlc.h | 2 ++
6 files changed, 43 insertions(+), 40 deletions(-)
--- a/drivers/char/pcmcia/synclink_cs.c 2009-01-07 15:26:51.830497659 -0800
+++ b/drivers/char/pcmcia/synclink_cs.c 2009-01-07 15:30:43.050748848 -0800
@@ -4311,10 +4311,16 @@ static void hdlcdev_rx(MGSLPC_INFO *info
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -4341,10 +4347,7 @@ static int hdlcdev_init(MGSLPC_INFO *inf
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclink.c 2009-01-07 15:26:51.810496861 -0800
+++ b/drivers/char/synclink.c 2009-01-07 15:30:43.054747103 -0800
@@ -8007,10 +8007,16 @@ static void hdlcdev_rx(struct mgsl_struc
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -8033,15 +8039,12 @@ static int hdlcdev_init(struct mgsl_stru
}
/* for network layer reporting purposes only */
+ dev->netdev_ops = &hdlcdev_ops;
dev->base_addr = info->io_base;
dev->irq = info->irq_level;
dev->dma = info->dma_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclink_gt.c 2009-01-07 15:26:51.798496911 -0800
+++ b/drivers/char/synclink_gt.c 2009-01-07 15:30:43.058746355 -0800
@@ -1766,10 +1766,16 @@ static void hdlcdev_rx(struct slgt_info
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -1797,10 +1803,7 @@ static int hdlcdev_init(struct slgt_info
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclinkmp.c 2009-01-07 15:26:51.818498600 -0800
+++ b/drivers/char/synclinkmp.c 2009-01-07 15:30:43.058746355 -0800
@@ -1907,10 +1907,16 @@ static void hdlcdev_rx(SLMP_INFO *info,
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -1938,10 +1944,7 @@ static int hdlcdev_init(SLMP_INFO *info)
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/net/wan/hdlc.c 2009-01-07 15:26:51.782497083 -0800
+++ b/drivers/net/wan/hdlc.c 2009-01-07 15:46:08.174365761 -0800
@@ -40,26 +40,20 @@
static const char* version = "HDLC support module revision 1.22";
+static const struct header_ops hdlc_null_ops;
+
#undef DEBUG_LINK
static struct hdlc_proto *first_proto;
-static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
+int hdlc_change_mtu(struct net_device *dev, int new_mtu)
{
if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
return -EINVAL;
dev->mtu = new_mtu;
return 0;
}
-
-
-
-static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
-{
- return &dev->stats;
-}
-
-
+EXPORT_SYMBOL(hdlc_change_mtu);
static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *p, struct net_device *orig_dev)
@@ -106,7 +100,7 @@ static int hdlc_device_event(struct noti
if (dev_net(dev) != &init_net)
return NOTIFY_DONE;
- if (dev->get_stats != hdlc_get_stats)
+ if (dev->header_ops != &hdlc_null_ops)
return NOTIFY_DONE; /* not an HDLC device */
if (event != NETDEV_CHANGE)
@@ -226,22 +220,17 @@ int hdlc_ioctl(struct net_device *dev, s
return -EINVAL;
}
-static const struct header_ops hdlc_null_ops;
-
static void hdlc_setup_dev(struct net_device *dev)
{
/* Re-init all variables changed by HDLC protocol drivers,
* including ether_setup() called from hdlc_raw_eth.c.
*/
- dev->get_stats = hdlc_get_stats;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->mtu = HDLC_MAX_MTU;
dev->type = ARPHRD_RAWHDLC;
dev->hard_header_len = 16;
dev->addr_len = 0;
dev->header_ops = &hdlc_null_ops;
-
- dev->change_mtu = hdlc_change_mtu;
}
static void hdlc_setup(struct net_device *dev)
--- a/include/linux/hdlc.h 2009-01-07 15:26:51.842497178 -0800
+++ b/include/linux/hdlc.h 2009-01-07 15:30:43.062746598 -0800
@@ -103,6 +103,8 @@ int hdlc_open(struct net_device *dev);
/* Must be called by hardware driver when HDLC device is being closed */
void hdlc_close(struct net_device *dev);
+int hdlc_change_mtu(struct net_device *dev, int new_mtu);
+
int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
size_t size);
/* May be used by hardware driver to gain control over HDLC device */
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 37/42] synclink: convert devices to new API (rev2)
2009-01-07 23:48 ` [PATCH 37/42] synclink: convert devices to new API (rev2) Stephen Hemminger
@ 2009-01-08 2:08 ` David Miller
2009-01-08 22:49 ` Krzysztof Halasa
0 siblings, 1 reply; 95+ messages in thread
From: David Miller @ 2009-01-08 2:08 UTC (permalink / raw)
To: shemminger; +Cc: khc, netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 7 Jan 2009 15:48:35 -0800
> Convert to net_device_ops and internal net_device_stats.
> Remove unneeded last_rx update.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
I'm deferring this while you and Krzysztof work out how
to implement this properly.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [PATCH 37/42] synclink: convert devices to new API (rev2)
2009-01-08 2:08 ` David Miller
@ 2009-01-08 22:49 ` Krzysztof Halasa
2009-01-08 22:55 ` Krzysztof Halasa
2009-01-13 0:18 ` David Miller
0 siblings, 2 replies; 95+ messages in thread
From: Krzysztof Halasa @ 2009-01-08 22:49 UTC (permalink / raw)
To: David Miller; +Cc: shemminger, netdev
David Miller <davem@davemloft.net> writes:
> I'm deferring this while you and Krzysztof work out how
> to implement this properly.
It seems it's ready. Tested with IXP4xx HSS against i686 + PCI200SYN.
X.25 not tested, as usual, but the remaining protocols seem to work.
I'll append the concatenated patch as well.
The following changes since commit 56cf391a9462a4897ea660a6af3662dda5ae8c84:
Inaky Perez-Gonzalez (1):
wimax: fix kernel-doc for debufs_dentry member of struct wimax_dev
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/chris/linux-2.6.git for-david
me:
WAN: Generic HDLC now uses IFF_WAN_HDLC private flag.
WAN: Allow hw HDLC drivers to override dev->get_stats.
Fix a comment in include/linux/netdevice.h.
WAN: Convert generic HDLC drivers to netdev_ops.
WAN: Fix NAPI interface in IXP4xx HSS driver.
drivers/char/pcmcia/synclink_cs.c | 18 +++++++++++-------
drivers/char/synclink.c | 18 +++++++++++-------
drivers/char/synclink_gt.c | 18 +++++++++++-------
drivers/char/synclinkmp.c | 18 +++++++++++-------
drivers/net/wan/c101.c | 12 ++++++++----
drivers/net/wan/cosa.c | 14 ++++++++++----
drivers/net/wan/dscc4.c | 18 +++++++++++-------
drivers/net/wan/farsync.c | 18 ++++++++++++------
drivers/net/wan/hdlc.c | 29 ++++++++++++++---------------
drivers/net/wan/hdlc_cisco.c | 1 -
drivers/net/wan/hdlc_fr.c | 28 +++++++++-------------------
drivers/net/wan/hdlc_ppp.c | 2 --
drivers/net/wan/hdlc_raw.c | 3 ---
drivers/net/wan/hdlc_raw_eth.c | 8 ++------
drivers/net/wan/hdlc_x25.c | 2 +-
drivers/net/wan/hostess_sv11.c | 12 +++++++++---
drivers/net/wan/ixp4xx_hss.c | 18 ++++++++++++------
drivers/net/wan/lmc/lmc_main.c | 19 +++++++++++--------
drivers/net/wan/lmc/lmc_proto.c | 17 +----------------
drivers/net/wan/n2.c | 12 ++++++++----
drivers/net/wan/pc300too.c | 12 ++++++++----
drivers/net/wan/pci200syn.c | 12 ++++++++----
drivers/net/wan/sealevel.c | 12 +++++++++---
drivers/net/wan/wanxl.c | 14 ++++++++++----
include/linux/hdlc.h | 5 +++++
include/linux/if.h | 1 +
include/linux/netdevice.h | 2 +-
27 files changed, 194 insertions(+), 149 deletions(-)
--
Krzysztof Halasa
^ permalink raw reply [flat|nested] 95+ messages in thread* Re: [PATCH 37/42] synclink: convert devices to new API (rev2)
2009-01-08 22:49 ` Krzysztof Halasa
@ 2009-01-08 22:55 ` Krzysztof Halasa
2009-01-13 0:18 ` David Miller
1 sibling, 0 replies; 95+ messages in thread
From: Krzysztof Halasa @ 2009-01-08 22:55 UTC (permalink / raw)
To: David Miller; +Cc: shemminger, netdev
> git://git.kernel.org/pub/scm/linux/kernel/git/chris/linux-2.6.git for-david
> WAN: Generic HDLC now uses IFF_WAN_HDLC private flag.
> WAN: Allow hw HDLC drivers to override dev->get_stats.
> Fix a comment in include/linux/netdevice.h.
> WAN: Convert generic HDLC drivers to netdev_ops.
> WAN: Fix NAPI interface in IXP4xx HSS driver.
The above is equal to:
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index dc073e1..5608a1e 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -4311,10 +4311,17 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -4341,11 +4348,8 @@ static int hdlcdev_init(MGSLPC_INFO *info)
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
- dev->watchdog_timeo = 10*HZ;
+ dev->netdev_ops = &hdlcdev_ops;
+ dev->watchdog_timeo = 10 * HZ;
dev->tx_queue_len = 50;
/* generic HDLC layer callbacks and settings */
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index b8063d4..0057a8f 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -8007,10 +8007,17 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size)
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -8038,11 +8045,8 @@ static int hdlcdev_init(struct mgsl_struct *info)
dev->dma = info->dma_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
- dev->watchdog_timeo = 10*HZ;
+ dev->netdev_ops = &hdlcdev_ops;
+ dev->watchdog_timeo = 10 * HZ;
dev->tx_queue_len = 50;
/* generic HDLC layer callbacks and settings */
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 53544e2..faf163d 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1766,10 +1766,17 @@ static void hdlcdev_rx(struct slgt_info *info, char *buf, int size)
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -1797,11 +1804,8 @@ static int hdlcdev_init(struct slgt_info *info)
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
- dev->watchdog_timeo = 10*HZ;
+ dev->netdev_ops = &hdlcdev_ops;
+ dev->watchdog_timeo = 10 * HZ;
dev->tx_queue_len = 50;
/* generic HDLC layer callbacks and settings */
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index 7b0c5b2..8eb6c89 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1907,10 +1907,17 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size)
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -1938,11 +1945,8 @@ static int hdlcdev_init(SLMP_INFO *info)
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
- dev->watchdog_timeo = 10*HZ;
+ dev->netdev_ops = &hdlcdev_ops;
+ dev->watchdog_timeo = 10 * HZ;
dev->tx_queue_len = 50;
/* generic HDLC layer callbacks and settings */
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c
index b468979..9693b0f 100644
--- a/drivers/net/wan/c101.c
+++ b/drivers/net/wan/c101.c
@@ -296,7 +296,13 @@ static void c101_destroy_card(card_t *card)
kfree(card);
}
-
+static const struct net_device_ops c101_ops = {
+ .ndo_open = c101_open,
+ .ndo_stop = c101_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = c101_ioctl,
+};
static int __init c101_run(unsigned long irq, unsigned long winbase)
{
@@ -367,9 +373,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)
dev->mem_start = winbase;
dev->mem_end = winbase + C101_MAPPED_RAM_SIZE - 1;
dev->tx_queue_len = 50;
- dev->do_ioctl = c101_ioctl;
- dev->open = c101_open;
- dev->stop = c101_close;
+ dev->netdev_ops = &c101_ops;
hdlc->attach = sca_attach;
hdlc->xmit = sca_xmit;
card->settings.clock_type = CLOCK_EXT;
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index d80b72e..0d7ba11 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -427,6 +427,15 @@ static void __exit cosa_exit(void)
}
module_exit(cosa_exit);
+static const struct net_device_ops cosa_ops = {
+ .ndo_open = cosa_net_open,
+ .ndo_stop = cosa_net_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = cosa_net_ioctl,
+ .ndo_tx_timeout = cosa_net_timeout,
+};
+
static int cosa_probe(int base, int irq, int dma)
{
struct cosa_data *cosa = cosa_cards+nr_cards;
@@ -575,10 +584,7 @@ static int cosa_probe(int base, int irq, int dma)
}
dev_to_hdlc(chan->netdev)->attach = cosa_net_attach;
dev_to_hdlc(chan->netdev)->xmit = cosa_net_tx;
- chan->netdev->open = cosa_net_open;
- chan->netdev->stop = cosa_net_close;
- chan->netdev->do_ioctl = cosa_net_ioctl;
- chan->netdev->tx_timeout = cosa_net_timeout;
+ chan->netdev->netdev_ops = &cosa_ops;
chan->netdev->watchdog_timeo = TX_TIMEOUT;
chan->netdev->base_addr = chan->cosa->datareg;
chan->netdev->irq = chan->cosa->irq;
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index 888025d..8face5d 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -883,6 +883,15 @@ static inline int dscc4_set_quartz(struct dscc4_dev_priv *dpriv, int hz)
return ret;
}
+static const struct net_device_ops dscc4_ops = {
+ .ndo_open = dscc4_open,
+ .ndo_stop = dscc4_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = dscc4_ioctl,
+ .ndo_tx_timeout = dscc4_tx_timeout,
+};
+
static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
{
struct dscc4_pci_priv *ppriv;
@@ -916,13 +925,8 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
hdlc_device *hdlc = dev_to_hdlc(d);
d->base_addr = (unsigned long)ioaddr;
- d->init = NULL;
d->irq = pdev->irq;
- d->open = dscc4_open;
- d->stop = dscc4_close;
- d->set_multicast_list = NULL;
- d->do_ioctl = dscc4_ioctl;
- d->tx_timeout = dscc4_tx_timeout;
+ d->netdev_ops = &dscc4_ops;
d->watchdog_timeo = TX_TIMEOUT;
SET_NETDEV_DEV(d, &pdev->dev);
@@ -1048,7 +1052,7 @@ static int dscc4_open(struct net_device *dev)
struct dscc4_pci_priv *ppriv;
int ret = -EAGAIN;
- if ((dscc4_loopback_check(dpriv) < 0) || !dev->hard_start_xmit)
+ if ((dscc4_loopback_check(dpriv) < 0))
goto err;
if ((ret = hdlc_open(dev)))
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 48a2c9d..00945f7 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -2424,6 +2424,15 @@ fst_init_card(struct fst_card_info *card)
type_strings[card->type], card->irq, card->nports);
}
+static const struct net_device_ops fst_ops = {
+ .ndo_open = fst_open,
+ .ndo_stop = fst_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = fst_ioctl,
+ .ndo_tx_timeout = fst_tx_timeout,
+};
+
/*
* Initialise card when detected.
* Returns 0 to indicate success, or errno otherwise.
@@ -2565,12 +2574,9 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
dev->base_addr = card->pci_conf;
dev->irq = card->irq;
- dev->tx_queue_len = FST_TX_QUEUE_LEN;
- dev->open = fst_open;
- dev->stop = fst_close;
- dev->do_ioctl = fst_ioctl;
- dev->watchdog_timeo = FST_TX_TIMEOUT;
- dev->tx_timeout = fst_tx_timeout;
+ dev->netdev_ops = &fst_ops;
+ dev->tx_queue_len = FST_TX_QUEUE_LEN;
+ dev->watchdog_timeo = FST_TX_TIMEOUT;
hdlc->attach = fst_attach;
hdlc->xmit = fst_start_xmit;
}
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 1f2a140..43da8bd 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -44,7 +44,7 @@ static const char* version = "HDLC support module revision 1.22";
static struct hdlc_proto *first_proto;
-static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
+int hdlc_change_mtu(struct net_device *dev, int new_mtu)
{
if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
return -EINVAL;
@@ -52,15 +52,6 @@ static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
return 0;
}
-
-
-static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
-{
- return &dev->stats;
-}
-
-
-
static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *p, struct net_device *orig_dev)
{
@@ -75,7 +66,15 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
return hdlc->proto->netif_rx(skb);
}
+int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+ hdlc_device *hdlc = dev_to_hdlc(dev);
+
+ if (hdlc->proto->xmit)
+ return hdlc->proto->xmit(skb, dev);
+ return hdlc->xmit(skb, dev); /* call hardware driver directly */
+}
static inline void hdlc_proto_start(struct net_device *dev)
{
@@ -102,11 +101,11 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
hdlc_device *hdlc;
unsigned long flags;
int on;
-
+
if (dev_net(dev) != &init_net)
return NOTIFY_DONE;
- if (dev->get_stats != hdlc_get_stats)
+ if (!(dev->priv_flags & IFF_WAN_HDLC))
return NOTIFY_DONE; /* not an HDLC device */
if (event != NETDEV_CHANGE)
@@ -233,15 +232,13 @@ static void hdlc_setup_dev(struct net_device *dev)
/* Re-init all variables changed by HDLC protocol drivers,
* including ether_setup() called from hdlc_raw_eth.c.
*/
- dev->get_stats = hdlc_get_stats;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
+ dev->priv_flags = IFF_WAN_HDLC;
dev->mtu = HDLC_MAX_MTU;
dev->type = ARPHRD_RAWHDLC;
dev->hard_header_len = 16;
dev->addr_len = 0;
dev->header_ops = &hdlc_null_ops;
-
- dev->change_mtu = hdlc_change_mtu;
}
static void hdlc_setup(struct net_device *dev)
@@ -339,6 +336,8 @@ MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
MODULE_DESCRIPTION("HDLC support module");
MODULE_LICENSE("GPL v2");
+EXPORT_SYMBOL(hdlc_change_mtu);
+EXPORT_SYMBOL(hdlc_start_xmit);
EXPORT_SYMBOL(hdlc_open);
EXPORT_SYMBOL(hdlc_close);
EXPORT_SYMBOL(hdlc_ioctl);
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index 44e64b1..af3fd4f 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -382,7 +382,6 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
memcpy(&state(hdlc)->settings, &new_settings, size);
spin_lock_init(&state(hdlc)->lock);
- dev->hard_start_xmit = hdlc->xmit;
dev->header_ops = &cisco_header_ops;
dev->type = ARPHRD_CISCO;
netif_dormant_on(dev);
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index f1ddd7c..70e57ce 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -444,18 +444,6 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
return 0;
}
-
-
-static int pvc_change_mtu(struct net_device *dev, int new_mtu)
-{
- if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
- return -EINVAL;
- dev->mtu = new_mtu;
- return 0;
-}
-
-
-
static inline void fr_log_dlci_active(pvc_device *pvc)
{
printk(KERN_INFO "%s: DLCI %d [%s%s%s]%s %s\n",
@@ -1068,6 +1056,14 @@ static void pvc_setup(struct net_device *dev)
dev->addr_len = 2;
}
+static const struct net_device_ops pvc_ops = {
+ .ndo_open = pvc_open,
+ .ndo_stop = pvc_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = pvc_xmit,
+ .ndo_do_ioctl = pvc_ioctl,
+};
+
static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
{
hdlc_device *hdlc = dev_to_hdlc(frad);
@@ -1104,11 +1100,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
*(__be16*)dev->dev_addr = htons(dlci);
dlci_to_q922(dev->broadcast, dlci);
}
- dev->hard_start_xmit = pvc_xmit;
- dev->open = pvc_open;
- dev->stop = pvc_close;
- dev->do_ioctl = pvc_ioctl;
- dev->change_mtu = pvc_change_mtu;
+ dev->netdev_ops = &pvc_ops;
dev->mtu = HDLC_MAX_MTU;
dev->tx_queue_len = 0;
dev->ml_priv = pvc;
@@ -1260,8 +1252,6 @@ static int fr_ioctl(struct net_device *dev, struct ifreq *ifr)
state(hdlc)->dce_pvc_count = 0;
}
memcpy(&state(hdlc)->settings, &new_settings, size);
-
- dev->hard_start_xmit = hdlc->xmit;
dev->type = ARPHRD_FRAD;
return 0;
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 57fe714..7b8a5ea 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -558,7 +558,6 @@ out:
return NET_RX_DROP;
}
-
static void ppp_timer(unsigned long arg)
{
struct proto *proto = (struct proto *)arg;
@@ -679,7 +678,6 @@ static int ppp_ioctl(struct net_device *dev, struct ifreq *ifr)
ppp->keepalive_interval = 10;
ppp->keepalive_timeout = 60;
- dev->hard_start_xmit = hdlc->xmit;
dev->hard_header_len = sizeof(struct hdlc_header);
dev->header_ops = &ppp_header_ops;
dev->type = ARPHRD_PPP;
diff --git a/drivers/net/wan/hdlc_raw.c b/drivers/net/wan/hdlc_raw.c
index 8612311..6e92c64 100644
--- a/drivers/net/wan/hdlc_raw.c
+++ b/drivers/net/wan/hdlc_raw.c
@@ -30,8 +30,6 @@ static __be16 raw_type_trans(struct sk_buff *skb, struct net_device *dev)
return __constant_htons(ETH_P_IP);
}
-
-
static struct hdlc_proto proto = {
.type_trans = raw_type_trans,
.ioctl = raw_ioctl,
@@ -86,7 +84,6 @@ static int raw_ioctl(struct net_device *dev, struct ifreq *ifr)
if (result)
return result;
memcpy(hdlc->state, &new_settings, size);
- dev->hard_start_xmit = hdlc->xmit;
dev->type = ARPHRD_RAWHDLC;
netif_dormant_off(dev);
return 0;
diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c
index a13fc32..49e68f5 100644
--- a/drivers/net/wan/hdlc_raw_eth.c
+++ b/drivers/net/wan/hdlc_raw_eth.c
@@ -45,6 +45,7 @@ static int eth_tx(struct sk_buff *skb, struct net_device *dev)
static struct hdlc_proto proto = {
.type_trans = eth_type_trans,
+ .xmit = eth_tx,
.ioctl = raw_eth_ioctl,
.module = THIS_MODULE,
};
@@ -56,9 +57,7 @@ static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr)
const size_t size = sizeof(raw_hdlc_proto);
raw_hdlc_proto new_settings;
hdlc_device *hdlc = dev_to_hdlc(dev);
- int result;
- int (*old_ch_mtu)(struct net_device *, int);
- int old_qlen;
+ int result, old_qlen;
switch (ifr->ifr_settings.type) {
case IF_GET_PROTO:
@@ -99,11 +98,8 @@ static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr)
if (result)
return result;
memcpy(hdlc->state, &new_settings, size);
- dev->hard_start_xmit = eth_tx;
- old_ch_mtu = dev->change_mtu;
old_qlen = dev->tx_queue_len;
ether_setup(dev);
- dev->change_mtu = old_ch_mtu;
dev->tx_queue_len = old_qlen;
random_ether_addr(dev->dev_addr);
netif_dormant_off(dev);
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c
index cbcbf6f..b1dc29e 100644
--- a/drivers/net/wan/hdlc_x25.c
+++ b/drivers/net/wan/hdlc_x25.c
@@ -184,6 +184,7 @@ static struct hdlc_proto proto = {
.close = x25_close,
.ioctl = x25_ioctl,
.netif_rx = x25_rx,
+ .xmit = x25_xmit,
.module = THIS_MODULE,
};
@@ -213,7 +214,6 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr)
if ((result = attach_hdlc_protocol(dev, &proto, 0)))
return result;
- dev->hard_start_xmit = x25_xmit;
dev->type = ARPHRD_X25;
netif_dormant_off(dev);
return 0;
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index af54f0c..567d4f5 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -173,6 +173,14 @@ static int hostess_attach(struct net_device *dev, unsigned short encoding,
* Description block for a Comtrol Hostess SV11 card
*/
+static const struct net_device_ops hostess_ops = {
+ .ndo_open = hostess_open,
+ .ndo_stop = hostess_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = hostess_ioctl,
+};
+
static struct z8530_dev *sv11_init(int iobase, int irq)
{
struct z8530_dev *sv;
@@ -267,9 +275,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
dev_to_hdlc(netdev)->attach = hostess_attach;
dev_to_hdlc(netdev)->xmit = hostess_queue_xmit;
- netdev->open = hostess_open;
- netdev->stop = hostess_close;
- netdev->do_ioctl = hostess_ioctl;
+ netdev->netdev_ops = &hostess_ops;
netdev->base_addr = iobase;
netdev->irq = irq;
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index 2dc2416..7e8bbba 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -622,7 +622,7 @@ static void hss_hdlc_rx_irq(void *pdev)
printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name);
#endif
qmgr_disable_irq(queue_ids[port->id].rx);
- netif_rx_schedule(dev, &port->napi);
+ netif_rx_schedule(&port->napi);
}
static int hss_hdlc_poll(struct napi_struct *napi, int budget)
@@ -651,7 +651,7 @@ static int hss_hdlc_poll(struct napi_struct *napi, int budget)
printk(KERN_DEBUG "%s: hss_hdlc_poll"
" netif_rx_complete\n", dev->name);
#endif
- netif_rx_complete(dev, napi);
+ netif_rx_complete(napi);
qmgr_enable_irq(rxq);
if (!qmgr_stat_empty(rxq) &&
netif_rx_reschedule(napi)) {
@@ -1069,7 +1069,7 @@ static int hss_hdlc_open(struct net_device *dev)
hss_start_hdlc(port);
/* we may already have RX data, enables IRQ */
- netif_rx_schedule(dev, &port->napi);
+ netif_rx_schedule(&port->napi);
return 0;
err_unlock:
@@ -1230,6 +1230,14 @@ static int hss_hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
* initialization
****************************************************************************/
+static const struct net_device_ops hss_hdlc_ops = {
+ .ndo_open = hss_hdlc_open,
+ .ndo_stop = hss_hdlc_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = hss_hdlc_ioctl,
+};
+
static int __devinit hss_init_one(struct platform_device *pdev)
{
struct port *port;
@@ -1254,9 +1262,7 @@ static int __devinit hss_init_one(struct platform_device *pdev)
hdlc = dev_to_hdlc(dev);
hdlc->attach = hss_hdlc_attach;
hdlc->xmit = hss_hdlc_xmit;
- dev->open = hss_hdlc_open;
- dev->stop = hss_hdlc_close;
- dev->do_ioctl = hss_hdlc_ioctl;
+ dev->netdev_ops = &hss_hdlc_ops;
dev->tx_queue_len = 100;
port->clock_type = CLOCK_EXT;
port->clock_rate = 2048000;
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index feac3b9..45b1822 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -806,6 +806,16 @@ static int lmc_attach(struct net_device *dev, unsigned short encoding,
return -EINVAL;
}
+static const struct net_device_ops lmc_ops = {
+ .ndo_open = lmc_open,
+ .ndo_stop = lmc_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = lmc_ioctl,
+ .ndo_tx_timeout = lmc_driver_timeout,
+ .ndo_get_stats = lmc_get_stats,
+};
+
static int __devinit lmc_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -849,11 +859,7 @@ static int __devinit lmc_init_one(struct pci_dev *pdev,
dev->type = ARPHRD_HDLC;
dev_to_hdlc(dev)->xmit = lmc_start_xmit;
dev_to_hdlc(dev)->attach = lmc_attach;
- dev->open = lmc_open;
- dev->stop = lmc_close;
- dev->get_stats = lmc_get_stats;
- dev->do_ioctl = lmc_ioctl;
- dev->tx_timeout = lmc_driver_timeout;
+ dev->netdev_ops = &lmc_ops;
dev->watchdog_timeo = HZ; /* 1 second */
dev->tx_queue_len = 100;
sc->lmc_device = dev;
@@ -1059,9 +1065,6 @@ static int lmc_open(struct net_device *dev)
if ((err = lmc_proto_open(sc)) != 0)
return err;
- dev->do_ioctl = lmc_ioctl;
-
-
netif_start_queue(dev);
sc->extra_stats.tx_tbusy0++;
diff --git a/drivers/net/wan/lmc/lmc_proto.c b/drivers/net/wan/lmc/lmc_proto.c
index 94b4c20..044a481 100644
--- a/drivers/net/wan/lmc/lmc_proto.c
+++ b/drivers/net/wan/lmc/lmc_proto.c
@@ -51,30 +51,15 @@
void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
{
lmc_trace(sc->lmc_device, "lmc_proto_attach in");
- switch(sc->if_type){
- case LMC_PPP:
- {
- struct net_device *dev = sc->lmc_device;
- dev->do_ioctl = lmc_ioctl;
- }
- break;
- case LMC_NET:
- {
+ if (sc->if_type == LMC_NET) {
struct net_device *dev = sc->lmc_device;
/*
* They set a few basics because they don't use HDLC
*/
dev->flags |= IFF_POINTOPOINT;
-
dev->hard_header_len = 0;
dev->addr_len = 0;
}
- case LMC_RAW: /* Setup the task queue, maybe we should notify someone? */
- {
- }
- default:
- break;
- }
lmc_trace(sc->lmc_device, "lmc_proto_attach out");
}
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c
index 697715a..83da596 100644
--- a/drivers/net/wan/n2.c
+++ b/drivers/net/wan/n2.c
@@ -324,7 +324,13 @@ static void n2_destroy_card(card_t *card)
kfree(card);
}
-
+static const struct net_device_ops n2_ops = {
+ .ndo_open = n2_open,
+ .ndo_stop = n2_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = n2_ioctl,
+};
static int __init n2_run(unsigned long io, unsigned long irq,
unsigned long winbase, long valid0, long valid1)
@@ -460,9 +466,7 @@ static int __init n2_run(unsigned long io, unsigned long irq,
dev->mem_start = winbase;
dev->mem_end = winbase + USE_WINDOWSIZE - 1;
dev->tx_queue_len = 50;
- dev->do_ioctl = n2_ioctl;
- dev->open = n2_open;
- dev->stop = n2_close;
+ dev->netdev_ops = &n2_ops;
hdlc->attach = sca_attach;
hdlc->xmit = sca_xmit;
port->settings.clock_type = CLOCK_EXT;
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index f247e5d..60ece54 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -287,7 +287,13 @@ static void pc300_pci_remove_one(struct pci_dev *pdev)
kfree(card);
}
-
+static const struct net_device_ops pc300_ops = {
+ .ndo_open = pc300_open,
+ .ndo_stop = pc300_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = pc300_ioctl,
+};
static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
@@ -448,9 +454,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
dev->mem_start = ramphys;
dev->mem_end = ramphys + ramsize - 1;
dev->tx_queue_len = 50;
- dev->do_ioctl = pc300_ioctl;
- dev->open = pc300_open;
- dev->stop = pc300_close;
+ dev->netdev_ops = &pc300_ops;
hdlc->attach = sca_attach;
hdlc->xmit = sca_xmit;
port->settings.clock_type = CLOCK_EXT;
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index 1104d3a..e035d8c 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -265,7 +265,13 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
kfree(card);
}
-
+static const struct net_device_ops pci200_ops = {
+ .ndo_open = pci200_open,
+ .ndo_stop = pci200_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = pci200_ioctl,
+};
static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
@@ -395,9 +401,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
dev->mem_start = ramphys;
dev->mem_end = ramphys + ramsize - 1;
dev->tx_queue_len = 50;
- dev->do_ioctl = pci200_ioctl;
- dev->open = pci200_open;
- dev->stop = pci200_close;
+ dev->netdev_ops = &pci200_ops;
hdlc->attach = sca_attach;
hdlc->xmit = sca_xmit;
port->settings.clock_type = CLOCK_EXT;
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 0941a26..23b2690 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -169,6 +169,14 @@ static int sealevel_attach(struct net_device *dev, unsigned short encoding,
return -EINVAL;
}
+static const struct net_device_ops sealevel_ops = {
+ .ndo_open = sealevel_open,
+ .ndo_stop = sealevel_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = sealevel_ioctl,
+};
+
static int slvl_setup(struct slvl_device *sv, int iobase, int irq)
{
struct net_device *dev = alloc_hdlcdev(sv);
@@ -177,9 +185,7 @@ static int slvl_setup(struct slvl_device *sv, int iobase, int irq)
dev_to_hdlc(dev)->attach = sealevel_attach;
dev_to_hdlc(dev)->xmit = sealevel_queue_xmit;
- dev->open = sealevel_open;
- dev->stop = sealevel_close;
- dev->do_ioctl = sealevel_ioctl;
+ dev->netdev_ops = &sealevel_ops;
dev->base_addr = iobase;
dev->irq = irq;
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 4bffb67..887acb0 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -547,6 +547,15 @@ static void wanxl_pci_remove_one(struct pci_dev *pdev)
#include "wanxlfw.inc"
+static const struct net_device_ops wanxl_ops = {
+ .ndo_open = wanxl_open,
+ .ndo_stop = wanxl_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_start_xmit = hdlc_start_xmit,
+ .ndo_do_ioctl = wanxl_ioctl,
+ .ndo_get_stats = wanxl_get_stats,
+};
+
static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -777,12 +786,9 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
hdlc = dev_to_hdlc(dev);
spin_lock_init(&port->lock);
dev->tx_queue_len = 50;
- dev->do_ioctl = wanxl_ioctl;
- dev->open = wanxl_open;
- dev->stop = wanxl_close;
+ dev->netdev_ops = &wanxl_ops;
hdlc->attach = wanxl_attach;
hdlc->xmit = wanxl_xmit;
- dev->get_stats = wanxl_get_stats;
port->card = card;
port->node = i;
get_status(port)->clocking = CLOCK_EXT;
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index fd47a15..6a6e701 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -38,6 +38,7 @@ struct hdlc_proto {
int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
__be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
int (*netif_rx)(struct sk_buff *skb);
+ int (*xmit)(struct sk_buff *skb, struct net_device *dev);
struct module *module;
struct hdlc_proto *next; /* next protocol in the list */
};
@@ -102,6 +103,10 @@ static __inline__ void debug_frame(const struct sk_buff *skb)
int hdlc_open(struct net_device *dev);
/* Must be called by hardware driver when HDLC device is being closed */
void hdlc_close(struct net_device *dev);
+/* May be used by hardware driver */
+int hdlc_change_mtu(struct net_device *dev, int new_mtu);
+/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
+int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
size_t size);
diff --git a/include/linux/if.h b/include/linux/if.h
index 2a6e296..1108f3e 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -66,6 +66,7 @@
#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
+#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
#define IF_GET_IFACE 0x0001 /* for querying only */
#define IF_GET_PROTO 0x0002
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 114091b..353d2e6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -467,7 +467,7 @@ struct netdev_queue {
* This function is called when network device transistions to the down
* state.
*
- * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
+ * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev);
* Called when a packet needs to be transmitted.
* Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
* Required can not be NULL.
--
Krzysztof Halasa
^ permalink raw reply related [flat|nested] 95+ messages in thread* Re: [PATCH 37/42] synclink: convert devices to new API (rev2)
2009-01-08 22:49 ` Krzysztof Halasa
2009-01-08 22:55 ` Krzysztof Halasa
@ 2009-01-13 0:18 ` David Miller
1 sibling, 0 replies; 95+ messages in thread
From: David Miller @ 2009-01-13 0:18 UTC (permalink / raw)
To: khc; +Cc: shemminger, netdev
From: Krzysztof Halasa <khc@pm.waw.pl>
Date: Thu, 08 Jan 2009 23:49:37 +0100
> git://git.kernel.org/pub/scm/linux/kernel/git/chris/linux-2.6.git for-david
>
> me:
> WAN: Generic HDLC now uses IFF_WAN_HDLC private flag.
> WAN: Allow hw HDLC drivers to override dev->get_stats.
> Fix a comment in include/linux/netdevice.h.
> WAN: Convert generic HDLC drivers to netdev_ops.
> WAN: Fix NAPI interface in IXP4xx HSS driver.
Krzysztof, I integrated these changes into my local tree.
Thanks a lot.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [PATCH 38/42] uwb: convert devices to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (34 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 37/42] synclink: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-07 10:38 ` David Vrabel
2009-01-07 0:33 ` [PATCH 39/42] slip: convert " Stephen Hemminger
` (4 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller, david.vrabel; +Cc: netdev
[-- Attachment #1: uwb.patch --]
[-- Type: text/plain, Size: 4153 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/uwb/i1480/i1480u-wlp/lc.c 2009-01-05 14:31:38.074069717 -0800
+++ b/drivers/uwb/i1480/i1480u-wlp/lc.c 2009-01-05 14:36:27.342318530 -0800
@@ -181,6 +181,15 @@ error:
}
#endif
+static const struct net_device_ops i1480u_netdev_ops = {
+ .ndo_open = i1480u_open,
+ .ndo_stop = i1480u_stop,
+ .ndo_start_xmit = i1480u_hard_start_xmit,
+ .ndo_tx_timeout = i1480u_tx_timeout,
+ .ndo_set_config = i1480u_set_config,
+ .ndo_change_mtu = i1480u_change_mtu,
+};
+
static
int i1480u_add(struct i1480u *i1480u, struct usb_interface *iface)
{
@@ -235,13 +244,7 @@ int i1480u_add(struct i1480u *i1480u, st
net_dev->features |= NETIF_F_HIGHDMA;
net_dev->watchdog_timeo = 5*HZ; /* FIXME: a better default? */
- net_dev->open = i1480u_open;
- net_dev->stop = i1480u_stop;
- net_dev->hard_start_xmit = i1480u_hard_start_xmit;
- net_dev->tx_timeout = i1480u_tx_timeout;
- net_dev->get_stats = i1480u_get_stats;
- net_dev->set_config = i1480u_set_config;
- net_dev->change_mtu = i1480u_change_mtu;
+ net_dev->netdev_ops = &i1480u_netdev_ops;
#ifdef i1480u_FLOW_CONTROL
/* Notification endpoint setup (submitted when we open the device) */
--- a/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h 2009-01-05 14:35:49.078569623 -0800
+++ b/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h 2009-01-05 14:36:06.718845136 -0800
@@ -221,7 +221,6 @@ struct i1480u {
struct net_device *net_dev;
spinlock_t lock;
- struct net_device_stats stats;
/* RX context handling */
struct sk_buff *rx_skb;
@@ -271,7 +270,6 @@ extern int i1480u_stop(struct net_device
extern int i1480u_hard_start_xmit(struct sk_buff *, struct net_device *);
extern void i1480u_tx_timeout(struct net_device *);
extern int i1480u_set_config(struct net_device *, struct ifmap *);
-extern struct net_device_stats *i1480u_get_stats(struct net_device *);
extern int i1480u_change_mtu(struct net_device *, int);
extern void i1480u_uwb_notifs_cb(void *, struct uwb_dev *, enum uwb_notifs);
--- a/drivers/uwb/i1480/i1480u-wlp/netdev.c 2009-01-05 14:34:29.010821205 -0800
+++ b/drivers/uwb/i1480/i1480u-wlp/netdev.c 2009-01-05 14:36:19.862975627 -0800
@@ -262,15 +262,6 @@ int i1480u_stop(struct net_device *net_d
return 0;
}
-
-/** Report statistics */
-struct net_device_stats *i1480u_get_stats(struct net_device *net_dev)
-{
- struct i1480u *i1480u = netdev_priv(net_dev);
- return &i1480u->stats;
-}
-
-
/**
*
* Change the interface config--we probably don't have to do anything.
--- a/drivers/uwb/i1480/i1480u-wlp/rx.c 2009-01-05 14:37:21.409819109 -0800
+++ b/drivers/uwb/i1480/i1480u-wlp/rx.c 2009-01-05 14:46:48.222569803 -0800
@@ -167,7 +167,7 @@ do { \
do { \
if (printk_ratelimit()) \
dev_err(&i1480u->usb_iface->dev, msg); \
- i1480u->stats.rx_dropped++; \
+ i1480u->net_dev->stats.rx_dropped++; \
} while (0)
@@ -193,10 +193,8 @@ void i1480u_skb_deliver(struct i1480u *i
if (!should_parse)
goto out;
i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev);
- i1480u->stats.rx_packets++;
- i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size;
- net_dev->last_rx = jiffies;
- /* FIXME: flow control: check netif_rx() retval */
+ net_dev->stats.rx_packets++;
+ net_dev->stats.rx_bytes += i1480u->rx_untd_pkt_size;
netif_rx(i1480u->rx_skb); /* deliver */
out:
--- a/drivers/uwb/i1480/i1480u-wlp/tx.c 2009-01-05 14:38:33.469819531 -0800
+++ b/drivers/uwb/i1480/i1480u-wlp/tx.c 2009-01-05 14:46:39.510569625 -0800
@@ -117,8 +117,8 @@ void i1480u_tx_cb(struct urb *urb)
switch (urb->status) {
case 0:
spin_lock_irqsave(&i1480u->lock, flags);
- i1480u->stats.tx_packets++;
- i1480u->stats.tx_bytes += urb->actual_length;
+ net_dev->stats.tx_packets++;
+ net_dev->stats.tx_bytes += urb->actual_length;
spin_unlock_irqrestore(&i1480u->lock, flags);
break;
case -ECONNRESET: /* Not an error, but a controlled situation; */
@@ -530,7 +530,7 @@ int i1480u_hard_start_xmit(struct sk_buf
return NETDEV_TX_OK;
error:
dev_kfree_skb_any(skb);
- i1480u->stats.tx_dropped++;
+ net_dev->stats.tx_dropped++;
out:
return NETDEV_TX_OK;
}
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 39/42] slip: convert to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (35 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 38/42] uwb: convert devices to net_device_ops Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:09 ` David Miller
2009-01-07 0:33 ` [PATCH 40/42] amd8111e: " Stephen Hemminger
` (3 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: slip.patch --]
[-- Type: text/plain, Size: 1356 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/slip.c 2009-01-05 17:15:19.435319615 -0800
+++ b/drivers/net/slip.c 2009-01-05 17:15:54.926064690 -0800
@@ -603,7 +603,6 @@ static int sl_init(struct net_device *de
dev->mtu = sl->mtu;
dev->type = ARPHRD_SLIP + sl->mode;
#ifdef SL_CHECK_TRANSMIT
- dev->tx_timeout = sl_tx_timeout;
dev->watchdog_timeo = 20*HZ;
#endif
return 0;
@@ -617,19 +616,26 @@ static void sl_uninit(struct net_device
sl_free_bufs(sl);
}
+static const struct net_device_ops sl_netdev_ops = {
+ .ndo_init = sl_init,
+ .ndo_uninit = sl_uninit,
+ .ndo_open = sl_open,
+ .ndo_stop = sl_close,
+ .ndo_start_xmit = sl_xmit,
+ .ndo_get_stats = sl_get_stats,
+ .ndo_change_mtu = sl_change_mtu,
+ .ndo_tx_timeout = sl_tx_timeout,
+#ifdef CONFIG_SLIP_SMART
+ .ndo_do_ioctl = sl_ioctl,
+#endif
+};
+
+
static void sl_setup(struct net_device *dev)
{
- dev->init = sl_init;
- dev->uninit = sl_uninit;
- dev->open = sl_open;
+ dev->netdev_ops = &sl_netdev_ops;
dev->destructor = free_netdev;
- dev->stop = sl_close;
- dev->get_stats = sl_get_stats;
- dev->change_mtu = sl_change_mtu;
- dev->hard_start_xmit = sl_xmit;
-#ifdef CONFIG_SLIP_SMART
- dev->do_ioctl = sl_ioctl;
-#endif
+
dev->hard_header_len = 0;
dev->addr_len = 0;
dev->tx_queue_len = 10;
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 40/42] amd8111e: convert to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (36 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 39/42] slip: convert " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:10 ` David Miller
2009-01-07 0:33 ` [PATCH 41/42] atp: " Stephen Hemminger
` (2 subsequent siblings)
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: amd8111e.patch --]
[-- Type: text/plain, Size: 2323 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/amd8111e.c 2009-01-05 16:51:26.431069139 -0800
+++ b/drivers/net/amd8111e.c 2009-01-05 16:53:51.933650831 -0800
@@ -1813,6 +1813,25 @@ static void __devinit amd8111e_probe_ext
lp->ext_phy_addr = 1;
}
+static const struct net_device_ops amd8111e_netdev_ops = {
+ .ndo_open = amd8111e_open,
+ .ndo_stop = amd8111e_close,
+ .ndo_start_xmit = amd8111e_start_xmit,
+ .ndo_tx_timeout = amd8111e_tx_timeout,
+ .ndo_get_stats = amd8111e_get_stats,
+ .ndo_set_multicast_list = amd8111e_set_multicast_list,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = amd8111e_set_mac_address,
+ .ndo_do_ioctl = amd8111e_ioctl,
+ .ndo_change_mtu = amd8111e_change_mtu,
+#if AMD8111E_VLAN_TAG_USED
+ .ndo_vlan_rx_register = amd8111e_vlan_rx_register,
+#endif
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = amd8111e_poll,
+#endif
+};
+
static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -1872,7 +1891,6 @@ static int __devinit amd8111e_probe_one(
#if AMD8111E_VLAN_TAG_USED
dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ;
- dev->vlan_rx_register =amd8111e_vlan_rx_register;
#endif
lp = netdev_priv(dev);
@@ -1901,27 +1919,16 @@ static int __devinit amd8111e_probe_one(
if(dynamic_ipg[card_idx++])
lp->options |= OPTION_DYN_IPG_ENABLE;
+
/* Initialize driver entry points */
- dev->open = amd8111e_open;
- dev->hard_start_xmit = amd8111e_start_xmit;
- dev->stop = amd8111e_close;
- dev->get_stats = amd8111e_get_stats;
- dev->set_multicast_list = amd8111e_set_multicast_list;
- dev->set_mac_address = amd8111e_set_mac_address;
- dev->do_ioctl = amd8111e_ioctl;
- dev->change_mtu = amd8111e_change_mtu;
+ dev->netdev_ops = &amd8111e_netdev_ops;
SET_ETHTOOL_OPS(dev, &ops);
dev->irq =pdev->irq;
- dev->tx_timeout = amd8111e_tx_timeout;
dev->watchdog_timeo = AMD8111E_TX_TIMEOUT;
netif_napi_add(dev, &lp->napi, amd8111e_rx_poll, 32);
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = amd8111e_poll;
-#endif
#if AMD8111E_VLAN_TAG_USED
dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
- dev->vlan_rx_register =amd8111e_vlan_rx_register;
#endif
/* Probe the external PHY */
amd8111e_probe_ext_phy(dev);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 41/42] atp: convert to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (37 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 40/42] amd8111e: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:10 ` David Miller
2009-01-07 0:33 ` [PATCH 42/42] b44: " Stephen Hemminger
[not found] ` <20090107003345.872219054@vyatta.com>
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: atp.patch --]
[-- Type: text/plain, Size: 2080 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/atp.c 2009-01-05 14:54:20.114569210 -0800
+++ b/drivers/net/atp.c 2009-01-05 14:58:55.166569651 -0800
@@ -204,8 +204,7 @@ static irqreturn_t atp_interrupt(int irq
static void net_rx(struct net_device *dev);
static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode);
static int net_close(struct net_device *dev);
-static void set_rx_mode_8002(struct net_device *dev);
-static void set_rx_mode_8012(struct net_device *dev);
+static void set_rx_mode(struct net_device *dev);
static void tx_timeout(struct net_device *dev);
@@ -242,6 +241,17 @@ static int __init atp_init(void)
return -ENODEV;
}
+static const struct net_device_ops atp_netdev_ops = {
+ .ndo_open = net_open,
+ .ndo_stop = net_close,
+ .ndo_start_xmit = atp_send_packet,
+ .ndo_set_multicast_list = set_rx_mode,
+ .ndo_tx_timeout = tx_timeout,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
static int __init atp_probe1(long ioaddr)
{
struct net_device *dev = NULL;
@@ -342,12 +352,7 @@ static int __init atp_probe1(long ioaddr
if (dev->mem_end & 0xf)
net_debug = dev->mem_end & 7;
- dev->open = net_open;
- dev->stop = net_close;
- dev->hard_start_xmit = atp_send_packet;
- dev->set_multicast_list =
- lp->chip_type == RTL8002 ? &set_rx_mode_8002 : &set_rx_mode_8012;
- dev->tx_timeout = tx_timeout;
+ dev->netdev_ops = &atp_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT;
res = register_netdev(dev);
@@ -903,6 +908,17 @@ static void set_rx_mode_8012(struct net_
write_reg(ioaddr, CMR2, CMR2_IRQOUT); /* Switch back to page 0 */
}
+static void set_rx_mode(struct net_device *dev)
+{
+ struct net_local *lp = netdev_priv(dev);
+
+ if (lp->chip_type == RTL8002)
+ return set_rx_mode_8002(dev);
+ else
+ return set_rx_mode_8012(dev);
+}
+
+
static int __init atp_init_module(void) {
if (debug) /* Emit version even if no cards detected. */
printk(KERN_INFO "%s", version);
--
^ permalink raw reply [flat|nested] 95+ messages in thread* [PATCH 42/42] b44: convert to net_device_ops
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
` (38 preceding siblings ...)
2009-01-07 0:33 ` [PATCH 41/42] atp: " Stephen Hemminger
@ 2009-01-07 0:33 ` Stephen Hemminger
2009-01-08 2:10 ` David Miller
[not found] ` <20090107003345.872219054@vyatta.com>
40 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2009-01-07 0:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: b44.patch --]
[-- Type: text/plain, Size: 1626 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/b44.c 2009-01-06 14:16:03.441860786 -0800
+++ b/drivers/net/b44.c 2009-01-06 14:29:04.120610422 -0800
@@ -2108,6 +2108,22 @@ static int __devinit b44_get_invariants(
return err;
}
+static const struct net_device_ops b44_netdev_ops = {
+ .ndo_open = b44_open,
+ .ndo_stop = b44_close,
+ .ndo_start_xmit = b44_start_xmit,
+ .ndo_get_stats = b44_get_stats,
+ .ndo_set_multicast_list = b44_set_rx_mode,
+ .ndo_set_mac_address = b44_set_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_do_ioctl = b44_ioctl,
+ .ndo_tx_timeout = b44_tx_timeout,
+ .ndo_change_mtu = b44_change_mtu,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = b44_poll_controller,
+#endif
+};
+
static int __devinit b44_init_one(struct ssb_device *sdev,
const struct ssb_device_id *ent)
{
@@ -2145,20 +2161,9 @@ static int __devinit b44_init_one(struct
bp->rx_pending = B44_DEF_RX_RING_PENDING;
bp->tx_pending = B44_DEF_TX_RING_PENDING;
- dev->open = b44_open;
- dev->stop = b44_close;
- dev->hard_start_xmit = b44_start_xmit;
- dev->get_stats = b44_get_stats;
- dev->set_multicast_list = b44_set_rx_mode;
- dev->set_mac_address = b44_set_mac_addr;
- dev->do_ioctl = b44_ioctl;
- dev->tx_timeout = b44_tx_timeout;
+ dev->netdev_ops = &b44_netdev_ops;
netif_napi_add(dev, &bp->napi, b44_poll, 64);
dev->watchdog_timeo = B44_TX_TIMEOUT;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = b44_poll_controller;
-#endif
- dev->change_mtu = b44_change_mtu;
dev->irq = sdev->irq;
SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
--
^ permalink raw reply [flat|nested] 95+ messages in thread[parent not found: <20090107003345.872219054@vyatta.com>]