diff options
Diffstat (limited to 'include/net')
51 files changed, 1323 insertions, 225 deletions
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h index 2f6a3f2233ed..da3a77d25fcb 100644 --- a/include/net/6lowpan.h +++ b/include/net/6lowpan.h | |||
| @@ -75,6 +75,8 @@ | |||
| 75 | #define LOWPAN_IPHC_MAX_HC_BUF_LEN (sizeof(struct ipv6hdr) + \ | 75 | #define LOWPAN_IPHC_MAX_HC_BUF_LEN (sizeof(struct ipv6hdr) + \ |
| 76 | LOWPAN_IPHC_MAX_HEADER_LEN + \ | 76 | LOWPAN_IPHC_MAX_HEADER_LEN + \ |
| 77 | LOWPAN_NHC_MAX_HDR_LEN) | 77 | LOWPAN_NHC_MAX_HDR_LEN) |
| 78 | /* SCI/DCI is 4 bit width, so we have maximum 16 entries */ | ||
| 79 | #define LOWPAN_IPHC_CTX_TABLE_SIZE (1 << 4) | ||
| 78 | 80 | ||
| 79 | #define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */ | 81 | #define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */ |
| 80 | #define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */ | 82 | #define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */ |
| @@ -98,9 +100,39 @@ enum lowpan_lltypes { | |||
| 98 | LOWPAN_LLTYPE_IEEE802154, | 100 | LOWPAN_LLTYPE_IEEE802154, |
| 99 | }; | 101 | }; |
| 100 | 102 | ||
| 103 | enum lowpan_iphc_ctx_flags { | ||
| 104 | LOWPAN_IPHC_CTX_FLAG_ACTIVE, | ||
| 105 | LOWPAN_IPHC_CTX_FLAG_COMPRESSION, | ||
| 106 | }; | ||
| 107 | |||
| 108 | struct lowpan_iphc_ctx { | ||
| 109 | u8 id; | ||
| 110 | struct in6_addr pfx; | ||
| 111 | u8 plen; | ||
| 112 | unsigned long flags; | ||
| 113 | }; | ||
| 114 | |||
| 115 | struct lowpan_iphc_ctx_table { | ||
| 116 | spinlock_t lock; | ||
| 117 | const struct lowpan_iphc_ctx_ops *ops; | ||
| 118 | struct lowpan_iphc_ctx table[LOWPAN_IPHC_CTX_TABLE_SIZE]; | ||
| 119 | }; | ||
| 120 | |||
| 121 | static inline bool lowpan_iphc_ctx_is_active(const struct lowpan_iphc_ctx *ctx) | ||
| 122 | { | ||
| 123 | return test_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE, &ctx->flags); | ||
| 124 | } | ||
| 125 | |||
| 126 | static inline bool | ||
| 127 | lowpan_iphc_ctx_is_compression(const struct lowpan_iphc_ctx *ctx) | ||
| 128 | { | ||
| 129 | return test_bit(LOWPAN_IPHC_CTX_FLAG_COMPRESSION, &ctx->flags); | ||
| 130 | } | ||
| 131 | |||
| 101 | struct lowpan_priv { | 132 | struct lowpan_priv { |
| 102 | enum lowpan_lltypes lltype; | 133 | enum lowpan_lltypes lltype; |
| 103 | struct dentry *iface_debugfs; | 134 | struct dentry *iface_debugfs; |
| 135 | struct lowpan_iphc_ctx_table ctx; | ||
| 104 | 136 | ||
| 105 | /* must be last */ | 137 | /* must be last */ |
| 106 | u8 priv[0] __aligned(sizeof(void *)); | 138 | u8 priv[0] __aligned(sizeof(void *)); |
diff --git a/include/net/act_api.h b/include/net/act_api.h index 9d446f136607..2a19fe111c78 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | 7 | ||
| 8 | #include <net/sch_generic.h> | 8 | #include <net/sch_generic.h> |
| 9 | #include <net/pkt_sched.h> | 9 | #include <net/pkt_sched.h> |
| 10 | #include <net/net_namespace.h> | ||
| 11 | #include <net/netns/generic.h> | ||
| 10 | 12 | ||
| 11 | struct tcf_common { | 13 | struct tcf_common { |
| 12 | struct hlist_node tcfc_head; | 14 | struct hlist_node tcfc_head; |
| @@ -65,11 +67,6 @@ static inline int tcf_hashinfo_init(struct tcf_hashinfo *hf, unsigned int mask) | |||
| 65 | return 0; | 67 | return 0; |
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | static inline void tcf_hashinfo_destroy(struct tcf_hashinfo *hf) | ||
| 69 | { | ||
| 70 | kfree(hf->htab); | ||
| 71 | } | ||
| 72 | |||
| 73 | /* Update lastuse only if needed, to avoid dirtying a cache line. | 70 | /* Update lastuse only if needed, to avoid dirtying a cache line. |
| 74 | * We use a temp variable to avoid fetching jiffies twice. | 71 | * We use a temp variable to avoid fetching jiffies twice. |
| 75 | */ | 72 | */ |
| @@ -81,42 +78,76 @@ static inline void tcf_lastuse_update(struct tcf_t *tm) | |||
| 81 | tm->lastuse = now; | 78 | tm->lastuse = now; |
| 82 | } | 79 | } |
| 83 | 80 | ||
| 84 | #ifdef CONFIG_NET_CLS_ACT | ||
| 85 | |||
| 86 | #define ACT_P_CREATED 1 | ||
| 87 | #define ACT_P_DELETED 1 | ||
| 88 | |||
| 89 | struct tc_action { | 81 | struct tc_action { |
| 90 | void *priv; | 82 | void *priv; |
| 91 | const struct tc_action_ops *ops; | 83 | const struct tc_action_ops *ops; |
| 92 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ | 84 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ |
| 93 | __u32 order; | 85 | __u32 order; |
| 94 | struct list_head list; | 86 | struct list_head list; |
| 87 | struct tcf_hashinfo *hinfo; | ||
| 95 | }; | 88 | }; |
| 96 | 89 | ||
| 90 | #ifdef CONFIG_NET_CLS_ACT | ||
| 91 | |||
| 92 | #define ACT_P_CREATED 1 | ||
| 93 | #define ACT_P_DELETED 1 | ||
| 94 | |||
| 97 | struct tc_action_ops { | 95 | struct tc_action_ops { |
| 98 | struct list_head head; | 96 | struct list_head head; |
| 99 | struct tcf_hashinfo *hinfo; | ||
| 100 | char kind[IFNAMSIZ]; | 97 | char kind[IFNAMSIZ]; |
| 101 | __u32 type; /* TBD to match kind */ | 98 | __u32 type; /* TBD to match kind */ |
| 102 | struct module *owner; | 99 | struct module *owner; |
| 103 | int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); | 100 | int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); |
| 104 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); | 101 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); |
| 105 | void (*cleanup)(struct tc_action *, int bind); | 102 | void (*cleanup)(struct tc_action *, int bind); |
| 106 | int (*lookup)(struct tc_action *, u32); | 103 | int (*lookup)(struct net *, struct tc_action *, u32); |
| 107 | int (*init)(struct net *net, struct nlattr *nla, | 104 | int (*init)(struct net *net, struct nlattr *nla, |
| 108 | struct nlattr *est, struct tc_action *act, int ovr, | 105 | struct nlattr *est, struct tc_action *act, int ovr, |
| 109 | int bind); | 106 | int bind); |
| 110 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); | 107 | int (*walk)(struct net *, struct sk_buff *, |
| 108 | struct netlink_callback *, int, struct tc_action *); | ||
| 109 | }; | ||
| 110 | |||
| 111 | struct tc_action_net { | ||
| 112 | struct tcf_hashinfo *hinfo; | ||
| 113 | const struct tc_action_ops *ops; | ||
| 111 | }; | 114 | }; |
| 112 | 115 | ||
| 113 | int tcf_hash_search(struct tc_action *a, u32 index); | 116 | static inline |
| 114 | u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo); | 117 | int tc_action_net_init(struct tc_action_net *tn, const struct tc_action_ops *ops, |
| 115 | int tcf_hash_check(u32 index, struct tc_action *a, int bind); | 118 | unsigned int mask) |
| 116 | int tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a, | 119 | { |
| 117 | int size, int bind, bool cpustats); | 120 | int err = 0; |
| 121 | |||
| 122 | tn->hinfo = kmalloc(sizeof(*tn->hinfo), GFP_KERNEL); | ||
| 123 | if (!tn->hinfo) | ||
| 124 | return -ENOMEM; | ||
| 125 | tn->ops = ops; | ||
| 126 | err = tcf_hashinfo_init(tn->hinfo, mask); | ||
| 127 | if (err) | ||
| 128 | kfree(tn->hinfo); | ||
| 129 | return err; | ||
| 130 | } | ||
| 131 | |||
| 132 | void tcf_hashinfo_destroy(const struct tc_action_ops *ops, | ||
| 133 | struct tcf_hashinfo *hinfo); | ||
| 134 | |||
| 135 | static inline void tc_action_net_exit(struct tc_action_net *tn) | ||
| 136 | { | ||
| 137 | tcf_hashinfo_destroy(tn->ops, tn->hinfo); | ||
| 138 | } | ||
| 139 | |||
| 140 | int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, | ||
| 141 | struct netlink_callback *cb, int type, | ||
| 142 | struct tc_action *a); | ||
| 143 | int tcf_hash_search(struct tc_action_net *tn, struct tc_action *a, u32 index); | ||
| 144 | u32 tcf_hash_new_index(struct tc_action_net *tn); | ||
| 145 | int tcf_hash_check(struct tc_action_net *tn, u32 index, struct tc_action *a, | ||
| 146 | int bind); | ||
| 147 | int tcf_hash_create(struct tc_action_net *tn, u32 index, struct nlattr *est, | ||
| 148 | struct tc_action *a, int size, int bind, bool cpustats); | ||
| 118 | void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est); | 149 | void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est); |
| 119 | void tcf_hash_insert(struct tc_action *a); | 150 | void tcf_hash_insert(struct tc_action_net *tn, struct tc_action *a); |
| 120 | 151 | ||
| 121 | int __tcf_hash_release(struct tc_action *a, bool bind, bool strict); | 152 | int __tcf_hash_release(struct tc_action *a, bool bind, bool strict); |
| 122 | 153 | ||
| @@ -125,8 +156,8 @@ static inline int tcf_hash_release(struct tc_action *a, bool bind) | |||
| 125 | return __tcf_hash_release(a, bind, false); | 156 | return __tcf_hash_release(a, bind, false); |
| 126 | } | 157 | } |
| 127 | 158 | ||
| 128 | int tcf_register_action(struct tc_action_ops *a, unsigned int mask); | 159 | int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops); |
| 129 | int tcf_unregister_action(struct tc_action_ops *a); | 160 | int tcf_unregister_action(struct tc_action_ops *a, struct pernet_operations *ops); |
| 130 | int tcf_action_destroy(struct list_head *actions, int bind); | 161 | int tcf_action_destroy(struct list_head *actions, int bind); |
| 131 | int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions, | 162 | int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions, |
| 132 | struct tcf_result *res); | 163 | struct tcf_result *res); |
| @@ -140,5 +171,16 @@ int tcf_action_dump(struct sk_buff *skb, struct list_head *, int, int); | |||
| 140 | int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); | 171 | int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); |
| 141 | int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); | 172 | int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); |
| 142 | int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int); | 173 | int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int); |
| 174 | |||
| 175 | #define tc_no_actions(_exts) \ | ||
| 176 | (list_empty(&(_exts)->actions)) | ||
| 177 | |||
| 178 | #define tc_for_each_action(_a, _exts) \ | ||
| 179 | list_for_each_entry(a, &(_exts)->actions, list) | ||
| 180 | #else /* CONFIG_NET_CLS_ACT */ | ||
| 181 | |||
| 182 | #define tc_no_actions(_exts) true | ||
| 183 | #define tc_for_each_action(_a, _exts) while (0) | ||
| 184 | |||
| 143 | #endif /* CONFIG_NET_CLS_ACT */ | 185 | #endif /* CONFIG_NET_CLS_ACT */ |
| 144 | #endif | 186 | #endif |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 47f52d3cd8df..730d856683e5 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
| @@ -87,6 +87,8 @@ int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr, | |||
| 87 | u32 banned_flags); | 87 | u32 banned_flags); |
| 88 | int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, | 88 | int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, |
| 89 | u32 banned_flags); | 89 | u32 banned_flags); |
| 90 | int ipv4_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, | ||
| 91 | bool match_wildcard); | ||
| 90 | int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, | 92 | int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, |
| 91 | bool match_wildcard); | 93 | bool match_wildcard); |
| 92 | void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr); | 94 | void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr); |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 339ea57be423..5d38d980b89d 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -233,6 +233,7 @@ enum { | |||
| 233 | HCI_SC_ENABLED, | 233 | HCI_SC_ENABLED, |
| 234 | HCI_SC_ONLY, | 234 | HCI_SC_ONLY, |
| 235 | HCI_PRIVACY, | 235 | HCI_PRIVACY, |
| 236 | HCI_LIMITED_PRIVACY, | ||
| 236 | HCI_RPA_EXPIRED, | 237 | HCI_RPA_EXPIRED, |
| 237 | HCI_RPA_RESOLVING, | 238 | HCI_RPA_RESOLVING, |
| 238 | HCI_HS_ENABLED, | 239 | HCI_HS_ENABLED, |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index d4f82edb5cff..dc71473462ac 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #ifndef __HCI_CORE_H | 25 | #ifndef __HCI_CORE_H |
| 26 | #define __HCI_CORE_H | 26 | #define __HCI_CORE_H |
| 27 | 27 | ||
| 28 | #include <linux/leds.h> | ||
| 28 | #include <net/bluetooth/hci.h> | 29 | #include <net/bluetooth/hci.h> |
| 29 | #include <net/bluetooth/hci_sock.h> | 30 | #include <net/bluetooth/hci_sock.h> |
| 30 | 31 | ||
| @@ -396,6 +397,8 @@ struct hci_dev { | |||
| 396 | struct delayed_work rpa_expired; | 397 | struct delayed_work rpa_expired; |
| 397 | bdaddr_t rpa; | 398 | bdaddr_t rpa; |
| 398 | 399 | ||
| 400 | struct led_trigger *power_led; | ||
| 401 | |||
| 399 | int (*open)(struct hci_dev *hdev); | 402 | int (*open)(struct hci_dev *hdev); |
| 400 | int (*close)(struct hci_dev *hdev); | 403 | int (*close)(struct hci_dev *hdev); |
| 401 | int (*flush)(struct hci_dev *hdev); | 404 | int (*flush)(struct hci_dev *hdev); |
diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h index f1fbc3b11962..f358ad5e4214 100644 --- a/include/net/bond_3ad.h +++ b/include/net/bond_3ad.h | |||
| @@ -306,5 +306,6 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, | |||
| 306 | struct slave *slave); | 306 | struct slave *slave); |
| 307 | int bond_3ad_set_carrier(struct bonding *bond); | 307 | int bond_3ad_set_carrier(struct bonding *bond); |
| 308 | void bond_3ad_update_lacp_rate(struct bonding *bond); | 308 | void bond_3ad_update_lacp_rate(struct bonding *bond); |
| 309 | void bond_3ad_update_ad_actor_settings(struct bonding *bond); | ||
| 309 | #endif /* _NET_BOND_3AD_H */ | 310 | #endif /* _NET_BOND_3AD_H */ |
| 310 | 311 | ||
diff --git a/include/net/bonding.h b/include/net/bonding.h index ee6c52053aa3..791800ddd6d9 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h | |||
| @@ -215,6 +215,7 @@ struct bonding { | |||
| 215 | * ALB mode (6) - to sync the use and modifications of its hash table | 215 | * ALB mode (6) - to sync the use and modifications of its hash table |
| 216 | */ | 216 | */ |
| 217 | spinlock_t mode_lock; | 217 | spinlock_t mode_lock; |
| 218 | spinlock_t stats_lock; | ||
| 218 | u8 send_peer_notif; | 219 | u8 send_peer_notif; |
| 219 | u8 igmp_retrans; | 220 | u8 igmp_retrans; |
| 220 | #ifdef CONFIG_PROC_FS | 221 | #ifdef CONFIG_PROC_FS |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9bcaaf7cd15a..9e1b24c29f0c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -712,6 +712,8 @@ struct cfg80211_acl_data { | |||
| 712 | * @p2p_opp_ps: P2P opportunistic PS | 712 | * @p2p_opp_ps: P2P opportunistic PS |
| 713 | * @acl: ACL configuration used by the drivers which has support for | 713 | * @acl: ACL configuration used by the drivers which has support for |
| 714 | * MAC address based access control | 714 | * MAC address based access control |
| 715 | * @pbss: If set, start as a PCP instead of AP. Relevant for DMG | ||
| 716 | * networks. | ||
| 715 | */ | 717 | */ |
| 716 | struct cfg80211_ap_settings { | 718 | struct cfg80211_ap_settings { |
| 717 | struct cfg80211_chan_def chandef; | 719 | struct cfg80211_chan_def chandef; |
| @@ -730,6 +732,7 @@ struct cfg80211_ap_settings { | |||
| 730 | u8 p2p_ctwindow; | 732 | u8 p2p_ctwindow; |
| 731 | bool p2p_opp_ps; | 733 | bool p2p_opp_ps; |
| 732 | const struct cfg80211_acl_data *acl; | 734 | const struct cfg80211_acl_data *acl; |
| 735 | bool pbss; | ||
| 733 | }; | 736 | }; |
| 734 | 737 | ||
| 735 | /** | 738 | /** |
| @@ -1888,6 +1891,8 @@ struct cfg80211_ibss_params { | |||
| 1888 | * @ht_capa_mask: The bits of ht_capa which are to be used. | 1891 | * @ht_capa_mask: The bits of ht_capa which are to be used. |
| 1889 | * @vht_capa: VHT Capability overrides | 1892 | * @vht_capa: VHT Capability overrides |
| 1890 | * @vht_capa_mask: The bits of vht_capa which are to be used. | 1893 | * @vht_capa_mask: The bits of vht_capa which are to be used. |
| 1894 | * @pbss: if set, connect to a PCP instead of AP. Valid for DMG | ||
| 1895 | * networks. | ||
| 1891 | */ | 1896 | */ |
| 1892 | struct cfg80211_connect_params { | 1897 | struct cfg80211_connect_params { |
| 1893 | struct ieee80211_channel *channel; | 1898 | struct ieee80211_channel *channel; |
| @@ -1910,6 +1915,7 @@ struct cfg80211_connect_params { | |||
| 1910 | struct ieee80211_ht_cap ht_capa_mask; | 1915 | struct ieee80211_ht_cap ht_capa_mask; |
| 1911 | struct ieee80211_vht_cap vht_capa; | 1916 | struct ieee80211_vht_cap vht_capa; |
| 1912 | struct ieee80211_vht_cap vht_capa_mask; | 1917 | struct ieee80211_vht_cap vht_capa_mask; |
| 1918 | bool pbss; | ||
| 1913 | }; | 1919 | }; |
| 1914 | 1920 | ||
| 1915 | /** | 1921 | /** |
| @@ -3489,6 +3495,7 @@ struct cfg80211_cached_keys; | |||
| 3489 | * registered for unexpected class 3 frames (AP mode) | 3495 | * registered for unexpected class 3 frames (AP mode) |
| 3490 | * @conn: (private) cfg80211 software SME connection state machine data | 3496 | * @conn: (private) cfg80211 software SME connection state machine data |
| 3491 | * @connect_keys: (private) keys to set after connection is established | 3497 | * @connect_keys: (private) keys to set after connection is established |
| 3498 | * @conn_bss_type: connecting/connected BSS type | ||
| 3492 | * @ibss_fixed: (private) IBSS is using fixed BSSID | 3499 | * @ibss_fixed: (private) IBSS is using fixed BSSID |
| 3493 | * @ibss_dfs_possible: (private) IBSS may change to a DFS channel | 3500 | * @ibss_dfs_possible: (private) IBSS may change to a DFS channel |
| 3494 | * @event_list: (private) list for internal event processing | 3501 | * @event_list: (private) list for internal event processing |
| @@ -3519,6 +3526,7 @@ struct wireless_dev { | |||
| 3519 | u8 ssid_len, mesh_id_len, mesh_id_up_len; | 3526 | u8 ssid_len, mesh_id_len, mesh_id_up_len; |
| 3520 | struct cfg80211_conn *conn; | 3527 | struct cfg80211_conn *conn; |
| 3521 | struct cfg80211_cached_keys *connect_keys; | 3528 | struct cfg80211_cached_keys *connect_keys; |
| 3529 | enum ieee80211_bss_type conn_bss_type; | ||
| 3522 | 3530 | ||
| 3523 | struct list_head event_list; | 3531 | struct list_head event_list; |
| 3524 | spinlock_t event_lock; | 3532 | spinlock_t event_lock; |
diff --git a/include/net/checksum.h b/include/net/checksum.h index 10a16b5bd1c7..5c30891e84e5 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h | |||
| @@ -88,8 +88,11 @@ static inline __wsum | |||
| 88 | csum_block_add(__wsum csum, __wsum csum2, int offset) | 88 | csum_block_add(__wsum csum, __wsum csum2, int offset) |
| 89 | { | 89 | { |
| 90 | u32 sum = (__force u32)csum2; | 90 | u32 sum = (__force u32)csum2; |
| 91 | if (offset&1) | 91 | |
| 92 | sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF); | 92 | /* rotate sum to align it with a 16b boundary */ |
| 93 | if (offset & 1) | ||
| 94 | sum = ror32(sum, 8); | ||
| 95 | |||
| 93 | return csum_add(csum, (__force __wsum)sum); | 96 | return csum_add(csum, (__force __wsum)sum); |
| 94 | } | 97 | } |
| 95 | 98 | ||
| @@ -102,10 +105,7 @@ csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len) | |||
| 102 | static inline __wsum | 105 | static inline __wsum |
| 103 | csum_block_sub(__wsum csum, __wsum csum2, int offset) | 106 | csum_block_sub(__wsum csum, __wsum csum2, int offset) |
| 104 | { | 107 | { |
| 105 | u32 sum = (__force u32)csum2; | 108 | return csum_block_add(csum, ~csum2, offset); |
| 106 | if (offset&1) | ||
| 107 | sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF); | ||
| 108 | return csum_sub(csum, (__force __wsum)sum); | ||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static inline __wsum csum_unfold(__sum16 n) | 111 | static inline __wsum csum_unfold(__sum16 n) |
| @@ -120,6 +120,11 @@ static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum) | |||
| 120 | 120 | ||
| 121 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) | 121 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) |
| 122 | 122 | ||
| 123 | static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff) | ||
| 124 | { | ||
| 125 | *sum = csum_fold(csum_add(diff, ~csum_unfold(*sum))); | ||
| 126 | } | ||
| 127 | |||
| 123 | static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) | 128 | static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) |
| 124 | { | 129 | { |
| 125 | __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from); | 130 | __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from); |
diff --git a/include/net/codel.h b/include/net/codel.h index 267e70210061..d168aca115cc 100644 --- a/include/net/codel.h +++ b/include/net/codel.h | |||
| @@ -162,12 +162,14 @@ struct codel_vars { | |||
| 162 | * struct codel_stats - contains codel shared variables and stats | 162 | * struct codel_stats - contains codel shared variables and stats |
| 163 | * @maxpacket: largest packet we've seen so far | 163 | * @maxpacket: largest packet we've seen so far |
| 164 | * @drop_count: temp count of dropped packets in dequeue() | 164 | * @drop_count: temp count of dropped packets in dequeue() |
| 165 | * @drop_len: bytes of dropped packets in dequeue() | ||
| 165 | * ecn_mark: number of packets we ECN marked instead of dropping | 166 | * ecn_mark: number of packets we ECN marked instead of dropping |
| 166 | * ce_mark: number of packets CE marked because sojourn time was above ce_threshold | 167 | * ce_mark: number of packets CE marked because sojourn time was above ce_threshold |
| 167 | */ | 168 | */ |
| 168 | struct codel_stats { | 169 | struct codel_stats { |
| 169 | u32 maxpacket; | 170 | u32 maxpacket; |
| 170 | u32 drop_count; | 171 | u32 drop_count; |
| 172 | u32 drop_len; | ||
| 171 | u32 ecn_mark; | 173 | u32 ecn_mark; |
| 172 | u32 ce_mark; | 174 | u32 ce_mark; |
| 173 | }; | 175 | }; |
| @@ -308,6 +310,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch, | |||
| 308 | vars->rec_inv_sqrt); | 310 | vars->rec_inv_sqrt); |
| 309 | goto end; | 311 | goto end; |
| 310 | } | 312 | } |
| 313 | stats->drop_len += qdisc_pkt_len(skb); | ||
| 311 | qdisc_drop(skb, sch); | 314 | qdisc_drop(skb, sch); |
| 312 | stats->drop_count++; | 315 | stats->drop_count++; |
| 313 | skb = dequeue_func(vars, sch); | 316 | skb = dequeue_func(vars, sch); |
| @@ -330,6 +333,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch, | |||
| 330 | if (params->ecn && INET_ECN_set_ce(skb)) { | 333 | if (params->ecn && INET_ECN_set_ce(skb)) { |
| 331 | stats->ecn_mark++; | 334 | stats->ecn_mark++; |
| 332 | } else { | 335 | } else { |
| 336 | stats->drop_len += qdisc_pkt_len(skb); | ||
| 333 | qdisc_drop(skb, sch); | 337 | qdisc_drop(skb, sch); |
| 334 | stats->drop_count++; | 338 | stats->drop_count++; |
| 335 | 339 | ||
diff --git a/include/net/devlink.h b/include/net/devlink.h new file mode 100644 index 000000000000..c37d257891d6 --- /dev/null +++ b/include/net/devlink.h | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /* | ||
| 2 | * include/net/devlink.h - Network physical device Netlink interface | ||
| 3 | * Copyright (c) 2016 Mellanox Technologies. All rights reserved. | ||
| 4 | * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | */ | ||
| 11 | #ifndef _NET_DEVLINK_H_ | ||
| 12 | #define _NET_DEVLINK_H_ | ||
| 13 | |||
| 14 | #include <linux/device.h> | ||
| 15 | #include <linux/slab.h> | ||
| 16 | #include <linux/gfp.h> | ||
| 17 | #include <linux/list.h> | ||
| 18 | #include <linux/netdevice.h> | ||
| 19 | #include <net/net_namespace.h> | ||
| 20 | #include <uapi/linux/devlink.h> | ||
| 21 | |||
| 22 | struct devlink_ops; | ||
| 23 | |||
| 24 | struct devlink { | ||
| 25 | struct list_head list; | ||
| 26 | struct list_head port_list; | ||
| 27 | const struct devlink_ops *ops; | ||
| 28 | struct device *dev; | ||
| 29 | possible_net_t _net; | ||
| 30 | char priv[0] __aligned(NETDEV_ALIGN); | ||
| 31 | }; | ||
| 32 | |||
| 33 | struct devlink_port { | ||
| 34 | struct list_head list; | ||
| 35 | struct devlink *devlink; | ||
| 36 | unsigned index; | ||
| 37 | bool registered; | ||
| 38 | enum devlink_port_type type; | ||
| 39 | enum devlink_port_type desired_type; | ||
| 40 | void *type_dev; | ||
| 41 | bool split; | ||
| 42 | u32 split_group; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct devlink_ops { | ||
| 46 | size_t priv_size; | ||
| 47 | int (*port_type_set)(struct devlink_port *devlink_port, | ||
| 48 | enum devlink_port_type port_type); | ||
| 49 | int (*port_split)(struct devlink *devlink, unsigned int port_index, | ||
| 50 | unsigned int count); | ||
| 51 | int (*port_unsplit)(struct devlink *devlink, unsigned int port_index); | ||
| 52 | }; | ||
| 53 | |||
| 54 | static inline void *devlink_priv(struct devlink *devlink) | ||
| 55 | { | ||
| 56 | BUG_ON(!devlink); | ||
| 57 | return &devlink->priv; | ||
| 58 | } | ||
| 59 | |||
| 60 | static inline struct devlink *priv_to_devlink(void *priv) | ||
| 61 | { | ||
| 62 | BUG_ON(!priv); | ||
| 63 | return container_of(priv, struct devlink, priv); | ||
| 64 | } | ||
| 65 | |||
| 66 | struct ib_device; | ||
| 67 | |||
| 68 | #if IS_ENABLED(CONFIG_NET_DEVLINK) | ||
| 69 | |||
| 70 | struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size); | ||
| 71 | int devlink_register(struct devlink *devlink, struct device *dev); | ||
| 72 | void devlink_unregister(struct devlink *devlink); | ||
| 73 | void devlink_free(struct devlink *devlink); | ||
| 74 | int devlink_port_register(struct devlink *devlink, | ||
| 75 | struct devlink_port *devlink_port, | ||
| 76 | unsigned int port_index); | ||
| 77 | void devlink_port_unregister(struct devlink_port *devlink_port); | ||
| 78 | void devlink_port_type_eth_set(struct devlink_port *devlink_port, | ||
| 79 | struct net_device *netdev); | ||
| 80 | void devlink_port_type_ib_set(struct devlink_port *devlink_port, | ||
| 81 | struct ib_device *ibdev); | ||
| 82 | void devlink_port_type_clear(struct devlink_port *devlink_port); | ||
| 83 | void devlink_port_split_set(struct devlink_port *devlink_port, | ||
| 84 | u32 split_group); | ||
| 85 | |||
| 86 | #else | ||
| 87 | |||
| 88 | static inline struct devlink *devlink_alloc(const struct devlink_ops *ops, | ||
| 89 | size_t priv_size) | ||
| 90 | { | ||
| 91 | return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL); | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline int devlink_register(struct devlink *devlink, struct device *dev) | ||
| 95 | { | ||
| 96 | return 0; | ||
| 97 | } | ||
| 98 | |||
| 99 | static inline void devlink_unregister(struct devlink *devlink) | ||
| 100 | { | ||
| 101 | } | ||
| 102 | |||
| 103 | static inline void devlink_free(struct devlink *devlink) | ||
| 104 | { | ||
| 105 | kfree(devlink); | ||
| 106 | } | ||
| 107 | |||
| 108 | static inline int devlink_port_register(struct devlink *devlink, | ||
| 109 | struct devlink_port *devlink_port, | ||
| 110 | unsigned int port_index) | ||
| 111 | { | ||
| 112 | return 0; | ||
| 113 | } | ||
| 114 | |||
| 115 | static inline void devlink_port_unregister(struct devlink_port *devlink_port) | ||
| 116 | { | ||
| 117 | } | ||
| 118 | |||
| 119 | static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port, | ||
| 120 | struct net_device *netdev) | ||
| 121 | { | ||
| 122 | } | ||
| 123 | |||
| 124 | static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port, | ||
| 125 | struct ib_device *ibdev) | ||
| 126 | { | ||
| 127 | } | ||
| 128 | |||
| 129 | static inline void devlink_port_type_clear(struct devlink_port *devlink_port) | ||
| 130 | { | ||
| 131 | } | ||
| 132 | |||
| 133 | static inline void devlink_port_split_set(struct devlink_port *devlink_port, | ||
| 134 | u32 split_group) | ||
| 135 | { | ||
| 136 | } | ||
| 137 | |||
| 138 | #endif | ||
| 139 | |||
| 140 | #endif /* _NET_DEVLINK_H_ */ | ||
diff --git a/include/net/dsa.h b/include/net/dsa.h index 26a0e86e611e..6463bb2863ac 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
| @@ -296,16 +296,17 @@ struct dsa_switch_driver { | |||
| 296 | /* | 296 | /* |
| 297 | * Bridge integration | 297 | * Bridge integration |
| 298 | */ | 298 | */ |
| 299 | int (*port_join_bridge)(struct dsa_switch *ds, int port, | 299 | int (*port_bridge_join)(struct dsa_switch *ds, int port, |
| 300 | u32 br_port_mask); | 300 | struct net_device *bridge); |
| 301 | int (*port_leave_bridge)(struct dsa_switch *ds, int port, | 301 | void (*port_bridge_leave)(struct dsa_switch *ds, int port); |
| 302 | u32 br_port_mask); | ||
| 303 | int (*port_stp_update)(struct dsa_switch *ds, int port, | 302 | int (*port_stp_update)(struct dsa_switch *ds, int port, |
| 304 | u8 state); | 303 | u8 state); |
| 305 | 304 | ||
| 306 | /* | 305 | /* |
| 307 | * VLAN support | 306 | * VLAN support |
| 308 | */ | 307 | */ |
| 308 | int (*port_vlan_filtering)(struct dsa_switch *ds, int port, | ||
| 309 | bool vlan_filtering); | ||
| 309 | int (*port_vlan_prepare)(struct dsa_switch *ds, int port, | 310 | int (*port_vlan_prepare)(struct dsa_switch *ds, int port, |
| 310 | const struct switchdev_obj_port_vlan *vlan, | 311 | const struct switchdev_obj_port_vlan *vlan, |
| 311 | struct switchdev_trans *trans); | 312 | struct switchdev_trans *trans); |
| @@ -314,9 +315,9 @@ struct dsa_switch_driver { | |||
| 314 | struct switchdev_trans *trans); | 315 | struct switchdev_trans *trans); |
| 315 | int (*port_vlan_del)(struct dsa_switch *ds, int port, | 316 | int (*port_vlan_del)(struct dsa_switch *ds, int port, |
| 316 | const struct switchdev_obj_port_vlan *vlan); | 317 | const struct switchdev_obj_port_vlan *vlan); |
| 317 | int (*port_pvid_get)(struct dsa_switch *ds, int port, u16 *pvid); | 318 | int (*port_vlan_dump)(struct dsa_switch *ds, int port, |
| 318 | int (*vlan_getnext)(struct dsa_switch *ds, u16 *vid, | 319 | struct switchdev_obj_port_vlan *vlan, |
| 319 | unsigned long *ports, unsigned long *untagged); | 320 | int (*cb)(struct switchdev_obj *obj)); |
| 320 | 321 | ||
| 321 | /* | 322 | /* |
| 322 | * Forwarding database | 323 | * Forwarding database |
diff --git a/include/net/dst.h b/include/net/dst.h index c7329dcd90cc..5c98443c1c9e 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -398,6 +398,18 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev, | |||
| 398 | __skb_tunnel_rx(skb, dev, net); | 398 | __skb_tunnel_rx(skb, dev, net); |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | static inline u32 dst_tclassid(const struct sk_buff *skb) | ||
| 402 | { | ||
| 403 | #ifdef CONFIG_IP_ROUTE_CLASSID | ||
| 404 | const struct dst_entry *dst; | ||
| 405 | |||
| 406 | dst = skb_dst(skb); | ||
| 407 | if (dst) | ||
| 408 | return dst->tclassid; | ||
| 409 | #endif | ||
| 410 | return 0; | ||
| 411 | } | ||
| 412 | |||
| 401 | int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb); | 413 | int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb); |
| 402 | static inline int dst_discard(struct sk_buff *skb) | 414 | static inline int dst_discard(struct sk_buff *skb) |
| 403 | { | 415 | { |
diff --git a/include/net/dst_cache.h b/include/net/dst_cache.h new file mode 100644 index 000000000000..151accae708b --- /dev/null +++ b/include/net/dst_cache.h | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | #ifndef _NET_DST_CACHE_H | ||
| 2 | #define _NET_DST_CACHE_H | ||
| 3 | |||
| 4 | #include <linux/jiffies.h> | ||
| 5 | #include <net/dst.h> | ||
| 6 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 7 | #include <net/ip6_fib.h> | ||
| 8 | #endif | ||
| 9 | |||
| 10 | struct dst_cache { | ||
| 11 | struct dst_cache_pcpu __percpu *cache; | ||
| 12 | unsigned long reset_ts; | ||
| 13 | }; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * dst_cache_get - perform cache lookup | ||
| 17 | * @dst_cache: the cache | ||
| 18 | * | ||
| 19 | * The caller should use dst_cache_get_ip4() if it need to retrieve the | ||
| 20 | * source address to be used when xmitting to the cached dst. | ||
| 21 | * local BH must be disabled. | ||
| 22 | */ | ||
| 23 | struct dst_entry *dst_cache_get(struct dst_cache *dst_cache); | ||
| 24 | |||
| 25 | /** | ||
| 26 | * dst_cache_get_ip4 - perform cache lookup and fetch ipv4 source address | ||
| 27 | * @dst_cache: the cache | ||
| 28 | * @saddr: return value for the retrieved source address | ||
| 29 | * | ||
| 30 | * local BH must be disabled. | ||
| 31 | */ | ||
| 32 | struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr); | ||
| 33 | |||
| 34 | /** | ||
| 35 | * dst_cache_set_ip4 - store the ipv4 dst into the cache | ||
| 36 | * @dst_cache: the cache | ||
| 37 | * @dst: the entry to be cached | ||
| 38 | * @saddr: the source address to be stored inside the cache | ||
| 39 | * | ||
| 40 | * local BH must be disabled. | ||
| 41 | */ | ||
| 42 | void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst, | ||
| 43 | __be32 saddr); | ||
| 44 | |||
| 45 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 46 | |||
| 47 | /** | ||
| 48 | * dst_cache_set_ip6 - store the ipv6 dst into the cache | ||
| 49 | * @dst_cache: the cache | ||
| 50 | * @dst: the entry to be cached | ||
| 51 | * @saddr: the source address to be stored inside the cache | ||
| 52 | * | ||
| 53 | * local BH must be disabled. | ||
| 54 | */ | ||
| 55 | void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst, | ||
| 56 | const struct in6_addr *addr); | ||
| 57 | |||
| 58 | /** | ||
| 59 | * dst_cache_get_ip6 - perform cache lookup and fetch ipv6 source address | ||
| 60 | * @dst_cache: the cache | ||
| 61 | * @saddr: return value for the retrieved source address | ||
| 62 | * | ||
| 63 | * local BH must be disabled. | ||
| 64 | */ | ||
| 65 | struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache, | ||
| 66 | struct in6_addr *saddr); | ||
| 67 | #endif | ||
| 68 | |||
| 69 | /** | ||
| 70 | * dst_cache_reset - invalidate the cache contents | ||
| 71 | * @dst_cache: the cache | ||
| 72 | * | ||
| 73 | * This do not free the cached dst to avoid races and contentions. | ||
| 74 | * the dst will be freed on later cache lookup. | ||
| 75 | */ | ||
| 76 | static inline void dst_cache_reset(struct dst_cache *dst_cache) | ||
| 77 | { | ||
| 78 | dst_cache->reset_ts = jiffies; | ||
| 79 | } | ||
| 80 | |||
| 81 | /** | ||
| 82 | * dst_cache_init - initialize the cache, allocating the required storage | ||
| 83 | * @dst_cache: the cache | ||
| 84 | * @gfp: allocation flags | ||
| 85 | */ | ||
| 86 | int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp); | ||
| 87 | |||
| 88 | /** | ||
| 89 | * dst_cache_destroy - empty the cache and free the allocated storage | ||
| 90 | * @dst_cache: the cache | ||
| 91 | * | ||
| 92 | * No synchronization is enforced: it must be called only when the cache | ||
| 93 | * is unsed. | ||
| 94 | */ | ||
| 95 | void dst_cache_destroy(struct dst_cache *dst_cache); | ||
| 96 | |||
| 97 | #endif | ||
diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h index 30a56ab2ccfb..5db9f5910428 100644 --- a/include/net/dst_metadata.h +++ b/include/net/dst_metadata.h | |||
| @@ -62,6 +62,7 @@ static inline int skb_metadata_dst_cmp(const struct sk_buff *skb_a, | |||
| 62 | sizeof(a->u.tun_info) + a->u.tun_info.options_len); | 62 | sizeof(a->u.tun_info) + a->u.tun_info.options_len); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | void metadata_dst_free(struct metadata_dst *); | ||
| 65 | struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags); | 66 | struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags); |
| 66 | struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags); | 67 | struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags); |
| 67 | 68 | ||
| @@ -125,7 +126,7 @@ static inline struct metadata_dst *ip_tun_rx_dst(struct sk_buff *skb, | |||
| 125 | 126 | ||
| 126 | ip_tunnel_key_init(&tun_dst->u.tun_info.key, | 127 | ip_tunnel_key_init(&tun_dst->u.tun_info.key, |
| 127 | iph->saddr, iph->daddr, iph->tos, iph->ttl, | 128 | iph->saddr, iph->daddr, iph->tos, iph->ttl, |
| 128 | 0, 0, tunnel_id, flags); | 129 | 0, 0, 0, tunnel_id, flags); |
| 129 | return tun_dst; | 130 | return tun_dst; |
| 130 | } | 131 | } |
| 131 | 132 | ||
| @@ -151,8 +152,11 @@ static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb, | |||
| 151 | 152 | ||
| 152 | info->key.u.ipv6.src = ip6h->saddr; | 153 | info->key.u.ipv6.src = ip6h->saddr; |
| 153 | info->key.u.ipv6.dst = ip6h->daddr; | 154 | info->key.u.ipv6.dst = ip6h->daddr; |
| 155 | |||
| 154 | info->key.tos = ipv6_get_dsfield(ip6h); | 156 | info->key.tos = ipv6_get_dsfield(ip6h); |
| 155 | info->key.ttl = ip6h->hop_limit; | 157 | info->key.ttl = ip6h->hop_limit; |
| 158 | info->key.label = ip6_flowlabel(ip6h); | ||
| 159 | |||
| 156 | return tun_dst; | 160 | return tun_dst; |
| 157 | } | 161 | } |
| 158 | 162 | ||
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index 8c8548cf5888..d3d60dccd19f 100644 --- a/include/net/flow_dissector.h +++ b/include/net/flow_dissector.h | |||
| @@ -184,4 +184,17 @@ static inline bool flow_keys_have_l4(struct flow_keys *keys) | |||
| 184 | 184 | ||
| 185 | u32 flow_hash_from_keys(struct flow_keys *keys); | 185 | u32 flow_hash_from_keys(struct flow_keys *keys); |
| 186 | 186 | ||
| 187 | static inline bool dissector_uses_key(const struct flow_dissector *flow_dissector, | ||
| 188 | enum flow_dissector_key_id key_id) | ||
| 189 | { | ||
| 190 | return flow_dissector->used_keys & (1 << key_id); | ||
| 191 | } | ||
| 192 | |||
| 193 | static inline void *skb_flow_dissector_target(struct flow_dissector *flow_dissector, | ||
| 194 | enum flow_dissector_key_id key_id, | ||
| 195 | void *target_container) | ||
| 196 | { | ||
| 197 | return ((char *)target_container) + flow_dissector->offset[key_id]; | ||
| 198 | } | ||
| 199 | |||
| 187 | #endif | 200 | #endif |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 43c0e771f417..8d4608ce8716 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
| @@ -83,7 +83,6 @@ struct genl_family { | |||
| 83 | * @attrs: netlink attributes | 83 | * @attrs: netlink attributes |
| 84 | * @_net: network namespace | 84 | * @_net: network namespace |
| 85 | * @user_ptr: user pointers | 85 | * @user_ptr: user pointers |
| 86 | * @dst_sk: destination socket | ||
| 87 | */ | 86 | */ |
| 88 | struct genl_info { | 87 | struct genl_info { |
| 89 | u32 snd_seq; | 88 | u32 snd_seq; |
| @@ -94,7 +93,6 @@ struct genl_info { | |||
| 94 | struct nlattr ** attrs; | 93 | struct nlattr ** attrs; |
| 95 | possible_net_t _net; | 94 | possible_net_t _net; |
| 96 | void * user_ptr[2]; | 95 | void * user_ptr[2]; |
| 97 | struct sock * dst_sk; | ||
| 98 | }; | 96 | }; |
| 99 | 97 | ||
| 100 | static inline struct net *genl_info_net(struct genl_info *info) | 98 | static inline struct net *genl_info_net(struct genl_info *info) |
| @@ -188,8 +186,6 @@ int genl_unregister_family(struct genl_family *family); | |||
| 188 | void genl_notify(struct genl_family *family, struct sk_buff *skb, | 186 | void genl_notify(struct genl_family *family, struct sk_buff *skb, |
| 189 | struct genl_info *info, u32 group, gfp_t flags); | 187 | struct genl_info *info, u32 group, gfp_t flags); |
| 190 | 188 | ||
| 191 | struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info, | ||
| 192 | gfp_t flags); | ||
| 193 | void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, | 189 | void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, |
| 194 | struct genl_family *family, int flags, u8 cmd); | 190 | struct genl_family *family, int flags, u8 cmd); |
| 195 | 191 | ||
diff --git a/include/net/hwbm.h b/include/net/hwbm.h new file mode 100644 index 000000000000..47d08662501b --- /dev/null +++ b/include/net/hwbm.h | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #ifndef _HWBM_H | ||
| 2 | #define _HWBM_H | ||
| 3 | |||
| 4 | struct hwbm_pool { | ||
| 5 | /* Capacity of the pool */ | ||
| 6 | int size; | ||
| 7 | /* Size of the buffers managed */ | ||
| 8 | int frag_size; | ||
| 9 | /* Number of buffers currently used by this pool */ | ||
| 10 | int buf_num; | ||
| 11 | /* constructor called during alocation */ | ||
| 12 | int (*construct)(struct hwbm_pool *bm_pool, void *buf); | ||
| 13 | /* protect acces to the buffer counter*/ | ||
| 14 | spinlock_t lock; | ||
| 15 | /* private data */ | ||
| 16 | void *priv; | ||
| 17 | }; | ||
| 18 | #ifdef CONFIG_HWBM | ||
| 19 | void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf); | ||
| 20 | int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp); | ||
| 21 | int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp); | ||
| 22 | #else | ||
| 23 | void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {} | ||
| 24 | int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; } | ||
| 25 | int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp) | ||
| 26 | { return 0; } | ||
| 27 | #endif /* CONFIG_HWBM */ | ||
| 28 | #endif /* _HWBM_H */ | ||
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 7ff588ca6817..28332bdac333 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
| @@ -53,6 +53,7 @@ struct sock *__inet6_lookup_established(struct net *net, | |||
| 53 | 53 | ||
| 54 | struct sock *inet6_lookup_listener(struct net *net, | 54 | struct sock *inet6_lookup_listener(struct net *net, |
| 55 | struct inet_hashinfo *hashinfo, | 55 | struct inet_hashinfo *hashinfo, |
| 56 | struct sk_buff *skb, int doff, | ||
| 56 | const struct in6_addr *saddr, | 57 | const struct in6_addr *saddr, |
| 57 | const __be16 sport, | 58 | const __be16 sport, |
| 58 | const struct in6_addr *daddr, | 59 | const struct in6_addr *daddr, |
| @@ -60,6 +61,7 @@ struct sock *inet6_lookup_listener(struct net *net, | |||
| 60 | 61 | ||
| 61 | static inline struct sock *__inet6_lookup(struct net *net, | 62 | static inline struct sock *__inet6_lookup(struct net *net, |
| 62 | struct inet_hashinfo *hashinfo, | 63 | struct inet_hashinfo *hashinfo, |
| 64 | struct sk_buff *skb, int doff, | ||
| 63 | const struct in6_addr *saddr, | 65 | const struct in6_addr *saddr, |
| 64 | const __be16 sport, | 66 | const __be16 sport, |
| 65 | const struct in6_addr *daddr, | 67 | const struct in6_addr *daddr, |
| @@ -71,12 +73,12 @@ static inline struct sock *__inet6_lookup(struct net *net, | |||
| 71 | if (sk) | 73 | if (sk) |
| 72 | return sk; | 74 | return sk; |
| 73 | 75 | ||
| 74 | return inet6_lookup_listener(net, hashinfo, saddr, sport, | 76 | return inet6_lookup_listener(net, hashinfo, skb, doff, saddr, sport, |
| 75 | daddr, hnum, dif); | 77 | daddr, hnum, dif); |
| 76 | } | 78 | } |
| 77 | 79 | ||
| 78 | static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, | 80 | static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, |
| 79 | struct sk_buff *skb, | 81 | struct sk_buff *skb, int doff, |
| 80 | const __be16 sport, | 82 | const __be16 sport, |
| 81 | const __be16 dport, | 83 | const __be16 dport, |
| 82 | int iif) | 84 | int iif) |
| @@ -86,16 +88,19 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, | |||
| 86 | if (sk) | 88 | if (sk) |
| 87 | return sk; | 89 | return sk; |
| 88 | 90 | ||
| 89 | return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, | 91 | return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, skb, |
| 90 | &ipv6_hdr(skb)->saddr, sport, | 92 | doff, &ipv6_hdr(skb)->saddr, sport, |
| 91 | &ipv6_hdr(skb)->daddr, ntohs(dport), | 93 | &ipv6_hdr(skb)->daddr, ntohs(dport), |
| 92 | iif); | 94 | iif); |
| 93 | } | 95 | } |
| 94 | 96 | ||
| 95 | struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, | 97 | struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, |
| 98 | struct sk_buff *skb, int doff, | ||
| 96 | const struct in6_addr *saddr, const __be16 sport, | 99 | const struct in6_addr *saddr, const __be16 sport, |
| 97 | const struct in6_addr *daddr, const __be16 dport, | 100 | const struct in6_addr *daddr, const __be16 dport, |
| 98 | const int dif); | 101 | const int dif); |
| 102 | |||
| 103 | int inet6_hash(struct sock *sk); | ||
| 99 | #endif /* IS_ENABLED(CONFIG_IPV6) */ | 104 | #endif /* IS_ENABLED(CONFIG_IPV6) */ |
| 100 | 105 | ||
| 101 | #define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ | 106 | #define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ |
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 12aac0fd6ee7..909972aa3acd 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
| @@ -13,6 +13,7 @@ struct netns_frags { | |||
| 13 | int timeout; | 13 | int timeout; |
| 14 | int high_thresh; | 14 | int high_thresh; |
| 15 | int low_thresh; | 15 | int low_thresh; |
| 16 | int max_dist; | ||
| 16 | }; | 17 | }; |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index de2e3ade6102..50f635c2c536 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
| @@ -207,12 +207,16 @@ void inet_hashinfo_init(struct inet_hashinfo *h); | |||
| 207 | 207 | ||
| 208 | bool inet_ehash_insert(struct sock *sk, struct sock *osk); | 208 | bool inet_ehash_insert(struct sock *sk, struct sock *osk); |
| 209 | bool inet_ehash_nolisten(struct sock *sk, struct sock *osk); | 209 | bool inet_ehash_nolisten(struct sock *sk, struct sock *osk); |
| 210 | void __inet_hash(struct sock *sk, struct sock *osk); | 210 | int __inet_hash(struct sock *sk, struct sock *osk, |
| 211 | void inet_hash(struct sock *sk); | 211 | int (*saddr_same)(const struct sock *sk1, |
| 212 | const struct sock *sk2, | ||
| 213 | bool match_wildcard)); | ||
| 214 | int inet_hash(struct sock *sk); | ||
| 212 | void inet_unhash(struct sock *sk); | 215 | void inet_unhash(struct sock *sk); |
| 213 | 216 | ||
| 214 | struct sock *__inet_lookup_listener(struct net *net, | 217 | struct sock *__inet_lookup_listener(struct net *net, |
| 215 | struct inet_hashinfo *hashinfo, | 218 | struct inet_hashinfo *hashinfo, |
| 219 | struct sk_buff *skb, int doff, | ||
| 216 | const __be32 saddr, const __be16 sport, | 220 | const __be32 saddr, const __be16 sport, |
| 217 | const __be32 daddr, | 221 | const __be32 daddr, |
| 218 | const unsigned short hnum, | 222 | const unsigned short hnum, |
| @@ -220,10 +224,11 @@ struct sock *__inet_lookup_listener(struct net *net, | |||
| 220 | 224 | ||
| 221 | static inline struct sock *inet_lookup_listener(struct net *net, | 225 | static inline struct sock *inet_lookup_listener(struct net *net, |
| 222 | struct inet_hashinfo *hashinfo, | 226 | struct inet_hashinfo *hashinfo, |
| 227 | struct sk_buff *skb, int doff, | ||
| 223 | __be32 saddr, __be16 sport, | 228 | __be32 saddr, __be16 sport, |
| 224 | __be32 daddr, __be16 dport, int dif) | 229 | __be32 daddr, __be16 dport, int dif) |
| 225 | { | 230 | { |
| 226 | return __inet_lookup_listener(net, hashinfo, saddr, sport, | 231 | return __inet_lookup_listener(net, hashinfo, skb, doff, saddr, sport, |
| 227 | daddr, ntohs(dport), dif); | 232 | daddr, ntohs(dport), dif); |
| 228 | } | 233 | } |
| 229 | 234 | ||
| @@ -299,6 +304,7 @@ static inline struct sock * | |||
| 299 | 304 | ||
| 300 | static inline struct sock *__inet_lookup(struct net *net, | 305 | static inline struct sock *__inet_lookup(struct net *net, |
| 301 | struct inet_hashinfo *hashinfo, | 306 | struct inet_hashinfo *hashinfo, |
| 307 | struct sk_buff *skb, int doff, | ||
| 302 | const __be32 saddr, const __be16 sport, | 308 | const __be32 saddr, const __be16 sport, |
| 303 | const __be32 daddr, const __be16 dport, | 309 | const __be32 daddr, const __be16 dport, |
| 304 | const int dif) | 310 | const int dif) |
| @@ -307,12 +313,13 @@ static inline struct sock *__inet_lookup(struct net *net, | |||
| 307 | struct sock *sk = __inet_lookup_established(net, hashinfo, | 313 | struct sock *sk = __inet_lookup_established(net, hashinfo, |
| 308 | saddr, sport, daddr, hnum, dif); | 314 | saddr, sport, daddr, hnum, dif); |
| 309 | 315 | ||
| 310 | return sk ? : __inet_lookup_listener(net, hashinfo, saddr, sport, | 316 | return sk ? : __inet_lookup_listener(net, hashinfo, skb, doff, saddr, |
| 311 | daddr, hnum, dif); | 317 | sport, daddr, hnum, dif); |
| 312 | } | 318 | } |
| 313 | 319 | ||
| 314 | static inline struct sock *inet_lookup(struct net *net, | 320 | static inline struct sock *inet_lookup(struct net *net, |
| 315 | struct inet_hashinfo *hashinfo, | 321 | struct inet_hashinfo *hashinfo, |
| 322 | struct sk_buff *skb, int doff, | ||
| 316 | const __be32 saddr, const __be16 sport, | 323 | const __be32 saddr, const __be16 sport, |
| 317 | const __be32 daddr, const __be16 dport, | 324 | const __be32 daddr, const __be16 dport, |
| 318 | const int dif) | 325 | const int dif) |
| @@ -320,7 +327,8 @@ static inline struct sock *inet_lookup(struct net *net, | |||
| 320 | struct sock *sk; | 327 | struct sock *sk; |
| 321 | 328 | ||
| 322 | local_bh_disable(); | 329 | local_bh_disable(); |
| 323 | sk = __inet_lookup(net, hashinfo, saddr, sport, daddr, dport, dif); | 330 | sk = __inet_lookup(net, hashinfo, skb, doff, saddr, sport, daddr, |
| 331 | dport, dif); | ||
| 324 | local_bh_enable(); | 332 | local_bh_enable(); |
| 325 | 333 | ||
| 326 | return sk; | 334 | return sk; |
| @@ -328,6 +336,7 @@ static inline struct sock *inet_lookup(struct net *net, | |||
| 328 | 336 | ||
| 329 | static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, | 337 | static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, |
| 330 | struct sk_buff *skb, | 338 | struct sk_buff *skb, |
| 339 | int doff, | ||
| 331 | const __be16 sport, | 340 | const __be16 sport, |
| 332 | const __be16 dport) | 341 | const __be16 dport) |
| 333 | { | 342 | { |
| @@ -337,8 +346,8 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, | |||
| 337 | if (sk) | 346 | if (sk) |
| 338 | return sk; | 347 | return sk; |
| 339 | else | 348 | else |
| 340 | return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo, | 349 | return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo, skb, |
| 341 | iph->saddr, sport, | 350 | doff, iph->saddr, sport, |
| 342 | iph->daddr, dport, inet_iif(skb)); | 351 | iph->daddr, dport, inet_iif(skb)); |
| 343 | } | 352 | } |
| 344 | 353 | ||
diff --git a/include/net/ip.h b/include/net/ip.h index 1a98f1ca1638..fad74d323bd6 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -240,17 +240,13 @@ static inline int inet_is_local_reserved_port(struct net *net, int port) | |||
| 240 | } | 240 | } |
| 241 | #endif | 241 | #endif |
| 242 | 242 | ||
| 243 | __be32 inet_current_timestamp(void); | ||
| 244 | |||
| 243 | /* From inetpeer.c */ | 245 | /* From inetpeer.c */ |
| 244 | extern int inet_peer_threshold; | 246 | extern int inet_peer_threshold; |
| 245 | extern int inet_peer_minttl; | 247 | extern int inet_peer_minttl; |
| 246 | extern int inet_peer_maxttl; | 248 | extern int inet_peer_maxttl; |
| 247 | 249 | ||
| 248 | /* From ip_input.c */ | ||
| 249 | extern int sysctl_ip_early_demux; | ||
| 250 | |||
| 251 | /* From ip_output.c */ | ||
| 252 | extern int sysctl_ip_dynaddr; | ||
| 253 | |||
| 254 | void ipfrag_init(void); | 250 | void ipfrag_init(void); |
| 255 | 251 | ||
| 256 | void ip_static_sysctl_init(void); | 252 | void ip_static_sysctl_init(void); |
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h index 1a49b73f7f6e..cca840584c88 100644 --- a/include/net/ip6_checksum.h +++ b/include/net/ip6_checksum.h | |||
| @@ -37,8 +37,7 @@ | |||
| 37 | #ifndef _HAVE_ARCH_IPV6_CSUM | 37 | #ifndef _HAVE_ARCH_IPV6_CSUM |
| 38 | __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | 38 | __sum16 csum_ipv6_magic(const struct in6_addr *saddr, |
| 39 | const struct in6_addr *daddr, | 39 | const struct in6_addr *daddr, |
| 40 | __u32 len, unsigned short proto, | 40 | __u32 len, __u8 proto, __wsum csum); |
| 41 | __wsum csum); | ||
| 42 | #endif | 41 | #endif |
| 43 | 42 | ||
| 44 | static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto) | 43 | static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto) |
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index 0d0ce0b2d870..499a707765ea 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <linux/if_tunnel.h> | 6 | #include <linux/if_tunnel.h> |
| 7 | #include <linux/ip6_tunnel.h> | 7 | #include <linux/ip6_tunnel.h> |
| 8 | #include <net/ip_tunnels.h> | 8 | #include <net/ip_tunnels.h> |
| 9 | #include <net/dst_cache.h> | ||
| 9 | 10 | ||
| 10 | #define IP6TUNNEL_ERR_TIMEO (30*HZ) | 11 | #define IP6TUNNEL_ERR_TIMEO (30*HZ) |
| 11 | 12 | ||
| @@ -33,12 +34,6 @@ struct __ip6_tnl_parm { | |||
| 33 | __be32 o_key; | 34 | __be32 o_key; |
| 34 | }; | 35 | }; |
| 35 | 36 | ||
| 36 | struct ip6_tnl_dst { | ||
| 37 | seqlock_t lock; | ||
| 38 | struct dst_entry __rcu *dst; | ||
| 39 | u32 cookie; | ||
| 40 | }; | ||
| 41 | |||
| 42 | /* IPv6 tunnel */ | 37 | /* IPv6 tunnel */ |
| 43 | struct ip6_tnl { | 38 | struct ip6_tnl { |
| 44 | struct ip6_tnl __rcu *next; /* next tunnel in list */ | 39 | struct ip6_tnl __rcu *next; /* next tunnel in list */ |
| @@ -46,7 +41,7 @@ struct ip6_tnl { | |||
| 46 | struct net *net; /* netns for packet i/o */ | 41 | struct net *net; /* netns for packet i/o */ |
| 47 | struct __ip6_tnl_parm parms; /* tunnel configuration parameters */ | 42 | struct __ip6_tnl_parm parms; /* tunnel configuration parameters */ |
| 48 | struct flowi fl; /* flowi template for xmit */ | 43 | struct flowi fl; /* flowi template for xmit */ |
| 49 | struct ip6_tnl_dst __percpu *dst_cache; /* cached dst */ | 44 | struct dst_cache dst_cache; /* cached dst */ |
| 50 | 45 | ||
| 51 | int err_count; | 46 | int err_count; |
| 52 | unsigned long err_time; | 47 | unsigned long err_time; |
| @@ -66,11 +61,6 @@ struct ipv6_tlv_tnl_enc_lim { | |||
| 66 | __u8 encap_limit; /* tunnel encapsulation limit */ | 61 | __u8 encap_limit; /* tunnel encapsulation limit */ |
| 67 | } __packed; | 62 | } __packed; |
| 68 | 63 | ||
| 69 | struct dst_entry *ip6_tnl_dst_get(struct ip6_tnl *t); | ||
| 70 | int ip6_tnl_dst_init(struct ip6_tnl *t); | ||
| 71 | void ip6_tnl_dst_destroy(struct ip6_tnl *t); | ||
| 72 | void ip6_tnl_dst_reset(struct ip6_tnl *t); | ||
| 73 | void ip6_tnl_dst_set(struct ip6_tnl *t, struct dst_entry *dst); | ||
| 74 | int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, | 64 | int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, |
| 75 | const struct in6_addr *raddr); | 65 | const struct in6_addr *raddr); |
| 76 | int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, | 66 | int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, |
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index dda9abf6b89c..c35dda9ec991 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
| @@ -7,12 +7,15 @@ | |||
| 7 | #include <linux/socket.h> | 7 | #include <linux/socket.h> |
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #include <linux/u64_stats_sync.h> | 9 | #include <linux/u64_stats_sync.h> |
| 10 | #include <linux/bitops.h> | ||
| 11 | |||
| 10 | #include <net/dsfield.h> | 12 | #include <net/dsfield.h> |
| 11 | #include <net/gro_cells.h> | 13 | #include <net/gro_cells.h> |
| 12 | #include <net/inet_ecn.h> | 14 | #include <net/inet_ecn.h> |
| 13 | #include <net/netns/generic.h> | 15 | #include <net/netns/generic.h> |
| 14 | #include <net/rtnetlink.h> | 16 | #include <net/rtnetlink.h> |
| 15 | #include <net/lwtunnel.h> | 17 | #include <net/lwtunnel.h> |
| 18 | #include <net/dst_cache.h> | ||
| 16 | 19 | ||
| 17 | #if IS_ENABLED(CONFIG_IPV6) | 20 | #if IS_ENABLED(CONFIG_IPV6) |
| 18 | #include <net/ipv6.h> | 21 | #include <net/ipv6.h> |
| @@ -47,6 +50,7 @@ struct ip_tunnel_key { | |||
| 47 | __be16 tun_flags; | 50 | __be16 tun_flags; |
| 48 | u8 tos; /* TOS for IPv4, TC for IPv6 */ | 51 | u8 tos; /* TOS for IPv4, TC for IPv6 */ |
| 49 | u8 ttl; /* TTL for IPv4, HL for IPv6 */ | 52 | u8 ttl; /* TTL for IPv4, HL for IPv6 */ |
| 53 | __be32 label; /* Flow Label for IPv6 */ | ||
| 50 | __be16 tp_src; | 54 | __be16 tp_src; |
| 51 | __be16 tp_dst; | 55 | __be16 tp_dst; |
| 52 | }; | 56 | }; |
| @@ -55,8 +59,16 @@ struct ip_tunnel_key { | |||
| 55 | #define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */ | 59 | #define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */ |
| 56 | #define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */ | 60 | #define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */ |
| 57 | 61 | ||
| 62 | /* Maximum tunnel options length. */ | ||
| 63 | #define IP_TUNNEL_OPTS_MAX \ | ||
| 64 | GENMASK((FIELD_SIZEOF(struct ip_tunnel_info, \ | ||
| 65 | options_len) * BITS_PER_BYTE) - 1, 0) | ||
| 66 | |||
| 58 | struct ip_tunnel_info { | 67 | struct ip_tunnel_info { |
| 59 | struct ip_tunnel_key key; | 68 | struct ip_tunnel_key key; |
| 69 | #ifdef CONFIG_DST_CACHE | ||
| 70 | struct dst_cache dst_cache; | ||
| 71 | #endif | ||
| 60 | u8 options_len; | 72 | u8 options_len; |
| 61 | u8 mode; | 73 | u8 mode; |
| 62 | }; | 74 | }; |
| @@ -85,11 +97,6 @@ struct ip_tunnel_prl_entry { | |||
| 85 | struct rcu_head rcu_head; | 97 | struct rcu_head rcu_head; |
| 86 | }; | 98 | }; |
| 87 | 99 | ||
| 88 | struct ip_tunnel_dst { | ||
| 89 | struct dst_entry __rcu *dst; | ||
| 90 | __be32 saddr; | ||
| 91 | }; | ||
| 92 | |||
| 93 | struct metadata_dst; | 100 | struct metadata_dst; |
| 94 | 101 | ||
| 95 | struct ip_tunnel { | 102 | struct ip_tunnel { |
| @@ -108,7 +115,7 @@ struct ip_tunnel { | |||
| 108 | int tun_hlen; /* Precalculated header length */ | 115 | int tun_hlen; /* Precalculated header length */ |
| 109 | int mlink; | 116 | int mlink; |
| 110 | 117 | ||
| 111 | struct ip_tunnel_dst __percpu *dst_cache; | 118 | struct dst_cache dst_cache; |
| 112 | 119 | ||
| 113 | struct ip_tunnel_parm parms; | 120 | struct ip_tunnel_parm parms; |
| 114 | 121 | ||
| @@ -141,6 +148,7 @@ struct ip_tunnel { | |||
| 141 | #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400) | 148 | #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400) |
| 142 | #define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800) | 149 | #define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800) |
| 143 | #define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000) | 150 | #define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000) |
| 151 | #define TUNNEL_NOCACHE __cpu_to_be16(0x2000) | ||
| 144 | 152 | ||
| 145 | #define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT) | 153 | #define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT) |
| 146 | 154 | ||
| @@ -181,7 +189,7 @@ int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op, | |||
| 181 | 189 | ||
| 182 | static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, | 190 | static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, |
| 183 | __be32 saddr, __be32 daddr, | 191 | __be32 saddr, __be32 daddr, |
| 184 | u8 tos, u8 ttl, | 192 | u8 tos, u8 ttl, __be32 label, |
| 185 | __be16 tp_src, __be16 tp_dst, | 193 | __be16 tp_src, __be16 tp_dst, |
| 186 | __be64 tun_id, __be16 tun_flags) | 194 | __be64 tun_id, __be16 tun_flags) |
| 187 | { | 195 | { |
| @@ -192,6 +200,7 @@ static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, | |||
| 192 | 0, IP_TUNNEL_KEY_IPV4_PAD_LEN); | 200 | 0, IP_TUNNEL_KEY_IPV4_PAD_LEN); |
| 193 | key->tos = tos; | 201 | key->tos = tos; |
| 194 | key->ttl = ttl; | 202 | key->ttl = ttl; |
| 203 | key->label = label; | ||
| 195 | key->tun_flags = tun_flags; | 204 | key->tun_flags = tun_flags; |
| 196 | 205 | ||
| 197 | /* For the tunnel types on the top of IPsec, the tp_src and tp_dst of | 206 | /* For the tunnel types on the top of IPsec, the tp_src and tp_dst of |
| @@ -207,6 +216,20 @@ static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, | |||
| 207 | 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE); | 216 | 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE); |
| 208 | } | 217 | } |
| 209 | 218 | ||
| 219 | static inline bool | ||
| 220 | ip_tunnel_dst_cache_usable(const struct sk_buff *skb, | ||
| 221 | const struct ip_tunnel_info *info) | ||
| 222 | { | ||
| 223 | if (skb->mark) | ||
| 224 | return false; | ||
| 225 | if (!info) | ||
| 226 | return true; | ||
| 227 | if (info->key.tun_flags & TUNNEL_NOCACHE) | ||
| 228 | return false; | ||
| 229 | |||
| 230 | return true; | ||
| 231 | } | ||
| 232 | |||
| 210 | static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info | 233 | static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info |
| 211 | *tun_info) | 234 | *tun_info) |
| 212 | { | 235 | { |
| @@ -248,7 +271,6 @@ int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[], | |||
| 248 | int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], | 271 | int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], |
| 249 | struct ip_tunnel_parm *p); | 272 | struct ip_tunnel_parm *p); |
| 250 | void ip_tunnel_setup(struct net_device *dev, int net_id); | 273 | void ip_tunnel_setup(struct net_device *dev, int net_id); |
| 251 | void ip_tunnel_dst_reset_all(struct ip_tunnel *t); | ||
| 252 | int ip_tunnel_encap_setup(struct ip_tunnel *t, | 274 | int ip_tunnel_encap_setup(struct ip_tunnel *t, |
| 253 | struct ip_tunnel_encap *ipencap); | 275 | struct ip_tunnel_encap *ipencap); |
| 254 | 276 | ||
| @@ -273,15 +295,15 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, | |||
| 273 | return INET_ECN_encapsulate(tos, inner); | 295 | return INET_ECN_encapsulate(tos, inner); |
| 274 | } | 296 | } |
| 275 | 297 | ||
| 276 | int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); | 298 | int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto, |
| 299 | bool xnet); | ||
| 277 | void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, | 300 | void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, |
| 278 | __be32 src, __be32 dst, u8 proto, | 301 | __be32 src, __be32 dst, u8 proto, |
| 279 | u8 tos, u8 ttl, __be16 df, bool xnet); | 302 | u8 tos, u8 ttl, __be16 df, bool xnet); |
| 280 | struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md, | 303 | struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md, |
| 281 | gfp_t flags); | 304 | gfp_t flags); |
| 282 | 305 | ||
| 283 | struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum, | 306 | struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, int gso_type_mask); |
| 284 | int gso_type_mask); | ||
| 285 | 307 | ||
| 286 | static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len) | 308 | static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len) |
| 287 | { | 309 | { |
| @@ -356,6 +378,17 @@ static inline void ip_tunnel_unneed_metadata(void) | |||
| 356 | { | 378 | { |
| 357 | } | 379 | } |
| 358 | 380 | ||
| 381 | static inline void ip_tunnel_info_opts_get(void *to, | ||
| 382 | const struct ip_tunnel_info *info) | ||
| 383 | { | ||
| 384 | } | ||
| 385 | |||
| 386 | static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info, | ||
| 387 | const void *from, int len) | ||
| 388 | { | ||
| 389 | info->options_len = 0; | ||
| 390 | } | ||
| 391 | |||
| 359 | #endif /* CONFIG_INET */ | 392 | #endif /* CONFIG_INET */ |
| 360 | 393 | ||
| 361 | #endif /* __NET_IP_TUNNELS_H */ | 394 | #endif /* __NET_IP_TUNNELS_H */ |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 0816c872b689..a6cc576fd467 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -1588,6 +1588,23 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) | |||
| 1588 | } | 1588 | } |
| 1589 | #endif /* CONFIG_IP_VS_NFCT */ | 1589 | #endif /* CONFIG_IP_VS_NFCT */ |
| 1590 | 1590 | ||
| 1591 | /* Really using conntrack? */ | ||
| 1592 | static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp, | ||
| 1593 | struct sk_buff *skb) | ||
| 1594 | { | ||
| 1595 | #ifdef CONFIG_IP_VS_NFCT | ||
| 1596 | enum ip_conntrack_info ctinfo; | ||
| 1597 | struct nf_conn *ct; | ||
| 1598 | |||
| 1599 | if (!(cp->flags & IP_VS_CONN_F_NFCT)) | ||
| 1600 | return false; | ||
| 1601 | ct = nf_ct_get(skb, &ctinfo); | ||
| 1602 | if (ct && !nf_ct_is_untracked(ct)) | ||
| 1603 | return true; | ||
| 1604 | #endif | ||
| 1605 | return false; | ||
| 1606 | } | ||
| 1607 | |||
| 1591 | static inline int | 1608 | static inline int |
| 1592 | ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) | 1609 | ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) |
| 1593 | { | 1610 | { |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 6570f379aba2..f3c9857c645d 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -259,8 +259,12 @@ static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np) | |||
| 259 | 259 | ||
| 260 | rcu_read_lock(); | 260 | rcu_read_lock(); |
| 261 | opt = rcu_dereference(np->opt); | 261 | opt = rcu_dereference(np->opt); |
| 262 | if (opt && !atomic_inc_not_zero(&opt->refcnt)) | 262 | if (opt) { |
| 263 | opt = NULL; | 263 | if (!atomic_inc_not_zero(&opt->refcnt)) |
| 264 | opt = NULL; | ||
| 265 | else | ||
| 266 | opt = rcu_pointer_handoff(opt); | ||
| 267 | } | ||
| 264 | rcu_read_unlock(); | 268 | rcu_read_unlock(); |
| 265 | return opt; | 269 | return opt; |
| 266 | } | 270 | } |
diff --git a/include/net/kcm.h b/include/net/kcm.h new file mode 100644 index 000000000000..2840b5825dcc --- /dev/null +++ b/include/net/kcm.h | |||
| @@ -0,0 +1,226 @@ | |||
| 1 | /* | ||
| 2 | * Kernel Connection Multiplexor | ||
| 3 | * | ||
| 4 | * Copyright (c) 2016 Tom Herbert <tom@herbertland.com> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 | ||
| 8 | * as published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef __NET_KCM_H_ | ||
| 12 | #define __NET_KCM_H_ | ||
| 13 | |||
| 14 | #include <linux/skbuff.h> | ||
| 15 | #include <net/sock.h> | ||
| 16 | #include <uapi/linux/kcm.h> | ||
| 17 | |||
| 18 | extern unsigned int kcm_net_id; | ||
| 19 | |||
| 20 | #define KCM_STATS_ADD(stat, count) ((stat) += (count)) | ||
| 21 | #define KCM_STATS_INCR(stat) ((stat)++) | ||
| 22 | |||
| 23 | struct kcm_psock_stats { | ||
| 24 | unsigned long long rx_msgs; | ||
| 25 | unsigned long long rx_bytes; | ||
| 26 | unsigned long long tx_msgs; | ||
| 27 | unsigned long long tx_bytes; | ||
| 28 | unsigned int rx_aborts; | ||
| 29 | unsigned int rx_mem_fail; | ||
| 30 | unsigned int rx_need_more_hdr; | ||
| 31 | unsigned int rx_msg_too_big; | ||
| 32 | unsigned int rx_msg_timeouts; | ||
| 33 | unsigned int rx_bad_hdr_len; | ||
| 34 | unsigned long long reserved; | ||
| 35 | unsigned long long unreserved; | ||
| 36 | unsigned int tx_aborts; | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct kcm_mux_stats { | ||
| 40 | unsigned long long rx_msgs; | ||
| 41 | unsigned long long rx_bytes; | ||
| 42 | unsigned long long tx_msgs; | ||
| 43 | unsigned long long tx_bytes; | ||
| 44 | unsigned int rx_ready_drops; | ||
| 45 | unsigned int tx_retries; | ||
| 46 | unsigned int psock_attach; | ||
| 47 | unsigned int psock_unattach_rsvd; | ||
| 48 | unsigned int psock_unattach; | ||
| 49 | }; | ||
| 50 | |||
| 51 | struct kcm_stats { | ||
| 52 | unsigned long long rx_msgs; | ||
| 53 | unsigned long long rx_bytes; | ||
| 54 | unsigned long long tx_msgs; | ||
| 55 | unsigned long long tx_bytes; | ||
| 56 | }; | ||
| 57 | |||
| 58 | struct kcm_tx_msg { | ||
| 59 | unsigned int sent; | ||
| 60 | unsigned int fragidx; | ||
| 61 | unsigned int frag_offset; | ||
| 62 | unsigned int msg_flags; | ||
| 63 | struct sk_buff *frag_skb; | ||
| 64 | struct sk_buff *last_skb; | ||
| 65 | }; | ||
| 66 | |||
| 67 | struct kcm_rx_msg { | ||
| 68 | int full_len; | ||
| 69 | int accum_len; | ||
| 70 | int offset; | ||
| 71 | int early_eaten; | ||
| 72 | }; | ||
| 73 | |||
| 74 | /* Socket structure for KCM client sockets */ | ||
| 75 | struct kcm_sock { | ||
| 76 | struct sock sk; | ||
| 77 | struct kcm_mux *mux; | ||
| 78 | struct list_head kcm_sock_list; | ||
| 79 | int index; | ||
| 80 | u32 done : 1; | ||
| 81 | struct work_struct done_work; | ||
| 82 | |||
| 83 | struct kcm_stats stats; | ||
| 84 | |||
| 85 | /* Transmit */ | ||
| 86 | struct kcm_psock *tx_psock; | ||
| 87 | struct work_struct tx_work; | ||
| 88 | struct list_head wait_psock_list; | ||
| 89 | struct sk_buff *seq_skb; | ||
| 90 | |||
| 91 | /* Don't use bit fields here, these are set under different locks */ | ||
| 92 | bool tx_wait; | ||
| 93 | bool tx_wait_more; | ||
| 94 | |||
| 95 | /* Receive */ | ||
| 96 | struct kcm_psock *rx_psock; | ||
| 97 | struct list_head wait_rx_list; /* KCMs waiting for receiving */ | ||
| 98 | bool rx_wait; | ||
| 99 | u32 rx_disabled : 1; | ||
| 100 | }; | ||
| 101 | |||
| 102 | struct bpf_prog; | ||
| 103 | |||
| 104 | /* Structure for an attached lower socket */ | ||
| 105 | struct kcm_psock { | ||
| 106 | struct sock *sk; | ||
| 107 | struct kcm_mux *mux; | ||
| 108 | int index; | ||
| 109 | |||
| 110 | u32 tx_stopped : 1; | ||
| 111 | u32 rx_stopped : 1; | ||
| 112 | u32 done : 1; | ||
| 113 | u32 unattaching : 1; | ||
| 114 | |||
| 115 | void (*save_state_change)(struct sock *sk); | ||
| 116 | void (*save_data_ready)(struct sock *sk); | ||
| 117 | void (*save_write_space)(struct sock *sk); | ||
| 118 | |||
| 119 | struct list_head psock_list; | ||
| 120 | |||
| 121 | struct kcm_psock_stats stats; | ||
| 122 | |||
| 123 | /* Receive */ | ||
| 124 | struct sk_buff *rx_skb_head; | ||
| 125 | struct sk_buff **rx_skb_nextp; | ||
| 126 | struct sk_buff *ready_rx_msg; | ||
| 127 | struct list_head psock_ready_list; | ||
| 128 | struct work_struct rx_work; | ||
| 129 | struct delayed_work rx_delayed_work; | ||
| 130 | struct bpf_prog *bpf_prog; | ||
| 131 | struct kcm_sock *rx_kcm; | ||
| 132 | unsigned long long saved_rx_bytes; | ||
| 133 | unsigned long long saved_rx_msgs; | ||
| 134 | struct timer_list rx_msg_timer; | ||
| 135 | unsigned int rx_need_bytes; | ||
| 136 | |||
| 137 | /* Transmit */ | ||
| 138 | struct kcm_sock *tx_kcm; | ||
| 139 | struct list_head psock_avail_list; | ||
| 140 | unsigned long long saved_tx_bytes; | ||
| 141 | unsigned long long saved_tx_msgs; | ||
| 142 | }; | ||
| 143 | |||
| 144 | /* Per net MUX list */ | ||
| 145 | struct kcm_net { | ||
| 146 | struct mutex mutex; | ||
| 147 | struct kcm_psock_stats aggregate_psock_stats; | ||
| 148 | struct kcm_mux_stats aggregate_mux_stats; | ||
| 149 | struct list_head mux_list; | ||
| 150 | int count; | ||
| 151 | }; | ||
| 152 | |||
| 153 | /* Structure for a MUX */ | ||
| 154 | struct kcm_mux { | ||
| 155 | struct list_head kcm_mux_list; | ||
| 156 | struct rcu_head rcu; | ||
| 157 | struct kcm_net *knet; | ||
| 158 | |||
| 159 | struct list_head kcm_socks; /* All KCM sockets on MUX */ | ||
| 160 | int kcm_socks_cnt; /* Total KCM socket count for MUX */ | ||
| 161 | struct list_head psocks; /* List of all psocks on MUX */ | ||
| 162 | int psocks_cnt; /* Total attached sockets */ | ||
| 163 | |||
| 164 | struct kcm_mux_stats stats; | ||
| 165 | struct kcm_psock_stats aggregate_psock_stats; | ||
| 166 | |||
| 167 | /* Receive */ | ||
| 168 | spinlock_t rx_lock ____cacheline_aligned_in_smp; | ||
| 169 | struct list_head kcm_rx_waiters; /* KCMs waiting for receiving */ | ||
| 170 | struct list_head psocks_ready; /* List of psocks with a msg ready */ | ||
| 171 | struct sk_buff_head rx_hold_queue; | ||
| 172 | |||
| 173 | /* Transmit */ | ||
| 174 | spinlock_t lock ____cacheline_aligned_in_smp; /* TX and mux locking */ | ||
| 175 | struct list_head psocks_avail; /* List of available psocks */ | ||
| 176 | struct list_head kcm_tx_waiters; /* KCMs waiting for a TX psock */ | ||
| 177 | }; | ||
| 178 | |||
| 179 | #ifdef CONFIG_PROC_FS | ||
| 180 | int kcm_proc_init(void); | ||
| 181 | void kcm_proc_exit(void); | ||
| 182 | #else | ||
| 183 | static inline int kcm_proc_init(void) { return 0; } | ||
| 184 | static inline void kcm_proc_exit(void) { } | ||
| 185 | #endif | ||
| 186 | |||
| 187 | static inline void aggregate_psock_stats(struct kcm_psock_stats *stats, | ||
| 188 | struct kcm_psock_stats *agg_stats) | ||
| 189 | { | ||
| 190 | /* Save psock statistics in the mux when psock is being unattached. */ | ||
| 191 | |||
| 192 | #define SAVE_PSOCK_STATS(_stat) (agg_stats->_stat += stats->_stat) | ||
| 193 | SAVE_PSOCK_STATS(rx_msgs); | ||
| 194 | SAVE_PSOCK_STATS(rx_bytes); | ||
| 195 | SAVE_PSOCK_STATS(rx_aborts); | ||
| 196 | SAVE_PSOCK_STATS(rx_mem_fail); | ||
| 197 | SAVE_PSOCK_STATS(rx_need_more_hdr); | ||
| 198 | SAVE_PSOCK_STATS(rx_msg_too_big); | ||
| 199 | SAVE_PSOCK_STATS(rx_msg_timeouts); | ||
| 200 | SAVE_PSOCK_STATS(rx_bad_hdr_len); | ||
| 201 | SAVE_PSOCK_STATS(tx_msgs); | ||
| 202 | SAVE_PSOCK_STATS(tx_bytes); | ||
| 203 | SAVE_PSOCK_STATS(reserved); | ||
| 204 | SAVE_PSOCK_STATS(unreserved); | ||
| 205 | SAVE_PSOCK_STATS(tx_aborts); | ||
| 206 | #undef SAVE_PSOCK_STATS | ||
| 207 | } | ||
| 208 | |||
| 209 | static inline void aggregate_mux_stats(struct kcm_mux_stats *stats, | ||
| 210 | struct kcm_mux_stats *agg_stats) | ||
| 211 | { | ||
| 212 | /* Save psock statistics in the mux when psock is being unattached. */ | ||
| 213 | |||
| 214 | #define SAVE_MUX_STATS(_stat) (agg_stats->_stat += stats->_stat) | ||
| 215 | SAVE_MUX_STATS(rx_msgs); | ||
| 216 | SAVE_MUX_STATS(rx_bytes); | ||
| 217 | SAVE_MUX_STATS(tx_msgs); | ||
| 218 | SAVE_MUX_STATS(tx_bytes); | ||
| 219 | SAVE_MUX_STATS(rx_ready_drops); | ||
| 220 | SAVE_MUX_STATS(psock_attach); | ||
| 221 | SAVE_MUX_STATS(psock_unattach_rsvd); | ||
| 222 | SAVE_MUX_STATS(psock_unattach); | ||
| 223 | #undef SAVE_MUX_STATS | ||
| 224 | } | ||
| 225 | |||
| 226 | #endif /* __NET_KCM_H_ */ | ||
diff --git a/include/net/l3mdev.h b/include/net/l3mdev.h index 5567d46b3cff..c43a9c73de5e 100644 --- a/include/net/l3mdev.h +++ b/include/net/l3mdev.h | |||
| @@ -39,7 +39,7 @@ struct l3mdev_ops { | |||
| 39 | 39 | ||
| 40 | #ifdef CONFIG_NET_L3_MASTER_DEV | 40 | #ifdef CONFIG_NET_L3_MASTER_DEV |
| 41 | 41 | ||
| 42 | int l3mdev_master_ifindex_rcu(struct net_device *dev); | 42 | int l3mdev_master_ifindex_rcu(const struct net_device *dev); |
| 43 | static inline int l3mdev_master_ifindex(struct net_device *dev) | 43 | static inline int l3mdev_master_ifindex(struct net_device *dev) |
| 44 | { | 44 | { |
| 45 | int ifindex; | 45 | int ifindex; |
| @@ -179,7 +179,7 @@ struct dst_entry *l3mdev_rt6_dst_by_oif(struct net *net, | |||
| 179 | 179 | ||
| 180 | #else | 180 | #else |
| 181 | 181 | ||
| 182 | static inline int l3mdev_master_ifindex_rcu(struct net_device *dev) | 182 | static inline int l3mdev_master_ifindex_rcu(const struct net_device *dev) |
| 183 | { | 183 | { |
| 184 | return 0; | 184 | return 0; |
| 185 | } | 185 | } |
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h index 66350ce3e955..e9f116e29c22 100644 --- a/include/net/lwtunnel.h +++ b/include/net/lwtunnel.h | |||
| @@ -170,6 +170,8 @@ static inline int lwtunnel_input(struct sk_buff *skb) | |||
| 170 | return -EOPNOTSUPP; | 170 | return -EOPNOTSUPP; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | #endif | 173 | #endif /* CONFIG_LWTUNNEL */ |
| 174 | |||
| 175 | #define MODULE_ALIAS_RTNL_LWT(encap_type) MODULE_ALIAS("rtnl-lwt-" __stringify(encap_type)) | ||
| 174 | 176 | ||
| 175 | #endif /* __NET_LWTUNNEL_H */ | 177 | #endif /* __NET_LWTUNNEL_H */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 7c30faff245f..0c09da34b67a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
| 6 | * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> | 6 | * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> |
| 7 | * Copyright 2013-2014 Intel Mobile Communications GmbH | 7 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
| 8 | * Copyright (C) 2015 Intel Deutschland GmbH | 8 | * Copyright (C) 2015 - 2016 Intel Deutschland GmbH |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
| @@ -298,6 +298,7 @@ struct ieee80211_vif_chanctx_switch { | |||
| 298 | * note that this is only called when it changes after the channel | 298 | * note that this is only called when it changes after the channel |
| 299 | * context had been assigned. | 299 | * context had been assigned. |
| 300 | * @BSS_CHANGED_OCB: OCB join status changed | 300 | * @BSS_CHANGED_OCB: OCB join status changed |
| 301 | * @BSS_CHANGED_MU_GROUPS: VHT MU-MIMO group id or user position changed | ||
| 301 | */ | 302 | */ |
| 302 | enum ieee80211_bss_change { | 303 | enum ieee80211_bss_change { |
| 303 | BSS_CHANGED_ASSOC = 1<<0, | 304 | BSS_CHANGED_ASSOC = 1<<0, |
| @@ -323,6 +324,7 @@ enum ieee80211_bss_change { | |||
| 323 | BSS_CHANGED_BEACON_INFO = 1<<20, | 324 | BSS_CHANGED_BEACON_INFO = 1<<20, |
| 324 | BSS_CHANGED_BANDWIDTH = 1<<21, | 325 | BSS_CHANGED_BANDWIDTH = 1<<21, |
| 325 | BSS_CHANGED_OCB = 1<<22, | 326 | BSS_CHANGED_OCB = 1<<22, |
| 327 | BSS_CHANGED_MU_GROUPS = 1<<23, | ||
| 326 | 328 | ||
| 327 | /* when adding here, make sure to change ieee80211_reconfig */ | 329 | /* when adding here, make sure to change ieee80211_reconfig */ |
| 328 | }; | 330 | }; |
| @@ -436,6 +438,19 @@ struct ieee80211_event { | |||
| 436 | }; | 438 | }; |
| 437 | 439 | ||
| 438 | /** | 440 | /** |
| 441 | * struct ieee80211_mu_group_data - STA's VHT MU-MIMO group data | ||
| 442 | * | ||
| 443 | * This structure describes the group id data of VHT MU-MIMO | ||
| 444 | * | ||
| 445 | * @membership: 64 bits array - a bit is set if station is member of the group | ||
| 446 | * @position: 2 bits per group id indicating the position in the group | ||
| 447 | */ | ||
| 448 | struct ieee80211_mu_group_data { | ||
| 449 | u8 membership[WLAN_MEMBERSHIP_LEN]; | ||
| 450 | u8 position[WLAN_USER_POSITION_LEN]; | ||
| 451 | }; | ||
| 452 | |||
| 453 | /** | ||
| 439 | * struct ieee80211_bss_conf - holds the BSS's changing parameters | 454 | * struct ieee80211_bss_conf - holds the BSS's changing parameters |
| 440 | * | 455 | * |
| 441 | * This structure keeps information about a BSS (and an association | 456 | * This structure keeps information about a BSS (and an association |
| @@ -477,6 +492,7 @@ struct ieee80211_event { | |||
| 477 | * @enable_beacon: whether beaconing should be enabled or not | 492 | * @enable_beacon: whether beaconing should be enabled or not |
| 478 | * @chandef: Channel definition for this BSS -- the hardware might be | 493 | * @chandef: Channel definition for this BSS -- the hardware might be |
| 479 | * configured a higher bandwidth than this BSS uses, for example. | 494 | * configured a higher bandwidth than this BSS uses, for example. |
| 495 | * @mu_group: VHT MU-MIMO group membership data | ||
| 480 | * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation. | 496 | * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation. |
| 481 | * This field is only valid when the channel is a wide HT/VHT channel. | 497 | * This field is only valid when the channel is a wide HT/VHT channel. |
| 482 | * Note that with TDLS this can be the case (channel is HT, protection must | 498 | * Note that with TDLS this can be the case (channel is HT, protection must |
| @@ -535,6 +551,7 @@ struct ieee80211_bss_conf { | |||
| 535 | s32 cqm_rssi_thold; | 551 | s32 cqm_rssi_thold; |
| 536 | u32 cqm_rssi_hyst; | 552 | u32 cqm_rssi_hyst; |
| 537 | struct cfg80211_chan_def chandef; | 553 | struct cfg80211_chan_def chandef; |
| 554 | struct ieee80211_mu_group_data mu_group; | ||
| 538 | __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; | 555 | __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; |
| 539 | int arp_addr_cnt; | 556 | int arp_addr_cnt; |
| 540 | bool qos; | 557 | bool qos; |
| @@ -691,12 +708,14 @@ enum mac80211_tx_info_flags { | |||
| 691 | * protocol frame (e.g. EAP) | 708 | * protocol frame (e.g. EAP) |
| 692 | * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll | 709 | * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll |
| 693 | * frame (PS-Poll or uAPSD). | 710 | * frame (PS-Poll or uAPSD). |
| 711 | * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information | ||
| 694 | * | 712 | * |
| 695 | * These flags are used in tx_info->control.flags. | 713 | * These flags are used in tx_info->control.flags. |
| 696 | */ | 714 | */ |
| 697 | enum mac80211_tx_control_flags { | 715 | enum mac80211_tx_control_flags { |
| 698 | IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0), | 716 | IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0), |
| 699 | IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1), | 717 | IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1), |
| 718 | IEEE80211_TX_CTRL_RATE_INJECT = BIT(2), | ||
| 700 | }; | 719 | }; |
| 701 | 720 | ||
| 702 | /* | 721 | /* |
| @@ -993,6 +1012,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
| 993 | * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime | 1012 | * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime |
| 994 | * field) is valid and contains the time the last symbol of the MPDU | 1013 | * field) is valid and contains the time the last symbol of the MPDU |
| 995 | * (including FCS) was received. | 1014 | * (including FCS) was received. |
| 1015 | * @RX_FLAG_MACTIME_PLCP_START: The timestamp passed in the RX status (@mactime | ||
| 1016 | * field) is valid and contains the time the SYNC preamble was received. | ||
| 996 | * @RX_FLAG_SHORTPRE: Short preamble was used for this frame | 1017 | * @RX_FLAG_SHORTPRE: Short preamble was used for this frame |
| 997 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index | 1018 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index |
| 998 | * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index | 1019 | * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index |
| @@ -1014,6 +1035,14 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
| 1014 | * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC | 1035 | * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC |
| 1015 | * is stored in the @ampdu_delimiter_crc field) | 1036 | * is stored in the @ampdu_delimiter_crc field) |
| 1016 | * @RX_FLAG_LDPC: LDPC was used | 1037 | * @RX_FLAG_LDPC: LDPC was used |
| 1038 | * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without | ||
| 1039 | * processing it in any regular way. | ||
| 1040 | * This is useful if drivers offload some frames but still want to report | ||
| 1041 | * them for sniffing purposes. | ||
| 1042 | * @RX_FLAG_SKIP_MONITOR: Process and report frame to all interfaces except | ||
| 1043 | * monitor interfaces. | ||
| 1044 | * This is useful if drivers offload some frames but still want to report | ||
| 1045 | * them for sniffing purposes. | ||
| 1017 | * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 | 1046 | * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 |
| 1018 | * @RX_FLAG_10MHZ: 10 MHz (half channel) was used | 1047 | * @RX_FLAG_10MHZ: 10 MHz (half channel) was used |
| 1019 | * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used | 1048 | * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used |
| @@ -1033,6 +1062,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
| 1033 | enum mac80211_rx_flags { | 1062 | enum mac80211_rx_flags { |
| 1034 | RX_FLAG_MMIC_ERROR = BIT(0), | 1063 | RX_FLAG_MMIC_ERROR = BIT(0), |
| 1035 | RX_FLAG_DECRYPTED = BIT(1), | 1064 | RX_FLAG_DECRYPTED = BIT(1), |
| 1065 | RX_FLAG_MACTIME_PLCP_START = BIT(2), | ||
| 1036 | RX_FLAG_MMIC_STRIPPED = BIT(3), | 1066 | RX_FLAG_MMIC_STRIPPED = BIT(3), |
| 1037 | RX_FLAG_IV_STRIPPED = BIT(4), | 1067 | RX_FLAG_IV_STRIPPED = BIT(4), |
| 1038 | RX_FLAG_FAILED_FCS_CRC = BIT(5), | 1068 | RX_FLAG_FAILED_FCS_CRC = BIT(5), |
| @@ -1046,7 +1076,7 @@ enum mac80211_rx_flags { | |||
| 1046 | RX_FLAG_HT_GF = BIT(13), | 1076 | RX_FLAG_HT_GF = BIT(13), |
| 1047 | RX_FLAG_AMPDU_DETAILS = BIT(14), | 1077 | RX_FLAG_AMPDU_DETAILS = BIT(14), |
| 1048 | RX_FLAG_PN_VALIDATED = BIT(15), | 1078 | RX_FLAG_PN_VALIDATED = BIT(15), |
| 1049 | /* bit 16 free */ | 1079 | RX_FLAG_DUP_VALIDATED = BIT(16), |
| 1050 | RX_FLAG_AMPDU_LAST_KNOWN = BIT(17), | 1080 | RX_FLAG_AMPDU_LAST_KNOWN = BIT(17), |
| 1051 | RX_FLAG_AMPDU_IS_LAST = BIT(18), | 1081 | RX_FLAG_AMPDU_IS_LAST = BIT(18), |
| 1052 | RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19), | 1082 | RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19), |
| @@ -1054,6 +1084,8 @@ enum mac80211_rx_flags { | |||
| 1054 | RX_FLAG_MACTIME_END = BIT(21), | 1084 | RX_FLAG_MACTIME_END = BIT(21), |
| 1055 | RX_FLAG_VHT = BIT(22), | 1085 | RX_FLAG_VHT = BIT(22), |
| 1056 | RX_FLAG_LDPC = BIT(23), | 1086 | RX_FLAG_LDPC = BIT(23), |
| 1087 | RX_FLAG_ONLY_MONITOR = BIT(24), | ||
| 1088 | RX_FLAG_SKIP_MONITOR = BIT(25), | ||
| 1057 | RX_FLAG_STBC_MASK = BIT(26) | BIT(27), | 1089 | RX_FLAG_STBC_MASK = BIT(26) | BIT(27), |
| 1058 | RX_FLAG_10MHZ = BIT(28), | 1090 | RX_FLAG_10MHZ = BIT(28), |
| 1059 | RX_FLAG_5MHZ = BIT(29), | 1091 | RX_FLAG_5MHZ = BIT(29), |
| @@ -1072,6 +1104,7 @@ enum mac80211_rx_flags { | |||
| 1072 | * @RX_VHT_FLAG_160MHZ: 160 MHz was used | 1104 | * @RX_VHT_FLAG_160MHZ: 160 MHz was used |
| 1073 | * @RX_VHT_FLAG_BF: packet was beamformed | 1105 | * @RX_VHT_FLAG_BF: packet was beamformed |
| 1074 | */ | 1106 | */ |
| 1107 | |||
| 1075 | enum mac80211_rx_vht_flags { | 1108 | enum mac80211_rx_vht_flags { |
| 1076 | RX_VHT_FLAG_80MHZ = BIT(0), | 1109 | RX_VHT_FLAG_80MHZ = BIT(0), |
| 1077 | RX_VHT_FLAG_160MHZ = BIT(1), | 1110 | RX_VHT_FLAG_160MHZ = BIT(1), |
| @@ -1091,6 +1124,8 @@ enum mac80211_rx_vht_flags { | |||
| 1091 | * it but can store it and pass it back to the driver for synchronisation | 1124 | * it but can store it and pass it back to the driver for synchronisation |
| 1092 | * @band: the active band when this frame was received | 1125 | * @band: the active band when this frame was received |
| 1093 | * @freq: frequency the radio was tuned to when receiving this frame, in MHz | 1126 | * @freq: frequency the radio was tuned to when receiving this frame, in MHz |
| 1127 | * This field must be set for management frames, but isn't strictly needed | ||
| 1128 | * for data (other) frames - for those it only affects radiotap reporting. | ||
| 1094 | * @signal: signal strength when receiving this frame, either in dBm, in dB or | 1129 | * @signal: signal strength when receiving this frame, either in dBm, in dB or |
| 1095 | * unspecified depending on the hardware capabilities flags | 1130 | * unspecified depending on the hardware capabilities flags |
| 1096 | * @IEEE80211_HW_SIGNAL_* | 1131 | * @IEEE80211_HW_SIGNAL_* |
| @@ -1347,6 +1382,7 @@ enum ieee80211_vif_flags { | |||
| 1347 | * @csa_active: marks whether a channel switch is going on. Internally it is | 1382 | * @csa_active: marks whether a channel switch is going on. Internally it is |
| 1348 | * write-protected by sdata_lock and local->mtx so holding either is fine | 1383 | * write-protected by sdata_lock and local->mtx so holding either is fine |
| 1349 | * for read access. | 1384 | * for read access. |
| 1385 | * @mu_mimo_owner: indicates interface owns MU-MIMO capability | ||
| 1350 | * @driver_flags: flags/capabilities the driver has for this interface, | 1386 | * @driver_flags: flags/capabilities the driver has for this interface, |
| 1351 | * these need to be set (or cleared) when the interface is added | 1387 | * these need to be set (or cleared) when the interface is added |
| 1352 | * or, if supported by the driver, the interface type is changed | 1388 | * or, if supported by the driver, the interface type is changed |
| @@ -1373,6 +1409,7 @@ struct ieee80211_vif { | |||
| 1373 | u8 addr[ETH_ALEN]; | 1409 | u8 addr[ETH_ALEN]; |
| 1374 | bool p2p; | 1410 | bool p2p; |
| 1375 | bool csa_active; | 1411 | bool csa_active; |
| 1412 | bool mu_mimo_owner; | ||
| 1376 | 1413 | ||
| 1377 | u8 cab_queue; | 1414 | u8 cab_queue; |
| 1378 | u8 hw_queue[IEEE80211_NUM_ACS]; | 1415 | u8 hw_queue[IEEE80211_NUM_ACS]; |
| @@ -1486,9 +1523,8 @@ enum ieee80211_key_flags { | |||
| 1486 | * wants to be given when a frame is transmitted and needs to be | 1523 | * wants to be given when a frame is transmitted and needs to be |
| 1487 | * encrypted in hardware. | 1524 | * encrypted in hardware. |
| 1488 | * @cipher: The key's cipher suite selector. | 1525 | * @cipher: The key's cipher suite selector. |
| 1489 | * @tx_pn: PN used for TX on non-TKIP keys, may be used by the driver | 1526 | * @tx_pn: PN used for TX keys, may be used by the driver as well if it |
| 1490 | * as well if it needs to do software PN assignment by itself | 1527 | * needs to do software PN assignment by itself (e.g. due to TSO) |
| 1491 | * (e.g. due to TSO) | ||
| 1492 | * @flags: key flags, see &enum ieee80211_key_flags. | 1528 | * @flags: key flags, see &enum ieee80211_key_flags. |
| 1493 | * @keyidx: the key index (0-3) | 1529 | * @keyidx: the key index (0-3) |
| 1494 | * @keylen: key material length | 1530 | * @keylen: key material length |
| @@ -1514,6 +1550,9 @@ struct ieee80211_key_conf { | |||
| 1514 | 1550 | ||
| 1515 | #define IEEE80211_MAX_PN_LEN 16 | 1551 | #define IEEE80211_MAX_PN_LEN 16 |
| 1516 | 1552 | ||
| 1553 | #define TKIP_PN_TO_IV16(pn) ((u16)(pn & 0xffff)) | ||
| 1554 | #define TKIP_PN_TO_IV32(pn) ((u32)((pn >> 16) & 0xffffffff)) | ||
| 1555 | |||
| 1517 | /** | 1556 | /** |
| 1518 | * struct ieee80211_key_seq - key sequence counter | 1557 | * struct ieee80211_key_seq - key sequence counter |
| 1519 | * | 1558 | * |
| @@ -1684,6 +1723,18 @@ struct ieee80211_sta_rates { | |||
| 1684 | * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only | 1723 | * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only |
| 1685 | * valid if the STA is a TDLS peer in the first place. | 1724 | * valid if the STA is a TDLS peer in the first place. |
| 1686 | * @mfp: indicates whether the STA uses management frame protection or not. | 1725 | * @mfp: indicates whether the STA uses management frame protection or not. |
| 1726 | * @max_amsdu_subframes: indicates the maximal number of MSDUs in a single | ||
| 1727 | * A-MSDU. Taken from the Extended Capabilities element. 0 means | ||
| 1728 | * unlimited. | ||
| 1729 | * @max_amsdu_len: indicates the maximal length of an A-MSDU in bytes. This | ||
| 1730 | * field is always valid for packets with a VHT preamble. For packets | ||
| 1731 | * with a HT preamble, additional limits apply: | ||
| 1732 | * + If the skb is transmitted as part of a BA agreement, the | ||
| 1733 | * A-MSDU maximal size is min(max_amsdu_len, 4065) bytes. | ||
| 1734 | * + If the skb is not part of a BA aggreement, the A-MSDU maximal | ||
| 1735 | * size is min(max_amsdu_len, 7935) bytes. | ||
| 1736 | * Both additional HT limits must be enforced by the low level driver. | ||
| 1737 | * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2). | ||
| 1687 | * @txq: per-TID data TX queues (if driver uses the TXQ abstraction) | 1738 | * @txq: per-TID data TX queues (if driver uses the TXQ abstraction) |
| 1688 | */ | 1739 | */ |
| 1689 | struct ieee80211_sta { | 1740 | struct ieee80211_sta { |
| @@ -1702,6 +1753,8 @@ struct ieee80211_sta { | |||
| 1702 | bool tdls; | 1753 | bool tdls; |
| 1703 | bool tdls_initiator; | 1754 | bool tdls_initiator; |
| 1704 | bool mfp; | 1755 | bool mfp; |
| 1756 | u8 max_amsdu_subframes; | ||
| 1757 | u16 max_amsdu_len; | ||
| 1705 | 1758 | ||
| 1706 | struct ieee80211_txq *txq[IEEE80211_NUM_TIDS]; | 1759 | struct ieee80211_txq *txq[IEEE80211_NUM_TIDS]; |
| 1707 | 1760 | ||
| @@ -1910,6 +1963,11 @@ struct ieee80211_txq { | |||
| 1910 | * by just its MAC address; this prevents, for example, the same station | 1963 | * by just its MAC address; this prevents, for example, the same station |
| 1911 | * from connecting to two virtual AP interfaces at the same time. | 1964 | * from connecting to two virtual AP interfaces at the same time. |
| 1912 | * | 1965 | * |
| 1966 | * @IEEE80211_HW_SUPPORTS_REORDERING_BUFFER: Hardware (or driver) manages the | ||
| 1967 | * reordering buffer internally, guaranteeing mac80211 receives frames in | ||
| 1968 | * order and does not need to manage its own reorder buffer or BA session | ||
| 1969 | * timeout. | ||
| 1970 | * | ||
| 1913 | * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays | 1971 | * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays |
| 1914 | */ | 1972 | */ |
| 1915 | enum ieee80211_hw_flags { | 1973 | enum ieee80211_hw_flags { |
| @@ -1946,6 +2004,7 @@ enum ieee80211_hw_flags { | |||
| 1946 | IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU, | 2004 | IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU, |
| 1947 | IEEE80211_HW_BEACON_TX_STATUS, | 2005 | IEEE80211_HW_BEACON_TX_STATUS, |
| 1948 | IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR, | 2006 | IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR, |
| 2007 | IEEE80211_HW_SUPPORTS_REORDERING_BUFFER, | ||
| 1949 | 2008 | ||
| 1950 | /* keep last, obviously */ | 2009 | /* keep last, obviously */ |
| 1951 | NUM_IEEE80211_HW_FLAGS | 2010 | NUM_IEEE80211_HW_FLAGS |
| @@ -2167,7 +2226,7 @@ static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev | |||
| 2167 | * @hw: the &struct ieee80211_hw to set the MAC address for | 2226 | * @hw: the &struct ieee80211_hw to set the MAC address for |
| 2168 | * @addr: the address to set | 2227 | * @addr: the address to set |
| 2169 | */ | 2228 | */ |
| 2170 | static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) | 2229 | static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, const u8 *addr) |
| 2171 | { | 2230 | { |
| 2172 | memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); | 2231 | memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); |
| 2173 | } | 2232 | } |
| @@ -2684,6 +2743,33 @@ enum ieee80211_ampdu_mlme_action { | |||
| 2684 | }; | 2743 | }; |
| 2685 | 2744 | ||
| 2686 | /** | 2745 | /** |
| 2746 | * struct ieee80211_ampdu_params - AMPDU action parameters | ||
| 2747 | * | ||
| 2748 | * @action: the ampdu action, value from %ieee80211_ampdu_mlme_action. | ||
| 2749 | * @sta: peer of this AMPDU session | ||
| 2750 | * @tid: tid of the BA session | ||
| 2751 | * @ssn: start sequence number of the session. TX/RX_STOP can pass 0. When | ||
| 2752 | * action is set to %IEEE80211_AMPDU_RX_START the driver passes back the | ||
| 2753 | * actual ssn value used to start the session and writes the value here. | ||
| 2754 | * @buf_size: reorder buffer size (number of subframes). Valid only when the | ||
| 2755 | * action is set to %IEEE80211_AMPDU_RX_START or | ||
| 2756 | * %IEEE80211_AMPDU_TX_OPERATIONAL | ||
| 2757 | * @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU. | ||
| 2758 | * valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL | ||
| 2759 | * @timeout: BA session timeout. Valid only when the action is set to | ||
| 2760 | * %IEEE80211_AMPDU_RX_START | ||
| 2761 | */ | ||
| 2762 | struct ieee80211_ampdu_params { | ||
| 2763 | enum ieee80211_ampdu_mlme_action action; | ||
| 2764 | struct ieee80211_sta *sta; | ||
| 2765 | u16 tid; | ||
| 2766 | u16 ssn; | ||
| 2767 | u8 buf_size; | ||
| 2768 | bool amsdu; | ||
| 2769 | u16 timeout; | ||
| 2770 | }; | ||
| 2771 | |||
| 2772 | /** | ||
| 2687 | * enum ieee80211_frame_release_type - frame release reason | 2773 | * enum ieee80211_frame_release_type - frame release reason |
| 2688 | * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll | 2774 | * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll |
| 2689 | * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to | 2775 | * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to |
| @@ -3027,13 +3113,9 @@ enum ieee80211_reconfig_type { | |||
| 3027 | * @ampdu_action: Perform a certain A-MPDU action | 3113 | * @ampdu_action: Perform a certain A-MPDU action |
| 3028 | * The RA/TID combination determines the destination and TID we want | 3114 | * The RA/TID combination determines the destination and TID we want |
| 3029 | * the ampdu action to be performed for. The action is defined through | 3115 | * the ampdu action to be performed for. The action is defined through |
| 3030 | * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) | 3116 | * ieee80211_ampdu_mlme_action. |
| 3031 | * is the first frame we expect to perform the action on. Notice | 3117 | * When the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL the driver |
| 3032 | * that TX/RX_STOP can pass NULL for this parameter. | 3118 | * may neither send aggregates containing more subframes than @buf_size |
| 3033 | * The @buf_size parameter is only valid when the action is set to | ||
| 3034 | * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder | ||
| 3035 | * buffer size (number of subframes) for this session -- the driver | ||
| 3036 | * may neither send aggregates containing more subframes than this | ||
| 3037 | * nor send aggregates in a way that lost frames would exceed the | 3119 | * nor send aggregates in a way that lost frames would exceed the |
| 3038 | * buffer size. If just limiting the aggregate size, this would be | 3120 | * buffer size. If just limiting the aggregate size, this would be |
| 3039 | * possible with a buf_size of 8: | 3121 | * possible with a buf_size of 8: |
| @@ -3044,9 +3126,6 @@ enum ieee80211_reconfig_type { | |||
| 3044 | * buffer size of 8. Correct ways to retransmit #1 would be: | 3126 | * buffer size of 8. Correct ways to retransmit #1 would be: |
| 3045 | * - TX: 1 or 18 or 81 | 3127 | * - TX: 1 or 18 or 81 |
| 3046 | * Even "189" would be wrong since 1 could be lost again. | 3128 | * Even "189" would be wrong since 1 could be lost again. |
| 3047 | * The @amsdu parameter is valid when the action is set to | ||
| 3048 | * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's ability | ||
| 3049 | * to receive A-MSDU within A-MPDU. | ||
| 3050 | * | 3129 | * |
| 3051 | * Returns a negative error code on failure. | 3130 | * Returns a negative error code on failure. |
| 3052 | * The callback can sleep. | 3131 | * The callback can sleep. |
| @@ -3388,9 +3467,7 @@ struct ieee80211_ops { | |||
| 3388 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 3467 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
| 3389 | int (*ampdu_action)(struct ieee80211_hw *hw, | 3468 | int (*ampdu_action)(struct ieee80211_hw *hw, |
| 3390 | struct ieee80211_vif *vif, | 3469 | struct ieee80211_vif *vif, |
| 3391 | enum ieee80211_ampdu_mlme_action action, | 3470 | struct ieee80211_ampdu_params *params); |
| 3392 | struct ieee80211_sta *sta, u16 tid, u16 *ssn, | ||
| 3393 | u8 buf_size, bool amsdu); | ||
| 3394 | int (*get_survey)(struct ieee80211_hw *hw, int idx, | 3471 | int (*get_survey)(struct ieee80211_hw *hw, int idx, |
| 3395 | struct survey_info *survey); | 3472 | struct survey_info *survey); |
| 3396 | void (*rfkill_poll)(struct ieee80211_hw *hw); | 3473 | void (*rfkill_poll)(struct ieee80211_hw *hw); |
| @@ -4374,21 +4451,19 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, | |||
| 4374 | struct sk_buff *skb, u8 *p2k); | 4451 | struct sk_buff *skb, u8 *p2k); |
| 4375 | 4452 | ||
| 4376 | /** | 4453 | /** |
| 4377 | * ieee80211_get_key_tx_seq - get key TX sequence counter | 4454 | * ieee80211_tkip_add_iv - write TKIP IV and Ext. IV to pos |
| 4378 | * | 4455 | * |
| 4456 | * @pos: start of crypto header | ||
| 4379 | * @keyconf: the parameter passed with the set key | 4457 | * @keyconf: the parameter passed with the set key |
| 4380 | * @seq: buffer to receive the sequence data | 4458 | * @pn: PN to add |
| 4381 | * | 4459 | * |
| 4382 | * This function allows a driver to retrieve the current TX IV/PN | 4460 | * Returns: pointer to the octet following IVs (i.e. beginning of |
| 4383 | * for the given key. It must not be called if IV generation is | 4461 | * the packet payload) |
| 4384 | * offloaded to the device. | ||
| 4385 | * | 4462 | * |
| 4386 | * Note that this function may only be called when no TX processing | 4463 | * This function writes the tkip IV value to pos (which should |
| 4387 | * can be done concurrently, for example when queues are stopped | 4464 | * point to the crypto header) |
| 4388 | * and the stop has been synchronized. | ||
| 4389 | */ | 4465 | */ |
| 4390 | void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf, | 4466 | u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key_conf *keyconf, u64 pn); |
| 4391 | struct ieee80211_key_seq *seq); | ||
| 4392 | 4467 | ||
| 4393 | /** | 4468 | /** |
| 4394 | * ieee80211_get_key_rx_seq - get key RX sequence counter | 4469 | * ieee80211_get_key_rx_seq - get key RX sequence counter |
| @@ -4410,23 +4485,6 @@ void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, | |||
| 4410 | int tid, struct ieee80211_key_seq *seq); | 4485 | int tid, struct ieee80211_key_seq *seq); |
| 4411 | 4486 | ||
| 4412 | /** | 4487 | /** |
| 4413 | * ieee80211_set_key_tx_seq - set key TX sequence counter | ||
| 4414 | * | ||
| 4415 | * @keyconf: the parameter passed with the set key | ||
| 4416 | * @seq: new sequence data | ||
| 4417 | * | ||
| 4418 | * This function allows a driver to set the current TX IV/PNs for the | ||
| 4419 | * given key. This is useful when resuming from WoWLAN sleep and the | ||
| 4420 | * device may have transmitted frames using the PTK, e.g. replies to | ||
| 4421 | * ARP requests. | ||
| 4422 | * | ||
| 4423 | * Note that this function may only be called when no TX processing | ||
| 4424 | * can be done concurrently. | ||
| 4425 | */ | ||
| 4426 | void ieee80211_set_key_tx_seq(struct ieee80211_key_conf *keyconf, | ||
| 4427 | struct ieee80211_key_seq *seq); | ||
| 4428 | |||
| 4429 | /** | ||
| 4430 | * ieee80211_set_key_rx_seq - set key RX sequence counter | 4488 | * ieee80211_set_key_rx_seq - set key RX sequence counter |
| 4431 | * | 4489 | * |
| 4432 | * @keyconf: the parameter passed with the set key | 4490 | * @keyconf: the parameter passed with the set key |
| @@ -5121,6 +5179,24 @@ void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap, | |||
| 5121 | const u8 *addr); | 5179 | const u8 *addr); |
| 5122 | 5180 | ||
| 5123 | /** | 5181 | /** |
| 5182 | * ieee80211_mark_rx_ba_filtered_frames - move RX BA window and mark filtered | ||
| 5183 | * @pubsta: station struct | ||
| 5184 | * @tid: the session's TID | ||
| 5185 | * @ssn: starting sequence number of the bitmap, all frames before this are | ||
| 5186 | * assumed to be out of the window after the call | ||
| 5187 | * @filtered: bitmap of filtered frames, BIT(0) is the @ssn entry etc. | ||
| 5188 | * @received_mpdus: number of received mpdus in firmware | ||
| 5189 | * | ||
| 5190 | * This function moves the BA window and releases all frames before @ssn, and | ||
| 5191 | * marks frames marked in the bitmap as having been filtered. Afterwards, it | ||
| 5192 | * checks if any frames in the window starting from @ssn can now be released | ||
| 5193 | * (in case they were only waiting for frames that were filtered.) | ||
| 5194 | */ | ||
| 5195 | void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid, | ||
| 5196 | u16 ssn, u64 filtered, | ||
| 5197 | u16 received_mpdus); | ||
| 5198 | |||
| 5199 | /** | ||
| 5124 | * ieee80211_send_bar - send a BlockAckReq frame | 5200 | * ieee80211_send_bar - send a BlockAckReq frame |
| 5125 | * | 5201 | * |
| 5126 | * can be used to flush pending frames from the peer's aggregation reorder | 5202 | * can be used to flush pending frames from the peer's aggregation reorder |
| @@ -5371,6 +5447,21 @@ ieee80211_vif_type_p2p(struct ieee80211_vif *vif) | |||
| 5371 | return ieee80211_iftype_p2p(vif->type, vif->p2p); | 5447 | return ieee80211_iftype_p2p(vif->type, vif->p2p); |
| 5372 | } | 5448 | } |
| 5373 | 5449 | ||
| 5450 | /** | ||
| 5451 | * ieee80211_update_mu_groups - set the VHT MU-MIMO groud data | ||
| 5452 | * | ||
| 5453 | * @vif: the specified virtual interface | ||
| 5454 | * @membership: 64 bits array - a bit is set if station is member of the group | ||
| 5455 | * @position: 2 bits per group id indicating the position in the group | ||
| 5456 | * | ||
| 5457 | * Note: This function assumes that the given vif is valid and the position and | ||
| 5458 | * membership data is of the correct size and are in the same byte order as the | ||
| 5459 | * matching GroupId management frame. | ||
| 5460 | * Calls to this function need to be serialized with RX path. | ||
| 5461 | */ | ||
| 5462 | void ieee80211_update_mu_groups(struct ieee80211_vif *vif, | ||
| 5463 | const u8 *membership, const u8 *position); | ||
| 5464 | |||
| 5374 | void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif, | 5465 | void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif, |
| 5375 | int rssi_min_thold, | 5466 | int rssi_min_thold, |
| 5376 | int rssi_max_thold); | 5467 | int rssi_max_thold); |
| @@ -5523,4 +5614,19 @@ void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid); | |||
| 5523 | */ | 5614 | */ |
| 5524 | struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, | 5615 | struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, |
| 5525 | struct ieee80211_txq *txq); | 5616 | struct ieee80211_txq *txq); |
| 5617 | |||
| 5618 | /** | ||
| 5619 | * ieee80211_txq_get_depth - get pending frame/byte count of given txq | ||
| 5620 | * | ||
| 5621 | * The values are not guaranteed to be coherent with regard to each other, i.e. | ||
| 5622 | * txq state can change half-way of this function and the caller may end up | ||
| 5623 | * with "new" frame_cnt and "old" byte_cnt or vice-versa. | ||
| 5624 | * | ||
| 5625 | * @txq: pointer obtained from station or virtual interface | ||
| 5626 | * @frame_cnt: pointer to store frame count | ||
| 5627 | * @byte_cnt: pointer to store byte count | ||
| 5628 | */ | ||
| 5629 | void ieee80211_txq_get_depth(struct ieee80211_txq *txq, | ||
| 5630 | unsigned long *frame_cnt, | ||
| 5631 | unsigned long *byte_cnt); | ||
| 5526 | #endif /* MAC80211_H */ | 5632 | #endif /* MAC80211_H */ |
diff --git a/include/net/mac802154.h b/include/net/mac802154.h index da574bbdc333..6cd7a70706a9 100644 --- a/include/net/mac802154.h +++ b/include/net/mac802154.h | |||
| @@ -16,10 +16,10 @@ | |||
| 16 | #ifndef NET_MAC802154_H | 16 | #ifndef NET_MAC802154_H |
| 17 | #define NET_MAC802154_H | 17 | #define NET_MAC802154_H |
| 18 | 18 | ||
| 19 | #include <asm/unaligned.h> | ||
| 19 | #include <net/af_ieee802154.h> | 20 | #include <net/af_ieee802154.h> |
| 20 | #include <linux/ieee802154.h> | 21 | #include <linux/ieee802154.h> |
| 21 | #include <linux/skbuff.h> | 22 | #include <linux/skbuff.h> |
| 22 | #include <linux/unaligned/memmove.h> | ||
| 23 | 23 | ||
| 24 | #include <net/cfg802154.h> | 24 | #include <net/cfg802154.h> |
| 25 | 25 | ||
| @@ -247,13 +247,14 @@ struct ieee802154_ops { | |||
| 247 | */ | 247 | */ |
| 248 | static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb) | 248 | static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb) |
| 249 | { | 249 | { |
| 250 | /* return some invalid fc on failure */ | 250 | /* check if we can fc at skb_mac_header of sk buffer */ |
| 251 | if (unlikely(skb->len < 2)) { | 251 | if (unlikely(!skb_mac_header_was_set(skb) || |
| 252 | (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) { | ||
| 252 | WARN_ON(1); | 253 | WARN_ON(1); |
| 253 | return cpu_to_le16(0); | 254 | return cpu_to_le16(0); |
| 254 | } | 255 | } |
| 255 | 256 | ||
| 256 | return (__force __le16)__get_unaligned_memmove16(skb_mac_header(skb)); | 257 | return get_unaligned_le16(skb_mac_header(skb)); |
| 257 | } | 258 | } |
| 258 | 259 | ||
| 259 | /** | 260 | /** |
| @@ -263,7 +264,7 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb) | |||
| 263 | */ | 264 | */ |
| 264 | static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src) | 265 | static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src) |
| 265 | { | 266 | { |
| 266 | __put_unaligned_memmove64(swab64p(be64_src), le64_dst); | 267 | put_unaligned_le64(get_unaligned_be64(be64_src), le64_dst); |
| 267 | } | 268 | } |
| 268 | 269 | ||
| 269 | /** | 270 | /** |
| @@ -273,7 +274,7 @@ static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src) | |||
| 273 | */ | 274 | */ |
| 274 | static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src) | 275 | static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src) |
| 275 | { | 276 | { |
| 276 | __put_unaligned_memmove64(swab64p(le64_src), be64_dst); | 277 | put_unaligned_be64(get_unaligned_le64(le64_src), be64_dst); |
| 277 | } | 278 | } |
| 278 | 279 | ||
| 279 | /** | 280 | /** |
| @@ -283,7 +284,7 @@ static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src) | |||
| 283 | */ | 284 | */ |
| 284 | static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src) | 285 | static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src) |
| 285 | { | 286 | { |
| 286 | __put_unaligned_memmove16(swab16p(le16_src), be16_dst); | 287 | put_unaligned_be16(get_unaligned_le16(le16_src), be16_dst); |
| 287 | } | 288 | } |
| 288 | 289 | ||
| 289 | /** | 290 | /** |
diff --git a/include/net/netfilter/nft_masq.h b/include/net/netfilter/nft_masq.h index e2a518b60e19..a3f3c11b2526 100644 --- a/include/net/netfilter/nft_masq.h +++ b/include/net/netfilter/nft_masq.h | |||
| @@ -2,7 +2,9 @@ | |||
| 2 | #define _NFT_MASQ_H_ | 2 | #define _NFT_MASQ_H_ |
| 3 | 3 | ||
| 4 | struct nft_masq { | 4 | struct nft_masq { |
| 5 | u32 flags; | 5 | u32 flags; |
| 6 | enum nft_registers sreg_proto_min:8; | ||
| 7 | enum nft_registers sreg_proto_max:8; | ||
| 6 | }; | 8 | }; |
| 7 | 9 | ||
| 8 | extern const struct nla_policy nft_masq_policy[]; | 10 | extern const struct nla_policy nft_masq_policy[]; |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 2b7907a35568..a69cde3ce460 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
| @@ -80,9 +80,13 @@ struct netns_ipv4 { | |||
| 80 | int sysctl_tcp_ecn; | 80 | int sysctl_tcp_ecn; |
| 81 | int sysctl_tcp_ecn_fallback; | 81 | int sysctl_tcp_ecn_fallback; |
| 82 | 82 | ||
| 83 | int sysctl_ip_default_ttl; | ||
| 83 | int sysctl_ip_no_pmtu_disc; | 84 | int sysctl_ip_no_pmtu_disc; |
| 84 | int sysctl_ip_fwd_use_pmtu; | 85 | int sysctl_ip_fwd_use_pmtu; |
| 85 | int sysctl_ip_nonlocal_bind; | 86 | int sysctl_ip_nonlocal_bind; |
| 87 | /* Shall we try to damage output packets if routing dev changes? */ | ||
| 88 | int sysctl_ip_dynaddr; | ||
| 89 | int sysctl_ip_early_demux; | ||
| 86 | 90 | ||
| 87 | int sysctl_fwmark_reflect; | 91 | int sysctl_fwmark_reflect; |
| 88 | int sysctl_tcp_fwmark_accept; | 92 | int sysctl_tcp_fwmark_accept; |
| @@ -98,6 +102,21 @@ struct netns_ipv4 { | |||
| 98 | int sysctl_tcp_keepalive_probes; | 102 | int sysctl_tcp_keepalive_probes; |
| 99 | int sysctl_tcp_keepalive_intvl; | 103 | int sysctl_tcp_keepalive_intvl; |
| 100 | 104 | ||
| 105 | int sysctl_tcp_syn_retries; | ||
| 106 | int sysctl_tcp_synack_retries; | ||
| 107 | int sysctl_tcp_syncookies; | ||
| 108 | int sysctl_tcp_reordering; | ||
| 109 | int sysctl_tcp_retries1; | ||
| 110 | int sysctl_tcp_retries2; | ||
| 111 | int sysctl_tcp_orphan_retries; | ||
| 112 | int sysctl_tcp_fin_timeout; | ||
| 113 | unsigned int sysctl_tcp_notsent_lowat; | ||
| 114 | |||
| 115 | int sysctl_igmp_max_memberships; | ||
| 116 | int sysctl_igmp_max_msf; | ||
| 117 | int sysctl_igmp_llm_reports; | ||
| 118 | int sysctl_igmp_qrv; | ||
| 119 | |||
| 101 | struct ping_group_range ping_group_range; | 120 | struct ping_group_range ping_group_range; |
| 102 | 121 | ||
| 103 | atomic_t dev_addr_genid; | 122 | atomic_t dev_addr_genid; |
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index c0368db6df54..10d0848f5b8a 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
| @@ -58,7 +58,10 @@ struct netns_ipv6 { | |||
| 58 | struct timer_list ip6_fib_timer; | 58 | struct timer_list ip6_fib_timer; |
| 59 | struct hlist_head *fib_table_hash; | 59 | struct hlist_head *fib_table_hash; |
| 60 | struct fib6_table *fib6_main_tbl; | 60 | struct fib6_table *fib6_main_tbl; |
| 61 | struct list_head fib6_walkers; | ||
| 61 | struct dst_ops ip6_dst_ops; | 62 | struct dst_ops ip6_dst_ops; |
| 63 | rwlock_t fib6_walker_lock; | ||
| 64 | spinlock_t fib6_gc_lock; | ||
| 62 | unsigned int ip6_rt_gc_expire; | 65 | unsigned int ip6_rt_gc_expire; |
| 63 | unsigned long ip6_rt_last_gc; | 66 | unsigned long ip6_rt_last_gc; |
| 64 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 67 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h index 68e509750caa..039cc29cb4a8 100644 --- a/include/net/phonet/phonet.h +++ b/include/net/phonet/phonet.h | |||
| @@ -51,7 +51,7 @@ void pn_sock_init(void); | |||
| 51 | struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa); | 51 | struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa); |
| 52 | void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb); | 52 | void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb); |
| 53 | void phonet_get_local_port_range(int *min, int *max); | 53 | void phonet_get_local_port_range(int *min, int *max); |
| 54 | void pn_sock_hash(struct sock *sk); | 54 | int pn_sock_hash(struct sock *sk); |
| 55 | void pn_sock_unhash(struct sock *sk); | 55 | void pn_sock_unhash(struct sock *sk); |
| 56 | int pn_sock_get_port(struct sock *sk, unsigned short sport); | 56 | int pn_sock_get_port(struct sock *sk, unsigned short sport); |
| 57 | 57 | ||
diff --git a/include/net/ping.h b/include/net/ping.h index ac80cb45e630..5fd7cc244833 100644 --- a/include/net/ping.h +++ b/include/net/ping.h | |||
| @@ -65,7 +65,7 @@ struct pingfakehdr { | |||
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | int ping_get_port(struct sock *sk, unsigned short ident); | 67 | int ping_get_port(struct sock *sk, unsigned short ident); |
| 68 | void ping_hash(struct sock *sk); | 68 | int ping_hash(struct sock *sk); |
| 69 | void ping_unhash(struct sock *sk); | 69 | void ping_unhash(struct sock *sk); |
| 70 | 70 | ||
| 71 | int ping_init_sock(struct sock *sk); | 71 | int ping_init_sock(struct sock *sk); |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index bc49967e1a68..caa5e18636df 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
| @@ -358,4 +358,69 @@ tcf_match_indev(struct sk_buff *skb, int ifindex) | |||
| 358 | } | 358 | } |
| 359 | #endif /* CONFIG_NET_CLS_IND */ | 359 | #endif /* CONFIG_NET_CLS_IND */ |
| 360 | 360 | ||
| 361 | struct tc_cls_u32_knode { | ||
| 362 | struct tcf_exts *exts; | ||
| 363 | struct tc_u32_sel *sel; | ||
| 364 | u32 handle; | ||
| 365 | u32 val; | ||
| 366 | u32 mask; | ||
| 367 | u32 link_handle; | ||
| 368 | u8 fshift; | ||
| 369 | }; | ||
| 370 | |||
| 371 | struct tc_cls_u32_hnode { | ||
| 372 | u32 handle; | ||
| 373 | u32 prio; | ||
| 374 | unsigned int divisor; | ||
| 375 | }; | ||
| 376 | |||
| 377 | enum tc_clsu32_command { | ||
| 378 | TC_CLSU32_NEW_KNODE, | ||
| 379 | TC_CLSU32_REPLACE_KNODE, | ||
| 380 | TC_CLSU32_DELETE_KNODE, | ||
| 381 | TC_CLSU32_NEW_HNODE, | ||
| 382 | TC_CLSU32_REPLACE_HNODE, | ||
| 383 | TC_CLSU32_DELETE_HNODE, | ||
| 384 | }; | ||
| 385 | |||
| 386 | struct tc_cls_u32_offload { | ||
| 387 | /* knode values */ | ||
| 388 | enum tc_clsu32_command command; | ||
| 389 | union { | ||
| 390 | struct tc_cls_u32_knode knode; | ||
| 391 | struct tc_cls_u32_hnode hnode; | ||
| 392 | }; | ||
| 393 | }; | ||
| 394 | |||
| 395 | /* tca flags definitions */ | ||
| 396 | #define TCA_CLS_FLAGS_SKIP_HW 1 | ||
| 397 | |||
| 398 | static inline bool tc_should_offload(struct net_device *dev, u32 flags) | ||
| 399 | { | ||
| 400 | if (!(dev->features & NETIF_F_HW_TC)) | ||
| 401 | return false; | ||
| 402 | |||
| 403 | if (flags & TCA_CLS_FLAGS_SKIP_HW) | ||
| 404 | return false; | ||
| 405 | |||
| 406 | if (!dev->netdev_ops->ndo_setup_tc) | ||
| 407 | return false; | ||
| 408 | |||
| 409 | return true; | ||
| 410 | } | ||
| 411 | |||
| 412 | enum tc_fl_command { | ||
| 413 | TC_CLSFLOWER_REPLACE, | ||
| 414 | TC_CLSFLOWER_DESTROY, | ||
| 415 | }; | ||
| 416 | |||
| 417 | struct tc_cls_flower_offload { | ||
| 418 | enum tc_fl_command command; | ||
| 419 | unsigned long cookie; | ||
| 420 | struct flow_dissector *dissector; | ||
| 421 | struct fl_flow_key *mask; | ||
| 422 | struct fl_flow_key *key; | ||
| 423 | struct tcf_exts *exts; | ||
| 424 | }; | ||
| 425 | |||
| 361 | #endif | 426 | #endif |
diff --git a/include/net/raw.h b/include/net/raw.h index 6a40c6562dd2..3e789008394d 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
| @@ -57,7 +57,7 @@ int raw_seq_open(struct inode *ino, struct file *file, | |||
| 57 | 57 | ||
| 58 | #endif | 58 | #endif |
| 59 | 59 | ||
| 60 | void raw_hash_sk(struct sock *sk); | 60 | int raw_hash_sk(struct sock *sk); |
| 61 | void raw_unhash_sk(struct sock *sk); | 61 | void raw_unhash_sk(struct sock *sk); |
| 62 | 62 | ||
| 63 | struct raw_sock { | 63 | struct raw_sock { |
diff --git a/include/net/route.h b/include/net/route.h index a3b9ef74a389..9b0a523bb428 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
| @@ -329,14 +329,13 @@ static inline int inet_iif(const struct sk_buff *skb) | |||
| 329 | return skb->skb_iif; | 329 | return skb->skb_iif; |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | extern int sysctl_ip_default_ttl; | ||
| 333 | |||
| 334 | static inline int ip4_dst_hoplimit(const struct dst_entry *dst) | 332 | static inline int ip4_dst_hoplimit(const struct dst_entry *dst) |
| 335 | { | 333 | { |
| 336 | int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT); | 334 | int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT); |
| 335 | struct net *net = dev_net(dst->dev); | ||
| 337 | 336 | ||
| 338 | if (hoplimit == 0) | 337 | if (hoplimit == 0) |
| 339 | hoplimit = sysctl_ip_default_ttl; | 338 | hoplimit = net->ipv4.sysctl_ip_default_ttl; |
| 340 | return hoplimit; | 339 | return hoplimit; |
| 341 | } | 340 | } |
| 342 | 341 | ||
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 636a362a0e03..46e55f0202a6 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -345,6 +345,12 @@ extern struct Qdisc_ops pfifo_fast_ops; | |||
| 345 | extern struct Qdisc_ops mq_qdisc_ops; | 345 | extern struct Qdisc_ops mq_qdisc_ops; |
| 346 | extern struct Qdisc_ops noqueue_qdisc_ops; | 346 | extern struct Qdisc_ops noqueue_qdisc_ops; |
| 347 | extern const struct Qdisc_ops *default_qdisc_ops; | 347 | extern const struct Qdisc_ops *default_qdisc_ops; |
| 348 | static inline const struct Qdisc_ops * | ||
| 349 | get_default_qdisc_ops(const struct net_device *dev, int ntx) | ||
| 350 | { | ||
| 351 | return ntx < dev->real_num_tx_queues ? | ||
| 352 | default_qdisc_ops : &pfifo_fast_ops; | ||
| 353 | } | ||
| 348 | 354 | ||
| 349 | struct Qdisc_class_common { | 355 | struct Qdisc_class_common { |
| 350 | u32 classid; | 356 | u32 classid; |
| @@ -396,7 +402,8 @@ struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, | |||
| 396 | struct Qdisc *qdisc); | 402 | struct Qdisc *qdisc); |
| 397 | void qdisc_reset(struct Qdisc *qdisc); | 403 | void qdisc_reset(struct Qdisc *qdisc); |
| 398 | void qdisc_destroy(struct Qdisc *qdisc); | 404 | void qdisc_destroy(struct Qdisc *qdisc); |
| 399 | void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); | 405 | void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n, |
| 406 | unsigned int len); | ||
| 400 | struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, | 407 | struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, |
| 401 | const struct Qdisc_ops *ops); | 408 | const struct Qdisc_ops *ops); |
| 402 | struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, | 409 | struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, |
| @@ -707,6 +714,23 @@ static inline void qdisc_reset_queue(struct Qdisc *sch) | |||
| 707 | sch->qstats.backlog = 0; | 714 | sch->qstats.backlog = 0; |
| 708 | } | 715 | } |
| 709 | 716 | ||
| 717 | static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new, | ||
| 718 | struct Qdisc **pold) | ||
| 719 | { | ||
| 720 | struct Qdisc *old; | ||
| 721 | |||
| 722 | sch_tree_lock(sch); | ||
| 723 | old = *pold; | ||
| 724 | *pold = new; | ||
| 725 | if (old != NULL) { | ||
| 726 | qdisc_tree_reduce_backlog(old, old->q.qlen, old->qstats.backlog); | ||
| 727 | qdisc_reset(old); | ||
| 728 | } | ||
| 729 | sch_tree_unlock(sch); | ||
| 730 | |||
| 731 | return old; | ||
| 732 | } | ||
| 733 | |||
| 710 | static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch, | 734 | static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch, |
| 711 | struct sk_buff_head *list) | 735 | struct sk_buff_head *list) |
| 712 | { | 736 | { |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 487ef34bbd63..efc01743b9d6 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
| @@ -201,7 +201,7 @@ struct sctp_chunk *sctp_make_cwr(const struct sctp_association *, | |||
| 201 | struct sctp_chunk * sctp_make_datafrag_empty(struct sctp_association *, | 201 | struct sctp_chunk * sctp_make_datafrag_empty(struct sctp_association *, |
| 202 | const struct sctp_sndrcvinfo *sinfo, | 202 | const struct sctp_sndrcvinfo *sinfo, |
| 203 | int len, const __u8 flags, | 203 | int len, const __u8 flags, |
| 204 | __u16 ssn); | 204 | __u16 ssn, gfp_t gfp); |
| 205 | struct sctp_chunk *sctp_make_ecne(const struct sctp_association *, | 205 | struct sctp_chunk *sctp_make_ecne(const struct sctp_association *, |
| 206 | const __u32); | 206 | const __u32); |
| 207 | struct sctp_chunk *sctp_make_sack(const struct sctp_association *); | 207 | struct sctp_chunk *sctp_make_sack(const struct sctp_association *); |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 5a57409da37b..e2ac0620d4be 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -535,7 +535,6 @@ struct sctp_datamsg { | |||
| 535 | struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, | 535 | struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, |
| 536 | struct sctp_sndrcvinfo *, | 536 | struct sctp_sndrcvinfo *, |
| 537 | struct iov_iter *); | 537 | struct iov_iter *); |
| 538 | void sctp_datamsg_free(struct sctp_datamsg *); | ||
| 539 | void sctp_datamsg_put(struct sctp_datamsg *); | 538 | void sctp_datamsg_put(struct sctp_datamsg *); |
| 540 | void sctp_chunk_fail(struct sctp_chunk *, int error); | 539 | void sctp_chunk_fail(struct sctp_chunk *, int error); |
| 541 | int sctp_chunk_abandoned(struct sctp_chunk *); | 540 | int sctp_chunk_abandoned(struct sctp_chunk *); |
| @@ -656,7 +655,7 @@ void sctp_chunk_free(struct sctp_chunk *); | |||
| 656 | void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); | 655 | void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); |
| 657 | struct sctp_chunk *sctp_chunkify(struct sk_buff *, | 656 | struct sctp_chunk *sctp_chunkify(struct sk_buff *, |
| 658 | const struct sctp_association *, | 657 | const struct sctp_association *, |
| 659 | struct sock *); | 658 | struct sock *, gfp_t gfp); |
| 660 | void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *, | 659 | void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *, |
| 661 | union sctp_addr *); | 660 | union sctp_addr *); |
| 662 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); | 661 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); |
| @@ -718,10 +717,10 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *, | |||
| 718 | __u16 sport, __u16 dport); | 717 | __u16 sport, __u16 dport); |
| 719 | struct sctp_packet *sctp_packet_config(struct sctp_packet *, __u32 vtag, int); | 718 | struct sctp_packet *sctp_packet_config(struct sctp_packet *, __u32 vtag, int); |
| 720 | sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *, | 719 | sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *, |
| 721 | struct sctp_chunk *, int); | 720 | struct sctp_chunk *, int, gfp_t); |
| 722 | sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *, | 721 | sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *, |
| 723 | struct sctp_chunk *); | 722 | struct sctp_chunk *); |
| 724 | int sctp_packet_transmit(struct sctp_packet *); | 723 | int sctp_packet_transmit(struct sctp_packet *, gfp_t); |
| 725 | void sctp_packet_free(struct sctp_packet *); | 724 | void sctp_packet_free(struct sctp_packet *); |
| 726 | 725 | ||
| 727 | static inline int sctp_packet_empty(struct sctp_packet *packet) | 726 | static inline int sctp_packet_empty(struct sctp_packet *packet) |
| @@ -1054,7 +1053,7 @@ struct sctp_outq { | |||
| 1054 | void sctp_outq_init(struct sctp_association *, struct sctp_outq *); | 1053 | void sctp_outq_init(struct sctp_association *, struct sctp_outq *); |
| 1055 | void sctp_outq_teardown(struct sctp_outq *); | 1054 | void sctp_outq_teardown(struct sctp_outq *); |
| 1056 | void sctp_outq_free(struct sctp_outq*); | 1055 | void sctp_outq_free(struct sctp_outq*); |
| 1057 | int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk); | 1056 | int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk, gfp_t); |
| 1058 | int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *); | 1057 | int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *); |
| 1059 | int sctp_outq_is_empty(const struct sctp_outq *); | 1058 | int sctp_outq_is_empty(const struct sctp_outq *); |
| 1060 | void sctp_outq_restart(struct sctp_outq *); | 1059 | void sctp_outq_restart(struct sctp_outq *); |
| @@ -1062,7 +1061,7 @@ void sctp_outq_restart(struct sctp_outq *); | |||
| 1062 | void sctp_retransmit(struct sctp_outq *, struct sctp_transport *, | 1061 | void sctp_retransmit(struct sctp_outq *, struct sctp_transport *, |
| 1063 | sctp_retransmit_reason_t); | 1062 | sctp_retransmit_reason_t); |
| 1064 | void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8); | 1063 | void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8); |
| 1065 | int sctp_outq_uncork(struct sctp_outq *); | 1064 | int sctp_outq_uncork(struct sctp_outq *, gfp_t gfp); |
| 1066 | /* Uncork and flush an outqueue. */ | 1065 | /* Uncork and flush an outqueue. */ |
| 1067 | static inline void sctp_outq_cork(struct sctp_outq *q) | 1066 | static inline void sctp_outq_cork(struct sctp_outq *q) |
| 1068 | { | 1067 | { |
diff --git a/include/net/sock.h b/include/net/sock.h index f5ea148853e2..255d3e03727b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -984,7 +984,7 @@ struct proto { | |||
| 984 | void (*release_cb)(struct sock *sk); | 984 | void (*release_cb)(struct sock *sk); |
| 985 | 985 | ||
| 986 | /* Keeping track of sk's, looking them up, and port selection methods. */ | 986 | /* Keeping track of sk's, looking them up, and port selection methods. */ |
| 987 | void (*hash)(struct sock *sk); | 987 | int (*hash)(struct sock *sk); |
| 988 | void (*unhash)(struct sock *sk); | 988 | void (*unhash)(struct sock *sk); |
| 989 | void (*rehash)(struct sock *sk); | 989 | void (*rehash)(struct sock *sk); |
| 990 | int (*get_port)(struct sock *sk, unsigned short snum); | 990 | int (*get_port)(struct sock *sk, unsigned short snum); |
| @@ -1194,10 +1194,10 @@ static inline void sock_prot_inuse_add(struct net *net, struct proto *prot, | |||
| 1194 | /* With per-bucket locks this operation is not-atomic, so that | 1194 | /* With per-bucket locks this operation is not-atomic, so that |
| 1195 | * this version is not worse. | 1195 | * this version is not worse. |
| 1196 | */ | 1196 | */ |
| 1197 | static inline void __sk_prot_rehash(struct sock *sk) | 1197 | static inline int __sk_prot_rehash(struct sock *sk) |
| 1198 | { | 1198 | { |
| 1199 | sk->sk_prot->unhash(sk); | 1199 | sk->sk_prot->unhash(sk); |
| 1200 | sk->sk_prot->hash(sk); | 1200 | return sk->sk_prot->hash(sk); |
| 1201 | } | 1201 | } |
| 1202 | 1202 | ||
| 1203 | void sk_prot_clear_portaddr_nulls(struct sock *sk, int size); | 1203 | void sk_prot_clear_portaddr_nulls(struct sock *sk, int size); |
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h index 592a6bc02b0b..93c520b83d10 100644 --- a/include/net/tc_act/tc_gact.h +++ b/include/net/tc_act/tc_gact.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define __NET_TC_GACT_H | 2 | #define __NET_TC_GACT_H |
| 3 | 3 | ||
| 4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
| 5 | #include <linux/tc_act/tc_gact.h> | ||
| 5 | 6 | ||
| 6 | struct tcf_gact { | 7 | struct tcf_gact { |
| 7 | struct tcf_common common; | 8 | struct tcf_common common; |
| @@ -15,4 +16,19 @@ struct tcf_gact { | |||
| 15 | #define to_gact(a) \ | 16 | #define to_gact(a) \ |
| 16 | container_of(a->priv, struct tcf_gact, common) | 17 | container_of(a->priv, struct tcf_gact, common) |
| 17 | 18 | ||
| 19 | static inline bool is_tcf_gact_shot(const struct tc_action *a) | ||
| 20 | { | ||
| 21 | #ifdef CONFIG_NET_CLS_ACT | ||
| 22 | struct tcf_gact *gact; | ||
| 23 | |||
| 24 | if (a->ops && a->ops->type != TCA_ACT_GACT) | ||
| 25 | return false; | ||
| 26 | |||
| 27 | gact = a->priv; | ||
| 28 | if (gact->tcf_action == TC_ACT_SHOT) | ||
| 29 | return true; | ||
| 30 | |||
| 31 | #endif | ||
| 32 | return false; | ||
| 33 | } | ||
| 18 | #endif /* __NET_TC_GACT_H */ | 34 | #endif /* __NET_TC_GACT_H */ |
diff --git a/include/net/tc_act/tc_ife.h b/include/net/tc_act/tc_ife.h new file mode 100644 index 000000000000..dc9a09aefb33 --- /dev/null +++ b/include/net/tc_act/tc_ife.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | #ifndef __NET_TC_IFE_H | ||
| 2 | #define __NET_TC_IFE_H | ||
| 3 | |||
| 4 | #include <net/act_api.h> | ||
| 5 | #include <linux/etherdevice.h> | ||
| 6 | #include <linux/rtnetlink.h> | ||
| 7 | #include <linux/module.h> | ||
| 8 | |||
| 9 | #define IFE_METAHDRLEN 2 | ||
| 10 | struct tcf_ife_info { | ||
| 11 | struct tcf_common common; | ||
| 12 | u8 eth_dst[ETH_ALEN]; | ||
| 13 | u8 eth_src[ETH_ALEN]; | ||
| 14 | u16 eth_type; | ||
| 15 | u16 flags; | ||
| 16 | /* list of metaids allowed */ | ||
| 17 | struct list_head metalist; | ||
| 18 | }; | ||
| 19 | #define to_ife(a) \ | ||
| 20 | container_of(a->priv, struct tcf_ife_info, common) | ||
| 21 | |||
| 22 | struct tcf_meta_info { | ||
| 23 | const struct tcf_meta_ops *ops; | ||
| 24 | void *metaval; | ||
| 25 | u16 metaid; | ||
| 26 | struct list_head metalist; | ||
| 27 | }; | ||
| 28 | |||
| 29 | struct tcf_meta_ops { | ||
| 30 | u16 metaid; /*Maintainer provided ID */ | ||
| 31 | u16 metatype; /*netlink attribute type (look at net/netlink.h) */ | ||
| 32 | const char *name; | ||
| 33 | const char *synopsis; | ||
| 34 | struct list_head list; | ||
| 35 | int (*check_presence)(struct sk_buff *, struct tcf_meta_info *); | ||
| 36 | int (*encode)(struct sk_buff *, void *, struct tcf_meta_info *); | ||
| 37 | int (*decode)(struct sk_buff *, void *, u16 len); | ||
| 38 | int (*get)(struct sk_buff *skb, struct tcf_meta_info *mi); | ||
| 39 | int (*alloc)(struct tcf_meta_info *, void *); | ||
| 40 | void (*release)(struct tcf_meta_info *); | ||
| 41 | int (*validate)(void *val, int len); | ||
| 42 | struct module *owner; | ||
| 43 | }; | ||
| 44 | |||
| 45 | #define MODULE_ALIAS_IFE_META(metan) MODULE_ALIAS("ifemeta" __stringify_1(metan)) | ||
| 46 | |||
| 47 | int ife_get_meta_u32(struct sk_buff *skb, struct tcf_meta_info *mi); | ||
| 48 | int ife_get_meta_u16(struct sk_buff *skb, struct tcf_meta_info *mi); | ||
| 49 | int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, | ||
| 50 | const void *dval); | ||
| 51 | int ife_alloc_meta_u32(struct tcf_meta_info *mi, void *metaval); | ||
| 52 | int ife_alloc_meta_u16(struct tcf_meta_info *mi, void *metaval); | ||
| 53 | int ife_check_meta_u32(u32 metaval, struct tcf_meta_info *mi); | ||
| 54 | int ife_encode_meta_u32(u32 metaval, void *skbdata, struct tcf_meta_info *mi); | ||
| 55 | int ife_validate_meta_u32(void *val, int len); | ||
| 56 | int ife_validate_meta_u16(void *val, int len); | ||
| 57 | void ife_release_meta_gen(struct tcf_meta_info *mi); | ||
| 58 | int register_ife_op(struct tcf_meta_ops *mops); | ||
| 59 | int unregister_ife_op(struct tcf_meta_ops *mops); | ||
| 60 | |||
| 61 | #endif /* __NET_TC_IFE_H */ | ||
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h index 0df9a0db4a8e..b496d5ad7d42 100644 --- a/include/net/tc_act/tc_skbedit.h +++ b/include/net/tc_act/tc_skbedit.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #define __NET_TC_SKBEDIT_H | 20 | #define __NET_TC_SKBEDIT_H |
| 21 | 21 | ||
| 22 | #include <net/act_api.h> | 22 | #include <net/act_api.h> |
| 23 | #include <linux/tc_act/tc_skbedit.h> | ||
| 23 | 24 | ||
| 24 | struct tcf_skbedit { | 25 | struct tcf_skbedit { |
| 25 | struct tcf_common common; | 26 | struct tcf_common common; |
| @@ -32,4 +33,19 @@ struct tcf_skbedit { | |||
| 32 | #define to_skbedit(a) \ | 33 | #define to_skbedit(a) \ |
| 33 | container_of(a->priv, struct tcf_skbedit, common) | 34 | container_of(a->priv, struct tcf_skbedit, common) |
| 34 | 35 | ||
| 36 | /* Return true iff action is mark */ | ||
| 37 | static inline bool is_tcf_skbedit_mark(const struct tc_action *a) | ||
| 38 | { | ||
| 39 | #ifdef CONFIG_NET_CLS_ACT | ||
| 40 | if (a->ops && a->ops->type == TCA_ACT_SKBEDIT) | ||
| 41 | return to_skbedit(a)->flags == SKBEDIT_F_MARK; | ||
| 42 | #endif | ||
| 43 | return false; | ||
| 44 | } | ||
| 45 | |||
| 46 | static inline u32 tcf_skbedit_mark(const struct tc_action *a) | ||
| 47 | { | ||
| 48 | return to_skbedit(a)->mark; | ||
| 49 | } | ||
| 50 | |||
| 35 | #endif /* __NET_TC_SKBEDIT_H */ | 51 | #endif /* __NET_TC_SKBEDIT_H */ |
diff --git a/include/net/tcp.h b/include/net/tcp.h index b04bc989ad6c..b91370f61be6 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -238,13 +238,6 @@ extern struct inet_timewait_death_row tcp_death_row; | |||
| 238 | extern int sysctl_tcp_timestamps; | 238 | extern int sysctl_tcp_timestamps; |
| 239 | extern int sysctl_tcp_window_scaling; | 239 | extern int sysctl_tcp_window_scaling; |
| 240 | extern int sysctl_tcp_sack; | 240 | extern int sysctl_tcp_sack; |
| 241 | extern int sysctl_tcp_fin_timeout; | ||
| 242 | extern int sysctl_tcp_syn_retries; | ||
| 243 | extern int sysctl_tcp_synack_retries; | ||
| 244 | extern int sysctl_tcp_retries1; | ||
| 245 | extern int sysctl_tcp_retries2; | ||
| 246 | extern int sysctl_tcp_orphan_retries; | ||
| 247 | extern int sysctl_tcp_syncookies; | ||
| 248 | extern int sysctl_tcp_fastopen; | 241 | extern int sysctl_tcp_fastopen; |
| 249 | extern int sysctl_tcp_retrans_collapse; | 242 | extern int sysctl_tcp_retrans_collapse; |
| 250 | extern int sysctl_tcp_stdurg; | 243 | extern int sysctl_tcp_stdurg; |
| @@ -273,7 +266,6 @@ extern int sysctl_tcp_thin_dupack; | |||
| 273 | extern int sysctl_tcp_early_retrans; | 266 | extern int sysctl_tcp_early_retrans; |
| 274 | extern int sysctl_tcp_limit_output_bytes; | 267 | extern int sysctl_tcp_limit_output_bytes; |
| 275 | extern int sysctl_tcp_challenge_ack_limit; | 268 | extern int sysctl_tcp_challenge_ack_limit; |
| 276 | extern unsigned int sysctl_tcp_notsent_lowat; | ||
| 277 | extern int sysctl_tcp_min_tso_segs; | 269 | extern int sysctl_tcp_min_tso_segs; |
| 278 | extern int sysctl_tcp_min_rtt_wlen; | 270 | extern int sysctl_tcp_min_rtt_wlen; |
| 279 | extern int sysctl_tcp_autocorking; | 271 | extern int sysctl_tcp_autocorking; |
| @@ -567,6 +559,7 @@ void tcp_rearm_rto(struct sock *sk); | |||
| 567 | void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req); | 559 | void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req); |
| 568 | void tcp_reset(struct sock *sk); | 560 | void tcp_reset(struct sock *sk); |
| 569 | void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb); | 561 | void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb); |
| 562 | void tcp_fin(struct sock *sk); | ||
| 570 | 563 | ||
| 571 | /* tcp_timer.c */ | 564 | /* tcp_timer.c */ |
| 572 | void tcp_init_xmit_timers(struct sock *); | 565 | void tcp_init_xmit_timers(struct sock *); |
| @@ -962,9 +955,11 @@ static inline void tcp_enable_fack(struct tcp_sock *tp) | |||
| 962 | */ | 955 | */ |
| 963 | static inline void tcp_enable_early_retrans(struct tcp_sock *tp) | 956 | static inline void tcp_enable_early_retrans(struct tcp_sock *tp) |
| 964 | { | 957 | { |
| 958 | struct net *net = sock_net((struct sock *)tp); | ||
| 959 | |||
| 965 | tp->do_early_retrans = sysctl_tcp_early_retrans && | 960 | tp->do_early_retrans = sysctl_tcp_early_retrans && |
| 966 | sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack && | 961 | sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack && |
| 967 | sysctl_tcp_reordering == 3; | 962 | net->ipv4.sysctl_tcp_reordering == 3; |
| 968 | } | 963 | } |
| 969 | 964 | ||
| 970 | static inline void tcp_disable_early_retrans(struct tcp_sock *tp) | 965 | static inline void tcp_disable_early_retrans(struct tcp_sock *tp) |
| @@ -1251,7 +1246,7 @@ static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp) | |||
| 1251 | 1246 | ||
| 1252 | static inline int tcp_fin_time(const struct sock *sk) | 1247 | static inline int tcp_fin_time(const struct sock *sk) |
| 1253 | { | 1248 | { |
| 1254 | int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; | 1249 | int fin_timeout = tcp_sk(sk)->linger2 ? : sock_net(sk)->ipv4.sysctl_tcp_fin_timeout; |
| 1255 | const int rto = inet_csk(sk)->icsk_rto; | 1250 | const int rto = inet_csk(sk)->icsk_rto; |
| 1256 | 1251 | ||
| 1257 | if (fin_timeout < (rto << 2) - (rto >> 1)) | 1252 | if (fin_timeout < (rto << 2) - (rto >> 1)) |
| @@ -1433,6 +1428,7 @@ void tcp_free_fastopen_req(struct tcp_sock *tp); | |||
| 1433 | 1428 | ||
| 1434 | extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; | 1429 | extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; |
| 1435 | int tcp_fastopen_reset_cipher(void *key, unsigned int len); | 1430 | int tcp_fastopen_reset_cipher(void *key, unsigned int len); |
| 1431 | void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb); | ||
| 1436 | struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, | 1432 | struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, |
| 1437 | struct request_sock *req, | 1433 | struct request_sock *req, |
| 1438 | struct tcp_fastopen_cookie *foc, | 1434 | struct tcp_fastopen_cookie *foc, |
| @@ -1681,7 +1677,8 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr); | |||
| 1681 | 1677 | ||
| 1682 | static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) | 1678 | static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) |
| 1683 | { | 1679 | { |
| 1684 | return tp->notsent_lowat ?: sysctl_tcp_notsent_lowat; | 1680 | struct net *net = sock_net((struct sock *)tp); |
| 1681 | return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat; | ||
| 1685 | } | 1682 | } |
| 1686 | 1683 | ||
| 1687 | static inline bool tcp_stream_memory_free(const struct sock *sk) | 1684 | static inline bool tcp_stream_memory_free(const struct sock *sk) |
| @@ -1815,4 +1812,38 @@ static inline void skb_set_tcp_pure_ack(struct sk_buff *skb) | |||
| 1815 | skb->truesize = 2; | 1812 | skb->truesize = 2; |
| 1816 | } | 1813 | } |
| 1817 | 1814 | ||
| 1815 | static inline int tcp_inq(struct sock *sk) | ||
| 1816 | { | ||
| 1817 | struct tcp_sock *tp = tcp_sk(sk); | ||
| 1818 | int answ; | ||
| 1819 | |||
| 1820 | if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { | ||
| 1821 | answ = 0; | ||
| 1822 | } else if (sock_flag(sk, SOCK_URGINLINE) || | ||
| 1823 | !tp->urg_data || | ||
| 1824 | before(tp->urg_seq, tp->copied_seq) || | ||
| 1825 | !before(tp->urg_seq, tp->rcv_nxt)) { | ||
| 1826 | |||
| 1827 | answ = tp->rcv_nxt - tp->copied_seq; | ||
| 1828 | |||
| 1829 | /* Subtract 1, if FIN was received */ | ||
| 1830 | if (answ && sock_flag(sk, SOCK_DONE)) | ||
| 1831 | answ--; | ||
| 1832 | } else { | ||
| 1833 | answ = tp->urg_seq - tp->copied_seq; | ||
| 1834 | } | ||
| 1835 | |||
| 1836 | return answ; | ||
| 1837 | } | ||
| 1838 | |||
| 1839 | static inline void tcp_segs_in(struct tcp_sock *tp, const struct sk_buff *skb) | ||
| 1840 | { | ||
| 1841 | u16 segs_in; | ||
| 1842 | |||
| 1843 | segs_in = max_t(u16, 1, skb_shinfo(skb)->gso_segs); | ||
| 1844 | tp->segs_in += segs_in; | ||
| 1845 | if (skb->len > tcp_hdrlen(skb)) | ||
| 1846 | tp->data_segs_in += segs_in; | ||
| 1847 | } | ||
| 1848 | |||
| 1818 | #endif /* _TCP_H */ | 1849 | #endif /* _TCP_H */ |
diff --git a/include/net/udp.h b/include/net/udp.h index 2842541e28e7..92927f729ac8 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
| @@ -177,9 +177,10 @@ static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb) | |||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ | 179 | /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ |
| 180 | static inline void udp_lib_hash(struct sock *sk) | 180 | static inline int udp_lib_hash(struct sock *sk) |
| 181 | { | 181 | { |
| 182 | BUG(); | 182 | BUG(); |
| 183 | return 0; | ||
| 183 | } | 184 | } |
| 184 | 185 | ||
| 185 | void udp_lib_unhash(struct sock *sk); | 186 | void udp_lib_unhash(struct sock *sk); |
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index cca2ad3082c3..b83114077cee 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h | |||
| @@ -88,8 +88,8 @@ int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk, | |||
| 88 | struct sk_buff *skb, | 88 | struct sk_buff *skb, |
| 89 | struct net_device *dev, struct in6_addr *saddr, | 89 | struct net_device *dev, struct in6_addr *saddr, |
| 90 | struct in6_addr *daddr, | 90 | struct in6_addr *daddr, |
| 91 | __u8 prio, __u8 ttl, __be16 src_port, | 91 | __u8 prio, __u8 ttl, __be32 label, |
| 92 | __be16 dst_port, bool nocheck); | 92 | __be16 src_port, __be16 dst_port, bool nocheck); |
| 93 | #endif | 93 | #endif |
| 94 | 94 | ||
| 95 | void udp_tunnel_sock_release(struct socket *sock); | 95 | void udp_tunnel_sock_release(struct socket *sock); |
| @@ -103,7 +103,7 @@ static inline struct sk_buff *udp_tunnel_handle_offloads(struct sk_buff *skb, | |||
| 103 | { | 103 | { |
| 104 | int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL; | 104 | int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL; |
| 105 | 105 | ||
| 106 | return iptunnel_handle_offloads(skb, udp_csum, type); | 106 | return iptunnel_handle_offloads(skb, type); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff) | 109 | static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff) |
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index 0fb86442544b..a763c96ecde4 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h | |||
| @@ -9,17 +9,71 @@ | |||
| 9 | #include <linux/udp.h> | 9 | #include <linux/udp.h> |
| 10 | #include <net/dst_metadata.h> | 10 | #include <net/dst_metadata.h> |
| 11 | 11 | ||
| 12 | /* VXLAN protocol (RFC 7348) header: | ||
| 13 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 14 | * |R|R|R|R|I|R|R|R| Reserved | | ||
| 15 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 16 | * | VXLAN Network Identifier (VNI) | Reserved | | ||
| 17 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 18 | * | ||
| 19 | * I = VXLAN Network Identifier (VNI) present. | ||
| 20 | */ | ||
| 21 | struct vxlanhdr { | ||
| 22 | __be32 vx_flags; | ||
| 23 | __be32 vx_vni; | ||
| 24 | }; | ||
| 25 | |||
| 26 | /* VXLAN header flags. */ | ||
| 27 | #define VXLAN_HF_VNI cpu_to_be32(BIT(27)) | ||
| 28 | |||
| 29 | #define VXLAN_N_VID (1u << 24) | ||
| 30 | #define VXLAN_VID_MASK (VXLAN_N_VID - 1) | ||
| 31 | #define VXLAN_VNI_MASK cpu_to_be32(VXLAN_VID_MASK << 8) | ||
| 32 | #define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr)) | ||
| 33 | |||
| 12 | #define VNI_HASH_BITS 10 | 34 | #define VNI_HASH_BITS 10 |
| 13 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) | 35 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) |
| 36 | #define FDB_HASH_BITS 8 | ||
| 37 | #define FDB_HASH_SIZE (1<<FDB_HASH_BITS) | ||
| 38 | |||
| 39 | /* Remote checksum offload for VXLAN (VXLAN_F_REMCSUM_[RT]X): | ||
| 40 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 41 | * |R|R|R|R|I|R|R|R|R|R|C| Reserved | | ||
| 42 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 43 | * | VXLAN Network Identifier (VNI) |O| Csum start | | ||
| 44 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 45 | * | ||
| 46 | * C = Remote checksum offload bit. When set indicates that the | ||
| 47 | * remote checksum offload data is present. | ||
| 48 | * | ||
| 49 | * O = Offset bit. Indicates the checksum offset relative to | ||
| 50 | * checksum start. | ||
| 51 | * | ||
| 52 | * Csum start = Checksum start divided by two. | ||
| 53 | * | ||
| 54 | * http://tools.ietf.org/html/draft-herbert-vxlan-rco | ||
| 55 | */ | ||
| 56 | |||
| 57 | /* VXLAN-RCO header flags. */ | ||
| 58 | #define VXLAN_HF_RCO cpu_to_be32(BIT(21)) | ||
| 59 | |||
| 60 | /* Remote checksum offload header option */ | ||
| 61 | #define VXLAN_RCO_MASK cpu_to_be32(0x7f) /* Last byte of vni field */ | ||
| 62 | #define VXLAN_RCO_UDP cpu_to_be32(0x80) /* Indicate UDP RCO (TCP when not set *) */ | ||
| 63 | #define VXLAN_RCO_SHIFT 1 /* Left shift of start */ | ||
| 64 | #define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1) | ||
| 65 | #define VXLAN_MAX_REMCSUM_START (0x7f << VXLAN_RCO_SHIFT) | ||
| 14 | 66 | ||
| 15 | /* | 67 | /* |
| 16 | * VXLAN Group Based Policy Extension: | 68 | * VXLAN Group Based Policy Extension (VXLAN_F_GBP): |
| 17 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 69 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 18 | * |1|-|-|-|1|-|-|-|R|D|R|R|A|R|R|R| Group Policy ID | | 70 | * |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID | |
| 19 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 71 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 20 | * | VXLAN Network Identifier (VNI) | Reserved | | 72 | * | VXLAN Network Identifier (VNI) | Reserved | |
| 21 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 73 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 22 | * | 74 | * |
| 75 | * G = Group Policy ID present. | ||
| 76 | * | ||
| 23 | * D = Don't Learn bit. When set, this bit indicates that the egress | 77 | * D = Don't Learn bit. When set, this bit indicates that the egress |
| 24 | * VTEP MUST NOT learn the source address of the encapsulated frame. | 78 | * VTEP MUST NOT learn the source address of the encapsulated frame. |
| 25 | * | 79 | * |
| @@ -27,18 +81,18 @@ | |||
| 27 | * this packet. Policies MUST NOT be applied by devices when the | 81 | * this packet. Policies MUST NOT be applied by devices when the |
| 28 | * A bit is set. | 82 | * A bit is set. |
| 29 | * | 83 | * |
| 30 | * [0] https://tools.ietf.org/html/draft-smith-vxlan-group-policy | 84 | * https://tools.ietf.org/html/draft-smith-vxlan-group-policy |
| 31 | */ | 85 | */ |
| 32 | struct vxlanhdr_gbp { | 86 | struct vxlanhdr_gbp { |
| 33 | __u8 vx_flags; | 87 | u8 vx_flags; |
| 34 | #ifdef __LITTLE_ENDIAN_BITFIELD | 88 | #ifdef __LITTLE_ENDIAN_BITFIELD |
| 35 | __u8 reserved_flags1:3, | 89 | u8 reserved_flags1:3, |
| 36 | policy_applied:1, | 90 | policy_applied:1, |
| 37 | reserved_flags2:2, | 91 | reserved_flags2:2, |
| 38 | dont_learn:1, | 92 | dont_learn:1, |
| 39 | reserved_flags3:1; | 93 | reserved_flags3:1; |
| 40 | #elif defined(__BIG_ENDIAN_BITFIELD) | 94 | #elif defined(__BIG_ENDIAN_BITFIELD) |
| 41 | __u8 reserved_flags1:1, | 95 | u8 reserved_flags1:1, |
| 42 | dont_learn:1, | 96 | dont_learn:1, |
| 43 | reserved_flags2:2, | 97 | reserved_flags2:2, |
| 44 | policy_applied:1, | 98 | policy_applied:1, |
| @@ -50,7 +104,10 @@ struct vxlanhdr_gbp { | |||
| 50 | __be32 vx_vni; | 104 | __be32 vx_vni; |
| 51 | }; | 105 | }; |
| 52 | 106 | ||
| 53 | #define VXLAN_GBP_USED_BITS (VXLAN_HF_GBP | 0xFFFFFF) | 107 | /* VXLAN-GBP header flags. */ |
| 108 | #define VXLAN_HF_GBP cpu_to_be32(BIT(31)) | ||
| 109 | |||
| 110 | #define VXLAN_GBP_USED_BITS (VXLAN_HF_GBP | cpu_to_be32(0xFFFFFF)) | ||
| 54 | 111 | ||
| 55 | /* skb->mark mapping | 112 | /* skb->mark mapping |
| 56 | * | 113 | * |
| @@ -62,44 +119,6 @@ struct vxlanhdr_gbp { | |||
| 62 | #define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16) | 119 | #define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16) |
| 63 | #define VXLAN_GBP_ID_MASK (0xFFFF) | 120 | #define VXLAN_GBP_ID_MASK (0xFFFF) |
| 64 | 121 | ||
| 65 | /* VXLAN protocol header: | ||
| 66 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 67 | * |G|R|R|R|I|R|R|C| Reserved | | ||
| 68 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 69 | * | VXLAN Network Identifier (VNI) | Reserved | | ||
| 70 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 71 | * | ||
| 72 | * G = 1 Group Policy (VXLAN-GBP) | ||
| 73 | * I = 1 VXLAN Network Identifier (VNI) present | ||
| 74 | * C = 1 Remote checksum offload (RCO) | ||
| 75 | */ | ||
| 76 | struct vxlanhdr { | ||
| 77 | __be32 vx_flags; | ||
| 78 | __be32 vx_vni; | ||
| 79 | }; | ||
| 80 | |||
| 81 | /* VXLAN header flags. */ | ||
| 82 | #define VXLAN_HF_RCO BIT(21) | ||
| 83 | #define VXLAN_HF_VNI BIT(27) | ||
| 84 | #define VXLAN_HF_GBP BIT(31) | ||
| 85 | |||
| 86 | /* Remote checksum offload header option */ | ||
| 87 | #define VXLAN_RCO_MASK 0x7f /* Last byte of vni field */ | ||
| 88 | #define VXLAN_RCO_UDP 0x80 /* Indicate UDP RCO (TCP when not set *) */ | ||
| 89 | #define VXLAN_RCO_SHIFT 1 /* Left shift of start */ | ||
| 90 | #define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1) | ||
| 91 | #define VXLAN_MAX_REMCSUM_START (VXLAN_RCO_MASK << VXLAN_RCO_SHIFT) | ||
| 92 | |||
| 93 | #define VXLAN_N_VID (1u << 24) | ||
| 94 | #define VXLAN_VID_MASK (VXLAN_N_VID - 1) | ||
| 95 | #define VXLAN_VNI_MASK (VXLAN_VID_MASK << 8) | ||
| 96 | #define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr)) | ||
| 97 | |||
| 98 | #define VNI_HASH_BITS 10 | ||
| 99 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) | ||
| 100 | #define FDB_HASH_BITS 8 | ||
| 101 | #define FDB_HASH_SIZE (1<<FDB_HASH_BITS) | ||
| 102 | |||
| 103 | struct vxlan_metadata { | 122 | struct vxlan_metadata { |
| 104 | u32 gbp; | 123 | u32 gbp; |
| 105 | }; | 124 | }; |
| @@ -125,23 +144,25 @@ union vxlan_addr { | |||
| 125 | struct vxlan_rdst { | 144 | struct vxlan_rdst { |
| 126 | union vxlan_addr remote_ip; | 145 | union vxlan_addr remote_ip; |
| 127 | __be16 remote_port; | 146 | __be16 remote_port; |
| 128 | u32 remote_vni; | 147 | __be32 remote_vni; |
| 129 | u32 remote_ifindex; | 148 | u32 remote_ifindex; |
| 130 | struct list_head list; | 149 | struct list_head list; |
| 131 | struct rcu_head rcu; | 150 | struct rcu_head rcu; |
| 151 | struct dst_cache dst_cache; | ||
| 132 | }; | 152 | }; |
| 133 | 153 | ||
| 134 | struct vxlan_config { | 154 | struct vxlan_config { |
| 135 | union vxlan_addr remote_ip; | 155 | union vxlan_addr remote_ip; |
| 136 | union vxlan_addr saddr; | 156 | union vxlan_addr saddr; |
| 137 | u32 vni; | 157 | __be32 vni; |
| 138 | int remote_ifindex; | 158 | int remote_ifindex; |
| 139 | int mtu; | 159 | int mtu; |
| 140 | __be16 dst_port; | 160 | __be16 dst_port; |
| 141 | __u16 port_min; | 161 | u16 port_min; |
| 142 | __u16 port_max; | 162 | u16 port_max; |
| 143 | __u8 tos; | 163 | u8 tos; |
| 144 | __u8 ttl; | 164 | u8 ttl; |
| 165 | __be32 label; | ||
| 145 | u32 flags; | 166 | u32 flags; |
| 146 | unsigned long age_interval; | 167 | unsigned long age_interval; |
| 147 | unsigned int addrmax; | 168 | unsigned int addrmax; |
| @@ -177,7 +198,7 @@ struct vxlan_dev { | |||
| 177 | #define VXLAN_F_L2MISS 0x08 | 198 | #define VXLAN_F_L2MISS 0x08 |
| 178 | #define VXLAN_F_L3MISS 0x10 | 199 | #define VXLAN_F_L3MISS 0x10 |
| 179 | #define VXLAN_F_IPV6 0x20 | 200 | #define VXLAN_F_IPV6 0x20 |
| 180 | #define VXLAN_F_UDP_CSUM 0x40 | 201 | #define VXLAN_F_UDP_ZERO_CSUM_TX 0x40 |
| 181 | #define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80 | 202 | #define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80 |
| 182 | #define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100 | 203 | #define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100 |
| 183 | #define VXLAN_F_REMCSUM_TX 0x200 | 204 | #define VXLAN_F_REMCSUM_TX 0x200 |
| @@ -242,6 +263,68 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, | |||
| 242 | /* IPv6 header + UDP + VXLAN + Ethernet header */ | 263 | /* IPv6 header + UDP + VXLAN + Ethernet header */ |
| 243 | #define VXLAN6_HEADROOM (40 + 8 + 8 + 14) | 264 | #define VXLAN6_HEADROOM (40 + 8 + 8 + 14) |
| 244 | 265 | ||
| 266 | static inline struct vxlanhdr *vxlan_hdr(struct sk_buff *skb) | ||
| 267 | { | ||
| 268 | return (struct vxlanhdr *)(udp_hdr(skb) + 1); | ||
| 269 | } | ||
| 270 | |||
| 271 | static inline __be32 vxlan_vni(__be32 vni_field) | ||
| 272 | { | ||
| 273 | #if defined(__BIG_ENDIAN) | ||
| 274 | return vni_field >> 8; | ||
| 275 | #else | ||
| 276 | return (vni_field & VXLAN_VNI_MASK) << 8; | ||
| 277 | #endif | ||
| 278 | } | ||
| 279 | |||
| 280 | static inline __be32 vxlan_vni_field(__be32 vni) | ||
| 281 | { | ||
| 282 | #if defined(__BIG_ENDIAN) | ||
| 283 | return vni << 8; | ||
| 284 | #else | ||
| 285 | return vni >> 8; | ||
| 286 | #endif | ||
| 287 | } | ||
| 288 | |||
| 289 | static inline __be32 vxlan_tun_id_to_vni(__be64 tun_id) | ||
| 290 | { | ||
| 291 | #if defined(__BIG_ENDIAN) | ||
| 292 | return tun_id; | ||
| 293 | #else | ||
| 294 | return tun_id >> 32; | ||
| 295 | #endif | ||
| 296 | } | ||
| 297 | |||
| 298 | static inline __be64 vxlan_vni_to_tun_id(__be32 vni) | ||
| 299 | { | ||
| 300 | #if defined(__BIG_ENDIAN) | ||
| 301 | return (__be64)vni; | ||
| 302 | #else | ||
| 303 | return (__be64)vni << 32; | ||
| 304 | #endif | ||
| 305 | } | ||
| 306 | |||
| 307 | static inline size_t vxlan_rco_start(__be32 vni_field) | ||
| 308 | { | ||
| 309 | return be32_to_cpu(vni_field & VXLAN_RCO_MASK) << VXLAN_RCO_SHIFT; | ||
| 310 | } | ||
| 311 | |||
| 312 | static inline size_t vxlan_rco_offset(__be32 vni_field) | ||
| 313 | { | ||
| 314 | return (vni_field & VXLAN_RCO_UDP) ? | ||
| 315 | offsetof(struct udphdr, check) : | ||
| 316 | offsetof(struct tcphdr, check); | ||
| 317 | } | ||
| 318 | |||
| 319 | static inline __be32 vxlan_compute_rco(unsigned int start, unsigned int offset) | ||
| 320 | { | ||
| 321 | __be32 vni_field = cpu_to_be32(start >> VXLAN_RCO_SHIFT); | ||
| 322 | |||
| 323 | if (offset == offsetof(struct udphdr, check)) | ||
| 324 | vni_field |= VXLAN_RCO_UDP; | ||
| 325 | return vni_field; | ||
| 326 | } | ||
| 327 | |||
| 245 | #if IS_ENABLED(CONFIG_VXLAN) | 328 | #if IS_ENABLED(CONFIG_VXLAN) |
| 246 | void vxlan_get_rx_port(struct net_device *netdev); | 329 | void vxlan_get_rx_port(struct net_device *netdev); |
| 247 | #else | 330 | #else |
