diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-08-31 15:50:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-01 04:13:03 -0400 |
commit | dc1f8bf68b311b1537cb65893430b6796118498a (patch) | |
tree | 25aa489e1c88d6a535b6d6a694dcaf41f5256fa4 /include/linux/netdevice.h | |
parent | 9e39f7c5b311a306977c5471f9e2ce4c456aa038 (diff) |
netdev: change transmit to limited range type
The transmit function should only return one of three possible values,
some drivers got confused and returned errno's or other values.
This changes the definition so that this can be caught at compile time.
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.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 60d3aac49ed4..376a2e1ac00d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -79,17 +79,19 @@ struct wireless_dev; | |||
79 | #define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e)) | 79 | #define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e)) |
80 | #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) | 80 | #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) |
81 | 81 | ||
82 | /* Driver transmit return codes */ | ||
83 | enum netdev_tx { | ||
84 | NETDEV_TX_OK = 0, /* driver took care of packet */ | ||
85 | NETDEV_TX_BUSY, /* driver tx path was busy*/ | ||
86 | NETDEV_TX_LOCKED = -1, /* driver tx lock was already taken */ | ||
87 | }; | ||
88 | typedef enum netdev_tx netdev_tx_t; | ||
89 | |||
82 | #endif | 90 | #endif |
83 | 91 | ||
84 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ | 92 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ |
85 | 93 | ||
86 | /* Driver transmit return codes */ | ||
87 | #define NETDEV_TX_OK 0 /* driver took care of packet */ | ||
88 | #define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ | ||
89 | #define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */ | ||
90 | |||
91 | #ifdef __KERNEL__ | 94 | #ifdef __KERNEL__ |
92 | |||
93 | /* | 95 | /* |
94 | * Compute the worst case header length according to the protocols | 96 | * Compute the worst case header length according to the protocols |
95 | * used. | 97 | * used. |
@@ -507,9 +509,11 @@ struct netdev_queue { | |||
507 | * This function is called when network device transistions to the down | 509 | * This function is called when network device transistions to the down |
508 | * state. | 510 | * state. |
509 | * | 511 | * |
510 | * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev); | 512 | * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, |
513 | * struct net_device *dev); | ||
511 | * Called when a packet needs to be transmitted. | 514 | * Called when a packet needs to be transmitted. |
512 | * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED, | 515 | * Must return NETDEV_TX_OK , NETDEV_TX_BUSY. |
516 | * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) | ||
513 | * Required can not be NULL. | 517 | * Required can not be NULL. |
514 | * | 518 | * |
515 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); | 519 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); |
@@ -580,7 +584,7 @@ struct net_device_ops { | |||
580 | void (*ndo_uninit)(struct net_device *dev); | 584 | void (*ndo_uninit)(struct net_device *dev); |
581 | int (*ndo_open)(struct net_device *dev); | 585 | int (*ndo_open)(struct net_device *dev); |
582 | int (*ndo_stop)(struct net_device *dev); | 586 | int (*ndo_stop)(struct net_device *dev); |
583 | int (*ndo_start_xmit) (struct sk_buff *skb, | 587 | netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb, |
584 | struct net_device *dev); | 588 | struct net_device *dev); |
585 | u16 (*ndo_select_queue)(struct net_device *dev, | 589 | u16 (*ndo_select_queue)(struct net_device *dev, |
586 | struct sk_buff *skb); | 590 | struct sk_buff *skb); |