diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
| commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
| tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/netdevice.h | |
| parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) | |
Patched in Tegra support.
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 704 |
1 files changed, 298 insertions, 406 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9ef07d0868b..ddee79bb8f1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -25,19 +25,24 @@ | |||
| 25 | #ifndef _LINUX_NETDEVICE_H | 25 | #ifndef _LINUX_NETDEVICE_H |
| 26 | #define _LINUX_NETDEVICE_H | 26 | #define _LINUX_NETDEVICE_H |
| 27 | 27 | ||
| 28 | #include <linux/pm_qos.h> | 28 | #include <linux/if.h> |
| 29 | #include <linux/if_ether.h> | ||
| 30 | #include <linux/if_packet.h> | ||
| 31 | #include <linux/if_link.h> | ||
| 32 | |||
| 33 | #ifdef __KERNEL__ | ||
| 34 | #include <linux/pm_qos_params.h> | ||
| 29 | #include <linux/timer.h> | 35 | #include <linux/timer.h> |
| 30 | #include <linux/bug.h> | ||
| 31 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
| 32 | #include <linux/atomic.h> | 37 | #include <linux/atomic.h> |
| 33 | #include <asm/cache.h> | 38 | #include <asm/cache.h> |
| 34 | #include <asm/byteorder.h> | 39 | #include <asm/byteorder.h> |
| 35 | 40 | ||
| 41 | #include <linux/device.h> | ||
| 36 | #include <linux/percpu.h> | 42 | #include <linux/percpu.h> |
| 37 | #include <linux/rculist.h> | 43 | #include <linux/rculist.h> |
| 38 | #include <linux/dmaengine.h> | 44 | #include <linux/dmaengine.h> |
| 39 | #include <linux/workqueue.h> | 45 | #include <linux/workqueue.h> |
| 40 | #include <linux/dynamic_queue_limits.h> | ||
| 41 | 46 | ||
| 42 | #include <linux/ethtool.h> | 47 | #include <linux/ethtool.h> |
| 43 | #include <net/net_namespace.h> | 48 | #include <net/net_namespace.h> |
| @@ -45,14 +50,9 @@ | |||
| 45 | #ifdef CONFIG_DCB | 50 | #ifdef CONFIG_DCB |
| 46 | #include <net/dcbnl.h> | 51 | #include <net/dcbnl.h> |
| 47 | #endif | 52 | #endif |
| 48 | #include <net/netprio_cgroup.h> | ||
| 49 | |||
| 50 | #include <linux/netdev_features.h> | ||
| 51 | #include <linux/neighbour.h> | ||
| 52 | #include <uapi/linux/netdevice.h> | ||
| 53 | 53 | ||
| 54 | struct vlan_group; | ||
| 54 | struct netpoll_info; | 55 | struct netpoll_info; |
| 55 | struct device; | ||
| 56 | struct phy_device; | 56 | struct phy_device; |
| 57 | /* 802.11 specific */ | 57 | /* 802.11 specific */ |
| 58 | struct wireless_dev; | 58 | struct wireless_dev; |
| @@ -60,9 +60,6 @@ struct wireless_dev; | |||
| 60 | #define SET_ETHTOOL_OPS(netdev,ops) \ | 60 | #define SET_ETHTOOL_OPS(netdev,ops) \ |
| 61 | ( (netdev)->ethtool_ops = (ops) ) | 61 | ( (netdev)->ethtool_ops = (ops) ) |
| 62 | 62 | ||
| 63 | extern void netdev_set_default_ethtool_ops(struct net_device *dev, | ||
| 64 | const struct ethtool_ops *ops); | ||
| 65 | |||
| 66 | /* hardware address assignment types */ | 63 | /* hardware address assignment types */ |
| 67 | #define NET_ADDR_PERM 0 /* address is permanent (default) */ | 64 | #define NET_ADDR_PERM 0 /* address is permanent (default) */ |
| 68 | #define NET_ADDR_RANDOM 1 /* address is generated randomly */ | 65 | #define NET_ADDR_RANDOM 1 /* address is generated randomly */ |
| @@ -131,25 +128,35 @@ static inline bool dev_xmit_complete(int rc) | |||
| 131 | return false; | 128 | return false; |
| 132 | } | 129 | } |
| 133 | 130 | ||
| 131 | #endif | ||
| 132 | |||
| 133 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ | ||
| 134 | |||
| 135 | /* Initial net device group. All devices belong to group 0 by default. */ | ||
| 136 | #define INIT_NETDEV_GROUP 0 | ||
| 137 | |||
| 138 | #ifdef __KERNEL__ | ||
| 134 | /* | 139 | /* |
| 135 | * Compute the worst case header length according to the protocols | 140 | * Compute the worst case header length according to the protocols |
| 136 | * used. | 141 | * used. |
| 137 | */ | 142 | */ |
| 138 | 143 | ||
| 139 | #if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) | 144 | #if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) |
| 140 | # if defined(CONFIG_MAC80211_MESH) | 145 | # if defined(CONFIG_MAC80211_MESH) |
| 141 | # define LL_MAX_HEADER 128 | 146 | # define LL_MAX_HEADER 128 |
| 142 | # else | 147 | # else |
| 143 | # define LL_MAX_HEADER 96 | 148 | # define LL_MAX_HEADER 96 |
| 144 | # endif | 149 | # endif |
| 145 | #elif IS_ENABLED(CONFIG_TR) | 150 | #elif defined(CONFIG_TR) || defined(CONFIG_TR_MODULE) |
| 146 | # define LL_MAX_HEADER 48 | 151 | # define LL_MAX_HEADER 48 |
| 147 | #else | 152 | #else |
| 148 | # define LL_MAX_HEADER 32 | 153 | # define LL_MAX_HEADER 32 |
| 149 | #endif | 154 | #endif |
| 150 | 155 | ||
| 151 | #if !IS_ENABLED(CONFIG_NET_IPIP) && !IS_ENABLED(CONFIG_NET_IPGRE) && \ | 156 | #if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \ |
| 152 | !IS_ENABLED(CONFIG_IPV6_SIT) && !IS_ENABLED(CONFIG_IPV6_TUNNEL) | 157 | !defined(CONFIG_NET_IPGRE) && !defined(CONFIG_NET_IPGRE_MODULE) && \ |
| 158 | !defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \ | ||
| 159 | !defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE) | ||
| 153 | #define MAX_HEADER LL_MAX_HEADER | 160 | #define MAX_HEADER LL_MAX_HEADER |
| 154 | #else | 161 | #else |
| 155 | #define MAX_HEADER (LL_MAX_HEADER + 48) | 162 | #define MAX_HEADER (LL_MAX_HEADER + 48) |
| @@ -186,15 +193,25 @@ struct net_device_stats { | |||
| 186 | unsigned long tx_compressed; | 193 | unsigned long tx_compressed; |
| 187 | }; | 194 | }; |
| 188 | 195 | ||
| 196 | #endif /* __KERNEL__ */ | ||
| 197 | |||
| 198 | |||
| 199 | /* Media selection options. */ | ||
| 200 | enum { | ||
| 201 | IF_PORT_UNKNOWN = 0, | ||
| 202 | IF_PORT_10BASE2, | ||
| 203 | IF_PORT_10BASET, | ||
| 204 | IF_PORT_AUI, | ||
| 205 | IF_PORT_100BASET, | ||
| 206 | IF_PORT_100BASETX, | ||
| 207 | IF_PORT_100BASEFX | ||
| 208 | }; | ||
| 209 | |||
| 210 | #ifdef __KERNEL__ | ||
| 189 | 211 | ||
| 190 | #include <linux/cache.h> | 212 | #include <linux/cache.h> |
| 191 | #include <linux/skbuff.h> | 213 | #include <linux/skbuff.h> |
| 192 | 214 | ||
| 193 | #ifdef CONFIG_RPS | ||
| 194 | #include <linux/static_key.h> | ||
| 195 | extern struct static_key rps_needed; | ||
| 196 | #endif | ||
| 197 | |||
| 198 | struct neighbour; | 215 | struct neighbour; |
| 199 | struct neigh_parms; | 216 | struct neigh_parms; |
| 200 | struct sk_buff; | 217 | struct sk_buff; |
| @@ -255,16 +272,21 @@ struct hh_cache { | |||
| 255 | * | 272 | * |
| 256 | * We could use other alignment values, but we must maintain the | 273 | * We could use other alignment values, but we must maintain the |
| 257 | * relationship HH alignment <= LL alignment. | 274 | * relationship HH alignment <= LL alignment. |
| 275 | * | ||
| 276 | * LL_ALLOCATED_SPACE also takes into account the tailroom the device | ||
| 277 | * may need. | ||
| 258 | */ | 278 | */ |
| 259 | #define LL_RESERVED_SPACE(dev) \ | 279 | #define LL_RESERVED_SPACE(dev) \ |
| 260 | ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) | 280 | ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) |
| 261 | #define LL_RESERVED_SPACE_EXTRA(dev,extra) \ | 281 | #define LL_RESERVED_SPACE_EXTRA(dev,extra) \ |
| 262 | ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) | 282 | ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) |
| 283 | #define LL_ALLOCATED_SPACE(dev) \ | ||
| 284 | ((((dev)->hard_header_len+(dev)->needed_headroom+(dev)->needed_tailroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) | ||
| 263 | 285 | ||
| 264 | struct header_ops { | 286 | struct header_ops { |
| 265 | int (*create) (struct sk_buff *skb, struct net_device *dev, | 287 | int (*create) (struct sk_buff *skb, struct net_device *dev, |
| 266 | unsigned short type, const void *daddr, | 288 | unsigned short type, const void *daddr, |
| 267 | const void *saddr, unsigned int len); | 289 | const void *saddr, unsigned len); |
| 268 | int (*parse)(const struct sk_buff *skb, unsigned char *haddr); | 290 | int (*parse)(const struct sk_buff *skb, unsigned char *haddr); |
| 269 | int (*rebuild)(struct sk_buff *skb); | 291 | int (*rebuild)(struct sk_buff *skb); |
| 270 | int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); | 292 | int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); |
| @@ -313,16 +335,18 @@ struct napi_struct { | |||
| 313 | 335 | ||
| 314 | unsigned long state; | 336 | unsigned long state; |
| 315 | int weight; | 337 | int weight; |
| 316 | unsigned int gro_count; | ||
| 317 | int (*poll)(struct napi_struct *, int); | 338 | int (*poll)(struct napi_struct *, int); |
| 318 | #ifdef CONFIG_NETPOLL | 339 | #ifdef CONFIG_NETPOLL |
| 319 | spinlock_t poll_lock; | 340 | spinlock_t poll_lock; |
| 320 | int poll_owner; | 341 | int poll_owner; |
| 321 | #endif | 342 | #endif |
| 343 | |||
| 344 | unsigned int gro_count; | ||
| 345 | |||
| 322 | struct net_device *dev; | 346 | struct net_device *dev; |
| 347 | struct list_head dev_list; | ||
| 323 | struct sk_buff *gro_list; | 348 | struct sk_buff *gro_list; |
| 324 | struct sk_buff *skb; | 349 | struct sk_buff *skb; |
| 325 | struct list_head dev_list; | ||
| 326 | }; | 350 | }; |
| 327 | 351 | ||
| 328 | enum { | 352 | enum { |
| @@ -372,7 +396,7 @@ typedef enum gro_result gro_result_t; | |||
| 372 | * | 396 | * |
| 373 | * If the rx_handler consider the skb should be ignored, it should return | 397 | * If the rx_handler consider the skb should be ignored, it should return |
| 374 | * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that | 398 | * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that |
| 375 | * are registered on exact device (ptype->dev == skb->dev). | 399 | * are registred on exact device (ptype->dev == skb->dev). |
| 376 | * | 400 | * |
| 377 | * If the rx_handler didn't changed skb->dev, but want the skb to be normally | 401 | * If the rx_handler didn't changed skb->dev, but want the skb to be normally |
| 378 | * delivered, it should return RX_HANDLER_PASS. | 402 | * delivered, it should return RX_HANDLER_PASS. |
| @@ -392,7 +416,7 @@ typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); | |||
| 392 | 416 | ||
| 393 | extern void __napi_schedule(struct napi_struct *n); | 417 | extern void __napi_schedule(struct napi_struct *n); |
| 394 | 418 | ||
| 395 | static inline bool napi_disable_pending(struct napi_struct *n) | 419 | static inline int napi_disable_pending(struct napi_struct *n) |
| 396 | { | 420 | { |
| 397 | return test_bit(NAPI_STATE_DISABLE, &n->state); | 421 | return test_bit(NAPI_STATE_DISABLE, &n->state); |
| 398 | } | 422 | } |
| @@ -406,7 +430,7 @@ static inline bool napi_disable_pending(struct napi_struct *n) | |||
| 406 | * insure only one NAPI poll instance runs. We also make | 430 | * insure only one NAPI poll instance runs. We also make |
| 407 | * sure there is no pending NAPI disable. | 431 | * sure there is no pending NAPI disable. |
| 408 | */ | 432 | */ |
| 409 | static inline bool napi_schedule_prep(struct napi_struct *n) | 433 | static inline int napi_schedule_prep(struct napi_struct *n) |
| 410 | { | 434 | { |
| 411 | return !napi_disable_pending(n) && | 435 | return !napi_disable_pending(n) && |
| 412 | !test_and_set_bit(NAPI_STATE_SCHED, &n->state); | 436 | !test_and_set_bit(NAPI_STATE_SCHED, &n->state); |
| @@ -426,13 +450,13 @@ static inline void napi_schedule(struct napi_struct *n) | |||
| 426 | } | 450 | } |
| 427 | 451 | ||
| 428 | /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ | 452 | /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ |
| 429 | static inline bool napi_reschedule(struct napi_struct *napi) | 453 | static inline int napi_reschedule(struct napi_struct *napi) |
| 430 | { | 454 | { |
| 431 | if (napi_schedule_prep(napi)) { | 455 | if (napi_schedule_prep(napi)) { |
| 432 | __napi_schedule(napi); | 456 | __napi_schedule(napi); |
| 433 | return true; | 457 | return 1; |
| 434 | } | 458 | } |
| 435 | return false; | 459 | return 0; |
| 436 | } | 460 | } |
| 437 | 461 | ||
| 438 | /** | 462 | /** |
| @@ -492,23 +516,11 @@ static inline void napi_synchronize(const struct napi_struct *n) | |||
| 492 | #endif | 516 | #endif |
| 493 | 517 | ||
| 494 | enum netdev_queue_state_t { | 518 | enum netdev_queue_state_t { |
| 495 | __QUEUE_STATE_DRV_XOFF, | 519 | __QUEUE_STATE_XOFF, |
| 496 | __QUEUE_STATE_STACK_XOFF, | ||
| 497 | __QUEUE_STATE_FROZEN, | 520 | __QUEUE_STATE_FROZEN, |
| 498 | #define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \ | 521 | #define QUEUE_STATE_XOFF_OR_FROZEN ((1 << __QUEUE_STATE_XOFF) | \ |
| 499 | (1 << __QUEUE_STATE_STACK_XOFF)) | 522 | (1 << __QUEUE_STATE_FROZEN)) |
| 500 | #define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \ | ||
| 501 | (1 << __QUEUE_STATE_FROZEN)) | ||
| 502 | }; | 523 | }; |
| 503 | /* | ||
| 504 | * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The | ||
| 505 | * netif_tx_* functions below are used to manipulate this flag. The | ||
| 506 | * __QUEUE_STATE_STACK_XOFF flag is used by the stack to stop the transmit | ||
| 507 | * queue independently. The netif_xmit_*stopped functions below are called | ||
| 508 | * to check if the queue has been stopped by the driver or stack (either | ||
| 509 | * of the XOFF bits are set in the state). Drivers should not need to call | ||
| 510 | * netif_xmit*stopped functions, they should only be using netif_tx_*. | ||
| 511 | */ | ||
| 512 | 524 | ||
| 513 | struct netdev_queue { | 525 | struct netdev_queue { |
| 514 | /* | 526 | /* |
| @@ -516,8 +528,9 @@ struct netdev_queue { | |||
| 516 | */ | 528 | */ |
| 517 | struct net_device *dev; | 529 | struct net_device *dev; |
| 518 | struct Qdisc *qdisc; | 530 | struct Qdisc *qdisc; |
| 531 | unsigned long state; | ||
| 519 | struct Qdisc *qdisc_sleeping; | 532 | struct Qdisc *qdisc_sleeping; |
| 520 | #ifdef CONFIG_SYSFS | 533 | #if defined(CONFIG_RPS) || defined(CONFIG_XPS) |
| 521 | struct kobject kobj; | 534 | struct kobject kobj; |
| 522 | #endif | 535 | #endif |
| 523 | #if defined(CONFIG_XPS) && defined(CONFIG_NUMA) | 536 | #if defined(CONFIG_XPS) && defined(CONFIG_NUMA) |
| @@ -532,18 +545,6 @@ struct netdev_queue { | |||
| 532 | * please use this field instead of dev->trans_start | 545 | * please use this field instead of dev->trans_start |
| 533 | */ | 546 | */ |
| 534 | unsigned long trans_start; | 547 | unsigned long trans_start; |
| 535 | |||
| 536 | /* | ||
| 537 | * Number of TX timeouts for this queue | ||
| 538 | * (/sys/class/net/DEV/Q/trans_timeout) | ||
| 539 | */ | ||
| 540 | unsigned long trans_timeout; | ||
| 541 | |||
| 542 | unsigned long state; | ||
| 543 | |||
| 544 | #ifdef CONFIG_BQL | ||
| 545 | struct dql dql; | ||
| 546 | #endif | ||
| 547 | } ____cacheline_aligned_in_smp; | 548 | } ____cacheline_aligned_in_smp; |
| 548 | 549 | ||
| 549 | static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) | 550 | static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) |
| @@ -572,7 +573,7 @@ struct rps_map { | |||
| 572 | struct rcu_head rcu; | 573 | struct rcu_head rcu; |
| 573 | u16 cpus[0]; | 574 | u16 cpus[0]; |
| 574 | }; | 575 | }; |
| 575 | #define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16))) | 576 | #define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) |
| 576 | 577 | ||
| 577 | /* | 578 | /* |
| 578 | * The rps_dev_flow structure contains the mapping of a flow to a CPU, the | 579 | * The rps_dev_flow structure contains the mapping of a flow to a CPU, the |
| @@ -596,7 +597,7 @@ struct rps_dev_flow_table { | |||
| 596 | struct rps_dev_flow flows[0]; | 597 | struct rps_dev_flow flows[0]; |
| 597 | }; | 598 | }; |
| 598 | #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ | 599 | #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ |
| 599 | ((_num) * sizeof(struct rps_dev_flow))) | 600 | (_num * sizeof(struct rps_dev_flow))) |
| 600 | 601 | ||
| 601 | /* | 602 | /* |
| 602 | * The rps_sock_flow_table contains mappings of flows to the last CPU | 603 | * The rps_sock_flow_table contains mappings of flows to the last CPU |
| @@ -607,7 +608,7 @@ struct rps_sock_flow_table { | |||
| 607 | u16 ents[0]; | 608 | u16 ents[0]; |
| 608 | }; | 609 | }; |
| 609 | #define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \ | 610 | #define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \ |
| 610 | ((_num) * sizeof(u16))) | 611 | (_num * sizeof(u16))) |
| 611 | 612 | ||
| 612 | #define RPS_NO_CPU 0xffff | 613 | #define RPS_NO_CPU 0xffff |
| 613 | 614 | ||
| @@ -659,7 +660,7 @@ struct xps_map { | |||
| 659 | struct rcu_head rcu; | 660 | struct rcu_head rcu; |
| 660 | u16 queues[0]; | 661 | u16 queues[0]; |
| 661 | }; | 662 | }; |
| 662 | #define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16))) | 663 | #define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16))) |
| 663 | #define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \ | 664 | #define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \ |
| 664 | / sizeof(u16)) | 665 | / sizeof(u16)) |
| 665 | 666 | ||
| @@ -682,23 +683,6 @@ struct netdev_tc_txq { | |||
| 682 | u16 offset; | 683 | u16 offset; |
| 683 | }; | 684 | }; |
| 684 | 685 | ||
| 685 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | ||
| 686 | /* | ||
| 687 | * This structure is to hold information about the device | ||
| 688 | * configured to run FCoE protocol stack. | ||
| 689 | */ | ||
| 690 | struct netdev_fcoe_hbainfo { | ||
| 691 | char manufacturer[64]; | ||
| 692 | char serial_number[64]; | ||
| 693 | char hardware_version[64]; | ||
| 694 | char driver_version[64]; | ||
| 695 | char optionrom_version[64]; | ||
| 696 | char firmware_version[64]; | ||
| 697 | char model[256]; | ||
| 698 | char model_description[256]; | ||
| 699 | }; | ||
| 700 | #endif | ||
| 701 | |||
| 702 | /* | 686 | /* |
| 703 | * This structure defines the management hooks for network devices. | 687 | * This structure defines the management hooks for network devices. |
| 704 | * The following hooks can be defined; unless noted otherwise, they are | 688 | * The following hooks can be defined; unless noted otherwise, they are |
| @@ -739,8 +723,9 @@ struct netdev_fcoe_hbainfo { | |||
| 739 | * | 723 | * |
| 740 | * void (*ndo_set_rx_mode)(struct net_device *dev); | 724 | * void (*ndo_set_rx_mode)(struct net_device *dev); |
| 741 | * This function is called device changes address list filtering. | 725 | * This function is called device changes address list filtering. |
| 742 | * If driver handles unicast address filtering, it should set | 726 | * |
| 743 | * IFF_UNICAST_FLT to its priv_flags. | 727 | * void (*ndo_set_multicast_list)(struct net_device *dev); |
| 728 | * This function is called when the multicast address list changes. | ||
| 744 | * | 729 | * |
| 745 | * int (*ndo_set_mac_address)(struct net_device *dev, void *addr); | 730 | * int (*ndo_set_mac_address)(struct net_device *dev, void *addr); |
| 746 | * This function is called when the Media Access Control address | 731 | * This function is called when the Media Access Control address |
| @@ -783,11 +768,11 @@ struct netdev_fcoe_hbainfo { | |||
| 783 | * 3. Update dev->stats asynchronously and atomically, and define | 768 | * 3. Update dev->stats asynchronously and atomically, and define |
| 784 | * neither operation. | 769 | * neither operation. |
| 785 | * | 770 | * |
| 786 | * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); | 771 | * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); |
| 787 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) | 772 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) |
| 788 | * this function is called when a VLAN id is registered. | 773 | * this function is called when a VLAN id is registered. |
| 789 | * | 774 | * |
| 790 | * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); | 775 | * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); |
| 791 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) | 776 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) |
| 792 | * this function is called when a VLAN id is unregistered. | 777 | * this function is called when a VLAN id is unregistered. |
| 793 | * | 778 | * |
| @@ -797,7 +782,6 @@ struct netdev_fcoe_hbainfo { | |||
| 797 | * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); | 782 | * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); |
| 798 | * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); | 783 | * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); |
| 799 | * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); | 784 | * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); |
| 800 | * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); | ||
| 801 | * int (*ndo_get_vf_config)(struct net_device *dev, | 785 | * int (*ndo_get_vf_config)(struct net_device *dev, |
| 802 | * int vf, struct ifla_vf_info *ivf); | 786 | * int vf, struct ifla_vf_info *ivf); |
| 803 | * int (*ndo_set_vf_port)(struct net_device *dev, int vf, | 787 | * int (*ndo_set_vf_port)(struct net_device *dev, int vf, |
| @@ -839,13 +823,6 @@ struct netdev_fcoe_hbainfo { | |||
| 839 | * perform necessary setup and returns 1 to indicate the device is set up | 823 | * perform necessary setup and returns 1 to indicate the device is set up |
| 840 | * successfully to perform DDP on this I/O, otherwise this returns 0. | 824 | * successfully to perform DDP on this I/O, otherwise this returns 0. |
| 841 | * | 825 | * |
| 842 | * int (*ndo_fcoe_get_hbainfo)(struct net_device *dev, | ||
| 843 | * struct netdev_fcoe_hbainfo *hbainfo); | ||
| 844 | * Called when the FCoE Protocol stack wants information on the underlying | ||
| 845 | * device. This information is utilized by the FCoE protocol stack to | ||
| 846 | * register attributes with Fiber Channel management service as per the | ||
| 847 | * FC-GS Fabric Device Management Information(FDMI) specification. | ||
| 848 | * | ||
| 849 | * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type); | 826 | * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type); |
| 850 | * Called when the underlying device wants to override default World Wide | 827 | * Called when the underlying device wants to override default World Wide |
| 851 | * Name (WWN) generation mechanism in FCoE protocol stack to pass its own | 828 | * Name (WWN) generation mechanism in FCoE protocol stack to pass its own |
| @@ -868,32 +845,16 @@ struct netdev_fcoe_hbainfo { | |||
| 868 | * Called to release previously enslaved netdev. | 845 | * Called to release previously enslaved netdev. |
| 869 | * | 846 | * |
| 870 | * Feature/offload setting functions. | 847 | * Feature/offload setting functions. |
| 871 | * netdev_features_t (*ndo_fix_features)(struct net_device *dev, | 848 | * u32 (*ndo_fix_features)(struct net_device *dev, u32 features); |
| 872 | * netdev_features_t features); | ||
| 873 | * Adjusts the requested feature flags according to device-specific | 849 | * Adjusts the requested feature flags according to device-specific |
| 874 | * constraints, and returns the resulting flags. Must not modify | 850 | * constraints, and returns the resulting flags. Must not modify |
| 875 | * the device state. | 851 | * the device state. |
| 876 | * | 852 | * |
| 877 | * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); | 853 | * int (*ndo_set_features)(struct net_device *dev, u32 features); |
| 878 | * Called to update device configuration to new features. Passed | 854 | * Called to update device configuration to new features. Passed |
| 879 | * feature set might be less than what was returned by ndo_fix_features()). | 855 | * feature set might be less than what was returned by ndo_fix_features()). |
| 880 | * Must return >0 or -errno if it changed dev->features itself. | 856 | * Must return >0 or -errno if it changed dev->features itself. |
| 881 | * | 857 | * |
| 882 | * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[], | ||
| 883 | * struct net_device *dev, | ||
| 884 | * const unsigned char *addr, u16 flags) | ||
| 885 | * Adds an FDB entry to dev for addr. | ||
| 886 | * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, | ||
| 887 | * const unsigned char *addr) | ||
| 888 | * Deletes the FDB entry from dev coresponding to addr. | ||
| 889 | * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, | ||
| 890 | * struct net_device *dev, int idx) | ||
| 891 | * Used to add FDB entries to dump requests. Implementers should add | ||
| 892 | * entries to skb and update idx with the number of entries. | ||
| 893 | * | ||
| 894 | * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) | ||
| 895 | * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, | ||
| 896 | * struct net_device *dev) | ||
| 897 | */ | 858 | */ |
| 898 | struct net_device_ops { | 859 | struct net_device_ops { |
| 899 | int (*ndo_init)(struct net_device *dev); | 860 | int (*ndo_init)(struct net_device *dev); |
| @@ -907,6 +868,7 @@ struct net_device_ops { | |||
| 907 | void (*ndo_change_rx_flags)(struct net_device *dev, | 868 | void (*ndo_change_rx_flags)(struct net_device *dev, |
| 908 | int flags); | 869 | int flags); |
| 909 | void (*ndo_set_rx_mode)(struct net_device *dev); | 870 | void (*ndo_set_rx_mode)(struct net_device *dev); |
| 871 | void (*ndo_set_multicast_list)(struct net_device *dev); | ||
| 910 | int (*ndo_set_mac_address)(struct net_device *dev, | 872 | int (*ndo_set_mac_address)(struct net_device *dev, |
| 911 | void *addr); | 873 | void *addr); |
| 912 | int (*ndo_validate_addr)(struct net_device *dev); | 874 | int (*ndo_validate_addr)(struct net_device *dev); |
| @@ -924,15 +886,14 @@ struct net_device_ops { | |||
| 924 | struct rtnl_link_stats64 *storage); | 886 | struct rtnl_link_stats64 *storage); |
| 925 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 887 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
| 926 | 888 | ||
| 927 | int (*ndo_vlan_rx_add_vid)(struct net_device *dev, | 889 | void (*ndo_vlan_rx_add_vid)(struct net_device *dev, |
| 928 | unsigned short vid); | 890 | unsigned short vid); |
| 929 | int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, | 891 | void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, |
| 930 | unsigned short vid); | 892 | unsigned short vid); |
| 931 | #ifdef CONFIG_NET_POLL_CONTROLLER | 893 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 932 | void (*ndo_poll_controller)(struct net_device *dev); | 894 | void (*ndo_poll_controller)(struct net_device *dev); |
| 933 | int (*ndo_netpoll_setup)(struct net_device *dev, | 895 | int (*ndo_netpoll_setup)(struct net_device *dev, |
| 934 | struct netpoll_info *info, | 896 | struct netpoll_info *info); |
| 935 | gfp_t gfp); | ||
| 936 | void (*ndo_netpoll_cleanup)(struct net_device *dev); | 897 | void (*ndo_netpoll_cleanup)(struct net_device *dev); |
| 937 | #endif | 898 | #endif |
| 938 | int (*ndo_set_vf_mac)(struct net_device *dev, | 899 | int (*ndo_set_vf_mac)(struct net_device *dev, |
| @@ -941,8 +902,6 @@ struct net_device_ops { | |||
| 941 | int queue, u16 vlan, u8 qos); | 902 | int queue, u16 vlan, u8 qos); |
| 942 | int (*ndo_set_vf_tx_rate)(struct net_device *dev, | 903 | int (*ndo_set_vf_tx_rate)(struct net_device *dev, |
| 943 | int vf, int rate); | 904 | int vf, int rate); |
| 944 | int (*ndo_set_vf_spoofchk)(struct net_device *dev, | ||
| 945 | int vf, bool setting); | ||
| 946 | int (*ndo_get_vf_config)(struct net_device *dev, | 905 | int (*ndo_get_vf_config)(struct net_device *dev, |
| 947 | int vf, | 906 | int vf, |
| 948 | struct ifla_vf_info *ivf); | 907 | struct ifla_vf_info *ivf); |
| @@ -952,7 +911,7 @@ struct net_device_ops { | |||
| 952 | int (*ndo_get_vf_port)(struct net_device *dev, | 911 | int (*ndo_get_vf_port)(struct net_device *dev, |
| 953 | int vf, struct sk_buff *skb); | 912 | int vf, struct sk_buff *skb); |
| 954 | int (*ndo_setup_tc)(struct net_device *dev, u8 tc); | 913 | int (*ndo_setup_tc)(struct net_device *dev, u8 tc); |
| 955 | #if IS_ENABLED(CONFIG_FCOE) | 914 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
| 956 | int (*ndo_fcoe_enable)(struct net_device *dev); | 915 | int (*ndo_fcoe_enable)(struct net_device *dev); |
| 957 | int (*ndo_fcoe_disable)(struct net_device *dev); | 916 | int (*ndo_fcoe_disable)(struct net_device *dev); |
| 958 | int (*ndo_fcoe_ddp_setup)(struct net_device *dev, | 917 | int (*ndo_fcoe_ddp_setup)(struct net_device *dev, |
| @@ -965,17 +924,11 @@ struct net_device_ops { | |||
| 965 | u16 xid, | 924 | u16 xid, |
| 966 | struct scatterlist *sgl, | 925 | struct scatterlist *sgl, |
| 967 | unsigned int sgc); | 926 | unsigned int sgc); |
| 968 | int (*ndo_fcoe_get_hbainfo)(struct net_device *dev, | ||
| 969 | struct netdev_fcoe_hbainfo *hbainfo); | ||
| 970 | #endif | ||
| 971 | |||
| 972 | #if IS_ENABLED(CONFIG_LIBFCOE) | ||
| 973 | #define NETDEV_FCOE_WWNN 0 | 927 | #define NETDEV_FCOE_WWNN 0 |
| 974 | #define NETDEV_FCOE_WWPN 1 | 928 | #define NETDEV_FCOE_WWPN 1 |
| 975 | int (*ndo_fcoe_get_wwn)(struct net_device *dev, | 929 | int (*ndo_fcoe_get_wwn)(struct net_device *dev, |
| 976 | u64 *wwn, int type); | 930 | u64 *wwn, int type); |
| 977 | #endif | 931 | #endif |
| 978 | |||
| 979 | #ifdef CONFIG_RFS_ACCEL | 932 | #ifdef CONFIG_RFS_ACCEL |
| 980 | int (*ndo_rx_flow_steer)(struct net_device *dev, | 933 | int (*ndo_rx_flow_steer)(struct net_device *dev, |
| 981 | const struct sk_buff *skb, | 934 | const struct sk_buff *skb, |
| @@ -986,31 +939,10 @@ struct net_device_ops { | |||
| 986 | struct net_device *slave_dev); | 939 | struct net_device *slave_dev); |
| 987 | int (*ndo_del_slave)(struct net_device *dev, | 940 | int (*ndo_del_slave)(struct net_device *dev, |
| 988 | struct net_device *slave_dev); | 941 | struct net_device *slave_dev); |
| 989 | netdev_features_t (*ndo_fix_features)(struct net_device *dev, | 942 | u32 (*ndo_fix_features)(struct net_device *dev, |
| 990 | netdev_features_t features); | 943 | u32 features); |
| 991 | int (*ndo_set_features)(struct net_device *dev, | 944 | int (*ndo_set_features)(struct net_device *dev, |
| 992 | netdev_features_t features); | 945 | u32 features); |
| 993 | int (*ndo_neigh_construct)(struct neighbour *n); | ||
| 994 | void (*ndo_neigh_destroy)(struct neighbour *n); | ||
| 995 | |||
| 996 | int (*ndo_fdb_add)(struct ndmsg *ndm, | ||
| 997 | struct nlattr *tb[], | ||
| 998 | struct net_device *dev, | ||
| 999 | const unsigned char *addr, | ||
| 1000 | u16 flags); | ||
| 1001 | int (*ndo_fdb_del)(struct ndmsg *ndm, | ||
| 1002 | struct net_device *dev, | ||
| 1003 | const unsigned char *addr); | ||
| 1004 | int (*ndo_fdb_dump)(struct sk_buff *skb, | ||
| 1005 | struct netlink_callback *cb, | ||
| 1006 | struct net_device *dev, | ||
| 1007 | int idx); | ||
| 1008 | |||
| 1009 | int (*ndo_bridge_setlink)(struct net_device *dev, | ||
| 1010 | struct nlmsghdr *nlh); | ||
| 1011 | int (*ndo_bridge_getlink)(struct sk_buff *skb, | ||
| 1012 | u32 pid, u32 seq, | ||
| 1013 | struct net_device *dev); | ||
| 1014 | }; | 946 | }; |
| 1015 | 947 | ||
| 1016 | /* | 948 | /* |
| @@ -1032,9 +964,10 @@ struct net_device { | |||
| 1032 | */ | 964 | */ |
| 1033 | char name[IFNAMSIZ]; | 965 | char name[IFNAMSIZ]; |
| 1034 | 966 | ||
| 1035 | /* device name hash chain, please keep it close to name[] */ | 967 | struct pm_qos_request_list pm_qos_req; |
| 1036 | struct hlist_node name_hlist; | ||
| 1037 | 968 | ||
| 969 | /* device name hash chain */ | ||
| 970 | struct hlist_node name_hlist; | ||
| 1038 | /* snmp alias */ | 971 | /* snmp alias */ |
| 1039 | char *ifalias; | 972 | char *ifalias; |
| 1040 | 973 | ||
| @@ -1059,19 +992,91 @@ struct net_device { | |||
| 1059 | struct list_head unreg_list; | 992 | struct list_head unreg_list; |
| 1060 | 993 | ||
| 1061 | /* currently active device features */ | 994 | /* currently active device features */ |
| 1062 | netdev_features_t features; | 995 | u32 features; |
| 1063 | /* user-changeable features */ | 996 | /* user-changeable features */ |
| 1064 | netdev_features_t hw_features; | 997 | u32 hw_features; |
| 1065 | /* user-requested features */ | 998 | /* user-requested features */ |
| 1066 | netdev_features_t wanted_features; | 999 | u32 wanted_features; |
| 1067 | /* mask of features inheritable by VLAN devices */ | 1000 | /* mask of features inheritable by VLAN devices */ |
| 1068 | netdev_features_t vlan_features; | 1001 | u32 vlan_features; |
| 1069 | /* mask of features inherited by encapsulating devices | 1002 | |
| 1070 | * This field indicates what encapsulation offloads | 1003 | /* Net device feature bits; if you change something, |
| 1071 | * the hardware is capable of doing, and drivers will | 1004 | * also update netdev_features_strings[] in ethtool.c */ |
| 1072 | * need to set them appropriately. | 1005 | |
| 1006 | #define NETIF_F_SG 1 /* Scatter/gather IO. */ | ||
| 1007 | #define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */ | ||
| 1008 | #define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ | ||
| 1009 | #define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */ | ||
| 1010 | #define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */ | ||
| 1011 | #define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */ | ||
| 1012 | #define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */ | ||
| 1013 | #define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */ | ||
| 1014 | #define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ | ||
| 1015 | #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ | ||
| 1016 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ | ||
| 1017 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ | ||
| 1018 | #define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ | ||
| 1019 | /* do not use LLTX in new drivers */ | ||
| 1020 | #define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ | ||
| 1021 | #define NETIF_F_GRO 16384 /* Generic receive offload */ | ||
| 1022 | #define NETIF_F_LRO 32768 /* large receive offload */ | ||
| 1023 | |||
| 1024 | /* the GSO_MASK reserves bits 16 through 23 */ | ||
| 1025 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ | ||
| 1026 | #define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ | ||
| 1027 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ | ||
| 1028 | #define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ | ||
| 1029 | #define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */ | ||
| 1030 | #define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */ | ||
| 1031 | #define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */ | ||
| 1032 | #define NETIF_F_LOOPBACK (1 << 31) /* Enable loopback */ | ||
| 1033 | |||
| 1034 | /* Segmentation offload features */ | ||
| 1035 | #define NETIF_F_GSO_SHIFT 16 | ||
| 1036 | #define NETIF_F_GSO_MASK 0x00ff0000 | ||
| 1037 | #define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) | ||
| 1038 | #define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT) | ||
| 1039 | #define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT) | ||
| 1040 | #define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) | ||
| 1041 | #define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) | ||
| 1042 | #define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) | ||
| 1043 | |||
| 1044 | /* Features valid for ethtool to change */ | ||
| 1045 | /* = all defined minus driver/device-class-related */ | ||
| 1046 | #define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \ | ||
| 1047 | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL) | ||
| 1048 | #define NETIF_F_ETHTOOL_BITS (0xff3fffff & ~NETIF_F_NEVER_CHANGE) | ||
| 1049 | |||
| 1050 | /* List of features with software fallbacks. */ | ||
| 1051 | #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ | ||
| 1052 | NETIF_F_TSO6 | NETIF_F_UFO) | ||
| 1053 | |||
| 1054 | |||
| 1055 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) | ||
| 1056 | #define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM) | ||
| 1057 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) | ||
| 1058 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) | ||
| 1059 | |||
| 1060 | #define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) | ||
| 1061 | |||
| 1062 | #define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \ | ||
| 1063 | NETIF_F_FSO) | ||
| 1064 | |||
| 1065 | /* | ||
| 1066 | * If one device supports one of these features, then enable them | ||
| 1067 | * for all in netdev_increment_features. | ||
| 1073 | */ | 1068 | */ |
| 1074 | netdev_features_t hw_enc_features; | 1069 | #define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ |
| 1070 | NETIF_F_SG | NETIF_F_HIGHDMA | \ | ||
| 1071 | NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED) | ||
| 1072 | /* | ||
| 1073 | * If one device doesn't support one of these features, then disable it | ||
| 1074 | * for all in netdev_increment_features. | ||
| 1075 | */ | ||
| 1076 | #define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO) | ||
| 1077 | |||
| 1078 | /* changeable features with no special hardware requirements */ | ||
| 1079 | #define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO) | ||
| 1075 | 1080 | ||
| 1076 | /* Interface index. Unique device identifier */ | 1081 | /* Interface index. Unique device identifier */ |
| 1077 | int ifindex; | 1082 | int ifindex; |
| @@ -1097,8 +1102,7 @@ struct net_device { | |||
| 1097 | const struct header_ops *header_ops; | 1102 | const struct header_ops *header_ops; |
| 1098 | 1103 | ||
| 1099 | unsigned int flags; /* interface flags (a la BSD) */ | 1104 | unsigned int flags; /* interface flags (a la BSD) */ |
| 1100 | unsigned int priv_flags; /* Like 'flags' but invisible to userspace. | 1105 | unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */ |
| 1101 | * See if.h for definitions. */ | ||
| 1102 | unsigned short gflags; | 1106 | unsigned short gflags; |
| 1103 | unsigned short padded; /* How much padding added by alloc_netdev() */ | 1107 | unsigned short padded; /* How much padding added by alloc_netdev() */ |
| 1104 | 1108 | ||
| @@ -1123,7 +1127,6 @@ struct net_device { | |||
| 1123 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ | 1127 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ |
| 1124 | unsigned char addr_assign_type; /* hw address assignment type */ | 1128 | unsigned char addr_assign_type; /* hw address assignment type */ |
| 1125 | unsigned char addr_len; /* hardware address length */ | 1129 | unsigned char addr_len; /* hardware address length */ |
| 1126 | unsigned char neigh_priv_len; | ||
| 1127 | unsigned short dev_id; /* for shared network cards */ | 1130 | unsigned short dev_id; /* for shared network cards */ |
| 1128 | 1131 | ||
| 1129 | spinlock_t addr_list_lock; | 1132 | spinlock_t addr_list_lock; |
| @@ -1136,16 +1139,17 @@ struct net_device { | |||
| 1136 | 1139 | ||
| 1137 | /* Protocol specific pointers */ | 1140 | /* Protocol specific pointers */ |
| 1138 | 1141 | ||
| 1139 | #if IS_ENABLED(CONFIG_VLAN_8021Q) | 1142 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
| 1140 | struct vlan_info __rcu *vlan_info; /* VLAN info */ | 1143 | struct vlan_group __rcu *vlgrp; /* VLAN group */ |
| 1141 | #endif | 1144 | #endif |
| 1142 | #if IS_ENABLED(CONFIG_NET_DSA) | 1145 | #ifdef CONFIG_NET_DSA |
| 1143 | struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ | 1146 | void *dsa_ptr; /* dsa specific data */ |
| 1144 | #endif | 1147 | #endif |
| 1145 | void *atalk_ptr; /* AppleTalk link */ | 1148 | void *atalk_ptr; /* AppleTalk link */ |
| 1146 | struct in_device __rcu *ip_ptr; /* IPv4 specific data */ | 1149 | struct in_device __rcu *ip_ptr; /* IPv4 specific data */ |
| 1147 | struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ | 1150 | struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ |
| 1148 | struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ | 1151 | struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ |
| 1152 | void *ec_ptr; /* Econet specific data */ | ||
| 1149 | void *ax25_ptr; /* AX.25 specific data */ | 1153 | void *ax25_ptr; /* AX.25 specific data */ |
| 1150 | struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, | 1154 | struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, |
| 1151 | assign before registering */ | 1155 | assign before registering */ |
| @@ -1175,11 +1179,9 @@ struct net_device { | |||
| 1175 | 1179 | ||
| 1176 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | 1180 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ |
| 1177 | 1181 | ||
| 1178 | #ifdef CONFIG_SYSFS | 1182 | #if defined(CONFIG_RPS) || defined(CONFIG_XPS) |
| 1179 | struct kset *queues_kset; | 1183 | struct kset *queues_kset; |
| 1180 | #endif | ||
| 1181 | 1184 | ||
| 1182 | #ifdef CONFIG_RPS | ||
| 1183 | struct netdev_rx_queue *_rx; | 1185 | struct netdev_rx_queue *_rx; |
| 1184 | 1186 | ||
| 1185 | /* Number of RX queues allocated at register_netdev() time */ | 1187 | /* Number of RX queues allocated at register_netdev() time */ |
| @@ -1292,8 +1294,6 @@ struct net_device { | |||
| 1292 | /* for setting kernel sock attribute on TCP connection setup */ | 1294 | /* for setting kernel sock attribute on TCP connection setup */ |
| 1293 | #define GSO_MAX_SIZE 65536 | 1295 | #define GSO_MAX_SIZE 65536 |
| 1294 | unsigned int gso_max_size; | 1296 | unsigned int gso_max_size; |
| 1295 | #define GSO_MAX_SEGS 65535 | ||
| 1296 | u16 gso_max_segs; | ||
| 1297 | 1297 | ||
| 1298 | #ifdef CONFIG_DCB | 1298 | #ifdef CONFIG_DCB |
| 1299 | /* Data Center Bridging netlink ops */ | 1299 | /* Data Center Bridging netlink ops */ |
| @@ -1303,22 +1303,15 @@ struct net_device { | |||
| 1303 | struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; | 1303 | struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; |
| 1304 | u8 prio_tc_map[TC_BITMASK + 1]; | 1304 | u8 prio_tc_map[TC_BITMASK + 1]; |
| 1305 | 1305 | ||
| 1306 | #if IS_ENABLED(CONFIG_FCOE) | 1306 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
| 1307 | /* max exchange id for FCoE LRO by ddp */ | 1307 | /* max exchange id for FCoE LRO by ddp */ |
| 1308 | unsigned int fcoe_ddp_xid; | 1308 | unsigned int fcoe_ddp_xid; |
| 1309 | #endif | 1309 | #endif |
| 1310 | #if IS_ENABLED(CONFIG_NETPRIO_CGROUP) | ||
| 1311 | struct netprio_map __rcu *priomap; | ||
| 1312 | #endif | ||
| 1313 | /* phy device may attach itself for hardware timestamping */ | 1310 | /* phy device may attach itself for hardware timestamping */ |
| 1314 | struct phy_device *phydev; | 1311 | struct phy_device *phydev; |
| 1315 | 1312 | ||
| 1316 | struct lock_class_key *qdisc_tx_busylock; | ||
| 1317 | |||
| 1318 | /* group the device belongs to */ | 1313 | /* group the device belongs to */ |
| 1319 | int group; | 1314 | int group; |
| 1320 | |||
| 1321 | struct pm_qos_request pm_qos_req; | ||
| 1322 | }; | 1315 | }; |
| 1323 | #define to_net_dev(d) container_of(d, struct net_device, dev) | 1316 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
| 1324 | 1317 | ||
| @@ -1394,9 +1387,6 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, | |||
| 1394 | f(dev, &dev->_tx[i], arg); | 1387 | f(dev, &dev->_tx[i], arg); |
| 1395 | } | 1388 | } |
| 1396 | 1389 | ||
| 1397 | extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, | ||
| 1398 | struct sk_buff *skb); | ||
| 1399 | |||
| 1400 | /* | 1390 | /* |
| 1401 | * Net namespace inlines | 1391 | * Net namespace inlines |
| 1402 | */ | 1392 | */ |
| @@ -1425,6 +1415,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev) | |||
| 1425 | return 0; | 1415 | return 0; |
| 1426 | } | 1416 | } |
| 1427 | 1417 | ||
| 1418 | #ifndef CONFIG_NET_NS | ||
| 1419 | static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev) | ||
| 1420 | { | ||
| 1421 | skb->dev = dev; | ||
| 1422 | } | ||
| 1423 | #else /* CONFIG_NET_NS */ | ||
| 1424 | void skb_set_dev(struct sk_buff *skb, struct net_device *dev); | ||
| 1425 | #endif | ||
| 1426 | |||
| 1428 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) | 1427 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) |
| 1429 | { | 1428 | { |
| 1430 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | 1429 | #ifdef CONFIG_NET_DSA_TAG_TRAILER |
| @@ -1488,28 +1487,17 @@ struct napi_gro_cb { | |||
| 1488 | /* This indicates where we are processing relative to skb->data. */ | 1487 | /* This indicates where we are processing relative to skb->data. */ |
| 1489 | int data_offset; | 1488 | int data_offset; |
| 1490 | 1489 | ||
| 1490 | /* This is non-zero if the packet may be of the same flow. */ | ||
| 1491 | int same_flow; | ||
| 1492 | |||
| 1491 | /* This is non-zero if the packet cannot be merged with the new skb. */ | 1493 | /* This is non-zero if the packet cannot be merged with the new skb. */ |
| 1492 | int flush; | 1494 | int flush; |
| 1493 | 1495 | ||
| 1494 | /* Number of segments aggregated. */ | 1496 | /* Number of segments aggregated. */ |
| 1495 | u16 count; | 1497 | int count; |
| 1496 | |||
| 1497 | /* This is non-zero if the packet may be of the same flow. */ | ||
| 1498 | u8 same_flow; | ||
| 1499 | 1498 | ||
| 1500 | /* Free the skb? */ | 1499 | /* Free the skb? */ |
| 1501 | u8 free; | 1500 | int free; |
| 1502 | #define NAPI_GRO_FREE 1 | ||
| 1503 | #define NAPI_GRO_FREE_STOLEN_HEAD 2 | ||
| 1504 | |||
| 1505 | /* jiffies when first packet was created/queued */ | ||
| 1506 | unsigned long age; | ||
| 1507 | |||
| 1508 | /* Used in ipv6_gro_receive() */ | ||
| 1509 | int proto; | ||
| 1510 | |||
| 1511 | /* used in skb_gro_receive() slow path */ | ||
| 1512 | struct sk_buff *last; | ||
| 1513 | }; | 1501 | }; |
| 1514 | 1502 | ||
| 1515 | #define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) | 1503 | #define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) |
| @@ -1521,25 +1509,14 @@ struct packet_type { | |||
| 1521 | struct net_device *, | 1509 | struct net_device *, |
| 1522 | struct packet_type *, | 1510 | struct packet_type *, |
| 1523 | struct net_device *); | 1511 | struct net_device *); |
| 1524 | bool (*id_match)(struct packet_type *ptype, | ||
| 1525 | struct sock *sk); | ||
| 1526 | void *af_packet_priv; | ||
| 1527 | struct list_head list; | ||
| 1528 | }; | ||
| 1529 | |||
| 1530 | struct offload_callbacks { | ||
| 1531 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | 1512 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, |
| 1532 | netdev_features_t features); | 1513 | u32 features); |
| 1533 | int (*gso_send_check)(struct sk_buff *skb); | 1514 | int (*gso_send_check)(struct sk_buff *skb); |
| 1534 | struct sk_buff **(*gro_receive)(struct sk_buff **head, | 1515 | struct sk_buff **(*gro_receive)(struct sk_buff **head, |
| 1535 | struct sk_buff *skb); | 1516 | struct sk_buff *skb); |
| 1536 | int (*gro_complete)(struct sk_buff *skb); | 1517 | int (*gro_complete)(struct sk_buff *skb); |
| 1537 | }; | 1518 | void *af_packet_priv; |
| 1538 | 1519 | struct list_head list; | |
| 1539 | struct packet_offload { | ||
| 1540 | __be16 type; /* This is really htons(ether_type). */ | ||
| 1541 | struct offload_callbacks callbacks; | ||
| 1542 | struct list_head list; | ||
| 1543 | }; | 1520 | }; |
| 1544 | 1521 | ||
| 1545 | #include <linux/notifier.h> | 1522 | #include <linux/notifier.h> |
| @@ -1567,7 +1544,7 @@ struct packet_offload { | |||
| 1567 | #define NETDEV_PRE_TYPE_CHANGE 0x000E | 1544 | #define NETDEV_PRE_TYPE_CHANGE 0x000E |
| 1568 | #define NETDEV_POST_TYPE_CHANGE 0x000F | 1545 | #define NETDEV_POST_TYPE_CHANGE 0x000F |
| 1569 | #define NETDEV_POST_INIT 0x0010 | 1546 | #define NETDEV_POST_INIT 0x0010 |
| 1570 | #define NETDEV_UNREGISTER_FINAL 0x0011 | 1547 | #define NETDEV_UNREGISTER_BATCH 0x0011 |
| 1571 | #define NETDEV_RELEASE 0x0012 | 1548 | #define NETDEV_RELEASE 0x0012 |
| 1572 | #define NETDEV_NOTIFY_PEERS 0x0013 | 1549 | #define NETDEV_NOTIFY_PEERS 0x0013 |
| 1573 | #define NETDEV_JOIN 0x0014 | 1550 | #define NETDEV_JOIN 0x0014 |
| @@ -1579,8 +1556,6 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); | |||
| 1579 | 1556 | ||
| 1580 | extern rwlock_t dev_base_lock; /* Device list lock */ | 1557 | extern rwlock_t dev_base_lock; /* Device list lock */ |
| 1581 | 1558 | ||
| 1582 | extern seqcount_t devnet_rename_seq; /* Device rename seq */ | ||
| 1583 | |||
| 1584 | 1559 | ||
| 1585 | #define for_each_netdev(net, d) \ | 1560 | #define for_each_netdev(net, d) \ |
| 1586 | list_for_each_entry(d, &(net)->dev_base_head, dev_list) | 1561 | list_for_each_entry(d, &(net)->dev_base_head, dev_list) |
| @@ -1638,9 +1613,6 @@ extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short | |||
| 1638 | extern void dev_add_pack(struct packet_type *pt); | 1613 | extern void dev_add_pack(struct packet_type *pt); |
| 1639 | extern void dev_remove_pack(struct packet_type *pt); | 1614 | extern void dev_remove_pack(struct packet_type *pt); |
| 1640 | extern void __dev_remove_pack(struct packet_type *pt); | 1615 | extern void __dev_remove_pack(struct packet_type *pt); |
| 1641 | extern void dev_add_offload(struct packet_offload *po); | ||
| 1642 | extern void dev_remove_offload(struct packet_offload *po); | ||
| 1643 | extern void __dev_remove_offload(struct packet_offload *po); | ||
| 1644 | 1616 | ||
| 1645 | extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, | 1617 | extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, |
| 1646 | unsigned short mask); | 1618 | unsigned short mask); |
| @@ -1651,7 +1623,6 @@ extern int dev_alloc_name(struct net_device *dev, const char *name); | |||
| 1651 | extern int dev_open(struct net_device *dev); | 1623 | extern int dev_open(struct net_device *dev); |
| 1652 | extern int dev_close(struct net_device *dev); | 1624 | extern int dev_close(struct net_device *dev); |
| 1653 | extern void dev_disable_lro(struct net_device *dev); | 1625 | extern void dev_disable_lro(struct net_device *dev); |
| 1654 | extern int dev_loopback_xmit(struct sk_buff *newskb); | ||
| 1655 | extern int dev_queue_xmit(struct sk_buff *skb); | 1626 | extern int dev_queue_xmit(struct sk_buff *skb); |
| 1656 | extern int register_netdevice(struct net_device *dev); | 1627 | extern int register_netdevice(struct net_device *dev); |
| 1657 | extern void unregister_netdevice_queue(struct net_device *dev, | 1628 | extern void unregister_netdevice_queue(struct net_device *dev, |
| @@ -1677,6 +1648,7 @@ extern int netpoll_trap(void); | |||
| 1677 | #endif | 1648 | #endif |
| 1678 | extern int skb_gro_receive(struct sk_buff **head, | 1649 | extern int skb_gro_receive(struct sk_buff **head, |
| 1679 | struct sk_buff *skb); | 1650 | struct sk_buff *skb); |
| 1651 | extern void skb_gro_reset_offset(struct sk_buff *skb); | ||
| 1680 | 1652 | ||
| 1681 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) | 1653 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) |
| 1682 | { | 1654 | { |
| @@ -1729,7 +1701,7 @@ static inline void *skb_gro_network_header(struct sk_buff *skb) | |||
| 1729 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 1701 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
| 1730 | unsigned short type, | 1702 | unsigned short type, |
| 1731 | const void *daddr, const void *saddr, | 1703 | const void *daddr, const void *saddr, |
| 1732 | unsigned int len) | 1704 | unsigned len) |
| 1733 | { | 1705 | { |
| 1734 | if (!dev->header_ops || !dev->header_ops->create) | 1706 | if (!dev->header_ops || !dev->header_ops->create) |
| 1735 | return 0; | 1707 | return 0; |
| @@ -1780,7 +1752,7 @@ struct softnet_data { | |||
| 1780 | unsigned int input_queue_head; | 1752 | unsigned int input_queue_head; |
| 1781 | unsigned int input_queue_tail; | 1753 | unsigned int input_queue_tail; |
| 1782 | #endif | 1754 | #endif |
| 1783 | unsigned int dropped; | 1755 | unsigned dropped; |
| 1784 | struct sk_buff_head input_pkt_queue; | 1756 | struct sk_buff_head input_pkt_queue; |
| 1785 | struct napi_struct backlog; | 1757 | struct napi_struct backlog; |
| 1786 | }; | 1758 | }; |
| @@ -1806,7 +1778,7 @@ extern void __netif_schedule(struct Qdisc *q); | |||
| 1806 | 1778 | ||
| 1807 | static inline void netif_schedule_queue(struct netdev_queue *txq) | 1779 | static inline void netif_schedule_queue(struct netdev_queue *txq) |
| 1808 | { | 1780 | { |
| 1809 | if (!(txq->state & QUEUE_STATE_ANY_XOFF)) | 1781 | if (!test_bit(__QUEUE_STATE_XOFF, &txq->state)) |
| 1810 | __netif_schedule(txq->qdisc); | 1782 | __netif_schedule(txq->qdisc); |
| 1811 | } | 1783 | } |
| 1812 | 1784 | ||
| @@ -1820,7 +1792,7 @@ static inline void netif_tx_schedule_all(struct net_device *dev) | |||
| 1820 | 1792 | ||
| 1821 | static inline void netif_tx_start_queue(struct netdev_queue *dev_queue) | 1793 | static inline void netif_tx_start_queue(struct netdev_queue *dev_queue) |
| 1822 | { | 1794 | { |
| 1823 | clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); | 1795 | clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state); |
| 1824 | } | 1796 | } |
| 1825 | 1797 | ||
| 1826 | /** | 1798 | /** |
| @@ -1852,7 +1824,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) | |||
| 1852 | return; | 1824 | return; |
| 1853 | } | 1825 | } |
| 1854 | #endif | 1826 | #endif |
| 1855 | if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state)) | 1827 | if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state)) |
| 1856 | __netif_schedule(dev_queue->qdisc); | 1828 | __netif_schedule(dev_queue->qdisc); |
| 1857 | } | 1829 | } |
| 1858 | 1830 | ||
| @@ -1884,7 +1856,7 @@ static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) | |||
| 1884 | pr_info("netif_stop_queue() cannot be called before register_netdev()\n"); | 1856 | pr_info("netif_stop_queue() cannot be called before register_netdev()\n"); |
| 1885 | return; | 1857 | return; |
| 1886 | } | 1858 | } |
| 1887 | set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); | 1859 | set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); |
| 1888 | } | 1860 | } |
| 1889 | 1861 | ||
| 1890 | /** | 1862 | /** |
| @@ -1909,9 +1881,9 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev) | |||
| 1909 | } | 1881 | } |
| 1910 | } | 1882 | } |
| 1911 | 1883 | ||
| 1912 | static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue) | 1884 | static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) |
| 1913 | { | 1885 | { |
| 1914 | return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); | 1886 | return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state); |
| 1915 | } | 1887 | } |
| 1916 | 1888 | ||
| 1917 | /** | 1889 | /** |
| @@ -1920,91 +1892,14 @@ static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue) | |||
| 1920 | * | 1892 | * |
| 1921 | * Test if transmit queue on device is currently unable to send. | 1893 | * Test if transmit queue on device is currently unable to send. |
| 1922 | */ | 1894 | */ |
| 1923 | static inline bool netif_queue_stopped(const struct net_device *dev) | 1895 | static inline int netif_queue_stopped(const struct net_device *dev) |
| 1924 | { | 1896 | { |
| 1925 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); | 1897 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); |
| 1926 | } | 1898 | } |
| 1927 | 1899 | ||
| 1928 | static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue) | 1900 | static inline int netif_tx_queue_frozen_or_stopped(const struct netdev_queue *dev_queue) |
| 1929 | { | 1901 | { |
| 1930 | return dev_queue->state & QUEUE_STATE_ANY_XOFF; | 1902 | return dev_queue->state & QUEUE_STATE_XOFF_OR_FROZEN; |
| 1931 | } | ||
| 1932 | |||
| 1933 | static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) | ||
| 1934 | { | ||
| 1935 | return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; | ||
| 1936 | } | ||
| 1937 | |||
| 1938 | static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, | ||
| 1939 | unsigned int bytes) | ||
| 1940 | { | ||
| 1941 | #ifdef CONFIG_BQL | ||
| 1942 | dql_queued(&dev_queue->dql, bytes); | ||
| 1943 | |||
| 1944 | if (likely(dql_avail(&dev_queue->dql) >= 0)) | ||
| 1945 | return; | ||
| 1946 | |||
| 1947 | set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); | ||
| 1948 | |||
| 1949 | /* | ||
| 1950 | * The XOFF flag must be set before checking the dql_avail below, | ||
| 1951 | * because in netdev_tx_completed_queue we update the dql_completed | ||
| 1952 | * before checking the XOFF flag. | ||
| 1953 | */ | ||
| 1954 | smp_mb(); | ||
| 1955 | |||
| 1956 | /* check again in case another CPU has just made room avail */ | ||
| 1957 | if (unlikely(dql_avail(&dev_queue->dql) >= 0)) | ||
| 1958 | clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); | ||
| 1959 | #endif | ||
| 1960 | } | ||
| 1961 | |||
| 1962 | static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) | ||
| 1963 | { | ||
| 1964 | netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes); | ||
| 1965 | } | ||
| 1966 | |||
| 1967 | static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, | ||
| 1968 | unsigned int pkts, unsigned int bytes) | ||
| 1969 | { | ||
| 1970 | #ifdef CONFIG_BQL | ||
| 1971 | if (unlikely(!bytes)) | ||
| 1972 | return; | ||
| 1973 | |||
| 1974 | dql_completed(&dev_queue->dql, bytes); | ||
| 1975 | |||
| 1976 | /* | ||
| 1977 | * Without the memory barrier there is a small possiblity that | ||
| 1978 | * netdev_tx_sent_queue will miss the update and cause the queue to | ||
| 1979 | * be stopped forever | ||
| 1980 | */ | ||
| 1981 | smp_mb(); | ||
| 1982 | |||
| 1983 | if (dql_avail(&dev_queue->dql) < 0) | ||
| 1984 | return; | ||
| 1985 | |||
| 1986 | if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state)) | ||
| 1987 | netif_schedule_queue(dev_queue); | ||
| 1988 | #endif | ||
| 1989 | } | ||
| 1990 | |||
| 1991 | static inline void netdev_completed_queue(struct net_device *dev, | ||
| 1992 | unsigned int pkts, unsigned int bytes) | ||
| 1993 | { | ||
| 1994 | netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes); | ||
| 1995 | } | ||
| 1996 | |||
| 1997 | static inline void netdev_tx_reset_queue(struct netdev_queue *q) | ||
| 1998 | { | ||
| 1999 | #ifdef CONFIG_BQL | ||
| 2000 | clear_bit(__QUEUE_STATE_STACK_XOFF, &q->state); | ||
| 2001 | dql_reset(&q->dql); | ||
| 2002 | #endif | ||
| 2003 | } | ||
| 2004 | |||
| 2005 | static inline void netdev_reset_queue(struct net_device *dev_queue) | ||
| 2006 | { | ||
| 2007 | netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0)); | ||
| 2008 | } | 1903 | } |
| 2009 | 1904 | ||
| 2010 | /** | 1905 | /** |
| @@ -2013,7 +1908,7 @@ static inline void netdev_reset_queue(struct net_device *dev_queue) | |||
| 2013 | * | 1908 | * |
| 2014 | * Test if the device has been brought up. | 1909 | * Test if the device has been brought up. |
| 2015 | */ | 1910 | */ |
| 2016 | static inline bool netif_running(const struct net_device *dev) | 1911 | static inline int netif_running(const struct net_device *dev) |
| 2017 | { | 1912 | { |
| 2018 | return test_bit(__LINK_STATE_START, &dev->state); | 1913 | return test_bit(__LINK_STATE_START, &dev->state); |
| 2019 | } | 1914 | } |
| @@ -2063,16 +1958,16 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) | |||
| 2063 | * | 1958 | * |
| 2064 | * Check individual transmit queue of a device with multiple transmit queues. | 1959 | * Check individual transmit queue of a device with multiple transmit queues. |
| 2065 | */ | 1960 | */ |
| 2066 | static inline bool __netif_subqueue_stopped(const struct net_device *dev, | 1961 | static inline int __netif_subqueue_stopped(const struct net_device *dev, |
| 2067 | u16 queue_index) | 1962 | u16 queue_index) |
| 2068 | { | 1963 | { |
| 2069 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); | 1964 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); |
| 2070 | 1965 | ||
| 2071 | return netif_tx_queue_stopped(txq); | 1966 | return netif_tx_queue_stopped(txq); |
| 2072 | } | 1967 | } |
| 2073 | 1968 | ||
| 2074 | static inline bool netif_subqueue_stopped(const struct net_device *dev, | 1969 | static inline int netif_subqueue_stopped(const struct net_device *dev, |
| 2075 | struct sk_buff *skb) | 1970 | struct sk_buff *skb) |
| 2076 | { | 1971 | { |
| 2077 | return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); | 1972 | return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); |
| 2078 | } | 1973 | } |
| @@ -2091,7 +1986,7 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | |||
| 2091 | if (netpoll_trap()) | 1986 | if (netpoll_trap()) |
| 2092 | return; | 1987 | return; |
| 2093 | #endif | 1988 | #endif |
| 2094 | if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state)) | 1989 | if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state)) |
| 2095 | __netif_schedule(txq->qdisc); | 1990 | __netif_schedule(txq->qdisc); |
| 2096 | } | 1991 | } |
| 2097 | 1992 | ||
| @@ -2111,7 +2006,7 @@ static inline u16 skb_tx_hash(const struct net_device *dev, | |||
| 2111 | * | 2006 | * |
| 2112 | * Check if device has multiple transmit queues | 2007 | * Check if device has multiple transmit queues |
| 2113 | */ | 2008 | */ |
| 2114 | static inline bool netif_is_multiqueue(const struct net_device *dev) | 2009 | static inline int netif_is_multiqueue(const struct net_device *dev) |
| 2115 | { | 2010 | { |
| 2116 | return dev->num_tx_queues > 1; | 2011 | return dev->num_tx_queues > 1; |
| 2117 | } | 2012 | } |
| @@ -2133,12 +2028,7 @@ static inline int netif_set_real_num_rx_queues(struct net_device *dev, | |||
| 2133 | static inline int netif_copy_real_num_queues(struct net_device *to_dev, | 2028 | static inline int netif_copy_real_num_queues(struct net_device *to_dev, |
| 2134 | const struct net_device *from_dev) | 2029 | const struct net_device *from_dev) |
| 2135 | { | 2030 | { |
| 2136 | int err; | 2031 | netif_set_real_num_tx_queues(to_dev, from_dev->real_num_tx_queues); |
| 2137 | |||
| 2138 | err = netif_set_real_num_tx_queues(to_dev, | ||
| 2139 | from_dev->real_num_tx_queues); | ||
| 2140 | if (err) | ||
| 2141 | return err; | ||
| 2142 | #ifdef CONFIG_RPS | 2032 | #ifdef CONFIG_RPS |
| 2143 | return netif_set_real_num_rx_queues(to_dev, | 2033 | return netif_set_real_num_rx_queues(to_dev, |
| 2144 | from_dev->real_num_rx_queues); | 2034 | from_dev->real_num_rx_queues); |
| @@ -2147,9 +2037,6 @@ static inline int netif_copy_real_num_queues(struct net_device *to_dev, | |||
| 2147 | #endif | 2037 | #endif |
| 2148 | } | 2038 | } |
| 2149 | 2039 | ||
| 2150 | #define DEFAULT_MAX_NUM_RSS_QUEUES (8) | ||
| 2151 | extern int netif_get_num_default_rss_queues(void); | ||
| 2152 | |||
| 2153 | /* Use this variant when it is known for sure that it | 2040 | /* Use this variant when it is known for sure that it |
| 2154 | * is executing from hardware interrupt context or with hardware interrupts | 2041 | * is executing from hardware interrupt context or with hardware interrupts |
| 2155 | * disabled. | 2042 | * disabled. |
| @@ -2165,10 +2052,17 @@ extern void dev_kfree_skb_any(struct sk_buff *skb); | |||
| 2165 | extern int netif_rx(struct sk_buff *skb); | 2052 | extern int netif_rx(struct sk_buff *skb); |
| 2166 | extern int netif_rx_ni(struct sk_buff *skb); | 2053 | extern int netif_rx_ni(struct sk_buff *skb); |
| 2167 | extern int netif_receive_skb(struct sk_buff *skb); | 2054 | extern int netif_receive_skb(struct sk_buff *skb); |
| 2055 | extern gro_result_t dev_gro_receive(struct napi_struct *napi, | ||
| 2056 | struct sk_buff *skb); | ||
| 2057 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); | ||
| 2168 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, | 2058 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, |
| 2169 | struct sk_buff *skb); | 2059 | struct sk_buff *skb); |
| 2170 | extern void napi_gro_flush(struct napi_struct *napi, bool flush_old); | 2060 | extern void napi_gro_flush(struct napi_struct *napi); |
| 2171 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); | 2061 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); |
| 2062 | extern gro_result_t napi_frags_finish(struct napi_struct *napi, | ||
| 2063 | struct sk_buff *skb, | ||
| 2064 | gro_result_t ret); | ||
| 2065 | extern struct sk_buff * napi_frags_skb(struct napi_struct *napi); | ||
| 2172 | extern gro_result_t napi_gro_frags(struct napi_struct *napi); | 2066 | extern gro_result_t napi_gro_frags(struct napi_struct *napi); |
| 2173 | 2067 | ||
| 2174 | static inline void napi_free_frags(struct napi_struct *napi) | 2068 | static inline void napi_free_frags(struct napi_struct *napi) |
| @@ -2182,12 +2076,12 @@ extern int netdev_rx_handler_register(struct net_device *dev, | |||
| 2182 | void *rx_handler_data); | 2076 | void *rx_handler_data); |
| 2183 | extern void netdev_rx_handler_unregister(struct net_device *dev); | 2077 | extern void netdev_rx_handler_unregister(struct net_device *dev); |
| 2184 | 2078 | ||
| 2185 | extern bool dev_valid_name(const char *name); | 2079 | extern int dev_valid_name(const char *name); |
| 2186 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 2080 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
| 2187 | extern int dev_ethtool(struct net *net, struct ifreq *); | 2081 | extern int dev_ethtool(struct net *net, struct ifreq *); |
| 2188 | extern unsigned int dev_get_flags(const struct net_device *); | 2082 | extern unsigned dev_get_flags(const struct net_device *); |
| 2189 | extern int __dev_change_flags(struct net_device *, unsigned int flags); | 2083 | extern int __dev_change_flags(struct net_device *, unsigned int flags); |
| 2190 | extern int dev_change_flags(struct net_device *, unsigned int); | 2084 | extern int dev_change_flags(struct net_device *, unsigned); |
| 2191 | extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); | 2085 | extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); |
| 2192 | extern int dev_change_name(struct net_device *, const char *); | 2086 | extern int dev_change_name(struct net_device *, const char *); |
| 2193 | extern int dev_set_alias(struct net_device *, const char *, size_t); | 2087 | extern int dev_set_alias(struct net_device *, const char *, size_t); |
| @@ -2216,7 +2110,7 @@ extern void netdev_run_todo(void); | |||
| 2216 | */ | 2110 | */ |
| 2217 | static inline void dev_put(struct net_device *dev) | 2111 | static inline void dev_put(struct net_device *dev) |
| 2218 | { | 2112 | { |
| 2219 | this_cpu_dec(*dev->pcpu_refcnt); | 2113 | irqsafe_cpu_dec(*dev->pcpu_refcnt); |
| 2220 | } | 2114 | } |
| 2221 | 2115 | ||
| 2222 | /** | 2116 | /** |
| @@ -2227,7 +2121,7 @@ static inline void dev_put(struct net_device *dev) | |||
| 2227 | */ | 2121 | */ |
| 2228 | static inline void dev_hold(struct net_device *dev) | 2122 | static inline void dev_hold(struct net_device *dev) |
| 2229 | { | 2123 | { |
| 2230 | this_cpu_inc(*dev->pcpu_refcnt); | 2124 | irqsafe_cpu_inc(*dev->pcpu_refcnt); |
| 2231 | } | 2125 | } |
| 2232 | 2126 | ||
| 2233 | /* Carrier loss detection, dial on demand. The functions netif_carrier_on | 2127 | /* Carrier loss detection, dial on demand. The functions netif_carrier_on |
| @@ -2239,7 +2133,6 @@ static inline void dev_hold(struct net_device *dev) | |||
| 2239 | * kind of lower layer not just hardware media. | 2133 | * kind of lower layer not just hardware media. |
| 2240 | */ | 2134 | */ |
| 2241 | 2135 | ||
| 2242 | extern void linkwatch_init_dev(struct net_device *dev); | ||
| 2243 | extern void linkwatch_fire_event(struct net_device *dev); | 2136 | extern void linkwatch_fire_event(struct net_device *dev); |
| 2244 | extern void linkwatch_forget_dev(struct net_device *dev); | 2137 | extern void linkwatch_forget_dev(struct net_device *dev); |
| 2245 | 2138 | ||
| @@ -2249,7 +2142,7 @@ extern void linkwatch_forget_dev(struct net_device *dev); | |||
| 2249 | * | 2142 | * |
| 2250 | * Check if carrier is present on device | 2143 | * Check if carrier is present on device |
| 2251 | */ | 2144 | */ |
| 2252 | static inline bool netif_carrier_ok(const struct net_device *dev) | 2145 | static inline int netif_carrier_ok(const struct net_device *dev) |
| 2253 | { | 2146 | { |
| 2254 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); | 2147 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); |
| 2255 | } | 2148 | } |
| @@ -2262,6 +2155,8 @@ extern void netif_carrier_on(struct net_device *dev); | |||
| 2262 | 2155 | ||
| 2263 | extern void netif_carrier_off(struct net_device *dev); | 2156 | extern void netif_carrier_off(struct net_device *dev); |
| 2264 | 2157 | ||
| 2158 | extern void netif_notify_peers(struct net_device *dev); | ||
| 2159 | |||
| 2265 | /** | 2160 | /** |
| 2266 | * netif_dormant_on - mark device as dormant. | 2161 | * netif_dormant_on - mark device as dormant. |
| 2267 | * @dev: network device | 2162 | * @dev: network device |
| @@ -2299,7 +2194,7 @@ static inline void netif_dormant_off(struct net_device *dev) | |||
| 2299 | * | 2194 | * |
| 2300 | * Check if carrier is present on device | 2195 | * Check if carrier is present on device |
| 2301 | */ | 2196 | */ |
| 2302 | static inline bool netif_dormant(const struct net_device *dev) | 2197 | static inline int netif_dormant(const struct net_device *dev) |
| 2303 | { | 2198 | { |
| 2304 | return test_bit(__LINK_STATE_DORMANT, &dev->state); | 2199 | return test_bit(__LINK_STATE_DORMANT, &dev->state); |
| 2305 | } | 2200 | } |
| @@ -2311,7 +2206,7 @@ static inline bool netif_dormant(const struct net_device *dev) | |||
| 2311 | * | 2206 | * |
| 2312 | * Check if carrier is operational | 2207 | * Check if carrier is operational |
| 2313 | */ | 2208 | */ |
| 2314 | static inline bool netif_oper_up(const struct net_device *dev) | 2209 | static inline int netif_oper_up(const struct net_device *dev) |
| 2315 | { | 2210 | { |
| 2316 | return (dev->operstate == IF_OPER_UP || | 2211 | return (dev->operstate == IF_OPER_UP || |
| 2317 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); | 2212 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); |
| @@ -2323,7 +2218,7 @@ static inline bool netif_oper_up(const struct net_device *dev) | |||
| 2323 | * | 2218 | * |
| 2324 | * Check if device has not been removed from system. | 2219 | * Check if device has not been removed from system. |
| 2325 | */ | 2220 | */ |
| 2326 | static inline bool netif_device_present(struct net_device *dev) | 2221 | static inline int netif_device_present(struct net_device *dev) |
| 2327 | { | 2222 | { |
| 2328 | return test_bit(__LINK_STATE_PRESENT, &dev->state); | 2223 | return test_bit(__LINK_STATE_PRESENT, &dev->state); |
| 2329 | } | 2224 | } |
| @@ -2393,9 +2288,9 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq) | |||
| 2393 | txq->xmit_lock_owner = smp_processor_id(); | 2288 | txq->xmit_lock_owner = smp_processor_id(); |
| 2394 | } | 2289 | } |
| 2395 | 2290 | ||
| 2396 | static inline bool __netif_tx_trylock(struct netdev_queue *txq) | 2291 | static inline int __netif_tx_trylock(struct netdev_queue *txq) |
| 2397 | { | 2292 | { |
| 2398 | bool ok = spin_trylock(&txq->_xmit_lock); | 2293 | int ok = spin_trylock(&txq->_xmit_lock); |
| 2399 | if (likely(ok)) | 2294 | if (likely(ok)) |
| 2400 | txq->xmit_lock_owner = smp_processor_id(); | 2295 | txq->xmit_lock_owner = smp_processor_id(); |
| 2401 | return ok; | 2296 | return ok; |
| @@ -2510,11 +2405,6 @@ static inline void netif_addr_lock(struct net_device *dev) | |||
| 2510 | spin_lock(&dev->addr_list_lock); | 2405 | spin_lock(&dev->addr_list_lock); |
| 2511 | } | 2406 | } |
| 2512 | 2407 | ||
| 2513 | static inline void netif_addr_lock_nested(struct net_device *dev) | ||
| 2514 | { | ||
| 2515 | spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING); | ||
| 2516 | } | ||
| 2517 | |||
| 2518 | static inline void netif_addr_lock_bh(struct net_device *dev) | 2408 | static inline void netif_addr_lock_bh(struct net_device *dev) |
| 2519 | { | 2409 | { |
| 2520 | spin_lock_bh(&dev->addr_list_lock); | 2410 | spin_lock_bh(&dev->addr_list_lock); |
| @@ -2571,9 +2461,9 @@ extern void __hw_addr_flush(struct netdev_hw_addr_list *list); | |||
| 2571 | extern void __hw_addr_init(struct netdev_hw_addr_list *list); | 2461 | extern void __hw_addr_init(struct netdev_hw_addr_list *list); |
| 2572 | 2462 | ||
| 2573 | /* Functions used for device addresses handling */ | 2463 | /* Functions used for device addresses handling */ |
| 2574 | extern int dev_addr_add(struct net_device *dev, const unsigned char *addr, | 2464 | extern int dev_addr_add(struct net_device *dev, unsigned char *addr, |
| 2575 | unsigned char addr_type); | 2465 | unsigned char addr_type); |
| 2576 | extern int dev_addr_del(struct net_device *dev, const unsigned char *addr, | 2466 | extern int dev_addr_del(struct net_device *dev, unsigned char *addr, |
| 2577 | unsigned char addr_type); | 2467 | unsigned char addr_type); |
| 2578 | extern int dev_addr_add_multiple(struct net_device *to_dev, | 2468 | extern int dev_addr_add_multiple(struct net_device *to_dev, |
| 2579 | struct net_device *from_dev, | 2469 | struct net_device *from_dev, |
| @@ -2585,20 +2475,18 @@ extern void dev_addr_flush(struct net_device *dev); | |||
| 2585 | extern int dev_addr_init(struct net_device *dev); | 2475 | extern int dev_addr_init(struct net_device *dev); |
| 2586 | 2476 | ||
| 2587 | /* Functions used for unicast addresses handling */ | 2477 | /* Functions used for unicast addresses handling */ |
| 2588 | extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); | 2478 | extern int dev_uc_add(struct net_device *dev, unsigned char *addr); |
| 2589 | extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); | 2479 | extern int dev_uc_del(struct net_device *dev, unsigned char *addr); |
| 2590 | extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); | ||
| 2591 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); | 2480 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); |
| 2592 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); | 2481 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); |
| 2593 | extern void dev_uc_flush(struct net_device *dev); | 2482 | extern void dev_uc_flush(struct net_device *dev); |
| 2594 | extern void dev_uc_init(struct net_device *dev); | 2483 | extern void dev_uc_init(struct net_device *dev); |
| 2595 | 2484 | ||
| 2596 | /* Functions used for multicast addresses handling */ | 2485 | /* Functions used for multicast addresses handling */ |
| 2597 | extern int dev_mc_add(struct net_device *dev, const unsigned char *addr); | 2486 | extern int dev_mc_add(struct net_device *dev, unsigned char *addr); |
| 2598 | extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); | 2487 | extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); |
| 2599 | extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); | 2488 | extern int dev_mc_del(struct net_device *dev, unsigned char *addr); |
| 2600 | extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); | 2489 | extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); |
| 2601 | extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); | ||
| 2602 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); | 2490 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); |
| 2603 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); | 2491 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); |
| 2604 | extern void dev_mc_flush(struct net_device *dev); | 2492 | extern void dev_mc_flush(struct net_device *dev); |
| @@ -2610,15 +2498,14 @@ extern void __dev_set_rx_mode(struct net_device *dev); | |||
| 2610 | extern int dev_set_promiscuity(struct net_device *dev, int inc); | 2498 | extern int dev_set_promiscuity(struct net_device *dev, int inc); |
| 2611 | extern int dev_set_allmulti(struct net_device *dev, int inc); | 2499 | extern int dev_set_allmulti(struct net_device *dev, int inc); |
| 2612 | extern void netdev_state_change(struct net_device *dev); | 2500 | extern void netdev_state_change(struct net_device *dev); |
| 2613 | extern void netdev_notify_peers(struct net_device *dev); | 2501 | extern int netdev_bonding_change(struct net_device *dev, |
| 2502 | unsigned long event); | ||
| 2614 | extern void netdev_features_change(struct net_device *dev); | 2503 | extern void netdev_features_change(struct net_device *dev); |
| 2615 | /* Load a device via the kmod */ | 2504 | /* Load a device via the kmod */ |
| 2616 | extern void dev_load(struct net *net, const char *name); | 2505 | extern void dev_load(struct net *net, const char *name); |
| 2617 | extern void dev_mcast_init(void); | 2506 | extern void dev_mcast_init(void); |
| 2618 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, | 2507 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, |
| 2619 | struct rtnl_link_stats64 *storage); | 2508 | struct rtnl_link_stats64 *storage); |
| 2620 | extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, | ||
| 2621 | const struct net_device_stats *netdev_stats); | ||
| 2622 | 2509 | ||
| 2623 | extern int netdev_max_backlog; | 2510 | extern int netdev_max_backlog; |
| 2624 | extern int netdev_tstamp_prequeue; | 2511 | extern int netdev_tstamp_prequeue; |
| @@ -2628,8 +2515,7 @@ extern int netdev_set_master(struct net_device *dev, struct net_device *master) | |||
| 2628 | extern int netdev_set_bond_master(struct net_device *dev, | 2515 | extern int netdev_set_bond_master(struct net_device *dev, |
| 2629 | struct net_device *master); | 2516 | struct net_device *master); |
| 2630 | extern int skb_checksum_help(struct sk_buff *skb); | 2517 | extern int skb_checksum_help(struct sk_buff *skb); |
| 2631 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, | 2518 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features); |
| 2632 | netdev_features_t features); | ||
| 2633 | #ifdef CONFIG_BUG | 2519 | #ifdef CONFIG_BUG |
| 2634 | extern void netdev_rx_csum_fault(struct net_device *dev); | 2520 | extern void netdev_rx_csum_fault(struct net_device *dev); |
| 2635 | #else | 2521 | #else |
| @@ -2656,13 +2542,11 @@ extern const char *netdev_drivername(const struct net_device *dev); | |||
| 2656 | 2542 | ||
| 2657 | extern void linkwatch_run_queue(void); | 2543 | extern void linkwatch_run_queue(void); |
| 2658 | 2544 | ||
| 2659 | static inline netdev_features_t netdev_get_wanted_features( | 2545 | static inline u32 netdev_get_wanted_features(struct net_device *dev) |
| 2660 | struct net_device *dev) | ||
| 2661 | { | 2546 | { |
| 2662 | return (dev->features & ~dev->hw_features) | dev->wanted_features; | 2547 | return (dev->features & ~dev->hw_features) | dev->wanted_features; |
| 2663 | } | 2548 | } |
| 2664 | netdev_features_t netdev_increment_features(netdev_features_t all, | 2549 | u32 netdev_increment_features(u32 all, u32 one, u32 mask); |
| 2665 | netdev_features_t one, netdev_features_t mask); | ||
| 2666 | int __netdev_update_features(struct net_device *dev); | 2550 | int __netdev_update_features(struct net_device *dev); |
| 2667 | void netdev_update_features(struct net_device *dev); | 2551 | void netdev_update_features(struct net_device *dev); |
| 2668 | void netdev_change_features(struct net_device *dev); | 2552 | void netdev_change_features(struct net_device *dev); |
| @@ -2670,35 +2554,24 @@ void netdev_change_features(struct net_device *dev); | |||
| 2670 | void netif_stacked_transfer_operstate(const struct net_device *rootdev, | 2554 | void netif_stacked_transfer_operstate(const struct net_device *rootdev, |
| 2671 | struct net_device *dev); | 2555 | struct net_device *dev); |
| 2672 | 2556 | ||
| 2673 | netdev_features_t netif_skb_features(struct sk_buff *skb); | 2557 | u32 netif_skb_features(struct sk_buff *skb); |
| 2674 | 2558 | ||
| 2675 | static inline bool net_gso_ok(netdev_features_t features, int gso_type) | 2559 | static inline int net_gso_ok(u32 features, int gso_type) |
| 2676 | { | 2560 | { |
| 2677 | netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; | 2561 | int feature = gso_type << NETIF_F_GSO_SHIFT; |
| 2678 | |||
| 2679 | /* check flags correspondence */ | ||
| 2680 | BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT)); | ||
| 2681 | BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT)); | ||
| 2682 | BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT)); | ||
| 2683 | BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT)); | ||
| 2684 | BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT)); | ||
| 2685 | BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT)); | ||
| 2686 | |||
| 2687 | return (features & feature) == feature; | 2562 | return (features & feature) == feature; |
| 2688 | } | 2563 | } |
| 2689 | 2564 | ||
| 2690 | static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features) | 2565 | static inline int skb_gso_ok(struct sk_buff *skb, u32 features) |
| 2691 | { | 2566 | { |
| 2692 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && | 2567 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && |
| 2693 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); | 2568 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); |
| 2694 | } | 2569 | } |
| 2695 | 2570 | ||
| 2696 | static inline bool netif_needs_gso(struct sk_buff *skb, | 2571 | static inline int netif_needs_gso(struct sk_buff *skb, int features) |
| 2697 | netdev_features_t features) | ||
| 2698 | { | 2572 | { |
| 2699 | return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || | 2573 | return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || |
| 2700 | unlikely((skb->ip_summed != CHECKSUM_PARTIAL) && | 2574 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); |
| 2701 | (skb->ip_summed != CHECKSUM_UNNECESSARY))); | ||
| 2702 | } | 2575 | } |
| 2703 | 2576 | ||
| 2704 | static inline void netif_set_gso_max_size(struct net_device *dev, | 2577 | static inline void netif_set_gso_max_size(struct net_device *dev, |
| @@ -2707,17 +2580,31 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
| 2707 | dev->gso_max_size = size; | 2580 | dev->gso_max_size = size; |
| 2708 | } | 2581 | } |
| 2709 | 2582 | ||
| 2710 | static inline bool netif_is_bond_slave(struct net_device *dev) | 2583 | static inline int netif_is_bond_slave(struct net_device *dev) |
| 2711 | { | 2584 | { |
| 2712 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; | 2585 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; |
| 2713 | } | 2586 | } |
| 2714 | 2587 | ||
| 2715 | static inline bool netif_supports_nofcs(struct net_device *dev) | 2588 | extern struct pernet_operations __net_initdata loopback_net_ops; |
| 2589 | |||
| 2590 | int dev_ethtool_get_settings(struct net_device *dev, | ||
| 2591 | struct ethtool_cmd *cmd); | ||
| 2592 | |||
| 2593 | static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) | ||
| 2716 | { | 2594 | { |
| 2717 | return dev->priv_flags & IFF_SUPP_NOFCS; | 2595 | if (dev->features & NETIF_F_RXCSUM) |
| 2596 | return 1; | ||
| 2597 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) | ||
| 2598 | return 0; | ||
| 2599 | return dev->ethtool_ops->get_rx_csum(dev); | ||
| 2718 | } | 2600 | } |
| 2719 | 2601 | ||
| 2720 | extern struct pernet_operations __net_initdata loopback_net_ops; | 2602 | static inline u32 dev_ethtool_get_flags(struct net_device *dev) |
| 2603 | { | ||
| 2604 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags) | ||
| 2605 | return 0; | ||
| 2606 | return dev->ethtool_ops->get_flags(dev); | ||
| 2607 | } | ||
| 2721 | 2608 | ||
| 2722 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 2609 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
| 2723 | 2610 | ||
| @@ -2730,35 +2617,36 @@ static inline const char *netdev_name(const struct net_device *dev) | |||
| 2730 | return dev->name; | 2617 | return dev->name; |
| 2731 | } | 2618 | } |
| 2732 | 2619 | ||
| 2733 | extern __printf(3, 4) | 2620 | extern int netdev_printk(const char *level, const struct net_device *dev, |
| 2734 | int netdev_printk(const char *level, const struct net_device *dev, | 2621 | const char *format, ...) |
| 2735 | const char *format, ...); | 2622 | __attribute__ ((format (printf, 3, 4))); |
| 2736 | extern __printf(2, 3) | 2623 | extern int netdev_emerg(const struct net_device *dev, const char *format, ...) |
| 2737 | int netdev_emerg(const struct net_device *dev, const char *format, ...); | 2624 | __attribute__ ((format (printf, 2, 3))); |
| 2738 | extern __printf(2, 3) | 2625 | extern int netdev_alert(const struct net_device *dev, const char *format, ...) |
| 2739 | int netdev_alert(const struct net_device *dev, const char *format, ...); | 2626 | __attribute__ ((format (printf, 2, 3))); |
| 2740 | extern __printf(2, 3) | 2627 | extern int netdev_crit(const struct net_device *dev, const char *format, ...) |
| 2741 | int netdev_crit(const struct net_device *dev, const char *format, ...); | 2628 | __attribute__ ((format (printf, 2, 3))); |
| 2742 | extern __printf(2, 3) | 2629 | extern int netdev_err(const struct net_device *dev, const char *format, ...) |
| 2743 | int netdev_err(const struct net_device *dev, const char *format, ...); | 2630 | __attribute__ ((format (printf, 2, 3))); |
| 2744 | extern __printf(2, 3) | 2631 | extern int netdev_warn(const struct net_device *dev, const char *format, ...) |
| 2745 | int netdev_warn(const struct net_device *dev, const char *format, ...); | 2632 | __attribute__ ((format (printf, 2, 3))); |
| 2746 | extern __printf(2, 3) | 2633 | extern int netdev_notice(const struct net_device *dev, const char *format, ...) |
| 2747 | int netdev_notice(const struct net_device *dev, const char *format, ...); | 2634 | __attribute__ ((format (printf, 2, 3))); |
| 2748 | extern __printf(2, 3) | 2635 | extern int netdev_info(const struct net_device *dev, const char *format, ...) |
| 2749 | int netdev_info(const struct net_device *dev, const char *format, ...); | 2636 | __attribute__ ((format (printf, 2, 3))); |
| 2750 | 2637 | ||
| 2751 | #define MODULE_ALIAS_NETDEV(device) \ | 2638 | #define MODULE_ALIAS_NETDEV(device) \ |
| 2752 | MODULE_ALIAS("netdev-" device) | 2639 | MODULE_ALIAS("netdev-" device) |
| 2753 | 2640 | ||
| 2754 | #if defined(CONFIG_DYNAMIC_DEBUG) | 2641 | #if defined(DEBUG) |
| 2642 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2643 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
| 2644 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 2755 | #define netdev_dbg(__dev, format, args...) \ | 2645 | #define netdev_dbg(__dev, format, args...) \ |
| 2756 | do { \ | 2646 | do { \ |
| 2757 | dynamic_netdev_dbg(__dev, format, ##args); \ | 2647 | dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \ |
| 2648 | netdev_name(__dev), ##args); \ | ||
| 2758 | } while (0) | 2649 | } while (0) |
| 2759 | #elif defined(DEBUG) | ||
| 2760 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2761 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
| 2762 | #else | 2650 | #else |
| 2763 | #define netdev_dbg(__dev, format, args...) \ | 2651 | #define netdev_dbg(__dev, format, args...) \ |
| 2764 | ({ \ | 2652 | ({ \ |
| @@ -2817,15 +2705,17 @@ do { \ | |||
| 2817 | #define netif_info(priv, type, dev, fmt, args...) \ | 2705 | #define netif_info(priv, type, dev, fmt, args...) \ |
| 2818 | netif_level(info, priv, type, dev, fmt, ##args) | 2706 | netif_level(info, priv, type, dev, fmt, ##args) |
| 2819 | 2707 | ||
| 2820 | #if defined(CONFIG_DYNAMIC_DEBUG) | 2708 | #if defined(DEBUG) |
| 2709 | #define netif_dbg(priv, type, dev, format, args...) \ | ||
| 2710 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) | ||
| 2711 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 2821 | #define netif_dbg(priv, type, netdev, format, args...) \ | 2712 | #define netif_dbg(priv, type, netdev, format, args...) \ |
| 2822 | do { \ | 2713 | do { \ |
| 2823 | if (netif_msg_##type(priv)) \ | 2714 | if (netif_msg_##type(priv)) \ |
| 2824 | dynamic_netdev_dbg(netdev, format, ##args); \ | 2715 | dynamic_dev_dbg((netdev)->dev.parent, \ |
| 2716 | "%s: " format, \ | ||
| 2717 | netdev_name(netdev), ##args); \ | ||
| 2825 | } while (0) | 2718 | } while (0) |
| 2826 | #elif defined(DEBUG) | ||
| 2827 | #define netif_dbg(priv, type, dev, format, args...) \ | ||
| 2828 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) | ||
| 2829 | #else | 2719 | #else |
| 2830 | #define netif_dbg(priv, type, dev, format, args...) \ | 2720 | #define netif_dbg(priv, type, dev, format, args...) \ |
| 2831 | ({ \ | 2721 | ({ \ |
| @@ -2846,4 +2736,6 @@ do { \ | |||
| 2846 | }) | 2736 | }) |
| 2847 | #endif | 2737 | #endif |
| 2848 | 2738 | ||
| 2739 | #endif /* __KERNEL__ */ | ||
| 2740 | |||
| 2849 | #endif /* _LINUX_NETDEVICE_H */ | 2741 | #endif /* _LINUX_NETDEVICE_H */ |
