Network device ops (phase 3)
Subsystems (2)
cover Network device ops (phase 3)
This covers the rest of 1G and 10G devices
PATCH 1/22 jme: convert driver to net_device_ops
Convert driver to new net_device_ops. Compile tested only.
drivers/net/jme.c +13 -9
@@ -2625,6 +2625,18 @@ jme_check_hw_ver(struct jme_adapter *jme jme->chiprev = (chipmode &CM_CHIPREV_MASK ) >>CM_CHIPREV_SHIFT ; } +static const struct net_device_ops jme_netdev_ops = { + .ndo_open = jme_open, + .ndo_stop = jme_close, + .ndo_validate_addr = eth_validate_addr, + .ndo_start_xmit = jme_start_xmit, + .ndo_set_mac_address = jme_set_macaddr, + .ndo_set_multicast_list = jme_set_multi, + .ndo_change_mtu = jme_change_mtu, + .ndo_tx_timeout = jme_tx_timeout, + .ndo_vlan_rx_register = jme_vlan_rx_register, +}; +static int __devinit jme_init_one (struct pci_dev *pdev,const struct pci_device_id *ent)
@@ -2674,17 +2686,9 @@ jme_init_one(struct pci_dev *pdev, rc = -ENOMEM ; goto err_out_release_regions; } - netdev->open = jme_open; - netdev->stop = jme_close; - netdev->hard_start_xmit = jme_start_xmit; - netdev->set_mac_address = jme_set_macaddr; - netdev->set_multicast_list = jme_set_multi; - netdev->change_mtu = jme_change_mtu; + netdev->netdev_ops = &jme_netdev_ops; netdev->ethtool_ops = &jme_ethtool_ops; - netdev->tx_timeout = jme_tx_timeout; netdev->watchdog_timeo =TX_TIMEOUT ; - netdev->vlan_rx_register = jme_vlan_rx_register; -NETDEV_GET_STATS (netdev, &jme_get_stats); netdev->features =NETIF_F_HW_CSUM |NETIF_F_SG | NETIF_F_TSO |
Re: [PATCH 01/22] jme: convert driver to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:39 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 2/22 s2io: convert to net_device_ops
In reply to Stephen HemmingerConvert this driver to network device ops. Compile teseted only.
drivers/net/s2io.c +22 -21
@@ -352,9 +352,10 @@ static void do_s2io_copy_mac_addr(struct sp->def_mac_addr[offset].mac_addr[1 ] = (u8) (mac_addr >>32 ); sp->def_mac_addr[offset].mac_addr[0 ] = (u8) (mac_addr >>40 ); } +/* Add the vlan */ static void s2io_vlan_rx_register (struct net_device *dev, -struct vlan_group *grp) +struct vlan_group *grp) {int i;struct s2io_nic *nic =netdev_priv (dev);
@@ -372,7 +373,7 @@ static void s2io_vlan_rx_register(struct }/* Unregister the vlan */ -static void s2io_vlan_rx_kill_vid (struct net_device *dev,unsigned long vid) +static void s2io_vlan_rx_kill_vid (struct net_device *dev,unsigned short vid) {int i;struct s2io_nic *nic =netdev_priv (dev);
@@ -7717,6 +7718,24 @@ static int rts_ds_steer(struct s2io_nic S2IO_BIT_RESET); } +static const struct net_device_ops s2io_netdev_ops = { + .ndo_open = s2io_open, + .ndo_stop = s2io_close, + .ndo_get_stats = s2io_get_stats, + .ndo_start_xmit = s2io_xmit, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_multicast_list = s2io_set_multicast, + .ndo_do_ioctl = s2io_ioctl, + .ndo_set_mac_address = s2io_set_mac_addr, + .ndo_change_mtu = s2io_change_mtu, + .ndo_vlan_rx_register = s2io_vlan_rx_register, + .ndo_vlan_rx_kill_vid = s2io_vlan_rx_kill_vid, + .ndo_tx_timeout = s2io_tx_watchdog, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = s2io_netpoll, +#endif +}; +/** * s2io_init_nic - Initialization of the adapter . * @pdev : structure containing the PCI related information of the device.
@@ -7942,26 +7961,9 @@ s2io_init_nic(struct pci_dev *pdev, cons }/* Driver entry points */ - dev->open = &s2io_open; - dev->stop = &s2io_close; - dev->hard_start_xmit = &s2io_xmit; - dev->get_stats = &s2io_get_stats; - dev->set_multicast_list = &s2io_set_multicast; - dev->do_ioctl = &s2io_ioctl; - dev->set_mac_address = &s2io_set_mac_addr; - dev->change_mtu = &s2io_change_mtu; + dev->netdev_ops = &s2io_netdev_ops;SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); dev->features |=NETIF_F_HW_VLAN_TX |NETIF_F_HW_VLAN_RX ; - dev->vlan_rx_register = s2io_vlan_rx_register; - dev->vlan_rx_kill_vid = (void *)s2io_vlan_rx_kill_vid; - -/* -* will use eth_mac_addr() for dev->set_mac_address -* mac address will be set every time dev->open() is called -*/ -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = s2io_netpoll; -#endif dev->features |=NETIF_F_SG |NETIF_F_IP_CSUM ;if (sp->high_dma_flag == TRUE)
@@ -7972,7 +7974,6 @@ s2io_init_nic(struct pci_dev *pdev, cons dev->features |=NETIF_F_UFO ; dev->features |=NETIF_F_HW_CSUM ; } - dev->tx_timeout = &s2io_tx_watchdog; dev->watchdog_timeo =WATCH_DOG_TIMEOUT ;INIT_WORK (&sp->rst_timer_task, s2io_restart_nic);INIT_WORK (&sp->set_link_task, s2io_set_link);
Re: [PATCH 02/22] s2io: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:40 -0800
Quoted 3 lines
Convert this driver to network device ops. Compile teseted only.
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 3/22 qlge: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/qlge/qlge_main.c +19 -11
@@ -3715,6 +3715,22 @@ err_out:return err; } + +static const struct net_device_ops qlge_netdev_ops = { + .ndo_open = qlge_open, + .ndo_stop = qlge_close, + .ndo_start_xmit = qlge_send, + .ndo_change_mtu = qlge_change_mtu, + .ndo_get_stats = qlge_get_stats, + .ndo_set_multicast_list = qlge_set_multicast_list, + .ndo_set_mac_address = qlge_set_mac_address, + .ndo_validate_addr = eth_validate_addr, + .ndo_tx_timeout = qlge_tx_timeout, + .ndo_vlan_rx_register = ql_vlan_rx_register, + .ndo_vlan_rx_add_vid = ql_vlan_rx_add_vid, + .ndo_vlan_rx_kill_vid = ql_vlan_rx_kill_vid, +}; +static int __devinit qlge_probe (struct pci_dev *pdev,const struct pci_device_id *pci_entry) {
@@ -3752,19 +3768,11 @@ static int __devinit qlge_probe(struct p*/ ndev->tx_queue_len = qdev->tx_ring_size; ndev->irq = pdev->irq; - ndev->open = qlge_open; - ndev->stop = qlge_close; - ndev->hard_start_xmit = qlge_send; + + ndev->netdev_ops = &qlge_netdev_ops;SET_ETHTOOL_OPS (ndev, &qlge_ethtool_ops); - ndev->change_mtu = qlge_change_mtu; - ndev->get_stats = qlge_get_stats; - ndev->set_multicast_list = qlge_set_multicast_list; - ndev->set_mac_address = qlge_set_mac_address; - ndev->tx_timeout = qlge_tx_timeout; ndev->watchdog_timeo =10 *HZ ; - ndev->vlan_rx_register = ql_vlan_rx_register; - ndev->vlan_rx_add_vid = ql_vlan_rx_add_vid; - ndev->vlan_rx_kill_vid = ql_vlan_rx_kill_vid; + err =register_netdev (ndev);if (err) {dev_err (&pdev->dev,"net device registration failed.\n" );
Re: [PATCH 03/22] qlge: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:41 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 4/22 Subject qlge: fix sparse warnings
In reply to Stephen HemmingerFix sparse warnings and one bug:
* Several routines can be static
* Don't lose __iomem annotation
* fix locking on error path (bug)
drivers/net/qlge/qlge_main.c +14 -13
@@ -642,7 +642,7 @@ static void ql_enable_all_completion_int } -int ql_read_flash_word (struct ql_adapter *qdev,int offset,u32 *data) +static int ql_read_flash_word (struct ql_adapter *qdev,int offset,u32 *data) {int status =0 ;/* wait for reg to come ready */
@@ -832,7 +832,7 @@ end: }/* Get the next large buffer. */ -struct bq_desc *ql_get_curr_lbuf (struct rx_ring *rx_ring) +static struct bq_desc *ql_get_curr_lbuf (struct rx_ring *rx_ring) {struct bq_desc *lbq_desc = &rx_ring->lbq[rx_ring->lbq_curr_idx]; rx_ring->lbq_curr_idx++;
@@ -843,7 +843,7 @@ struct bq_desc *ql_get_curr_lbuf(struct }/* Get the next small buffer. */ -struct bq_desc *ql_get_curr_sbuf (struct rx_ring *rx_ring) +static struct bq_desc *ql_get_curr_sbuf (struct rx_ring *rx_ring) {struct bq_desc *sbq_desc = &rx_ring->sbq[rx_ring->sbq_curr_idx]; rx_ring->sbq_curr_idx++;
@@ -1166,7 +1166,7 @@ map_error:return NETDEV_TX_BUSY ; } -void ql_realign_skb (struct sk_buff *skb,int len) +static void ql_realign_skb (struct sk_buff *skb,int len) {void *temp_addr = skb->data;
@@ -2069,7 +2069,7 @@ err:return -ENOMEM ; } -void ql_free_lbq_buffers (struct ql_adapter *qdev,struct rx_ring *rx_ring) +static void ql_free_lbq_buffers (struct ql_adapter *qdev,struct rx_ring *rx_ring) {int i;struct bq_desc *lbq_desc;
@@ -2132,7 +2132,7 @@ mem_error:return -ENOMEM ; } -void ql_free_sbq_buffers (struct ql_adapter *qdev,struct rx_ring *rx_ring) +static void ql_free_sbq_buffers (struct ql_adapter *qdev,struct rx_ring *rx_ring) {int i;struct bq_desc *sbq_desc;
@@ -2467,7 +2467,7 @@ static int ql_start_rx_ring(struct ql_ad rx_ring->sbq_base_indirect_dma = shadow_reg_dma;/* PCI doorbell mem area + 0x00 for consumer index register */ - rx_ring->cnsmr_idx_db_reg = (u32 *) doorbell_area; + rx_ring->cnsmr_idx_db_reg = (u32 __iomem *) doorbell_area; rx_ring->cnsmr_idx =0 ; rx_ring->curr_entry = rx_ring->cq_base;
@@ -2475,10 +2475,10 @@ static int ql_start_rx_ring(struct ql_ad rx_ring->valid_db_reg = doorbell_area +0x04 ;/* PCI doorbell mem area + 0x18 for large buffer consumer */ - rx_ring->lbq_prod_idx_db_reg = (u32 *) (doorbell_area +0x18 ); + rx_ring->lbq_prod_idx_db_reg = (u32 __iomem *) (doorbell_area +0x18 );/* PCI doorbell mem area + 0x1c */ - rx_ring->sbq_prod_idx_db_reg = (u32 *) (doorbell_area +0x1c ); + rx_ring->sbq_prod_idx_db_reg = (u32 __iomem *) (doorbell_area +0x1c );memset ((void *)cqicb,0 ,sizeof (struct cqicb )); cqicb->msix_vect = rx_ring->irq;
@@ -2609,7 +2609,7 @@ static int ql_start_tx_ring(struct ql_ad* Assign doorbell registers for this tx_ring. */ /* TX PCI doorbell mem area for tx producer index */ - tx_ring->prod_idx_db_reg = (u32 *) doorbell_area; + tx_ring->prod_idx_db_reg = (u32 __iomem *) doorbell_area; tx_ring->prod_idx =0 ;/* TX PCI doorbell mem area + 0x04 */ tx_ring->valid_db_reg = doorbell_area +0x04 ;
@@ -3520,6 +3520,7 @@ static int qlge_set_mac_address(struct n {struct ql_adapter *qdev = (struct ql_adapter *)netdev_priv (ndev);struct sockaddr *addr = p; +int ret =0 ;if (netif_running (ndev))return -EBUSY ;
@@ -3532,11 +3533,11 @@ static int qlge_set_mac_address(struct nif (ql_set_mac_addr_reg (qdev, (u8 *) ndev->dev_addr,MAC_ADDR_TYPE_CAM_MAC , qdev->func)) {/* Unicast */ QPRINTK (qdev,HW ,ERR ,"Failed to load MAC address.\n" ); -return -1 ; + ret =-1 ; }spin_unlock (&qdev->hw_lock); -return 0 ; +return ret; }static void qlge_tx_timeout (struct net_device *ndev)
@@ -3586,7 +3587,7 @@ static void ql_release_all(struct pci_de qdev->q_workqueue =NULL ; }if (qdev->reg_base) -iounmap ((void *)qdev->reg_base); +iounmap (qdev->reg_base);if (qdev->doorbell_area)iounmap (qdev->doorbell_area);pci_release_regions (pdev);
Re: [PATCH 04/22] Subject qlge: fix sparse warnings
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:42 -0800
Quoted 6 lines
Fix sparse warnings and one bug:
* Several routines can be static
* Don't lose__iomemannotation
* fix locking on error path (bug)Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 5/22 via-rhine: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/via-rhine.c +17 -11
@@ -614,6 +614,20 @@ static void __devinit rhine_hw_init(strurhine_reload_eeprom (pioaddr, dev); } +static const struct net_device_ops rhine_netdev_ops = { + .ndo_open = rhine_open, + .ndo_stop = rhine_close, + .ndo_start_xmit = rhine_start_tx, + .ndo_get_stats = rhine_get_stats, + .ndo_set_multicast_list = rhine_set_rx_mode, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = netdev_ioctl, + .ndo_tx_timeout = rhine_tx_timeout, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = rhine_poll, +#endif +}; +static int __devinit rhine_init_one (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -764,18 +778,10 @@ static int __devinit rhine_init_one(stru rp->mii_if.reg_num_mask =0x1f ;/* The chip-specific entries in the device structure. */ - dev->open = rhine_open; - dev->hard_start_xmit = rhine_start_tx; - dev->stop = rhine_close; - dev->get_stats = rhine_get_stats; - dev->set_multicast_list = rhine_set_rx_mode; - dev->do_ioctl = netdev_ioctl; - dev->ethtool_ops = &netdev_ethtool_ops; - dev->tx_timeout = rhine_tx_timeout; + dev->netdev_ops = &rhine_netdev_ops; + dev->ethtool_ops = &netdev_ethtool_ops, dev->watchdog_timeo =TX_TIMEOUT ; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = rhine_poll; -#endif +netif_napi_add (dev, &rp->napi, rhine_napipoll,64 );if (rp->quirks & rqRhineI)
Re: [PATCH 05/22] via-rhine: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:43 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 6/22 myri10ge: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/myri10ge/myri10ge.c +13 -7
@@ -3731,6 +3731,17 @@ abort_with_fw:myri10ge_load_firmware (mgp,0 ); } +static const struct net_device_ops myri10ge_netdev_ops = { + .ndo_open = myri10ge_open, + .ndo_stop = myri10ge_close, + .ndo_start_xmit = myri10ge_xmit, + .ndo_get_stats = myri10ge_get_stats, + .ndo_validate_addr = eth_validate_addr, + .ndo_change_mtu = myri10ge_change_mtu, + .ndo_set_multicast_list = myri10ge_set_multicast_list, + .ndo_set_mac_address = myri10ge_set_mac_address, +}; +static int myri10ge_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {struct net_device *netdev;
@@ -3862,15 +3873,10 @@ static int myri10ge_probe(struct pci_dev myri10ge_initial_mtu =MYRI10GE_MAX_ETHER_MTU -ETH_HLEN ;if ((myri10ge_initial_mtu +ETH_HLEN ) <68 ) myri10ge_initial_mtu =68 ; + + netdev->netdev_ops = &myri10ge_netdev_ops; netdev->mtu = myri10ge_initial_mtu; - netdev->open = myri10ge_open; - netdev->stop = myri10ge_close; - netdev->hard_start_xmit = myri10ge_xmit; - netdev->get_stats = myri10ge_get_stats; netdev->base_addr = mgp->iomem_base; - netdev->change_mtu = myri10ge_change_mtu; - netdev->set_multicast_list = myri10ge_set_multicast_list; - netdev->set_mac_address = myri10ge_set_mac_address; netdev->features = mgp->features;if (dac_enabled)
Re: [PATCH 06/22] myri10ge: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:44 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 7/22 mlx4: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/mlx4/en_netdev.c +19 -15
@@ -953,6 +953,23 @@ static int mlx4_en_change_mtu(struct netreturn 0 ; } +static const struct net_device_ops mlx4_netdev_ops = { + .ndo_open = mlx4_en_open, + .ndo_stop = mlx4_en_close, + .ndo_start_xmit = mlx4_en_xmit, + .ndo_get_stats = mlx4_en_get_stats, + .ndo_set_multicast_list = mlx4_en_set_multicast, + .ndo_set_mac_address = mlx4_en_set_mac, + .ndo_change_mtu = mlx4_en_change_mtu, + .ndo_tx_timeout = mlx4_en_tx_timeout, + .ndo_vlan_rx_register = mlx4_en_vlan_rx_register, + .ndo_vlan_rx_add_vid = mlx4_en_vlan_rx_add_vid, + .ndo_vlan_rx_kill_vid = mlx4_en_vlan_rx_kill_vid, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = mlx4_en_netpoll, +#endif +}; +int mlx4_en_init_netdev (struct mlx4_en_dev *mdev,int port,struct mlx4_en_port_profile *prof) {
@@ -1029,22 +1046,9 @@ int mlx4_en_init_netdev(struct mlx4_en_d/* * Initialize netdev entry points */ - - dev->open = &mlx4_en_open; - dev->stop = &mlx4_en_close; - dev->hard_start_xmit = &mlx4_en_xmit; - dev->get_stats = &mlx4_en_get_stats; - dev->set_multicast_list = &mlx4_en_set_multicast; - dev->set_mac_address = &mlx4_en_set_mac; - dev->change_mtu = &mlx4_en_change_mtu; - dev->tx_timeout = &mlx4_en_tx_timeout; + dev->netdev_ops = &mlx4_netdev_ops; dev->watchdog_timeo =MLX4_EN_WATCHDOG_TIMEOUT ; - dev->vlan_rx_register = mlx4_en_vlan_rx_register; - dev->vlan_rx_add_vid = mlx4_en_vlan_rx_add_vid; - dev->vlan_rx_kill_vid = mlx4_en_vlan_rx_kill_vid; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = mlx4_en_netpoll; -#endif +SET_ETHTOOL_OPS (dev, &mlx4_en_ethtool_ops);/* Set defualt MAC */
Re: [PATCH 07/22] mlx4: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:45 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 8/22 bnx2: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/bnx2.c +20 -16
@@ -7707,6 +7707,25 @@ bnx2_init_napi(struct bnx2 *bp) } } +static const struct net_device_ops bnx2_netdev_ops = { + .ndo_open = bnx2_open, + .ndo_start_xmit = bnx2_start_xmit, + .ndo_stop = bnx2_close, + .ndo_get_stats = bnx2_get_stats, + .ndo_set_rx_mode = bnx2_set_rx_mode, + .ndo_do_ioctl = bnx2_ioctl, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = bnx2_change_mac_addr, + .ndo_change_mtu = bnx2_change_mtu, + .ndo_tx_timeout = bnx2_tx_timeout, +#ifdef BCM_VLAN + .ndo_vlan_rx_register = bnx2_vlan_rx_register, +#endif +#if defined(HAVE_POLL_CONTROLLER) || defined(CONFIG_NET_POLL_CONTROLLER) + .ndo_poll_controller = poll_bnx2, +#endif +}; +static int __devinit bnx2_init_one (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -7731,28 +7750,13 @@ bnx2_init_one(struct pci_dev *pdev, consreturn rc; } - dev->open = bnx2_open; - dev->hard_start_xmit = bnx2_start_xmit; - dev->stop = bnx2_close; - dev->get_stats = bnx2_get_stats; - dev->set_rx_mode = bnx2_set_rx_mode; - dev->do_ioctl = bnx2_ioctl; - dev->set_mac_address = bnx2_change_mac_addr; - dev->change_mtu = bnx2_change_mtu; - dev->tx_timeout = bnx2_tx_timeout; + dev->netdev_ops = &bnx2_netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; -#ifdef BCM_VLAN - dev->vlan_rx_register = bnx2_vlan_rx_register; -#endif dev->ethtool_ops = &bnx2_ethtool_ops; bp =netdev_priv (dev);bnx2_init_napi (bp); -#if defined(HAVE_POLL_CONTROLLER ) || defined(CONFIG_NET_POLL_CONTROLLER ) - dev->poll_controller = poll_bnx2; -#endif -pci_set_drvdata (pdev, dev);memcpy (dev->dev_addr, bp->mac_addr,6 );
Re: [PATCH 08/22] bnx2: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:46 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 9/22 dl2k: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/dl2k.c +14 -8
@@ -85,6 +85,19 @@ static int mii_write (struct net_devicestatic const struct ethtool_ops ethtool_ops; +static const struct net_device_ops netdev_ops = { + .ndo_open = rio_open, + .ndo_start_xmit = start_xmit, + .ndo_stop = rio_close, + .ndo_get_stats = get_stats, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = eth_mac_addr, + .ndo_set_multicast_list = set_multicast, + .ndo_do_ioctl = rio_ioctl, + .ndo_tx_timeout = rio_tx_timeout, + .ndo_change_mtu = change_mtu, +}; +static int __devinit rio_probe1 (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -197,15 +210,8 @@ rio_probe1 (struct pci_dev *pdev, constelse if (tx_coalesce >TX_RING_SIZE -1 ) tx_coalesce =TX_RING_SIZE -1 ; } - dev->open = &rio_open; - dev->hard_start_xmit = &start_xmit; - dev->stop = &rio_close; - dev->get_stats = &get_stats; - dev->set_multicast_list = &set_multicast; - dev->do_ioctl = &rio_ioctl; - dev->tx_timeout = &rio_tx_timeout; + dev->netdev_ops = &netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; - dev->change_mtu = &change_mtu;SET_ETHTOOL_OPS (dev, ðtool_ops);#if 0 dev->features =NETIF_F_IP_CSUM ;
Re: [PATCH 09/22] dl2k: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:47 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 10/22 netxen: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only. Had to do some refactoring on multicast_list.
Fix ethtool restart to propogate error code.
drivers/net/netxen/netxen_nic_main.c +28 -15
@@ -469,6 +469,31 @@ netxen_read_mac_addr(struct netxen_adaptreturn 0 ; } +static void netxen_set_multicast_list (struct net_device *dev) +{ +struct netxen_adapter *adapter =netdev_priv (dev); + +if (NX_IS_REVISION_P3 (adapter->ahw.revision_id)) +netxen_p3_nic_set_multi (dev); +else +netxen_p2_nic_set_multi (dev); +} + +static const struct net_device_ops netxen_netdev_ops = { + .ndo_open = netxen_nic_open, + .ndo_stop = netxen_nic_close, + .ndo_start_xmit = netxen_nic_xmit_frame, + .ndo_get_stats = netxen_nic_get_stats, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_multicast_list = netxen_set_multicast_list, + .ndo_set_mac_address = netxen_nic_set_mac, + .ndo_change_mtu = netxen_nic_change_mtu, + .ndo_tx_timeout = netxen_tx_timeout, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = netxen_nic_poll_controller, +#endif +}; +/* * netxen_nic_probe() *
@@ -680,25 +705,13 @@ netxen_nic_probe(struct pci_dev *pdev, celse adapter->max_mc_count =16 ; - netdev->open = netxen_nic_open; - netdev->stop = netxen_nic_close; - netdev->hard_start_xmit = netxen_nic_xmit_frame; - netdev->get_stats = netxen_nic_get_stats; -if (NX_IS_REVISION_P3 (revision_id)) - netdev->set_multicast_list = netxen_p3_nic_set_multi; -else - netdev->set_multicast_list = netxen_p2_nic_set_multi; - netdev->set_mac_address = netxen_nic_set_mac; - netdev->change_mtu = netxen_nic_change_mtu; - netdev->tx_timeout = netxen_tx_timeout; + netdev->netdev_ops = &netxen_netdev_ops; netdev->watchdog_timeo =2 *HZ ;netxen_nic_change_mtu (netdev, netdev->mtu);SET_ETHTOOL_OPS (netdev, &netxen_nic_ethtool_ops); -#ifdef CONFIG_NET_POLL_CONTROLLER - netdev->poll_controller = netxen_nic_poll_controller; -#endif +/* ScatterGather support */ netdev->features =NETIF_F_SG ; netdev->features |=NETIF_F_IP_CSUM ;
@@ -1075,7 +1088,7 @@ static int netxen_nic_open(struct net_denetxen_nic_set_link_parameters (adapter); - netdev->set_multicast_list (netdev); +netxen_set_multicast_list (netdev);if (adapter->set_mtu) adapter->set_mtu (adapter, netdev->mtu);
drivers/net/netxen/netxen_nic_ethtool.c +5 -5
@@ -275,11 +275,11 @@ netxen_nic_set_settings(struct net_devic }else return -EOPNOTSUPP ; -if (netif_running (dev)) { - dev->stop (dev); - dev->open (dev); - } -return 0 ; +if (!netif_running (dev)) +return 0 ; + + dev->netdev_ops->ndo_stop (dev); +return dev->netdev_ops->ndo_open (dev); }static int netxen_nic_get_regs_len (struct net_device *dev)
Re: [PATCH 10/22] netxen: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:48 -0800
Quoted 5 lines
Convert driver to new
net_device_ops. Compile tested only. Had to do some refactoring onmulticast_list.
Fix ethtool restart to propogate error code.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 11/22 efx: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/sfc/efx.c +18 -13
@@ -1433,12 +1433,28 @@ static void efx_set_multicast_list(strucfalcon_set_multicast_hash (efx); } +static const struct net_device_ops efx_netdev_ops = { + .ndo_open = efx_net_open, + .ndo_stop = efx_net_stop, + .ndo_get_stats = efx_net_stats, + .ndo_tx_timeout = efx_watchdog, + .ndo_start_xmit = efx_hard_start_xmit, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = efx_ioctl, + .ndo_change_mtu = efx_change_mtu, + .ndo_set_mac_address = efx_set_mac_address, + .ndo_set_multicast_list = efx_set_multicast_list, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = efx_netpoll, +#endif +}; +static int efx_netdev_event (struct notifier_block *this,unsigned long event,void *ptr) {struct net_device *net_dev = ptr; -if (net_dev->open == efx_net_open && event ==NETDEV_CHANGENAME ) { +if (net_dev->netdev_ops == &efx_netdev_ops && event ==NETDEV_CHANGENAME ) {struct efx_nic *efx =netdev_priv (net_dev);strcpy (efx->name, net_dev->name);
@@ -1459,18 +1475,7 @@ static int efx_register_netdev(struct ef net_dev->watchdog_timeo =5 *HZ ; net_dev->irq = efx->pci_dev->irq; - net_dev->open = efx_net_open; - net_dev->stop = efx_net_stop; - net_dev->get_stats = efx_net_stats; - net_dev->tx_timeout = &efx_watchdog; - net_dev->hard_start_xmit = efx_hard_start_xmit; - net_dev->do_ioctl = efx_ioctl; - net_dev->change_mtu = efx_change_mtu; - net_dev->set_mac_address = efx_set_mac_address; - net_dev->set_multicast_list = efx_set_multicast_list; -#ifdef CONFIG_NET_POLL_CONTROLLER - net_dev->poll_controller = efx_netpoll; -#endif + net_dev->netdev_ops = &efx_netdev_ops;SET_NETDEV_DEV (net_dev, &efx->pci_dev->dev);SET_ETHTOOL_OPS (net_dev, &efx_ethtool_ops);
Re: [PATCH 11/22] efx: convert to net_device_ops
Quoted 3 lines · Stephen Hemminger
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
(But the driver name is sfc; "efx" is an historical reference.)
Quoted 19 lines
drivers/net/sfc/efx.c +13
-0@@ -1433,12 +1433,28 @@ static void efx_set_multicast_list(strucfalcon_set_multicast_hash (efx); } +static const struct net_device_ops efx_netdev_ops = { + .ndo_open = efx_net_open, + .ndo_stop = efx_net_stop, + .ndo_get_stats = efx_net_stats, + .ndo_tx_timeout = efx_watchdog, + .ndo_start_xmit = efx_hard_start_xmit, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = efx_ioctl, + .ndo_change_mtu = efx_change_mtu, + .ndo_set_mac_address = efx_set_mac_address, + .ndo_set_multicast_list = efx_set_multicast_list, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = efx_netpoll,
drivers/net/sfc/efx.c static void efx_set_multicast_list(struc · line 1457
Quoted 10 lines
drivers/net/sfc/efx.c +4
-1+#endif +}; +static int efx_netdev_event (struct notifier_block *this,unsigned long event,void *ptr) {struct net_device *net_dev = ptr; -if (net_dev->open == efx_net_open && event ==NETDEV_CHANGENAME ) { +if (net_dev->netdev_ops == &efx_netdev_ops && event ==NETDEV_CHANGENAME ) {
Also, this line should be wrapped now.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [PATCH 11/22] efx: convert to net_device_ops
From: Ben Hutchings <[email protected]>
Date: Sat, 22 Nov 2008 00:45:14 +0000
Quoted 6 lines
Quoted 3 lines · Stephen Hemminger
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>Acked-by Ben Hutchings <[email protected]>
Applied.
Quoted 1 line
(But the driver name is sfc; "efx" is an historical reference.)
I fixed this up in the commit message, thanks.
Quoted 4 lines
drivers/net/sfc/efx.c static void efx_set_multicast_list(struc · line 1457
Quoted 2 lines
drivers/net/sfc/efx.c +1
-1-if (net_dev->open == efx_net_open && event ==NETDEV_CHANGENAME ) { +if (net_dev->netdev_ops == &efx_netdev_ops && event ==NETDEV_CHANGENAME ) {Also, this line should be wrapped now.
I think this is being overly picky, and it's OK to elide this in this type of change I think.
PATCH 12/22 tehuti: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/tehuti.c +16 -11
@@ -1885,6 +1885,21 @@ static void bdx_tx_push_desc_safe(structRET (); } +static const struct net_device_ops bdx_netdev_ops = { + .ndo_open = bdx_open, + .ndo_stop = bdx_close, + .ndo_start_xmit = bdx_tx_transmit, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = bdx_ioctl, + .ndo_set_multicast_list = bdx_setmulti, + .ndo_get_stats = bdx_get_stats, + .ndo_change_mtu = bdx_change_mtu, + .ndo_set_mac_address = bdx_set_mac, + .ndo_vlan_rx_register = bdx_vlan_rx_register, + .ndo_vlan_rx_add_vid = bdx_vlan_rx_add_vid, + .ndo_vlan_rx_kill_vid = bdx_vlan_rx_kill_vid, +}; +/** * bdx_probe - Device Initialization Routine * @pdev: PCI device information struct
@@ -1994,18 +2009,8 @@ bdx_probe(struct pci_dev *pdev, const st goto err_out_iomap; } - ndev->open = bdx_open; - ndev->stop = bdx_close; - ndev->hard_start_xmit = bdx_tx_transmit; - ndev->do_ioctl = bdx_ioctl; - ndev->set_multicast_list = bdx_setmulti; - ndev->get_stats = bdx_get_stats; - ndev->change_mtu = bdx_change_mtu; - ndev->set_mac_address = bdx_set_mac; + ndev->netdev_ops = &bdx_netdev_ops; ndev->tx_queue_len =BDX_NDEV_TXQ_LEN ; - ndev->vlan_rx_register = bdx_vlan_rx_register; - ndev->vlan_rx_add_vid = bdx_vlan_rx_add_vid; - ndev->vlan_rx_kill_vid = bdx_vlan_rx_kill_vid;bdx_ethtool_ops (ndev);/* ethtool interface */
Re: [PATCH 12/22] tehuti: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:50 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 13/22 sis900: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/sis900.c +16 -11
@@ -381,6 +381,21 @@ static int __devinit sis96x_get_mac_addrreturn 0 ; } +static const struct net_device_ops sis900_netdev_ops = { + .ndo_open = sis900_open, + .ndo_stop = sis900_close, + .ndo_start_xmit = sis900_start_xmit, + .ndo_set_config = sis900_set_config, + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = mii_ioctl, + .ndo_tx_timeout = sis900_tx_timeout, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = sis900_poll, +#endif +}; +/** * sis900_probe - Probe for sis900 device * @pci_dev: the sis900 pci device
@@ -461,20 +476,10 @@ static int __devinit sis900_probe(struct sis_priv->rx_ring_dma = ring_dma;/* The SiS900-specific entries in the device structure. */ - net_dev->open = &sis900_open; - net_dev->hard_start_xmit = &sis900_start_xmit; - net_dev->stop = &sis900_close; - net_dev->set_config = &sis900_set_config; - net_dev->set_multicast_list = &set_rx_mode; - net_dev->do_ioctl = &mii_ioctl; - net_dev->tx_timeout = sis900_tx_timeout; + net_dev->netdev_ops = &sis900_netdev_ops; net_dev->watchdog_timeo =TX_TIMEOUT ; net_dev->ethtool_ops = &sis900_ethtool_ops; -#ifdef CONFIG_NET_POLL_CONTROLLER - net_dev->poll_controller = &sis900_poll; -#endif -if (sis900_debug >0 ) sis_priv->msg_enable = sis900_debug;else
Re: [PATCH 13/22] sis900: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:51 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 14/22 r6040: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/r6040.c +18 -11
@@ -1029,13 +1029,28 @@ static u32 netdev_get_link(struct net_dereturn mii_link_ok (&rp->mii_if); } -static struct ethtool_ops netdev_ethtool_ops = { +static const struct ethtool_ops netdev_ethtool_ops = { .get_drvinfo = netdev_get_drvinfo, .get_settings = netdev_get_settings, .set_settings = netdev_set_settings, .get_link = netdev_get_link, }; +static const struct net_device_ops r6040_netdev_ops = { + .ndo_open = r6040_open, + .ndo_stop = r6040_close, + .ndo_start_xmit = r6040_start_xmit, + .ndo_get_stats = r6040_get_stats, + .ndo_set_multicast_list = r6040_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = r6040_ioctl, + .ndo_tx_timeout = r6040_tx_timeout, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = r6040_poll_controller, +#endif +}; +static int __devinit r6040_init_one (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -1127,18 +1142,10 @@ static int __devinit r6040_init_one(stru lp->switch_sig =0 ;/* The RDC-specific entries in the device structure. */ - dev->open = &r6040_open; - dev->hard_start_xmit = &r6040_start_xmit; - dev->stop = &r6040_close; - dev->get_stats = r6040_get_stats; - dev->set_multicast_list = &r6040_multicast_list; - dev->do_ioctl = &r6040_ioctl; + dev->netdev_ops = &r6040_netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops; - dev->tx_timeout = &r6040_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = r6040_poll_controller; -#endif +netif_napi_add (dev, &lp->napi, r6040_poll,64 ); lp->mii_if.dev = dev; lp->mii_if.mdio_read = r6040_mdio_read;
Re: [PATCH 14/22] r6040: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:52 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 15/22 yellowfin: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/yellowfin.c +11 -6
@@ -355,6 +355,16 @@ static int yellowfin_close(struct net_destatic void set_rx_mode (struct net_device *dev);static const struct ethtool_ops ethtool_ops; +static const struct net_device_ops netdev_ops = { + .ndo_open = yellowfin_open, + .ndo_stop = yellowfin_close, + .ndo_start_xmit = yellowfin_start_xmit, + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = netdev_ioctl, + .ndo_tx_timeout = yellowfin_tx_timeout, +};static int __devinit yellowfin_init_one (struct pci_dev *pdev,const struct pci_device_id *ent)
@@ -464,13 +474,8 @@ static int __devinit yellowfin_init_one( np->duplex_lock =1 ;/* The Yellowfin-specific entries in the device structure. */ - dev->open = &yellowfin_open; - dev->hard_start_xmit = &yellowfin_start_xmit; - dev->stop = &yellowfin_close; - 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 = yellowfin_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ;if (mtu)
Re: [PATCH 15/22] yellowfin: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:53 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 16/22 ns83820: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/ns83820.c +14 -8
@@ -1948,7 +1948,19 @@ static void ns83820_probe_phy(struct net }#endif -static int __devinit ns83820_init_one (struct pci_dev *pci_dev,const struct pci_device_id *id) +static const struct net_device_ops netdev_ops = { + .ndo_open = ns83820_open, + .ndo_stop = ns83820_stop, + .ndo_start_xmit = ns83820_hard_start_xmit, + .ndo_get_stats = ns83820_get_stats, + .ndo_change_mtu = ns83820_change_mtu, + .ndo_set_multicast_list = ns83820_set_multicast, + .ndo_validate_addr = eth_validate_addr, + .ndo_tx_timeout = ns83820_tx_timeout, +}; + +static int __devinit ns83820_init_one (struct pci_dev *pci_dev, +const struct pci_device_id *id) {struct net_device *ndev;struct ns83820 *dev;
@@ -2040,14 +2052,8 @@ static int __devinit ns83820_init_one(st ndev->name,le32_to_cpu (readl (dev->base +0x22c )), pci_dev->subsystem_vendor, pci_dev->subsystem_device); - ndev->open = ns83820_open; - ndev->stop = ns83820_stop; - ndev->hard_start_xmit = ns83820_hard_start_xmit; - ndev->get_stats = ns83820_get_stats; - ndev->change_mtu = ns83820_change_mtu; - ndev->set_multicast_list = ns83820_set_multicast; + ndev->netdev_ops = &netdev_ops;SET_ETHTOOL_OPS (ndev, &ops); - ndev->tx_timeout = ns83820_tx_timeout; ndev->watchdog_timeo =5 *HZ ;pci_set_drvdata (pci_dev, ndev);
Re: [PATCH 16/22] ns83820: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:54 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 17/22 bnx2x: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/bnx2x_main.c +20 -14
@@ -10002,6 +10002,25 @@ static void poll_bnx2x(struct net_device }#endif +static const struct net_device_ops bnx2x_netdev_ops = { + .ndo_open = bnx2x_open, + .ndo_stop = bnx2x_close, + .ndo_start_xmit = bnx2x_start_xmit, + .ndo_set_multicast_list = bnx2x_set_rx_mode, + .ndo_set_mac_address = bnx2x_change_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = bnx2x_ioctl, + .ndo_change_mtu = bnx2x_change_mtu, + .ndo_tx_timeout = bnx2x_tx_timeout, +#ifdef BCM_VLAN + .ndo_vlan_rx_register = bnx2x_vlan_rx_register, +#endif +#if defined(HAVE_POLL_CONTROLLER) || defined(CONFIG_NET_POLL_CONTROLLER) + .ndo_poll_controller = poll_bnx2x, +#endif +}; + +static int __devinit bnx2x_init_dev (struct pci_dev *pdev,struct net_device *dev) {
@@ -10112,23 +10131,10 @@ static int __devinit bnx2x_init_dev(struREG_WR (bp,PXP2_REG_PGL_ADDR_90_F0 +BP_PORT (bp)*16 ,0 );REG_WR (bp,PXP2_REG_PGL_ADDR_94_F0 +BP_PORT (bp)*16 ,0 ); - dev->hard_start_xmit = bnx2x_start_xmit; dev->watchdog_timeo =TX_TIMEOUT ; + dev->netdev_ops = &bnx2x_netdev_ops; dev->ethtool_ops = &bnx2x_ethtool_ops; - dev->open = bnx2x_open; - dev->stop = bnx2x_close; - dev->set_multicast_list = bnx2x_set_rx_mode; - dev->set_mac_address = bnx2x_change_mac_addr; - dev->do_ioctl = bnx2x_ioctl; - dev->change_mtu = bnx2x_change_mtu; - dev->tx_timeout = bnx2x_tx_timeout; -#ifdef BCM_VLAN - dev->vlan_rx_register = bnx2x_vlan_rx_register; -#endif -#if defined(HAVE_POLL_CONTROLLER ) || defined(CONFIG_NET_POLL_CONTROLLER ) - dev->poll_controller = poll_bnx2x; -#endif dev->features |=NETIF_F_SG ; dev->features |=NETIF_F_HW_CSUM ;if (bp->flags &USING_DAC_FLAG )
Re: [PATCH 17/22] bnx2x: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:55 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 18/22 hamachi: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/hamachi.c +14 -7
@@ -568,6 +568,19 @@ static void set_rx_mode(struct net_devicstatic const struct ethtool_ops ethtool_ops;static const struct ethtool_ops ethtool_ops_no_mii; +static const struct net_device_ops hamachi_netdev_ops = { + .ndo_open = hamachi_open, + .ndo_stop = hamachi_close, + .ndo_start_xmit = hamachi_start_xmit, + .ndo_get_stats = hamachi_get_stats, + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_tx_timeout = hamachi_tx_timeout, + .ndo_do_ioctl = netdev_ioctl, +}; + +static int __devinit hamachi_init_one (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -722,17 +735,11 @@ static int __devinit hamachi_init_one (s/* The Hamachi-specific entries in the device structure. */ - dev->open = &hamachi_open; - dev->hard_start_xmit = &hamachi_start_xmit; - dev->stop = &hamachi_close; - dev->get_stats = &hamachi_get_stats; - dev->set_multicast_list = &set_rx_mode; - dev->do_ioctl = &netdev_ioctl; + dev->netdev_ops = &hamachi_netdev_ops;if (chip_tbl[hmp->chip_id].flags & CanHaveMII)SET_ETHTOOL_OPS (dev, ðtool_ops);else SET_ETHTOOL_OPS (dev, ðtool_ops_no_mii); - dev->tx_timeout = &hamachi_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ;if (mtu) dev->mtu = mtu;
Re: [PATCH 18/22] hamachi: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:56 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 19/22 qla3xxx: convert to net_device_ops
In reply to Stephen HemmingerConvert this driver to net_device_ops. Compile tested only.
drivers/net/qla3xxx.c +12 -10
@@ -3900,6 +3900,17 @@ static void ql3xxx_timer(unsigned long pqueue_delayed_work (qdev->workqueue, &qdev->link_state_work,0 ); } +static const struct net_device_ops ql3xxx_netdev_ops = { + .ndo_open = ql3xxx_open, + .ndo_start_xmit = ql3xxx_send, + .ndo_stop = ql3xxx_close, + .ndo_set_multicast_list =NULL ,/* not allowed on NIC side */ + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = ql3xxx_set_mac_address, + .ndo_tx_timeout = ql3xxx_tx_timeout, +}; +static int __devinit ql3xxx_probe (struct pci_dev *pdev,const struct pci_device_id *pci_entry) {
@@ -3978,17 +3989,8 @@ static int __devinit ql3xxx_probe(structspin_lock_init (&qdev->hw_lock);/* Set driver entry points */ - ndev->open = ql3xxx_open; - ndev->hard_start_xmit = ql3xxx_send; - ndev->stop = ql3xxx_close; -/* ndev->set_multicast_list -* This device is one side of a two-function adapter -* (NIC and iSCSI). Promiscuous mode setting/clearing is -* not allowed from the NIC side. -*/ + ndev->netdev_ops = &ql3xxx_netdev_ops;SET_ETHTOOL_OPS (ndev, &ql3xxx_ethtool_ops); - ndev->set_mac_address = ql3xxx_set_mac_address; - ndev->tx_timeout = ql3xxx_tx_timeout; ndev->watchdog_timeo =5 *HZ ;netif_napi_add (ndev, &qdev->napi, ql_poll,64 );
Re: [PATCH 19/22] qla3xxx: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:57 -0800
Quoted 3 lines
Convert this driver to
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 20/22 sc92031: convert to net_device_ops
In reply to Stephen HemmingerConvert this driver to net_device_ops. Compile tested only.
drivers/net/sc92031.c +18 -11
@@ -1386,7 +1386,7 @@ static void sc92031_ethtool_get_ethtool_spin_unlock_bh (&priv->lock); } -static struct ethtool_ops sc92031_ethtool_ops = { +static const struct ethtool_ops sc92031_ethtool_ops = { .get_settings = sc92031_ethtool_get_settings, .set_settings = sc92031_ethtool_set_settings, .get_drvinfo = sc92031_ethtool_get_drvinfo,
@@ -1399,6 +1399,21 @@ static struct ethtool_ops sc92031_ethtoo .get_ethtool_stats = sc92031_ethtool_get_ethtool_stats, }; + +static const struct net_device_ops sc92031_netdev_ops = { + .ndo_get_stats = sc92031_get_stats, + .ndo_start_xmit = sc92031_start_xmit, + .ndo_open = sc92031_open, + .ndo_stop = sc92031_stop, + .ndo_set_multicast_list = sc92031_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_tx_timeout = sc92031_tx_timeout, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = sc92031_poll_controller, +#endif +}; +static int __devinit sc92031_probe (struct pci_dev *pdev,const struct pci_device_id *id) {
@@ -1452,17 +1467,9 @@ static int __devinit sc92031_probe(struc/* faked with skb_copy_and_csum_dev */ dev->features =NETIF_F_SG |NETIF_F_HW_CSUM |NETIF_F_HIGHDMA ; - dev->get_stats = sc92031_get_stats; - dev->ethtool_ops = &sc92031_ethtool_ops; - dev->hard_start_xmit = sc92031_start_xmit; + dev->netdev_ops = &sc92031_netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; - dev->open = sc92031_open; - dev->stop = sc92031_stop; - dev->set_multicast_list = sc92031_set_multicast_list; - dev->tx_timeout = sc92031_tx_timeout; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = sc92031_poll_controller; -#endif + dev->ethtool_ops = &sc92031_ethtool_ops; priv =netdev_priv (dev);spin_lock_init (&priv->lock);
Re: [PATCH 20/22] sc92031: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:58 -0800
Quoted 3 lines
Convert this driver to
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 21/22 eql: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only.
drivers/net/eql.c +8 -4
@@ -162,6 +162,13 @@ static void eql_timer(unsigned long parastatic char version[]__initdata ="Equalizer2002: Simon Janes ([email protected]) and David S. Miller ([email protected])\n" ; +static const struct net_device_ops eql_netdev_ops = { + .ndo_open = eql_open, + .ndo_stop = eql_close, + .ndo_do_ioctl = eql_ioctl, + .ndo_start_xmit = eql_slave_xmit, +}; +static void __init eql_setup (struct net_device *dev) {equalizer_t *eql =netdev_priv (dev);
@@ -175,10 +182,7 @@ static void __init eql_setup(struct net_INIT_LIST_HEAD (&eql->queue.all_slaves); eql->queue.master_dev = dev; - dev->open = eql_open; - dev->stop = eql_close; - dev->do_ioctl = eql_ioctl; - dev->hard_start_xmit = eql_slave_xmit; + dev->netdev_ops = &eql_netdev_ops;/* * Now we undo some of the things that eth_setup does
Re: [PATCH 21/22] eql: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:21:59 -0800
Quoted 3 lines
Convert driver to new
net_device_ops. Compile tested only.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 22/22 ne2k: convert to net_device_ops
In reply to Stephen HemmingerConvert driver to new net_device_ops. Compile tested only. This required some additional work to export common code ei_XXX.
--- drivers/net/8390.h | 4 ++++ drivers/net/lib8390.c | 15 ++++++++------- drivers/net/ne2k-pci.c | 19 ++++++++++++++----- 3 files changed, 26 insertions(+), 12 deletions(-)
drivers/net/8390.h +5 -0
@@ -33,6 +33,11 @@ extern void ei_poll(struct net_device *dextern void eip_poll (struct net_device *dev);#endif +extern void ei_tx_timeout (struct net_device *dev); +extern int ei_start_xmit (struct sk_buff *skb,struct net_device *dev); +extern void ei_set_multicast_list (struct net_device *dev); +extern struct net_device_stats *ei_get_stats (struct net_device *dev); +/* Without I/O delay - non ISA or later chips */ extern void NS8390_init (struct net_device *dev,int startp);extern int ei_open (struct net_device *dev);
drivers/net/lib8390.c +16 -10
@@ -108,14 +108,13 @@ int ei_debug = 1;/* Index to functions. */ static void ei_tx_intr (struct net_device *dev);static void ei_tx_err (struct net_device *dev); -static void ei_tx_timeout (struct net_device *dev); +void ei_tx_timeout (struct net_device *dev);static void ei_receive (struct net_device *dev);static void ei_rx_overrun (struct net_device *dev);/* Routines generic to NS8390-based boards. */ static void NS8390_trigger_send (struct net_device *dev,unsigned int length,int start_page); -static void set_multicast_list (struct net_device *dev);static void do_set_multicast_list (struct net_device *dev);static void __NS8390_init (struct net_device *dev,int startp);
@@ -208,8 +207,10 @@ static int __ei_open(struct net_device */* The card I/O part of the driver (e.g. 3c503) can hook a Tx timeout wrapper that does e.g. media check & then calls ei_tx_timeout. */ +#ifdef CONFIG_COMPAT_NET_DEV_OPS if (dev->tx_timeout ==NULL ) dev->tx_timeout = ei_tx_timeout; +#endif if (dev->watchdog_timeo <=0 ) dev->watchdog_timeo =TX_TIMEOUT ;
@@ -258,7 +259,7 @@ static int __ei_close(struct net_device* completed (or failed) - i.e. never posted a Tx related interrupt. */ -static void ei_tx_timeout (struct net_device *dev) +void ei_tx_timeout (struct net_device *dev) {unsigned long e8390_base = dev->base_addr;struct ei_device *ei_local = (struct ei_device *)netdev_priv (dev);
@@ -295,6 +296,7 @@ static void ei_tx_timeout(struct net_devenable_irq_lockdep (dev->irq);netif_wake_queue (dev); } +EXPORT_SYMBOL_GPL (ei_tx_timeout);/** * ei_start_xmit - begin packet transmission
@@ -304,7 +306,7 @@ static void ei_tx_timeout(struct net_dev* Sends a packet to an 8390 network device. */ -static int ei_start_xmit (struct sk_buff *skb,struct net_device *dev) +int ei_start_xmit (struct sk_buff *skb,struct net_device *dev) {unsigned long e8390_base = dev->base_addr;struct ei_device *ei_local = (struct ei_device *)netdev_priv (dev);
@@ -421,6 +423,7 @@ static int ei_start_xmit(struct sk_buffreturn 0 ; } +EXPORT_SYMBOL_GPL (ei_start_xmit);/** * ei_interrupt - handle the interrupts from an 8390
@@ -882,7 +885,7 @@ static void ei_rx_overrun(struct net_dev* Collect the stats. This is called unlocked and from several contexts. */ -static struct net_device_stats *get_stats (struct net_device *dev) +struct net_device_stats *ei_get_stats (struct net_device *dev) {unsigned long ioaddr = dev->base_addr;struct ei_device *ei_local = (struct ei_device *)netdev_priv (dev);
@@ -901,6 +904,7 @@ static struct net_device_stats *get_statreturn &dev->stats; } +EXPORT_SYMBOL_GPL (ei_get_stats);/* * Form the 64 bit 8390 multicast table from the linked list of addresses
@@ -991,7 +995,7 @@ static void do_set_multicast_list(struct* not called too often. Must protect against both bh and irq users */ -static void set_multicast_list (struct net_device *dev) +void ei_set_multicast_list (struct net_device *dev) {unsigned long flags;struct ei_device *ei_local = (struct ei_device *)netdev_priv (dev);
@@ -1000,6 +1004,7 @@ static void set_multicast_list(struct nedo_set_multicast_list (dev);spin_unlock_irqrestore (&ei_local->page_lock, flags); } +EXPORT_SYMBOL_GPL (ei_set_multicast_list);/** * ethdev_setup - init rest of 8390 device struct
@@ -1015,10 +1020,11 @@ static void ethdev_setup(struct net_deviif (ei_debug >1 )printk (version); - dev->hard_start_xmit = &ei_start_xmit; - dev->get_stats = get_stats; - dev->set_multicast_list = &set_multicast_list; - +#ifdef CONFIG_COMPAT_NET_DEV_OPS + dev->hard_start_xmit = ei_start_xmit; + dev->get_stats = ei_get_stats; + dev->set_multicast_list = ei_set_multicast_list; +#endif ether_setup (dev);spin_lock_init (&ei_local->page_lock);
drivers/net/ne2k-pci.c +16 -5
@@ -200,6 +200,19 @@ struct ne2k_pci_card {in the 'dev' and 'ei_status' structures. */ +static const struct net_device_ops ne2k_netdev_ops = { + .ndo_open = ne2k_pci_open, + .ndo_stop = ne2k_pci_close, + .ndo_start_xmit = ei_start_xmit, + .ndo_tx_timeout = ei_tx_timeout, + .ndo_get_stats = ei_get_stats, + .ndo_set_multicast_list = ei_set_multicast_list, + .ndo_validate_addr = eth_validate_addr, + .ndo_change_mtu = eth_change_mtu, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = ei_poll, +#endif +};static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,const struct pci_device_id *ent)
@@ -265,6 +278,8 @@ static int __devinit ne2k_pci_init_one (dev_err (&pdev->dev,"cannot allocate ethernet device\n" ); goto err_out_free_res; } + dev->netdev_ops = &ne2k_netdev_ops; +SET_NETDEV_DEV (dev, &pdev->dev);/* Reset card. Who knows what dain-bramaged state it was left in. */
@@ -353,12 +368,8 @@ static int __devinit ne2k_pci_init_one ( ei_status.block_output = &ne2k_pci_block_output; ei_status.get_8390_hdr = &ne2k_pci_get_8390_hdr; ei_status.priv = (unsigned long ) pdev; - dev->open = &ne2k_pci_open; - dev->stop = &ne2k_pci_close; + dev->ethtool_ops = &ne2k_pci_ethtool_ops; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = ei_poll; -#endif NS8390_init (dev,0 ); i =register_netdev (dev);
Re: [PATCH 22/22] ne2k: convert to net_device_ops
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Nov 2008 15:22:00 -0800
Quoted 4 lines
Convert driver to new
net_device_ops. Compile tested only. This required some additional work to export common codeei_XXX.Signed-off-by Stephen Hemminger <[email protected]>
Applied.