aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-11-20 23:14:53 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-20 23:14:53 -0500
commit008298231abbeb91bc7be9e8b078607b816d1a4a (patch)
tree8cb0c17720086ef97c614b96241f06aa63ce8511 /include/linux/netdevice.h
parent6ab33d51713d6d60c7677c0d020910a8cb37e513 (diff)
netdev: add more functions to netdevice ops
This patch moves neigh_setup and hard_start_xmit into the network device ops structure. For bisection, fix all the previously converted drivers as well. Bonding driver took the biggest hit on this. Added a prefetch of the hard_start_xmit in the fast path to try and reduce any impact this would have. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 981a089d5149..d8fb23679ee3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -454,8 +454,8 @@ struct netdev_queue {
454 454
455/* 455/*
456 * This structure defines the management hooks for network devices. 456 * This structure defines the management hooks for network devices.
457 * The following hooks can bed defined and are optonal (can be null) 457 * The following hooks can be defined; unless noted otherwise, they are
458 * unless otherwise noted. 458 * optional and can be filled with a null pointer.
459 * 459 *
460 * int (*ndo_init)(struct net_device *dev); 460 * int (*ndo_init)(struct net_device *dev);
461 * This function is called once when network device is registered. 461 * This function is called once when network device is registered.
@@ -475,6 +475,15 @@ struct netdev_queue {
475 * This function is called when network device transistions to the down 475 * This function is called when network device transistions to the down
476 * state. 476 * state.
477 * 477 *
478 * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
479 * Called when a packet needs to be transmitted.
480 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
481 * Required can not be NULL.
482 *
483 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
484 * Called to decide which queue to when device supports multiple
485 * transmit queues.
486 *
478 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags); 487 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
479 * This function is called to allow device receiver to make 488 * This function is called to allow device receiver to make
480 * changes to configuration when multicast or promiscious is enabled. 489 * changes to configuration when multicast or promiscious is enabled.
@@ -508,7 +517,7 @@ struct netdev_queue {
508 * of a device. If not defined, any request to change MTU will 517 * of a device. If not defined, any request to change MTU will
509 * will return an error. 518 * will return an error.
510 * 519 *
511 * void (*ndo_tx_timeout) (struct net_device *dev); 520 * void (*ndo_tx_timeout)(struct net_device *dev);
512 * Callback uses when the transmitter has not made any progress 521 * Callback uses when the transmitter has not made any progress
513 * for dev->watchdog ticks. 522 * for dev->watchdog ticks.
514 * 523 *
@@ -538,6 +547,10 @@ struct net_device_ops {
538 void (*ndo_uninit)(struct net_device *dev); 547 void (*ndo_uninit)(struct net_device *dev);
539 int (*ndo_open)(struct net_device *dev); 548 int (*ndo_open)(struct net_device *dev);
540 int (*ndo_stop)(struct net_device *dev); 549 int (*ndo_stop)(struct net_device *dev);
550 int (*ndo_start_xmit) (struct sk_buff *skb,
551 struct net_device *dev);
552 u16 (*ndo_select_queue)(struct net_device *dev,
553 struct sk_buff *skb);
541#define HAVE_CHANGE_RX_FLAGS 554#define HAVE_CHANGE_RX_FLAGS
542 void (*ndo_change_rx_flags)(struct net_device *dev, 555 void (*ndo_change_rx_flags)(struct net_device *dev,
543 int flags); 556 int flags);
@@ -557,8 +570,10 @@ struct net_device_ops {
557 int (*ndo_set_config)(struct net_device *dev, 570 int (*ndo_set_config)(struct net_device *dev,
558 struct ifmap *map); 571 struct ifmap *map);
559#define HAVE_CHANGE_MTU 572#define HAVE_CHANGE_MTU
560 int (*ndo_change_mtu)(struct net_device *dev, int new_mtu); 573 int (*ndo_change_mtu)(struct net_device *dev,
561 574 int new_mtu);
575 int (*ndo_neigh_setup)(struct net_device *dev,
576 struct neigh_parms *);
562#define HAVE_TX_TIMEOUT 577#define HAVE_TX_TIMEOUT
563 void (*ndo_tx_timeout) (struct net_device *dev); 578 void (*ndo_tx_timeout) (struct net_device *dev);
564 579
@@ -761,18 +776,12 @@ struct net_device
761 /* Number of TX queues currently active in device */ 776 /* Number of TX queues currently active in device */
762 unsigned int real_num_tx_queues; 777 unsigned int real_num_tx_queues;
763 778
764 /* Map buffer to appropriate transmit queue */
765 u16 (*select_queue)(struct net_device *dev,
766 struct sk_buff *skb);
767
768 unsigned long tx_queue_len; /* Max frames per queue allowed */ 779 unsigned long tx_queue_len; /* Max frames per queue allowed */
769 spinlock_t tx_global_lock; 780 spinlock_t tx_global_lock;
770/* 781/*
771 * One part is mostly used on xmit path (device) 782 * One part is mostly used on xmit path (device)
772 */ 783 */
773 void *priv; /* pointer to private data */ 784 void *priv; /* pointer to private data */
774 int (*hard_start_xmit) (struct sk_buff *skb,
775 struct net_device *dev);
776 /* These may be needed for future network-power-down code. */ 785 /* These may be needed for future network-power-down code. */
777 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 786 unsigned long trans_start; /* Time (in jiffies) of last Tx */
778 787
@@ -800,8 +809,6 @@ struct net_device
800 /* Called from unregister, can be used to call free_netdev */ 809 /* Called from unregister, can be used to call free_netdev */
801 void (*destructor)(struct net_device *dev); 810 void (*destructor)(struct net_device *dev);
802 811
803 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
804
805#ifdef CONFIG_NETPOLL 812#ifdef CONFIG_NETPOLL
806 struct netpoll_info *npinfo; 813 struct netpoll_info *npinfo;
807#endif 814#endif
@@ -842,6 +849,10 @@ struct net_device
842 void (*uninit)(struct net_device *dev); 849 void (*uninit)(struct net_device *dev);
843 int (*open)(struct net_device *dev); 850 int (*open)(struct net_device *dev);
844 int (*stop)(struct net_device *dev); 851 int (*stop)(struct net_device *dev);
852 int (*hard_start_xmit) (struct sk_buff *skb,
853 struct net_device *dev);
854 u16 (*select_queue)(struct net_device *dev,
855 struct sk_buff *skb);
845 void (*change_rx_flags)(struct net_device *dev, 856 void (*change_rx_flags)(struct net_device *dev,
846 int flags); 857 int flags);
847 void (*set_rx_mode)(struct net_device *dev); 858 void (*set_rx_mode)(struct net_device *dev);
@@ -854,6 +865,8 @@ struct net_device
854 int (*set_config)(struct net_device *dev, 865 int (*set_config)(struct net_device *dev,
855 struct ifmap *map); 866 struct ifmap *map);
856 int (*change_mtu)(struct net_device *dev, int new_mtu); 867 int (*change_mtu)(struct net_device *dev, int new_mtu);
868 int (*neigh_setup)(struct net_device *dev,
869 struct neigh_parms *);
857 void (*tx_timeout) (struct net_device *dev); 870 void (*tx_timeout) (struct net_device *dev);
858 struct net_device_stats* (*get_stats)(struct net_device *dev); 871 struct net_device_stats* (*get_stats)(struct net_device *dev);
859 void (*vlan_rx_register)(struct net_device *dev, 872 void (*vlan_rx_register)(struct net_device *dev,