diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 350 |
1 files changed, 290 insertions, 60 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 812a5f3c2abe..fa8b47637997 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/if.h> | 28 | #include <linux/if.h> |
| 29 | #include <linux/if_ether.h> | 29 | #include <linux/if_ether.h> |
| 30 | #include <linux/if_packet.h> | 30 | #include <linux/if_packet.h> |
| 31 | #include <linux/if_link.h> | ||
| 31 | 32 | ||
| 32 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
| 33 | #include <linux/timer.h> | 34 | #include <linux/timer.h> |
| @@ -63,30 +64,69 @@ struct wireless_dev; | |||
| 63 | #define HAVE_FREE_NETDEV /* free_netdev() */ | 64 | #define HAVE_FREE_NETDEV /* free_netdev() */ |
| 64 | #define HAVE_NETDEV_PRIV /* netdev_priv() */ | 65 | #define HAVE_NETDEV_PRIV /* netdev_priv() */ |
| 65 | 66 | ||
| 66 | #define NET_XMIT_SUCCESS 0 | ||
| 67 | #define NET_XMIT_DROP 1 /* skb dropped */ | ||
| 68 | #define NET_XMIT_CN 2 /* congestion notification */ | ||
| 69 | #define NET_XMIT_POLICED 3 /* skb is shot by police */ | ||
| 70 | #define NET_XMIT_MASK 0xFFFF /* qdisc flags in net/sch_generic.h */ | ||
| 71 | |||
| 72 | /* Backlog congestion levels */ | 67 | /* Backlog congestion levels */ |
| 73 | #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ | 68 | #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ |
| 74 | #define NET_RX_DROP 1 /* packet dropped */ | 69 | #define NET_RX_DROP 1 /* packet dropped */ |
| 70 | |||
| 71 | /* | ||
| 72 | * Transmit return codes: transmit return codes originate from three different | ||
| 73 | * namespaces: | ||
| 74 | * | ||
| 75 | * - qdisc return codes | ||
| 76 | * - driver transmit return codes | ||
| 77 | * - errno values | ||
| 78 | * | ||
| 79 | * Drivers are allowed to return any one of those in their hard_start_xmit() | ||
| 80 | * function. Real network devices commonly used with qdiscs should only return | ||
| 81 | * the driver transmit return codes though - when qdiscs are used, the actual | ||
| 82 | * transmission happens asynchronously, so the value is not propagated to | ||
| 83 | * higher layers. Virtual network devices transmit synchronously, in this case | ||
| 84 | * the driver transmit return codes are consumed by dev_queue_xmit(), all | ||
| 85 | * others are propagated to higher layers. | ||
| 86 | */ | ||
| 87 | |||
| 88 | /* qdisc ->enqueue() return codes. */ | ||
| 89 | #define NET_XMIT_SUCCESS 0x00 | ||
| 90 | #define NET_XMIT_DROP 0x01 /* skb dropped */ | ||
| 91 | #define NET_XMIT_CN 0x02 /* congestion notification */ | ||
| 92 | #define NET_XMIT_POLICED 0x03 /* skb is shot by police */ | ||
| 93 | #define NET_XMIT_MASK 0x0f /* qdisc flags in net/sch_generic.h */ | ||
| 75 | 94 | ||
| 76 | /* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It | 95 | /* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It |
| 77 | * indicates that the device will soon be dropping packets, or already drops | 96 | * indicates that the device will soon be dropping packets, or already drops |
| 78 | * some packets of the same priority; prompting us to send less aggressively. */ | 97 | * some packets of the same priority; prompting us to send less aggressively. */ |
| 79 | #define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e)) | 98 | #define net_xmit_eval(e) ((e) == NET_XMIT_CN ? 0 : (e)) |
| 80 | #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) | 99 | #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) |
| 81 | 100 | ||
| 82 | /* Driver transmit return codes */ | 101 | /* Driver transmit return codes */ |
| 102 | #define NETDEV_TX_MASK 0xf0 | ||
| 103 | |||
| 83 | enum netdev_tx { | 104 | enum netdev_tx { |
| 84 | NETDEV_TX_OK = 0, /* driver took care of packet */ | 105 | __NETDEV_TX_MIN = INT_MIN, /* make sure enum is signed */ |
| 85 | NETDEV_TX_BUSY, /* driver tx path was busy*/ | 106 | NETDEV_TX_OK = 0x00, /* driver took care of packet */ |
| 86 | NETDEV_TX_LOCKED = -1, /* driver tx lock was already taken */ | 107 | NETDEV_TX_BUSY = 0x10, /* driver tx path was busy*/ |
| 108 | NETDEV_TX_LOCKED = 0x20, /* driver tx lock was already taken */ | ||
| 87 | }; | 109 | }; |
| 88 | typedef enum netdev_tx netdev_tx_t; | 110 | typedef enum netdev_tx netdev_tx_t; |
| 89 | 111 | ||
| 112 | /* | ||
| 113 | * Current order: NETDEV_TX_MASK > NET_XMIT_MASK >= 0 is significant; | ||
| 114 | * hard_start_xmit() return < NET_XMIT_MASK means skb was consumed. | ||
| 115 | */ | ||
| 116 | static inline bool dev_xmit_complete(int rc) | ||
| 117 | { | ||
| 118 | /* | ||
| 119 | * Positive cases with an skb consumed by a driver: | ||
| 120 | * - successful transmission (rc == NETDEV_TX_OK) | ||
| 121 | * - error while transmitting (rc < 0) | ||
| 122 | * - error while queueing to a different device (rc & NET_XMIT_MASK) | ||
| 123 | */ | ||
| 124 | if (likely(rc < NET_XMIT_MASK)) | ||
| 125 | return true; | ||
| 126 | |||
| 127 | return false; | ||
| 128 | } | ||
| 129 | |||
| 90 | #endif | 130 | #endif |
| 91 | 131 | ||
| 92 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ | 132 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ |
| @@ -97,7 +137,7 @@ typedef enum netdev_tx netdev_tx_t; | |||
| 97 | * used. | 137 | * used. |
| 98 | */ | 138 | */ |
| 99 | 139 | ||
| 100 | #if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 140 | #if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) |
| 101 | # if defined(CONFIG_MAC80211_MESH) | 141 | # if defined(CONFIG_MAC80211_MESH) |
| 102 | # define LL_MAX_HEADER 128 | 142 | # define LL_MAX_HEADER 128 |
| 103 | # else | 143 | # else |
| @@ -125,8 +165,7 @@ typedef enum netdev_tx netdev_tx_t; | |||
| 125 | * with byte counters. | 165 | * with byte counters. |
| 126 | */ | 166 | */ |
| 127 | 167 | ||
| 128 | struct net_device_stats | 168 | struct net_device_stats { |
| 129 | { | ||
| 130 | unsigned long rx_packets; /* total packets received */ | 169 | unsigned long rx_packets; /* total packets received */ |
| 131 | unsigned long tx_packets; /* total packets transmitted */ | 170 | unsigned long tx_packets; /* total packets transmitted */ |
| 132 | unsigned long rx_bytes; /* total bytes received */ | 171 | unsigned long rx_bytes; /* total bytes received */ |
| @@ -179,8 +218,7 @@ struct neighbour; | |||
| 179 | struct neigh_parms; | 218 | struct neigh_parms; |
| 180 | struct sk_buff; | 219 | struct sk_buff; |
| 181 | 220 | ||
| 182 | struct netif_rx_stats | 221 | struct netif_rx_stats { |
| 183 | { | ||
| 184 | unsigned total; | 222 | unsigned total; |
| 185 | unsigned dropped; | 223 | unsigned dropped; |
| 186 | unsigned time_squeeze; | 224 | unsigned time_squeeze; |
| @@ -189,8 +227,7 @@ struct netif_rx_stats | |||
| 189 | 227 | ||
| 190 | DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat); | 228 | DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat); |
| 191 | 229 | ||
| 192 | struct dev_addr_list | 230 | struct dev_addr_list { |
| 193 | { | ||
| 194 | struct dev_addr_list *next; | 231 | struct dev_addr_list *next; |
| 195 | u8 da_addr[MAX_ADDR_LEN]; | 232 | u8 da_addr[MAX_ADDR_LEN]; |
| 196 | u8 da_addrlen; | 233 | u8 da_addrlen; |
| @@ -227,8 +264,18 @@ struct netdev_hw_addr_list { | |||
| 227 | int count; | 264 | int count; |
| 228 | }; | 265 | }; |
| 229 | 266 | ||
| 230 | struct hh_cache | 267 | #define netdev_uc_count(dev) ((dev)->uc.count) |
| 231 | { | 268 | #define netdev_uc_empty(dev) ((dev)->uc.count == 0) |
| 269 | #define netdev_for_each_uc_addr(ha, dev) \ | ||
| 270 | list_for_each_entry(ha, &dev->uc.list, list) | ||
| 271 | |||
| 272 | #define netdev_mc_count(dev) ((dev)->mc_count) | ||
| 273 | #define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) | ||
| 274 | |||
| 275 | #define netdev_for_each_mc_addr(mclist, dev) \ | ||
| 276 | for (mclist = dev->mc_list; mclist; mclist = mclist->next) | ||
| 277 | |||
| 278 | struct hh_cache { | ||
| 232 | struct hh_cache *hh_next; /* Next entry */ | 279 | struct hh_cache *hh_next; /* Next entry */ |
| 233 | atomic_t hh_refcnt; /* number of users */ | 280 | atomic_t hh_refcnt; /* number of users */ |
| 234 | /* | 281 | /* |
| @@ -291,8 +338,7 @@ struct header_ops { | |||
| 291 | * code. | 338 | * code. |
| 292 | */ | 339 | */ |
| 293 | 340 | ||
| 294 | enum netdev_state_t | 341 | enum netdev_state_t { |
| 295 | { | ||
| 296 | __LINK_STATE_START, | 342 | __LINK_STATE_START, |
| 297 | __LINK_STATE_PRESENT, | 343 | __LINK_STATE_PRESENT, |
| 298 | __LINK_STATE_NOCARRIER, | 344 | __LINK_STATE_NOCARRIER, |
| @@ -341,20 +387,20 @@ struct napi_struct { | |||
| 341 | struct sk_buff *skb; | 387 | struct sk_buff *skb; |
| 342 | }; | 388 | }; |
| 343 | 389 | ||
| 344 | enum | 390 | enum { |
| 345 | { | ||
| 346 | NAPI_STATE_SCHED, /* Poll is scheduled */ | 391 | NAPI_STATE_SCHED, /* Poll is scheduled */ |
| 347 | NAPI_STATE_DISABLE, /* Disable pending */ | 392 | NAPI_STATE_DISABLE, /* Disable pending */ |
| 348 | NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ | 393 | NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ |
| 349 | }; | 394 | }; |
| 350 | 395 | ||
| 351 | enum { | 396 | enum gro_result { |
| 352 | GRO_MERGED, | 397 | GRO_MERGED, |
| 353 | GRO_MERGED_FREE, | 398 | GRO_MERGED_FREE, |
| 354 | GRO_HELD, | 399 | GRO_HELD, |
| 355 | GRO_NORMAL, | 400 | GRO_NORMAL, |
| 356 | GRO_DROP, | 401 | GRO_DROP, |
| 357 | }; | 402 | }; |
| 403 | typedef enum gro_result gro_result_t; | ||
| 358 | 404 | ||
| 359 | extern void __napi_schedule(struct napi_struct *n); | 405 | extern void __napi_schedule(struct napi_struct *n); |
| 360 | 406 | ||
| @@ -457,8 +503,7 @@ static inline void napi_synchronize(const struct napi_struct *n) | |||
| 457 | # define napi_synchronize(n) barrier() | 503 | # define napi_synchronize(n) barrier() |
| 458 | #endif | 504 | #endif |
| 459 | 505 | ||
| 460 | enum netdev_queue_state_t | 506 | enum netdev_queue_state_t { |
| 461 | { | ||
| 462 | __QUEUE_STATE_XOFF, | 507 | __QUEUE_STATE_XOFF, |
| 463 | __QUEUE_STATE_FROZEN, | 508 | __QUEUE_STATE_FROZEN, |
| 464 | }; | 509 | }; |
| @@ -577,6 +622,13 @@ struct netdev_queue { | |||
| 577 | * this function is called when a VLAN id is unregistered. | 622 | * this function is called when a VLAN id is unregistered. |
| 578 | * | 623 | * |
| 579 | * void (*ndo_poll_controller)(struct net_device *dev); | 624 | * void (*ndo_poll_controller)(struct net_device *dev); |
| 625 | * | ||
| 626 | * SR-IOV management functions. | ||
| 627 | * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); | ||
| 628 | * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); | ||
| 629 | * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); | ||
| 630 | * int (*ndo_get_vf_config)(struct net_device *dev, | ||
| 631 | * int vf, struct ifla_vf_info *ivf); | ||
| 580 | */ | 632 | */ |
| 581 | #define HAVE_NET_DEVICE_OPS | 633 | #define HAVE_NET_DEVICE_OPS |
| 582 | struct net_device_ops { | 634 | struct net_device_ops { |
| @@ -588,30 +640,21 @@ struct net_device_ops { | |||
| 588 | struct net_device *dev); | 640 | struct net_device *dev); |
| 589 | u16 (*ndo_select_queue)(struct net_device *dev, | 641 | u16 (*ndo_select_queue)(struct net_device *dev, |
| 590 | struct sk_buff *skb); | 642 | struct sk_buff *skb); |
| 591 | #define HAVE_CHANGE_RX_FLAGS | ||
| 592 | void (*ndo_change_rx_flags)(struct net_device *dev, | 643 | void (*ndo_change_rx_flags)(struct net_device *dev, |
| 593 | int flags); | 644 | int flags); |
| 594 | #define HAVE_SET_RX_MODE | ||
| 595 | void (*ndo_set_rx_mode)(struct net_device *dev); | 645 | void (*ndo_set_rx_mode)(struct net_device *dev); |
| 596 | #define HAVE_MULTICAST | ||
| 597 | void (*ndo_set_multicast_list)(struct net_device *dev); | 646 | void (*ndo_set_multicast_list)(struct net_device *dev); |
| 598 | #define HAVE_SET_MAC_ADDR | ||
| 599 | int (*ndo_set_mac_address)(struct net_device *dev, | 647 | int (*ndo_set_mac_address)(struct net_device *dev, |
| 600 | void *addr); | 648 | void *addr); |
| 601 | #define HAVE_VALIDATE_ADDR | ||
| 602 | int (*ndo_validate_addr)(struct net_device *dev); | 649 | int (*ndo_validate_addr)(struct net_device *dev); |
| 603 | #define HAVE_PRIVATE_IOCTL | ||
| 604 | int (*ndo_do_ioctl)(struct net_device *dev, | 650 | int (*ndo_do_ioctl)(struct net_device *dev, |
| 605 | struct ifreq *ifr, int cmd); | 651 | struct ifreq *ifr, int cmd); |
| 606 | #define HAVE_SET_CONFIG | ||
| 607 | int (*ndo_set_config)(struct net_device *dev, | 652 | int (*ndo_set_config)(struct net_device *dev, |
| 608 | struct ifmap *map); | 653 | struct ifmap *map); |
| 609 | #define HAVE_CHANGE_MTU | ||
| 610 | int (*ndo_change_mtu)(struct net_device *dev, | 654 | int (*ndo_change_mtu)(struct net_device *dev, |
| 611 | int new_mtu); | 655 | int new_mtu); |
| 612 | int (*ndo_neigh_setup)(struct net_device *dev, | 656 | int (*ndo_neigh_setup)(struct net_device *dev, |
| 613 | struct neigh_parms *); | 657 | struct neigh_parms *); |
| 614 | #define HAVE_TX_TIMEOUT | ||
| 615 | void (*ndo_tx_timeout) (struct net_device *dev); | 658 | void (*ndo_tx_timeout) (struct net_device *dev); |
| 616 | 659 | ||
| 617 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 660 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
| @@ -623,9 +666,17 @@ struct net_device_ops { | |||
| 623 | void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, | 666 | void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, |
| 624 | unsigned short vid); | 667 | unsigned short vid); |
| 625 | #ifdef CONFIG_NET_POLL_CONTROLLER | 668 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 626 | #define HAVE_NETDEV_POLL | ||
| 627 | void (*ndo_poll_controller)(struct net_device *dev); | 669 | void (*ndo_poll_controller)(struct net_device *dev); |
| 628 | #endif | 670 | #endif |
| 671 | int (*ndo_set_vf_mac)(struct net_device *dev, | ||
| 672 | int queue, u8 *mac); | ||
| 673 | int (*ndo_set_vf_vlan)(struct net_device *dev, | ||
| 674 | int queue, u16 vlan, u8 qos); | ||
| 675 | int (*ndo_set_vf_tx_rate)(struct net_device *dev, | ||
| 676 | int vf, int rate); | ||
| 677 | int (*ndo_get_vf_config)(struct net_device *dev, | ||
| 678 | int vf, | ||
| 679 | struct ifla_vf_info *ivf); | ||
| 629 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | 680 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
| 630 | int (*ndo_fcoe_enable)(struct net_device *dev); | 681 | int (*ndo_fcoe_enable)(struct net_device *dev); |
| 631 | int (*ndo_fcoe_disable)(struct net_device *dev); | 682 | int (*ndo_fcoe_disable)(struct net_device *dev); |
| @@ -635,6 +686,10 @@ struct net_device_ops { | |||
| 635 | unsigned int sgc); | 686 | unsigned int sgc); |
| 636 | int (*ndo_fcoe_ddp_done)(struct net_device *dev, | 687 | int (*ndo_fcoe_ddp_done)(struct net_device *dev, |
| 637 | u16 xid); | 688 | u16 xid); |
| 689 | #define NETDEV_FCOE_WWNN 0 | ||
| 690 | #define NETDEV_FCOE_WWPN 1 | ||
| 691 | int (*ndo_fcoe_get_wwn)(struct net_device *dev, | ||
| 692 | u64 *wwn, int type); | ||
| 638 | #endif | 693 | #endif |
| 639 | }; | 694 | }; |
| 640 | 695 | ||
| @@ -648,8 +703,7 @@ struct net_device_ops { | |||
| 648 | * moves out. | 703 | * moves out. |
| 649 | */ | 704 | */ |
| 650 | 705 | ||
| 651 | struct net_device | 706 | struct net_device { |
| 652 | { | ||
| 653 | 707 | ||
| 654 | /* | 708 | /* |
| 655 | * This is the first field of the "visible" part of this structure | 709 | * This is the first field of the "visible" part of this structure |
| @@ -683,6 +737,7 @@ struct net_device | |||
| 683 | 737 | ||
| 684 | struct list_head dev_list; | 738 | struct list_head dev_list; |
| 685 | struct list_head napi_list; | 739 | struct list_head napi_list; |
| 740 | struct list_head unreg_list; | ||
| 686 | 741 | ||
| 687 | /* Net device features */ | 742 | /* Net device features */ |
| 688 | unsigned long features; | 743 | unsigned long features; |
| @@ -708,6 +763,7 @@ struct net_device | |||
| 708 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ | 763 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ |
| 709 | #define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ | 764 | #define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ |
| 710 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ | 765 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ |
| 766 | #define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ | ||
| 711 | 767 | ||
| 712 | /* Segmentation offload features */ | 768 | /* Segmentation offload features */ |
| 713 | #define NETIF_F_GSO_SHIFT 16 | 769 | #define NETIF_F_GSO_SHIFT 16 |
| @@ -859,7 +915,7 @@ struct net_device | |||
| 859 | /* device index hash chain */ | 915 | /* device index hash chain */ |
| 860 | struct hlist_node index_hlist; | 916 | struct hlist_node index_hlist; |
| 861 | 917 | ||
| 862 | struct net_device *link_watch_next; | 918 | struct list_head link_watch_list; |
| 863 | 919 | ||
| 864 | /* register/unregister state machine */ | 920 | /* register/unregister state machine */ |
| 865 | enum { NETREG_UNINITIALIZED=0, | 921 | enum { NETREG_UNINITIALIZED=0, |
| @@ -868,7 +924,12 @@ struct net_device | |||
| 868 | NETREG_UNREGISTERED, /* completed unregister todo */ | 924 | NETREG_UNREGISTERED, /* completed unregister todo */ |
| 869 | NETREG_RELEASED, /* called free_netdev */ | 925 | NETREG_RELEASED, /* called free_netdev */ |
| 870 | NETREG_DUMMY, /* dummy device for NAPI poll */ | 926 | NETREG_DUMMY, /* dummy device for NAPI poll */ |
| 871 | } reg_state; | 927 | } reg_state:16; |
| 928 | |||
| 929 | enum { | ||
| 930 | RTNL_LINK_INITIALIZED, | ||
| 931 | RTNL_LINK_INITIALIZING, | ||
| 932 | } rtnl_link_state:16; | ||
| 872 | 933 | ||
| 873 | /* Called from unregister, can be used to call free_netdev */ | 934 | /* Called from unregister, can be used to call free_netdev */ |
| 874 | void (*destructor)(struct net_device *dev); | 935 | void (*destructor)(struct net_device *dev); |
| @@ -894,8 +955,8 @@ struct net_device | |||
| 894 | 955 | ||
| 895 | /* class/net/name entry */ | 956 | /* class/net/name entry */ |
| 896 | struct device dev; | 957 | struct device dev; |
| 897 | /* space for optional statistics and wireless sysfs groups */ | 958 | /* space for optional device, statistics, and wireless sysfs groups */ |
| 898 | const struct attribute_group *sysfs_groups[3]; | 959 | const struct attribute_group *sysfs_groups[4]; |
| 899 | 960 | ||
| 900 | /* rtnetlink link ops */ | 961 | /* rtnetlink link ops */ |
| 901 | const struct rtnl_link_ops *rtnl_link_ops; | 962 | const struct rtnl_link_ops *rtnl_link_ops; |
| @@ -909,13 +970,15 @@ struct net_device | |||
| 909 | 970 | ||
| 910 | #ifdef CONFIG_DCB | 971 | #ifdef CONFIG_DCB |
| 911 | /* Data Center Bridging netlink ops */ | 972 | /* Data Center Bridging netlink ops */ |
| 912 | struct dcbnl_rtnl_ops *dcbnl_ops; | 973 | const struct dcbnl_rtnl_ops *dcbnl_ops; |
| 913 | #endif | 974 | #endif |
| 914 | 975 | ||
| 915 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | 976 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
| 916 | /* max exchange id for FCoE LRO by ddp */ | 977 | /* max exchange id for FCoE LRO by ddp */ |
| 917 | unsigned int fcoe_ddp_xid; | 978 | unsigned int fcoe_ddp_xid; |
| 918 | #endif | 979 | #endif |
| 980 | /* n-tuple filter list attached to this device */ | ||
| 981 | struct ethtool_rx_ntuple_list ethtool_ntuple_list; | ||
| 919 | }; | 982 | }; |
| 920 | #define to_net_dev(d) container_of(d, struct net_device, dev) | 983 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
| 921 | 984 | ||
| @@ -972,6 +1035,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev) | |||
| 972 | return 0; | 1035 | return 0; |
| 973 | } | 1036 | } |
| 974 | 1037 | ||
| 1038 | #ifndef CONFIG_NET_NS | ||
| 1039 | static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev) | ||
| 1040 | { | ||
| 1041 | skb->dev = dev; | ||
| 1042 | } | ||
| 1043 | #else /* CONFIG_NET_NS */ | ||
| 1044 | void skb_set_dev(struct sk_buff *skb, struct net_device *dev); | ||
| 1045 | #endif | ||
| 1046 | |||
| 975 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) | 1047 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) |
| 976 | { | 1048 | { |
| 977 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | 1049 | #ifdef CONFIG_NET_DSA_TAG_TRAILER |
| @@ -1075,10 +1147,16 @@ extern rwlock_t dev_base_lock; /* Device list lock */ | |||
| 1075 | 1147 | ||
| 1076 | #define for_each_netdev(net, d) \ | 1148 | #define for_each_netdev(net, d) \ |
| 1077 | list_for_each_entry(d, &(net)->dev_base_head, dev_list) | 1149 | list_for_each_entry(d, &(net)->dev_base_head, dev_list) |
| 1150 | #define for_each_netdev_reverse(net, d) \ | ||
| 1151 | list_for_each_entry_reverse(d, &(net)->dev_base_head, dev_list) | ||
| 1152 | #define for_each_netdev_rcu(net, d) \ | ||
| 1153 | list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list) | ||
| 1078 | #define for_each_netdev_safe(net, d, n) \ | 1154 | #define for_each_netdev_safe(net, d, n) \ |
| 1079 | list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) | 1155 | list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) |
| 1080 | #define for_each_netdev_continue(net, d) \ | 1156 | #define for_each_netdev_continue(net, d) \ |
| 1081 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) | 1157 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) |
| 1158 | #define for_each_netdev_continue_rcu(net, d) \ | ||
| 1159 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) | ||
| 1082 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) | 1160 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) |
| 1083 | 1161 | ||
| 1084 | static inline struct net_device *next_net_device(struct net_device *dev) | 1162 | static inline struct net_device *next_net_device(struct net_device *dev) |
| @@ -1091,6 +1169,16 @@ static inline struct net_device *next_net_device(struct net_device *dev) | |||
| 1091 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); | 1169 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); |
| 1092 | } | 1170 | } |
| 1093 | 1171 | ||
| 1172 | static inline struct net_device *next_net_device_rcu(struct net_device *dev) | ||
| 1173 | { | ||
| 1174 | struct list_head *lh; | ||
| 1175 | struct net *net; | ||
| 1176 | |||
| 1177 | net = dev_net(dev); | ||
| 1178 | lh = rcu_dereference(dev->dev_list.next); | ||
| 1179 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); | ||
| 1180 | } | ||
| 1181 | |||
| 1094 | static inline struct net_device *first_net_device(struct net *net) | 1182 | static inline struct net_device *first_net_device(struct net *net) |
| 1095 | { | 1183 | { |
| 1096 | return list_empty(&net->dev_base_head) ? NULL : | 1184 | return list_empty(&net->dev_base_head) ? NULL : |
| @@ -1109,6 +1197,7 @@ extern void __dev_remove_pack(struct packet_type *pt); | |||
| 1109 | extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags, | 1197 | extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags, |
| 1110 | unsigned short mask); | 1198 | unsigned short mask); |
| 1111 | extern struct net_device *dev_get_by_name(struct net *net, const char *name); | 1199 | extern struct net_device *dev_get_by_name(struct net *net, const char *name); |
| 1200 | extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); | ||
| 1112 | extern struct net_device *__dev_get_by_name(struct net *net, const char *name); | 1201 | extern struct net_device *__dev_get_by_name(struct net *net, const char *name); |
| 1113 | extern int dev_alloc_name(struct net_device *dev, const char *name); | 1202 | extern int dev_alloc_name(struct net_device *dev, const char *name); |
| 1114 | extern int dev_open(struct net_device *dev); | 1203 | extern int dev_open(struct net_device *dev); |
| @@ -1116,7 +1205,14 @@ extern int dev_close(struct net_device *dev); | |||
| 1116 | extern void dev_disable_lro(struct net_device *dev); | 1205 | extern void dev_disable_lro(struct net_device *dev); |
| 1117 | extern int dev_queue_xmit(struct sk_buff *skb); | 1206 | extern int dev_queue_xmit(struct sk_buff *skb); |
| 1118 | extern int register_netdevice(struct net_device *dev); | 1207 | extern int register_netdevice(struct net_device *dev); |
| 1119 | extern void unregister_netdevice(struct net_device *dev); | 1208 | extern void unregister_netdevice_queue(struct net_device *dev, |
| 1209 | struct list_head *head); | ||
| 1210 | extern void unregister_netdevice_many(struct list_head *head); | ||
| 1211 | static inline void unregister_netdevice(struct net_device *dev) | ||
| 1212 | { | ||
| 1213 | unregister_netdevice_queue(dev, NULL); | ||
| 1214 | } | ||
| 1215 | |||
| 1120 | extern void free_netdev(struct net_device *dev); | 1216 | extern void free_netdev(struct net_device *dev); |
| 1121 | extern void synchronize_net(void); | 1217 | extern void synchronize_net(void); |
| 1122 | extern int register_netdevice_notifier(struct notifier_block *nb); | 1218 | extern int register_netdevice_notifier(struct notifier_block *nb); |
| @@ -1127,6 +1223,7 @@ extern void netdev_resync_ops(struct net_device *dev); | |||
| 1127 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); | 1223 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); |
| 1128 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); | 1224 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); |
| 1129 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); | 1225 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
| 1226 | extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); | ||
| 1130 | extern int dev_restart(struct net_device *dev); | 1227 | extern int dev_restart(struct net_device *dev); |
| 1131 | #ifdef CONFIG_NETPOLL_TRAP | 1228 | #ifdef CONFIG_NETPOLL_TRAP |
| 1132 | extern int netpoll_trap(void); | 1229 | extern int netpoll_trap(void); |
| @@ -1212,8 +1309,7 @@ static inline int unregister_gifconf(unsigned int family) | |||
| 1212 | * Incoming packets are placed on per-cpu queues so that | 1309 | * Incoming packets are placed on per-cpu queues so that |
| 1213 | * no locking is needed. | 1310 | * no locking is needed. |
| 1214 | */ | 1311 | */ |
| 1215 | struct softnet_data | 1312 | struct softnet_data { |
| 1216 | { | ||
| 1217 | struct Qdisc *output_queue; | 1313 | struct Qdisc *output_queue; |
| 1218 | struct sk_buff_head input_pkt_queue; | 1314 | struct sk_buff_head input_pkt_queue; |
| 1219 | struct list_head poll_list; | 1315 | struct list_head poll_list; |
| @@ -1466,19 +1562,19 @@ extern int netif_rx(struct sk_buff *skb); | |||
| 1466 | extern int netif_rx_ni(struct sk_buff *skb); | 1562 | extern int netif_rx_ni(struct sk_buff *skb); |
| 1467 | #define HAVE_NETIF_RECEIVE_SKB 1 | 1563 | #define HAVE_NETIF_RECEIVE_SKB 1 |
| 1468 | extern int netif_receive_skb(struct sk_buff *skb); | 1564 | extern int netif_receive_skb(struct sk_buff *skb); |
| 1469 | extern void napi_gro_flush(struct napi_struct *napi); | 1565 | extern gro_result_t dev_gro_receive(struct napi_struct *napi, |
| 1470 | extern int dev_gro_receive(struct napi_struct *napi, | ||
| 1471 | struct sk_buff *skb); | 1566 | struct sk_buff *skb); |
| 1472 | extern int napi_skb_finish(int ret, struct sk_buff *skb); | 1567 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); |
| 1473 | extern int napi_gro_receive(struct napi_struct *napi, | 1568 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, |
| 1474 | struct sk_buff *skb); | 1569 | struct sk_buff *skb); |
| 1475 | extern void napi_reuse_skb(struct napi_struct *napi, | 1570 | extern void napi_reuse_skb(struct napi_struct *napi, |
| 1476 | struct sk_buff *skb); | 1571 | struct sk_buff *skb); |
| 1477 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); | 1572 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); |
| 1478 | extern int napi_frags_finish(struct napi_struct *napi, | 1573 | extern gro_result_t napi_frags_finish(struct napi_struct *napi, |
| 1479 | struct sk_buff *skb, int ret); | 1574 | struct sk_buff *skb, |
| 1575 | gro_result_t ret); | ||
| 1480 | extern struct sk_buff * napi_frags_skb(struct napi_struct *napi); | 1576 | extern struct sk_buff * napi_frags_skb(struct napi_struct *napi); |
| 1481 | extern int napi_gro_frags(struct napi_struct *napi); | 1577 | extern gro_result_t napi_gro_frags(struct napi_struct *napi); |
| 1482 | 1578 | ||
| 1483 | static inline void napi_free_frags(struct napi_struct *napi) | 1579 | static inline void napi_free_frags(struct napi_struct *napi) |
| 1484 | { | 1580 | { |
| @@ -1491,7 +1587,9 @@ extern int dev_valid_name(const char *name); | |||
| 1491 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 1587 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
| 1492 | extern int dev_ethtool(struct net *net, struct ifreq *); | 1588 | extern int dev_ethtool(struct net *net, struct ifreq *); |
| 1493 | extern unsigned dev_get_flags(const struct net_device *); | 1589 | extern unsigned dev_get_flags(const struct net_device *); |
| 1590 | extern int __dev_change_flags(struct net_device *, unsigned int flags); | ||
| 1494 | extern int dev_change_flags(struct net_device *, unsigned); | 1591 | extern int dev_change_flags(struct net_device *, unsigned); |
| 1592 | extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); | ||
| 1495 | extern int dev_change_name(struct net_device *, const char *); | 1593 | extern int dev_change_name(struct net_device *, const char *); |
| 1496 | extern int dev_set_alias(struct net_device *, const char *, size_t); | 1594 | extern int dev_set_alias(struct net_device *, const char *, size_t); |
| 1497 | extern int dev_change_net_namespace(struct net_device *, | 1595 | extern int dev_change_net_namespace(struct net_device *, |
| @@ -1502,6 +1600,8 @@ extern int dev_set_mac_address(struct net_device *, | |||
| 1502 | extern int dev_hard_start_xmit(struct sk_buff *skb, | 1600 | extern int dev_hard_start_xmit(struct sk_buff *skb, |
| 1503 | struct net_device *dev, | 1601 | struct net_device *dev, |
| 1504 | struct netdev_queue *txq); | 1602 | struct netdev_queue *txq); |
| 1603 | extern int dev_forward_skb(struct net_device *dev, | ||
| 1604 | struct sk_buff *skb); | ||
| 1505 | 1605 | ||
| 1506 | extern int netdev_budget; | 1606 | extern int netdev_budget; |
| 1507 | 1607 | ||
| @@ -1540,6 +1640,7 @@ static inline void dev_hold(struct net_device *dev) | |||
| 1540 | */ | 1640 | */ |
| 1541 | 1641 | ||
| 1542 | extern void linkwatch_fire_event(struct net_device *dev); | 1642 | extern void linkwatch_fire_event(struct net_device *dev); |
| 1643 | extern void linkwatch_forget_dev(struct net_device *dev); | ||
| 1543 | 1644 | ||
| 1544 | /** | 1645 | /** |
| 1545 | * netif_carrier_ok - test if carrier present | 1646 | * netif_carrier_ok - test if carrier present |
| @@ -1609,7 +1710,8 @@ static inline int netif_dormant(const struct net_device *dev) | |||
| 1609 | * | 1710 | * |
| 1610 | * Check if carrier is operational | 1711 | * Check if carrier is operational |
| 1611 | */ | 1712 | */ |
| 1612 | static inline int netif_oper_up(const struct net_device *dev) { | 1713 | static inline int netif_oper_up(const struct net_device *dev) |
| 1714 | { | ||
| 1613 | return (dev->operstate == IF_OPER_UP || | 1715 | return (dev->operstate == IF_OPER_UP || |
| 1614 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); | 1716 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); |
| 1615 | } | 1717 | } |
| @@ -1880,6 +1982,7 @@ extern void netdev_features_change(struct net_device *dev); | |||
| 1880 | extern void dev_load(struct net *net, const char *name); | 1982 | extern void dev_load(struct net *net, const char *name); |
| 1881 | extern void dev_mcast_init(void); | 1983 | extern void dev_mcast_init(void); |
| 1882 | extern const struct net_device_stats *dev_get_stats(struct net_device *dev); | 1984 | extern const struct net_device_stats *dev_get_stats(struct net_device *dev); |
| 1985 | extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); | ||
| 1883 | 1986 | ||
| 1884 | extern int netdev_max_backlog; | 1987 | extern int netdev_max_backlog; |
| 1885 | extern int weight_p; | 1988 | extern int weight_p; |
| @@ -1914,6 +2017,9 @@ unsigned long netdev_increment_features(unsigned long all, unsigned long one, | |||
| 1914 | unsigned long mask); | 2017 | unsigned long mask); |
| 1915 | unsigned long netdev_fix_features(unsigned long features, const char *name); | 2018 | unsigned long netdev_fix_features(unsigned long features, const char *name); |
| 1916 | 2019 | ||
| 2020 | void netif_stacked_transfer_operstate(const struct net_device *rootdev, | ||
| 2021 | struct net_device *dev); | ||
| 2022 | |||
| 1917 | static inline int net_gso_ok(int features, int gso_type) | 2023 | static inline int net_gso_ok(int features, int gso_type) |
| 1918 | { | 2024 | { |
| 1919 | int feature = gso_type << NETIF_F_GSO_SHIFT; | 2025 | int feature = gso_type << NETIF_F_GSO_SHIFT; |
| @@ -1953,12 +2059,12 @@ static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, | |||
| 1953 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and | 2059 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and |
| 1954 | * ARP on active-backup slaves with arp_validate enabled. | 2060 | * ARP on active-backup slaves with arp_validate enabled. |
| 1955 | */ | 2061 | */ |
| 1956 | static inline int skb_bond_should_drop(struct sk_buff *skb) | 2062 | static inline int skb_bond_should_drop(struct sk_buff *skb, |
| 2063 | struct net_device *master) | ||
| 1957 | { | 2064 | { |
| 1958 | struct net_device *dev = skb->dev; | ||
| 1959 | struct net_device *master = dev->master; | ||
| 1960 | |||
| 1961 | if (master) { | 2065 | if (master) { |
| 2066 | struct net_device *dev = skb->dev; | ||
| 2067 | |||
| 1962 | if (master->priv_flags & IFF_MASTER_ARPMON) | 2068 | if (master->priv_flags & IFF_MASTER_ARPMON) |
| 1963 | dev->last_rx = jiffies; | 2069 | dev->last_rx = jiffies; |
| 1964 | 2070 | ||
| @@ -2013,6 +2119,130 @@ static inline u32 dev_ethtool_get_flags(struct net_device *dev) | |||
| 2013 | return 0; | 2119 | return 0; |
| 2014 | return dev->ethtool_ops->get_flags(dev); | 2120 | return dev->ethtool_ops->get_flags(dev); |
| 2015 | } | 2121 | } |
| 2122 | |||
| 2123 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | ||
| 2124 | |||
| 2125 | /* netdev_printk helpers, similar to dev_printk */ | ||
| 2126 | |||
| 2127 | static inline const char *netdev_name(const struct net_device *dev) | ||
| 2128 | { | ||
| 2129 | if (dev->reg_state != NETREG_REGISTERED) | ||
| 2130 | return "(unregistered net_device)"; | ||
| 2131 | return dev->name; | ||
| 2132 | } | ||
| 2133 | |||
| 2134 | #define netdev_printk(level, netdev, format, args...) \ | ||
| 2135 | dev_printk(level, (netdev)->dev.parent, \ | ||
| 2136 | "%s: " format, \ | ||
| 2137 | netdev_name(netdev), ##args) | ||
| 2138 | |||
| 2139 | #define netdev_emerg(dev, format, args...) \ | ||
| 2140 | netdev_printk(KERN_EMERG, dev, format, ##args) | ||
| 2141 | #define netdev_alert(dev, format, args...) \ | ||
| 2142 | netdev_printk(KERN_ALERT, dev, format, ##args) | ||
| 2143 | #define netdev_crit(dev, format, args...) \ | ||
| 2144 | netdev_printk(KERN_CRIT, dev, format, ##args) | ||
| 2145 | #define netdev_err(dev, format, args...) \ | ||
| 2146 | netdev_printk(KERN_ERR, dev, format, ##args) | ||
| 2147 | #define netdev_warn(dev, format, args...) \ | ||
| 2148 | netdev_printk(KERN_WARNING, dev, format, ##args) | ||
| 2149 | #define netdev_notice(dev, format, args...) \ | ||
| 2150 | netdev_printk(KERN_NOTICE, dev, format, ##args) | ||
| 2151 | #define netdev_info(dev, format, args...) \ | ||
| 2152 | netdev_printk(KERN_INFO, dev, format, ##args) | ||
| 2153 | |||
| 2154 | #if defined(DEBUG) | ||
| 2155 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2156 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
| 2157 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 2158 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2159 | do { \ | ||
| 2160 | dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \ | ||
| 2161 | netdev_name(__dev), ##args); \ | ||
| 2162 | } while (0) | ||
| 2163 | #else | ||
| 2164 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2165 | ({ \ | ||
| 2166 | if (0) \ | ||
| 2167 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ||
| 2168 | 0; \ | ||
| 2169 | }) | ||
| 2170 | #endif | ||
| 2171 | |||
| 2172 | #if defined(VERBOSE_DEBUG) | ||
| 2173 | #define netdev_vdbg netdev_dbg | ||
| 2174 | #else | ||
| 2175 | |||
| 2176 | #define netdev_vdbg(dev, format, args...) \ | ||
| 2177 | ({ \ | ||
| 2178 | if (0) \ | ||
| 2179 | netdev_printk(KERN_DEBUG, dev, format, ##args); \ | ||
| 2180 | 0; \ | ||
| 2181 | }) | ||
| 2182 | #endif | ||
| 2183 | |||
| 2184 | /* | ||
| 2185 | * netdev_WARN() acts like dev_printk(), but with the key difference | ||
| 2186 | * of using a WARN/WARN_ON to get the message out, including the | ||
| 2187 | * file/line information and a backtrace. | ||
| 2188 | */ | ||
| 2189 | #define netdev_WARN(dev, format, args...) \ | ||
| 2190 | WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); | ||
| 2191 | |||
| 2192 | /* netif printk helpers, similar to netdev_printk */ | ||
| 2193 | |||
| 2194 | #define netif_printk(priv, type, level, dev, fmt, args...) \ | ||
| 2195 | do { \ | ||
| 2196 | if (netif_msg_##type(priv)) \ | ||
| 2197 | netdev_printk(level, (dev), fmt, ##args); \ | ||
| 2198 | } while (0) | ||
| 2199 | |||
| 2200 | #define netif_emerg(priv, type, dev, fmt, args...) \ | ||
| 2201 | netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args) | ||
| 2202 | #define netif_alert(priv, type, dev, fmt, args...) \ | ||
| 2203 | netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args) | ||
| 2204 | #define netif_crit(priv, type, dev, fmt, args...) \ | ||
| 2205 | netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args) | ||
| 2206 | #define netif_err(priv, type, dev, fmt, args...) \ | ||
| 2207 | netif_printk(priv, type, KERN_ERR, dev, fmt, ##args) | ||
| 2208 | #define netif_warn(priv, type, dev, fmt, args...) \ | ||
| 2209 | netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args) | ||
| 2210 | #define netif_notice(priv, type, dev, fmt, args...) \ | ||
| 2211 | netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args) | ||
| 2212 | #define netif_info(priv, type, dev, fmt, args...) \ | ||
| 2213 | netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args) | ||
| 2214 | |||
| 2215 | #if defined(DEBUG) | ||
| 2216 | #define netif_dbg(priv, type, dev, format, args...) \ | ||
| 2217 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) | ||
| 2218 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 2219 | #define netif_dbg(priv, type, netdev, format, args...) \ | ||
| 2220 | do { \ | ||
| 2221 | if (netif_msg_##type(priv)) \ | ||
| 2222 | dynamic_dev_dbg((netdev)->dev.parent, \ | ||
| 2223 | "%s: " format, \ | ||
| 2224 | netdev_name(netdev), ##args); \ | ||
| 2225 | } while (0) | ||
| 2226 | #else | ||
| 2227 | #define netif_dbg(priv, type, dev, format, args...) \ | ||
| 2228 | ({ \ | ||
| 2229 | if (0) \ | ||
| 2230 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ | ||
| 2231 | 0; \ | ||
| 2232 | }) | ||
| 2233 | #endif | ||
| 2234 | |||
| 2235 | #if defined(VERBOSE_DEBUG) | ||
| 2236 | #define netif_vdbg netdev_dbg | ||
| 2237 | #else | ||
| 2238 | #define netif_vdbg(priv, type, dev, format, args...) \ | ||
| 2239 | ({ \ | ||
| 2240 | if (0) \ | ||
| 2241 | netif_printk(KERN_DEBUG, dev, format, ##args); \ | ||
| 2242 | 0; \ | ||
| 2243 | }) | ||
| 2244 | #endif | ||
| 2245 | |||
| 2016 | #endif /* __KERNEL__ */ | 2246 | #endif /* __KERNEL__ */ |
| 2017 | 2247 | ||
| 2018 | #endif /* _LINUX_NETDEVICE_H */ | 2248 | #endif /* _LINUX_NETDEVICE_H */ |
