aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h88
1 files changed, 67 insertions, 21 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 52fd8e8694cf..d115256ed5a2 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -51,6 +51,7 @@
51#include <linux/netdev_features.h> 51#include <linux/netdev_features.h>
52#include <linux/neighbour.h> 52#include <linux/neighbour.h>
53#include <uapi/linux/netdevice.h> 53#include <uapi/linux/netdevice.h>
54#include <uapi/linux/if_bonding.h>
54 55
55struct netpoll_info; 56struct netpoll_info;
56struct device; 57struct device;
@@ -643,39 +644,40 @@ struct rps_dev_flow_table {
643/* 644/*
644 * The rps_sock_flow_table contains mappings of flows to the last CPU 645 * The rps_sock_flow_table contains mappings of flows to the last CPU
645 * on which they were processed by the application (set in recvmsg). 646 * on which they were processed by the application (set in recvmsg).
647 * Each entry is a 32bit value. Upper part is the high order bits
648 * of flow hash, lower part is cpu number.
649 * rps_cpu_mask is used to partition the space, depending on number of
650 * possible cpus : rps_cpu_mask = roundup_pow_of_two(nr_cpu_ids) - 1
651 * For example, if 64 cpus are possible, rps_cpu_mask = 0x3f,
652 * meaning we use 32-6=26 bits for the hash.
646 */ 653 */
647struct rps_sock_flow_table { 654struct rps_sock_flow_table {
648 unsigned int mask; 655 u32 mask;
649 u16 ents[0]; 656
657 u32 ents[0] ____cacheline_aligned_in_smp;
650}; 658};
651#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \ 659#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (offsetof(struct rps_sock_flow_table, ents[_num]))
652 ((_num) * sizeof(u16)))
653 660
654#define RPS_NO_CPU 0xffff 661#define RPS_NO_CPU 0xffff
655 662
663extern u32 rps_cpu_mask;
664extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
665
656static inline void rps_record_sock_flow(struct rps_sock_flow_table *table, 666static inline void rps_record_sock_flow(struct rps_sock_flow_table *table,
657 u32 hash) 667 u32 hash)
658{ 668{
659 if (table && hash) { 669 if (table && hash) {
660 unsigned int cpu, index = hash & table->mask; 670 unsigned int index = hash & table->mask;
671 u32 val = hash & ~rps_cpu_mask;
661 672
662 /* We only give a hint, preemption can change cpu under us */ 673 /* We only give a hint, preemption can change cpu under us */
663 cpu = raw_smp_processor_id(); 674 val |= raw_smp_processor_id();
664 675
665 if (table->ents[index] != cpu) 676 if (table->ents[index] != val)
666 table->ents[index] = cpu; 677 table->ents[index] = val;
667 } 678 }
668} 679}
669 680
670static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
671 u32 hash)
672{
673 if (table && hash)
674 table->ents[hash & table->mask] = RPS_NO_CPU;
675}
676
677extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
678
679#ifdef CONFIG_RFS_ACCEL 681#ifdef CONFIG_RFS_ACCEL
680bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id, 682bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
681 u16 filter_id); 683 u16 filter_id);
@@ -1154,13 +1156,15 @@ struct net_device_ops {
1154 int idx); 1156 int idx);
1155 1157
1156 int (*ndo_bridge_setlink)(struct net_device *dev, 1158 int (*ndo_bridge_setlink)(struct net_device *dev,
1157 struct nlmsghdr *nlh); 1159 struct nlmsghdr *nlh,
1160 u16 flags);
1158 int (*ndo_bridge_getlink)(struct sk_buff *skb, 1161 int (*ndo_bridge_getlink)(struct sk_buff *skb,
1159 u32 pid, u32 seq, 1162 u32 pid, u32 seq,
1160 struct net_device *dev, 1163 struct net_device *dev,
1161 u32 filter_mask); 1164 u32 filter_mask);
1162 int (*ndo_bridge_dellink)(struct net_device *dev, 1165 int (*ndo_bridge_dellink)(struct net_device *dev,
1163 struct nlmsghdr *nlh); 1166 struct nlmsghdr *nlh,
1167 u16 flags);
1164 int (*ndo_change_carrier)(struct net_device *dev, 1168 int (*ndo_change_carrier)(struct net_device *dev,
1165 bool new_carrier); 1169 bool new_carrier);
1166 int (*ndo_get_phys_port_id)(struct net_device *dev, 1170 int (*ndo_get_phys_port_id)(struct net_device *dev,
@@ -1514,6 +1518,8 @@ struct net_device {
1514 struct list_head napi_list; 1518 struct list_head napi_list;
1515 struct list_head unreg_list; 1519 struct list_head unreg_list;
1516 struct list_head close_list; 1520 struct list_head close_list;
1521 struct list_head ptype_all;
1522 struct list_head ptype_specific;
1517 1523
1518 struct { 1524 struct {
1519 struct list_head upper; 1525 struct list_head upper;
@@ -1969,7 +1975,7 @@ struct offload_callbacks {
1969 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1975 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1970 netdev_features_t features); 1976 netdev_features_t features);
1971 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1977 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1972 struct sk_buff *skb); 1978 struct sk_buff *skb);
1973 int (*gro_complete)(struct sk_buff *skb, int nhoff); 1979 int (*gro_complete)(struct sk_buff *skb, int nhoff);
1974}; 1980};
1975 1981
@@ -1979,10 +1985,21 @@ struct packet_offload {
1979 struct list_head list; 1985 struct list_head list;
1980}; 1986};
1981 1987
1988struct udp_offload;
1989
1990struct udp_offload_callbacks {
1991 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1992 struct sk_buff *skb,
1993 struct udp_offload *uoff);
1994 int (*gro_complete)(struct sk_buff *skb,
1995 int nhoff,
1996 struct udp_offload *uoff);
1997};
1998
1982struct udp_offload { 1999struct udp_offload {
1983 __be16 port; 2000 __be16 port;
1984 u8 ipproto; 2001 u8 ipproto;
1985 struct offload_callbacks callbacks; 2002 struct udp_offload_callbacks callbacks;
1986}; 2003};
1987 2004
1988/* often modified stats are per cpu, other are shared (netdev->stats) */ 2005/* often modified stats are per cpu, other are shared (netdev->stats) */
@@ -2041,6 +2058,7 @@ struct pcpu_sw_netstats {
2041#define NETDEV_RESEND_IGMP 0x0016 2058#define NETDEV_RESEND_IGMP 0x0016
2042#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ 2059#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */
2043#define NETDEV_CHANGEINFODATA 0x0018 2060#define NETDEV_CHANGEINFODATA 0x0018
2061#define NETDEV_BONDING_INFO 0x0019
2044 2062
2045int register_netdevice_notifier(struct notifier_block *nb); 2063int register_netdevice_notifier(struct notifier_block *nb);
2046int unregister_netdevice_notifier(struct notifier_block *nb); 2064int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2303,6 +2321,21 @@ do { \
2303 compute_pseudo(skb, proto)); \ 2321 compute_pseudo(skb, proto)); \
2304} while (0) 2322} while (0)
2305 2323
2324static inline void skb_gro_remcsum_process(struct sk_buff *skb, void *ptr,
2325 int start, int offset)
2326{
2327 __wsum delta;
2328
2329 BUG_ON(!NAPI_GRO_CB(skb)->csum_valid);
2330
2331 delta = remcsum_adjust(ptr, NAPI_GRO_CB(skb)->csum, start, offset);
2332
2333 /* Adjust skb->csum since we changed the packet */
2334 skb->csum = csum_add(skb->csum, delta);
2335 NAPI_GRO_CB(skb)->csum = csum_add(NAPI_GRO_CB(skb)->csum, delta);
2336}
2337
2338
2306static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 2339static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
2307 unsigned short type, 2340 unsigned short type,
2308 const void *daddr, const void *saddr, 2341 const void *daddr, const void *saddr,
@@ -3464,6 +3497,19 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
3464struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, 3497struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
3465 netdev_features_t features); 3498 netdev_features_t features);
3466 3499
3500struct netdev_bonding_info {
3501 ifslave slave;
3502 ifbond master;
3503};
3504
3505struct netdev_notifier_bonding_info {
3506 struct netdev_notifier_info info; /* must be first */
3507 struct netdev_bonding_info bonding_info;
3508};
3509
3510void netdev_bonding_info_change(struct net_device *dev,
3511 struct netdev_bonding_info *bonding_info);
3512
3467static inline 3513static inline
3468struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) 3514struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
3469{ 3515{