aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-05-13 00:10:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-05-13 00:10:38 -0400
commit110bc76729d448fdbcb5cdb63b83d9fd65ce5e26 (patch)
treeb25599bb5e186303ea9c18715a09a0c3278603af /net
parent6c9d370c16aad97cfc6de68666634eaabac2b048 (diff)
parent01d460dd70adc858e15307332832183c622bee50 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Handle max TX power properly wrt VIFs and the MAC in iwlwifi, from Avri Altman. 2) Use the correct FW API for scan completions in iwlwifi, from Avraham Stern. 3) FW monitor in iwlwifi accidently uses unmapped memory, fix from Liad Kaufman. 4) rhashtable conversion of mac80211 station table was buggy, the virtual interface was not taken into account. Fix from Johannes Berg. 5) Fix deadlock in rtlwifi by not using a zero timeout for usb_control_msg(), from Larry Finger. 6) Update reordering state before calculating loss detection, from Yuchung Cheng. 7) Fix off by one in bluetooth firmward parsing, from Dan Carpenter. 8) Fix extended frame handling in xiling_can driver, from Jeppe Ledet-Pedersen. 9) Fix CODEL packet scheduler behavior in the presence of TSO packets, from Eric Dumazet. 10) Fix NAPI budget testing in fm10k driver, from Alexander Duyck. 11) macvlan needs to propagate promisc settings down the the lower device, from Vlad Yasevich. 12) igb driver can oops when changing number of rings, from Toshiaki Makita. 13) Source specific default routes not handled properly in ipv6, from Markus Stenberg. 14) Use after free in tc_ctl_tfilter(), from WANG Cong. 15) Use softirq spinlocking in netxen driver, from Tony Camuso. 16) Two ARM bpf JIT fixes from Nicolas Schichan. 17) Handle MSG_DONTWAIT properly in ring based AF_PACKET sends, from Mathias Kretschmer. 18) Fix x86 bpf JIT implementation of FROM_{BE16,LE16,LE32}, from Alexei Starovoitov. 19) ll_temac driver DMA maps TX packet header with incorrect length, fix from Michal Simek. 20) We removed pm_qos bits from netdevice.h, but some indirect references remained. Kill them. From David Ahern. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (90 commits) net: Remove remaining remnants of pm_qos from netdevice.h e1000e: Add pm_qos header net: phy: micrel: Fix regression in kszphy_probe net: ll_temac: Fix DMA map size bug x86: bpf_jit: fix FROM_BE16 and FROM_LE16/32 instructions netns: return RTM_NEWNSID instead of RTM_GETNSID on a get Update be2net maintainers' email addresses net_sched: gred: use correct backlog value in WRED mode pppoe: drop pppoe device in pppoe_unbind_sock_work net: qca_spi: Fix possible race during probe net: mdio-gpio: Allow for unspecified bus id af_packet / TX_RING not fully non-blocking (w/ MSG_DONTWAIT). bnx2x: limit fw delay in kdump to 5s after boot ARM: net: delegate filter to kernel interpreter when imm_offset() return value can't fit into 12bits. ARM: net fix emit_udiv() for BPF_ALU | BPF_DIV | BPF_K intruction. mpls: Change reserved label names to be consistent with netbsd usbnet: avoid integer overflow in start_xmit netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2) net: xgene_enet: Set hardware dependency net: amd-xgbe: Add hardware dependency ...
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c3
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/net_namespace.c2
-rw-r--r--net/core/sock.c2
-rw-r--r--net/ieee802154/Makefile4
-rw-r--r--net/ieee802154/nl-phy.c5
-rw-r--r--net/ieee802154/nl802154.c2
-rw-r--r--net/ieee802154/rdev-ops.h85
-rw-r--r--net/ieee802154/trace.c7
-rw-r--r--net/ieee802154/trace.h247
-rw-r--r--net/ipv4/inet_diag.c8
-rw-r--r--net/ipv4/tcp.c28
-rw-r--r--net/ipv4/tcp_dctcp.c20
-rw-r--r--net/ipv4/tcp_fastopen.c1
-rw-r--r--net/ipv4/tcp_illinois.c21
-rw-r--r--net/ipv4/tcp_input.c36
-rw-r--r--net/ipv4/tcp_vegas.c19
-rw-r--r--net/ipv4/tcp_vegas.h3
-rw-r--r--net/ipv4/tcp_westwood.c15
-rw-r--r--net/ipv6/ip6_output.c39
-rw-r--r--net/ipv6/route.c5
-rw-r--r--net/mac80211/iface.c12
-rw-r--r--net/mac80211/sta_info.c19
-rw-r--r--net/mac802154/cfg.c9
-rw-r--r--net/mac802154/ieee802154_i.h3
-rw-r--r--net/mac802154/iface.c5
-rw-r--r--net/mac802154/llsec.c4
-rw-r--r--net/mac802154/main.c7
-rw-r--r--net/mpls/af_mpls.c18
-rw-r--r--net/mpls/internal.h10
-rw-r--r--net/netlink/af_netlink.c1
-rw-r--r--net/packet/af_packet.c9
-rw-r--r--net/rds/connection.c17
-rw-r--r--net/rds/ib_cm.c13
-rw-r--r--net/rds/tcp_connect.c1
-rw-r--r--net/rds/tcp_listen.c46
-rw-r--r--net/sched/cls_api.c7
-rw-r--r--net/sched/sch_codel.c2
-rw-r--r--net/sched/sch_fq_codel.c2
-rw-r--r--net/sched/sch_gred.c4
40 files changed, 611 insertions, 132 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 476709bd068a..4663c3dad3f5 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1557,7 +1557,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
1557{ 1557{
1558 BT_DBG("%s %p", hdev->name, hdev); 1558 BT_DBG("%s %p", hdev->name, hdev);
1559 1559
1560 if (!hci_dev_test_flag(hdev, HCI_UNREGISTER)) { 1560 if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
1561 test_bit(HCI_UP, &hdev->flags)) {
1561 /* Execute vendor specific shutdown routine */ 1562 /* Execute vendor specific shutdown routine */
1562 if (hdev->shutdown) 1563 if (hdev->shutdown)
1563 hdev->shutdown(hdev); 1564 hdev->shutdown(hdev);
diff --git a/net/core/dev.c b/net/core/dev.c
index c7ba0388f1be..2c1c67fad64d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5209,7 +5209,7 @@ static int __netdev_upper_dev_link(struct net_device *dev,
5209 if (__netdev_find_adj(upper_dev, dev, &upper_dev->all_adj_list.upper)) 5209 if (__netdev_find_adj(upper_dev, dev, &upper_dev->all_adj_list.upper))
5210 return -EBUSY; 5210 return -EBUSY;
5211 5211
5212 if (__netdev_find_adj(dev, upper_dev, &dev->all_adj_list.upper)) 5212 if (__netdev_find_adj(dev, upper_dev, &dev->adj_list.upper))
5213 return -EEXIST; 5213 return -EEXIST;
5214 5214
5215 if (master && netdev_master_upper_dev_get(dev)) 5215 if (master && netdev_master_upper_dev_get(dev))
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 78fc04ad36fc..572af0011997 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -601,7 +601,7 @@ static int rtnl_net_getid(struct sk_buff *skb, struct nlmsghdr *nlh)
601 } 601 }
602 602
603 err = rtnl_net_fill(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq, 0, 603 err = rtnl_net_fill(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq, 0,
604 RTM_GETNSID, net, peer, -1); 604 RTM_NEWNSID, net, peer, -1);
605 if (err < 0) 605 if (err < 0)
606 goto err_out; 606 goto err_out;
607 607
diff --git a/net/core/sock.c b/net/core/sock.c
index e891bcf325ca..292f42228bfb 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1474,8 +1474,8 @@ void sk_release_kernel(struct sock *sk)
1474 return; 1474 return;
1475 1475
1476 sock_hold(sk); 1476 sock_hold(sk);
1477 sock_net_set(sk, get_net(&init_net));
1478 sock_release(sk->sk_socket); 1477 sock_release(sk->sk_socket);
1478 sock_net_set(sk, get_net(&init_net));
1479 sock_put(sk); 1479 sock_put(sk);
1480} 1480}
1481EXPORT_SYMBOL(sk_release_kernel); 1481EXPORT_SYMBOL(sk_release_kernel);
diff --git a/net/ieee802154/Makefile b/net/ieee802154/Makefile
index 05dab2957cd4..4adfd4d5471b 100644
--- a/net/ieee802154/Makefile
+++ b/net/ieee802154/Makefile
@@ -3,7 +3,9 @@ obj-$(CONFIG_IEEE802154_SOCKET) += ieee802154_socket.o
3obj-y += 6lowpan/ 3obj-y += 6lowpan/
4 4
5ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o core.o \ 5ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o core.o \
6 header_ops.o sysfs.o nl802154.o 6 header_ops.o sysfs.o nl802154.o trace.o
7ieee802154_socket-y := socket.o 7ieee802154_socket-y := socket.o
8 8
9CFLAGS_trace.o := -I$(src)
10
9ccflags-y += -D__CHECK_ENDIAN__ 11ccflags-y += -D__CHECK_ENDIAN__
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
index 1b9d25f6e898..346c6665d25e 100644
--- a/net/ieee802154/nl-phy.c
+++ b/net/ieee802154/nl-phy.c
@@ -175,6 +175,7 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
175 int rc = -ENOBUFS; 175 int rc = -ENOBUFS;
176 struct net_device *dev; 176 struct net_device *dev;
177 int type = __IEEE802154_DEV_INVALID; 177 int type = __IEEE802154_DEV_INVALID;
178 unsigned char name_assign_type;
178 179
179 pr_debug("%s\n", __func__); 180 pr_debug("%s\n", __func__);
180 181
@@ -190,8 +191,10 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
190 if (devname[nla_len(info->attrs[IEEE802154_ATTR_DEV_NAME]) - 1] 191 if (devname[nla_len(info->attrs[IEEE802154_ATTR_DEV_NAME]) - 1]
191 != '\0') 192 != '\0')
192 return -EINVAL; /* phy name should be null-terminated */ 193 return -EINVAL; /* phy name should be null-terminated */
194 name_assign_type = NET_NAME_USER;
193 } else { 195 } else {
194 devname = "wpan%d"; 196 devname = "wpan%d";
197 name_assign_type = NET_NAME_ENUM;
195 } 198 }
196 199
197 if (strlen(devname) >= IFNAMSIZ) 200 if (strlen(devname) >= IFNAMSIZ)
@@ -221,7 +224,7 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
221 } 224 }
222 225
223 dev = rdev_add_virtual_intf_deprecated(wpan_phy_to_rdev(phy), devname, 226 dev = rdev_add_virtual_intf_deprecated(wpan_phy_to_rdev(phy), devname,
224 type); 227 name_assign_type, type);
225 if (IS_ERR(dev)) { 228 if (IS_ERR(dev)) {
226 rc = PTR_ERR(dev); 229 rc = PTR_ERR(dev);
227 goto nla_put_failure; 230 goto nla_put_failure;
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index a4daf91b8d0a..f3c12f6a4a39 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -589,7 +589,7 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info)
589 589
590 return rdev_add_virtual_intf(rdev, 590 return rdev_add_virtual_intf(rdev,
591 nla_data(info->attrs[NL802154_ATTR_IFNAME]), 591 nla_data(info->attrs[NL802154_ATTR_IFNAME]),
592 type, extended_addr); 592 NET_NAME_USER, type, extended_addr);
593} 593}
594 594
595static int nl802154_del_interface(struct sk_buff *skb, struct genl_info *info) 595static int nl802154_del_interface(struct sk_buff *skb, struct genl_info *info)
diff --git a/net/ieee802154/rdev-ops.h b/net/ieee802154/rdev-ops.h
index 7c46732fad2b..7b5a9dd94fe5 100644
--- a/net/ieee802154/rdev-ops.h
+++ b/net/ieee802154/rdev-ops.h
@@ -4,13 +4,16 @@
4#include <net/cfg802154.h> 4#include <net/cfg802154.h>
5 5
6#include "core.h" 6#include "core.h"
7#include "trace.h"
7 8
8static inline struct net_device * 9static inline struct net_device *
9rdev_add_virtual_intf_deprecated(struct cfg802154_registered_device *rdev, 10rdev_add_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
10 const char *name, int type) 11 const char *name,
12 unsigned char name_assign_type,
13 int type)
11{ 14{
12 return rdev->ops->add_virtual_intf_deprecated(&rdev->wpan_phy, name, 15 return rdev->ops->add_virtual_intf_deprecated(&rdev->wpan_phy, name,
13 type); 16 name_assign_type, type);
14} 17}
15 18
16static inline void 19static inline void
@@ -22,75 +25,131 @@ rdev_del_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
22 25
23static inline int 26static inline int
24rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name, 27rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name,
28 unsigned char name_assign_type,
25 enum nl802154_iftype type, __le64 extended_addr) 29 enum nl802154_iftype type, __le64 extended_addr)
26{ 30{
27 return rdev->ops->add_virtual_intf(&rdev->wpan_phy, name, type, 31 int ret;
32
33 trace_802154_rdev_add_virtual_intf(&rdev->wpan_phy, name, type,
28 extended_addr); 34 extended_addr);
35 ret = rdev->ops->add_virtual_intf(&rdev->wpan_phy, name,
36 name_assign_type, type,
37 extended_addr);
38 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
39 return ret;
29} 40}
30 41
31static inline int 42static inline int
32rdev_del_virtual_intf(struct cfg802154_registered_device *rdev, 43rdev_del_virtual_intf(struct cfg802154_registered_device *rdev,
33 struct wpan_dev *wpan_dev) 44 struct wpan_dev *wpan_dev)
34{ 45{
35 return rdev->ops->del_virtual_intf(&rdev->wpan_phy, wpan_dev); 46 int ret;
47
48 trace_802154_rdev_del_virtual_intf(&rdev->wpan_phy, wpan_dev);
49 ret = rdev->ops->del_virtual_intf(&rdev->wpan_phy, wpan_dev);
50 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
51 return ret;
36} 52}
37 53
38static inline int 54static inline int
39rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel) 55rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel)
40{ 56{
41 return rdev->ops->set_channel(&rdev->wpan_phy, page, channel); 57 int ret;
58
59 trace_802154_rdev_set_channel(&rdev->wpan_phy, page, channel);
60 ret = rdev->ops->set_channel(&rdev->wpan_phy, page, channel);
61 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
62 return ret;
42} 63}
43 64
44static inline int 65static inline int
45rdev_set_cca_mode(struct cfg802154_registered_device *rdev, 66rdev_set_cca_mode(struct cfg802154_registered_device *rdev,
46 const struct wpan_phy_cca *cca) 67 const struct wpan_phy_cca *cca)
47{ 68{
48 return rdev->ops->set_cca_mode(&rdev->wpan_phy, cca); 69 int ret;
70
71 trace_802154_rdev_set_cca_mode(&rdev->wpan_phy, cca);
72 ret = rdev->ops->set_cca_mode(&rdev->wpan_phy, cca);
73 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
74 return ret;
49} 75}
50 76
51static inline int 77static inline int
52rdev_set_pan_id(struct cfg802154_registered_device *rdev, 78rdev_set_pan_id(struct cfg802154_registered_device *rdev,
53 struct wpan_dev *wpan_dev, __le16 pan_id) 79 struct wpan_dev *wpan_dev, __le16 pan_id)
54{ 80{
55 return rdev->ops->set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id); 81 int ret;
82
83 trace_802154_rdev_set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id);
84 ret = rdev->ops->set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id);
85 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
86 return ret;
56} 87}
57 88
58static inline int 89static inline int
59rdev_set_short_addr(struct cfg802154_registered_device *rdev, 90rdev_set_short_addr(struct cfg802154_registered_device *rdev,
60 struct wpan_dev *wpan_dev, __le16 short_addr) 91 struct wpan_dev *wpan_dev, __le16 short_addr)
61{ 92{
62 return rdev->ops->set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr); 93 int ret;
94
95 trace_802154_rdev_set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr);
96 ret = rdev->ops->set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr);
97 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
98 return ret;
63} 99}
64 100
65static inline int 101static inline int
66rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev, 102rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev,
67 struct wpan_dev *wpan_dev, u8 min_be, u8 max_be) 103 struct wpan_dev *wpan_dev, u8 min_be, u8 max_be)
68{ 104{
69 return rdev->ops->set_backoff_exponent(&rdev->wpan_phy, wpan_dev, 105 int ret;
106
107 trace_802154_rdev_set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
70 min_be, max_be); 108 min_be, max_be);
109 ret = rdev->ops->set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
110 min_be, max_be);
111 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
112 return ret;
71} 113}
72 114
73static inline int 115static inline int
74rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev, 116rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev,
75 struct wpan_dev *wpan_dev, u8 max_csma_backoffs) 117 struct wpan_dev *wpan_dev, u8 max_csma_backoffs)
76{ 118{
77 return rdev->ops->set_max_csma_backoffs(&rdev->wpan_phy, wpan_dev, 119 int ret;
78 max_csma_backoffs); 120
121 trace_802154_rdev_set_csma_backoffs(&rdev->wpan_phy, wpan_dev,
122 max_csma_backoffs);
123 ret = rdev->ops->set_max_csma_backoffs(&rdev->wpan_phy, wpan_dev,
124 max_csma_backoffs);
125 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
126 return ret;
79} 127}
80 128
81static inline int 129static inline int
82rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev, 130rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev,
83 struct wpan_dev *wpan_dev, s8 max_frame_retries) 131 struct wpan_dev *wpan_dev, s8 max_frame_retries)
84{ 132{
85 return rdev->ops->set_max_frame_retries(&rdev->wpan_phy, wpan_dev, 133 int ret;
134
135 trace_802154_rdev_set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
86 max_frame_retries); 136 max_frame_retries);
137 ret = rdev->ops->set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
138 max_frame_retries);
139 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
140 return ret;
87} 141}
88 142
89static inline int 143static inline int
90rdev_set_lbt_mode(struct cfg802154_registered_device *rdev, 144rdev_set_lbt_mode(struct cfg802154_registered_device *rdev,
91 struct wpan_dev *wpan_dev, bool mode) 145 struct wpan_dev *wpan_dev, bool mode)
92{ 146{
93 return rdev->ops->set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode); 147 int ret;
148
149 trace_802154_rdev_set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode);
150 ret = rdev->ops->set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode);
151 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
152 return ret;
94} 153}
95 154
96#endif /* __CFG802154_RDEV_OPS */ 155#endif /* __CFG802154_RDEV_OPS */
diff --git a/net/ieee802154/trace.c b/net/ieee802154/trace.c
new file mode 100644
index 000000000000..95f997fad755
--- /dev/null
+++ b/net/ieee802154/trace.c
@@ -0,0 +1,7 @@
1#include <linux/module.h>
2
3#ifndef __CHECKER__
4#define CREATE_TRACE_POINTS
5#include "trace.h"
6
7#endif
diff --git a/net/ieee802154/trace.h b/net/ieee802154/trace.h
new file mode 100644
index 000000000000..5ac25eb6ed17
--- /dev/null
+++ b/net/ieee802154/trace.h
@@ -0,0 +1,247 @@
1/* Based on net/wireless/tracing.h */
2
3#undef TRACE_SYSTEM
4#define TRACE_SYSTEM cfg802154
5
6#if !defined(__RDEV_CFG802154_OPS_TRACE) || defined(TRACE_HEADER_MULTI_READ)
7#define __RDEV_CFG802154_OPS_TRACE
8
9#include <linux/tracepoint.h>
10
11#include <net/cfg802154.h>
12
13#define MAXNAME 32
14#define WPAN_PHY_ENTRY __array(char, wpan_phy_name, MAXNAME)
15#define WPAN_PHY_ASSIGN strlcpy(__entry->wpan_phy_name, \
16 wpan_phy_name(wpan_phy), \
17 MAXNAME)
18#define WPAN_PHY_PR_FMT "%s"
19#define WPAN_PHY_PR_ARG __entry->wpan_phy_name
20
21#define WPAN_DEV_ENTRY __field(u32, identifier)
22#define WPAN_DEV_ASSIGN (__entry->identifier) = (!IS_ERR_OR_NULL(wpan_dev) \
23 ? wpan_dev->identifier : 0)
24#define WPAN_DEV_PR_FMT "wpan_dev(%u)"
25#define WPAN_DEV_PR_ARG (__entry->identifier)
26
27#define WPAN_CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
28 __field(enum nl802154_cca_opts, cca_opt)
29#define WPAN_CCA_ASSIGN \
30 do { \
31 (__entry->cca_mode) = cca->mode; \
32 (__entry->cca_opt) = cca->opt; \
33 } while (0)
34#define WPAN_CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
35#define WPAN_CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
36
37#define BOOL_TO_STR(bo) (bo) ? "true" : "false"
38
39/*************************************************************
40 * rdev->ops traces *
41 *************************************************************/
42
43TRACE_EVENT(802154_rdev_add_virtual_intf,
44 TP_PROTO(struct wpan_phy *wpan_phy, char *name,
45 enum nl802154_iftype type, __le64 extended_addr),
46 TP_ARGS(wpan_phy, name, type, extended_addr),
47 TP_STRUCT__entry(
48 WPAN_PHY_ENTRY
49 __string(vir_intf_name, name ? name : "<noname>")
50 __field(enum nl802154_iftype, type)
51 __field(__le64, extended_addr)
52 ),
53 TP_fast_assign(
54 WPAN_PHY_ASSIGN;
55 __assign_str(vir_intf_name, name ? name : "<noname>");
56 __entry->type = type;
57 __entry->extended_addr = extended_addr;
58 ),
59 TP_printk(WPAN_PHY_PR_FMT ", virtual intf name: %s, type: %d, ea %llx",
60 WPAN_PHY_PR_ARG, __get_str(vir_intf_name), __entry->type,
61 __le64_to_cpu(__entry->extended_addr))
62);
63
64TRACE_EVENT(802154_rdev_del_virtual_intf,
65 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
66 TP_ARGS(wpan_phy, wpan_dev),
67 TP_STRUCT__entry(
68 WPAN_PHY_ENTRY
69 WPAN_DEV_ENTRY
70 ),
71 TP_fast_assign(
72 WPAN_PHY_ASSIGN;
73 WPAN_DEV_ASSIGN;
74 ),
75 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT, WPAN_PHY_PR_ARG,
76 WPAN_DEV_PR_ARG)
77);
78
79TRACE_EVENT(802154_rdev_set_channel,
80 TP_PROTO(struct wpan_phy *wpan_phy, u8 page, u8 channel),
81 TP_ARGS(wpan_phy, page, channel),
82 TP_STRUCT__entry(
83 WPAN_PHY_ENTRY
84 __field(u8, page)
85 __field(u8, channel)
86 ),
87 TP_fast_assign(
88 WPAN_PHY_ASSIGN;
89 __entry->page = page;
90 __entry->channel = channel;
91 ),
92 TP_printk(WPAN_PHY_PR_FMT ", page: %d, channel: %d", WPAN_PHY_PR_ARG,
93 __entry->page, __entry->channel)
94);
95
96TRACE_EVENT(802154_rdev_set_cca_mode,
97 TP_PROTO(struct wpan_phy *wpan_phy, const struct wpan_phy_cca *cca),
98 TP_ARGS(wpan_phy, cca),
99 TP_STRUCT__entry(
100 WPAN_PHY_ENTRY
101 WPAN_CCA_ENTRY
102 ),
103 TP_fast_assign(
104 WPAN_PHY_ASSIGN;
105 WPAN_CCA_ASSIGN;
106 ),
107 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_CCA_PR_FMT, WPAN_PHY_PR_ARG,
108 WPAN_CCA_PR_ARG)
109);
110
111DECLARE_EVENT_CLASS(802154_le16_template,
112 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
113 __le16 le16arg),
114 TP_ARGS(wpan_phy, wpan_dev, le16arg),
115 TP_STRUCT__entry(
116 WPAN_PHY_ENTRY
117 WPAN_DEV_ENTRY
118 __field(__le16, le16arg)
119 ),
120 TP_fast_assign(
121 WPAN_PHY_ASSIGN;
122 WPAN_DEV_ASSIGN;
123 __entry->le16arg = le16arg;
124 ),
125 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", pan id: 0x%04x",
126 WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
127 __le16_to_cpu(__entry->le16arg))
128);
129
130DEFINE_EVENT(802154_le16_template, 802154_rdev_set_pan_id,
131 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
132 __le16 le16arg),
133 TP_ARGS(wpan_phy, wpan_dev, le16arg)
134);
135
136DEFINE_EVENT_PRINT(802154_le16_template, 802154_rdev_set_short_addr,
137 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
138 __le16 le16arg),
139 TP_ARGS(wpan_phy, wpan_dev, le16arg),
140 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", sa: 0x%04x",
141 WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
142 __le16_to_cpu(__entry->le16arg))
143);
144
145TRACE_EVENT(802154_rdev_set_backoff_exponent,
146 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
147 u8 min_be, u8 max_be),
148 TP_ARGS(wpan_phy, wpan_dev, min_be, max_be),
149 TP_STRUCT__entry(
150 WPAN_PHY_ENTRY
151 WPAN_DEV_ENTRY
152 __field(u8, min_be)
153 __field(u8, max_be)
154 ),
155 TP_fast_assign(
156 WPAN_PHY_ASSIGN;
157 WPAN_DEV_ASSIGN;
158 __entry->min_be = min_be;
159 __entry->max_be = max_be;
160 ),
161
162 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
163 ", min be: %d, max_be: %d", WPAN_PHY_PR_ARG,
164 WPAN_DEV_PR_ARG, __entry->min_be, __entry->max_be)
165);
166
167TRACE_EVENT(802154_rdev_set_csma_backoffs,
168 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
169 u8 max_csma_backoffs),
170 TP_ARGS(wpan_phy, wpan_dev, max_csma_backoffs),
171 TP_STRUCT__entry(
172 WPAN_PHY_ENTRY
173 WPAN_DEV_ENTRY
174 __field(u8, max_csma_backoffs)
175 ),
176 TP_fast_assign(
177 WPAN_PHY_ASSIGN;
178 WPAN_DEV_ASSIGN;
179 __entry->max_csma_backoffs = max_csma_backoffs;
180 ),
181
182 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
183 ", max csma backoffs: %d", WPAN_PHY_PR_ARG,
184 WPAN_DEV_PR_ARG, __entry->max_csma_backoffs)
185);
186
187TRACE_EVENT(802154_rdev_set_max_frame_retries,
188 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
189 s8 max_frame_retries),
190 TP_ARGS(wpan_phy, wpan_dev, max_frame_retries),
191 TP_STRUCT__entry(
192 WPAN_PHY_ENTRY
193 WPAN_DEV_ENTRY
194 __field(s8, max_frame_retries)
195 ),
196 TP_fast_assign(
197 WPAN_PHY_ASSIGN;
198 WPAN_DEV_ASSIGN;
199 __entry->max_frame_retries = max_frame_retries;
200 ),
201
202 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
203 ", max frame retries: %d", WPAN_PHY_PR_ARG,
204 WPAN_DEV_PR_ARG, __entry->max_frame_retries)
205);
206
207TRACE_EVENT(802154_rdev_set_lbt_mode,
208 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
209 bool mode),
210 TP_ARGS(wpan_phy, wpan_dev, mode),
211 TP_STRUCT__entry(
212 WPAN_PHY_ENTRY
213 WPAN_DEV_ENTRY
214 __field(bool, mode)
215 ),
216 TP_fast_assign(
217 WPAN_PHY_ASSIGN;
218 WPAN_DEV_ASSIGN;
219 __entry->mode = mode;
220 ),
221 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
222 ", lbt mode: %s", WPAN_PHY_PR_ARG,
223 WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->mode))
224);
225
226TRACE_EVENT(802154_rdev_return_int,
227 TP_PROTO(struct wpan_phy *wpan_phy, int ret),
228 TP_ARGS(wpan_phy, ret),
229 TP_STRUCT__entry(
230 WPAN_PHY_ENTRY
231 __field(int, ret)
232 ),
233 TP_fast_assign(
234 WPAN_PHY_ASSIGN;
235 __entry->ret = ret;
236 ),
237 TP_printk(WPAN_PHY_PR_FMT ", returned: %d", WPAN_PHY_PR_ARG,
238 __entry->ret)
239);
240
241#endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
242
243#undef TRACE_INCLUDE_PATH
244#define TRACE_INCLUDE_PATH .
245#undef TRACE_INCLUDE_FILE
246#define TRACE_INCLUDE_FILE trace
247#include <trace/define_trace.h>
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index bb77ebdae3b3..4d32262c7502 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -224,14 +224,16 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
224 handler->idiag_get_info(sk, r, info); 224 handler->idiag_get_info(sk, r, info);
225 225
226 if (sk->sk_state < TCP_TIME_WAIT) { 226 if (sk->sk_state < TCP_TIME_WAIT) {
227 int err = 0; 227 union tcp_cc_info info;
228 size_t sz = 0;
229 int attr;
228 230
229 rcu_read_lock(); 231 rcu_read_lock();
230 ca_ops = READ_ONCE(icsk->icsk_ca_ops); 232 ca_ops = READ_ONCE(icsk->icsk_ca_ops);
231 if (ca_ops && ca_ops->get_info) 233 if (ca_ops && ca_ops->get_info)
232 err = ca_ops->get_info(sk, ext, skb); 234 sz = ca_ops->get_info(sk, ext, &attr, &info);
233 rcu_read_unlock(); 235 rcu_read_unlock();
234 if (err < 0) 236 if (sz && nla_put(skb, attr, sz, &info) < 0)
235 goto errout; 237 goto errout;
236 } 238 }
237 239
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 8c5cd9efebbc..46efa03d2b11 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -252,6 +252,7 @@
252#include <linux/types.h> 252#include <linux/types.h>
253#include <linux/fcntl.h> 253#include <linux/fcntl.h>
254#include <linux/poll.h> 254#include <linux/poll.h>
255#include <linux/inet_diag.h>
255#include <linux/init.h> 256#include <linux/init.h>
256#include <linux/fs.h> 257#include <linux/fs.h>
257#include <linux/skbuff.h> 258#include <linux/skbuff.h>
@@ -2592,7 +2593,7 @@ EXPORT_SYMBOL(compat_tcp_setsockopt);
2592#endif 2593#endif
2593 2594
2594/* Return information about state of tcp endpoint in API format. */ 2595/* Return information about state of tcp endpoint in API format. */
2595void tcp_get_info(const struct sock *sk, struct tcp_info *info) 2596void tcp_get_info(struct sock *sk, struct tcp_info *info)
2596{ 2597{
2597 const struct tcp_sock *tp = tcp_sk(sk); 2598 const struct tcp_sock *tp = tcp_sk(sk);
2598 const struct inet_connection_sock *icsk = inet_csk(sk); 2599 const struct inet_connection_sock *icsk = inet_csk(sk);
@@ -2663,6 +2664,11 @@ void tcp_get_info(const struct sock *sk, struct tcp_info *info)
2663 2664
2664 rate = READ_ONCE(sk->sk_max_pacing_rate); 2665 rate = READ_ONCE(sk->sk_max_pacing_rate);
2665 info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL; 2666 info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL;
2667
2668 spin_lock_bh(&sk->sk_lock.slock);
2669 info->tcpi_bytes_acked = tp->bytes_acked;
2670 info->tcpi_bytes_received = tp->bytes_received;
2671 spin_unlock_bh(&sk->sk_lock.slock);
2666} 2672}
2667EXPORT_SYMBOL_GPL(tcp_get_info); 2673EXPORT_SYMBOL_GPL(tcp_get_info);
2668 2674
@@ -2734,6 +2740,26 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
2734 return -EFAULT; 2740 return -EFAULT;
2735 return 0; 2741 return 0;
2736 } 2742 }
2743 case TCP_CC_INFO: {
2744 const struct tcp_congestion_ops *ca_ops;
2745 union tcp_cc_info info;
2746 size_t sz = 0;
2747 int attr;
2748
2749 if (get_user(len, optlen))
2750 return -EFAULT;
2751
2752 ca_ops = icsk->icsk_ca_ops;
2753 if (ca_ops && ca_ops->get_info)
2754 sz = ca_ops->get_info(sk, ~0U, &attr, &info);
2755
2756 len = min_t(unsigned int, len, sz);
2757 if (put_user(len, optlen))
2758 return -EFAULT;
2759 if (copy_to_user(optval, &info, len))
2760 return -EFAULT;
2761 return 0;
2762 }
2737 case TCP_QUICKACK: 2763 case TCP_QUICKACK:
2738 val = !icsk->icsk_ack.pingpong; 2764 val = !icsk->icsk_ack.pingpong;
2739 break; 2765 break;
diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c
index 4376016f7fa5..4c41c1287197 100644
--- a/net/ipv4/tcp_dctcp.c
+++ b/net/ipv4/tcp_dctcp.c
@@ -277,7 +277,8 @@ static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
277 } 277 }
278} 278}
279 279
280static int dctcp_get_info(struct sock *sk, u32 ext, struct sk_buff *skb) 280static size_t dctcp_get_info(struct sock *sk, u32 ext, int *attr,
281 union tcp_cc_info *info)
281{ 282{
282 const struct dctcp *ca = inet_csk_ca(sk); 283 const struct dctcp *ca = inet_csk_ca(sk);
283 284
@@ -286,18 +287,17 @@ static int dctcp_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
286 */ 287 */
287 if (ext & (1 << (INET_DIAG_DCTCPINFO - 1)) || 288 if (ext & (1 << (INET_DIAG_DCTCPINFO - 1)) ||
288 ext & (1 << (INET_DIAG_VEGASINFO - 1))) { 289 ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
289 struct tcp_dctcp_info info; 290 memset(info, 0, sizeof(struct tcp_dctcp_info));
290
291 memset(&info, 0, sizeof(info));
292 if (inet_csk(sk)->icsk_ca_ops != &dctcp_reno) { 291 if (inet_csk(sk)->icsk_ca_ops != &dctcp_reno) {
293 info.dctcp_enabled = 1; 292 info->dctcp.dctcp_enabled = 1;
294 info.dctcp_ce_state = (u16) ca->ce_state; 293 info->dctcp.dctcp_ce_state = (u16) ca->ce_state;
295 info.dctcp_alpha = ca->dctcp_alpha; 294 info->dctcp.dctcp_alpha = ca->dctcp_alpha;
296 info.dctcp_ab_ecn = ca->acked_bytes_ecn; 295 info->dctcp.dctcp_ab_ecn = ca->acked_bytes_ecn;
297 info.dctcp_ab_tot = ca->acked_bytes_total; 296 info->dctcp.dctcp_ab_tot = ca->acked_bytes_total;
298 } 297 }
299 298
300 return nla_put(skb, INET_DIAG_DCTCPINFO, sizeof(info), &info); 299 *attr = INET_DIAG_DCTCPINFO;
300 return sizeof(*info);
301 } 301 }
302 return 0; 302 return 0;
303} 303}
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index e3d87aca6be8..3c673d5e6cff 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -206,6 +206,7 @@ static bool tcp_fastopen_create_child(struct sock *sk,
206 skb_set_owner_r(skb2, child); 206 skb_set_owner_r(skb2, child);
207 __skb_queue_tail(&child->sk_receive_queue, skb2); 207 __skb_queue_tail(&child->sk_receive_queue, skb2);
208 tp->syn_data_acked = 1; 208 tp->syn_data_acked = 1;
209 tp->bytes_received = end_seq - TCP_SKB_CB(skb)->seq - 1;
209 } else { 210 } else {
210 end_seq = TCP_SKB_CB(skb)->seq + 1; 211 end_seq = TCP_SKB_CB(skb)->seq + 1;
211 } 212 }
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 67476f085e48..f71002e4db0b 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -300,24 +300,25 @@ static u32 tcp_illinois_ssthresh(struct sock *sk)
300} 300}
301 301
302/* Extract info for Tcp socket info provided via netlink. */ 302/* Extract info for Tcp socket info provided via netlink. */
303static int tcp_illinois_info(struct sock *sk, u32 ext, struct sk_buff *skb) 303static size_t tcp_illinois_info(struct sock *sk, u32 ext, int *attr,
304 union tcp_cc_info *info)
304{ 305{
305 const struct illinois *ca = inet_csk_ca(sk); 306 const struct illinois *ca = inet_csk_ca(sk);
306 307
307 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { 308 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
308 struct tcpvegas_info info = { 309 info->vegas.tcpv_enabled = 1;
309 .tcpv_enabled = 1, 310 info->vegas.tcpv_rttcnt = ca->cnt_rtt;
310 .tcpv_rttcnt = ca->cnt_rtt, 311 info->vegas.tcpv_minrtt = ca->base_rtt;
311 .tcpv_minrtt = ca->base_rtt, 312 info->vegas.tcpv_rtt = 0;
312 };
313 313
314 if (info.tcpv_rttcnt > 0) { 314 if (info->vegas.tcpv_rttcnt > 0) {
315 u64 t = ca->sum_rtt; 315 u64 t = ca->sum_rtt;
316 316
317 do_div(t, info.tcpv_rttcnt); 317 do_div(t, info->vegas.tcpv_rttcnt);
318 info.tcpv_rtt = t; 318 info->vegas.tcpv_rtt = t;
319 } 319 }
320 return nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info); 320 *attr = INET_DIAG_VEGASINFO;
321 return sizeof(struct tcpvegas_info);
321 } 322 }
322 return 0; 323 return 0;
323} 324}
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 3a4d9b34bed4..bc790ea9960f 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1820,14 +1820,12 @@ advance_sp:
1820 for (j = 0; j < used_sacks; j++) 1820 for (j = 0; j < used_sacks; j++)
1821 tp->recv_sack_cache[i++] = sp[j]; 1821 tp->recv_sack_cache[i++] = sp[j];
1822 1822
1823 tcp_mark_lost_retrans(sk);
1824
1825 tcp_verify_left_out(tp);
1826
1827 if ((state.reord < tp->fackets_out) && 1823 if ((state.reord < tp->fackets_out) &&
1828 ((inet_csk(sk)->icsk_ca_state != TCP_CA_Loss) || tp->undo_marker)) 1824 ((inet_csk(sk)->icsk_ca_state != TCP_CA_Loss) || tp->undo_marker))
1829 tcp_update_reordering(sk, tp->fackets_out - state.reord, 0); 1825 tcp_update_reordering(sk, tp->fackets_out - state.reord, 0);
1830 1826
1827 tcp_mark_lost_retrans(sk);
1828 tcp_verify_left_out(tp);
1831out: 1829out:
1832 1830
1833#if FASTRETRANS_DEBUG > 0 1831#if FASTRETRANS_DEBUG > 0
@@ -3280,6 +3278,24 @@ static inline bool tcp_may_update_window(const struct tcp_sock *tp,
3280 (ack_seq == tp->snd_wl1 && nwin > tp->snd_wnd); 3278 (ack_seq == tp->snd_wl1 && nwin > tp->snd_wnd);
3281} 3279}
3282 3280
3281/* If we update tp->snd_una, also update tp->bytes_acked */
3282static void tcp_snd_una_update(struct tcp_sock *tp, u32 ack)
3283{
3284 u32 delta = ack - tp->snd_una;
3285
3286 tp->bytes_acked += delta;
3287 tp->snd_una = ack;
3288}
3289
3290/* If we update tp->rcv_nxt, also update tp->bytes_received */
3291static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq)
3292{
3293 u32 delta = seq - tp->rcv_nxt;
3294
3295 tp->bytes_received += delta;
3296 tp->rcv_nxt = seq;
3297}
3298
3283/* Update our send window. 3299/* Update our send window.
3284 * 3300 *
3285 * Window update algorithm, described in RFC793/RFC1122 (used in linux-2.2 3301 * Window update algorithm, described in RFC793/RFC1122 (used in linux-2.2
@@ -3315,7 +3331,7 @@ static int tcp_ack_update_window(struct sock *sk, const struct sk_buff *skb, u32
3315 } 3331 }
3316 } 3332 }
3317 3333
3318 tp->snd_una = ack; 3334 tcp_snd_una_update(tp, ack);
3319 3335
3320 return flag; 3336 return flag;
3321} 3337}
@@ -3497,7 +3513,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
3497 * Note, we use the fact that SND.UNA>=SND.WL2. 3513 * Note, we use the fact that SND.UNA>=SND.WL2.
3498 */ 3514 */
3499 tcp_update_wl(tp, ack_seq); 3515 tcp_update_wl(tp, ack_seq);
3500 tp->snd_una = ack; 3516 tcp_snd_una_update(tp, ack);
3501 flag |= FLAG_WIN_UPDATE; 3517 flag |= FLAG_WIN_UPDATE;
3502 3518
3503 tcp_in_ack_event(sk, CA_ACK_WIN_UPDATE); 3519 tcp_in_ack_event(sk, CA_ACK_WIN_UPDATE);
@@ -4236,7 +4252,7 @@ static void tcp_ofo_queue(struct sock *sk)
4236 4252
4237 tail = skb_peek_tail(&sk->sk_receive_queue); 4253 tail = skb_peek_tail(&sk->sk_receive_queue);
4238 eaten = tail && tcp_try_coalesce(sk, tail, skb, &fragstolen); 4254 eaten = tail && tcp_try_coalesce(sk, tail, skb, &fragstolen);
4239 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 4255 tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
4240 if (!eaten) 4256 if (!eaten)
4241 __skb_queue_tail(&sk->sk_receive_queue, skb); 4257 __skb_queue_tail(&sk->sk_receive_queue, skb);
4242 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 4258 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
@@ -4404,7 +4420,7 @@ static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, int
4404 __skb_pull(skb, hdrlen); 4420 __skb_pull(skb, hdrlen);
4405 eaten = (tail && 4421 eaten = (tail &&
4406 tcp_try_coalesce(sk, tail, skb, fragstolen)) ? 1 : 0; 4422 tcp_try_coalesce(sk, tail, skb, fragstolen)) ? 1 : 0;
4407 tcp_sk(sk)->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 4423 tcp_rcv_nxt_update(tcp_sk(sk), TCP_SKB_CB(skb)->end_seq);
4408 if (!eaten) { 4424 if (!eaten) {
4409 __skb_queue_tail(&sk->sk_receive_queue, skb); 4425 __skb_queue_tail(&sk->sk_receive_queue, skb);
4410 skb_set_owner_r(skb, sk); 4426 skb_set_owner_r(skb, sk);
@@ -4497,7 +4513,7 @@ queue_and_out:
4497 4513
4498 eaten = tcp_queue_rcv(sk, skb, 0, &fragstolen); 4514 eaten = tcp_queue_rcv(sk, skb, 0, &fragstolen);
4499 } 4515 }
4500 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 4516 tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
4501 if (skb->len) 4517 if (skb->len)
4502 tcp_event_data_recv(sk, skb); 4518 tcp_event_data_recv(sk, skb);
4503 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 4519 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
@@ -5245,7 +5261,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
5245 tcp_rcv_rtt_measure_ts(sk, skb); 5261 tcp_rcv_rtt_measure_ts(sk, skb);
5246 5262
5247 __skb_pull(skb, tcp_header_len); 5263 __skb_pull(skb, tcp_header_len);
5248 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 5264 tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
5249 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITSTOUSER); 5265 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITSTOUSER);
5250 eaten = 1; 5266 eaten = 1;
5251 } 5267 }
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index c71a1b8f7bde..a6cea1d5e20d 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -286,18 +286,19 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 acked)
286} 286}
287 287
288/* Extract info for Tcp socket info provided via netlink. */ 288/* Extract info for Tcp socket info provided via netlink. */
289int tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb) 289size_t tcp_vegas_get_info(struct sock *sk, u32 ext, int *attr,
290 union tcp_cc_info *info)
290{ 291{
291 const struct vegas *ca = inet_csk_ca(sk); 292 const struct vegas *ca = inet_csk_ca(sk);
293
292 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { 294 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
293 struct tcpvegas_info info = { 295 info->vegas.tcpv_enabled = ca->doing_vegas_now,
294 .tcpv_enabled = ca->doing_vegas_now, 296 info->vegas.tcpv_rttcnt = ca->cntRTT,
295 .tcpv_rttcnt = ca->cntRTT, 297 info->vegas.tcpv_rtt = ca->baseRTT,
296 .tcpv_rtt = ca->baseRTT, 298 info->vegas.tcpv_minrtt = ca->minRTT,
297 .tcpv_minrtt = ca->minRTT, 299
298 }; 300 *attr = INET_DIAG_VEGASINFO;
299 301 return sizeof(struct tcpvegas_info);
300 return nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
301 } 302 }
302 return 0; 303 return 0;
303} 304}
diff --git a/net/ipv4/tcp_vegas.h b/net/ipv4/tcp_vegas.h
index e8a6b33cc61d..ef9da5306c68 100644
--- a/net/ipv4/tcp_vegas.h
+++ b/net/ipv4/tcp_vegas.h
@@ -19,6 +19,7 @@ void tcp_vegas_init(struct sock *sk);
19void tcp_vegas_state(struct sock *sk, u8 ca_state); 19void tcp_vegas_state(struct sock *sk, u8 ca_state);
20void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us); 20void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us);
21void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event); 21void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event);
22int tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb); 22size_t tcp_vegas_get_info(struct sock *sk, u32 ext, int *attr,
23 union tcp_cc_info *info);
23 24
24#endif /* __TCP_VEGAS_H */ 25#endif /* __TCP_VEGAS_H */
diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c
index b3c57cceb990..c10732e39837 100644
--- a/net/ipv4/tcp_westwood.c
+++ b/net/ipv4/tcp_westwood.c
@@ -256,18 +256,19 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event)
256} 256}
257 257
258/* Extract info for Tcp socket info provided via netlink. */ 258/* Extract info for Tcp socket info provided via netlink. */
259static int tcp_westwood_info(struct sock *sk, u32 ext, struct sk_buff *skb) 259static size_t tcp_westwood_info(struct sock *sk, u32 ext, int *attr,
260 union tcp_cc_info *info)
260{ 261{
261 const struct westwood *ca = inet_csk_ca(sk); 262 const struct westwood *ca = inet_csk_ca(sk);
262 263
263 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { 264 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
264 struct tcpvegas_info info = { 265 info->vegas.tcpv_enabled = 1;
265 .tcpv_enabled = 1, 266 info->vegas.tcpv_rttcnt = 0;
266 .tcpv_rtt = jiffies_to_usecs(ca->rtt), 267 info->vegas.tcpv_rtt = jiffies_to_usecs(ca->rtt),
267 .tcpv_minrtt = jiffies_to_usecs(ca->rtt_min), 268 info->vegas.tcpv_minrtt = jiffies_to_usecs(ca->rtt_min),
268 };
269 269
270 return nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info); 270 *attr = INET_DIAG_VEGASINFO;
271 return sizeof(struct tcpvegas_info);
271 } 272 }
272 return 0; 273 return 0;
273} 274}
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 7fde1f265c90..c21777565c58 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -886,22 +886,45 @@ static int ip6_dst_lookup_tail(struct sock *sk,
886#endif 886#endif
887 int err; 887 int err;
888 888
889 if (!*dst) 889 /* The correct way to handle this would be to do
890 *dst = ip6_route_output(net, sk, fl6); 890 * ip6_route_get_saddr, and then ip6_route_output; however,
891 891 * the route-specific preferred source forces the
892 err = (*dst)->error; 892 * ip6_route_output call _before_ ip6_route_get_saddr.
893 if (err) 893 *
894 goto out_err_release; 894 * In source specific routing (no src=any default route),
895 * ip6_route_output will fail given src=any saddr, though, so
896 * that's why we try it again later.
897 */
898 if (ipv6_addr_any(&fl6->saddr) && (!*dst || !(*dst)->error)) {
899 struct rt6_info *rt;
900 bool had_dst = *dst != NULL;
895 901
896 if (ipv6_addr_any(&fl6->saddr)) { 902 if (!had_dst)
897 struct rt6_info *rt = (struct rt6_info *) *dst; 903 *dst = ip6_route_output(net, sk, fl6);
904 rt = (*dst)->error ? NULL : (struct rt6_info *)*dst;
898 err = ip6_route_get_saddr(net, rt, &fl6->daddr, 905 err = ip6_route_get_saddr(net, rt, &fl6->daddr,
899 sk ? inet6_sk(sk)->srcprefs : 0, 906 sk ? inet6_sk(sk)->srcprefs : 0,
900 &fl6->saddr); 907 &fl6->saddr);
901 if (err) 908 if (err)
902 goto out_err_release; 909 goto out_err_release;
910
911 /* If we had an erroneous initial result, pretend it
912 * never existed and let the SA-enabled version take
913 * over.
914 */
915 if (!had_dst && (*dst)->error) {
916 dst_release(*dst);
917 *dst = NULL;
918 }
903 } 919 }
904 920
921 if (!*dst)
922 *dst = ip6_route_output(net, sk, fl6);
923
924 err = (*dst)->error;
925 if (err)
926 goto out_err_release;
927
905#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 928#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
906 /* 929 /*
907 * Here if the dst entry we've looked up 930 * Here if the dst entry we've looked up
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 5c48293ff062..d3588885f097 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2245,9 +2245,10 @@ int ip6_route_get_saddr(struct net *net,
2245 unsigned int prefs, 2245 unsigned int prefs,
2246 struct in6_addr *saddr) 2246 struct in6_addr *saddr)
2247{ 2247{
2248 struct inet6_dev *idev = ip6_dst_idev((struct dst_entry *)rt); 2248 struct inet6_dev *idev =
2249 rt ? ip6_dst_idev((struct dst_entry *)rt) : NULL;
2249 int err = 0; 2250 int err = 0;
2250 if (rt->rt6i_prefsrc.plen) 2251 if (rt && rt->rt6i_prefsrc.plen)
2251 *saddr = rt->rt6i_prefsrc.addr; 2252 *saddr = rt->rt6i_prefsrc.addr;
2252 else 2253 else
2253 err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, 2254 err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index b4ac596a7cb7..bab5c63c0bad 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -819,13 +819,15 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
819 * (because if we remove a STA after ops->remove_interface() 819 * (because if we remove a STA after ops->remove_interface()
820 * the driver will have removed the vif info already!) 820 * the driver will have removed the vif info already!)
821 * 821 *
822 * This is relevant only in WDS mode, in all other modes we've 822 * In WDS mode a station must exist here and be flushed, for
823 * already removed all stations when disconnecting or similar, 823 * AP_VLANs stations may exist since there's nothing else that
824 * so warn otherwise. 824 * would have removed them, but in other modes there shouldn't
825 * be any stations.
825 */ 826 */
826 flushed = sta_info_flush(sdata); 827 flushed = sta_info_flush(sdata);
827 WARN_ON_ONCE((sdata->vif.type != NL80211_IFTYPE_WDS && flushed > 0) || 828 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
828 (sdata->vif.type == NL80211_IFTYPE_WDS && flushed != 1)); 829 ((sdata->vif.type != NL80211_IFTYPE_WDS && flushed > 0) ||
830 (sdata->vif.type == NL80211_IFTYPE_WDS && flushed != 1)));
829 831
830 /* don't count this interface for promisc/allmulti while it is down */ 832 /* don't count this interface for promisc/allmulti while it is down */
831 if (sdata->flags & IEEE80211_SDATA_ALLMULTI) 833 if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 12971b71d0fa..2880f2ae99ab 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -66,6 +66,7 @@
66 66
67static const struct rhashtable_params sta_rht_params = { 67static const struct rhashtable_params sta_rht_params = {
68 .nelem_hint = 3, /* start small */ 68 .nelem_hint = 3, /* start small */
69 .automatic_shrinking = true,
69 .head_offset = offsetof(struct sta_info, hash_node), 70 .head_offset = offsetof(struct sta_info, hash_node),
70 .key_offset = offsetof(struct sta_info, sta.addr), 71 .key_offset = offsetof(struct sta_info, sta.addr),
71 .key_len = ETH_ALEN, 72 .key_len = ETH_ALEN,
@@ -157,8 +158,24 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
157 const u8 *addr) 158 const u8 *addr)
158{ 159{
159 struct ieee80211_local *local = sdata->local; 160 struct ieee80211_local *local = sdata->local;
161 struct sta_info *sta;
162 struct rhash_head *tmp;
163 const struct bucket_table *tbl;
164
165 rcu_read_lock();
166 tbl = rht_dereference_rcu(local->sta_hash.tbl, &local->sta_hash);
160 167
161 return rhashtable_lookup_fast(&local->sta_hash, addr, sta_rht_params); 168 for_each_sta_info(local, tbl, addr, sta, tmp) {
169 if (sta->sdata == sdata) {
170 rcu_read_unlock();
171 /* this is safe as the caller must already hold
172 * another rcu read section or the mutex
173 */
174 return sta;
175 }
176 }
177 rcu_read_unlock();
178 return NULL;
162} 179}
163 180
164/* 181/*
diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c
index 5d9f68c75e5f..70be9c799f8a 100644
--- a/net/mac802154/cfg.c
+++ b/net/mac802154/cfg.c
@@ -22,13 +22,14 @@
22 22
23static struct net_device * 23static struct net_device *
24ieee802154_add_iface_deprecated(struct wpan_phy *wpan_phy, 24ieee802154_add_iface_deprecated(struct wpan_phy *wpan_phy,
25 const char *name, int type) 25 const char *name,
26 unsigned char name_assign_type, int type)
26{ 27{
27 struct ieee802154_local *local = wpan_phy_priv(wpan_phy); 28 struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
28 struct net_device *dev; 29 struct net_device *dev;
29 30
30 rtnl_lock(); 31 rtnl_lock();
31 dev = ieee802154_if_add(local, name, type, 32 dev = ieee802154_if_add(local, name, name_assign_type, type,
32 cpu_to_le64(0x0000000000000000ULL)); 33 cpu_to_le64(0x0000000000000000ULL));
33 rtnl_unlock(); 34 rtnl_unlock();
34 35
@@ -45,12 +46,14 @@ static void ieee802154_del_iface_deprecated(struct wpan_phy *wpan_phy,
45 46
46static int 47static int
47ieee802154_add_iface(struct wpan_phy *phy, const char *name, 48ieee802154_add_iface(struct wpan_phy *phy, const char *name,
49 unsigned char name_assign_type,
48 enum nl802154_iftype type, __le64 extended_addr) 50 enum nl802154_iftype type, __le64 extended_addr)
49{ 51{
50 struct ieee802154_local *local = wpan_phy_priv(phy); 52 struct ieee802154_local *local = wpan_phy_priv(phy);
51 struct net_device *err; 53 struct net_device *err;
52 54
53 err = ieee802154_if_add(local, name, type, extended_addr); 55 err = ieee802154_if_add(local, name, name_assign_type, type,
56 extended_addr);
54 return PTR_ERR_OR_ZERO(err); 57 return PTR_ERR_OR_ZERO(err);
55} 58}
56 59
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index bebd70ffc7a3..127ba18386fc 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -182,7 +182,8 @@ void ieee802154_iface_exit(void);
182void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata); 182void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata);
183struct net_device * 183struct net_device *
184ieee802154_if_add(struct ieee802154_local *local, const char *name, 184ieee802154_if_add(struct ieee802154_local *local, const char *name,
185 enum nl802154_iftype type, __le64 extended_addr); 185 unsigned char name_assign_type, enum nl802154_iftype type,
186 __le64 extended_addr);
186void ieee802154_remove_interfaces(struct ieee802154_local *local); 187void ieee802154_remove_interfaces(struct ieee802154_local *local);
187 188
188#endif /* __IEEE802154_I_H */ 189#endif /* __IEEE802154_I_H */
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 38b56f9d9386..91b75abbd1a1 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -522,7 +522,8 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata,
522 522
523struct net_device * 523struct net_device *
524ieee802154_if_add(struct ieee802154_local *local, const char *name, 524ieee802154_if_add(struct ieee802154_local *local, const char *name,
525 enum nl802154_iftype type, __le64 extended_addr) 525 unsigned char name_assign_type, enum nl802154_iftype type,
526 __le64 extended_addr)
526{ 527{
527 struct net_device *ndev = NULL; 528 struct net_device *ndev = NULL;
528 struct ieee802154_sub_if_data *sdata = NULL; 529 struct ieee802154_sub_if_data *sdata = NULL;
@@ -531,7 +532,7 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name,
531 ASSERT_RTNL(); 532 ASSERT_RTNL();
532 533
533 ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, name, 534 ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, name,
534 NET_NAME_UNKNOWN, ieee802154_if_setup); 535 name_assign_type, ieee802154_if_setup);
535 if (!ndev) 536 if (!ndev)
536 return ERR_PTR(-ENOMEM); 537 return ERR_PTR(-ENOMEM);
537 538
diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c
index dcf73958133a..5b2be12832e6 100644
--- a/net/mac802154/llsec.c
+++ b/net/mac802154/llsec.c
@@ -134,7 +134,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
134 for (i = 0; i < ARRAY_SIZE(key->tfm); i++) { 134 for (i = 0; i < ARRAY_SIZE(key->tfm); i++) {
135 key->tfm[i] = crypto_alloc_aead("ccm(aes)", 0, 135 key->tfm[i] = crypto_alloc_aead("ccm(aes)", 0,
136 CRYPTO_ALG_ASYNC); 136 CRYPTO_ALG_ASYNC);
137 if (!key->tfm[i]) 137 if (IS_ERR(key->tfm[i]))
138 goto err_tfm; 138 goto err_tfm;
139 if (crypto_aead_setkey(key->tfm[i], template->key, 139 if (crypto_aead_setkey(key->tfm[i], template->key,
140 IEEE802154_LLSEC_KEY_SIZE)) 140 IEEE802154_LLSEC_KEY_SIZE))
@@ -144,7 +144,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
144 } 144 }
145 145
146 key->tfm0 = crypto_alloc_blkcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); 146 key->tfm0 = crypto_alloc_blkcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);
147 if (!key->tfm0) 147 if (IS_ERR(key->tfm0))
148 goto err_tfm; 148 goto err_tfm;
149 149
150 if (crypto_blkcipher_setkey(key->tfm0, template->key, 150 if (crypto_blkcipher_setkey(key->tfm0, template->key,
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 8500378c8318..08cb32dc8fd3 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -161,18 +161,21 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
161 161
162 rtnl_lock(); 162 rtnl_lock();
163 163
164 dev = ieee802154_if_add(local, "wpan%d", NL802154_IFTYPE_NODE, 164 dev = ieee802154_if_add(local, "wpan%d", NET_NAME_ENUM,
165 NL802154_IFTYPE_NODE,
165 cpu_to_le64(0x0000000000000000ULL)); 166 cpu_to_le64(0x0000000000000000ULL));
166 if (IS_ERR(dev)) { 167 if (IS_ERR(dev)) {
167 rtnl_unlock(); 168 rtnl_unlock();
168 rc = PTR_ERR(dev); 169 rc = PTR_ERR(dev);
169 goto out_wq; 170 goto out_phy;
170 } 171 }
171 172
172 rtnl_unlock(); 173 rtnl_unlock();
173 174
174 return 0; 175 return 0;
175 176
177out_phy:
178 wpan_phy_unregister(local->phy);
176out_wq: 179out_wq:
177 destroy_workqueue(local->workqueue); 180 destroy_workqueue(local->workqueue);
178out: 181out:
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 954810c76a86..7b3f732269e4 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -647,7 +647,7 @@ int nla_get_labels(const struct nlattr *nla,
647 return -EINVAL; 647 return -EINVAL;
648 648
649 switch (dec.label) { 649 switch (dec.label) {
650 case LABEL_IMPLICIT_NULL: 650 case MPLS_LABEL_IMPLNULL:
651 /* RFC3032: This is a label that an LSR may 651 /* RFC3032: This is a label that an LSR may
652 * assign and distribute, but which never 652 * assign and distribute, but which never
653 * actually appears in the encapsulation. 653 * actually appears in the encapsulation.
@@ -935,7 +935,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)
935 } 935 }
936 936
937 /* In case the predefined labels need to be populated */ 937 /* In case the predefined labels need to be populated */
938 if (limit > LABEL_IPV4_EXPLICIT_NULL) { 938 if (limit > MPLS_LABEL_IPV4NULL) {
939 struct net_device *lo = net->loopback_dev; 939 struct net_device *lo = net->loopback_dev;
940 rt0 = mpls_rt_alloc(lo->addr_len); 940 rt0 = mpls_rt_alloc(lo->addr_len);
941 if (!rt0) 941 if (!rt0)
@@ -945,7 +945,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)
945 rt0->rt_via_table = NEIGH_LINK_TABLE; 945 rt0->rt_via_table = NEIGH_LINK_TABLE;
946 memcpy(rt0->rt_via, lo->dev_addr, lo->addr_len); 946 memcpy(rt0->rt_via, lo->dev_addr, lo->addr_len);
947 } 947 }
948 if (limit > LABEL_IPV6_EXPLICIT_NULL) { 948 if (limit > MPLS_LABEL_IPV6NULL) {
949 struct net_device *lo = net->loopback_dev; 949 struct net_device *lo = net->loopback_dev;
950 rt2 = mpls_rt_alloc(lo->addr_len); 950 rt2 = mpls_rt_alloc(lo->addr_len);
951 if (!rt2) 951 if (!rt2)
@@ -973,15 +973,15 @@ static int resize_platform_label_table(struct net *net, size_t limit)
973 memcpy(labels, old, cp_size); 973 memcpy(labels, old, cp_size);
974 974
975 /* If needed set the predefined labels */ 975 /* If needed set the predefined labels */
976 if ((old_limit <= LABEL_IPV6_EXPLICIT_NULL) && 976 if ((old_limit <= MPLS_LABEL_IPV6NULL) &&
977 (limit > LABEL_IPV6_EXPLICIT_NULL)) { 977 (limit > MPLS_LABEL_IPV6NULL)) {
978 RCU_INIT_POINTER(labels[LABEL_IPV6_EXPLICIT_NULL], rt2); 978 RCU_INIT_POINTER(labels[MPLS_LABEL_IPV6NULL], rt2);
979 rt2 = NULL; 979 rt2 = NULL;
980 } 980 }
981 981
982 if ((old_limit <= LABEL_IPV4_EXPLICIT_NULL) && 982 if ((old_limit <= MPLS_LABEL_IPV4NULL) &&
983 (limit > LABEL_IPV4_EXPLICIT_NULL)) { 983 (limit > MPLS_LABEL_IPV4NULL)) {
984 RCU_INIT_POINTER(labels[LABEL_IPV4_EXPLICIT_NULL], rt0); 984 RCU_INIT_POINTER(labels[MPLS_LABEL_IPV4NULL], rt0);
985 rt0 = NULL; 985 rt0 = NULL;
986 } 986 }
987 987
diff --git a/net/mpls/internal.h b/net/mpls/internal.h
index 693877d69606..b064c345042c 100644
--- a/net/mpls/internal.h
+++ b/net/mpls/internal.h
@@ -1,16 +1,6 @@
1#ifndef MPLS_INTERNAL_H 1#ifndef MPLS_INTERNAL_H
2#define MPLS_INTERNAL_H 2#define MPLS_INTERNAL_H
3 3
4#define LABEL_IPV4_EXPLICIT_NULL 0 /* RFC3032 */
5#define LABEL_ROUTER_ALERT_LABEL 1 /* RFC3032 */
6#define LABEL_IPV6_EXPLICIT_NULL 2 /* RFC3032 */
7#define LABEL_IMPLICIT_NULL 3 /* RFC3032 */
8#define LABEL_ENTROPY_INDICATOR 7 /* RFC6790 */
9#define LABEL_GAL 13 /* RFC5586 */
10#define LABEL_OAM_ALERT 14 /* RFC3429 */
11#define LABEL_EXTENSION 15 /* RFC7274 */
12
13
14struct mpls_shim_hdr { 4struct mpls_shim_hdr {
15 __be32 label_stack_entry; 5 __be32 label_stack_entry;
16}; 6};
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index ec4adbdcb9b4..daa0b818174b 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -3139,7 +3139,6 @@ static const struct rhashtable_params netlink_rhashtable_params = {
3139 .key_len = netlink_compare_arg_len, 3139 .key_len = netlink_compare_arg_len,
3140 .obj_hashfn = netlink_hash, 3140 .obj_hashfn = netlink_hash,
3141 .obj_cmpfn = netlink_compare, 3141 .obj_cmpfn = netlink_compare,
3142 .max_size = 65536,
3143 .automatic_shrinking = true, 3142 .automatic_shrinking = true,
3144}; 3143};
3145 3144
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 5102c3cc4eec..b5989c6ee551 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2311,11 +2311,14 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
2311 tlen = dev->needed_tailroom; 2311 tlen = dev->needed_tailroom;
2312 skb = sock_alloc_send_skb(&po->sk, 2312 skb = sock_alloc_send_skb(&po->sk,
2313 hlen + tlen + sizeof(struct sockaddr_ll), 2313 hlen + tlen + sizeof(struct sockaddr_ll),
2314 0, &err); 2314 !need_wait, &err);
2315 2315
2316 if (unlikely(skb == NULL)) 2316 if (unlikely(skb == NULL)) {
2317 /* we assume the socket was initially writeable ... */
2318 if (likely(len_sum > 0))
2319 err = len_sum;
2317 goto out_status; 2320 goto out_status;
2318 2321 }
2319 tp_len = tpacket_fill_skb(po, skb, ph, dev, size_max, proto, 2322 tp_len = tpacket_fill_skb(po, skb, ph, dev, size_max, proto,
2320 addr, hlen); 2323 addr, hlen);
2321 if (tp_len > dev->mtu + dev->hard_header_len) { 2324 if (tp_len > dev->mtu + dev->hard_header_len) {
diff --git a/net/rds/connection.c b/net/rds/connection.c
index 14f041398ca1..da6da57e5f36 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -126,7 +126,10 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,
126 struct rds_transport *loop_trans; 126 struct rds_transport *loop_trans;
127 unsigned long flags; 127 unsigned long flags;
128 int ret; 128 int ret;
129 struct rds_transport *otrans = trans;
129 130
131 if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP)
132 goto new_conn;
130 rcu_read_lock(); 133 rcu_read_lock();
131 conn = rds_conn_lookup(head, laddr, faddr, trans); 134 conn = rds_conn_lookup(head, laddr, faddr, trans);
132 if (conn && conn->c_loopback && conn->c_trans != &rds_loop_transport && 135 if (conn && conn->c_loopback && conn->c_trans != &rds_loop_transport &&
@@ -142,6 +145,7 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,
142 if (conn) 145 if (conn)
143 goto out; 146 goto out;
144 147
148new_conn:
145 conn = kmem_cache_zalloc(rds_conn_slab, gfp); 149 conn = kmem_cache_zalloc(rds_conn_slab, gfp);
146 if (!conn) { 150 if (!conn) {
147 conn = ERR_PTR(-ENOMEM); 151 conn = ERR_PTR(-ENOMEM);
@@ -230,13 +234,22 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,
230 /* Creating normal conn */ 234 /* Creating normal conn */
231 struct rds_connection *found; 235 struct rds_connection *found;
232 236
233 found = rds_conn_lookup(head, laddr, faddr, trans); 237 if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP)
238 found = NULL;
239 else
240 found = rds_conn_lookup(head, laddr, faddr, trans);
234 if (found) { 241 if (found) {
235 trans->conn_free(conn->c_transport_data); 242 trans->conn_free(conn->c_transport_data);
236 kmem_cache_free(rds_conn_slab, conn); 243 kmem_cache_free(rds_conn_slab, conn);
237 conn = found; 244 conn = found;
238 } else { 245 } else {
239 hlist_add_head_rcu(&conn->c_hash_node, head); 246 if ((is_outgoing && otrans->t_type == RDS_TRANS_TCP) ||
247 (otrans->t_type != RDS_TRANS_TCP)) {
248 /* Only the active side should be added to
249 * reconnect list for TCP.
250 */
251 hlist_add_head_rcu(&conn->c_hash_node, head);
252 }
240 rds_cong_add_conn(conn); 253 rds_cong_add_conn(conn);
241 rds_conn_count++; 254 rds_conn_count++;
242 } 255 }
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 31b74f5e61ad..8a09ee7db3c1 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -183,8 +183,17 @@ void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_even
183 183
184 /* If the peer gave us the last packet it saw, process this as if 184 /* If the peer gave us the last packet it saw, process this as if
185 * we had received a regular ACK. */ 185 * we had received a regular ACK. */
186 if (dp && dp->dp_ack_seq) 186 if (dp) {
187 rds_send_drop_acked(conn, be64_to_cpu(dp->dp_ack_seq), NULL); 187 /* dp structure start is not guaranteed to be 8 bytes aligned.
188 * Since dp_ack_seq is 64-bit extended load operations can be
189 * used so go through get_unaligned to avoid unaligned errors.
190 */
191 __be64 dp_ack_seq = get_unaligned(&dp->dp_ack_seq);
192
193 if (dp_ack_seq)
194 rds_send_drop_acked(conn, be64_to_cpu(dp_ack_seq),
195 NULL);
196 }
188 197
189 rds_connect_complete(conn); 198 rds_connect_complete(conn);
190} 199}
diff --git a/net/rds/tcp_connect.c b/net/rds/tcp_connect.c
index f9f564a6c960..973109c7b8e8 100644
--- a/net/rds/tcp_connect.c
+++ b/net/rds/tcp_connect.c
@@ -62,6 +62,7 @@ void rds_tcp_state_change(struct sock *sk)
62 case TCP_ESTABLISHED: 62 case TCP_ESTABLISHED:
63 rds_connect_complete(conn); 63 rds_connect_complete(conn);
64 break; 64 break;
65 case TCP_CLOSE_WAIT:
65 case TCP_CLOSE: 66 case TCP_CLOSE:
66 rds_conn_drop(conn); 67 rds_conn_drop(conn);
67 default: 68 default:
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index 23ab4dcd1d9f..0da49e34495f 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -45,12 +45,45 @@ static void rds_tcp_accept_worker(struct work_struct *work);
45static DECLARE_WORK(rds_tcp_listen_work, rds_tcp_accept_worker); 45static DECLARE_WORK(rds_tcp_listen_work, rds_tcp_accept_worker);
46static struct socket *rds_tcp_listen_sock; 46static struct socket *rds_tcp_listen_sock;
47 47
48static int rds_tcp_keepalive(struct socket *sock)
49{
50 /* values below based on xs_udp_default_timeout */
51 int keepidle = 5; /* send a probe 'keepidle' secs after last data */
52 int keepcnt = 5; /* number of unack'ed probes before declaring dead */
53 int keepalive = 1;
54 int ret = 0;
55
56 ret = kernel_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
57 (char *)&keepalive, sizeof(keepalive));
58 if (ret < 0)
59 goto bail;
60
61 ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_KEEPCNT,
62 (char *)&keepcnt, sizeof(keepcnt));
63 if (ret < 0)
64 goto bail;
65
66 ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_KEEPIDLE,
67 (char *)&keepidle, sizeof(keepidle));
68 if (ret < 0)
69 goto bail;
70
71 /* KEEPINTVL is the interval between successive probes. We follow
72 * the model in xs_tcp_finish_connecting() and re-use keepidle.
73 */
74 ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_KEEPINTVL,
75 (char *)&keepidle, sizeof(keepidle));
76bail:
77 return ret;
78}
79
48static int rds_tcp_accept_one(struct socket *sock) 80static int rds_tcp_accept_one(struct socket *sock)
49{ 81{
50 struct socket *new_sock = NULL; 82 struct socket *new_sock = NULL;
51 struct rds_connection *conn; 83 struct rds_connection *conn;
52 int ret; 84 int ret;
53 struct inet_sock *inet; 85 struct inet_sock *inet;
86 struct rds_tcp_connection *rs_tcp;
54 87
55 ret = sock_create_lite(sock->sk->sk_family, sock->sk->sk_type, 88 ret = sock_create_lite(sock->sk->sk_family, sock->sk->sk_type,
56 sock->sk->sk_protocol, &new_sock); 89 sock->sk->sk_protocol, &new_sock);
@@ -63,6 +96,10 @@ static int rds_tcp_accept_one(struct socket *sock)
63 if (ret < 0) 96 if (ret < 0)
64 goto out; 97 goto out;
65 98
99 ret = rds_tcp_keepalive(new_sock);
100 if (ret < 0)
101 goto out;
102
66 rds_tcp_tune(new_sock); 103 rds_tcp_tune(new_sock);
67 104
68 inet = inet_sk(new_sock->sk); 105 inet = inet_sk(new_sock->sk);
@@ -77,6 +114,15 @@ static int rds_tcp_accept_one(struct socket *sock)
77 ret = PTR_ERR(conn); 114 ret = PTR_ERR(conn);
78 goto out; 115 goto out;
79 } 116 }
117 /* An incoming SYN request came in, and TCP just accepted it.
118 * We always create a new conn for listen side of TCP, and do not
119 * add it to the c_hash_list.
120 *
121 * If the client reboots, this conn will need to be cleaned up.
122 * rds_tcp_state_change() will do that cleanup
123 */
124 rs_tcp = (struct rds_tcp_connection *)conn->c_transport_data;
125 WARN_ON(!rs_tcp || rs_tcp->t_sock);
80 126
81 /* 127 /*
82 * see the comment above rds_queue_delayed_reconnect() 128 * see the comment above rds_queue_delayed_reconnect()
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 8b0470e418dc..b6ef9a04de06 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -308,12 +308,11 @@ replay:
308 case RTM_DELTFILTER: 308 case RTM_DELTFILTER:
309 err = tp->ops->delete(tp, fh); 309 err = tp->ops->delete(tp, fh);
310 if (err == 0) { 310 if (err == 0) {
311 tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER); 311 struct tcf_proto *next = rtnl_dereference(tp->next);
312 if (tcf_destroy(tp, false)) {
313 struct tcf_proto *next = rtnl_dereference(tp->next);
314 312
313 tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER);
314 if (tcf_destroy(tp, false))
315 RCU_INIT_POINTER(*back, next); 315 RCU_INIT_POINTER(*back, next);
316 }
317 } 316 }
318 goto errout; 317 goto errout;
319 case RTM_GETTFILTER: 318 case RTM_GETTFILTER:
diff --git a/net/sched/sch_codel.c b/net/sched/sch_codel.c
index de28f8e968e8..7a0bdb16ac92 100644
--- a/net/sched/sch_codel.c
+++ b/net/sched/sch_codel.c
@@ -164,7 +164,7 @@ static int codel_init(struct Qdisc *sch, struct nlattr *opt)
164 164
165 sch->limit = DEFAULT_CODEL_LIMIT; 165 sch->limit = DEFAULT_CODEL_LIMIT;
166 166
167 codel_params_init(&q->params); 167 codel_params_init(&q->params, sch);
168 codel_vars_init(&q->vars); 168 codel_vars_init(&q->vars);
169 codel_stats_init(&q->stats); 169 codel_stats_init(&q->stats);
170 170
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 1e52decb7b59..c244c45b78d7 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -391,7 +391,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
391 q->perturbation = prandom_u32(); 391 q->perturbation = prandom_u32();
392 INIT_LIST_HEAD(&q->new_flows); 392 INIT_LIST_HEAD(&q->new_flows);
393 INIT_LIST_HEAD(&q->old_flows); 393 INIT_LIST_HEAD(&q->old_flows);
394 codel_params_init(&q->cparams); 394 codel_params_init(&q->cparams, sch);
395 codel_stats_init(&q->cstats); 395 codel_stats_init(&q->cstats);
396 q->cparams.ecn = true; 396 q->cparams.ecn = true;
397 397
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index a4ca4517cdc8..634529e0ce6b 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -229,7 +229,7 @@ static int gred_enqueue(struct sk_buff *skb, struct Qdisc *sch)
229 break; 229 break;
230 } 230 }
231 231
232 if (q->backlog + qdisc_pkt_len(skb) <= q->limit) { 232 if (gred_backlog(t, q, sch) + qdisc_pkt_len(skb) <= q->limit) {
233 q->backlog += qdisc_pkt_len(skb); 233 q->backlog += qdisc_pkt_len(skb);
234 return qdisc_enqueue_tail(skb, sch); 234 return qdisc_enqueue_tail(skb, sch);
235 } 235 }
@@ -553,7 +553,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
553 553
554 opt.limit = q->limit; 554 opt.limit = q->limit;
555 opt.DP = q->DP; 555 opt.DP = q->DP;
556 opt.backlog = q->backlog; 556 opt.backlog = gred_backlog(table, q, sch);
557 opt.prio = q->prio; 557 opt.prio = q->prio;
558 opt.qth_min = q->parms.qth_min >> q->parms.Wlog; 558 opt.qth_min = q->parms.qth_min >> q->parms.Wlog;
559 opt.qth_max = q->parms.qth_max >> q->parms.Wlog; 559 opt.qth_max = q->parms.qth_max >> q->parms.Wlog;