diff options
95 files changed, 802 insertions, 387 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index e626cb622dca..a6e86e20761e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -13117,6 +13117,7 @@ F: drivers/dma/dw/ | |||
13117 | 13117 | ||
13118 | SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER | 13118 | SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER |
13119 | M: Jie Deng <jiedeng@synopsys.com> | 13119 | M: Jie Deng <jiedeng@synopsys.com> |
13120 | M: Jose Abreu <Jose.Abreu@synopsys.com> | ||
13120 | L: netdev@vger.kernel.org | 13121 | L: netdev@vger.kernel.org |
13121 | S: Supported | 13122 | S: Supported |
13122 | F: drivers/net/ethernet/synopsys/ | 13123 | F: drivers/net/ethernet/synopsys/ |
diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-c.dts b/arch/arm/boot/dts/vf610-zii-dev-rev-c.dts index fbb3758ca2e3..4b8edc8982cf 100644 --- a/arch/arm/boot/dts/vf610-zii-dev-rev-c.dts +++ b/arch/arm/boot/dts/vf610-zii-dev-rev-c.dts | |||
@@ -121,7 +121,7 @@ | |||
121 | switch0port10: port@10 { | 121 | switch0port10: port@10 { |
122 | reg = <10>; | 122 | reg = <10>; |
123 | label = "dsa"; | 123 | label = "dsa"; |
124 | phy-mode = "xgmii"; | 124 | phy-mode = "xaui"; |
125 | link = <&switch1port10>; | 125 | link = <&switch1port10>; |
126 | }; | 126 | }; |
127 | }; | 127 | }; |
@@ -208,7 +208,7 @@ | |||
208 | switch1port10: port@10 { | 208 | switch1port10: port@10 { |
209 | reg = <10>; | 209 | reg = <10>; |
210 | label = "dsa"; | 210 | label = "dsa"; |
211 | phy-mode = "xgmii"; | 211 | phy-mode = "xaui"; |
212 | link = <&switch0port10>; | 212 | link = <&switch0port10>; |
213 | }; | 213 | }; |
214 | }; | 214 | }; |
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild index 50a32c33d729..73c57f614c9e 100644 --- a/arch/um/include/asm/Kbuild +++ b/arch/um/include/asm/Kbuild | |||
@@ -1,4 +1,5 @@ | |||
1 | generic-y += barrier.h | 1 | generic-y += barrier.h |
2 | generic-y += bpf_perf_event.h | ||
2 | generic-y += bug.h | 3 | generic-y += bug.h |
3 | generic-y += clkdev.h | 4 | generic-y += clkdev.h |
4 | generic-y += current.h | 5 | generic-y += current.h |
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index a7801f6668a5..6315774d72b3 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c | |||
@@ -338,6 +338,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, | |||
338 | cmode = MV88E6XXX_PORT_STS_CMODE_2500BASEX; | 338 | cmode = MV88E6XXX_PORT_STS_CMODE_2500BASEX; |
339 | break; | 339 | break; |
340 | case PHY_INTERFACE_MODE_XGMII: | 340 | case PHY_INTERFACE_MODE_XGMII: |
341 | case PHY_INTERFACE_MODE_XAUI: | ||
341 | cmode = MV88E6XXX_PORT_STS_CMODE_XAUI; | 342 | cmode = MV88E6XXX_PORT_STS_CMODE_XAUI; |
342 | break; | 343 | break; |
343 | case PHY_INTERFACE_MODE_RXAUI: | 344 | case PHY_INTERFACE_MODE_RXAUI: |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h b/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h index 57e796870595..105fdb958cef 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h | |||
@@ -50,7 +50,7 @@ | |||
50 | #define AQ_CFG_PCI_FUNC_MSIX_IRQS 9U | 50 | #define AQ_CFG_PCI_FUNC_MSIX_IRQS 9U |
51 | #define AQ_CFG_PCI_FUNC_PORTS 2U | 51 | #define AQ_CFG_PCI_FUNC_PORTS 2U |
52 | 52 | ||
53 | #define AQ_CFG_SERVICE_TIMER_INTERVAL (2 * HZ) | 53 | #define AQ_CFG_SERVICE_TIMER_INTERVAL (1 * HZ) |
54 | #define AQ_CFG_POLLING_TIMER_INTERVAL ((unsigned int)(2 * HZ)) | 54 | #define AQ_CFG_POLLING_TIMER_INTERVAL ((unsigned int)(2 * HZ)) |
55 | 55 | ||
56 | #define AQ_CFG_SKB_FRAGS_MAX 32U | 56 | #define AQ_CFG_SKB_FRAGS_MAX 32U |
@@ -80,6 +80,7 @@ | |||
80 | #define AQ_CFG_DRV_VERSION __stringify(NIC_MAJOR_DRIVER_VERSION)"."\ | 80 | #define AQ_CFG_DRV_VERSION __stringify(NIC_MAJOR_DRIVER_VERSION)"."\ |
81 | __stringify(NIC_MINOR_DRIVER_VERSION)"."\ | 81 | __stringify(NIC_MINOR_DRIVER_VERSION)"."\ |
82 | __stringify(NIC_BUILD_DRIVER_VERSION)"."\ | 82 | __stringify(NIC_BUILD_DRIVER_VERSION)"."\ |
83 | __stringify(NIC_REVISION_DRIVER_VERSION) | 83 | __stringify(NIC_REVISION_DRIVER_VERSION) \ |
84 | AQ_CFG_DRV_VERSION_SUFFIX | ||
84 | 85 | ||
85 | #endif /* AQ_CFG_H */ | 86 | #endif /* AQ_CFG_H */ |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c index 70efb7467bf3..f2d8063a2cef 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | |||
@@ -66,14 +66,14 @@ static const char aq_ethtool_stat_names[][ETH_GSTRING_LEN] = { | |||
66 | "OutUCast", | 66 | "OutUCast", |
67 | "OutMCast", | 67 | "OutMCast", |
68 | "OutBCast", | 68 | "OutBCast", |
69 | "InUCastOctects", | 69 | "InUCastOctets", |
70 | "OutUCastOctects", | 70 | "OutUCastOctets", |
71 | "InMCastOctects", | 71 | "InMCastOctets", |
72 | "OutMCastOctects", | 72 | "OutMCastOctets", |
73 | "InBCastOctects", | 73 | "InBCastOctets", |
74 | "OutBCastOctects", | 74 | "OutBCastOctets", |
75 | "InOctects", | 75 | "InOctets", |
76 | "OutOctects", | 76 | "OutOctets", |
77 | "InPacketsDma", | 77 | "InPacketsDma", |
78 | "OutPacketsDma", | 78 | "OutPacketsDma", |
79 | "InOctetsDma", | 79 | "InOctetsDma", |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h index 0207927dc8a6..b3825de6cdfb 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h | |||
@@ -46,6 +46,28 @@ struct aq_hw_link_status_s { | |||
46 | unsigned int mbps; | 46 | unsigned int mbps; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct aq_stats_s { | ||
50 | u64 uprc; | ||
51 | u64 mprc; | ||
52 | u64 bprc; | ||
53 | u64 erpt; | ||
54 | u64 uptc; | ||
55 | u64 mptc; | ||
56 | u64 bptc; | ||
57 | u64 erpr; | ||
58 | u64 mbtc; | ||
59 | u64 bbtc; | ||
60 | u64 mbrc; | ||
61 | u64 bbrc; | ||
62 | u64 ubrc; | ||
63 | u64 ubtc; | ||
64 | u64 dpc; | ||
65 | u64 dma_pkt_rc; | ||
66 | u64 dma_pkt_tc; | ||
67 | u64 dma_oct_rc; | ||
68 | u64 dma_oct_tc; | ||
69 | }; | ||
70 | |||
49 | #define AQ_HW_IRQ_INVALID 0U | 71 | #define AQ_HW_IRQ_INVALID 0U |
50 | #define AQ_HW_IRQ_LEGACY 1U | 72 | #define AQ_HW_IRQ_LEGACY 1U |
51 | #define AQ_HW_IRQ_MSI 2U | 73 | #define AQ_HW_IRQ_MSI 2U |
@@ -85,7 +107,9 @@ struct aq_hw_ops { | |||
85 | void (*destroy)(struct aq_hw_s *self); | 107 | void (*destroy)(struct aq_hw_s *self); |
86 | 108 | ||
87 | int (*get_hw_caps)(struct aq_hw_s *self, | 109 | int (*get_hw_caps)(struct aq_hw_s *self, |
88 | struct aq_hw_caps_s *aq_hw_caps); | 110 | struct aq_hw_caps_s *aq_hw_caps, |
111 | unsigned short device, | ||
112 | unsigned short subsystem_device); | ||
89 | 113 | ||
90 | int (*hw_ring_tx_xmit)(struct aq_hw_s *self, struct aq_ring_s *aq_ring, | 114 | int (*hw_ring_tx_xmit)(struct aq_hw_s *self, struct aq_ring_s *aq_ring, |
91 | unsigned int frags); | 115 | unsigned int frags); |
@@ -164,8 +188,7 @@ struct aq_hw_ops { | |||
164 | 188 | ||
165 | int (*hw_update_stats)(struct aq_hw_s *self); | 189 | int (*hw_update_stats)(struct aq_hw_s *self); |
166 | 190 | ||
167 | int (*hw_get_hw_stats)(struct aq_hw_s *self, u64 *data, | 191 | struct aq_stats_s *(*hw_get_hw_stats)(struct aq_hw_s *self); |
168 | unsigned int *p_count); | ||
169 | 192 | ||
170 | int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version); | 193 | int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version); |
171 | 194 | ||
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index 78dfb2ab78ce..75a894a9251c 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c | |||
@@ -37,6 +37,8 @@ static unsigned int aq_itr_rx; | |||
37 | module_param_named(aq_itr_rx, aq_itr_rx, uint, 0644); | 37 | module_param_named(aq_itr_rx, aq_itr_rx, uint, 0644); |
38 | MODULE_PARM_DESC(aq_itr_rx, "RX interrupt throttle rate"); | 38 | MODULE_PARM_DESC(aq_itr_rx, "RX interrupt throttle rate"); |
39 | 39 | ||
40 | static void aq_nic_update_ndev_stats(struct aq_nic_s *self); | ||
41 | |||
40 | static void aq_nic_rss_init(struct aq_nic_s *self, unsigned int num_rss_queues) | 42 | static void aq_nic_rss_init(struct aq_nic_s *self, unsigned int num_rss_queues) |
41 | { | 43 | { |
42 | struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; | 44 | struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; |
@@ -166,11 +168,8 @@ static int aq_nic_update_link_status(struct aq_nic_s *self) | |||
166 | static void aq_nic_service_timer_cb(struct timer_list *t) | 168 | static void aq_nic_service_timer_cb(struct timer_list *t) |
167 | { | 169 | { |
168 | struct aq_nic_s *self = from_timer(self, t, service_timer); | 170 | struct aq_nic_s *self = from_timer(self, t, service_timer); |
169 | struct net_device *ndev = aq_nic_get_ndev(self); | 171 | int ctimer = AQ_CFG_SERVICE_TIMER_INTERVAL; |
170 | int err = 0; | 172 | int err = 0; |
171 | unsigned int i = 0U; | ||
172 | struct aq_ring_stats_rx_s stats_rx; | ||
173 | struct aq_ring_stats_tx_s stats_tx; | ||
174 | 173 | ||
175 | if (aq_utils_obj_test(&self->header.flags, AQ_NIC_FLAGS_IS_NOT_READY)) | 174 | if (aq_utils_obj_test(&self->header.flags, AQ_NIC_FLAGS_IS_NOT_READY)) |
176 | goto err_exit; | 175 | goto err_exit; |
@@ -182,23 +181,14 @@ static void aq_nic_service_timer_cb(struct timer_list *t) | |||
182 | if (self->aq_hw_ops.hw_update_stats) | 181 | if (self->aq_hw_ops.hw_update_stats) |
183 | self->aq_hw_ops.hw_update_stats(self->aq_hw); | 182 | self->aq_hw_ops.hw_update_stats(self->aq_hw); |
184 | 183 | ||
185 | memset(&stats_rx, 0U, sizeof(struct aq_ring_stats_rx_s)); | 184 | aq_nic_update_ndev_stats(self); |
186 | memset(&stats_tx, 0U, sizeof(struct aq_ring_stats_tx_s)); | ||
187 | for (i = AQ_DIMOF(self->aq_vec); i--;) { | ||
188 | if (self->aq_vec[i]) | ||
189 | aq_vec_add_stats(self->aq_vec[i], &stats_rx, &stats_tx); | ||
190 | } | ||
191 | 185 | ||
192 | ndev->stats.rx_packets = stats_rx.packets; | 186 | /* If no link - use faster timer rate to detect link up asap */ |
193 | ndev->stats.rx_bytes = stats_rx.bytes; | 187 | if (!netif_carrier_ok(self->ndev)) |
194 | ndev->stats.rx_errors = stats_rx.errors; | 188 | ctimer = max(ctimer / 2, 1); |
195 | ndev->stats.tx_packets = stats_tx.packets; | ||
196 | ndev->stats.tx_bytes = stats_tx.bytes; | ||
197 | ndev->stats.tx_errors = stats_tx.errors; | ||
198 | 189 | ||
199 | err_exit: | 190 | err_exit: |
200 | mod_timer(&self->service_timer, | 191 | mod_timer(&self->service_timer, jiffies + ctimer); |
201 | jiffies + AQ_CFG_SERVICE_TIMER_INTERVAL); | ||
202 | } | 192 | } |
203 | 193 | ||
204 | static void aq_nic_polling_timer_cb(struct timer_list *t) | 194 | static void aq_nic_polling_timer_cb(struct timer_list *t) |
@@ -222,7 +212,7 @@ static struct net_device *aq_nic_ndev_alloc(void) | |||
222 | 212 | ||
223 | struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, | 213 | struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, |
224 | const struct ethtool_ops *et_ops, | 214 | const struct ethtool_ops *et_ops, |
225 | struct device *dev, | 215 | struct pci_dev *pdev, |
226 | struct aq_pci_func_s *aq_pci_func, | 216 | struct aq_pci_func_s *aq_pci_func, |
227 | unsigned int port, | 217 | unsigned int port, |
228 | const struct aq_hw_ops *aq_hw_ops) | 218 | const struct aq_hw_ops *aq_hw_ops) |
@@ -242,7 +232,7 @@ struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, | |||
242 | ndev->netdev_ops = ndev_ops; | 232 | ndev->netdev_ops = ndev_ops; |
243 | ndev->ethtool_ops = et_ops; | 233 | ndev->ethtool_ops = et_ops; |
244 | 234 | ||
245 | SET_NETDEV_DEV(ndev, dev); | 235 | SET_NETDEV_DEV(ndev, &pdev->dev); |
246 | 236 | ||
247 | ndev->if_port = port; | 237 | ndev->if_port = port; |
248 | self->ndev = ndev; | 238 | self->ndev = ndev; |
@@ -254,7 +244,8 @@ struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, | |||
254 | 244 | ||
255 | self->aq_hw = self->aq_hw_ops.create(aq_pci_func, self->port, | 245 | self->aq_hw = self->aq_hw_ops.create(aq_pci_func, self->port, |
256 | &self->aq_hw_ops); | 246 | &self->aq_hw_ops); |
257 | err = self->aq_hw_ops.get_hw_caps(self->aq_hw, &self->aq_hw_caps); | 247 | err = self->aq_hw_ops.get_hw_caps(self->aq_hw, &self->aq_hw_caps, |
248 | pdev->device, pdev->subsystem_device); | ||
258 | if (err < 0) | 249 | if (err < 0) |
259 | goto err_exit; | 250 | goto err_exit; |
260 | 251 | ||
@@ -749,16 +740,40 @@ int aq_nic_get_regs_count(struct aq_nic_s *self) | |||
749 | 740 | ||
750 | void aq_nic_get_stats(struct aq_nic_s *self, u64 *data) | 741 | void aq_nic_get_stats(struct aq_nic_s *self, u64 *data) |
751 | { | 742 | { |
752 | struct aq_vec_s *aq_vec = NULL; | ||
753 | unsigned int i = 0U; | 743 | unsigned int i = 0U; |
754 | unsigned int count = 0U; | 744 | unsigned int count = 0U; |
755 | int err = 0; | 745 | struct aq_vec_s *aq_vec = NULL; |
746 | struct aq_stats_s *stats = self->aq_hw_ops.hw_get_hw_stats(self->aq_hw); | ||
756 | 747 | ||
757 | err = self->aq_hw_ops.hw_get_hw_stats(self->aq_hw, data, &count); | 748 | if (!stats) |
758 | if (err < 0) | ||
759 | goto err_exit; | 749 | goto err_exit; |
760 | 750 | ||
761 | data += count; | 751 | data[i] = stats->uprc + stats->mprc + stats->bprc; |
752 | data[++i] = stats->uprc; | ||
753 | data[++i] = stats->mprc; | ||
754 | data[++i] = stats->bprc; | ||
755 | data[++i] = stats->erpt; | ||
756 | data[++i] = stats->uptc + stats->mptc + stats->bptc; | ||
757 | data[++i] = stats->uptc; | ||
758 | data[++i] = stats->mptc; | ||
759 | data[++i] = stats->bptc; | ||
760 | data[++i] = stats->ubrc; | ||
761 | data[++i] = stats->ubtc; | ||
762 | data[++i] = stats->mbrc; | ||
763 | data[++i] = stats->mbtc; | ||
764 | data[++i] = stats->bbrc; | ||
765 | data[++i] = stats->bbtc; | ||
766 | data[++i] = stats->ubrc + stats->mbrc + stats->bbrc; | ||
767 | data[++i] = stats->ubtc + stats->mbtc + stats->bbtc; | ||
768 | data[++i] = stats->dma_pkt_rc; | ||
769 | data[++i] = stats->dma_pkt_tc; | ||
770 | data[++i] = stats->dma_oct_rc; | ||
771 | data[++i] = stats->dma_oct_tc; | ||
772 | data[++i] = stats->dpc; | ||
773 | |||
774 | i++; | ||
775 | |||
776 | data += i; | ||
762 | count = 0U; | 777 | count = 0U; |
763 | 778 | ||
764 | for (i = 0U, aq_vec = self->aq_vec[0]; | 779 | for (i = 0U, aq_vec = self->aq_vec[0]; |
@@ -768,7 +783,20 @@ void aq_nic_get_stats(struct aq_nic_s *self, u64 *data) | |||
768 | } | 783 | } |
769 | 784 | ||
770 | err_exit:; | 785 | err_exit:; |
771 | (void)err; | 786 | } |
787 | |||
788 | static void aq_nic_update_ndev_stats(struct aq_nic_s *self) | ||
789 | { | ||
790 | struct net_device *ndev = self->ndev; | ||
791 | struct aq_stats_s *stats = self->aq_hw_ops.hw_get_hw_stats(self->aq_hw); | ||
792 | |||
793 | ndev->stats.rx_packets = stats->uprc + stats->mprc + stats->bprc; | ||
794 | ndev->stats.rx_bytes = stats->ubrc + stats->mbrc + stats->bbrc; | ||
795 | ndev->stats.rx_errors = stats->erpr; | ||
796 | ndev->stats.tx_packets = stats->uptc + stats->mptc + stats->bptc; | ||
797 | ndev->stats.tx_bytes = stats->ubtc + stats->mbtc + stats->bbtc; | ||
798 | ndev->stats.tx_errors = stats->erpt; | ||
799 | ndev->stats.multicast = stats->mprc; | ||
772 | } | 800 | } |
773 | 801 | ||
774 | void aq_nic_get_link_ksettings(struct aq_nic_s *self, | 802 | void aq_nic_get_link_ksettings(struct aq_nic_s *self, |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h index 4309983acdd6..3c9f8db03d5f 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h | |||
@@ -71,7 +71,7 @@ struct aq_nic_cfg_s { | |||
71 | 71 | ||
72 | struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, | 72 | struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, |
73 | const struct ethtool_ops *et_ops, | 73 | const struct ethtool_ops *et_ops, |
74 | struct device *dev, | 74 | struct pci_dev *pdev, |
75 | struct aq_pci_func_s *aq_pci_func, | 75 | struct aq_pci_func_s *aq_pci_func, |
76 | unsigned int port, | 76 | unsigned int port, |
77 | const struct aq_hw_ops *aq_hw_ops); | 77 | const struct aq_hw_ops *aq_hw_ops); |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c index cadaa646c89f..58c29d04b186 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | |||
@@ -51,7 +51,8 @@ struct aq_pci_func_s *aq_pci_func_alloc(struct aq_hw_ops *aq_hw_ops, | |||
51 | pci_set_drvdata(pdev, self); | 51 | pci_set_drvdata(pdev, self); |
52 | self->pdev = pdev; | 52 | self->pdev = pdev; |
53 | 53 | ||
54 | err = aq_hw_ops->get_hw_caps(NULL, &self->aq_hw_caps); | 54 | err = aq_hw_ops->get_hw_caps(NULL, &self->aq_hw_caps, pdev->device, |
55 | pdev->subsystem_device); | ||
55 | if (err < 0) | 56 | if (err < 0) |
56 | goto err_exit; | 57 | goto err_exit; |
57 | 58 | ||
@@ -59,7 +60,7 @@ struct aq_pci_func_s *aq_pci_func_alloc(struct aq_hw_ops *aq_hw_ops, | |||
59 | 60 | ||
60 | for (port = 0; port < self->ports; ++port) { | 61 | for (port = 0; port < self->ports; ++port) { |
61 | struct aq_nic_s *aq_nic = aq_nic_alloc_cold(ndev_ops, eth_ops, | 62 | struct aq_nic_s *aq_nic = aq_nic_alloc_cold(ndev_ops, eth_ops, |
62 | &pdev->dev, self, | 63 | pdev, self, |
63 | port, aq_hw_ops); | 64 | port, aq_hw_ops); |
64 | 65 | ||
65 | if (!aq_nic) { | 66 | if (!aq_nic) { |
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c index 07b3c49a16a4..f18dce14c93c 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | |||
@@ -18,9 +18,20 @@ | |||
18 | #include "hw_atl_a0_internal.h" | 18 | #include "hw_atl_a0_internal.h" |
19 | 19 | ||
20 | static int hw_atl_a0_get_hw_caps(struct aq_hw_s *self, | 20 | static int hw_atl_a0_get_hw_caps(struct aq_hw_s *self, |
21 | struct aq_hw_caps_s *aq_hw_caps) | 21 | struct aq_hw_caps_s *aq_hw_caps, |
22 | unsigned short device, | ||
23 | unsigned short subsystem_device) | ||
22 | { | 24 | { |
23 | memcpy(aq_hw_caps, &hw_atl_a0_hw_caps_, sizeof(*aq_hw_caps)); | 25 | memcpy(aq_hw_caps, &hw_atl_a0_hw_caps_, sizeof(*aq_hw_caps)); |
26 | |||
27 | if (device == HW_ATL_DEVICE_ID_D108 && subsystem_device == 0x0001) | ||
28 | aq_hw_caps->link_speed_msk &= ~HW_ATL_A0_RATE_10G; | ||
29 | |||
30 | if (device == HW_ATL_DEVICE_ID_D109 && subsystem_device == 0x0001) { | ||
31 | aq_hw_caps->link_speed_msk &= ~HW_ATL_A0_RATE_10G; | ||
32 | aq_hw_caps->link_speed_msk &= ~HW_ATL_A0_RATE_5G; | ||
33 | } | ||
34 | |||
24 | return 0; | 35 | return 0; |
25 | } | 36 | } |
26 | 37 | ||
@@ -333,6 +344,10 @@ static int hw_atl_a0_hw_init(struct aq_hw_s *self, | |||
333 | hw_atl_a0_hw_rss_set(self, &aq_nic_cfg->aq_rss); | 344 | hw_atl_a0_hw_rss_set(self, &aq_nic_cfg->aq_rss); |
334 | hw_atl_a0_hw_rss_hash_set(self, &aq_nic_cfg->aq_rss); | 345 | hw_atl_a0_hw_rss_hash_set(self, &aq_nic_cfg->aq_rss); |
335 | 346 | ||
347 | /* Reset link status and read out initial hardware counters */ | ||
348 | self->aq_link_status.mbps = 0; | ||
349 | hw_atl_utils_update_stats(self); | ||
350 | |||
336 | err = aq_hw_err_from_flags(self); | 351 | err = aq_hw_err_from_flags(self); |
337 | if (err < 0) | 352 | if (err < 0) |
338 | goto err_exit; | 353 | goto err_exit; |
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c index ec68c20efcbd..e4a22ce7bf09 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | |||
@@ -16,11 +16,23 @@ | |||
16 | #include "hw_atl_utils.h" | 16 | #include "hw_atl_utils.h" |
17 | #include "hw_atl_llh.h" | 17 | #include "hw_atl_llh.h" |
18 | #include "hw_atl_b0_internal.h" | 18 | #include "hw_atl_b0_internal.h" |
19 | #include "hw_atl_llh_internal.h" | ||
19 | 20 | ||
20 | static int hw_atl_b0_get_hw_caps(struct aq_hw_s *self, | 21 | static int hw_atl_b0_get_hw_caps(struct aq_hw_s *self, |
21 | struct aq_hw_caps_s *aq_hw_caps) | 22 | struct aq_hw_caps_s *aq_hw_caps, |
23 | unsigned short device, | ||
24 | unsigned short subsystem_device) | ||
22 | { | 25 | { |
23 | memcpy(aq_hw_caps, &hw_atl_b0_hw_caps_, sizeof(*aq_hw_caps)); | 26 | memcpy(aq_hw_caps, &hw_atl_b0_hw_caps_, sizeof(*aq_hw_caps)); |
27 | |||
28 | if (device == HW_ATL_DEVICE_ID_D108 && subsystem_device == 0x0001) | ||
29 | aq_hw_caps->link_speed_msk &= ~HW_ATL_B0_RATE_10G; | ||
30 | |||
31 | if (device == HW_ATL_DEVICE_ID_D109 && subsystem_device == 0x0001) { | ||
32 | aq_hw_caps->link_speed_msk &= ~HW_ATL_B0_RATE_10G; | ||
33 | aq_hw_caps->link_speed_msk &= ~HW_ATL_B0_RATE_5G; | ||
34 | } | ||
35 | |||
24 | return 0; | 36 | return 0; |
25 | } | 37 | } |
26 | 38 | ||
@@ -357,6 +369,7 @@ static int hw_atl_b0_hw_init(struct aq_hw_s *self, | |||
357 | }; | 369 | }; |
358 | 370 | ||
359 | int err = 0; | 371 | int err = 0; |
372 | u32 val; | ||
360 | 373 | ||
361 | self->aq_nic_cfg = aq_nic_cfg; | 374 | self->aq_nic_cfg = aq_nic_cfg; |
362 | 375 | ||
@@ -374,6 +387,20 @@ static int hw_atl_b0_hw_init(struct aq_hw_s *self, | |||
374 | hw_atl_b0_hw_rss_set(self, &aq_nic_cfg->aq_rss); | 387 | hw_atl_b0_hw_rss_set(self, &aq_nic_cfg->aq_rss); |
375 | hw_atl_b0_hw_rss_hash_set(self, &aq_nic_cfg->aq_rss); | 388 | hw_atl_b0_hw_rss_hash_set(self, &aq_nic_cfg->aq_rss); |
376 | 389 | ||
390 | /* Force limit MRRS on RDM/TDM to 2K */ | ||
391 | val = aq_hw_read_reg(self, pci_reg_control6_adr); | ||
392 | aq_hw_write_reg(self, pci_reg_control6_adr, (val & ~0x707) | 0x404); | ||
393 | |||
394 | /* TX DMA total request limit. B0 hardware is not capable to | ||
395 | * handle more than (8K-MRRS) incoming DMA data. | ||
396 | * Value 24 in 256byte units | ||
397 | */ | ||
398 | aq_hw_write_reg(self, tx_dma_total_req_limit_adr, 24); | ||
399 | |||
400 | /* Reset link status and read out initial hardware counters */ | ||
401 | self->aq_link_status.mbps = 0; | ||
402 | hw_atl_utils_update_stats(self); | ||
403 | |||
377 | err = aq_hw_err_from_flags(self); | 404 | err = aq_hw_err_from_flags(self); |
378 | if (err < 0) | 405 | if (err < 0) |
379 | goto err_exit; | 406 | goto err_exit; |
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h index 5527fc0e5942..93450ec930e8 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h | |||
@@ -2343,6 +2343,9 @@ | |||
2343 | #define tx_dma_desc_base_addrmsw_adr(descriptor) \ | 2343 | #define tx_dma_desc_base_addrmsw_adr(descriptor) \ |
2344 | (0x00007c04u + (descriptor) * 0x40) | 2344 | (0x00007c04u + (descriptor) * 0x40) |
2345 | 2345 | ||
2346 | /* tx dma total request limit */ | ||
2347 | #define tx_dma_total_req_limit_adr 0x00007b20u | ||
2348 | |||
2346 | /* tx interrupt moderation control register definitions | 2349 | /* tx interrupt moderation control register definitions |
2347 | * Preprocessor definitions for TX Interrupt Moderation Control Register | 2350 | * Preprocessor definitions for TX Interrupt Moderation Control Register |
2348 | * Base Address: 0x00008980 | 2351 | * Base Address: 0x00008980 |
@@ -2369,6 +2372,9 @@ | |||
2369 | /* default value of bitfield reg_res_dsbl */ | 2372 | /* default value of bitfield reg_res_dsbl */ |
2370 | #define pci_reg_res_dsbl_default 0x1 | 2373 | #define pci_reg_res_dsbl_default 0x1 |
2371 | 2374 | ||
2375 | /* PCI core control register */ | ||
2376 | #define pci_reg_control6_adr 0x1014u | ||
2377 | |||
2372 | /* global microprocessor scratch pad definitions */ | 2378 | /* global microprocessor scratch pad definitions */ |
2373 | #define glb_cpu_scratch_scp_adr(scratch_scp) (0x00000300u + (scratch_scp) * 0x4) | 2379 | #define glb_cpu_scratch_scp_adr(scratch_scp) (0x00000300u + (scratch_scp) * 0x4) |
2374 | 2380 | ||
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c index 1fe016fc4bc7..f2ce12ed4218 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | |||
@@ -503,73 +503,43 @@ int hw_atl_utils_update_stats(struct aq_hw_s *self) | |||
503 | struct hw_atl_s *hw_self = PHAL_ATLANTIC; | 503 | struct hw_atl_s *hw_self = PHAL_ATLANTIC; |
504 | struct hw_aq_atl_utils_mbox mbox; | 504 | struct hw_aq_atl_utils_mbox mbox; |
505 | 505 | ||
506 | if (!self->aq_link_status.mbps) | ||
507 | return 0; | ||
508 | |||
509 | hw_atl_utils_mpi_read_stats(self, &mbox); | 506 | hw_atl_utils_mpi_read_stats(self, &mbox); |
510 | 507 | ||
511 | #define AQ_SDELTA(_N_) (hw_self->curr_stats._N_ += \ | 508 | #define AQ_SDELTA(_N_) (hw_self->curr_stats._N_ += \ |
512 | mbox.stats._N_ - hw_self->last_stats._N_) | 509 | mbox.stats._N_ - hw_self->last_stats._N_) |
513 | 510 | if (self->aq_link_status.mbps) { | |
514 | AQ_SDELTA(uprc); | 511 | AQ_SDELTA(uprc); |
515 | AQ_SDELTA(mprc); | 512 | AQ_SDELTA(mprc); |
516 | AQ_SDELTA(bprc); | 513 | AQ_SDELTA(bprc); |
517 | AQ_SDELTA(erpt); | 514 | AQ_SDELTA(erpt); |
518 | 515 | ||
519 | AQ_SDELTA(uptc); | 516 | AQ_SDELTA(uptc); |
520 | AQ_SDELTA(mptc); | 517 | AQ_SDELTA(mptc); |
521 | AQ_SDELTA(bptc); | 518 | AQ_SDELTA(bptc); |
522 | AQ_SDELTA(erpr); | 519 | AQ_SDELTA(erpr); |
523 | 520 | ||
524 | AQ_SDELTA(ubrc); | 521 | AQ_SDELTA(ubrc); |
525 | AQ_SDELTA(ubtc); | 522 | AQ_SDELTA(ubtc); |
526 | AQ_SDELTA(mbrc); | 523 | AQ_SDELTA(mbrc); |
527 | AQ_SDELTA(mbtc); | 524 | AQ_SDELTA(mbtc); |
528 | AQ_SDELTA(bbrc); | 525 | AQ_SDELTA(bbrc); |
529 | AQ_SDELTA(bbtc); | 526 | AQ_SDELTA(bbtc); |
530 | AQ_SDELTA(dpc); | 527 | AQ_SDELTA(dpc); |
531 | 528 | } | |
532 | #undef AQ_SDELTA | 529 | #undef AQ_SDELTA |
530 | hw_self->curr_stats.dma_pkt_rc = stats_rx_dma_good_pkt_counterlsw_get(self); | ||
531 | hw_self->curr_stats.dma_pkt_tc = stats_tx_dma_good_pkt_counterlsw_get(self); | ||
532 | hw_self->curr_stats.dma_oct_rc = stats_rx_dma_good_octet_counterlsw_get(self); | ||
533 | hw_self->curr_stats.dma_oct_tc = stats_tx_dma_good_octet_counterlsw_get(self); | ||
533 | 534 | ||
534 | memcpy(&hw_self->last_stats, &mbox.stats, sizeof(mbox.stats)); | 535 | memcpy(&hw_self->last_stats, &mbox.stats, sizeof(mbox.stats)); |
535 | 536 | ||
536 | return 0; | 537 | return 0; |
537 | } | 538 | } |
538 | 539 | ||
539 | int hw_atl_utils_get_hw_stats(struct aq_hw_s *self, | 540 | struct aq_stats_s *hw_atl_utils_get_hw_stats(struct aq_hw_s *self) |
540 | u64 *data, unsigned int *p_count) | ||
541 | { | 541 | { |
542 | struct hw_atl_s *hw_self = PHAL_ATLANTIC; | 542 | return &PHAL_ATLANTIC->curr_stats; |
543 | struct hw_atl_stats_s *stats = &hw_self->curr_stats; | ||
544 | int i = 0; | ||
545 | |||
546 | data[i] = stats->uprc + stats->mprc + stats->bprc; | ||
547 | data[++i] = stats->uprc; | ||
548 | data[++i] = stats->mprc; | ||
549 | data[++i] = stats->bprc; | ||
550 | data[++i] = stats->erpt; | ||
551 | data[++i] = stats->uptc + stats->mptc + stats->bptc; | ||
552 | data[++i] = stats->uptc; | ||
553 | data[++i] = stats->mptc; | ||
554 | data[++i] = stats->bptc; | ||
555 | data[++i] = stats->ubrc; | ||
556 | data[++i] = stats->ubtc; | ||
557 | data[++i] = stats->mbrc; | ||
558 | data[++i] = stats->mbtc; | ||
559 | data[++i] = stats->bbrc; | ||
560 | data[++i] = stats->bbtc; | ||
561 | data[++i] = stats->ubrc + stats->mbrc + stats->bbrc; | ||
562 | data[++i] = stats->ubtc + stats->mbtc + stats->bbtc; | ||
563 | data[++i] = stats_rx_dma_good_pkt_counterlsw_get(self); | ||
564 | data[++i] = stats_tx_dma_good_pkt_counterlsw_get(self); | ||
565 | data[++i] = stats_rx_dma_good_octet_counterlsw_get(self); | ||
566 | data[++i] = stats_tx_dma_good_octet_counterlsw_get(self); | ||
567 | data[++i] = stats->dpc; | ||
568 | |||
569 | if (p_count) | ||
570 | *p_count = ++i; | ||
571 | |||
572 | return 0; | ||
573 | } | 543 | } |
574 | 544 | ||
575 | static const u32 hw_atl_utils_hw_mac_regs[] = { | 545 | static const u32 hw_atl_utils_hw_mac_regs[] = { |
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h index c99cc690e425..21aeca6908d3 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h | |||
@@ -129,7 +129,7 @@ struct __packed hw_aq_atl_utils_mbox { | |||
129 | struct __packed hw_atl_s { | 129 | struct __packed hw_atl_s { |
130 | struct aq_hw_s base; | 130 | struct aq_hw_s base; |
131 | struct hw_atl_stats_s last_stats; | 131 | struct hw_atl_stats_s last_stats; |
132 | struct hw_atl_stats_s curr_stats; | 132 | struct aq_stats_s curr_stats; |
133 | u64 speed; | 133 | u64 speed; |
134 | unsigned int chip_features; | 134 | unsigned int chip_features; |
135 | u32 fw_ver_actual; | 135 | u32 fw_ver_actual; |
@@ -207,8 +207,6 @@ int hw_atl_utils_get_fw_version(struct aq_hw_s *self, u32 *fw_version); | |||
207 | 207 | ||
208 | int hw_atl_utils_update_stats(struct aq_hw_s *self); | 208 | int hw_atl_utils_update_stats(struct aq_hw_s *self); |
209 | 209 | ||
210 | int hw_atl_utils_get_hw_stats(struct aq_hw_s *self, | 210 | struct aq_stats_s *hw_atl_utils_get_hw_stats(struct aq_hw_s *self); |
211 | u64 *data, | ||
212 | unsigned int *p_count); | ||
213 | 211 | ||
214 | #endif /* HW_ATL_UTILS_H */ | 212 | #endif /* HW_ATL_UTILS_H */ |
diff --git a/drivers/net/ethernet/aquantia/atlantic/ver.h b/drivers/net/ethernet/aquantia/atlantic/ver.h index 0de858d215c2..9009f2651e70 100644 --- a/drivers/net/ethernet/aquantia/atlantic/ver.h +++ b/drivers/net/ethernet/aquantia/atlantic/ver.h | |||
@@ -11,8 +11,10 @@ | |||
11 | #define VER_H | 11 | #define VER_H |
12 | 12 | ||
13 | #define NIC_MAJOR_DRIVER_VERSION 1 | 13 | #define NIC_MAJOR_DRIVER_VERSION 1 |
14 | #define NIC_MINOR_DRIVER_VERSION 5 | 14 | #define NIC_MINOR_DRIVER_VERSION 6 |
15 | #define NIC_BUILD_DRIVER_VERSION 345 | 15 | #define NIC_BUILD_DRIVER_VERSION 13 |
16 | #define NIC_REVISION_DRIVER_VERSION 0 | 16 | #define NIC_REVISION_DRIVER_VERSION 0 |
17 | 17 | ||
18 | #define AQ_CFG_DRV_VERSION_SUFFIX "-kern" | ||
19 | |||
18 | #endif /* VER_H */ | 20 | #endif /* VER_H */ |
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c index c6163874e4e7..16f9bee992fe 100644 --- a/drivers/net/ethernet/arc/emac_rockchip.c +++ b/drivers/net/ethernet/arc/emac_rockchip.c | |||
@@ -199,9 +199,11 @@ static int emac_rockchip_probe(struct platform_device *pdev) | |||
199 | 199 | ||
200 | /* RMII interface needs always a rate of 50MHz */ | 200 | /* RMII interface needs always a rate of 50MHz */ |
201 | err = clk_set_rate(priv->refclk, 50000000); | 201 | err = clk_set_rate(priv->refclk, 50000000); |
202 | if (err) | 202 | if (err) { |
203 | dev_err(dev, | 203 | dev_err(dev, |
204 | "failed to change reference clock rate (%d)\n", err); | 204 | "failed to change reference clock rate (%d)\n", err); |
205 | goto out_regulator_disable; | ||
206 | } | ||
205 | 207 | ||
206 | if (priv->soc_data->need_div_macclk) { | 208 | if (priv->soc_data->need_div_macclk) { |
207 | priv->macclk = devm_clk_get(dev, "macclk"); | 209 | priv->macclk = devm_clk_get(dev, "macclk"); |
@@ -230,12 +232,14 @@ static int emac_rockchip_probe(struct platform_device *pdev) | |||
230 | err = arc_emac_probe(ndev, interface); | 232 | err = arc_emac_probe(ndev, interface); |
231 | if (err) { | 233 | if (err) { |
232 | dev_err(dev, "failed to probe arc emac (%d)\n", err); | 234 | dev_err(dev, "failed to probe arc emac (%d)\n", err); |
233 | goto out_regulator_disable; | 235 | goto out_clk_disable_macclk; |
234 | } | 236 | } |
235 | 237 | ||
236 | return 0; | 238 | return 0; |
239 | |||
237 | out_clk_disable_macclk: | 240 | out_clk_disable_macclk: |
238 | clk_disable_unprepare(priv->macclk); | 241 | if (priv->soc_data->need_div_macclk) |
242 | clk_disable_unprepare(priv->macclk); | ||
239 | out_regulator_disable: | 243 | out_regulator_disable: |
240 | if (priv->regulator) | 244 | if (priv->regulator) |
241 | regulator_disable(priv->regulator); | 245 | regulator_disable(priv->regulator); |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 6e423f098a60..31efc47c847e 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
@@ -4081,7 +4081,6 @@ static void skge_remove(struct pci_dev *pdev) | |||
4081 | if (hw->ports > 1) { | 4081 | if (hw->ports > 1) { |
4082 | skge_write32(hw, B0_IMSK, 0); | 4082 | skge_write32(hw, B0_IMSK, 0); |
4083 | skge_read32(hw, B0_IMSK); | 4083 | skge_read32(hw, B0_IMSK); |
4084 | free_irq(pdev->irq, hw); | ||
4085 | } | 4084 | } |
4086 | spin_unlock_irq(&hw->hw_lock); | 4085 | spin_unlock_irq(&hw->hw_lock); |
4087 | 4086 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.c b/drivers/net/ethernet/mellanox/mlx4/en_port.c index e0eb695318e6..1fa4849a6f56 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_port.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_port.c | |||
@@ -188,7 +188,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
188 | struct net_device *dev = mdev->pndev[port]; | 188 | struct net_device *dev = mdev->pndev[port]; |
189 | struct mlx4_en_priv *priv = netdev_priv(dev); | 189 | struct mlx4_en_priv *priv = netdev_priv(dev); |
190 | struct net_device_stats *stats = &dev->stats; | 190 | struct net_device_stats *stats = &dev->stats; |
191 | struct mlx4_cmd_mailbox *mailbox; | 191 | struct mlx4_cmd_mailbox *mailbox, *mailbox_priority; |
192 | u64 in_mod = reset << 8 | port; | 192 | u64 in_mod = reset << 8 | port; |
193 | int err; | 193 | int err; |
194 | int i, counter_index; | 194 | int i, counter_index; |
@@ -198,6 +198,13 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
198 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); | 198 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); |
199 | if (IS_ERR(mailbox)) | 199 | if (IS_ERR(mailbox)) |
200 | return PTR_ERR(mailbox); | 200 | return PTR_ERR(mailbox); |
201 | |||
202 | mailbox_priority = mlx4_alloc_cmd_mailbox(mdev->dev); | ||
203 | if (IS_ERR(mailbox_priority)) { | ||
204 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); | ||
205 | return PTR_ERR(mailbox_priority); | ||
206 | } | ||
207 | |||
201 | err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, in_mod, 0, | 208 | err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, in_mod, 0, |
202 | MLX4_CMD_DUMP_ETH_STATS, MLX4_CMD_TIME_CLASS_B, | 209 | MLX4_CMD_DUMP_ETH_STATS, MLX4_CMD_TIME_CLASS_B, |
203 | MLX4_CMD_NATIVE); | 210 | MLX4_CMD_NATIVE); |
@@ -206,6 +213,28 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
206 | 213 | ||
207 | mlx4_en_stats = mailbox->buf; | 214 | mlx4_en_stats = mailbox->buf; |
208 | 215 | ||
216 | memset(&tmp_counter_stats, 0, sizeof(tmp_counter_stats)); | ||
217 | counter_index = mlx4_get_default_counter_index(mdev->dev, port); | ||
218 | err = mlx4_get_counter_stats(mdev->dev, counter_index, | ||
219 | &tmp_counter_stats, reset); | ||
220 | |||
221 | /* 0xffs indicates invalid value */ | ||
222 | memset(mailbox_priority->buf, 0xff, | ||
223 | sizeof(*flowstats) * MLX4_NUM_PRIORITIES); | ||
224 | |||
225 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN) { | ||
226 | memset(mailbox_priority->buf, 0, | ||
227 | sizeof(*flowstats) * MLX4_NUM_PRIORITIES); | ||
228 | err = mlx4_cmd_box(mdev->dev, 0, mailbox_priority->dma, | ||
229 | in_mod | MLX4_DUMP_ETH_STATS_FLOW_CONTROL, | ||
230 | 0, MLX4_CMD_DUMP_ETH_STATS, | ||
231 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); | ||
232 | if (err) | ||
233 | goto out; | ||
234 | } | ||
235 | |||
236 | flowstats = mailbox_priority->buf; | ||
237 | |||
209 | spin_lock_bh(&priv->stats_lock); | 238 | spin_lock_bh(&priv->stats_lock); |
210 | 239 | ||
211 | mlx4_en_fold_software_stats(dev); | 240 | mlx4_en_fold_software_stats(dev); |
@@ -345,31 +374,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
345 | priv->pkstats.tx_prio[8][0] = be64_to_cpu(mlx4_en_stats->TTOT_novlan); | 374 | priv->pkstats.tx_prio[8][0] = be64_to_cpu(mlx4_en_stats->TTOT_novlan); |
346 | priv->pkstats.tx_prio[8][1] = be64_to_cpu(mlx4_en_stats->TOCT_novlan); | 375 | priv->pkstats.tx_prio[8][1] = be64_to_cpu(mlx4_en_stats->TOCT_novlan); |
347 | 376 | ||
348 | spin_unlock_bh(&priv->stats_lock); | ||
349 | |||
350 | memset(&tmp_counter_stats, 0, sizeof(tmp_counter_stats)); | ||
351 | counter_index = mlx4_get_default_counter_index(mdev->dev, port); | ||
352 | err = mlx4_get_counter_stats(mdev->dev, counter_index, | ||
353 | &tmp_counter_stats, reset); | ||
354 | |||
355 | /* 0xffs indicates invalid value */ | ||
356 | memset(mailbox->buf, 0xff, sizeof(*flowstats) * MLX4_NUM_PRIORITIES); | ||
357 | |||
358 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN) { | ||
359 | memset(mailbox->buf, 0, | ||
360 | sizeof(*flowstats) * MLX4_NUM_PRIORITIES); | ||
361 | err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, | ||
362 | in_mod | MLX4_DUMP_ETH_STATS_FLOW_CONTROL, | ||
363 | 0, MLX4_CMD_DUMP_ETH_STATS, | ||
364 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); | ||
365 | if (err) | ||
366 | goto out; | ||
367 | } | ||
368 | |||
369 | flowstats = mailbox->buf; | ||
370 | |||
371 | spin_lock_bh(&priv->stats_lock); | ||
372 | |||
373 | if (tmp_counter_stats.counter_mode == 0) { | 377 | if (tmp_counter_stats.counter_mode == 0) { |
374 | priv->pf_stats.rx_bytes = be64_to_cpu(tmp_counter_stats.rx_bytes); | 378 | priv->pf_stats.rx_bytes = be64_to_cpu(tmp_counter_stats.rx_bytes); |
375 | priv->pf_stats.tx_bytes = be64_to_cpu(tmp_counter_stats.tx_bytes); | 379 | priv->pf_stats.tx_bytes = be64_to_cpu(tmp_counter_stats.tx_bytes); |
@@ -410,6 +414,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
410 | 414 | ||
411 | out: | 415 | out: |
412 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); | 416 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); |
417 | mlx4_free_cmd_mailbox(mdev->dev, mailbox_priority); | ||
413 | return err; | 418 | return err; |
414 | } | 419 | } |
415 | 420 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c index 88699b181946..946d9db7c8c2 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c | |||
@@ -185,7 +185,7 @@ void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf) | |||
185 | if (priv->mdev->dev->caps.flags & | 185 | if (priv->mdev->dev->caps.flags & |
186 | MLX4_DEV_CAP_FLAG_UC_LOOPBACK) { | 186 | MLX4_DEV_CAP_FLAG_UC_LOOPBACK) { |
187 | buf[3] = mlx4_en_test_registers(priv); | 187 | buf[3] = mlx4_en_test_registers(priv); |
188 | if (priv->port_up) | 188 | if (priv->port_up && dev->mtu >= MLX4_SELFTEST_LB_MIN_MTU) |
189 | buf[4] = mlx4_en_test_loopback(priv); | 189 | buf[4] = mlx4_en_test_loopback(priv); |
190 | } | 190 | } |
191 | 191 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 1856e279a7e0..2b72677eccd4 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -153,6 +153,9 @@ | |||
153 | #define SMALL_PACKET_SIZE (256 - NET_IP_ALIGN) | 153 | #define SMALL_PACKET_SIZE (256 - NET_IP_ALIGN) |
154 | #define HEADER_COPY_SIZE (128 - NET_IP_ALIGN) | 154 | #define HEADER_COPY_SIZE (128 - NET_IP_ALIGN) |
155 | #define MLX4_LOOPBACK_TEST_PAYLOAD (HEADER_COPY_SIZE - ETH_HLEN) | 155 | #define MLX4_LOOPBACK_TEST_PAYLOAD (HEADER_COPY_SIZE - ETH_HLEN) |
156 | #define PREAMBLE_LEN 8 | ||
157 | #define MLX4_SELFTEST_LB_MIN_MTU (MLX4_LOOPBACK_TEST_PAYLOAD + NET_IP_ALIGN + \ | ||
158 | ETH_HLEN + PREAMBLE_LEN) | ||
156 | 159 | ||
157 | #define MLX4_EN_MIN_MTU 46 | 160 | #define MLX4_EN_MIN_MTU 46 |
158 | /* VLAN_HLEN is added twice,to support skb vlan tagged with multiple | 161 | /* VLAN_HLEN is added twice,to support skb vlan tagged with multiple |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 04304dd894c6..606a0e0beeae 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -611,7 +611,6 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev) | |||
611 | MLX4_MAX_PORTS; | 611 | MLX4_MAX_PORTS; |
612 | else | 612 | else |
613 | res_alloc->guaranteed[t] = 0; | 613 | res_alloc->guaranteed[t] = 0; |
614 | res_alloc->res_free -= res_alloc->guaranteed[t]; | ||
615 | break; | 614 | break; |
616 | default: | 615 | default: |
617 | break; | 616 | break; |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 2d0897b7d860..9bd8d28de152 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |||
@@ -4300,6 +4300,7 @@ static int mlxsw_sp_port_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, | |||
4300 | 4300 | ||
4301 | static int mlxsw_sp_port_ovs_join(struct mlxsw_sp_port *mlxsw_sp_port) | 4301 | static int mlxsw_sp_port_ovs_join(struct mlxsw_sp_port *mlxsw_sp_port) |
4302 | { | 4302 | { |
4303 | u16 vid = 1; | ||
4303 | int err; | 4304 | int err; |
4304 | 4305 | ||
4305 | err = mlxsw_sp_port_vp_mode_set(mlxsw_sp_port, true); | 4306 | err = mlxsw_sp_port_vp_mode_set(mlxsw_sp_port, true); |
@@ -4312,8 +4313,19 @@ static int mlxsw_sp_port_ovs_join(struct mlxsw_sp_port *mlxsw_sp_port) | |||
4312 | true, false); | 4313 | true, false); |
4313 | if (err) | 4314 | if (err) |
4314 | goto err_port_vlan_set; | 4315 | goto err_port_vlan_set; |
4316 | |||
4317 | for (; vid <= VLAN_N_VID - 1; vid++) { | ||
4318 | err = mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, | ||
4319 | vid, false); | ||
4320 | if (err) | ||
4321 | goto err_vid_learning_set; | ||
4322 | } | ||
4323 | |||
4315 | return 0; | 4324 | return 0; |
4316 | 4325 | ||
4326 | err_vid_learning_set: | ||
4327 | for (vid--; vid >= 1; vid--) | ||
4328 | mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, true); | ||
4317 | err_port_vlan_set: | 4329 | err_port_vlan_set: |
4318 | mlxsw_sp_port_stp_set(mlxsw_sp_port, false); | 4330 | mlxsw_sp_port_stp_set(mlxsw_sp_port, false); |
4319 | err_port_stp_set: | 4331 | err_port_stp_set: |
@@ -4323,6 +4335,12 @@ err_port_stp_set: | |||
4323 | 4335 | ||
4324 | static void mlxsw_sp_port_ovs_leave(struct mlxsw_sp_port *mlxsw_sp_port) | 4336 | static void mlxsw_sp_port_ovs_leave(struct mlxsw_sp_port *mlxsw_sp_port) |
4325 | { | 4337 | { |
4338 | u16 vid; | ||
4339 | |||
4340 | for (vid = VLAN_N_VID - 1; vid >= 1; vid--) | ||
4341 | mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, | ||
4342 | vid, true); | ||
4343 | |||
4326 | mlxsw_sp_port_vlan_set(mlxsw_sp_port, 2, VLAN_N_VID - 1, | 4344 | mlxsw_sp_port_vlan_set(mlxsw_sp_port, 2, VLAN_N_VID - 1, |
4327 | false, false); | 4345 | false, false); |
4328 | mlxsw_sp_port_stp_set(mlxsw_sp_port, false); | 4346 | mlxsw_sp_port_stp_set(mlxsw_sp_port, false); |
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-phy.c b/drivers/net/ethernet/qualcomm/emac/emac-phy.c index 18461fcb9815..53dbf1e163a8 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac-phy.c +++ b/drivers/net/ethernet/qualcomm/emac/emac-phy.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #define MDIO_CLK_25_28 7 | 47 | #define MDIO_CLK_25_28 7 |
48 | 48 | ||
49 | #define MDIO_WAIT_TIMES 1000 | 49 | #define MDIO_WAIT_TIMES 1000 |
50 | #define MDIO_STATUS_DELAY_TIME 1 | ||
50 | 51 | ||
51 | static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum) | 52 | static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum) |
52 | { | 53 | { |
@@ -65,7 +66,7 @@ static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum) | |||
65 | 66 | ||
66 | if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, | 67 | if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, |
67 | !(reg & (MDIO_START | MDIO_BUSY)), | 68 | !(reg & (MDIO_START | MDIO_BUSY)), |
68 | 100, MDIO_WAIT_TIMES * 100)) | 69 | MDIO_STATUS_DELAY_TIME, MDIO_WAIT_TIMES * 100)) |
69 | return -EIO; | 70 | return -EIO; |
70 | 71 | ||
71 | return (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK; | 72 | return (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK; |
@@ -88,8 +89,8 @@ static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) | |||
88 | writel(reg, adpt->base + EMAC_MDIO_CTRL); | 89 | writel(reg, adpt->base + EMAC_MDIO_CTRL); |
89 | 90 | ||
90 | if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, | 91 | if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, |
91 | !(reg & (MDIO_START | MDIO_BUSY)), 100, | 92 | !(reg & (MDIO_START | MDIO_BUSY)), |
92 | MDIO_WAIT_TIMES * 100)) | 93 | MDIO_STATUS_DELAY_TIME, MDIO_WAIT_TIMES * 100)) |
93 | return -EIO; | 94 | return -EIO; |
94 | 95 | ||
95 | return 0; | 96 | return 0; |
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 2b962d349f5f..009780df664b 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c | |||
@@ -2308,32 +2308,9 @@ static int __maybe_unused ravb_resume(struct device *dev) | |||
2308 | struct ravb_private *priv = netdev_priv(ndev); | 2308 | struct ravb_private *priv = netdev_priv(ndev); |
2309 | int ret = 0; | 2309 | int ret = 0; |
2310 | 2310 | ||
2311 | if (priv->wol_enabled) { | 2311 | /* If WoL is enabled set reset mode to rearm the WoL logic */ |
2312 | /* Reduce the usecount of the clock to zero and then | 2312 | if (priv->wol_enabled) |
2313 | * restore it to its original value. This is done to force | ||
2314 | * the clock to be re-enabled which is a workaround | ||
2315 | * for renesas-cpg-mssr driver which do not enable clocks | ||
2316 | * when resuming from PSCI suspend/resume. | ||
2317 | * | ||
2318 | * Without this workaround the driver fails to communicate | ||
2319 | * with the hardware if WoL was enabled when the system | ||
2320 | * entered PSCI suspend. This is due to that if WoL is enabled | ||
2321 | * we explicitly keep the clock from being turned off when | ||
2322 | * suspending, but in PSCI sleep power is cut so the clock | ||
2323 | * is disabled anyhow, the clock driver is not aware of this | ||
2324 | * so the clock is not turned back on when resuming. | ||
2325 | * | ||
2326 | * TODO: once the renesas-cpg-mssr suspend/resume is working | ||
2327 | * this clock dance should be removed. | ||
2328 | */ | ||
2329 | clk_disable(priv->clk); | ||
2330 | clk_disable(priv->clk); | ||
2331 | clk_enable(priv->clk); | ||
2332 | clk_enable(priv->clk); | ||
2333 | |||
2334 | /* Set reset mode to rearm the WoL logic */ | ||
2335 | ravb_write(ndev, CCC_OPC_RESET, CCC); | 2313 | ravb_write(ndev, CCC_OPC_RESET, CCC); |
2336 | } | ||
2337 | 2314 | ||
2338 | /* All register have been reset to default values. | 2315 | /* All register have been reset to default values. |
2339 | * Restore all registers which where setup at probe time and | 2316 | * Restore all registers which where setup at probe time and |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index db72d13cebb9..75323000c364 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -1892,6 +1892,16 @@ static int sh_eth_phy_init(struct net_device *ndev) | |||
1892 | return PTR_ERR(phydev); | 1892 | return PTR_ERR(phydev); |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | /* mask with MAC supported features */ | ||
1896 | if (mdp->cd->register_type != SH_ETH_REG_GIGABIT) { | ||
1897 | int err = phy_set_max_speed(phydev, SPEED_100); | ||
1898 | if (err) { | ||
1899 | netdev_err(ndev, "failed to limit PHY to 100 Mbit/s\n"); | ||
1900 | phy_disconnect(phydev); | ||
1901 | return err; | ||
1902 | } | ||
1903 | } | ||
1904 | |||
1895 | phy_attached_info(phydev); | 1905 | phy_attached_info(phydev); |
1896 | 1906 | ||
1897 | return 0; | 1907 | return 0; |
diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c index 8483f03d5a41..1ab97d99b9ba 100644 --- a/drivers/net/hippi/rrunner.c +++ b/drivers/net/hippi/rrunner.c | |||
@@ -1379,8 +1379,8 @@ static int rr_close(struct net_device *dev) | |||
1379 | rrpriv->info_dma); | 1379 | rrpriv->info_dma); |
1380 | rrpriv->info = NULL; | 1380 | rrpriv->info = NULL; |
1381 | 1381 | ||
1382 | free_irq(pdev->irq, dev); | ||
1383 | spin_unlock_irqrestore(&rrpriv->lock, flags); | 1382 | spin_unlock_irqrestore(&rrpriv->lock, flags); |
1383 | free_irq(pdev->irq, dev); | ||
1384 | 1384 | ||
1385 | return 0; | 1385 | return 0; |
1386 | } | 1386 | } |
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 5f93e6add563..e911e4990b20 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c | |||
@@ -239,14 +239,10 @@ static int at803x_resume(struct phy_device *phydev) | |||
239 | { | 239 | { |
240 | int value; | 240 | int value; |
241 | 241 | ||
242 | mutex_lock(&phydev->lock); | ||
243 | |||
244 | value = phy_read(phydev, MII_BMCR); | 242 | value = phy_read(phydev, MII_BMCR); |
245 | value &= ~(BMCR_PDOWN | BMCR_ISOLATE); | 243 | value &= ~(BMCR_PDOWN | BMCR_ISOLATE); |
246 | phy_write(phydev, MII_BMCR, value); | 244 | phy_write(phydev, MII_BMCR, value); |
247 | 245 | ||
248 | mutex_unlock(&phydev->lock); | ||
249 | |||
250 | return 0; | 246 | return 0; |
251 | } | 247 | } |
252 | 248 | ||
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 4d02b27df044..b5a8f750e433 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -637,6 +637,10 @@ static int m88e1510_config_aneg(struct phy_device *phydev) | |||
637 | if (err < 0) | 637 | if (err < 0) |
638 | goto error; | 638 | goto error; |
639 | 639 | ||
640 | /* Do not touch the fiber page if we're in copper->sgmii mode */ | ||
641 | if (phydev->interface == PHY_INTERFACE_MODE_SGMII) | ||
642 | return 0; | ||
643 | |||
640 | /* Then the fiber link */ | 644 | /* Then the fiber link */ |
641 | err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); | 645 | err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); |
642 | if (err < 0) | 646 | if (err < 0) |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 2df7b62c1a36..54d00a1d2bef 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -270,6 +270,7 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus, | |||
270 | 270 | ||
271 | if (addr == mdiodev->addr) { | 271 | if (addr == mdiodev->addr) { |
272 | dev->of_node = child; | 272 | dev->of_node = child; |
273 | dev->fwnode = of_fwnode_handle(child); | ||
273 | return; | 274 | return; |
274 | } | 275 | } |
275 | } | 276 | } |
diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c index 1ea69b7585d9..842eb871a6e3 100644 --- a/drivers/net/phy/meson-gxl.c +++ b/drivers/net/phy/meson-gxl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/ethtool.h> | 22 | #include <linux/ethtool.h> |
23 | #include <linux/phy.h> | 23 | #include <linux/phy.h> |
24 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
25 | #include <linux/bitfield.h> | ||
25 | 26 | ||
26 | static int meson_gxl_config_init(struct phy_device *phydev) | 27 | static int meson_gxl_config_init(struct phy_device *phydev) |
27 | { | 28 | { |
@@ -50,6 +51,77 @@ static int meson_gxl_config_init(struct phy_device *phydev) | |||
50 | return 0; | 51 | return 0; |
51 | } | 52 | } |
52 | 53 | ||
54 | /* This function is provided to cope with the possible failures of this phy | ||
55 | * during aneg process. When aneg fails, the PHY reports that aneg is done | ||
56 | * but the value found in MII_LPA is wrong: | ||
57 | * - Early failures: MII_LPA is just 0x0001. if MII_EXPANSION reports that | ||
58 | * the link partner (LP) supports aneg but the LP never acked our base | ||
59 | * code word, it is likely that we never sent it to begin with. | ||
60 | * - Late failures: MII_LPA is filled with a value which seems to make sense | ||
61 | * but it actually is not what the LP is advertising. It seems that we | ||
62 | * can detect this using a magic bit in the WOL bank (reg 12 - bit 12). | ||
63 | * If this particular bit is not set when aneg is reported being done, | ||
64 | * it means MII_LPA is likely to be wrong. | ||
65 | * | ||
66 | * In both case, forcing a restart of the aneg process solve the problem. | ||
67 | * When this failure happens, the first retry is usually successful but, | ||
68 | * in some cases, it may take up to 6 retries to get a decent result | ||
69 | */ | ||
70 | static int meson_gxl_read_status(struct phy_device *phydev) | ||
71 | { | ||
72 | int ret, wol, lpa, exp; | ||
73 | |||
74 | if (phydev->autoneg == AUTONEG_ENABLE) { | ||
75 | ret = genphy_aneg_done(phydev); | ||
76 | if (ret < 0) | ||
77 | return ret; | ||
78 | else if (!ret) | ||
79 | goto read_status_continue; | ||
80 | |||
81 | /* Need to access WOL bank, make sure the access is open */ | ||
82 | ret = phy_write(phydev, 0x14, 0x0000); | ||
83 | if (ret) | ||
84 | return ret; | ||
85 | ret = phy_write(phydev, 0x14, 0x0400); | ||
86 | if (ret) | ||
87 | return ret; | ||
88 | ret = phy_write(phydev, 0x14, 0x0000); | ||
89 | if (ret) | ||
90 | return ret; | ||
91 | ret = phy_write(phydev, 0x14, 0x0400); | ||
92 | if (ret) | ||
93 | return ret; | ||
94 | |||
95 | /* Request LPI_STATUS WOL register */ | ||
96 | ret = phy_write(phydev, 0x14, 0x8D80); | ||
97 | if (ret) | ||
98 | return ret; | ||
99 | |||
100 | /* Read LPI_STATUS value */ | ||
101 | wol = phy_read(phydev, 0x15); | ||
102 | if (wol < 0) | ||
103 | return wol; | ||
104 | |||
105 | lpa = phy_read(phydev, MII_LPA); | ||
106 | if (lpa < 0) | ||
107 | return lpa; | ||
108 | |||
109 | exp = phy_read(phydev, MII_EXPANSION); | ||
110 | if (exp < 0) | ||
111 | return exp; | ||
112 | |||
113 | if (!(wol & BIT(12)) || | ||
114 | ((exp & EXPANSION_NWAY) && !(lpa & LPA_LPACK))) { | ||
115 | /* Looks like aneg failed after all */ | ||
116 | phydev_dbg(phydev, "LPA corruption - aneg restart\n"); | ||
117 | return genphy_restart_aneg(phydev); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | read_status_continue: | ||
122 | return genphy_read_status(phydev); | ||
123 | } | ||
124 | |||
53 | static struct phy_driver meson_gxl_phy[] = { | 125 | static struct phy_driver meson_gxl_phy[] = { |
54 | { | 126 | { |
55 | .phy_id = 0x01814400, | 127 | .phy_id = 0x01814400, |
@@ -60,7 +132,7 @@ static struct phy_driver meson_gxl_phy[] = { | |||
60 | .config_init = meson_gxl_config_init, | 132 | .config_init = meson_gxl_config_init, |
61 | .config_aneg = genphy_config_aneg, | 133 | .config_aneg = genphy_config_aneg, |
62 | .aneg_done = genphy_aneg_done, | 134 | .aneg_done = genphy_aneg_done, |
63 | .read_status = genphy_read_status, | 135 | .read_status = meson_gxl_read_status, |
64 | .suspend = genphy_suspend, | 136 | .suspend = genphy_suspend, |
65 | .resume = genphy_resume, | 137 | .resume = genphy_resume, |
66 | }, | 138 | }, |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 2b1e67bc1e73..ed10d1fc8f59 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -828,7 +828,6 @@ EXPORT_SYMBOL(phy_stop); | |||
828 | */ | 828 | */ |
829 | void phy_start(struct phy_device *phydev) | 829 | void phy_start(struct phy_device *phydev) |
830 | { | 830 | { |
831 | bool do_resume = false; | ||
832 | int err = 0; | 831 | int err = 0; |
833 | 832 | ||
834 | mutex_lock(&phydev->lock); | 833 | mutex_lock(&phydev->lock); |
@@ -841,6 +840,9 @@ void phy_start(struct phy_device *phydev) | |||
841 | phydev->state = PHY_UP; | 840 | phydev->state = PHY_UP; |
842 | break; | 841 | break; |
843 | case PHY_HALTED: | 842 | case PHY_HALTED: |
843 | /* if phy was suspended, bring the physical link up again */ | ||
844 | phy_resume(phydev); | ||
845 | |||
844 | /* make sure interrupts are re-enabled for the PHY */ | 846 | /* make sure interrupts are re-enabled for the PHY */ |
845 | if (phydev->irq != PHY_POLL) { | 847 | if (phydev->irq != PHY_POLL) { |
846 | err = phy_enable_interrupts(phydev); | 848 | err = phy_enable_interrupts(phydev); |
@@ -849,17 +851,12 @@ void phy_start(struct phy_device *phydev) | |||
849 | } | 851 | } |
850 | 852 | ||
851 | phydev->state = PHY_RESUMING; | 853 | phydev->state = PHY_RESUMING; |
852 | do_resume = true; | ||
853 | break; | 854 | break; |
854 | default: | 855 | default: |
855 | break; | 856 | break; |
856 | } | 857 | } |
857 | mutex_unlock(&phydev->lock); | 858 | mutex_unlock(&phydev->lock); |
858 | 859 | ||
859 | /* if phy was suspended, bring the physical link up again */ | ||
860 | if (do_resume) | ||
861 | phy_resume(phydev); | ||
862 | |||
863 | phy_trigger_machine(phydev, true); | 860 | phy_trigger_machine(phydev, true); |
864 | } | 861 | } |
865 | EXPORT_SYMBOL(phy_start); | 862 | EXPORT_SYMBOL(phy_start); |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 67f25ac29025..b15b31ca2618 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -135,7 +135,9 @@ static int mdio_bus_phy_resume(struct device *dev) | |||
135 | if (!mdio_bus_phy_may_suspend(phydev)) | 135 | if (!mdio_bus_phy_may_suspend(phydev)) |
136 | goto no_resume; | 136 | goto no_resume; |
137 | 137 | ||
138 | mutex_lock(&phydev->lock); | ||
138 | ret = phy_resume(phydev); | 139 | ret = phy_resume(phydev); |
140 | mutex_unlock(&phydev->lock); | ||
139 | if (ret < 0) | 141 | if (ret < 0) |
140 | return ret; | 142 | return ret; |
141 | 143 | ||
@@ -1026,7 +1028,9 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
1026 | if (err) | 1028 | if (err) |
1027 | goto error; | 1029 | goto error; |
1028 | 1030 | ||
1031 | mutex_lock(&phydev->lock); | ||
1029 | phy_resume(phydev); | 1032 | phy_resume(phydev); |
1033 | mutex_unlock(&phydev->lock); | ||
1030 | phy_led_triggers_register(phydev); | 1034 | phy_led_triggers_register(phydev); |
1031 | 1035 | ||
1032 | return err; | 1036 | return err; |
@@ -1157,6 +1161,8 @@ int phy_resume(struct phy_device *phydev) | |||
1157 | struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver); | 1161 | struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver); |
1158 | int ret = 0; | 1162 | int ret = 0; |
1159 | 1163 | ||
1164 | WARN_ON(!mutex_is_locked(&phydev->lock)); | ||
1165 | |||
1160 | if (phydev->drv && phydrv->resume) | 1166 | if (phydev->drv && phydrv->resume) |
1161 | ret = phydrv->resume(phydev); | 1167 | ret = phydrv->resume(phydev); |
1162 | 1168 | ||
@@ -1639,13 +1645,9 @@ int genphy_resume(struct phy_device *phydev) | |||
1639 | { | 1645 | { |
1640 | int value; | 1646 | int value; |
1641 | 1647 | ||
1642 | mutex_lock(&phydev->lock); | ||
1643 | |||
1644 | value = phy_read(phydev, MII_BMCR); | 1648 | value = phy_read(phydev, MII_BMCR); |
1645 | phy_write(phydev, MII_BMCR, value & ~BMCR_PDOWN); | 1649 | phy_write(phydev, MII_BMCR, value & ~BMCR_PDOWN); |
1646 | 1650 | ||
1647 | mutex_unlock(&phydev->lock); | ||
1648 | |||
1649 | return 0; | 1651 | return 0; |
1650 | } | 1652 | } |
1651 | EXPORT_SYMBOL(genphy_resume); | 1653 | EXPORT_SYMBOL(genphy_resume); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 304ec6555cd8..3000ddd1c7e2 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -1204,12 +1204,14 @@ static const struct usb_device_id products[] = { | |||
1204 | {QMI_FIXED_INTF(0x1199, 0x9079, 10)}, /* Sierra Wireless EM74xx */ | 1204 | {QMI_FIXED_INTF(0x1199, 0x9079, 10)}, /* Sierra Wireless EM74xx */ |
1205 | {QMI_FIXED_INTF(0x1199, 0x907b, 8)}, /* Sierra Wireless EM74xx */ | 1205 | {QMI_FIXED_INTF(0x1199, 0x907b, 8)}, /* Sierra Wireless EM74xx */ |
1206 | {QMI_FIXED_INTF(0x1199, 0x907b, 10)}, /* Sierra Wireless EM74xx */ | 1206 | {QMI_FIXED_INTF(0x1199, 0x907b, 10)}, /* Sierra Wireless EM74xx */ |
1207 | {QMI_FIXED_INTF(0x1199, 0x9091, 8)}, /* Sierra Wireless EM7565 */ | ||
1207 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ | 1208 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
1208 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ | 1209 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ |
1209 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 1210 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
1210 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ | 1211 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ |
1211 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ | 1212 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ |
1212 | {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ | 1213 | {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ |
1214 | {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ | ||
1213 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | 1215 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
1214 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ | 1216 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ |
1215 | {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */ | 1217 | {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */ |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 98258583abb0..3481e69738b5 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -81,6 +81,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, | |||
81 | * can be looked up later */ | 81 | * can be looked up later */ |
82 | of_node_get(child); | 82 | of_node_get(child); |
83 | phy->mdio.dev.of_node = child; | 83 | phy->mdio.dev.of_node = child; |
84 | phy->mdio.dev.fwnode = of_fwnode_handle(child); | ||
84 | 85 | ||
85 | /* All data is now stored in the phy struct; | 86 | /* All data is now stored in the phy struct; |
86 | * register it */ | 87 | * register it */ |
@@ -111,6 +112,7 @@ static int of_mdiobus_register_device(struct mii_bus *mdio, | |||
111 | */ | 112 | */ |
112 | of_node_get(child); | 113 | of_node_get(child); |
113 | mdiodev->dev.of_node = child; | 114 | mdiodev->dev.of_node = child; |
115 | mdiodev->dev.fwnode = of_fwnode_handle(child); | ||
114 | 116 | ||
115 | /* All data is now stored in the mdiodev struct; register it. */ | 117 | /* All data is now stored in the mdiodev struct; register it. */ |
116 | rc = mdio_device_register(mdiodev); | 118 | rc = mdio_device_register(mdiodev); |
@@ -206,6 +208,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
206 | mdio->phy_mask = ~0; | 208 | mdio->phy_mask = ~0; |
207 | 209 | ||
208 | mdio->dev.of_node = np; | 210 | mdio->dev.of_node = np; |
211 | mdio->dev.fwnode = of_fwnode_handle(np); | ||
209 | 212 | ||
210 | /* Get bus level PHY reset GPIO details */ | 213 | /* Get bus level PHY reset GPIO details */ |
211 | mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY; | 214 | mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY; |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 15015a24f8ad..badf42acbf95 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -565,9 +565,9 @@ enum qeth_cq { | |||
565 | }; | 565 | }; |
566 | 566 | ||
567 | struct qeth_ipato { | 567 | struct qeth_ipato { |
568 | int enabled; | 568 | bool enabled; |
569 | int invert4; | 569 | bool invert4; |
570 | int invert6; | 570 | bool invert6; |
571 | struct list_head entries; | 571 | struct list_head entries; |
572 | }; | 572 | }; |
573 | 573 | ||
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 430e3214f7e2..6c815207f4f5 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -1480,9 +1480,9 @@ static int qeth_setup_card(struct qeth_card *card) | |||
1480 | qeth_set_intial_options(card); | 1480 | qeth_set_intial_options(card); |
1481 | /* IP address takeover */ | 1481 | /* IP address takeover */ |
1482 | INIT_LIST_HEAD(&card->ipato.entries); | 1482 | INIT_LIST_HEAD(&card->ipato.entries); |
1483 | card->ipato.enabled = 0; | 1483 | card->ipato.enabled = false; |
1484 | card->ipato.invert4 = 0; | 1484 | card->ipato.invert4 = false; |
1485 | card->ipato.invert6 = 0; | 1485 | card->ipato.invert6 = false; |
1486 | /* init QDIO stuff */ | 1486 | /* init QDIO stuff */ |
1487 | qeth_init_qdio_info(card); | 1487 | qeth_init_qdio_info(card); |
1488 | INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work); | 1488 | INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work); |
diff --git a/drivers/s390/net/qeth_l3.h b/drivers/s390/net/qeth_l3.h index 194ae9b577cc..e5833837b799 100644 --- a/drivers/s390/net/qeth_l3.h +++ b/drivers/s390/net/qeth_l3.h | |||
@@ -82,7 +82,7 @@ void qeth_l3_del_vipa(struct qeth_card *, enum qeth_prot_versions, const u8 *); | |||
82 | int qeth_l3_add_rxip(struct qeth_card *, enum qeth_prot_versions, const u8 *); | 82 | int qeth_l3_add_rxip(struct qeth_card *, enum qeth_prot_versions, const u8 *); |
83 | void qeth_l3_del_rxip(struct qeth_card *card, enum qeth_prot_versions, | 83 | void qeth_l3_del_rxip(struct qeth_card *card, enum qeth_prot_versions, |
84 | const u8 *); | 84 | const u8 *); |
85 | int qeth_l3_is_addr_covered_by_ipato(struct qeth_card *, struct qeth_ipaddr *); | 85 | void qeth_l3_update_ipato(struct qeth_card *card); |
86 | struct qeth_ipaddr *qeth_l3_get_addr_buffer(enum qeth_prot_versions); | 86 | struct qeth_ipaddr *qeth_l3_get_addr_buffer(enum qeth_prot_versions); |
87 | int qeth_l3_add_ip(struct qeth_card *, struct qeth_ipaddr *); | 87 | int qeth_l3_add_ip(struct qeth_card *, struct qeth_ipaddr *); |
88 | int qeth_l3_delete_ip(struct qeth_card *, struct qeth_ipaddr *); | 88 | int qeth_l3_delete_ip(struct qeth_card *, struct qeth_ipaddr *); |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 6a73894b0cb5..ef0961e18686 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -164,8 +164,8 @@ static void qeth_l3_convert_addr_to_bits(u8 *addr, u8 *bits, int len) | |||
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | int qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, | 167 | static bool qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, |
168 | struct qeth_ipaddr *addr) | 168 | struct qeth_ipaddr *addr) |
169 | { | 169 | { |
170 | struct qeth_ipato_entry *ipatoe; | 170 | struct qeth_ipato_entry *ipatoe; |
171 | u8 addr_bits[128] = {0, }; | 171 | u8 addr_bits[128] = {0, }; |
@@ -174,6 +174,8 @@ int qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, | |||
174 | 174 | ||
175 | if (!card->ipato.enabled) | 175 | if (!card->ipato.enabled) |
176 | return 0; | 176 | return 0; |
177 | if (addr->type != QETH_IP_TYPE_NORMAL) | ||
178 | return 0; | ||
177 | 179 | ||
178 | qeth_l3_convert_addr_to_bits((u8 *) &addr->u, addr_bits, | 180 | qeth_l3_convert_addr_to_bits((u8 *) &addr->u, addr_bits, |
179 | (addr->proto == QETH_PROT_IPV4)? 4:16); | 181 | (addr->proto == QETH_PROT_IPV4)? 4:16); |
@@ -290,8 +292,7 @@ int qeth_l3_add_ip(struct qeth_card *card, struct qeth_ipaddr *tmp_addr) | |||
290 | memcpy(addr, tmp_addr, sizeof(struct qeth_ipaddr)); | 292 | memcpy(addr, tmp_addr, sizeof(struct qeth_ipaddr)); |
291 | addr->ref_counter = 1; | 293 | addr->ref_counter = 1; |
292 | 294 | ||
293 | if (addr->type == QETH_IP_TYPE_NORMAL && | 295 | if (qeth_l3_is_addr_covered_by_ipato(card, addr)) { |
294 | qeth_l3_is_addr_covered_by_ipato(card, addr)) { | ||
295 | QETH_CARD_TEXT(card, 2, "tkovaddr"); | 296 | QETH_CARD_TEXT(card, 2, "tkovaddr"); |
296 | addr->set_flags |= QETH_IPA_SETIP_TAKEOVER_FLAG; | 297 | addr->set_flags |= QETH_IPA_SETIP_TAKEOVER_FLAG; |
297 | } | 298 | } |
@@ -605,6 +606,27 @@ int qeth_l3_setrouting_v6(struct qeth_card *card) | |||
605 | /* | 606 | /* |
606 | * IP address takeover related functions | 607 | * IP address takeover related functions |
607 | */ | 608 | */ |
609 | |||
610 | /** | ||
611 | * qeth_l3_update_ipato() - Update 'takeover' property, for all NORMAL IPs. | ||
612 | * | ||
613 | * Caller must hold ip_lock. | ||
614 | */ | ||
615 | void qeth_l3_update_ipato(struct qeth_card *card) | ||
616 | { | ||
617 | struct qeth_ipaddr *addr; | ||
618 | unsigned int i; | ||
619 | |||
620 | hash_for_each(card->ip_htable, i, addr, hnode) { | ||
621 | if (addr->type != QETH_IP_TYPE_NORMAL) | ||
622 | continue; | ||
623 | if (qeth_l3_is_addr_covered_by_ipato(card, addr)) | ||
624 | addr->set_flags |= QETH_IPA_SETIP_TAKEOVER_FLAG; | ||
625 | else | ||
626 | addr->set_flags &= ~QETH_IPA_SETIP_TAKEOVER_FLAG; | ||
627 | } | ||
628 | } | ||
629 | |||
608 | static void qeth_l3_clear_ipato_list(struct qeth_card *card) | 630 | static void qeth_l3_clear_ipato_list(struct qeth_card *card) |
609 | { | 631 | { |
610 | struct qeth_ipato_entry *ipatoe, *tmp; | 632 | struct qeth_ipato_entry *ipatoe, *tmp; |
@@ -616,6 +638,7 @@ static void qeth_l3_clear_ipato_list(struct qeth_card *card) | |||
616 | kfree(ipatoe); | 638 | kfree(ipatoe); |
617 | } | 639 | } |
618 | 640 | ||
641 | qeth_l3_update_ipato(card); | ||
619 | spin_unlock_bh(&card->ip_lock); | 642 | spin_unlock_bh(&card->ip_lock); |
620 | } | 643 | } |
621 | 644 | ||
@@ -640,8 +663,10 @@ int qeth_l3_add_ipato_entry(struct qeth_card *card, | |||
640 | } | 663 | } |
641 | } | 664 | } |
642 | 665 | ||
643 | if (!rc) | 666 | if (!rc) { |
644 | list_add_tail(&new->entry, &card->ipato.entries); | 667 | list_add_tail(&new->entry, &card->ipato.entries); |
668 | qeth_l3_update_ipato(card); | ||
669 | } | ||
645 | 670 | ||
646 | spin_unlock_bh(&card->ip_lock); | 671 | spin_unlock_bh(&card->ip_lock); |
647 | 672 | ||
@@ -664,6 +689,7 @@ void qeth_l3_del_ipato_entry(struct qeth_card *card, | |||
664 | (proto == QETH_PROT_IPV4)? 4:16) && | 689 | (proto == QETH_PROT_IPV4)? 4:16) && |
665 | (ipatoe->mask_bits == mask_bits)) { | 690 | (ipatoe->mask_bits == mask_bits)) { |
666 | list_del(&ipatoe->entry); | 691 | list_del(&ipatoe->entry); |
692 | qeth_l3_update_ipato(card); | ||
667 | kfree(ipatoe); | 693 | kfree(ipatoe); |
668 | } | 694 | } |
669 | } | 695 | } |
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c index bd12fdf678be..6ea2b528a64e 100644 --- a/drivers/s390/net/qeth_l3_sys.c +++ b/drivers/s390/net/qeth_l3_sys.c | |||
@@ -370,8 +370,8 @@ static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev, | |||
370 | struct device_attribute *attr, const char *buf, size_t count) | 370 | struct device_attribute *attr, const char *buf, size_t count) |
371 | { | 371 | { |
372 | struct qeth_card *card = dev_get_drvdata(dev); | 372 | struct qeth_card *card = dev_get_drvdata(dev); |
373 | struct qeth_ipaddr *addr; | 373 | bool enable; |
374 | int i, rc = 0; | 374 | int rc = 0; |
375 | 375 | ||
376 | if (!card) | 376 | if (!card) |
377 | return -EINVAL; | 377 | return -EINVAL; |
@@ -384,25 +384,18 @@ static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev, | |||
384 | } | 384 | } |
385 | 385 | ||
386 | if (sysfs_streq(buf, "toggle")) { | 386 | if (sysfs_streq(buf, "toggle")) { |
387 | card->ipato.enabled = (card->ipato.enabled)? 0 : 1; | 387 | enable = !card->ipato.enabled; |
388 | } else if (sysfs_streq(buf, "1")) { | 388 | } else if (kstrtobool(buf, &enable)) { |
389 | card->ipato.enabled = 1; | ||
390 | hash_for_each(card->ip_htable, i, addr, hnode) { | ||
391 | if ((addr->type == QETH_IP_TYPE_NORMAL) && | ||
392 | qeth_l3_is_addr_covered_by_ipato(card, addr)) | ||
393 | addr->set_flags |= | ||
394 | QETH_IPA_SETIP_TAKEOVER_FLAG; | ||
395 | } | ||
396 | } else if (sysfs_streq(buf, "0")) { | ||
397 | card->ipato.enabled = 0; | ||
398 | hash_for_each(card->ip_htable, i, addr, hnode) { | ||
399 | if (addr->set_flags & | ||
400 | QETH_IPA_SETIP_TAKEOVER_FLAG) | ||
401 | addr->set_flags &= | ||
402 | ~QETH_IPA_SETIP_TAKEOVER_FLAG; | ||
403 | } | ||
404 | } else | ||
405 | rc = -EINVAL; | 389 | rc = -EINVAL; |
390 | goto out; | ||
391 | } | ||
392 | |||
393 | if (card->ipato.enabled != enable) { | ||
394 | card->ipato.enabled = enable; | ||
395 | spin_lock_bh(&card->ip_lock); | ||
396 | qeth_l3_update_ipato(card); | ||
397 | spin_unlock_bh(&card->ip_lock); | ||
398 | } | ||
406 | out: | 399 | out: |
407 | mutex_unlock(&card->conf_mutex); | 400 | mutex_unlock(&card->conf_mutex); |
408 | return rc ? rc : count; | 401 | return rc ? rc : count; |
@@ -428,20 +421,27 @@ static ssize_t qeth_l3_dev_ipato_invert4_store(struct device *dev, | |||
428 | const char *buf, size_t count) | 421 | const char *buf, size_t count) |
429 | { | 422 | { |
430 | struct qeth_card *card = dev_get_drvdata(dev); | 423 | struct qeth_card *card = dev_get_drvdata(dev); |
424 | bool invert; | ||
431 | int rc = 0; | 425 | int rc = 0; |
432 | 426 | ||
433 | if (!card) | 427 | if (!card) |
434 | return -EINVAL; | 428 | return -EINVAL; |
435 | 429 | ||
436 | mutex_lock(&card->conf_mutex); | 430 | mutex_lock(&card->conf_mutex); |
437 | if (sysfs_streq(buf, "toggle")) | 431 | if (sysfs_streq(buf, "toggle")) { |
438 | card->ipato.invert4 = (card->ipato.invert4)? 0 : 1; | 432 | invert = !card->ipato.invert4; |
439 | else if (sysfs_streq(buf, "1")) | 433 | } else if (kstrtobool(buf, &invert)) { |
440 | card->ipato.invert4 = 1; | ||
441 | else if (sysfs_streq(buf, "0")) | ||
442 | card->ipato.invert4 = 0; | ||
443 | else | ||
444 | rc = -EINVAL; | 434 | rc = -EINVAL; |
435 | goto out; | ||
436 | } | ||
437 | |||
438 | if (card->ipato.invert4 != invert) { | ||
439 | card->ipato.invert4 = invert; | ||
440 | spin_lock_bh(&card->ip_lock); | ||
441 | qeth_l3_update_ipato(card); | ||
442 | spin_unlock_bh(&card->ip_lock); | ||
443 | } | ||
444 | out: | ||
445 | mutex_unlock(&card->conf_mutex); | 445 | mutex_unlock(&card->conf_mutex); |
446 | return rc ? rc : count; | 446 | return rc ? rc : count; |
447 | } | 447 | } |
@@ -607,20 +607,27 @@ static ssize_t qeth_l3_dev_ipato_invert6_store(struct device *dev, | |||
607 | struct device_attribute *attr, const char *buf, size_t count) | 607 | struct device_attribute *attr, const char *buf, size_t count) |
608 | { | 608 | { |
609 | struct qeth_card *card = dev_get_drvdata(dev); | 609 | struct qeth_card *card = dev_get_drvdata(dev); |
610 | bool invert; | ||
610 | int rc = 0; | 611 | int rc = 0; |
611 | 612 | ||
612 | if (!card) | 613 | if (!card) |
613 | return -EINVAL; | 614 | return -EINVAL; |
614 | 615 | ||
615 | mutex_lock(&card->conf_mutex); | 616 | mutex_lock(&card->conf_mutex); |
616 | if (sysfs_streq(buf, "toggle")) | 617 | if (sysfs_streq(buf, "toggle")) { |
617 | card->ipato.invert6 = (card->ipato.invert6)? 0 : 1; | 618 | invert = !card->ipato.invert6; |
618 | else if (sysfs_streq(buf, "1")) | 619 | } else if (kstrtobool(buf, &invert)) { |
619 | card->ipato.invert6 = 1; | ||
620 | else if (sysfs_streq(buf, "0")) | ||
621 | card->ipato.invert6 = 0; | ||
622 | else | ||
623 | rc = -EINVAL; | 620 | rc = -EINVAL; |
621 | goto out; | ||
622 | } | ||
623 | |||
624 | if (card->ipato.invert6 != invert) { | ||
625 | card->ipato.invert6 = invert; | ||
626 | spin_lock_bh(&card->ip_lock); | ||
627 | qeth_l3_update_ipato(card); | ||
628 | spin_unlock_bh(&card->ip_lock); | ||
629 | } | ||
630 | out: | ||
624 | mutex_unlock(&card->conf_mutex); | 631 | mutex_unlock(&card->conf_mutex); |
625 | return rc ? rc : count; | 632 | return rc ? rc : count; |
626 | } | 633 | } |
diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h index 37b4bb2545b3..6866df4f31b5 100644 --- a/include/linux/ptr_ring.h +++ b/include/linux/ptr_ring.h | |||
@@ -101,12 +101,18 @@ static inline bool ptr_ring_full_bh(struct ptr_ring *r) | |||
101 | 101 | ||
102 | /* Note: callers invoking this in a loop must use a compiler barrier, | 102 | /* Note: callers invoking this in a loop must use a compiler barrier, |
103 | * for example cpu_relax(). Callers must hold producer_lock. | 103 | * for example cpu_relax(). Callers must hold producer_lock. |
104 | * Callers are responsible for making sure pointer that is being queued | ||
105 | * points to a valid data. | ||
104 | */ | 106 | */ |
105 | static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr) | 107 | static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr) |
106 | { | 108 | { |
107 | if (unlikely(!r->size) || r->queue[r->producer]) | 109 | if (unlikely(!r->size) || r->queue[r->producer]) |
108 | return -ENOSPC; | 110 | return -ENOSPC; |
109 | 111 | ||
112 | /* Make sure the pointer we are storing points to a valid data. */ | ||
113 | /* Pairs with smp_read_barrier_depends in __ptr_ring_consume. */ | ||
114 | smp_wmb(); | ||
115 | |||
110 | r->queue[r->producer++] = ptr; | 116 | r->queue[r->producer++] = ptr; |
111 | if (unlikely(r->producer >= r->size)) | 117 | if (unlikely(r->producer >= r->size)) |
112 | r->producer = 0; | 118 | r->producer = 0; |
@@ -275,6 +281,9 @@ static inline void *__ptr_ring_consume(struct ptr_ring *r) | |||
275 | if (ptr) | 281 | if (ptr) |
276 | __ptr_ring_discard_one(r); | 282 | __ptr_ring_discard_one(r); |
277 | 283 | ||
284 | /* Make sure anyone accessing data through the pointer is up to date. */ | ||
285 | /* Pairs with smp_wmb in __ptr_ring_produce. */ | ||
286 | smp_read_barrier_depends(); | ||
278 | return ptr; | 287 | return ptr; |
279 | } | 288 | } |
280 | 289 | ||
diff --git a/include/net/gue.h b/include/net/gue.h index 2fdb29ca74c2..fdad41469b65 100644 --- a/include/net/gue.h +++ b/include/net/gue.h | |||
@@ -44,10 +44,10 @@ struct guehdr { | |||
44 | #else | 44 | #else |
45 | #error "Please fix <asm/byteorder.h>" | 45 | #error "Please fix <asm/byteorder.h>" |
46 | #endif | 46 | #endif |
47 | __u8 proto_ctype; | 47 | __u8 proto_ctype; |
48 | __u16 flags; | 48 | __be16 flags; |
49 | }; | 49 | }; |
50 | __u32 word; | 50 | __be32 word; |
51 | }; | 51 | }; |
52 | }; | 52 | }; |
53 | 53 | ||
@@ -84,11 +84,10 @@ static inline size_t guehdr_priv_flags_len(__be32 flags) | |||
84 | * if there is an unknown standard or private flags, or the options length for | 84 | * if there is an unknown standard or private flags, or the options length for |
85 | * the flags exceeds the options length specific in hlen of the GUE header. | 85 | * the flags exceeds the options length specific in hlen of the GUE header. |
86 | */ | 86 | */ |
87 | static inline int validate_gue_flags(struct guehdr *guehdr, | 87 | static inline int validate_gue_flags(struct guehdr *guehdr, size_t optlen) |
88 | size_t optlen) | ||
89 | { | 88 | { |
89 | __be16 flags = guehdr->flags; | ||
90 | size_t len; | 90 | size_t len; |
91 | __be32 flags = guehdr->flags; | ||
92 | 91 | ||
93 | if (flags & ~GUE_FLAGS_ALL) | 92 | if (flags & ~GUE_FLAGS_ALL) |
94 | return 1; | 93 | return 1; |
@@ -101,12 +100,13 @@ static inline int validate_gue_flags(struct guehdr *guehdr, | |||
101 | /* Private flags are last four bytes accounted in | 100 | /* Private flags are last four bytes accounted in |
102 | * guehdr_flags_len | 101 | * guehdr_flags_len |
103 | */ | 102 | */ |
104 | flags = *(__be32 *)((void *)&guehdr[1] + len - GUE_LEN_PRIV); | 103 | __be32 pflags = *(__be32 *)((void *)&guehdr[1] + |
104 | len - GUE_LEN_PRIV); | ||
105 | 105 | ||
106 | if (flags & ~GUE_PFLAGS_ALL) | 106 | if (pflags & ~GUE_PFLAGS_ALL) |
107 | return 1; | 107 | return 1; |
108 | 108 | ||
109 | len += guehdr_priv_flags_len(flags); | 109 | len += guehdr_priv_flags_len(pflags); |
110 | if (len > optlen) | 110 | if (len > optlen) |
111 | return 1; | 111 | return 1; |
112 | } | 112 | } |
diff --git a/include/net/ip.h b/include/net/ip.h index 9896f46cbbf1..af8addbaa3c1 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <net/flow_dissector.h> | 34 | #include <net/flow_dissector.h> |
35 | 35 | ||
36 | #define IPV4_MAX_PMTU 65535U /* RFC 2675, Section 5.1 */ | 36 | #define IPV4_MAX_PMTU 65535U /* RFC 2675, Section 5.1 */ |
37 | #define IPV4_MIN_MTU 68 /* RFC 791 */ | ||
37 | 38 | ||
38 | struct sock; | 39 | struct sock; |
39 | 40 | ||
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 65d0d25f2648..83a3e47d5845 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -71,6 +71,7 @@ struct Qdisc { | |||
71 | * qdisc_tree_decrease_qlen() should stop. | 71 | * qdisc_tree_decrease_qlen() should stop. |
72 | */ | 72 | */ |
73 | #define TCQ_F_INVISIBLE 0x80 /* invisible by default in dump */ | 73 | #define TCQ_F_INVISIBLE 0x80 /* invisible by default in dump */ |
74 | #define TCQ_F_OFFLOADED 0x200 /* qdisc is offloaded to HW */ | ||
74 | u32 limit; | 75 | u32 limit; |
75 | const struct Qdisc_ops *ops; | 76 | const struct Qdisc_ops *ops; |
76 | struct qdisc_size_table __rcu *stab; | 77 | struct qdisc_size_table __rcu *stab; |
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index af3cc2f4e1ad..37b5096ae97b 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h | |||
@@ -256,7 +256,6 @@ struct tc_red_qopt { | |||
256 | #define TC_RED_ECN 1 | 256 | #define TC_RED_ECN 1 |
257 | #define TC_RED_HARDDROP 2 | 257 | #define TC_RED_HARDDROP 2 |
258 | #define TC_RED_ADAPTATIVE 4 | 258 | #define TC_RED_ADAPTATIVE 4 |
259 | #define TC_RED_OFFLOADED 8 | ||
260 | }; | 259 | }; |
261 | 260 | ||
262 | struct tc_red_xstats { | 261 | struct tc_red_xstats { |
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index d8b5f80c2ea6..843e29aa3cac 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h | |||
@@ -557,6 +557,7 @@ enum { | |||
557 | TCA_PAD, | 557 | TCA_PAD, |
558 | TCA_DUMP_INVISIBLE, | 558 | TCA_DUMP_INVISIBLE, |
559 | TCA_CHAIN, | 559 | TCA_CHAIN, |
560 | TCA_HW_OFFLOAD, | ||
560 | __TCA_MAX | 561 | __TCA_MAX |
561 | }; | 562 | }; |
562 | 563 | ||
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index e469e05c8e83..3905d4bc5b80 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c | |||
@@ -114,6 +114,7 @@ static void htab_free_elems(struct bpf_htab *htab) | |||
114 | pptr = htab_elem_get_ptr(get_htab_elem(htab, i), | 114 | pptr = htab_elem_get_ptr(get_htab_elem(htab, i), |
115 | htab->map.key_size); | 115 | htab->map.key_size); |
116 | free_percpu(pptr); | 116 | free_percpu(pptr); |
117 | cond_resched(); | ||
117 | } | 118 | } |
118 | free_elems: | 119 | free_elems: |
119 | bpf_map_area_free(htab->elems); | 120 | bpf_map_area_free(htab->elems); |
@@ -159,6 +160,7 @@ static int prealloc_init(struct bpf_htab *htab) | |||
159 | goto free_elems; | 160 | goto free_elems; |
160 | htab_elem_set_ptr(get_htab_elem(htab, i), htab->map.key_size, | 161 | htab_elem_set_ptr(get_htab_elem(htab, i), htab->map.key_size, |
161 | pptr); | 162 | pptr); |
163 | cond_resched(); | ||
162 | } | 164 | } |
163 | 165 | ||
164 | skip_percpu_elems: | 166 | skip_percpu_elems: |
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 0ce99c379c30..40207c2a4113 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c | |||
@@ -343,14 +343,13 @@ static const struct bpf_func_proto bpf_perf_event_read_value_proto = { | |||
343 | .arg4_type = ARG_CONST_SIZE, | 343 | .arg4_type = ARG_CONST_SIZE, |
344 | }; | 344 | }; |
345 | 345 | ||
346 | static DEFINE_PER_CPU(struct perf_sample_data, bpf_sd); | 346 | static DEFINE_PER_CPU(struct perf_sample_data, bpf_trace_sd); |
347 | 347 | ||
348 | static __always_inline u64 | 348 | static __always_inline u64 |
349 | __bpf_perf_event_output(struct pt_regs *regs, struct bpf_map *map, | 349 | __bpf_perf_event_output(struct pt_regs *regs, struct bpf_map *map, |
350 | u64 flags, struct perf_raw_record *raw) | 350 | u64 flags, struct perf_sample_data *sd) |
351 | { | 351 | { |
352 | struct bpf_array *array = container_of(map, struct bpf_array, map); | 352 | struct bpf_array *array = container_of(map, struct bpf_array, map); |
353 | struct perf_sample_data *sd = this_cpu_ptr(&bpf_sd); | ||
354 | unsigned int cpu = smp_processor_id(); | 353 | unsigned int cpu = smp_processor_id(); |
355 | u64 index = flags & BPF_F_INDEX_MASK; | 354 | u64 index = flags & BPF_F_INDEX_MASK; |
356 | struct bpf_event_entry *ee; | 355 | struct bpf_event_entry *ee; |
@@ -373,8 +372,6 @@ __bpf_perf_event_output(struct pt_regs *regs, struct bpf_map *map, | |||
373 | if (unlikely(event->oncpu != cpu)) | 372 | if (unlikely(event->oncpu != cpu)) |
374 | return -EOPNOTSUPP; | 373 | return -EOPNOTSUPP; |
375 | 374 | ||
376 | perf_sample_data_init(sd, 0, 0); | ||
377 | sd->raw = raw; | ||
378 | perf_event_output(event, sd, regs); | 375 | perf_event_output(event, sd, regs); |
379 | return 0; | 376 | return 0; |
380 | } | 377 | } |
@@ -382,6 +379,7 @@ __bpf_perf_event_output(struct pt_regs *regs, struct bpf_map *map, | |||
382 | BPF_CALL_5(bpf_perf_event_output, struct pt_regs *, regs, struct bpf_map *, map, | 379 | BPF_CALL_5(bpf_perf_event_output, struct pt_regs *, regs, struct bpf_map *, map, |
383 | u64, flags, void *, data, u64, size) | 380 | u64, flags, void *, data, u64, size) |
384 | { | 381 | { |
382 | struct perf_sample_data *sd = this_cpu_ptr(&bpf_trace_sd); | ||
385 | struct perf_raw_record raw = { | 383 | struct perf_raw_record raw = { |
386 | .frag = { | 384 | .frag = { |
387 | .size = size, | 385 | .size = size, |
@@ -392,7 +390,10 @@ BPF_CALL_5(bpf_perf_event_output, struct pt_regs *, regs, struct bpf_map *, map, | |||
392 | if (unlikely(flags & ~(BPF_F_INDEX_MASK))) | 390 | if (unlikely(flags & ~(BPF_F_INDEX_MASK))) |
393 | return -EINVAL; | 391 | return -EINVAL; |
394 | 392 | ||
395 | return __bpf_perf_event_output(regs, map, flags, &raw); | 393 | perf_sample_data_init(sd, 0, 0); |
394 | sd->raw = &raw; | ||
395 | |||
396 | return __bpf_perf_event_output(regs, map, flags, sd); | ||
396 | } | 397 | } |
397 | 398 | ||
398 | static const struct bpf_func_proto bpf_perf_event_output_proto = { | 399 | static const struct bpf_func_proto bpf_perf_event_output_proto = { |
@@ -407,10 +408,12 @@ static const struct bpf_func_proto bpf_perf_event_output_proto = { | |||
407 | }; | 408 | }; |
408 | 409 | ||
409 | static DEFINE_PER_CPU(struct pt_regs, bpf_pt_regs); | 410 | static DEFINE_PER_CPU(struct pt_regs, bpf_pt_regs); |
411 | static DEFINE_PER_CPU(struct perf_sample_data, bpf_misc_sd); | ||
410 | 412 | ||
411 | u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, | 413 | u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, |
412 | void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy) | 414 | void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy) |
413 | { | 415 | { |
416 | struct perf_sample_data *sd = this_cpu_ptr(&bpf_misc_sd); | ||
414 | struct pt_regs *regs = this_cpu_ptr(&bpf_pt_regs); | 417 | struct pt_regs *regs = this_cpu_ptr(&bpf_pt_regs); |
415 | struct perf_raw_frag frag = { | 418 | struct perf_raw_frag frag = { |
416 | .copy = ctx_copy, | 419 | .copy = ctx_copy, |
@@ -428,8 +431,10 @@ u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, | |||
428 | }; | 431 | }; |
429 | 432 | ||
430 | perf_fetch_caller_regs(regs); | 433 | perf_fetch_caller_regs(regs); |
434 | perf_sample_data_init(sd, 0, 0); | ||
435 | sd->raw = &raw; | ||
431 | 436 | ||
432 | return __bpf_perf_event_output(regs, map, flags, &raw); | 437 | return __bpf_perf_event_output(regs, map, flags, sd); |
433 | } | 438 | } |
434 | 439 | ||
435 | BPF_CALL_0(bpf_get_current_task) | 440 | BPF_CALL_0(bpf_get_current_task) |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 1b659ab652fb..bbe8414b6ee7 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -1214,7 +1214,7 @@ static bool batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, | |||
1214 | orig_node->last_seen = jiffies; | 1214 | orig_node->last_seen = jiffies; |
1215 | 1215 | ||
1216 | /* find packet count of corresponding one hop neighbor */ | 1216 | /* find packet count of corresponding one hop neighbor */ |
1217 | spin_lock_bh(&orig_node->bat_iv.ogm_cnt_lock); | 1217 | spin_lock_bh(&orig_neigh_node->bat_iv.ogm_cnt_lock); |
1218 | if_num = if_incoming->if_num; | 1218 | if_num = if_incoming->if_num; |
1219 | orig_eq_count = orig_neigh_node->bat_iv.bcast_own_sum[if_num]; | 1219 | orig_eq_count = orig_neigh_node->bat_iv.bcast_own_sum[if_num]; |
1220 | neigh_ifinfo = batadv_neigh_ifinfo_new(neigh_node, if_outgoing); | 1220 | neigh_ifinfo = batadv_neigh_ifinfo_new(neigh_node, if_outgoing); |
@@ -1224,7 +1224,7 @@ static bool batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, | |||
1224 | } else { | 1224 | } else { |
1225 | neigh_rq_count = 0; | 1225 | neigh_rq_count = 0; |
1226 | } | 1226 | } |
1227 | spin_unlock_bh(&orig_node->bat_iv.ogm_cnt_lock); | 1227 | spin_unlock_bh(&orig_neigh_node->bat_iv.ogm_cnt_lock); |
1228 | 1228 | ||
1229 | /* pay attention to not get a value bigger than 100 % */ | 1229 | /* pay attention to not get a value bigger than 100 % */ |
1230 | if (orig_eq_count > neigh_rq_count) | 1230 | if (orig_eq_count > neigh_rq_count) |
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c index 341ceab8338d..e0e2bfcd6b3e 100644 --- a/net/batman-adv/bat_v.c +++ b/net/batman-adv/bat_v.c | |||
@@ -814,7 +814,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv, | |||
814 | } | 814 | } |
815 | 815 | ||
816 | orig_gw = batadv_gw_node_get(bat_priv, orig_node); | 816 | orig_gw = batadv_gw_node_get(bat_priv, orig_node); |
817 | if (!orig_node) | 817 | if (!orig_gw) |
818 | goto out; | 818 | goto out; |
819 | 819 | ||
820 | if (batadv_v_gw_throughput_get(orig_gw, &orig_throughput) < 0) | 820 | if (batadv_v_gw_throughput_get(orig_gw, &orig_throughput) < 0) |
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index a98cf1104a30..ebe6e38934e4 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c | |||
@@ -499,6 +499,8 @@ int batadv_frag_send_packet(struct sk_buff *skb, | |||
499 | */ | 499 | */ |
500 | if (skb->priority >= 256 && skb->priority <= 263) | 500 | if (skb->priority >= 256 && skb->priority <= 263) |
501 | frag_header.priority = skb->priority - 256; | 501 | frag_header.priority = skb->priority - 256; |
502 | else | ||
503 | frag_header.priority = 0; | ||
502 | 504 | ||
503 | ether_addr_copy(frag_header.orig, primary_if->net_dev->dev_addr); | 505 | ether_addr_copy(frag_header.orig, primary_if->net_dev->dev_addr); |
504 | ether_addr_copy(frag_header.dest, orig_node->orig); | 506 | ether_addr_copy(frag_header.dest, orig_node->orig); |
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index 15cd2139381e..ebc4e2241c77 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c | |||
@@ -482,7 +482,7 @@ static void batadv_tp_reset_sender_timer(struct batadv_tp_vars *tp_vars) | |||
482 | 482 | ||
483 | /** | 483 | /** |
484 | * batadv_tp_sender_timeout - timer that fires in case of packet loss | 484 | * batadv_tp_sender_timeout - timer that fires in case of packet loss |
485 | * @arg: address of the related tp_vars | 485 | * @t: address to timer_list inside tp_vars |
486 | * | 486 | * |
487 | * If fired it means that there was packet loss. | 487 | * If fired it means that there was packet loss. |
488 | * Switch to Slow Start, set the ss_threshold to half of the current cwnd and | 488 | * Switch to Slow Start, set the ss_threshold to half of the current cwnd and |
@@ -1106,7 +1106,7 @@ static void batadv_tp_reset_receiver_timer(struct batadv_tp_vars *tp_vars) | |||
1106 | /** | 1106 | /** |
1107 | * batadv_tp_receiver_shutdown - stop a tp meter receiver when timeout is | 1107 | * batadv_tp_receiver_shutdown - stop a tp meter receiver when timeout is |
1108 | * reached without received ack | 1108 | * reached without received ack |
1109 | * @arg: address of the related tp_vars | 1109 | * @t: address to timer_list inside tp_vars |
1110 | */ | 1110 | */ |
1111 | static void batadv_tp_receiver_shutdown(struct timer_list *t) | 1111 | static void batadv_tp_receiver_shutdown(struct timer_list *t) |
1112 | { | 1112 | { |
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index 1c4810919a0a..b9057478d69c 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/module.h> | ||
18 | #include <linux/string.h> | 17 | #include <linux/string.h> |
19 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
20 | #include <linux/skbuff.h> | 19 | #include <linux/skbuff.h> |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 6b0ff396fa9d..a592ca025fc4 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -4293,7 +4293,7 @@ void skb_complete_tx_timestamp(struct sk_buff *skb, | |||
4293 | struct sock *sk = skb->sk; | 4293 | struct sock *sk = skb->sk; |
4294 | 4294 | ||
4295 | if (!skb_may_tx_timestamp(sk, false)) | 4295 | if (!skb_may_tx_timestamp(sk, false)) |
4296 | return; | 4296 | goto err; |
4297 | 4297 | ||
4298 | /* Take a reference to prevent skb_orphan() from freeing the socket, | 4298 | /* Take a reference to prevent skb_orphan() from freeing the socket, |
4299 | * but only if the socket refcount is not zero. | 4299 | * but only if the socket refcount is not zero. |
@@ -4302,7 +4302,11 @@ void skb_complete_tx_timestamp(struct sk_buff *skb, | |||
4302 | *skb_hwtstamps(skb) = *hwtstamps; | 4302 | *skb_hwtstamps(skb) = *hwtstamps; |
4303 | __skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND, false); | 4303 | __skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND, false); |
4304 | sock_put(sk); | 4304 | sock_put(sk); |
4305 | return; | ||
4305 | } | 4306 | } |
4307 | |||
4308 | err: | ||
4309 | kfree_skb(skb); | ||
4306 | } | 4310 | } |
4307 | EXPORT_SYMBOL_GPL(skb_complete_tx_timestamp); | 4311 | EXPORT_SYMBOL_GPL(skb_complete_tx_timestamp); |
4308 | 4312 | ||
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d6e7a642493b..a95a55f79137 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/of_net.h> | 16 | #include <linux/of_net.h> |
17 | #include <linux/of_mdio.h> | 17 | #include <linux/of_mdio.h> |
18 | #include <linux/mdio.h> | 18 | #include <linux/mdio.h> |
19 | #include <linux/list.h> | ||
20 | #include <net/rtnetlink.h> | 19 | #include <net/rtnetlink.h> |
21 | #include <net/pkt_cls.h> | 20 | #include <net/pkt_cls.h> |
22 | #include <net/tc_act/tc_mirred.h> | 21 | #include <net/tc_act/tc_mirred.h> |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index a4573bccd6da..7a93359fbc72 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1428,7 +1428,7 @@ skip: | |||
1428 | 1428 | ||
1429 | static bool inetdev_valid_mtu(unsigned int mtu) | 1429 | static bool inetdev_valid_mtu(unsigned int mtu) |
1430 | { | 1430 | { |
1431 | return mtu >= 68; | 1431 | return mtu >= IPV4_MIN_MTU; |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | static void inetdev_send_gratuitous_arp(struct net_device *dev, | 1434 | static void inetdev_send_gratuitous_arp(struct net_device *dev, |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index d1f8f302dbf3..726f6b608274 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -89,6 +89,7 @@ | |||
89 | #include <linux/rtnetlink.h> | 89 | #include <linux/rtnetlink.h> |
90 | #include <linux/times.h> | 90 | #include <linux/times.h> |
91 | #include <linux/pkt_sched.h> | 91 | #include <linux/pkt_sched.h> |
92 | #include <linux/byteorder/generic.h> | ||
92 | 93 | ||
93 | #include <net/net_namespace.h> | 94 | #include <net/net_namespace.h> |
94 | #include <net/arp.h> | 95 | #include <net/arp.h> |
@@ -321,6 +322,23 @@ igmp_scount(struct ip_mc_list *pmc, int type, int gdeleted, int sdeleted) | |||
321 | return scount; | 322 | return scount; |
322 | } | 323 | } |
323 | 324 | ||
325 | /* source address selection per RFC 3376 section 4.2.13 */ | ||
326 | static __be32 igmpv3_get_srcaddr(struct net_device *dev, | ||
327 | const struct flowi4 *fl4) | ||
328 | { | ||
329 | struct in_device *in_dev = __in_dev_get_rcu(dev); | ||
330 | |||
331 | if (!in_dev) | ||
332 | return htonl(INADDR_ANY); | ||
333 | |||
334 | for_ifa(in_dev) { | ||
335 | if (inet_ifa_match(fl4->saddr, ifa)) | ||
336 | return fl4->saddr; | ||
337 | } endfor_ifa(in_dev); | ||
338 | |||
339 | return htonl(INADDR_ANY); | ||
340 | } | ||
341 | |||
324 | static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu) | 342 | static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu) |
325 | { | 343 | { |
326 | struct sk_buff *skb; | 344 | struct sk_buff *skb; |
@@ -368,7 +386,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu) | |||
368 | pip->frag_off = htons(IP_DF); | 386 | pip->frag_off = htons(IP_DF); |
369 | pip->ttl = 1; | 387 | pip->ttl = 1; |
370 | pip->daddr = fl4.daddr; | 388 | pip->daddr = fl4.daddr; |
371 | pip->saddr = fl4.saddr; | 389 | pip->saddr = igmpv3_get_srcaddr(dev, &fl4); |
372 | pip->protocol = IPPROTO_IGMP; | 390 | pip->protocol = IPPROTO_IGMP; |
373 | pip->tot_len = 0; /* filled in later */ | 391 | pip->tot_len = 0; /* filled in later */ |
374 | ip_select_ident(net, skb, NULL); | 392 | ip_select_ident(net, skb, NULL); |
@@ -404,16 +422,17 @@ static int grec_size(struct ip_mc_list *pmc, int type, int gdel, int sdel) | |||
404 | } | 422 | } |
405 | 423 | ||
406 | static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, | 424 | static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, |
407 | int type, struct igmpv3_grec **ppgr) | 425 | int type, struct igmpv3_grec **ppgr, unsigned int mtu) |
408 | { | 426 | { |
409 | struct net_device *dev = pmc->interface->dev; | 427 | struct net_device *dev = pmc->interface->dev; |
410 | struct igmpv3_report *pih; | 428 | struct igmpv3_report *pih; |
411 | struct igmpv3_grec *pgr; | 429 | struct igmpv3_grec *pgr; |
412 | 430 | ||
413 | if (!skb) | 431 | if (!skb) { |
414 | skb = igmpv3_newpack(dev, dev->mtu); | 432 | skb = igmpv3_newpack(dev, mtu); |
415 | if (!skb) | 433 | if (!skb) |
416 | return NULL; | 434 | return NULL; |
435 | } | ||
417 | pgr = skb_put(skb, sizeof(struct igmpv3_grec)); | 436 | pgr = skb_put(skb, sizeof(struct igmpv3_grec)); |
418 | pgr->grec_type = type; | 437 | pgr->grec_type = type; |
419 | pgr->grec_auxwords = 0; | 438 | pgr->grec_auxwords = 0; |
@@ -436,12 +455,17 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
436 | struct igmpv3_grec *pgr = NULL; | 455 | struct igmpv3_grec *pgr = NULL; |
437 | struct ip_sf_list *psf, *psf_next, *psf_prev, **psf_list; | 456 | struct ip_sf_list *psf, *psf_next, *psf_prev, **psf_list; |
438 | int scount, stotal, first, isquery, truncate; | 457 | int scount, stotal, first, isquery, truncate; |
458 | unsigned int mtu; | ||
439 | 459 | ||
440 | if (pmc->multiaddr == IGMP_ALL_HOSTS) | 460 | if (pmc->multiaddr == IGMP_ALL_HOSTS) |
441 | return skb; | 461 | return skb; |
442 | if (ipv4_is_local_multicast(pmc->multiaddr) && !net->ipv4.sysctl_igmp_llm_reports) | 462 | if (ipv4_is_local_multicast(pmc->multiaddr) && !net->ipv4.sysctl_igmp_llm_reports) |
443 | return skb; | 463 | return skb; |
444 | 464 | ||
465 | mtu = READ_ONCE(dev->mtu); | ||
466 | if (mtu < IPV4_MIN_MTU) | ||
467 | return skb; | ||
468 | |||
445 | isquery = type == IGMPV3_MODE_IS_INCLUDE || | 469 | isquery = type == IGMPV3_MODE_IS_INCLUDE || |
446 | type == IGMPV3_MODE_IS_EXCLUDE; | 470 | type == IGMPV3_MODE_IS_EXCLUDE; |
447 | truncate = type == IGMPV3_MODE_IS_EXCLUDE || | 471 | truncate = type == IGMPV3_MODE_IS_EXCLUDE || |
@@ -462,7 +486,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
462 | AVAILABLE(skb) < grec_size(pmc, type, gdeleted, sdeleted)) { | 486 | AVAILABLE(skb) < grec_size(pmc, type, gdeleted, sdeleted)) { |
463 | if (skb) | 487 | if (skb) |
464 | igmpv3_sendpack(skb); | 488 | igmpv3_sendpack(skb); |
465 | skb = igmpv3_newpack(dev, dev->mtu); | 489 | skb = igmpv3_newpack(dev, mtu); |
466 | } | 490 | } |
467 | } | 491 | } |
468 | first = 1; | 492 | first = 1; |
@@ -498,12 +522,12 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
498 | pgr->grec_nsrcs = htons(scount); | 522 | pgr->grec_nsrcs = htons(scount); |
499 | if (skb) | 523 | if (skb) |
500 | igmpv3_sendpack(skb); | 524 | igmpv3_sendpack(skb); |
501 | skb = igmpv3_newpack(dev, dev->mtu); | 525 | skb = igmpv3_newpack(dev, mtu); |
502 | first = 1; | 526 | first = 1; |
503 | scount = 0; | 527 | scount = 0; |
504 | } | 528 | } |
505 | if (first) { | 529 | if (first) { |
506 | skb = add_grhead(skb, pmc, type, &pgr); | 530 | skb = add_grhead(skb, pmc, type, &pgr, mtu); |
507 | first = 0; | 531 | first = 0; |
508 | } | 532 | } |
509 | if (!skb) | 533 | if (!skb) |
@@ -538,7 +562,7 @@ empty_source: | |||
538 | igmpv3_sendpack(skb); | 562 | igmpv3_sendpack(skb); |
539 | skb = NULL; /* add_grhead will get a new one */ | 563 | skb = NULL; /* add_grhead will get a new one */ |
540 | } | 564 | } |
541 | skb = add_grhead(skb, pmc, type, &pgr); | 565 | skb = add_grhead(skb, pmc, type, &pgr, mtu); |
542 | } | 566 | } |
543 | } | 567 | } |
544 | if (pgr) | 568 | if (pgr) |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index bb6239169b1a..9c1735632c8c 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -266,7 +266,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, | |||
266 | len = gre_hdr_len + sizeof(*ershdr); | 266 | len = gre_hdr_len + sizeof(*ershdr); |
267 | 267 | ||
268 | if (unlikely(!pskb_may_pull(skb, len))) | 268 | if (unlikely(!pskb_may_pull(skb, len))) |
269 | return -ENOMEM; | 269 | return PACKET_REJECT; |
270 | 270 | ||
271 | iph = ip_hdr(skb); | 271 | iph = ip_hdr(skb); |
272 | ershdr = (struct erspanhdr *)(skb->data + gre_hdr_len); | 272 | ershdr = (struct erspanhdr *)(skb->data + gre_hdr_len); |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index fe6fee728ce4..5ddb1cb52bd4 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -349,8 +349,8 @@ static int ip_tunnel_bind_dev(struct net_device *dev) | |||
349 | dev->needed_headroom = t_hlen + hlen; | 349 | dev->needed_headroom = t_hlen + hlen; |
350 | mtu -= (dev->hard_header_len + t_hlen); | 350 | mtu -= (dev->hard_header_len + t_hlen); |
351 | 351 | ||
352 | if (mtu < 68) | 352 | if (mtu < IPV4_MIN_MTU) |
353 | mtu = 68; | 353 | mtu = IPV4_MIN_MTU; |
354 | 354 | ||
355 | return mtu; | 355 | return mtu; |
356 | } | 356 | } |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index f88221aebc9d..0c3c944a7b72 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -373,7 +373,6 @@ static int mark_source_chains(const struct xt_table_info *newinfo, | |||
373 | if (!xt_find_jump_offset(offsets, newpos, | 373 | if (!xt_find_jump_offset(offsets, newpos, |
374 | newinfo->number)) | 374 | newinfo->number)) |
375 | return 0; | 375 | return 0; |
376 | e = entry0 + newpos; | ||
377 | } else { | 376 | } else { |
378 | /* ... this is a fallthru */ | 377 | /* ... this is a fallthru */ |
379 | newpos = pos + e->next_offset; | 378 | newpos = pos + e->next_offset; |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 4cbe5e80f3bf..2e0d339028bb 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -439,7 +439,6 @@ mark_source_chains(const struct xt_table_info *newinfo, | |||
439 | if (!xt_find_jump_offset(offsets, newpos, | 439 | if (!xt_find_jump_offset(offsets, newpos, |
440 | newinfo->number)) | 440 | newinfo->number)) |
441 | return 0; | 441 | return 0; |
442 | e = entry0 + newpos; | ||
443 | } else { | 442 | } else { |
444 | /* ... this is a fallthru */ | 443 | /* ... this is a fallthru */ |
445 | newpos = pos + e->next_offset; | 444 | newpos = pos + e->next_offset; |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 17b4ca562944..69060e3abe85 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -813,12 +813,13 @@ static int clusterip_net_init(struct net *net) | |||
813 | 813 | ||
814 | static void clusterip_net_exit(struct net *net) | 814 | static void clusterip_net_exit(struct net *net) |
815 | { | 815 | { |
816 | #ifdef CONFIG_PROC_FS | ||
817 | struct clusterip_net *cn = net_generic(net, clusterip_net_id); | 816 | struct clusterip_net *cn = net_generic(net, clusterip_net_id); |
817 | #ifdef CONFIG_PROC_FS | ||
818 | proc_remove(cn->procdir); | 818 | proc_remove(cn->procdir); |
819 | cn->procdir = NULL; | 819 | cn->procdir = NULL; |
820 | #endif | 820 | #endif |
821 | nf_unregister_net_hook(net, &cip_arp_ops); | 821 | nf_unregister_net_hook(net, &cip_arp_ops); |
822 | WARN_ON_ONCE(!list_empty(&cn->configs)); | ||
822 | } | 823 | } |
823 | 824 | ||
824 | static struct pernet_operations clusterip_net_ops = { | 825 | static struct pernet_operations clusterip_net_ops = { |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 33b70bfd1122..125c1eab3eaa 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -513,11 +513,16 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
513 | int err; | 513 | int err; |
514 | struct ip_options_data opt_copy; | 514 | struct ip_options_data opt_copy; |
515 | struct raw_frag_vec rfv; | 515 | struct raw_frag_vec rfv; |
516 | int hdrincl; | ||
516 | 517 | ||
517 | err = -EMSGSIZE; | 518 | err = -EMSGSIZE; |
518 | if (len > 0xFFFF) | 519 | if (len > 0xFFFF) |
519 | goto out; | 520 | goto out; |
520 | 521 | ||
522 | /* hdrincl should be READ_ONCE(inet->hdrincl) | ||
523 | * but READ_ONCE() doesn't work with bit fields | ||
524 | */ | ||
525 | hdrincl = inet->hdrincl; | ||
521 | /* | 526 | /* |
522 | * Check the flags. | 527 | * Check the flags. |
523 | */ | 528 | */ |
@@ -593,7 +598,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
593 | /* Linux does not mangle headers on raw sockets, | 598 | /* Linux does not mangle headers on raw sockets, |
594 | * so that IP options + IP_HDRINCL is non-sense. | 599 | * so that IP options + IP_HDRINCL is non-sense. |
595 | */ | 600 | */ |
596 | if (inet->hdrincl) | 601 | if (hdrincl) |
597 | goto done; | 602 | goto done; |
598 | if (ipc.opt->opt.srr) { | 603 | if (ipc.opt->opt.srr) { |
599 | if (!daddr) | 604 | if (!daddr) |
@@ -615,12 +620,12 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
615 | 620 | ||
616 | flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos, | 621 | flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos, |
617 | RT_SCOPE_UNIVERSE, | 622 | RT_SCOPE_UNIVERSE, |
618 | inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol, | 623 | hdrincl ? IPPROTO_RAW : sk->sk_protocol, |
619 | inet_sk_flowi_flags(sk) | | 624 | inet_sk_flowi_flags(sk) | |
620 | (inet->hdrincl ? FLOWI_FLAG_KNOWN_NH : 0), | 625 | (hdrincl ? FLOWI_FLAG_KNOWN_NH : 0), |
621 | daddr, saddr, 0, 0, sk->sk_uid); | 626 | daddr, saddr, 0, 0, sk->sk_uid); |
622 | 627 | ||
623 | if (!inet->hdrincl) { | 628 | if (!hdrincl) { |
624 | rfv.msg = msg; | 629 | rfv.msg = msg; |
625 | rfv.hlen = 0; | 630 | rfv.hlen = 0; |
626 | 631 | ||
@@ -645,7 +650,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
645 | goto do_confirm; | 650 | goto do_confirm; |
646 | back_from_confirm: | 651 | back_from_confirm: |
647 | 652 | ||
648 | if (inet->hdrincl) | 653 | if (hdrincl) |
649 | err = raw_send_hdrinc(sk, &fl4, msg, len, | 654 | err = raw_send_hdrinc(sk, &fl4, msg, len, |
650 | &rt, msg->msg_flags, &ipc.sockc); | 655 | &rt, msg->msg_flags, &ipc.sockc); |
651 | 656 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 9550cc42de2d..45f750e85714 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -508,9 +508,6 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep) | |||
508 | u32 new_sample = tp->rcv_rtt_est.rtt_us; | 508 | u32 new_sample = tp->rcv_rtt_est.rtt_us; |
509 | long m = sample; | 509 | long m = sample; |
510 | 510 | ||
511 | if (m == 0) | ||
512 | m = 1; | ||
513 | |||
514 | if (new_sample != 0) { | 511 | if (new_sample != 0) { |
515 | /* If we sample in larger samples in the non-timestamp | 512 | /* If we sample in larger samples in the non-timestamp |
516 | * case, we could grossly overestimate the RTT especially | 513 | * case, we could grossly overestimate the RTT especially |
@@ -547,6 +544,8 @@ static inline void tcp_rcv_rtt_measure(struct tcp_sock *tp) | |||
547 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) | 544 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) |
548 | return; | 545 | return; |
549 | delta_us = tcp_stamp_us_delta(tp->tcp_mstamp, tp->rcv_rtt_est.time); | 546 | delta_us = tcp_stamp_us_delta(tp->tcp_mstamp, tp->rcv_rtt_est.time); |
547 | if (!delta_us) | ||
548 | delta_us = 1; | ||
550 | tcp_rcv_rtt_update(tp, delta_us, 1); | 549 | tcp_rcv_rtt_update(tp, delta_us, 1); |
551 | 550 | ||
552 | new_measure: | 551 | new_measure: |
@@ -563,8 +562,11 @@ static inline void tcp_rcv_rtt_measure_ts(struct sock *sk, | |||
563 | (TCP_SKB_CB(skb)->end_seq - | 562 | (TCP_SKB_CB(skb)->end_seq - |
564 | TCP_SKB_CB(skb)->seq >= inet_csk(sk)->icsk_ack.rcv_mss)) { | 563 | TCP_SKB_CB(skb)->seq >= inet_csk(sk)->icsk_ack.rcv_mss)) { |
565 | u32 delta = tcp_time_stamp(tp) - tp->rx_opt.rcv_tsecr; | 564 | u32 delta = tcp_time_stamp(tp) - tp->rx_opt.rcv_tsecr; |
566 | u32 delta_us = delta * (USEC_PER_SEC / TCP_TS_HZ); | 565 | u32 delta_us; |
567 | 566 | ||
567 | if (!delta) | ||
568 | delta = 1; | ||
569 | delta_us = delta * (USEC_PER_SEC / TCP_TS_HZ); | ||
568 | tcp_rcv_rtt_update(tp, delta_us, 0); | 570 | tcp_rcv_rtt_update(tp, delta_us, 0); |
569 | } | 571 | } |
570 | } | 572 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 77ea45da0fe9..94e28350f420 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -848,7 +848,7 @@ static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, | |||
848 | tcp_time_stamp_raw() + tcp_rsk(req)->ts_off, | 848 | tcp_time_stamp_raw() + tcp_rsk(req)->ts_off, |
849 | req->ts_recent, | 849 | req->ts_recent, |
850 | 0, | 850 | 0, |
851 | tcp_md5_do_lookup(sk, (union tcp_md5_addr *)&ip_hdr(skb)->daddr, | 851 | tcp_md5_do_lookup(sk, (union tcp_md5_addr *)&ip_hdr(skb)->saddr, |
852 | AF_INET), | 852 | AF_INET), |
853 | inet_rsk(req)->no_srccheck ? IP_REPLY_ARG_NOSRCCHECK : 0, | 853 | inet_rsk(req)->no_srccheck ? IP_REPLY_ARG_NOSRCCHECK : 0, |
854 | ip_hdr(skb)->tos); | 854 | ip_hdr(skb)->tos); |
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 16df6dd44b98..968fda198376 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -264,6 +264,7 @@ void tcp_delack_timer_handler(struct sock *sk) | |||
264 | icsk->icsk_ack.pingpong = 0; | 264 | icsk->icsk_ack.pingpong = 0; |
265 | icsk->icsk_ack.ato = TCP_ATO_MIN; | 265 | icsk->icsk_ack.ato = TCP_ATO_MIN; |
266 | } | 266 | } |
267 | tcp_mstamp_refresh(tcp_sk(sk)); | ||
267 | tcp_send_ack(sk); | 268 | tcp_send_ack(sk); |
268 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKS); | 269 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKS); |
269 | } | 270 | } |
@@ -632,6 +633,7 @@ static void tcp_keepalive_timer (struct timer_list *t) | |||
632 | goto out; | 633 | goto out; |
633 | } | 634 | } |
634 | 635 | ||
636 | tcp_mstamp_refresh(tp); | ||
635 | if (sk->sk_state == TCP_FIN_WAIT2 && sock_flag(sk, SOCK_DEAD)) { | 637 | if (sk->sk_state == TCP_FIN_WAIT2 && sock_flag(sk, SOCK_DEAD)) { |
636 | if (tp->linger2 >= 0) { | 638 | if (tp->linger2 >= 0) { |
637 | const int tmo = tcp_fin_time(sk) - TCP_TIMEWAIT_LEN; | 639 | const int tmo = tcp_fin_time(sk) - TCP_TIMEWAIT_LEN; |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index fc6d7d143f2c..844642682b83 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1682,16 +1682,16 @@ static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel) | |||
1682 | } | 1682 | } |
1683 | 1683 | ||
1684 | static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, | 1684 | static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, |
1685 | int type, struct mld2_grec **ppgr) | 1685 | int type, struct mld2_grec **ppgr, unsigned int mtu) |
1686 | { | 1686 | { |
1687 | struct net_device *dev = pmc->idev->dev; | ||
1688 | struct mld2_report *pmr; | 1687 | struct mld2_report *pmr; |
1689 | struct mld2_grec *pgr; | 1688 | struct mld2_grec *pgr; |
1690 | 1689 | ||
1691 | if (!skb) | 1690 | if (!skb) { |
1692 | skb = mld_newpack(pmc->idev, dev->mtu); | 1691 | skb = mld_newpack(pmc->idev, mtu); |
1693 | if (!skb) | 1692 | if (!skb) |
1694 | return NULL; | 1693 | return NULL; |
1694 | } | ||
1695 | pgr = skb_put(skb, sizeof(struct mld2_grec)); | 1695 | pgr = skb_put(skb, sizeof(struct mld2_grec)); |
1696 | pgr->grec_type = type; | 1696 | pgr->grec_type = type; |
1697 | pgr->grec_auxwords = 0; | 1697 | pgr->grec_auxwords = 0; |
@@ -1714,10 +1714,15 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, | |||
1714 | struct mld2_grec *pgr = NULL; | 1714 | struct mld2_grec *pgr = NULL; |
1715 | struct ip6_sf_list *psf, *psf_next, *psf_prev, **psf_list; | 1715 | struct ip6_sf_list *psf, *psf_next, *psf_prev, **psf_list; |
1716 | int scount, stotal, first, isquery, truncate; | 1716 | int scount, stotal, first, isquery, truncate; |
1717 | unsigned int mtu; | ||
1717 | 1718 | ||
1718 | if (pmc->mca_flags & MAF_NOREPORT) | 1719 | if (pmc->mca_flags & MAF_NOREPORT) |
1719 | return skb; | 1720 | return skb; |
1720 | 1721 | ||
1722 | mtu = READ_ONCE(dev->mtu); | ||
1723 | if (mtu < IPV6_MIN_MTU) | ||
1724 | return skb; | ||
1725 | |||
1721 | isquery = type == MLD2_MODE_IS_INCLUDE || | 1726 | isquery = type == MLD2_MODE_IS_INCLUDE || |
1722 | type == MLD2_MODE_IS_EXCLUDE; | 1727 | type == MLD2_MODE_IS_EXCLUDE; |
1723 | truncate = type == MLD2_MODE_IS_EXCLUDE || | 1728 | truncate = type == MLD2_MODE_IS_EXCLUDE || |
@@ -1738,7 +1743,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, | |||
1738 | AVAILABLE(skb) < grec_size(pmc, type, gdeleted, sdeleted)) { | 1743 | AVAILABLE(skb) < grec_size(pmc, type, gdeleted, sdeleted)) { |
1739 | if (skb) | 1744 | if (skb) |
1740 | mld_sendpack(skb); | 1745 | mld_sendpack(skb); |
1741 | skb = mld_newpack(idev, dev->mtu); | 1746 | skb = mld_newpack(idev, mtu); |
1742 | } | 1747 | } |
1743 | } | 1748 | } |
1744 | first = 1; | 1749 | first = 1; |
@@ -1774,12 +1779,12 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, | |||
1774 | pgr->grec_nsrcs = htons(scount); | 1779 | pgr->grec_nsrcs = htons(scount); |
1775 | if (skb) | 1780 | if (skb) |
1776 | mld_sendpack(skb); | 1781 | mld_sendpack(skb); |
1777 | skb = mld_newpack(idev, dev->mtu); | 1782 | skb = mld_newpack(idev, mtu); |
1778 | first = 1; | 1783 | first = 1; |
1779 | scount = 0; | 1784 | scount = 0; |
1780 | } | 1785 | } |
1781 | if (first) { | 1786 | if (first) { |
1782 | skb = add_grhead(skb, pmc, type, &pgr); | 1787 | skb = add_grhead(skb, pmc, type, &pgr, mtu); |
1783 | first = 0; | 1788 | first = 0; |
1784 | } | 1789 | } |
1785 | if (!skb) | 1790 | if (!skb) |
@@ -1814,7 +1819,7 @@ empty_source: | |||
1814 | mld_sendpack(skb); | 1819 | mld_sendpack(skb); |
1815 | skb = NULL; /* add_grhead will get a new one */ | 1820 | skb = NULL; /* add_grhead will get a new one */ |
1816 | } | 1821 | } |
1817 | skb = add_grhead(skb, pmc, type, &pgr); | 1822 | skb = add_grhead(skb, pmc, type, &pgr, mtu); |
1818 | } | 1823 | } |
1819 | } | 1824 | } |
1820 | if (pgr) | 1825 | if (pgr) |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index f06e25065a34..1d7ae9366335 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -458,7 +458,6 @@ mark_source_chains(const struct xt_table_info *newinfo, | |||
458 | if (!xt_find_jump_offset(offsets, newpos, | 458 | if (!xt_find_jump_offset(offsets, newpos, |
459 | newinfo->number)) | 459 | newinfo->number)) |
460 | return 0; | 460 | return 0; |
461 | e = entry0 + newpos; | ||
462 | } else { | 461 | } else { |
463 | /* ... this is a fallthru */ | 462 | /* ... this is a fallthru */ |
464 | newpos = pos + e->next_offset; | 463 | newpos = pos + e->next_offset; |
diff --git a/net/ipv6/netfilter/ip6t_MASQUERADE.c b/net/ipv6/netfilter/ip6t_MASQUERADE.c index 2b1a15846f9a..92c0047e7e33 100644 --- a/net/ipv6/netfilter/ip6t_MASQUERADE.c +++ b/net/ipv6/netfilter/ip6t_MASQUERADE.c | |||
@@ -33,13 +33,19 @@ static int masquerade_tg6_checkentry(const struct xt_tgchk_param *par) | |||
33 | 33 | ||
34 | if (range->flags & NF_NAT_RANGE_MAP_IPS) | 34 | if (range->flags & NF_NAT_RANGE_MAP_IPS) |
35 | return -EINVAL; | 35 | return -EINVAL; |
36 | return 0; | 36 | return nf_ct_netns_get(par->net, par->family); |
37 | } | ||
38 | |||
39 | static void masquerade_tg6_destroy(const struct xt_tgdtor_param *par) | ||
40 | { | ||
41 | nf_ct_netns_put(par->net, par->family); | ||
37 | } | 42 | } |
38 | 43 | ||
39 | static struct xt_target masquerade_tg6_reg __read_mostly = { | 44 | static struct xt_target masquerade_tg6_reg __read_mostly = { |
40 | .name = "MASQUERADE", | 45 | .name = "MASQUERADE", |
41 | .family = NFPROTO_IPV6, | 46 | .family = NFPROTO_IPV6, |
42 | .checkentry = masquerade_tg6_checkentry, | 47 | .checkentry = masquerade_tg6_checkentry, |
48 | .destroy = masquerade_tg6_destroy, | ||
43 | .target = masquerade_tg6, | 49 | .target = masquerade_tg6, |
44 | .targetsize = sizeof(struct nf_nat_range), | 50 | .targetsize = sizeof(struct nf_nat_range), |
45 | .table = "nat", | 51 | .table = "nat", |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 1f04ec0e4a7a..7178476b3d2f 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -994,7 +994,7 @@ static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, | |||
994 | req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, | 994 | req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, |
995 | tcp_time_stamp_raw() + tcp_rsk(req)->ts_off, | 995 | tcp_time_stamp_raw() + tcp_rsk(req)->ts_off, |
996 | req->ts_recent, sk->sk_bound_dev_if, | 996 | req->ts_recent, sk->sk_bound_dev_if, |
997 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), | 997 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->saddr), |
998 | 0, 0); | 998 | 0, 0); |
999 | } | 999 | } |
1000 | 1000 | ||
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 167f83b853e6..1621b6ab17ba 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -291,16 +291,15 @@ void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, | |||
291 | int i; | 291 | int i; |
292 | 292 | ||
293 | mutex_lock(&sta->ampdu_mlme.mtx); | 293 | mutex_lock(&sta->ampdu_mlme.mtx); |
294 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) { | 294 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) |
295 | ___ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT, | 295 | ___ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT, |
296 | WLAN_REASON_QSTA_LEAVE_QBSS, | 296 | WLAN_REASON_QSTA_LEAVE_QBSS, |
297 | reason != AGG_STOP_DESTROY_STA && | 297 | reason != AGG_STOP_DESTROY_STA && |
298 | reason != AGG_STOP_PEER_REQUEST); | 298 | reason != AGG_STOP_PEER_REQUEST); |
299 | } | ||
300 | mutex_unlock(&sta->ampdu_mlme.mtx); | ||
301 | 299 | ||
302 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) | 300 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) |
303 | ___ieee80211_stop_tx_ba_session(sta, i, reason); | 301 | ___ieee80211_stop_tx_ba_session(sta, i, reason); |
302 | mutex_unlock(&sta->ampdu_mlme.mtx); | ||
304 | 303 | ||
305 | /* stopping might queue the work again - so cancel only afterwards */ | 304 | /* stopping might queue the work again - so cancel only afterwards */ |
306 | cancel_work_sync(&sta->ampdu_mlme.work); | 305 | cancel_work_sync(&sta->ampdu_mlme.work); |
diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c index cf1bf2605c10..dc6347342e34 100644 --- a/net/netfilter/nf_conntrack_h323_asn1.c +++ b/net/netfilter/nf_conntrack_h323_asn1.c | |||
@@ -103,7 +103,6 @@ struct bitstr { | |||
103 | #define INC_BIT(bs) if((++(bs)->bit)>7){(bs)->cur++;(bs)->bit=0;} | 103 | #define INC_BIT(bs) if((++(bs)->bit)>7){(bs)->cur++;(bs)->bit=0;} |
104 | #define INC_BITS(bs,b) if(((bs)->bit+=(b))>7){(bs)->cur+=(bs)->bit>>3;(bs)->bit&=7;} | 104 | #define INC_BITS(bs,b) if(((bs)->bit+=(b))>7){(bs)->cur+=(bs)->bit>>3;(bs)->bit&=7;} |
105 | #define BYTE_ALIGN(bs) if((bs)->bit){(bs)->cur++;(bs)->bit=0;} | 105 | #define BYTE_ALIGN(bs) if((bs)->bit){(bs)->cur++;(bs)->bit=0;} |
106 | #define CHECK_BOUND(bs,n) if((bs)->cur+(n)>(bs)->end)return(H323_ERROR_BOUND) | ||
107 | static unsigned int get_len(struct bitstr *bs); | 106 | static unsigned int get_len(struct bitstr *bs); |
108 | static unsigned int get_bit(struct bitstr *bs); | 107 | static unsigned int get_bit(struct bitstr *bs); |
109 | static unsigned int get_bits(struct bitstr *bs, unsigned int b); | 108 | static unsigned int get_bits(struct bitstr *bs, unsigned int b); |
@@ -165,6 +164,19 @@ static unsigned int get_len(struct bitstr *bs) | |||
165 | return v; | 164 | return v; |
166 | } | 165 | } |
167 | 166 | ||
167 | static int nf_h323_error_boundary(struct bitstr *bs, size_t bytes, size_t bits) | ||
168 | { | ||
169 | bits += bs->bit; | ||
170 | bytes += bits / BITS_PER_BYTE; | ||
171 | if (bits % BITS_PER_BYTE > 0) | ||
172 | bytes++; | ||
173 | |||
174 | if (*bs->cur + bytes > *bs->end) | ||
175 | return 1; | ||
176 | |||
177 | return 0; | ||
178 | } | ||
179 | |||
168 | /****************************************************************************/ | 180 | /****************************************************************************/ |
169 | static unsigned int get_bit(struct bitstr *bs) | 181 | static unsigned int get_bit(struct bitstr *bs) |
170 | { | 182 | { |
@@ -279,8 +291,8 @@ static int decode_bool(struct bitstr *bs, const struct field_t *f, | |||
279 | PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); | 291 | PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); |
280 | 292 | ||
281 | INC_BIT(bs); | 293 | INC_BIT(bs); |
282 | 294 | if (nf_h323_error_boundary(bs, 0, 0)) | |
283 | CHECK_BOUND(bs, 0); | 295 | return H323_ERROR_BOUND; |
284 | return H323_ERROR_NONE; | 296 | return H323_ERROR_NONE; |
285 | } | 297 | } |
286 | 298 | ||
@@ -293,11 +305,14 @@ static int decode_oid(struct bitstr *bs, const struct field_t *f, | |||
293 | PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); | 305 | PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); |
294 | 306 | ||
295 | BYTE_ALIGN(bs); | 307 | BYTE_ALIGN(bs); |
296 | CHECK_BOUND(bs, 1); | 308 | if (nf_h323_error_boundary(bs, 1, 0)) |
309 | return H323_ERROR_BOUND; | ||
310 | |||
297 | len = *bs->cur++; | 311 | len = *bs->cur++; |
298 | bs->cur += len; | 312 | bs->cur += len; |
313 | if (nf_h323_error_boundary(bs, 0, 0)) | ||
314 | return H323_ERROR_BOUND; | ||
299 | 315 | ||
300 | CHECK_BOUND(bs, 0); | ||
301 | return H323_ERROR_NONE; | 316 | return H323_ERROR_NONE; |
302 | } | 317 | } |
303 | 318 | ||
@@ -319,6 +334,8 @@ static int decode_int(struct bitstr *bs, const struct field_t *f, | |||
319 | bs->cur += 2; | 334 | bs->cur += 2; |
320 | break; | 335 | break; |
321 | case CONS: /* 64K < Range < 4G */ | 336 | case CONS: /* 64K < Range < 4G */ |
337 | if (nf_h323_error_boundary(bs, 0, 2)) | ||
338 | return H323_ERROR_BOUND; | ||
322 | len = get_bits(bs, 2) + 1; | 339 | len = get_bits(bs, 2) + 1; |
323 | BYTE_ALIGN(bs); | 340 | BYTE_ALIGN(bs); |
324 | if (base && (f->attr & DECODE)) { /* timeToLive */ | 341 | if (base && (f->attr & DECODE)) { /* timeToLive */ |
@@ -330,7 +347,8 @@ static int decode_int(struct bitstr *bs, const struct field_t *f, | |||
330 | break; | 347 | break; |
331 | case UNCO: | 348 | case UNCO: |
332 | BYTE_ALIGN(bs); | 349 | BYTE_ALIGN(bs); |
333 | CHECK_BOUND(bs, 2); | 350 | if (nf_h323_error_boundary(bs, 2, 0)) |
351 | return H323_ERROR_BOUND; | ||
334 | len = get_len(bs); | 352 | len = get_len(bs); |
335 | bs->cur += len; | 353 | bs->cur += len; |
336 | break; | 354 | break; |
@@ -341,7 +359,8 @@ static int decode_int(struct bitstr *bs, const struct field_t *f, | |||
341 | 359 | ||
342 | PRINT("\n"); | 360 | PRINT("\n"); |
343 | 361 | ||
344 | CHECK_BOUND(bs, 0); | 362 | if (nf_h323_error_boundary(bs, 0, 0)) |
363 | return H323_ERROR_BOUND; | ||
345 | return H323_ERROR_NONE; | 364 | return H323_ERROR_NONE; |
346 | } | 365 | } |
347 | 366 | ||
@@ -357,7 +376,8 @@ static int decode_enum(struct bitstr *bs, const struct field_t *f, | |||
357 | INC_BITS(bs, f->sz); | 376 | INC_BITS(bs, f->sz); |
358 | } | 377 | } |
359 | 378 | ||
360 | CHECK_BOUND(bs, 0); | 379 | if (nf_h323_error_boundary(bs, 0, 0)) |
380 | return H323_ERROR_BOUND; | ||
361 | return H323_ERROR_NONE; | 381 | return H323_ERROR_NONE; |
362 | } | 382 | } |
363 | 383 | ||
@@ -375,12 +395,14 @@ static int decode_bitstr(struct bitstr *bs, const struct field_t *f, | |||
375 | len = f->lb; | 395 | len = f->lb; |
376 | break; | 396 | break; |
377 | case WORD: /* 2-byte length */ | 397 | case WORD: /* 2-byte length */ |
378 | CHECK_BOUND(bs, 2); | 398 | if (nf_h323_error_boundary(bs, 2, 0)) |
399 | return H323_ERROR_BOUND; | ||
379 | len = (*bs->cur++) << 8; | 400 | len = (*bs->cur++) << 8; |
380 | len += (*bs->cur++) + f->lb; | 401 | len += (*bs->cur++) + f->lb; |
381 | break; | 402 | break; |
382 | case SEMI: | 403 | case SEMI: |
383 | CHECK_BOUND(bs, 2); | 404 | if (nf_h323_error_boundary(bs, 2, 0)) |
405 | return H323_ERROR_BOUND; | ||
384 | len = get_len(bs); | 406 | len = get_len(bs); |
385 | break; | 407 | break; |
386 | default: | 408 | default: |
@@ -391,7 +413,8 @@ static int decode_bitstr(struct bitstr *bs, const struct field_t *f, | |||
391 | bs->cur += len >> 3; | 413 | bs->cur += len >> 3; |
392 | bs->bit = len & 7; | 414 | bs->bit = len & 7; |
393 | 415 | ||
394 | CHECK_BOUND(bs, 0); | 416 | if (nf_h323_error_boundary(bs, 0, 0)) |
417 | return H323_ERROR_BOUND; | ||
395 | return H323_ERROR_NONE; | 418 | return H323_ERROR_NONE; |
396 | } | 419 | } |
397 | 420 | ||
@@ -404,12 +427,15 @@ static int decode_numstr(struct bitstr *bs, const struct field_t *f, | |||
404 | PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); | 427 | PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); |
405 | 428 | ||
406 | /* 2 <= Range <= 255 */ | 429 | /* 2 <= Range <= 255 */ |
430 | if (nf_h323_error_boundary(bs, 0, f->sz)) | ||
431 | return H323_ERROR_BOUND; | ||
407 | len = get_bits(bs, f->sz) + f->lb; | 432 | len = get_bits(bs, f->sz) + f->lb; |
408 | 433 | ||
409 | BYTE_ALIGN(bs); | 434 | BYTE_ALIGN(bs); |
410 | INC_BITS(bs, (len << 2)); | 435 | INC_BITS(bs, (len << 2)); |
411 | 436 | ||
412 | CHECK_BOUND(bs, 0); | 437 | if (nf_h323_error_boundary(bs, 0, 0)) |
438 | return H323_ERROR_BOUND; | ||
413 | return H323_ERROR_NONE; | 439 | return H323_ERROR_NONE; |
414 | } | 440 | } |
415 | 441 | ||
@@ -440,15 +466,19 @@ static int decode_octstr(struct bitstr *bs, const struct field_t *f, | |||
440 | break; | 466 | break; |
441 | case BYTE: /* Range == 256 */ | 467 | case BYTE: /* Range == 256 */ |
442 | BYTE_ALIGN(bs); | 468 | BYTE_ALIGN(bs); |
443 | CHECK_BOUND(bs, 1); | 469 | if (nf_h323_error_boundary(bs, 1, 0)) |
470 | return H323_ERROR_BOUND; | ||
444 | len = (*bs->cur++) + f->lb; | 471 | len = (*bs->cur++) + f->lb; |
445 | break; | 472 | break; |
446 | case SEMI: | 473 | case SEMI: |
447 | BYTE_ALIGN(bs); | 474 | BYTE_ALIGN(bs); |
448 | CHECK_BOUND(bs, 2); | 475 | if (nf_h323_error_boundary(bs, 2, 0)) |
476 | return H323_ERROR_BOUND; | ||
449 | len = get_len(bs) + f->lb; | 477 | len = get_len(bs) + f->lb; |
450 | break; | 478 | break; |
451 | default: /* 2 <= Range <= 255 */ | 479 | default: /* 2 <= Range <= 255 */ |
480 | if (nf_h323_error_boundary(bs, 0, f->sz)) | ||
481 | return H323_ERROR_BOUND; | ||
452 | len = get_bits(bs, f->sz) + f->lb; | 482 | len = get_bits(bs, f->sz) + f->lb; |
453 | BYTE_ALIGN(bs); | 483 | BYTE_ALIGN(bs); |
454 | break; | 484 | break; |
@@ -458,7 +488,8 @@ static int decode_octstr(struct bitstr *bs, const struct field_t *f, | |||
458 | 488 | ||
459 | PRINT("\n"); | 489 | PRINT("\n"); |
460 | 490 | ||
461 | CHECK_BOUND(bs, 0); | 491 | if (nf_h323_error_boundary(bs, 0, 0)) |
492 | return H323_ERROR_BOUND; | ||
462 | return H323_ERROR_NONE; | 493 | return H323_ERROR_NONE; |
463 | } | 494 | } |
464 | 495 | ||
@@ -473,10 +504,13 @@ static int decode_bmpstr(struct bitstr *bs, const struct field_t *f, | |||
473 | switch (f->sz) { | 504 | switch (f->sz) { |
474 | case BYTE: /* Range == 256 */ | 505 | case BYTE: /* Range == 256 */ |
475 | BYTE_ALIGN(bs); | 506 | BYTE_ALIGN(bs); |
476 | CHECK_BOUND(bs, 1); | 507 | if (nf_h323_error_boundary(bs, 1, 0)) |
508 | return H323_ERROR_BOUND; | ||
477 | len = (*bs->cur++) + f->lb; | 509 | len = (*bs->cur++) + f->lb; |
478 | break; | 510 | break; |
479 | default: /* 2 <= Range <= 255 */ | 511 | default: /* 2 <= Range <= 255 */ |
512 | if (nf_h323_error_boundary(bs, 0, f->sz)) | ||
513 | return H323_ERROR_BOUND; | ||
480 | len = get_bits(bs, f->sz) + f->lb; | 514 | len = get_bits(bs, f->sz) + f->lb; |
481 | BYTE_ALIGN(bs); | 515 | BYTE_ALIGN(bs); |
482 | break; | 516 | break; |
@@ -484,7 +518,8 @@ static int decode_bmpstr(struct bitstr *bs, const struct field_t *f, | |||
484 | 518 | ||
485 | bs->cur += len << 1; | 519 | bs->cur += len << 1; |
486 | 520 | ||
487 | CHECK_BOUND(bs, 0); | 521 | if (nf_h323_error_boundary(bs, 0, 0)) |
522 | return H323_ERROR_BOUND; | ||
488 | return H323_ERROR_NONE; | 523 | return H323_ERROR_NONE; |
489 | } | 524 | } |
490 | 525 | ||
@@ -503,9 +538,13 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f, | |||
503 | base = (base && (f->attr & DECODE)) ? base + f->offset : NULL; | 538 | base = (base && (f->attr & DECODE)) ? base + f->offset : NULL; |
504 | 539 | ||
505 | /* Extensible? */ | 540 | /* Extensible? */ |
541 | if (nf_h323_error_boundary(bs, 0, 1)) | ||
542 | return H323_ERROR_BOUND; | ||
506 | ext = (f->attr & EXT) ? get_bit(bs) : 0; | 543 | ext = (f->attr & EXT) ? get_bit(bs) : 0; |
507 | 544 | ||
508 | /* Get fields bitmap */ | 545 | /* Get fields bitmap */ |
546 | if (nf_h323_error_boundary(bs, 0, f->sz)) | ||
547 | return H323_ERROR_BOUND; | ||
509 | bmp = get_bitmap(bs, f->sz); | 548 | bmp = get_bitmap(bs, f->sz); |
510 | if (base) | 549 | if (base) |
511 | *(unsigned int *)base = bmp; | 550 | *(unsigned int *)base = bmp; |
@@ -525,9 +564,11 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f, | |||
525 | 564 | ||
526 | /* Decode */ | 565 | /* Decode */ |
527 | if (son->attr & OPEN) { /* Open field */ | 566 | if (son->attr & OPEN) { /* Open field */ |
528 | CHECK_BOUND(bs, 2); | 567 | if (nf_h323_error_boundary(bs, 2, 0)) |
568 | return H323_ERROR_BOUND; | ||
529 | len = get_len(bs); | 569 | len = get_len(bs); |
530 | CHECK_BOUND(bs, len); | 570 | if (nf_h323_error_boundary(bs, len, 0)) |
571 | return H323_ERROR_BOUND; | ||
531 | if (!base || !(son->attr & DECODE)) { | 572 | if (!base || !(son->attr & DECODE)) { |
532 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, | 573 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, |
533 | " ", son->name); | 574 | " ", son->name); |
@@ -555,8 +596,11 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f, | |||
555 | return H323_ERROR_NONE; | 596 | return H323_ERROR_NONE; |
556 | 597 | ||
557 | /* Get the extension bitmap */ | 598 | /* Get the extension bitmap */ |
599 | if (nf_h323_error_boundary(bs, 0, 7)) | ||
600 | return H323_ERROR_BOUND; | ||
558 | bmp2_len = get_bits(bs, 7) + 1; | 601 | bmp2_len = get_bits(bs, 7) + 1; |
559 | CHECK_BOUND(bs, (bmp2_len + 7) >> 3); | 602 | if (nf_h323_error_boundary(bs, 0, bmp2_len)) |
603 | return H323_ERROR_BOUND; | ||
560 | bmp2 = get_bitmap(bs, bmp2_len); | 604 | bmp2 = get_bitmap(bs, bmp2_len); |
561 | bmp |= bmp2 >> f->sz; | 605 | bmp |= bmp2 >> f->sz; |
562 | if (base) | 606 | if (base) |
@@ -567,9 +611,11 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f, | |||
567 | for (opt = 0; opt < bmp2_len; opt++, i++, son++) { | 611 | for (opt = 0; opt < bmp2_len; opt++, i++, son++) { |
568 | /* Check Range */ | 612 | /* Check Range */ |
569 | if (i >= f->ub) { /* Newer Version? */ | 613 | if (i >= f->ub) { /* Newer Version? */ |
570 | CHECK_BOUND(bs, 2); | 614 | if (nf_h323_error_boundary(bs, 2, 0)) |
615 | return H323_ERROR_BOUND; | ||
571 | len = get_len(bs); | 616 | len = get_len(bs); |
572 | CHECK_BOUND(bs, len); | 617 | if (nf_h323_error_boundary(bs, len, 0)) |
618 | return H323_ERROR_BOUND; | ||
573 | bs->cur += len; | 619 | bs->cur += len; |
574 | continue; | 620 | continue; |
575 | } | 621 | } |
@@ -583,9 +629,11 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f, | |||
583 | if (!((0x80000000 >> opt) & bmp2)) /* Not present */ | 629 | if (!((0x80000000 >> opt) & bmp2)) /* Not present */ |
584 | continue; | 630 | continue; |
585 | 631 | ||
586 | CHECK_BOUND(bs, 2); | 632 | if (nf_h323_error_boundary(bs, 2, 0)) |
633 | return H323_ERROR_BOUND; | ||
587 | len = get_len(bs); | 634 | len = get_len(bs); |
588 | CHECK_BOUND(bs, len); | 635 | if (nf_h323_error_boundary(bs, len, 0)) |
636 | return H323_ERROR_BOUND; | ||
589 | if (!base || !(son->attr & DECODE)) { | 637 | if (!base || !(son->attr & DECODE)) { |
590 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ", | 638 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ", |
591 | son->name); | 639 | son->name); |
@@ -623,22 +671,27 @@ static int decode_seqof(struct bitstr *bs, const struct field_t *f, | |||
623 | switch (f->sz) { | 671 | switch (f->sz) { |
624 | case BYTE: | 672 | case BYTE: |
625 | BYTE_ALIGN(bs); | 673 | BYTE_ALIGN(bs); |
626 | CHECK_BOUND(bs, 1); | 674 | if (nf_h323_error_boundary(bs, 1, 0)) |
675 | return H323_ERROR_BOUND; | ||
627 | count = *bs->cur++; | 676 | count = *bs->cur++; |
628 | break; | 677 | break; |
629 | case WORD: | 678 | case WORD: |
630 | BYTE_ALIGN(bs); | 679 | BYTE_ALIGN(bs); |
631 | CHECK_BOUND(bs, 2); | 680 | if (nf_h323_error_boundary(bs, 2, 0)) |
681 | return H323_ERROR_BOUND; | ||
632 | count = *bs->cur++; | 682 | count = *bs->cur++; |
633 | count <<= 8; | 683 | count <<= 8; |
634 | count += *bs->cur++; | 684 | count += *bs->cur++; |
635 | break; | 685 | break; |
636 | case SEMI: | 686 | case SEMI: |
637 | BYTE_ALIGN(bs); | 687 | BYTE_ALIGN(bs); |
638 | CHECK_BOUND(bs, 2); | 688 | if (nf_h323_error_boundary(bs, 2, 0)) |
689 | return H323_ERROR_BOUND; | ||
639 | count = get_len(bs); | 690 | count = get_len(bs); |
640 | break; | 691 | break; |
641 | default: | 692 | default: |
693 | if (nf_h323_error_boundary(bs, 0, f->sz)) | ||
694 | return H323_ERROR_BOUND; | ||
642 | count = get_bits(bs, f->sz); | 695 | count = get_bits(bs, f->sz); |
643 | break; | 696 | break; |
644 | } | 697 | } |
@@ -658,8 +711,11 @@ static int decode_seqof(struct bitstr *bs, const struct field_t *f, | |||
658 | for (i = 0; i < count; i++) { | 711 | for (i = 0; i < count; i++) { |
659 | if (son->attr & OPEN) { | 712 | if (son->attr & OPEN) { |
660 | BYTE_ALIGN(bs); | 713 | BYTE_ALIGN(bs); |
714 | if (nf_h323_error_boundary(bs, 2, 0)) | ||
715 | return H323_ERROR_BOUND; | ||
661 | len = get_len(bs); | 716 | len = get_len(bs); |
662 | CHECK_BOUND(bs, len); | 717 | if (nf_h323_error_boundary(bs, len, 0)) |
718 | return H323_ERROR_BOUND; | ||
663 | if (!base || !(son->attr & DECODE)) { | 719 | if (!base || !(son->attr & DECODE)) { |
664 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, | 720 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, |
665 | " ", son->name); | 721 | " ", son->name); |
@@ -710,11 +766,17 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f, | |||
710 | base = (base && (f->attr & DECODE)) ? base + f->offset : NULL; | 766 | base = (base && (f->attr & DECODE)) ? base + f->offset : NULL; |
711 | 767 | ||
712 | /* Decode the choice index number */ | 768 | /* Decode the choice index number */ |
769 | if (nf_h323_error_boundary(bs, 0, 1)) | ||
770 | return H323_ERROR_BOUND; | ||
713 | if ((f->attr & EXT) && get_bit(bs)) { | 771 | if ((f->attr & EXT) && get_bit(bs)) { |
714 | ext = 1; | 772 | ext = 1; |
773 | if (nf_h323_error_boundary(bs, 0, 7)) | ||
774 | return H323_ERROR_BOUND; | ||
715 | type = get_bits(bs, 7) + f->lb; | 775 | type = get_bits(bs, 7) + f->lb; |
716 | } else { | 776 | } else { |
717 | ext = 0; | 777 | ext = 0; |
778 | if (nf_h323_error_boundary(bs, 0, f->sz)) | ||
779 | return H323_ERROR_BOUND; | ||
718 | type = get_bits(bs, f->sz); | 780 | type = get_bits(bs, f->sz); |
719 | if (type >= f->lb) | 781 | if (type >= f->lb) |
720 | return H323_ERROR_RANGE; | 782 | return H323_ERROR_RANGE; |
@@ -727,8 +789,11 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f, | |||
727 | /* Check Range */ | 789 | /* Check Range */ |
728 | if (type >= f->ub) { /* Newer version? */ | 790 | if (type >= f->ub) { /* Newer version? */ |
729 | BYTE_ALIGN(bs); | 791 | BYTE_ALIGN(bs); |
792 | if (nf_h323_error_boundary(bs, 2, 0)) | ||
793 | return H323_ERROR_BOUND; | ||
730 | len = get_len(bs); | 794 | len = get_len(bs); |
731 | CHECK_BOUND(bs, len); | 795 | if (nf_h323_error_boundary(bs, len, 0)) |
796 | return H323_ERROR_BOUND; | ||
732 | bs->cur += len; | 797 | bs->cur += len; |
733 | return H323_ERROR_NONE; | 798 | return H323_ERROR_NONE; |
734 | } | 799 | } |
@@ -742,8 +807,11 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f, | |||
742 | 807 | ||
743 | if (ext || (son->attr & OPEN)) { | 808 | if (ext || (son->attr & OPEN)) { |
744 | BYTE_ALIGN(bs); | 809 | BYTE_ALIGN(bs); |
810 | if (nf_h323_error_boundary(bs, len, 0)) | ||
811 | return H323_ERROR_BOUND; | ||
745 | len = get_len(bs); | 812 | len = get_len(bs); |
746 | CHECK_BOUND(bs, len); | 813 | if (nf_h323_error_boundary(bs, len, 0)) |
814 | return H323_ERROR_BOUND; | ||
747 | if (!base || !(son->attr & DECODE)) { | 815 | if (!base || !(son->attr & DECODE)) { |
748 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ", | 816 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ", |
749 | son->name); | 817 | son->name); |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 59c08997bfdf..382d49792f42 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <net/netfilter/nf_conntrack_zones.h> | 45 | #include <net/netfilter/nf_conntrack_zones.h> |
46 | #include <net/netfilter/nf_conntrack_timestamp.h> | 46 | #include <net/netfilter/nf_conntrack_timestamp.h> |
47 | #include <net/netfilter/nf_conntrack_labels.h> | 47 | #include <net/netfilter/nf_conntrack_labels.h> |
48 | #include <net/netfilter/nf_conntrack_seqadj.h> | ||
49 | #include <net/netfilter/nf_conntrack_synproxy.h> | 48 | #include <net/netfilter/nf_conntrack_synproxy.h> |
50 | #ifdef CONFIG_NF_NAT_NEEDED | 49 | #ifdef CONFIG_NF_NAT_NEEDED |
51 | #include <net/netfilter/nf_nat_core.h> | 50 | #include <net/netfilter/nf_nat_core.h> |
@@ -1566,9 +1565,11 @@ static int ctnetlink_change_helper(struct nf_conn *ct, | |||
1566 | static int ctnetlink_change_timeout(struct nf_conn *ct, | 1565 | static int ctnetlink_change_timeout(struct nf_conn *ct, |
1567 | const struct nlattr * const cda[]) | 1566 | const struct nlattr * const cda[]) |
1568 | { | 1567 | { |
1569 | u_int32_t timeout = ntohl(nla_get_be32(cda[CTA_TIMEOUT])); | 1568 | u64 timeout = (u64)ntohl(nla_get_be32(cda[CTA_TIMEOUT])) * HZ; |
1570 | 1569 | ||
1571 | ct->timeout = nfct_time_stamp + timeout * HZ; | 1570 | if (timeout > INT_MAX) |
1571 | timeout = INT_MAX; | ||
1572 | ct->timeout = nfct_time_stamp + (u32)timeout; | ||
1572 | 1573 | ||
1573 | if (test_bit(IPS_DYING_BIT, &ct->status)) | 1574 | if (test_bit(IPS_DYING_BIT, &ct->status)) |
1574 | return -ETIME; | 1575 | return -ETIME; |
@@ -1768,6 +1769,7 @@ ctnetlink_create_conntrack(struct net *net, | |||
1768 | int err = -EINVAL; | 1769 | int err = -EINVAL; |
1769 | struct nf_conntrack_helper *helper; | 1770 | struct nf_conntrack_helper *helper; |
1770 | struct nf_conn_tstamp *tstamp; | 1771 | struct nf_conn_tstamp *tstamp; |
1772 | u64 timeout; | ||
1771 | 1773 | ||
1772 | ct = nf_conntrack_alloc(net, zone, otuple, rtuple, GFP_ATOMIC); | 1774 | ct = nf_conntrack_alloc(net, zone, otuple, rtuple, GFP_ATOMIC); |
1773 | if (IS_ERR(ct)) | 1775 | if (IS_ERR(ct)) |
@@ -1776,7 +1778,10 @@ ctnetlink_create_conntrack(struct net *net, | |||
1776 | if (!cda[CTA_TIMEOUT]) | 1778 | if (!cda[CTA_TIMEOUT]) |
1777 | goto err1; | 1779 | goto err1; |
1778 | 1780 | ||
1779 | ct->timeout = nfct_time_stamp + ntohl(nla_get_be32(cda[CTA_TIMEOUT])) * HZ; | 1781 | timeout = (u64)ntohl(nla_get_be32(cda[CTA_TIMEOUT])) * HZ; |
1782 | if (timeout > INT_MAX) | ||
1783 | timeout = INT_MAX; | ||
1784 | ct->timeout = (u32)timeout + nfct_time_stamp; | ||
1780 | 1785 | ||
1781 | rcu_read_lock(); | 1786 | rcu_read_lock(); |
1782 | if (cda[CTA_HELP]) { | 1787 | if (cda[CTA_HELP]) { |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index b12fc07111d0..37ef35b861f2 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -1039,6 +1039,9 @@ static int tcp_packet(struct nf_conn *ct, | |||
1039 | IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED && | 1039 | IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED && |
1040 | timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK]) | 1040 | timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK]) |
1041 | timeout = timeouts[TCP_CONNTRACK_UNACK]; | 1041 | timeout = timeouts[TCP_CONNTRACK_UNACK]; |
1042 | else if (ct->proto.tcp.last_win == 0 && | ||
1043 | timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS]) | ||
1044 | timeout = timeouts[TCP_CONNTRACK_RETRANS]; | ||
1042 | else | 1045 | else |
1043 | timeout = timeouts[new_state]; | 1046 | timeout = timeouts[new_state]; |
1044 | spin_unlock_bh(&ct->lock); | 1047 | spin_unlock_bh(&ct->lock); |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index d8327b43e4dc..10798b357481 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -5847,6 +5847,12 @@ static int __net_init nf_tables_init_net(struct net *net) | |||
5847 | return 0; | 5847 | return 0; |
5848 | } | 5848 | } |
5849 | 5849 | ||
5850 | static void __net_exit nf_tables_exit_net(struct net *net) | ||
5851 | { | ||
5852 | WARN_ON_ONCE(!list_empty(&net->nft.af_info)); | ||
5853 | WARN_ON_ONCE(!list_empty(&net->nft.commit_list)); | ||
5854 | } | ||
5855 | |||
5850 | int __nft_release_basechain(struct nft_ctx *ctx) | 5856 | int __nft_release_basechain(struct nft_ctx *ctx) |
5851 | { | 5857 | { |
5852 | struct nft_rule *rule, *nr; | 5858 | struct nft_rule *rule, *nr; |
@@ -5917,6 +5923,7 @@ static void __nft_release_afinfo(struct net *net, struct nft_af_info *afi) | |||
5917 | 5923 | ||
5918 | static struct pernet_operations nf_tables_net_ops = { | 5924 | static struct pernet_operations nf_tables_net_ops = { |
5919 | .init = nf_tables_init_net, | 5925 | .init = nf_tables_init_net, |
5926 | .exit = nf_tables_exit_net, | ||
5920 | }; | 5927 | }; |
5921 | 5928 | ||
5922 | static int __init nf_tables_module_init(void) | 5929 | static int __init nf_tables_module_init(void) |
diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c index 41628b393673..d33ce6d5ebce 100644 --- a/net/netfilter/nfnetlink_cthelper.c +++ b/net/netfilter/nfnetlink_cthelper.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/capability.h> | ||
20 | #include <net/netlink.h> | 21 | #include <net/netlink.h> |
21 | #include <net/sock.h> | 22 | #include <net/sock.h> |
22 | 23 | ||
@@ -407,6 +408,9 @@ static int nfnl_cthelper_new(struct net *net, struct sock *nfnl, | |||
407 | struct nfnl_cthelper *nlcth; | 408 | struct nfnl_cthelper *nlcth; |
408 | int ret = 0; | 409 | int ret = 0; |
409 | 410 | ||
411 | if (!capable(CAP_NET_ADMIN)) | ||
412 | return -EPERM; | ||
413 | |||
410 | if (!tb[NFCTH_NAME] || !tb[NFCTH_TUPLE]) | 414 | if (!tb[NFCTH_NAME] || !tb[NFCTH_TUPLE]) |
411 | return -EINVAL; | 415 | return -EINVAL; |
412 | 416 | ||
@@ -611,6 +615,9 @@ static int nfnl_cthelper_get(struct net *net, struct sock *nfnl, | |||
611 | struct nfnl_cthelper *nlcth; | 615 | struct nfnl_cthelper *nlcth; |
612 | bool tuple_set = false; | 616 | bool tuple_set = false; |
613 | 617 | ||
618 | if (!capable(CAP_NET_ADMIN)) | ||
619 | return -EPERM; | ||
620 | |||
614 | if (nlh->nlmsg_flags & NLM_F_DUMP) { | 621 | if (nlh->nlmsg_flags & NLM_F_DUMP) { |
615 | struct netlink_dump_control c = { | 622 | struct netlink_dump_control c = { |
616 | .dump = nfnl_cthelper_dump_table, | 623 | .dump = nfnl_cthelper_dump_table, |
@@ -678,6 +685,9 @@ static int nfnl_cthelper_del(struct net *net, struct sock *nfnl, | |||
678 | struct nfnl_cthelper *nlcth, *n; | 685 | struct nfnl_cthelper *nlcth, *n; |
679 | int j = 0, ret; | 686 | int j = 0, ret; |
680 | 687 | ||
688 | if (!capable(CAP_NET_ADMIN)) | ||
689 | return -EPERM; | ||
690 | |||
681 | if (tb[NFCTH_NAME]) | 691 | if (tb[NFCTH_NAME]) |
682 | helper_name = nla_data(tb[NFCTH_NAME]); | 692 | helper_name = nla_data(tb[NFCTH_NAME]); |
683 | 693 | ||
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index e5afab86381c..e955bec0acc6 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -1093,10 +1093,15 @@ static int __net_init nfnl_log_net_init(struct net *net) | |||
1093 | 1093 | ||
1094 | static void __net_exit nfnl_log_net_exit(struct net *net) | 1094 | static void __net_exit nfnl_log_net_exit(struct net *net) |
1095 | { | 1095 | { |
1096 | struct nfnl_log_net *log = nfnl_log_pernet(net); | ||
1097 | unsigned int i; | ||
1098 | |||
1096 | #ifdef CONFIG_PROC_FS | 1099 | #ifdef CONFIG_PROC_FS |
1097 | remove_proc_entry("nfnetlink_log", net->nf.proc_netfilter); | 1100 | remove_proc_entry("nfnetlink_log", net->nf.proc_netfilter); |
1098 | #endif | 1101 | #endif |
1099 | nf_log_unset(net, &nfulnl_logger); | 1102 | nf_log_unset(net, &nfulnl_logger); |
1103 | for (i = 0; i < INSTANCE_BUCKETS; i++) | ||
1104 | WARN_ON_ONCE(!hlist_empty(&log->instance_table[i])); | ||
1100 | } | 1105 | } |
1101 | 1106 | ||
1102 | static struct pernet_operations nfnl_log_net_ops = { | 1107 | static struct pernet_operations nfnl_log_net_ops = { |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index a16356cacec3..c09b36755ed7 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -1512,10 +1512,15 @@ static int __net_init nfnl_queue_net_init(struct net *net) | |||
1512 | 1512 | ||
1513 | static void __net_exit nfnl_queue_net_exit(struct net *net) | 1513 | static void __net_exit nfnl_queue_net_exit(struct net *net) |
1514 | { | 1514 | { |
1515 | struct nfnl_queue_net *q = nfnl_queue_pernet(net); | ||
1516 | unsigned int i; | ||
1517 | |||
1515 | nf_unregister_queue_handler(net); | 1518 | nf_unregister_queue_handler(net); |
1516 | #ifdef CONFIG_PROC_FS | 1519 | #ifdef CONFIG_PROC_FS |
1517 | remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter); | 1520 | remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter); |
1518 | #endif | 1521 | #endif |
1522 | for (i = 0; i < INSTANCE_BUCKETS; i++) | ||
1523 | WARN_ON_ONCE(!hlist_empty(&q->instance_table[i])); | ||
1519 | } | 1524 | } |
1520 | 1525 | ||
1521 | static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list) | 1526 | static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list) |
diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c index a0a93d987a3b..47ec1046ad11 100644 --- a/net/netfilter/nft_exthdr.c +++ b/net/netfilter/nft_exthdr.c | |||
@@ -214,6 +214,8 @@ static const struct nla_policy nft_exthdr_policy[NFTA_EXTHDR_MAX + 1] = { | |||
214 | [NFTA_EXTHDR_OFFSET] = { .type = NLA_U32 }, | 214 | [NFTA_EXTHDR_OFFSET] = { .type = NLA_U32 }, |
215 | [NFTA_EXTHDR_LEN] = { .type = NLA_U32 }, | 215 | [NFTA_EXTHDR_LEN] = { .type = NLA_U32 }, |
216 | [NFTA_EXTHDR_FLAGS] = { .type = NLA_U32 }, | 216 | [NFTA_EXTHDR_FLAGS] = { .type = NLA_U32 }, |
217 | [NFTA_EXTHDR_OP] = { .type = NLA_U32 }, | ||
218 | [NFTA_EXTHDR_SREG] = { .type = NLA_U32 }, | ||
217 | }; | 219 | }; |
218 | 220 | ||
219 | static int nft_exthdr_init(const struct nft_ctx *ctx, | 221 | static int nft_exthdr_init(const struct nft_ctx *ctx, |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index a77dd514297c..55802e97f906 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -1729,8 +1729,17 @@ static int __net_init xt_net_init(struct net *net) | |||
1729 | return 0; | 1729 | return 0; |
1730 | } | 1730 | } |
1731 | 1731 | ||
1732 | static void __net_exit xt_net_exit(struct net *net) | ||
1733 | { | ||
1734 | int i; | ||
1735 | |||
1736 | for (i = 0; i < NFPROTO_NUMPROTO; i++) | ||
1737 | WARN_ON_ONCE(!list_empty(&net->xt.tables[i])); | ||
1738 | } | ||
1739 | |||
1732 | static struct pernet_operations xt_net_ops = { | 1740 | static struct pernet_operations xt_net_ops = { |
1733 | .init = xt_net_init, | 1741 | .init = xt_net_init, |
1742 | .exit = xt_net_exit, | ||
1734 | }; | 1743 | }; |
1735 | 1744 | ||
1736 | static int __init xt_init(void) | 1745 | static int __init xt_init(void) |
diff --git a/net/netfilter/xt_bpf.c b/net/netfilter/xt_bpf.c index 041da0d9c06f..1f7fbd3c7e5a 100644 --- a/net/netfilter/xt_bpf.c +++ b/net/netfilter/xt_bpf.c | |||
@@ -27,6 +27,9 @@ static int __bpf_mt_check_bytecode(struct sock_filter *insns, __u16 len, | |||
27 | { | 27 | { |
28 | struct sock_fprog_kern program; | 28 | struct sock_fprog_kern program; |
29 | 29 | ||
30 | if (len > XT_BPF_MAX_NUM_INSTR) | ||
31 | return -EINVAL; | ||
32 | |||
30 | program.len = len; | 33 | program.len = len; |
31 | program.filter = insns; | 34 | program.filter = insns; |
32 | 35 | ||
@@ -55,6 +58,9 @@ static int __bpf_mt_check_path(const char *path, struct bpf_prog **ret) | |||
55 | mm_segment_t oldfs = get_fs(); | 58 | mm_segment_t oldfs = get_fs(); |
56 | int retval, fd; | 59 | int retval, fd; |
57 | 60 | ||
61 | if (strnlen(path, XT_BPF_PATH_MAX) == XT_BPF_PATH_MAX) | ||
62 | return -EINVAL; | ||
63 | |||
58 | set_fs(KERNEL_DS); | 64 | set_fs(KERNEL_DS); |
59 | fd = bpf_obj_get_user(path, 0); | 65 | fd = bpf_obj_get_user(path, 0); |
60 | set_fs(oldfs); | 66 | set_fs(oldfs); |
diff --git a/net/netfilter/xt_osf.c b/net/netfilter/xt_osf.c index 36e14b1f061d..a34f314a8c23 100644 --- a/net/netfilter/xt_osf.c +++ b/net/netfilter/xt_osf.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | 21 | ||
22 | #include <linux/capability.h> | ||
22 | #include <linux/if.h> | 23 | #include <linux/if.h> |
23 | #include <linux/inetdevice.h> | 24 | #include <linux/inetdevice.h> |
24 | #include <linux/ip.h> | 25 | #include <linux/ip.h> |
@@ -70,6 +71,9 @@ static int xt_osf_add_callback(struct net *net, struct sock *ctnl, | |||
70 | struct xt_osf_finger *kf = NULL, *sf; | 71 | struct xt_osf_finger *kf = NULL, *sf; |
71 | int err = 0; | 72 | int err = 0; |
72 | 73 | ||
74 | if (!capable(CAP_NET_ADMIN)) | ||
75 | return -EPERM; | ||
76 | |||
73 | if (!osf_attrs[OSF_ATTR_FINGER]) | 77 | if (!osf_attrs[OSF_ATTR_FINGER]) |
74 | return -EINVAL; | 78 | return -EINVAL; |
75 | 79 | ||
@@ -115,6 +119,9 @@ static int xt_osf_remove_callback(struct net *net, struct sock *ctnl, | |||
115 | struct xt_osf_finger *sf; | 119 | struct xt_osf_finger *sf; |
116 | int err = -ENOENT; | 120 | int err = -ENOENT; |
117 | 121 | ||
122 | if (!capable(CAP_NET_ADMIN)) | ||
123 | return -EPERM; | ||
124 | |||
118 | if (!osf_attrs[OSF_ATTR_FINGER]) | 125 | if (!osf_attrs[OSF_ATTR_FINGER]) |
119 | return -EINVAL; | 126 | return -EINVAL; |
120 | 127 | ||
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index b9e0ee4e22f5..79cc1bf36e4a 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -253,6 +253,9 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb, | |||
253 | struct sock *sk = skb->sk; | 253 | struct sock *sk = skb->sk; |
254 | int ret = -ENOMEM; | 254 | int ret = -ENOMEM; |
255 | 255 | ||
256 | if (!net_eq(dev_net(dev), sock_net(sk))) | ||
257 | return 0; | ||
258 | |||
256 | dev_hold(dev); | 259 | dev_hold(dev); |
257 | 260 | ||
258 | if (is_vmalloc_addr(skb->head)) | 261 | if (is_vmalloc_addr(skb->head)) |
diff --git a/net/sched/act_meta_mark.c b/net/sched/act_meta_mark.c index 1e3f10e5da99..6445184b2759 100644 --- a/net/sched/act_meta_mark.c +++ b/net/sched/act_meta_mark.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <net/pkt_sched.h> | 22 | #include <net/pkt_sched.h> |
23 | #include <uapi/linux/tc_act/tc_ife.h> | 23 | #include <uapi/linux/tc_act/tc_ife.h> |
24 | #include <net/tc_act/tc_ife.h> | 24 | #include <net/tc_act/tc_ife.h> |
25 | #include <linux/rtnetlink.h> | ||
26 | 25 | ||
27 | static int skbmark_encode(struct sk_buff *skb, void *skbdata, | 26 | static int skbmark_encode(struct sk_buff *skb, void *skbdata, |
28 | struct tcf_meta_info *e) | 27 | struct tcf_meta_info *e) |
diff --git a/net/sched/act_meta_skbtcindex.c b/net/sched/act_meta_skbtcindex.c index 2ea1f26c9e96..7221437ca3a6 100644 --- a/net/sched/act_meta_skbtcindex.c +++ b/net/sched/act_meta_skbtcindex.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <net/pkt_sched.h> | 22 | #include <net/pkt_sched.h> |
23 | #include <uapi/linux/tc_act/tc_ife.h> | 23 | #include <uapi/linux/tc_act/tc_ife.h> |
24 | #include <net/tc_act/tc_ife.h> | 24 | #include <net/tc_act/tc_ife.h> |
25 | #include <linux/rtnetlink.h> | ||
26 | 25 | ||
27 | static int skbtcindex_encode(struct sk_buff *skb, void *skbdata, | 26 | static int skbtcindex_encode(struct sk_buff *skb, void *skbdata, |
28 | struct tcf_meta_info *e) | 27 | struct tcf_meta_info *e) |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index ddcf04b4ab43..b91ea03e3afa 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/kmod.h> | 25 | #include <linux/kmod.h> |
26 | #include <linux/err.h> | ||
27 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
28 | #include <net/net_namespace.h> | 27 | #include <net/net_namespace.h> |
29 | #include <net/sock.h> | 28 | #include <net/sock.h> |
@@ -352,6 +351,8 @@ void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q, | |||
352 | { | 351 | { |
353 | struct tcf_chain *chain; | 352 | struct tcf_chain *chain; |
354 | 353 | ||
354 | if (!block) | ||
355 | return; | ||
355 | /* Hold a refcnt for all chains, except 0, so that they don't disappear | 356 | /* Hold a refcnt for all chains, except 0, so that they don't disappear |
356 | * while we are iterating. | 357 | * while we are iterating. |
357 | */ | 358 | */ |
@@ -378,8 +379,6 @@ void tcf_block_put(struct tcf_block *block) | |||
378 | { | 379 | { |
379 | struct tcf_block_ext_info ei = {0, }; | 380 | struct tcf_block_ext_info ei = {0, }; |
380 | 381 | ||
381 | if (!block) | ||
382 | return; | ||
383 | tcf_block_put_ext(block, block->q, &ei); | 382 | tcf_block_put_ext(block, block->q, &ei); |
384 | } | 383 | } |
385 | 384 | ||
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index ac152b4f4247..507859cdd1cb 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <net/netlink.h> | 45 | #include <net/netlink.h> |
46 | #include <net/act_api.h> | 46 | #include <net/act_api.h> |
47 | #include <net/pkt_cls.h> | 47 | #include <net/pkt_cls.h> |
48 | #include <linux/netdevice.h> | ||
49 | #include <linux/idr.h> | 48 | #include <linux/idr.h> |
50 | 49 | ||
51 | struct tc_u_knode { | 50 | struct tc_u_knode { |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index b6c4f536876b..0f1eab99ff4e 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -795,6 +795,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
795 | tcm->tcm_info = refcount_read(&q->refcnt); | 795 | tcm->tcm_info = refcount_read(&q->refcnt); |
796 | if (nla_put_string(skb, TCA_KIND, q->ops->id)) | 796 | if (nla_put_string(skb, TCA_KIND, q->ops->id)) |
797 | goto nla_put_failure; | 797 | goto nla_put_failure; |
798 | if (nla_put_u8(skb, TCA_HW_OFFLOAD, !!(q->flags & TCQ_F_OFFLOADED))) | ||
799 | goto nla_put_failure; | ||
798 | if (q->ops->dump && q->ops->dump(q, skb) < 0) | 800 | if (q->ops->dump && q->ops->dump(q, skb) < 0) |
799 | goto nla_put_failure; | 801 | goto nla_put_failure; |
800 | qlen = q->q.qlen; | 802 | qlen = q->q.qlen; |
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index 5ecc38f35d47..fc1286f499c1 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c | |||
@@ -68,6 +68,8 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt) | |||
68 | struct net_device *dev = qdisc_dev(sch); | 68 | struct net_device *dev = qdisc_dev(sch); |
69 | int err; | 69 | int err; |
70 | 70 | ||
71 | net_inc_ingress_queue(); | ||
72 | |||
71 | mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress); | 73 | mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress); |
72 | 74 | ||
73 | q->block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; | 75 | q->block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; |
@@ -78,7 +80,6 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt) | |||
78 | if (err) | 80 | if (err) |
79 | return err; | 81 | return err; |
80 | 82 | ||
81 | net_inc_ingress_queue(); | ||
82 | sch->flags |= TCQ_F_CPUSTATS; | 83 | sch->flags |= TCQ_F_CPUSTATS; |
83 | 84 | ||
84 | return 0; | 85 | return 0; |
@@ -172,6 +173,9 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt) | |||
172 | struct net_device *dev = qdisc_dev(sch); | 173 | struct net_device *dev = qdisc_dev(sch); |
173 | int err; | 174 | int err; |
174 | 175 | ||
176 | net_inc_ingress_queue(); | ||
177 | net_inc_egress_queue(); | ||
178 | |||
175 | mini_qdisc_pair_init(&q->miniqp_ingress, sch, &dev->miniq_ingress); | 179 | mini_qdisc_pair_init(&q->miniqp_ingress, sch, &dev->miniq_ingress); |
176 | 180 | ||
177 | q->ingress_block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; | 181 | q->ingress_block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; |
@@ -190,18 +194,11 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt) | |||
190 | 194 | ||
191 | err = tcf_block_get_ext(&q->egress_block, sch, &q->egress_block_info); | 195 | err = tcf_block_get_ext(&q->egress_block, sch, &q->egress_block_info); |
192 | if (err) | 196 | if (err) |
193 | goto err_egress_block_get; | 197 | return err; |
194 | |||
195 | net_inc_ingress_queue(); | ||
196 | net_inc_egress_queue(); | ||
197 | 198 | ||
198 | sch->flags |= TCQ_F_CPUSTATS; | 199 | sch->flags |= TCQ_F_CPUSTATS; |
199 | 200 | ||
200 | return 0; | 201 | return 0; |
201 | |||
202 | err_egress_block_get: | ||
203 | tcf_block_put_ext(q->ingress_block, sch, &q->ingress_block_info); | ||
204 | return err; | ||
205 | } | 202 | } |
206 | 203 | ||
207 | static void clsact_destroy(struct Qdisc *sch) | 204 | static void clsact_destroy(struct Qdisc *sch) |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 9d874e60e032..f0747eb87dc4 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -157,6 +157,7 @@ static int red_offload(struct Qdisc *sch, bool enable) | |||
157 | .handle = sch->handle, | 157 | .handle = sch->handle, |
158 | .parent = sch->parent, | 158 | .parent = sch->parent, |
159 | }; | 159 | }; |
160 | int err; | ||
160 | 161 | ||
161 | if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) | 162 | if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) |
162 | return -EOPNOTSUPP; | 163 | return -EOPNOTSUPP; |
@@ -171,7 +172,14 @@ static int red_offload(struct Qdisc *sch, bool enable) | |||
171 | opt.command = TC_RED_DESTROY; | 172 | opt.command = TC_RED_DESTROY; |
172 | } | 173 | } |
173 | 174 | ||
174 | return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt); | 175 | err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt); |
176 | |||
177 | if (!err && enable) | ||
178 | sch->flags |= TCQ_F_OFFLOADED; | ||
179 | else | ||
180 | sch->flags &= ~TCQ_F_OFFLOADED; | ||
181 | |||
182 | return err; | ||
175 | } | 183 | } |
176 | 184 | ||
177 | static void red_destroy(struct Qdisc *sch) | 185 | static void red_destroy(struct Qdisc *sch) |
@@ -274,7 +282,7 @@ static int red_init(struct Qdisc *sch, struct nlattr *opt) | |||
274 | return red_change(sch, opt); | 282 | return red_change(sch, opt); |
275 | } | 283 | } |
276 | 284 | ||
277 | static int red_dump_offload(struct Qdisc *sch, struct tc_red_qopt *opt) | 285 | static int red_dump_offload_stats(struct Qdisc *sch, struct tc_red_qopt *opt) |
278 | { | 286 | { |
279 | struct net_device *dev = qdisc_dev(sch); | 287 | struct net_device *dev = qdisc_dev(sch); |
280 | struct tc_red_qopt_offload hw_stats = { | 288 | struct tc_red_qopt_offload hw_stats = { |
@@ -286,21 +294,12 @@ static int red_dump_offload(struct Qdisc *sch, struct tc_red_qopt *opt) | |||
286 | .stats.qstats = &sch->qstats, | 294 | .stats.qstats = &sch->qstats, |
287 | }, | 295 | }, |
288 | }; | 296 | }; |
289 | int err; | ||
290 | 297 | ||
291 | opt->flags &= ~TC_RED_OFFLOADED; | 298 | if (!(sch->flags & TCQ_F_OFFLOADED)) |
292 | if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) | ||
293 | return 0; | ||
294 | |||
295 | err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, | ||
296 | &hw_stats); | ||
297 | if (err == -EOPNOTSUPP) | ||
298 | return 0; | 299 | return 0; |
299 | 300 | ||
300 | if (!err) | 301 | return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, |
301 | opt->flags |= TC_RED_OFFLOADED; | 302 | &hw_stats); |
302 | |||
303 | return err; | ||
304 | } | 303 | } |
305 | 304 | ||
306 | static int red_dump(struct Qdisc *sch, struct sk_buff *skb) | 305 | static int red_dump(struct Qdisc *sch, struct sk_buff *skb) |
@@ -319,7 +318,7 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
319 | int err; | 318 | int err; |
320 | 319 | ||
321 | sch->qstats.backlog = q->qdisc->qstats.backlog; | 320 | sch->qstats.backlog = q->qdisc->qstats.backlog; |
322 | err = red_dump_offload(sch, &opt); | 321 | err = red_dump_offload_stats(sch, &opt); |
323 | if (err) | 322 | if (err) |
324 | goto nla_put_failure; | 323 | goto nla_put_failure; |
325 | 324 | ||
@@ -347,7 +346,7 @@ static int red_dump_stats(struct Qdisc *sch, struct gnet_dump *d) | |||
347 | .marked = q->stats.prob_mark + q->stats.forced_mark, | 346 | .marked = q->stats.prob_mark + q->stats.forced_mark, |
348 | }; | 347 | }; |
349 | 348 | ||
350 | if (tc_can_offload(dev) && dev->netdev_ops->ndo_setup_tc) { | 349 | if (sch->flags & TCQ_F_OFFLOADED) { |
351 | struct red_stats hw_stats = {0}; | 350 | struct red_stats hw_stats = {0}; |
352 | struct tc_red_qopt_offload hw_stats_request = { | 351 | struct tc_red_qopt_offload hw_stats_request = { |
353 | .command = TC_RED_XSTATS, | 352 | .command = TC_RED_XSTATS, |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index eb17a911aa29..3253f724a995 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -3891,13 +3891,17 @@ static int sctp_setsockopt_reset_streams(struct sock *sk, | |||
3891 | struct sctp_association *asoc; | 3891 | struct sctp_association *asoc; |
3892 | int retval = -EINVAL; | 3892 | int retval = -EINVAL; |
3893 | 3893 | ||
3894 | if (optlen < sizeof(struct sctp_reset_streams)) | 3894 | if (optlen < sizeof(*params)) |
3895 | return -EINVAL; | 3895 | return -EINVAL; |
3896 | 3896 | ||
3897 | params = memdup_user(optval, optlen); | 3897 | params = memdup_user(optval, optlen); |
3898 | if (IS_ERR(params)) | 3898 | if (IS_ERR(params)) |
3899 | return PTR_ERR(params); | 3899 | return PTR_ERR(params); |
3900 | 3900 | ||
3901 | if (params->srs_number_streams * sizeof(__u16) > | ||
3902 | optlen - sizeof(*params)) | ||
3903 | goto out; | ||
3904 | |||
3901 | asoc = sctp_id2assoc(sk, params->srs_assoc_id); | 3905 | asoc = sctp_id2assoc(sk, params->srs_assoc_id); |
3902 | if (!asoc) | 3906 | if (!asoc) |
3903 | goto out; | 3907 | goto out; |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 5d18c0caa92b..41127d0b925e 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1140,7 +1140,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq, | |||
1140 | __skb_dequeue(arrvq); | 1140 | __skb_dequeue(arrvq); |
1141 | __skb_queue_tail(inputq, skb); | 1141 | __skb_queue_tail(inputq, skb); |
1142 | } | 1142 | } |
1143 | refcount_dec(&skb->users); | 1143 | kfree_skb(skb); |
1144 | spin_unlock_bh(&inputq->lock); | 1144 | spin_unlock_bh(&inputq->lock); |
1145 | continue; | 1145 | continue; |
1146 | } | 1146 | } |
diff --git a/net/wireless/Makefile b/net/wireless/Makefile index 278d979c211a..d7d6cb00c47b 100644 --- a/net/wireless/Makefile +++ b/net/wireless/Makefile | |||
@@ -25,17 +25,45 @@ endif | |||
25 | 25 | ||
26 | $(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.x509) | 26 | $(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.x509) |
27 | @$(kecho) " GEN $@" | 27 | @$(kecho) " GEN $@" |
28 | @echo '#include "reg.h"' > $@ | 28 | @(set -e; \ |
29 | @echo 'const u8 shipped_regdb_certs[] = {' >> $@ | 29 | allf=""; \ |
30 | @for f in $^ ; do hexdump -v -e '1/1 "0x%.2x," "\n"' < $$f >> $@ ; done | 30 | for f in $^ ; do \ |
31 | @echo '};' >> $@ | 31 | # similar to hexdump -v -e '1/1 "0x%.2x," "\n"' \ |
32 | @echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);' >> $@ | 32 | thisf=$$(od -An -v -tx1 < $$f | \ |
33 | sed -e 's/ /\n/g' | \ | ||
34 | sed -e 's/^[0-9a-f]\+$$/\0/;t;d' | \ | ||
35 | sed -e 's/^/0x/;s/$$/,/'); \ | ||
36 | # file should not be empty - maybe command substitution failed? \ | ||
37 | test ! -z "$$thisf";\ | ||
38 | allf=$$allf$$thisf;\ | ||
39 | done; \ | ||
40 | ( \ | ||
41 | echo '#include "reg.h"'; \ | ||
42 | echo 'const u8 shipped_regdb_certs[] = {'; \ | ||
43 | echo "$$allf"; \ | ||
44 | echo '};'; \ | ||
45 | echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \ | ||
46 | ) >> $@) | ||
33 | 47 | ||
34 | $(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%) \ | 48 | $(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%) \ |
35 | $(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%)/*.x509) | 49 | $(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%)/*.x509) |
36 | @$(kecho) " GEN $@" | 50 | @$(kecho) " GEN $@" |
37 | @echo '#include "reg.h"' > $@ | 51 | @(set -e; \ |
38 | @echo 'const u8 extra_regdb_certs[] = {' >> $@ | 52 | allf=""; \ |
39 | @for f in $^ ; do test -f $$f && hexdump -v -e '1/1 "0x%.2x," "\n"' < $$f >> $@ || true ; done | 53 | for f in $^ ; do \ |
40 | @echo '};' >> $@ | 54 | # similar to hexdump -v -e '1/1 "0x%.2x," "\n"' \ |
41 | @echo 'unsigned int extra_regdb_certs_len = sizeof(extra_regdb_certs);' >> $@ | 55 | thisf=$$(od -An -v -tx1 < $$f | \ |
56 | sed -e 's/ /\n/g' | \ | ||
57 | sed -e 's/^[0-9a-f]\+$$/\0/;t;d' | \ | ||
58 | sed -e 's/^/0x/;s/$$/,/'); \ | ||
59 | # file should not be empty - maybe command substitution failed? \ | ||
60 | test ! -z "$$thisf";\ | ||
61 | allf=$$allf$$thisf;\ | ||
62 | done; \ | ||
63 | ( \ | ||
64 | echo '#include "reg.h"'; \ | ||
65 | echo 'const u8 extra_regdb_certs[] = {'; \ | ||
66 | echo "$$allf"; \ | ||
67 | echo '};'; \ | ||
68 | echo 'unsigned int extra_regdb_certs_len = sizeof(extra_regdb_certs);'; \ | ||
69 | ) >> $@) | ||
diff --git a/tools/include/uapi/asm/bpf_perf_event.h b/tools/include/uapi/asm/bpf_perf_event.h new file mode 100644 index 000000000000..13a58531e6fa --- /dev/null +++ b/tools/include/uapi/asm/bpf_perf_event.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #if defined(__aarch64__) | ||
2 | #include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h" | ||
3 | #elif defined(__s390__) | ||
4 | #include "../../arch/s390/include/uapi/asm/bpf_perf_event.h" | ||
5 | #else | ||
6 | #include <uapi/asm-generic/bpf_perf_event.h> | ||
7 | #endif | ||
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 21a2d76b67dc..792af7c3b74f 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile | |||
@@ -1,19 +1,8 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
2 | 2 | ||
3 | ifeq ($(srctree),) | ||
4 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) | ||
5 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
6 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
7 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
8 | endif | ||
9 | include $(srctree)/tools/scripts/Makefile.arch | ||
10 | |||
11 | $(call detected_var,SRCARCH) | ||
12 | |||
13 | LIBDIR := ../../../lib | 3 | LIBDIR := ../../../lib |
14 | BPFDIR := $(LIBDIR)/bpf | 4 | BPFDIR := $(LIBDIR)/bpf |
15 | APIDIR := ../../../include/uapi | 5 | APIDIR := ../../../include/uapi |
16 | ASMDIR:= ../../../arch/$(ARCH)/include/uapi | ||
17 | GENDIR := ../../../../include/generated | 6 | GENDIR := ../../../../include/generated |
18 | GENHDR := $(GENDIR)/autoconf.h | 7 | GENHDR := $(GENDIR)/autoconf.h |
19 | 8 | ||
@@ -21,7 +10,7 @@ ifneq ($(wildcard $(GENHDR)),) | |||
21 | GENFLAGS := -DHAVE_GENHDR | 10 | GENFLAGS := -DHAVE_GENHDR |
22 | endif | 11 | endif |
23 | 12 | ||
24 | CFLAGS += -Wall -O2 -I$(APIDIR) -I$(ASMDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include | 13 | CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include |
25 | LDLIBS += -lcap -lelf | 14 | LDLIBS += -lcap -lelf |
26 | 15 | ||
27 | TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \ | 16 | TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \ |