Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:
"Mostly small bits scattered all over the place, which is usually how
things go this late in the -rc series.

1) Proper driver init device resets in bnx2, from Baoquan He.

2) Fix accounting overflow in __tcp_retransmit_skb(),
sk_forward_alloc, and ip_idents_reserve, from Eric Dumazet.

3) Fix crash in bna driver ethtool stats handling, from Ivan Vecera.

4) Missing check of skb_linearize() return value in mac80211, from
Johannes Berg.

5) Endianness fix in nf_table_trace dumps, from Liping Zhang.

6) SSN comparison fix in SCTP, from Marcelo Ricardo Leitner.

7) Update DSA and b44 MAINTAINERS entries.

8) Make input path of vti6 driver work again, from Nicolas Dichtel.

9) Off-by-one in mlx4, from Sebastian Ott.

10) Fix fallback route lookup handling in ipv6, from Vincent Bernat.

11) Fix stack corruption on probe in qed driver, from Yuval Mintz.

12) PHY init fixes in r8152 from Hayes Wang.

13) Missing SKB free in irda_accept error path, from Phil Turnbull"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (61 commits)
tcp: properly account Fast Open SYN-ACK retrans
tcp: fix under-accounting retransmit SNMP counters
MAINTAINERS: Update b44 maintainer.
net: get rid of an signed integer overflow in ip_idents_reserve()
net/mlx4_core: Fix to clean devlink resources
net: can: ifi: Configure transmitter delay
vti6: fix input path
ipmr, ip6mr: return lastuse relative to now
r8152: disable ALDPS and EEE before setting PHY
r8152: remove r8153_enable_eee
r8152: move PHY settings to hw_phy_cfg
r8152: move enabling PHY
r8152: move some functions
cxgb4/cxgb4vf: Allocate more queues for 25G and 100G adapter
qed: Fix stack corruption on probe
MAINTAINERS: Add an entry for the core network DSA code
net: ipv6: fallback to full lookup if table lookup is unsuitable
net/mlx5: E-Switch, Handle mode change failures
net/mlx5: E-Switch, Fix error flow in the SRIOV e-switch init code
net/mlx5: Fix flow counter bulk command out mailbox allocation
...

+657 -342
+10 -1
MAINTAINERS
··· 2501 2501 F: kernel/bpf/ 2502 2502 2503 2503 BROADCOM B44 10/100 ETHERNET DRIVER 2504 - M: Gary Zambrano <zambrano@broadcom.com> 2504 + M: Michael Chan <michael.chan@broadcom.com> 2505 2505 L: netdev@vger.kernel.org 2506 2506 S: Supported 2507 2507 F: drivers/net/ethernet/broadcom/b44.* ··· 8160 8160 S: Maintained 8161 8161 W: https://fedorahosted.org/dropwatch/ 8162 8162 F: net/core/drop_monitor.c 8163 + 8164 + NETWORKING [DSA] 8165 + M: Andrew Lunn <andrew@lunn.ch> 8166 + M: Vivien Didelot <vivien.didelot@savoirfairelinux.com> 8167 + M: Florian Fainelli <f.fainelli@gmail.com> 8168 + S: Maintained 8169 + F: net/dsa/ 8170 + F: include/net/dsa.h 8171 + F: drivers/net/dsa/ 8163 8172 8164 8173 NETWORKING [GENERAL] 8165 8174 M: "David S. Miller" <davem@davemloft.net>
+8 -5
drivers/net/can/flexcan.c
··· 1268 1268 struct flexcan_priv *priv = netdev_priv(dev); 1269 1269 int err; 1270 1270 1271 - err = flexcan_chip_disable(priv); 1272 - if (err) 1273 - return err; 1274 - 1275 1271 if (netif_running(dev)) { 1272 + err = flexcan_chip_disable(priv); 1273 + if (err) 1274 + return err; 1276 1275 netif_stop_queue(dev); 1277 1276 netif_device_detach(dev); 1278 1277 } ··· 1284 1285 { 1285 1286 struct net_device *dev = dev_get_drvdata(device); 1286 1287 struct flexcan_priv *priv = netdev_priv(dev); 1288 + int err; 1287 1289 1288 1290 priv->can.state = CAN_STATE_ERROR_ACTIVE; 1289 1291 if (netif_running(dev)) { 1290 1292 netif_device_attach(dev); 1291 1293 netif_start_queue(dev); 1294 + err = flexcan_chip_enable(priv); 1295 + if (err) 1296 + return err; 1292 1297 } 1293 - return flexcan_chip_enable(priv); 1298 + return 0; 1294 1299 } 1295 1300 1296 1301 static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume);
+10 -1
drivers/net/can/ifi_canfd/ifi_canfd.c
··· 81 81 #define IFI_CANFD_TIME_SET_TIMEA_4_12_6_6 BIT(15) 82 82 83 83 #define IFI_CANFD_TDELAY 0x1c 84 + #define IFI_CANFD_TDELAY_DEFAULT 0xb 85 + #define IFI_CANFD_TDELAY_MASK 0x3fff 86 + #define IFI_CANFD_TDELAY_ABS BIT(14) 87 + #define IFI_CANFD_TDELAY_EN BIT(15) 84 88 85 89 #define IFI_CANFD_ERROR 0x20 86 90 #define IFI_CANFD_ERROR_TX_OFFSET 0 ··· 645 641 struct ifi_canfd_priv *priv = netdev_priv(ndev); 646 642 const struct can_bittiming *bt = &priv->can.bittiming; 647 643 const struct can_bittiming *dbt = &priv->can.data_bittiming; 648 - u16 brp, sjw, tseg1, tseg2; 644 + u16 brp, sjw, tseg1, tseg2, tdc; 649 645 650 646 /* Configure bit timing */ 651 647 brp = bt->brp - 2; ··· 668 664 (brp << IFI_CANFD_TIME_PRESCALE_OFF) | 669 665 (sjw << IFI_CANFD_TIME_SJW_OFF_7_9_8_8), 670 666 priv->base + IFI_CANFD_FTIME); 667 + 668 + /* Configure transmitter delay */ 669 + tdc = (dbt->brp * (dbt->phase_seg1 + 1)) & IFI_CANFD_TDELAY_MASK; 670 + writel(IFI_CANFD_TDELAY_EN | IFI_CANFD_TDELAY_ABS | tdc, 671 + priv->base + IFI_CANFD_TDELAY); 671 672 } 672 673 673 674 static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id,
+7 -5
drivers/net/ethernet/broadcom/bnx2.c
··· 6356 6356 struct bnx2 *bp = netdev_priv(dev); 6357 6357 int rc; 6358 6358 6359 - rc = bnx2_request_firmware(bp); 6360 - if (rc < 0) 6361 - goto out; 6362 - 6363 6359 netif_carrier_off(dev); 6364 6360 6365 6361 bnx2_disable_int(bp); ··· 6424 6428 bnx2_free_irq(bp); 6425 6429 bnx2_free_mem(bp); 6426 6430 bnx2_del_napi(bp); 6427 - bnx2_release_firmware(bp); 6428 6431 goto out; 6429 6432 } 6430 6433 ··· 8570 8575 8571 8576 pci_set_drvdata(pdev, dev); 8572 8577 8578 + rc = bnx2_request_firmware(bp); 8579 + if (rc < 0) 8580 + goto error; 8581 + 8582 + 8583 + bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); 8573 8584 memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN); 8574 8585 8575 8586 dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | ··· 8608 8607 return 0; 8609 8608 8610 8609 error: 8610 + bnx2_release_firmware(bp); 8611 8611 pci_iounmap(pdev, bp->regview); 8612 8612 pci_release_regions(pdev); 8613 8613 pci_disable_device(pdev);
+28 -27
drivers/net/ethernet/brocade/bna/bnad_ethtool.c
··· 31 31 #define BNAD_NUM_TXF_COUNTERS 12 32 32 #define BNAD_NUM_RXF_COUNTERS 10 33 33 #define BNAD_NUM_CQ_COUNTERS (3 + 5) 34 - #define BNAD_NUM_RXQ_COUNTERS 6 34 + #define BNAD_NUM_RXQ_COUNTERS 7 35 35 #define BNAD_NUM_TXQ_COUNTERS 5 36 36 37 - #define BNAD_ETHTOOL_STATS_NUM \ 38 - (sizeof(struct rtnl_link_stats64) / sizeof(u64) + \ 39 - sizeof(struct bnad_drv_stats) / sizeof(u64) + \ 40 - offsetof(struct bfi_enet_stats, rxf_stats[0]) / sizeof(u64)) 41 - 42 - static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { 37 + static const char *bnad_net_stats_strings[] = { 43 38 "rx_packets", 44 39 "tx_packets", 45 40 "rx_bytes", ··· 45 50 "tx_dropped", 46 51 "multicast", 47 52 "collisions", 48 - 49 53 "rx_length_errors", 50 - "rx_over_errors", 51 54 "rx_crc_errors", 52 55 "rx_frame_errors", 53 - "rx_fifo_errors", 54 - "rx_missed_errors", 55 - 56 - "tx_aborted_errors", 57 - "tx_carrier_errors", 58 56 "tx_fifo_errors", 59 - "tx_heartbeat_errors", 60 - "tx_window_errors", 61 - 62 - "rx_compressed", 63 - "tx_compressed", 64 57 65 58 "netif_queue_stop", 66 59 "netif_queue_wakeup", ··· 236 253 "fc_tx_timeout", 237 254 "fc_tx_fid_parity_errors", 238 255 }; 256 + 257 + #define BNAD_ETHTOOL_STATS_NUM ARRAY_SIZE(bnad_net_stats_strings) 239 258 240 259 static int 241 260 bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) ··· 643 658 string += ETH_GSTRING_LEN; 644 659 sprintf(string, "rxq%d_allocbuf_failed", q_num); 645 660 string += ETH_GSTRING_LEN; 661 + sprintf(string, "rxq%d_mapbuf_failed", q_num); 662 + string += ETH_GSTRING_LEN; 646 663 sprintf(string, "rxq%d_producer_index", q_num); 647 664 string += ETH_GSTRING_LEN; 648 665 sprintf(string, "rxq%d_consumer_index", q_num); ··· 664 677 string += ETH_GSTRING_LEN; 665 678 sprintf(string, "rxq%d_allocbuf_failed", 666 679 q_num); 680 + string += ETH_GSTRING_LEN; 681 + sprintf(string, "rxq%d_mapbuf_failed", 682 + q_num); 667 683 string += ETH_GSTRING_LEN; 668 684 sprintf(string, "rxq%d_producer_index", 669 685 q_num); ··· 844 854 u64 *buf) 845 855 { 846 856 struct bnad *bnad = netdev_priv(netdev); 847 - int i, j, bi; 857 + int i, j, bi = 0; 848 858 unsigned long flags; 849 - struct rtnl_link_stats64 *net_stats64; 859 + struct rtnl_link_stats64 net_stats64; 850 860 u64 *stats64; 851 861 u32 bmap; 852 862 ··· 861 871 * under the same lock 862 872 */ 863 873 spin_lock_irqsave(&bnad->bna_lock, flags); 864 - bi = 0; 865 - memset(buf, 0, stats->n_stats * sizeof(u64)); 866 874 867 - net_stats64 = (struct rtnl_link_stats64 *)buf; 868 - bnad_netdev_qstats_fill(bnad, net_stats64); 869 - bnad_netdev_hwstats_fill(bnad, net_stats64); 875 + memset(&net_stats64, 0, sizeof(net_stats64)); 876 + bnad_netdev_qstats_fill(bnad, &net_stats64); 877 + bnad_netdev_hwstats_fill(bnad, &net_stats64); 870 878 871 - bi = sizeof(*net_stats64) / sizeof(u64); 879 + buf[bi++] = net_stats64.rx_packets; 880 + buf[bi++] = net_stats64.tx_packets; 881 + buf[bi++] = net_stats64.rx_bytes; 882 + buf[bi++] = net_stats64.tx_bytes; 883 + buf[bi++] = net_stats64.rx_errors; 884 + buf[bi++] = net_stats64.tx_errors; 885 + buf[bi++] = net_stats64.rx_dropped; 886 + buf[bi++] = net_stats64.tx_dropped; 887 + buf[bi++] = net_stats64.multicast; 888 + buf[bi++] = net_stats64.collisions; 889 + buf[bi++] = net_stats64.rx_length_errors; 890 + buf[bi++] = net_stats64.rx_crc_errors; 891 + buf[bi++] = net_stats64.rx_frame_errors; 892 + buf[bi++] = net_stats64.tx_fifo_errors; 872 893 873 894 /* Get netif_queue_stopped from stack */ 874 895 bnad->stats.drv_stats.netif_queue_stopped = netif_queue_stopped(netdev);
+2 -2
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
··· 419 419 unsigned short supported; /* link capabilities */ 420 420 unsigned short advertising; /* advertised capabilities */ 421 421 unsigned short lp_advertising; /* peer advertised capabilities */ 422 - unsigned short requested_speed; /* speed user has requested */ 423 - unsigned short speed; /* actual link speed */ 422 + unsigned int requested_speed; /* speed user has requested */ 423 + unsigned int speed; /* actual link speed */ 424 424 unsigned char requested_fc; /* flow control user has requested */ 425 425 unsigned char fc; /* actual link flow control */ 426 426 unsigned char autoneg; /* autonegotiating? */
+13 -2
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
··· 4305 4305 .resume = eeh_resume, 4306 4306 }; 4307 4307 4308 + /* Return true if the Link Configuration supports "High Speeds" (those greater 4309 + * than 1Gb/s). 4310 + */ 4308 4311 static inline bool is_x_10g_port(const struct link_config *lc) 4309 4312 { 4310 - return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0 || 4311 - (lc->supported & FW_PORT_CAP_SPEED_40G) != 0; 4313 + unsigned int speeds, high_speeds; 4314 + 4315 + speeds = FW_PORT_CAP_SPEED_V(FW_PORT_CAP_SPEED_G(lc->supported)); 4316 + high_speeds = speeds & ~(FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G); 4317 + 4318 + return high_speeds != 0; 4312 4319 } 4313 4320 4314 4321 static inline void init_rspq(struct adapter *adap, struct sge_rspq *q, ··· 4763 4756 bufp += sprintf(bufp, "1000/"); 4764 4757 if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) 4765 4758 bufp += sprintf(bufp, "10G/"); 4759 + if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_25G) 4760 + bufp += sprintf(bufp, "25G/"); 4766 4761 if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) 4767 4762 bufp += sprintf(bufp, "40G/"); 4763 + if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100G) 4764 + bufp += sprintf(bufp, "100G/"); 4768 4765 if (bufp != buf) 4769 4766 --bufp; 4770 4767 sprintf(bufp, "BASE-%s", t4_get_port_type_description(pi->port_type));
+6 -1
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
··· 3627 3627 } 3628 3628 3629 3629 #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ 3630 - FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ 3630 + FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_25G | \ 3631 + FW_PORT_CAP_SPEED_40G | FW_PORT_CAP_SPEED_100G | \ 3631 3632 FW_PORT_CAP_ANEG) 3632 3633 3633 3634 /** ··· 7197 7196 speed = 1000; 7198 7197 else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) 7199 7198 speed = 10000; 7199 + else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_25G)) 7200 + speed = 25000; 7200 7201 else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) 7201 7202 speed = 40000; 7203 + else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100G)) 7204 + speed = 100000; 7202 7205 7203 7206 lc = &pi->link_cfg; 7204 7207
+6
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
··· 2265 2265 FW_PORT_CAP_802_3_ASM_DIR = 0x8000, 2266 2266 }; 2267 2267 2268 + #define FW_PORT_CAP_SPEED_S 0 2269 + #define FW_PORT_CAP_SPEED_M 0x3f 2270 + #define FW_PORT_CAP_SPEED_V(x) ((x) << FW_PORT_CAP_SPEED_S) 2271 + #define FW_PORT_CAP_SPEED_G(x) \ 2272 + (((x) >> FW_PORT_CAP_SPEED_S) & FW_PORT_CAP_SPEED_M) 2273 + 2268 2274 enum fw_port_mdi { 2269 2275 FW_PORT_CAP_MDI_UNCHANGED, 2270 2276 FW_PORT_CAP_MDI_AUTO,
+11 -4
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
··· 108 108 unsigned int supported; /* link capabilities */ 109 109 unsigned int advertising; /* advertised capabilities */ 110 110 unsigned short lp_advertising; /* peer advertised capabilities */ 111 - unsigned short requested_speed; /* speed user has requested */ 112 - unsigned short speed; /* actual link speed */ 111 + unsigned int requested_speed; /* speed user has requested */ 112 + unsigned int speed; /* actual link speed */ 113 113 unsigned char requested_fc; /* flow control user has requested */ 114 114 unsigned char fc; /* actual link flow control */ 115 115 unsigned char autoneg; /* autonegotiating? */ ··· 271 271 return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0; 272 272 } 273 273 274 + /* Return true if the Link Configuration supports "High Speeds" (those greater 275 + * than 1Gb/s). 276 + */ 274 277 static inline bool is_x_10g_port(const struct link_config *lc) 275 278 { 276 - return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0 || 277 - (lc->supported & FW_PORT_CAP_SPEED_40G) != 0; 279 + unsigned int speeds, high_speeds; 280 + 281 + speeds = FW_PORT_CAP_SPEED_V(FW_PORT_CAP_SPEED_G(lc->supported)); 282 + high_speeds = speeds & ~(FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G); 283 + 284 + return high_speeds != 0; 278 285 } 279 286 280 287 static inline unsigned int core_ticks_per_usec(const struct adapter *adapter)
+7 -2
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
··· 314 314 } 315 315 316 316 #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ 317 - FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ 318 - FW_PORT_CAP_SPEED_100G | FW_PORT_CAP_ANEG) 317 + FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_25G | \ 318 + FW_PORT_CAP_SPEED_40G | FW_PORT_CAP_SPEED_100G | \ 319 + FW_PORT_CAP_ANEG) 319 320 320 321 /** 321 322 * init_link_config - initialize a link's SW state ··· 1713 1712 speed = 1000; 1714 1713 else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) 1715 1714 speed = 10000; 1715 + else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_25G)) 1716 + speed = 25000; 1716 1717 else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) 1717 1718 speed = 40000; 1719 + else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100G)) 1720 + speed = 100000; 1718 1721 1719 1722 /* 1720 1723 * Scan all of our "ports" (Virtual Interfaces) looking for
+32 -2
drivers/net/ethernet/ibm/emac/core.c
··· 977 977 dev->mcast_pending = 1; 978 978 return; 979 979 } 980 + 981 + mutex_lock(&dev->link_lock); 980 982 __emac_set_multicast_list(dev); 983 + mutex_unlock(&dev->link_lock); 984 + } 985 + 986 + static int emac_set_mac_address(struct net_device *ndev, void *sa) 987 + { 988 + struct emac_instance *dev = netdev_priv(ndev); 989 + struct sockaddr *addr = sa; 990 + struct emac_regs __iomem *p = dev->emacp; 991 + 992 + if (!is_valid_ether_addr(addr->sa_data)) 993 + return -EADDRNOTAVAIL; 994 + 995 + mutex_lock(&dev->link_lock); 996 + 997 + memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len); 998 + 999 + emac_rx_disable(dev); 1000 + emac_tx_disable(dev); 1001 + out_be32(&p->iahr, (ndev->dev_addr[0] << 8) | ndev->dev_addr[1]); 1002 + out_be32(&p->ialr, (ndev->dev_addr[2] << 24) | 1003 + (ndev->dev_addr[3] << 16) | (ndev->dev_addr[4] << 8) | 1004 + ndev->dev_addr[5]); 1005 + emac_tx_enable(dev); 1006 + emac_rx_enable(dev); 1007 + 1008 + mutex_unlock(&dev->link_lock); 1009 + 1010 + return 0; 981 1011 } 982 1012 983 1013 static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu) ··· 2716 2686 .ndo_do_ioctl = emac_ioctl, 2717 2687 .ndo_tx_timeout = emac_tx_timeout, 2718 2688 .ndo_validate_addr = eth_validate_addr, 2719 - .ndo_set_mac_address = eth_mac_addr, 2689 + .ndo_set_mac_address = emac_set_mac_address, 2720 2690 .ndo_start_xmit = emac_start_xmit, 2721 2691 .ndo_change_mtu = eth_change_mtu, 2722 2692 }; ··· 2729 2699 .ndo_do_ioctl = emac_ioctl, 2730 2700 .ndo_tx_timeout = emac_tx_timeout, 2731 2701 .ndo_validate_addr = eth_validate_addr, 2732 - .ndo_set_mac_address = eth_mac_addr, 2702 + .ndo_set_mac_address = emac_set_mac_address, 2733 2703 .ndo_start_xmit = emac_start_xmit_sg, 2734 2704 .ndo_change_mtu = emac_change_mtu, 2735 2705 };
+1
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 1923 1923 { .compatible = "mediatek,mt7623-eth" }, 1924 1924 {}, 1925 1925 }; 1926 + MODULE_DEVICE_TABLE(of, of_mtk_match); 1926 1927 1927 1928 static struct platform_driver mtk_driver = { 1928 1929 .probe = mtk_probe,
+2 -2
drivers/net/ethernet/mellanox/mlx4/eq.c
··· 1305 1305 return 0; 1306 1306 1307 1307 err_out_unmap: 1308 - while (i >= 0) 1309 - mlx4_free_eq(dev, &priv->eq_table.eq[i--]); 1308 + while (i > 0) 1309 + mlx4_free_eq(dev, &priv->eq_table.eq[--i]); 1310 1310 #ifdef CONFIG_RFS_ACCEL 1311 1311 for (i = 1; i <= dev->caps.num_ports; i++) { 1312 1312 if (mlx4_priv(dev)->port[i].rmap) {
+3
drivers/net/ethernet/mellanox/mlx4/main.c
··· 2970 2970 mlx4_err(dev, "Failed to create mtu file for port %d\n", port); 2971 2971 device_remove_file(&info->dev->persist->pdev->dev, 2972 2972 &info->port_attr); 2973 + devlink_port_unregister(&info->devlink_port); 2973 2974 info->port = -1; 2974 2975 } 2975 2976 ··· 2985 2984 device_remove_file(&info->dev->persist->pdev->dev, &info->port_attr); 2986 2985 device_remove_file(&info->dev->persist->pdev->dev, 2987 2986 &info->port_mtu_attr); 2987 + devlink_port_unregister(&info->devlink_port); 2988 + 2988 2989 #ifdef CONFIG_RFS_ACCEL 2989 2990 free_irq_cpu_rmap(info->rmap); 2990 2991 info->rmap = NULL;
+1
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 1554 1554 1555 1555 abort: 1556 1556 esw_enable_vport(esw, 0, UC_ADDR_CHANGE); 1557 + esw->mode = SRIOV_NONE; 1557 1558 return err; 1558 1559 } 1559 1560
+14 -6
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 446 446 447 447 static int esw_offloads_start(struct mlx5_eswitch *esw) 448 448 { 449 - int err, num_vfs = esw->dev->priv.sriov.num_vfs; 449 + int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; 450 450 451 451 if (esw->mode != SRIOV_LEGACY) { 452 452 esw_warn(esw->dev, "Can't set offloads mode, SRIOV legacy not enabled\n"); ··· 455 455 456 456 mlx5_eswitch_disable_sriov(esw); 457 457 err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS); 458 - if (err) 459 - esw_warn(esw->dev, "Failed set eswitch to offloads, err %d\n", err); 458 + if (err) { 459 + esw_warn(esw->dev, "Failed setting eswitch to offloads, err %d\n", err); 460 + err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); 461 + if (err1) 462 + esw_warn(esw->dev, "Failed setting eswitch back to legacy, err %d\n", err); 463 + } 460 464 return err; 461 465 } 462 466 ··· 512 508 513 509 static int esw_offloads_stop(struct mlx5_eswitch *esw) 514 510 { 515 - int err, num_vfs = esw->dev->priv.sriov.num_vfs; 511 + int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; 516 512 517 513 mlx5_eswitch_disable_sriov(esw); 518 514 err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); 519 - if (err) 520 - esw_warn(esw->dev, "Failed set eswitch legacy mode. err %d\n", err); 515 + if (err) { 516 + esw_warn(esw->dev, "Failed setting eswitch to legacy, err %d\n", err); 517 + err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS); 518 + if (err1) 519 + esw_warn(esw->dev, "Failed setting eswitch back to offloads, err %d\n", err); 520 + } 521 521 522 522 return err; 523 523 }
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
··· 425 425 mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, u16 id, int num) 426 426 { 427 427 struct mlx5_cmd_fc_bulk *b; 428 - int outlen = sizeof(*b) + 428 + int outlen = 429 429 MLX5_ST_SZ_BYTES(query_flow_counter_out) + 430 430 MLX5_ST_SZ_BYTES(traffic_counter) * num; 431 431 432 - b = kzalloc(outlen, GFP_KERNEL); 432 + b = kzalloc(sizeof(*b) + outlen, GFP_KERNEL); 433 433 if (!b) 434 434 return NULL; 435 435
+6 -2
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
··· 2044 2044 2045 2045 nn->rx_rings = kcalloc(nn->num_rx_rings, sizeof(*nn->rx_rings), 2046 2046 GFP_KERNEL); 2047 - if (!nn->rx_rings) 2047 + if (!nn->rx_rings) { 2048 + err = -ENOMEM; 2048 2049 goto err_free_lsc; 2050 + } 2049 2051 nn->tx_rings = kcalloc(nn->num_tx_rings, sizeof(*nn->tx_rings), 2050 2052 GFP_KERNEL); 2051 - if (!nn->tx_rings) 2053 + if (!nn->tx_rings) { 2054 + err = -ENOMEM; 2052 2055 goto err_free_rx_rings; 2056 + } 2053 2057 2054 2058 for (r = 0; r < nn->num_r_vecs; r++) { 2055 2059 err = nfp_net_prepare_vector(nn, &nn->r_vecs[r], r);
+2 -2
drivers/net/ethernet/qlogic/qed/qed_mcp.c
··· 1153 1153 p_drv_version = &union_data.drv_version; 1154 1154 p_drv_version->version = p_ver->version; 1155 1155 1156 - for (i = 0; i < MCP_DRV_VER_STR_SIZE - 1; i += 4) { 1157 - val = cpu_to_be32(p_ver->name[i]); 1156 + for (i = 0; i < (MCP_DRV_VER_STR_SIZE - 4) / sizeof(u32); i++) { 1157 + val = cpu_to_be32(*((u32 *)&p_ver->name[i * sizeof(u32)])); 1158 1158 *(__be32 *)&p_drv_version->name[i * sizeof(u32)] = val; 1159 1159 } 1160 1160
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
··· 261 261 } 262 262 if (mode & WAKE_UCAST) { 263 263 pr_debug("GMAC: WOL on global unicast\n"); 264 - pmt |= global_unicast; 264 + pmt |= power_down | global_unicast | wake_up_frame_en; 265 265 } 266 266 267 267 writel(pmt, ioaddr + GMAC_PMT);
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
··· 102 102 } 103 103 if (mode & WAKE_UCAST) { 104 104 pr_debug("GMAC: WOL on global unicast\n"); 105 - pmt |= global_unicast; 105 + pmt |= power_down | global_unicast | wake_up_frame_en; 106 106 } 107 107 108 108 writel(pmt, ioaddr + GMAC_PMT);
+2 -4
drivers/net/phy/mdio-xgene.c
··· 424 424 mdiobus_unregister(mdio_bus); 425 425 mdiobus_free(mdio_bus); 426 426 427 - if (dev->of_node) { 428 - if (IS_ERR(pdata->clk)) 429 - clk_disable_unprepare(pdata->clk); 430 - } 427 + if (dev->of_node) 428 + clk_disable_unprepare(pdata->clk); 431 429 432 430 return 0; 433 431 }
+146 -135
drivers/net/usb/r8152.c
··· 32 32 #define NETNEXT_VERSION "08" 33 33 34 34 /* Information for net */ 35 - #define NET_VERSION "5" 35 + #define NET_VERSION "6" 36 36 37 37 #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION 38 38 #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" ··· 2552 2552 } 2553 2553 } 2554 2554 2555 + static inline void r8152_mmd_indirect(struct r8152 *tp, u16 dev, u16 reg) 2556 + { 2557 + ocp_reg_write(tp, OCP_EEE_AR, FUN_ADDR | dev); 2558 + ocp_reg_write(tp, OCP_EEE_DATA, reg); 2559 + ocp_reg_write(tp, OCP_EEE_AR, FUN_DATA | dev); 2560 + } 2561 + 2562 + static u16 r8152_mmd_read(struct r8152 *tp, u16 dev, u16 reg) 2563 + { 2564 + u16 data; 2565 + 2566 + r8152_mmd_indirect(tp, dev, reg); 2567 + data = ocp_reg_read(tp, OCP_EEE_DATA); 2568 + ocp_reg_write(tp, OCP_EEE_AR, 0x0000); 2569 + 2570 + return data; 2571 + } 2572 + 2573 + static void r8152_mmd_write(struct r8152 *tp, u16 dev, u16 reg, u16 data) 2574 + { 2575 + r8152_mmd_indirect(tp, dev, reg); 2576 + ocp_reg_write(tp, OCP_EEE_DATA, data); 2577 + ocp_reg_write(tp, OCP_EEE_AR, 0x0000); 2578 + } 2579 + 2580 + static void r8152_eee_en(struct r8152 *tp, bool enable) 2581 + { 2582 + u16 config1, config2, config3; 2583 + u32 ocp_data; 2584 + 2585 + ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); 2586 + config1 = ocp_reg_read(tp, OCP_EEE_CONFIG1) & ~sd_rise_time_mask; 2587 + config2 = ocp_reg_read(tp, OCP_EEE_CONFIG2); 2588 + config3 = ocp_reg_read(tp, OCP_EEE_CONFIG3) & ~fast_snr_mask; 2589 + 2590 + if (enable) { 2591 + ocp_data |= EEE_RX_EN | EEE_TX_EN; 2592 + config1 |= EEE_10_CAP | EEE_NWAY_EN | TX_QUIET_EN | RX_QUIET_EN; 2593 + config1 |= sd_rise_time(1); 2594 + config2 |= RG_DACQUIET_EN | RG_LDVQUIET_EN; 2595 + config3 |= fast_snr(42); 2596 + } else { 2597 + ocp_data &= ~(EEE_RX_EN | EEE_TX_EN); 2598 + config1 &= ~(EEE_10_CAP | EEE_NWAY_EN | TX_QUIET_EN | 2599 + RX_QUIET_EN); 2600 + config1 |= sd_rise_time(7); 2601 + config2 &= ~(RG_DACQUIET_EN | RG_LDVQUIET_EN); 2602 + config3 |= fast_snr(511); 2603 + } 2604 + 2605 + ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEE_CR, ocp_data); 2606 + ocp_reg_write(tp, OCP_EEE_CONFIG1, config1); 2607 + ocp_reg_write(tp, OCP_EEE_CONFIG2, config2); 2608 + ocp_reg_write(tp, OCP_EEE_CONFIG3, config3); 2609 + } 2610 + 2611 + static void r8152b_enable_eee(struct r8152 *tp) 2612 + { 2613 + r8152_eee_en(tp, true); 2614 + r8152_mmd_write(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, MDIO_EEE_100TX); 2615 + } 2616 + 2617 + static void r8152b_enable_fc(struct r8152 *tp) 2618 + { 2619 + u16 anar; 2620 + 2621 + anar = r8152_mdio_read(tp, MII_ADVERTISE); 2622 + anar |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; 2623 + r8152_mdio_write(tp, MII_ADVERTISE, anar); 2624 + } 2625 + 2555 2626 static void rtl8152_disable(struct r8152 *tp) 2556 2627 { 2557 2628 r8152_aldps_en(tp, false); ··· 2632 2561 2633 2562 static void r8152b_hw_phy_cfg(struct r8152 *tp) 2634 2563 { 2635 - u16 data; 2636 - 2637 - data = r8152_mdio_read(tp, MII_BMCR); 2638 - if (data & BMCR_PDOWN) { 2639 - data &= ~BMCR_PDOWN; 2640 - r8152_mdio_write(tp, MII_BMCR, data); 2641 - } 2564 + r8152b_enable_eee(tp); 2565 + r8152_aldps_en(tp, true); 2566 + r8152b_enable_fc(tp); 2642 2567 2643 2568 set_bit(PHY_RESET, &tp->flags); 2644 2569 } ··· 2768 2701 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); 2769 2702 } 2770 2703 2704 + static void r8153_aldps_en(struct r8152 *tp, bool enable) 2705 + { 2706 + u16 data; 2707 + 2708 + data = ocp_reg_read(tp, OCP_POWER_CFG); 2709 + if (enable) { 2710 + data |= EN_ALDPS; 2711 + ocp_reg_write(tp, OCP_POWER_CFG, data); 2712 + } else { 2713 + data &= ~EN_ALDPS; 2714 + ocp_reg_write(tp, OCP_POWER_CFG, data); 2715 + msleep(20); 2716 + } 2717 + } 2718 + 2719 + static void r8153_eee_en(struct r8152 *tp, bool enable) 2720 + { 2721 + u32 ocp_data; 2722 + u16 config; 2723 + 2724 + ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); 2725 + config = ocp_reg_read(tp, OCP_EEE_CFG); 2726 + 2727 + if (enable) { 2728 + ocp_data |= EEE_RX_EN | EEE_TX_EN; 2729 + config |= EEE10_EN; 2730 + } else { 2731 + ocp_data &= ~(EEE_RX_EN | EEE_TX_EN); 2732 + config &= ~EEE10_EN; 2733 + } 2734 + 2735 + ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEE_CR, ocp_data); 2736 + ocp_reg_write(tp, OCP_EEE_CFG, config); 2737 + } 2738 + 2771 2739 static void r8153_hw_phy_cfg(struct r8152 *tp) 2772 2740 { 2773 2741 u32 ocp_data; 2774 2742 u16 data; 2775 2743 2776 - if (tp->version == RTL_VER_03 || tp->version == RTL_VER_04 || 2777 - tp->version == RTL_VER_05) 2778 - ocp_reg_write(tp, OCP_ADC_CFG, CKADSEL_L | ADC_EN | EN_EMI_L); 2744 + /* disable ALDPS before updating the PHY parameters */ 2745 + r8153_aldps_en(tp, false); 2779 2746 2780 - data = r8152_mdio_read(tp, MII_BMCR); 2781 - if (data & BMCR_PDOWN) { 2782 - data &= ~BMCR_PDOWN; 2783 - r8152_mdio_write(tp, MII_BMCR, data); 2784 - } 2747 + /* disable EEE before updating the PHY parameters */ 2748 + r8153_eee_en(tp, false); 2749 + ocp_reg_write(tp, OCP_EEE_ADV, 0); 2785 2750 2786 2751 if (tp->version == RTL_VER_03) { 2787 2752 data = ocp_reg_read(tp, OCP_EEE_CFG); ··· 2843 2744 /* Adjust 10M Amplitude */ 2844 2745 sram_write(tp, SRAM_10M_AMP1, 0x00af); 2845 2746 sram_write(tp, SRAM_10M_AMP2, 0x0208); 2747 + 2748 + r8153_eee_en(tp, true); 2749 + ocp_reg_write(tp, OCP_EEE_ADV, MDIO_EEE_1000T | MDIO_EEE_100TX); 2750 + 2751 + r8153_aldps_en(tp, true); 2752 + r8152b_enable_fc(tp); 2846 2753 2847 2754 set_bit(PHY_RESET, &tp->flags); 2848 2755 } ··· 2969 2864 ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); 2970 2865 ocp_data |= RCR_APM | RCR_AM | RCR_AB; 2971 2866 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); 2972 - } 2973 - 2974 - static void r8153_aldps_en(struct r8152 *tp, bool enable) 2975 - { 2976 - u16 data; 2977 - 2978 - data = ocp_reg_read(tp, OCP_POWER_CFG); 2979 - if (enable) { 2980 - data |= EN_ALDPS; 2981 - ocp_reg_write(tp, OCP_POWER_CFG, data); 2982 - } else { 2983 - data &= ~EN_ALDPS; 2984 - ocp_reg_write(tp, OCP_POWER_CFG, data); 2985 - msleep(20); 2986 - } 2987 2867 } 2988 2868 2989 2869 static void rtl8153_disable(struct r8152 *tp) ··· 3336 3246 return res; 3337 3247 } 3338 3248 3339 - static inline void r8152_mmd_indirect(struct r8152 *tp, u16 dev, u16 reg) 3340 - { 3341 - ocp_reg_write(tp, OCP_EEE_AR, FUN_ADDR | dev); 3342 - ocp_reg_write(tp, OCP_EEE_DATA, reg); 3343 - ocp_reg_write(tp, OCP_EEE_AR, FUN_DATA | dev); 3344 - } 3345 - 3346 - static u16 r8152_mmd_read(struct r8152 *tp, u16 dev, u16 reg) 3347 - { 3348 - u16 data; 3349 - 3350 - r8152_mmd_indirect(tp, dev, reg); 3351 - data = ocp_reg_read(tp, OCP_EEE_DATA); 3352 - ocp_reg_write(tp, OCP_EEE_AR, 0x0000); 3353 - 3354 - return data; 3355 - } 3356 - 3357 - static void r8152_mmd_write(struct r8152 *tp, u16 dev, u16 reg, u16 data) 3358 - { 3359 - r8152_mmd_indirect(tp, dev, reg); 3360 - ocp_reg_write(tp, OCP_EEE_DATA, data); 3361 - ocp_reg_write(tp, OCP_EEE_AR, 0x0000); 3362 - } 3363 - 3364 - static void r8152_eee_en(struct r8152 *tp, bool enable) 3365 - { 3366 - u16 config1, config2, config3; 3367 - u32 ocp_data; 3368 - 3369 - ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); 3370 - config1 = ocp_reg_read(tp, OCP_EEE_CONFIG1) & ~sd_rise_time_mask; 3371 - config2 = ocp_reg_read(tp, OCP_EEE_CONFIG2); 3372 - config3 = ocp_reg_read(tp, OCP_EEE_CONFIG3) & ~fast_snr_mask; 3373 - 3374 - if (enable) { 3375 - ocp_data |= EEE_RX_EN | EEE_TX_EN; 3376 - config1 |= EEE_10_CAP | EEE_NWAY_EN | TX_QUIET_EN | RX_QUIET_EN; 3377 - config1 |= sd_rise_time(1); 3378 - config2 |= RG_DACQUIET_EN | RG_LDVQUIET_EN; 3379 - config3 |= fast_snr(42); 3380 - } else { 3381 - ocp_data &= ~(EEE_RX_EN | EEE_TX_EN); 3382 - config1 &= ~(EEE_10_CAP | EEE_NWAY_EN | TX_QUIET_EN | 3383 - RX_QUIET_EN); 3384 - config1 |= sd_rise_time(7); 3385 - config2 &= ~(RG_DACQUIET_EN | RG_LDVQUIET_EN); 3386 - config3 |= fast_snr(511); 3387 - } 3388 - 3389 - ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEE_CR, ocp_data); 3390 - ocp_reg_write(tp, OCP_EEE_CONFIG1, config1); 3391 - ocp_reg_write(tp, OCP_EEE_CONFIG2, config2); 3392 - ocp_reg_write(tp, OCP_EEE_CONFIG3, config3); 3393 - } 3394 - 3395 - static void r8152b_enable_eee(struct r8152 *tp) 3396 - { 3397 - r8152_eee_en(tp, true); 3398 - r8152_mmd_write(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, MDIO_EEE_100TX); 3399 - } 3400 - 3401 - static void r8153_eee_en(struct r8152 *tp, bool enable) 3402 - { 3403 - u32 ocp_data; 3404 - u16 config; 3405 - 3406 - ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); 3407 - config = ocp_reg_read(tp, OCP_EEE_CFG); 3408 - 3409 - if (enable) { 3410 - ocp_data |= EEE_RX_EN | EEE_TX_EN; 3411 - config |= EEE10_EN; 3412 - } else { 3413 - ocp_data &= ~(EEE_RX_EN | EEE_TX_EN); 3414 - config &= ~EEE10_EN; 3415 - } 3416 - 3417 - ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEE_CR, ocp_data); 3418 - ocp_reg_write(tp, OCP_EEE_CFG, config); 3419 - } 3420 - 3421 - static void r8153_enable_eee(struct r8152 *tp) 3422 - { 3423 - r8153_eee_en(tp, true); 3424 - ocp_reg_write(tp, OCP_EEE_ADV, MDIO_EEE_1000T | MDIO_EEE_100TX); 3425 - } 3426 - 3427 - static void r8152b_enable_fc(struct r8152 *tp) 3428 - { 3429 - u16 anar; 3430 - 3431 - anar = r8152_mdio_read(tp, MII_ADVERTISE); 3432 - anar |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; 3433 - r8152_mdio_write(tp, MII_ADVERTISE, anar); 3434 - } 3435 - 3436 3249 static void rtl_tally_reset(struct r8152 *tp) 3437 3250 { 3438 3251 u32 ocp_data; ··· 3348 3355 static void r8152b_init(struct r8152 *tp) 3349 3356 { 3350 3357 u32 ocp_data; 3358 + u16 data; 3351 3359 3352 3360 if (test_bit(RTL8152_UNPLUG, &tp->flags)) 3353 3361 return; 3362 + 3363 + data = r8152_mdio_read(tp, MII_BMCR); 3364 + if (data & BMCR_PDOWN) { 3365 + data &= ~BMCR_PDOWN; 3366 + r8152_mdio_write(tp, MII_BMCR, data); 3367 + } 3354 3368 3355 3369 r8152_aldps_en(tp, false); 3356 3370 ··· 3380 3380 SPDWN_RXDV_MSK | SPDWN_LINKCHG_MSK; 3381 3381 ocp_write_word(tp, MCU_TYPE_PLA, PLA_GPHY_INTR_IMR, ocp_data); 3382 3382 3383 - r8152b_enable_eee(tp); 3384 - r8152_aldps_en(tp, true); 3385 - r8152b_enable_fc(tp); 3386 3383 rtl_tally_reset(tp); 3387 3384 3388 3385 /* enable rx aggregation */ ··· 3391 3394 static void r8153_init(struct r8152 *tp) 3392 3395 { 3393 3396 u32 ocp_data; 3397 + u16 data; 3394 3398 int i; 3395 3399 3396 3400 if (test_bit(RTL8152_UNPLUG, &tp->flags)) 3397 3401 return; 3398 3402 3399 - r8153_aldps_en(tp, false); 3400 3403 r8153_u1u2en(tp, false); 3401 3404 3402 3405 for (i = 0; i < 500; i++) { ··· 3409 3412 for (i = 0; i < 500; i++) { 3410 3413 ocp_data = ocp_reg_read(tp, OCP_PHY_STATUS) & PHY_STAT_MASK; 3411 3414 if (ocp_data == PHY_STAT_LAN_ON || ocp_data == PHY_STAT_PWRDN) 3415 + break; 3416 + msleep(20); 3417 + } 3418 + 3419 + if (tp->version == RTL_VER_03 || tp->version == RTL_VER_04 || 3420 + tp->version == RTL_VER_05) 3421 + ocp_reg_write(tp, OCP_ADC_CFG, CKADSEL_L | ADC_EN | EN_EMI_L); 3422 + 3423 + data = r8152_mdio_read(tp, MII_BMCR); 3424 + if (data & BMCR_PDOWN) { 3425 + data &= ~BMCR_PDOWN; 3426 + r8152_mdio_write(tp, MII_BMCR, data); 3427 + } 3428 + 3429 + for (i = 0; i < 500; i++) { 3430 + ocp_data = ocp_reg_read(tp, OCP_PHY_STATUS) & PHY_STAT_MASK; 3431 + if (ocp_data == PHY_STAT_LAN_ON) 3412 3432 break; 3413 3433 msleep(20); 3414 3434 } ··· 3497 3483 ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0); 3498 3484 ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0); 3499 3485 3500 - r8153_enable_eee(tp); 3501 - r8153_aldps_en(tp, true); 3502 - r8152b_enable_fc(tp); 3503 3486 rtl_tally_reset(tp); 3504 3487 r8153_u2p3en(tp, true); 3505 3488 }
+9 -10
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
··· 513 513 int hdrlen = ieee80211_hdrlen(hdr->frame_control); 514 514 int queue; 515 515 516 + /* IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets that can be used 517 + * in 2 different types of vifs, P2P & STATION. P2P uses the offchannel 518 + * queue. STATION (HS2.0) uses the auxiliary context of the FW, 519 + * and hence needs to be sent on the aux queue 520 + */ 521 + if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && 522 + skb_info->control.vif->type == NL80211_IFTYPE_STATION) 523 + IEEE80211_SKB_CB(skb)->hw_queue = mvm->aux_queue; 524 + 516 525 memcpy(&info, skb->cb, sizeof(info)); 517 526 518 527 if (WARN_ON_ONCE(info.flags & IEEE80211_TX_CTL_AMPDU)) ··· 534 525 535 526 /* This holds the amsdu headers length */ 536 527 skb_info->driver_data[0] = (void *)(uintptr_t)0; 537 - 538 - /* 539 - * IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets that can be used 540 - * in 2 different types of vifs, P2P & STATION. P2P uses the offchannel 541 - * queue. STATION (HS2.0) uses the auxiliary context of the FW, 542 - * and hence needs to be sent on the aux queue 543 - */ 544 - if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && 545 - info.control.vif->type == NL80211_IFTYPE_STATION) 546 - IEEE80211_SKB_CB(skb)->hw_queue = mvm->aux_queue; 547 528 548 529 queue = info.hw_queue; 549 530
+30 -16
drivers/net/xen-netback/xenbus.c
··· 271 271 be->dev = dev; 272 272 dev_set_drvdata(&dev->dev, be); 273 273 274 + be->state = XenbusStateInitialising; 275 + err = xenbus_switch_state(dev, XenbusStateInitialising); 276 + if (err) 277 + goto fail; 278 + 274 279 sg = 1; 275 280 276 281 do { ··· 388 383 389 384 be->hotplug_script = script; 390 385 391 - err = xenbus_switch_state(dev, XenbusStateInitWait); 392 - if (err) 393 - goto fail; 394 - 395 - be->state = XenbusStateInitWait; 396 386 397 387 /* This kicks hotplug scripts, so do it immediately. */ 398 388 err = backend_create_xenvif(be); ··· 492 492 493 493 /* Handle backend state transitions: 494 494 * 495 - * The backend state starts in InitWait and the following transitions are 495 + * The backend state starts in Initialising and the following transitions are 496 496 * allowed. 497 497 * 498 - * InitWait -> Connected 498 + * Initialising -> InitWait -> Connected 499 + * \ 500 + * \ ^ \ | 501 + * \ | \ | 502 + * \ | \ | 503 + * \ | \ | 504 + * \ | \ | 505 + * \ | \ | 506 + * V | V V 499 507 * 500 - * ^ \ | 501 - * | \ | 502 - * | \ | 503 - * | \ | 504 - * | \ | 505 - * | \ | 506 - * | V V 507 - * 508 - * Closed <-> Closing 508 + * Closed <-> Closing 509 509 * 510 510 * The state argument specifies the eventual state of the backend and the 511 511 * function transitions to that state via the shortest path. ··· 515 515 { 516 516 while (be->state != state) { 517 517 switch (be->state) { 518 + case XenbusStateInitialising: 519 + switch (state) { 520 + case XenbusStateInitWait: 521 + case XenbusStateConnected: 522 + case XenbusStateClosing: 523 + backend_switch_state(be, XenbusStateInitWait); 524 + break; 525 + case XenbusStateClosed: 526 + backend_switch_state(be, XenbusStateClosed); 527 + break; 528 + default: 529 + BUG(); 530 + } 531 + break; 518 532 case XenbusStateClosed: 519 533 switch (state) { 520 534 case XenbusStateInitWait:
+1
drivers/s390/net/qeth_core.h
··· 999 999 __u16, __u16, 1000 1000 enum qeth_prot_versions); 1001 1001 int qeth_set_features(struct net_device *, netdev_features_t); 1002 + int qeth_recover_features(struct net_device *); 1002 1003 netdev_features_t qeth_fix_features(struct net_device *, netdev_features_t); 1003 1004 1004 1005 /* exports for OSN */
+31 -1
drivers/s390/net/qeth_core_main.c
··· 3619 3619 int e; 3620 3620 3621 3621 e = 0; 3622 - while (buffer->element[e].addr) { 3622 + while ((e < QDIO_MAX_ELEMENTS_PER_BUFFER) && 3623 + buffer->element[e].addr) { 3623 3624 unsigned long phys_aob_addr; 3624 3625 3625 3626 phys_aob_addr = (unsigned long) buffer->element[e].addr; ··· 6131 6130 } 6132 6131 return rc; 6133 6132 } 6133 + 6134 + /* try to restore device features on a device after recovery */ 6135 + int qeth_recover_features(struct net_device *dev) 6136 + { 6137 + struct qeth_card *card = dev->ml_priv; 6138 + netdev_features_t recover = dev->features; 6139 + 6140 + if (recover & NETIF_F_IP_CSUM) { 6141 + if (qeth_set_ipa_csum(card, 1, IPA_OUTBOUND_CHECKSUM)) 6142 + recover ^= NETIF_F_IP_CSUM; 6143 + } 6144 + if (recover & NETIF_F_RXCSUM) { 6145 + if (qeth_set_ipa_csum(card, 1, IPA_INBOUND_CHECKSUM)) 6146 + recover ^= NETIF_F_RXCSUM; 6147 + } 6148 + if (recover & NETIF_F_TSO) { 6149 + if (qeth_set_ipa_tso(card, 1)) 6150 + recover ^= NETIF_F_TSO; 6151 + } 6152 + 6153 + if (recover == dev->features) 6154 + return 0; 6155 + 6156 + dev_warn(&card->gdev->dev, 6157 + "Device recovery failed to restore all offload features\n"); 6158 + dev->features = recover; 6159 + return -EIO; 6160 + } 6161 + EXPORT_SYMBOL_GPL(qeth_recover_features); 6134 6162 6135 6163 int qeth_set_features(struct net_device *dev, netdev_features_t features) 6136 6164 {
+3 -3
drivers/s390/net/qeth_l2_main.c
··· 1124 1124 card->dev->hw_features |= NETIF_F_RXCSUM; 1125 1125 card->dev->vlan_features |= NETIF_F_RXCSUM; 1126 1126 } 1127 - /* Turn on SG per default */ 1128 - card->dev->features |= NETIF_F_SG; 1129 1127 } 1130 1128 card->info.broadcast_capable = 1; 1131 1129 qeth_l2_request_initial_mac(card); 1132 1130 card->dev->gso_max_size = (QETH_MAX_BUFFER_ELEMENTS(card) - 1) * 1133 1131 PAGE_SIZE; 1134 - card->dev->gso_max_segs = (QETH_MAX_BUFFER_ELEMENTS(card) - 1); 1135 1132 SET_NETDEV_DEV(card->dev, &card->gdev->dev); 1136 1133 netif_napi_add(card->dev, &card->napi, qeth_l2_poll, QETH_NAPI_WEIGHT); 1137 1134 netif_carrier_off(card->dev); ··· 1243 1246 } 1244 1247 /* this also sets saved unicast addresses */ 1245 1248 qeth_l2_set_rx_mode(card->dev); 1249 + rtnl_lock(); 1250 + qeth_recover_features(card->dev); 1251 + rtnl_unlock(); 1246 1252 } 1247 1253 /* let user_space know that device is online */ 1248 1254 kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);
+20 -9
drivers/s390/net/qeth_l3_main.c
··· 257 257 if (addr->in_progress) 258 258 return -EINPROGRESS; 259 259 260 + if (!qeth_card_hw_is_reachable(card)) { 261 + addr->disp_flag = QETH_DISP_ADDR_DELETE; 262 + return 0; 263 + } 264 + 260 265 rc = qeth_l3_deregister_addr_entry(card, addr); 261 266 262 267 hash_del(&addr->hnode); ··· 300 295 } 301 296 hash_add(card->ip_htable, &addr->hnode, 302 297 qeth_l3_ipaddr_hash(addr)); 298 + 299 + if (!qeth_card_hw_is_reachable(card)) { 300 + addr->disp_flag = QETH_DISP_ADDR_ADD; 301 + return 0; 302 + } 303 303 304 304 /* qeth_l3_register_addr_entry can go to sleep 305 305 * if we add a IPV4 addr. It is caused by the reason ··· 400 390 int i; 401 391 int rc; 402 392 403 - QETH_CARD_TEXT(card, 4, "recoverip"); 393 + QETH_CARD_TEXT(card, 4, "recovrip"); 404 394 405 395 spin_lock_bh(&card->ip_lock); 406 396 407 397 hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { 408 - if (addr->disp_flag == QETH_DISP_ADDR_ADD) { 398 + if (addr->disp_flag == QETH_DISP_ADDR_DELETE) { 399 + qeth_l3_deregister_addr_entry(card, addr); 400 + hash_del(&addr->hnode); 401 + kfree(addr); 402 + } else if (addr->disp_flag == QETH_DISP_ADDR_ADD) { 409 403 if (addr->proto == QETH_PROT_IPV4) { 410 404 addr->in_progress = 1; 411 405 spin_unlock_bh(&card->ip_lock); ··· 421 407 422 408 if (!rc) { 423 409 addr->disp_flag = QETH_DISP_ADDR_DO_NOTHING; 424 - if (addr->ref_counter < 1) { 410 + if (addr->ref_counter < 1) 425 411 qeth_l3_delete_ip(card, addr); 426 - kfree(addr); 427 - } 428 412 } else { 429 413 hash_del(&addr->hnode); 430 414 kfree(addr); ··· 701 689 702 690 spin_lock_bh(&card->ip_lock); 703 691 704 - if (!qeth_l3_ip_from_hash(card, ipaddr)) 692 + if (qeth_l3_ip_from_hash(card, ipaddr)) 705 693 rc = -EEXIST; 706 694 else 707 695 qeth_l3_add_ip(card, ipaddr); ··· 769 757 770 758 spin_lock_bh(&card->ip_lock); 771 759 772 - if (!qeth_l3_ip_from_hash(card, ipaddr)) 760 + if (qeth_l3_ip_from_hash(card, ipaddr)) 773 761 rc = -EEXIST; 774 762 else 775 763 qeth_l3_add_ip(card, ipaddr); ··· 3120 3108 card->dev->vlan_features = NETIF_F_SG | 3121 3109 NETIF_F_RXCSUM | NETIF_F_IP_CSUM | 3122 3110 NETIF_F_TSO; 3123 - card->dev->features = NETIF_F_SG; 3124 3111 } 3125 3112 } 3126 3113 } else if (card->info.type == QETH_CARD_TYPE_IQD) { ··· 3147 3136 netif_keep_dst(card->dev); 3148 3137 card->dev->gso_max_size = (QETH_MAX_BUFFER_ELEMENTS(card) - 1) * 3149 3138 PAGE_SIZE; 3150 - card->dev->gso_max_segs = (QETH_MAX_BUFFER_ELEMENTS(card) - 1); 3151 3139 3152 3140 SET_NETDEV_DEV(card->dev, &card->gdev->dev); 3153 3141 netif_napi_add(card->dev, &card->napi, qeth_l3_poll, QETH_NAPI_WEIGHT); ··· 3279 3269 else 3280 3270 dev_open(card->dev); 3281 3271 qeth_l3_set_multicast_list(card->dev); 3272 + qeth_recover_features(card->dev); 3282 3273 rtnl_unlock(); 3283 3274 } 3284 3275 qeth_trace_features(card);
+5
drivers/s390/net/qeth_l3_sys.c
··· 297 297 addr->u.a6.pfxlen = 0; 298 298 addr->type = QETH_IP_TYPE_NORMAL; 299 299 300 + spin_lock_bh(&card->ip_lock); 300 301 qeth_l3_delete_ip(card, addr); 302 + spin_unlock_bh(&card->ip_lock); 301 303 kfree(addr); 302 304 } 303 305 ··· 331 329 addr->type = QETH_IP_TYPE_NORMAL; 332 330 } else 333 331 return -ENOMEM; 332 + 333 + spin_lock_bh(&card->ip_lock); 334 334 qeth_l3_add_ip(card, addr); 335 + spin_unlock_bh(&card->ip_lock); 335 336 kfree(addr); 336 337 337 338 return count;
+14
include/net/netfilter/nf_conntrack_synproxy.h
··· 27 27 #endif 28 28 } 29 29 30 + static inline bool nf_ct_add_synproxy(struct nf_conn *ct, 31 + const struct nf_conn *tmpl) 32 + { 33 + if (tmpl && nfct_synproxy(tmpl)) { 34 + if (!nfct_seqadj_ext_add(ct)) 35 + return false; 36 + 37 + if (!nfct_synproxy_ext_add(ct)) 38 + return false; 39 + } 40 + 41 + return true; 42 + } 43 + 30 44 struct synproxy_stats { 31 45 unsigned int syn_received; 32 46 unsigned int cookie_invalid;
+1 -1
include/net/sctp/sm.h
··· 382 382 ADDIP_SERIAL_SIGN_BIT = (1<<31) 383 383 }; 384 384 385 - static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t) 385 + static inline int ADDIP_SERIAL_gte(__u32 s, __u32 t) 386 386 { 387 387 return ((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT); 388 388 }
+10
include/net/sock.h
··· 1332 1332 if (!sk_has_account(sk)) 1333 1333 return; 1334 1334 sk->sk_forward_alloc += size; 1335 + 1336 + /* Avoid a possible overflow. 1337 + * TCP send queues can make this happen, if sk_mem_reclaim() 1338 + * is not called and more than 2 GBytes are released at once. 1339 + * 1340 + * If we reach 2 MBytes, reclaim 1 MBytes right now, there is 1341 + * no need to hold that much forward allocation anyway. 1342 + */ 1343 + if (unlikely(sk->sk_forward_alloc >= 1 << 21)) 1344 + __sk_mem_reclaim(sk, 1 << 20); 1335 1345 } 1336 1346 1337 1347 static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
+3 -1
include/net/xfrm.h
··· 1540 1540 void xfrm4_local_error(struct sk_buff *skb, u32 mtu); 1541 1541 int xfrm6_extract_header(struct sk_buff *skb); 1542 1542 int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1543 - int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); 1543 + int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, 1544 + struct ip6_tnl *t); 1544 1545 int xfrm6_transport_finish(struct sk_buff *skb, int async); 1546 + int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t); 1545 1547 int xfrm6_rcv(struct sk_buff *skb); 1546 1548 int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1547 1549 xfrm_address_t *saddr, u8 proto);
+1 -1
net/batman-adv/bat_v_elp.c
··· 335 335 goto out; 336 336 337 337 skb_reserve(hard_iface->bat_v.elp_skb, ETH_HLEN + NET_IP_ALIGN); 338 - elp_buff = skb_push(hard_iface->bat_v.elp_skb, BATADV_ELP_HLEN); 338 + elp_buff = skb_put(hard_iface->bat_v.elp_skb, BATADV_ELP_HLEN); 339 339 elp_packet = (struct batadv_elp_packet *)elp_buff; 340 340 memset(elp_packet, 0, BATADV_ELP_HLEN); 341 341
+27 -1
net/batman-adv/routing.c
··· 470 470 } 471 471 472 472 /** 473 + * batadv_last_bonding_get - Get last_bonding_candidate of orig_node 474 + * @orig_node: originator node whose last bonding candidate should be retrieved 475 + * 476 + * Return: last bonding candidate of router or NULL if not found 477 + * 478 + * The object is returned with refcounter increased by 1. 479 + */ 480 + static struct batadv_orig_ifinfo * 481 + batadv_last_bonding_get(struct batadv_orig_node *orig_node) 482 + { 483 + struct batadv_orig_ifinfo *last_bonding_candidate; 484 + 485 + spin_lock_bh(&orig_node->neigh_list_lock); 486 + last_bonding_candidate = orig_node->last_bonding_candidate; 487 + 488 + if (last_bonding_candidate) 489 + kref_get(&last_bonding_candidate->refcount); 490 + spin_unlock_bh(&orig_node->neigh_list_lock); 491 + 492 + return last_bonding_candidate; 493 + } 494 + 495 + /** 473 496 * batadv_last_bonding_replace - Replace last_bonding_candidate of orig_node 474 497 * @orig_node: originator node whose bonding candidates should be replaced 475 498 * @new_candidate: new bonding candidate or NULL ··· 562 539 * router - obviously there are no other candidates. 563 540 */ 564 541 rcu_read_lock(); 565 - last_candidate = orig_node->last_bonding_candidate; 542 + last_candidate = batadv_last_bonding_get(orig_node); 566 543 if (last_candidate) 567 544 last_cand_router = rcu_dereference(last_candidate->router); 568 545 ··· 653 630 batadv_neigh_node_put(next_candidate_router); 654 631 batadv_orig_ifinfo_put(next_candidate); 655 632 } 633 + 634 + if (last_candidate) 635 + batadv_orig_ifinfo_put(last_candidate); 656 636 657 637 return router; 658 638 }
+3 -2
net/ipv4/ip_input.c
··· 312 312 { 313 313 const struct iphdr *iph = ip_hdr(skb); 314 314 struct rtable *rt; 315 + struct net_device *dev = skb->dev; 315 316 316 317 /* if ingress device is enslaved to an L3 master device pass the 317 318 * skb to its handler for processing ··· 342 341 */ 343 342 if (!skb_valid_dst(skb)) { 344 343 int err = ip_route_input_noref(skb, iph->daddr, iph->saddr, 345 - iph->tos, skb->dev); 344 + iph->tos, dev); 346 345 if (unlikely(err)) { 347 346 if (err == -EXDEV) 348 347 __NET_INC_STATS(net, LINUX_MIB_IPRPFILTER); ··· 371 370 __IP_UPD_PO_STATS(net, IPSTATS_MIB_INBCAST, skb->len); 372 371 } else if (skb->pkt_type == PACKET_BROADCAST || 373 372 skb->pkt_type == PACKET_MULTICAST) { 374 - struct in_device *in_dev = __in_dev_get_rcu(skb->dev); 373 + struct in_device *in_dev = __in_dev_get_rcu(dev); 375 374 376 375 /* RFC 1122 3.3.6: 377 376 *
+14 -1
net/ipv4/ip_vti.c
··· 88 88 struct net_device *dev; 89 89 struct pcpu_sw_netstats *tstats; 90 90 struct xfrm_state *x; 91 + struct xfrm_mode *inner_mode; 91 92 struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4; 92 93 u32 orig_mark = skb->mark; 93 94 int ret; ··· 106 105 } 107 106 108 107 x = xfrm_input_state(skb); 109 - family = x->inner_mode->afinfo->family; 108 + 109 + inner_mode = x->inner_mode; 110 + 111 + if (x->sel.family == AF_UNSPEC) { 112 + inner_mode = xfrm_ip2inner_mode(x, XFRM_MODE_SKB_CB(skb)->protocol); 113 + if (inner_mode == NULL) { 114 + XFRM_INC_STATS(dev_net(skb->dev), 115 + LINUX_MIB_XFRMINSTATEMODEERROR); 116 + return -EINVAL; 117 + } 118 + } 119 + 120 + family = inner_mode->afinfo->family; 110 121 111 122 skb->mark = be32_to_cpu(tunnel->parms.i_key); 112 123 ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family);
+5 -2
net/ipv4/ipmr.c
··· 2076 2076 struct rta_mfc_stats mfcs; 2077 2077 struct nlattr *mp_attr; 2078 2078 struct rtnexthop *nhp; 2079 + unsigned long lastuse; 2079 2080 int ct; 2080 2081 2081 2082 /* If cache is unresolved, don't try to parse IIF and OIF */ ··· 2106 2105 2107 2106 nla_nest_end(skb, mp_attr); 2108 2107 2108 + lastuse = READ_ONCE(c->mfc_un.res.lastuse); 2109 + lastuse = time_after_eq(jiffies, lastuse) ? jiffies - lastuse : 0; 2110 + 2109 2111 mfcs.mfcs_packets = c->mfc_un.res.pkt; 2110 2112 mfcs.mfcs_bytes = c->mfc_un.res.bytes; 2111 2113 mfcs.mfcs_wrong_if = c->mfc_un.res.wrong_if; 2112 2114 if (nla_put_64bit(skb, RTA_MFC_STATS, sizeof(mfcs), &mfcs, RTA_PAD) || 2113 - nla_put_u64_64bit(skb, RTA_EXPIRES, 2114 - jiffies_to_clock_t(c->mfc_un.res.lastuse), 2115 + nla_put_u64_64bit(skb, RTA_EXPIRES, jiffies_to_clock_t(lastuse), 2115 2116 RTA_PAD)) 2116 2117 return -EMSGSIZE; 2117 2118
+7 -4
net/ipv4/netfilter/nft_chain_route_ipv4.c
··· 31 31 __be32 saddr, daddr; 32 32 u_int8_t tos; 33 33 const struct iphdr *iph; 34 + int err; 34 35 35 36 /* root is playing with raw sockets. */ 36 37 if (skb->len < sizeof(struct iphdr) || ··· 47 46 tos = iph->tos; 48 47 49 48 ret = nft_do_chain(&pkt, priv); 50 - if (ret != NF_DROP && ret != NF_QUEUE) { 49 + if (ret != NF_DROP && ret != NF_STOLEN) { 51 50 iph = ip_hdr(skb); 52 51 53 52 if (iph->saddr != saddr || 54 53 iph->daddr != daddr || 55 54 skb->mark != mark || 56 - iph->tos != tos) 57 - if (ip_route_me_harder(state->net, skb, RTN_UNSPEC)) 58 - ret = NF_DROP; 55 + iph->tos != tos) { 56 + err = ip_route_me_harder(state->net, skb, RTN_UNSPEC); 57 + if (err < 0) 58 + ret = NF_DROP_ERR(err); 59 + } 59 60 } 60 61 return ret; 61 62 }
+8 -2
net/ipv4/route.c
··· 476 476 atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ; 477 477 u32 old = ACCESS_ONCE(*p_tstamp); 478 478 u32 now = (u32)jiffies; 479 - u32 delta = 0; 479 + u32 new, delta = 0; 480 480 481 481 if (old != now && cmpxchg(p_tstamp, old, now) == old) 482 482 delta = prandom_u32_max(now - old); 483 483 484 - return atomic_add_return(segs + delta, p_id) - segs; 484 + /* Do not use atomic_add_return() as it makes UBSAN unhappy */ 485 + do { 486 + old = (u32)atomic_read(p_id); 487 + new = old + delta + segs; 488 + } while (atomic_cmpxchg(p_id, old, new) != old); 489 + 490 + return new - segs; 485 491 } 486 492 EXPORT_SYMBOL(ip_idents_reserve); 487 493
+1 -1
net/ipv4/tcp_input.c
··· 5885 5885 * so release it. 5886 5886 */ 5887 5887 if (req) { 5888 - tp->total_retrans = req->num_retrans; 5888 + inet_csk(sk)->icsk_retransmits = 0; 5889 5889 reqsk_fastopen_remove(sk, req, false); 5890 5890 } else { 5891 5891 /* Make sure socket is routed, for correct metrics. */
+5 -2
net/ipv4/tcp_output.c
··· 2605 2605 * copying overhead: fragmentation, tunneling, mangling etc. 2606 2606 */ 2607 2607 if (atomic_read(&sk->sk_wmem_alloc) > 2608 - min(sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2), sk->sk_sndbuf)) 2608 + min_t(u32, sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2), 2609 + sk->sk_sndbuf)) 2609 2610 return -EAGAIN; 2610 2611 2611 2612 if (skb_still_in_host_queue(sk, skb)) ··· 2831 2830 if (tcp_retransmit_skb(sk, skb, segs)) 2832 2831 return; 2833 2832 2834 - NET_INC_STATS(sock_net(sk), mib_idx); 2833 + NET_ADD_STATS(sock_net(sk), mib_idx, tcp_skb_pcount(skb)); 2835 2834 2836 2835 if (tcp_in_cwnd_reduction(sk)) 2837 2836 tp->prr_out += tcp_skb_pcount(skb); ··· 3568 3567 if (!res) { 3569 3568 __TCP_INC_STATS(sock_net(sk), TCP_MIB_RETRANSSEGS); 3570 3569 __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); 3570 + if (unlikely(tcp_passive_fastopen(sk))) 3571 + tcp_sk(sk)->total_retrans++; 3571 3572 } 3572 3573 return res; 3573 3574 }
+1
net/ipv4/tcp_timer.c
··· 384 384 */ 385 385 inet_rtx_syn_ack(sk, req); 386 386 req->num_timeout++; 387 + icsk->icsk_retransmits++; 387 388 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, 388 389 TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); 389 390 }
+15 -4
net/ipv6/ip6_vti.c
··· 321 321 goto discard; 322 322 } 323 323 324 - XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; 325 - 326 324 rcu_read_unlock(); 327 325 328 - return xfrm6_rcv(skb); 326 + return xfrm6_rcv_tnl(skb, t); 329 327 } 330 328 rcu_read_unlock(); 331 329 return -EINVAL; ··· 338 340 struct net_device *dev; 339 341 struct pcpu_sw_netstats *tstats; 340 342 struct xfrm_state *x; 343 + struct xfrm_mode *inner_mode; 341 344 struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; 342 345 u32 orig_mark = skb->mark; 343 346 int ret; ··· 356 357 } 357 358 358 359 x = xfrm_input_state(skb); 359 - family = x->inner_mode->afinfo->family; 360 + 361 + inner_mode = x->inner_mode; 362 + 363 + if (x->sel.family == AF_UNSPEC) { 364 + inner_mode = xfrm_ip2inner_mode(x, XFRM_MODE_SKB_CB(skb)->protocol); 365 + if (inner_mode == NULL) { 366 + XFRM_INC_STATS(dev_net(skb->dev), 367 + LINUX_MIB_XFRMINSTATEMODEERROR); 368 + return -EINVAL; 369 + } 370 + } 371 + 372 + family = inner_mode->afinfo->family; 360 373 361 374 skb->mark = be32_to_cpu(t->parms.i_key); 362 375 ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family);
+5 -2
net/ipv6/ip6mr.c
··· 2239 2239 struct rta_mfc_stats mfcs; 2240 2240 struct nlattr *mp_attr; 2241 2241 struct rtnexthop *nhp; 2242 + unsigned long lastuse; 2242 2243 int ct; 2243 2244 2244 2245 /* If cache is unresolved, don't try to parse IIF and OIF */ ··· 2270 2269 2271 2270 nla_nest_end(skb, mp_attr); 2272 2271 2272 + lastuse = READ_ONCE(c->mfc_un.res.lastuse); 2273 + lastuse = time_after_eq(jiffies, lastuse) ? jiffies - lastuse : 0; 2274 + 2273 2275 mfcs.mfcs_packets = c->mfc_un.res.pkt; 2274 2276 mfcs.mfcs_bytes = c->mfc_un.res.bytes; 2275 2277 mfcs.mfcs_wrong_if = c->mfc_un.res.wrong_if; 2276 2278 if (nla_put_64bit(skb, RTA_MFC_STATS, sizeof(mfcs), &mfcs, RTA_PAD) || 2277 - nla_put_u64_64bit(skb, RTA_EXPIRES, 2278 - jiffies_to_clock_t(c->mfc_un.res.lastuse), 2279 + nla_put_u64_64bit(skb, RTA_EXPIRES, jiffies_to_clock_t(lastuse), 2279 2280 RTA_PAD)) 2280 2281 return -EMSGSIZE; 2281 2282
+7 -3
net/ipv6/netfilter/nft_chain_route_ipv6.c
··· 31 31 struct in6_addr saddr, daddr; 32 32 u_int8_t hop_limit; 33 33 u32 mark, flowlabel; 34 + int err; 34 35 35 36 /* malformed packet, drop it */ 36 37 if (nft_set_pktinfo_ipv6(&pkt, skb, state) < 0) ··· 47 46 flowlabel = *((u32 *)ipv6_hdr(skb)); 48 47 49 48 ret = nft_do_chain(&pkt, priv); 50 - if (ret != NF_DROP && ret != NF_QUEUE && 49 + if (ret != NF_DROP && ret != NF_STOLEN && 51 50 (memcmp(&ipv6_hdr(skb)->saddr, &saddr, sizeof(saddr)) || 52 51 memcmp(&ipv6_hdr(skb)->daddr, &daddr, sizeof(daddr)) || 53 52 skb->mark != mark || 54 53 ipv6_hdr(skb)->hop_limit != hop_limit || 55 - flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) 56 - return ip6_route_me_harder(state->net, skb) == 0 ? ret : NF_DROP; 54 + flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { 55 + err = ip6_route_me_harder(state->net, skb); 56 + if (err < 0) 57 + ret = NF_DROP_ERR(err); 58 + } 57 59 58 60 return ret; 59 61 }
+10 -1
net/ipv6/route.c
··· 1986 1986 if (!(gwa_type & IPV6_ADDR_UNICAST)) 1987 1987 goto out; 1988 1988 1989 - if (cfg->fc_table) 1989 + if (cfg->fc_table) { 1990 1990 grt = ip6_nh_lookup_table(net, cfg, gw_addr); 1991 + 1992 + if (grt) { 1993 + if (grt->rt6i_flags & RTF_GATEWAY || 1994 + (dev && dev != grt->dst.dev)) { 1995 + ip6_rt_put(grt); 1996 + grt = NULL; 1997 + } 1998 + } 1999 + } 1991 2000 1992 2001 if (!grt) 1993 2002 grt = rt6_lookup(net, gw_addr, NULL,
+11 -5
net/ipv6/xfrm6_input.c
··· 21 21 return xfrm6_extract_header(skb); 22 22 } 23 23 24 - int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 24 + int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, 25 + struct ip6_tnl *t) 25 26 { 26 - XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL; 27 + XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; 27 28 XFRM_SPI_SKB_CB(skb)->family = AF_INET6; 28 29 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); 29 30 return xfrm_input(skb, nexthdr, spi, 0); ··· 50 49 return -1; 51 50 } 52 51 53 - int xfrm6_rcv(struct sk_buff *skb) 52 + int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t) 54 53 { 55 54 return xfrm6_rcv_spi(skb, skb_network_header(skb)[IP6CB(skb)->nhoff], 56 - 0); 55 + 0, t); 56 + } 57 + EXPORT_SYMBOL(xfrm6_rcv_tnl); 58 + 59 + int xfrm6_rcv(struct sk_buff *skb) 60 + { 61 + return xfrm6_rcv_tnl(skb, NULL); 57 62 } 58 63 EXPORT_SYMBOL(xfrm6_rcv); 59 - 60 64 int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 61 65 xfrm_address_t *saddr, u8 proto) 62 66 {
+1 -1
net/ipv6/xfrm6_tunnel.c
··· 236 236 __be32 spi; 237 237 238 238 spi = xfrm6_tunnel_spi_lookup(net, (const xfrm_address_t *)&iph->saddr); 239 - return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi); 239 + return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi, NULL); 240 240 } 241 241 242 242 static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+2 -3
net/irda/af_irda.c
··· 832 832 struct sock *sk = sock->sk; 833 833 struct irda_sock *new, *self = irda_sk(sk); 834 834 struct sock *newsk; 835 - struct sk_buff *skb; 835 + struct sk_buff *skb = NULL; 836 836 int err; 837 837 838 838 err = irda_create(sock_net(sk), newsock, sk->sk_protocol, 0); ··· 900 900 err = -EPERM; /* value does not seem to make sense. -arnd */ 901 901 if (!new->tsap) { 902 902 pr_debug("%s(), dup failed!\n", __func__); 903 - kfree_skb(skb); 904 903 goto out; 905 904 } 906 905 ··· 918 919 /* Clean up the original one to keep it in listen state */ 919 920 irttp_listen(self->tsap); 920 921 921 - kfree_skb(skb); 922 922 sk->sk_ack_backlog--; 923 923 924 924 newsock->state = SS_CONNECTED; ··· 925 927 irda_connect_response(new); 926 928 err = 0; 927 929 out: 930 + kfree_skb(skb); 928 931 release_sock(sk); 929 932 return err; 930 933 }
+7 -1
net/mac80211/agg-rx.c
··· 261 261 .timeout = timeout, 262 262 .ssn = start_seq_num, 263 263 }; 264 - 265 264 int i, ret = -EOPNOTSUPP; 266 265 u16 status = WLAN_STATUS_REQUEST_DECLINED; 266 + 267 + if (tid >= IEEE80211_FIRST_TSPEC_TSID) { 268 + ht_dbg(sta->sdata, 269 + "STA %pM requests BA session on unsupported tid %d\n", 270 + sta->sta.addr, tid); 271 + goto end_no_lock; 272 + } 267 273 268 274 if (!sta->sta.ht_cap.ht_supported) { 269 275 ht_dbg(sta->sdata,
+3
net/mac80211/agg-tx.c
··· 584 584 ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) 585 585 return -EINVAL; 586 586 587 + if (WARN_ON(tid >= IEEE80211_FIRST_TSPEC_TSID)) 588 + return -EINVAL; 589 + 587 590 ht_dbg(sdata, "Open BA session requested for %pM tid %u\n", 588 591 pubsta->addr, tid); 589 592
+2 -1
net/mac80211/mesh_hwmp.c
··· 746 746 sta = next_hop_deref_protected(mpath); 747 747 if (mpath->flags & MESH_PATH_ACTIVE && 748 748 ether_addr_equal(ta, sta->sta.addr) && 749 + !(mpath->flags & MESH_PATH_FIXED) && 749 750 (!(mpath->flags & MESH_PATH_SN_VALID) || 750 751 SN_GT(target_sn, mpath->sn) || target_sn == 0)) { 751 752 mpath->flags &= ~MESH_PATH_ACTIVE; ··· 1013 1012 goto enddiscovery; 1014 1013 1015 1014 spin_lock_bh(&mpath->state_lock); 1016 - if (mpath->flags & MESH_PATH_DELETED) { 1015 + if (mpath->flags & (MESH_PATH_DELETED | MESH_PATH_FIXED)) { 1017 1016 spin_unlock_bh(&mpath->state_lock); 1018 1017 goto enddiscovery; 1019 1018 }
+1 -1
net/mac80211/mesh_pathtbl.c
··· 826 826 mpath->metric = 0; 827 827 mpath->hop_count = 0; 828 828 mpath->exp_time = 0; 829 - mpath->flags |= MESH_PATH_FIXED; 829 + mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID; 830 830 mesh_path_activate(mpath); 831 831 spin_unlock_bh(&mpath->state_lock); 832 832 mesh_path_tx_pending(mpath);
+2 -2
net/mac80211/sta_info.c
··· 1616 1616 1617 1617 sta_info_recalc_tim(sta); 1618 1618 } else { 1619 - unsigned long tids = sta->txq_buffered_tids & driver_release_tids; 1620 1619 int tid; 1621 1620 1622 1621 /* ··· 1647 1648 for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { 1648 1649 struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]); 1649 1650 1650 - if (!(tids & BIT(tid)) || txqi->tin.backlog_packets) 1651 + if (!(driver_release_tids & BIT(tid)) || 1652 + txqi->tin.backlog_packets) 1651 1653 continue; 1652 1654 1653 1655 sta_info_recalc_tim(sta);
+39 -34
net/mac80211/tx.c
··· 796 796 return ret; 797 797 } 798 798 799 + static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local, 800 + struct ieee80211_vif *vif, 801 + struct ieee80211_sta *pubsta, 802 + struct sk_buff *skb) 803 + { 804 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 805 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 806 + struct ieee80211_txq *txq = NULL; 807 + 808 + if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) || 809 + (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)) 810 + return NULL; 811 + 812 + if (!ieee80211_is_data(hdr->frame_control)) 813 + return NULL; 814 + 815 + if (pubsta) { 816 + u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; 817 + 818 + txq = pubsta->txq[tid]; 819 + } else if (vif) { 820 + txq = vif->txq; 821 + } 822 + 823 + if (!txq) 824 + return NULL; 825 + 826 + return to_txq_info(txq); 827 + } 828 + 799 829 static ieee80211_tx_result debug_noinline 800 830 ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) 801 831 { ··· 883 853 tid = *qc & IEEE80211_QOS_CTL_TID_MASK; 884 854 tx->sta->tx_stats.msdu[tid]++; 885 855 886 - if (!tx->sta->sta.txq[0]) 856 + if (!ieee80211_get_txq(tx->local, info->control.vif, &tx->sta->sta, 857 + tx->skb)) 887 858 hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid); 888 859 889 860 return TX_CONTINUE; ··· 1274 1243 return TX_CONTINUE; 1275 1244 } 1276 1245 1277 - static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local, 1278 - struct ieee80211_vif *vif, 1279 - struct ieee80211_sta *pubsta, 1280 - struct sk_buff *skb) 1281 - { 1282 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1283 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1284 - struct ieee80211_txq *txq = NULL; 1285 - 1286 - if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) || 1287 - (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)) 1288 - return NULL; 1289 - 1290 - if (!ieee80211_is_data(hdr->frame_control)) 1291 - return NULL; 1292 - 1293 - if (pubsta) { 1294 - u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; 1295 - 1296 - txq = pubsta->txq[tid]; 1297 - } else if (vif) { 1298 - txq = vif->txq; 1299 - } 1300 - 1301 - if (!txq) 1302 - return NULL; 1303 - 1304 - return to_txq_info(txq); 1305 - } 1306 - 1307 1246 static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb) 1308 1247 { 1309 1248 IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time(); ··· 1515 1514 spin_unlock_bh(&fq->lock); 1516 1515 1517 1516 if (skb && skb_has_frag_list(skb) && 1518 - !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) 1519 - skb_linearize(skb); 1517 + !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) { 1518 + if (skb_linearize(skb)) { 1519 + ieee80211_free_txskb(&local->hw, skb); 1520 + return NULL; 1521 + } 1522 + } 1520 1523 1521 1524 return skb; 1522 1525 } ··· 3269 3264 3270 3265 if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { 3271 3266 *ieee80211_get_qos_ctl(hdr) = tid; 3272 - if (!sta->sta.txq[0]) 3267 + if (!ieee80211_get_txq(local, &sdata->vif, &sta->sta, skb)) 3273 3268 hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); 3274 3269 } else { 3275 3270 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
+3 -3
net/netfilter/nf_conntrack_core.c
··· 1035 1035 if (IS_ERR(ct)) 1036 1036 return (struct nf_conntrack_tuple_hash *)ct; 1037 1037 1038 - if (tmpl && nfct_synproxy(tmpl)) { 1039 - nfct_seqadj_ext_add(ct); 1040 - nfct_synproxy_ext_add(ct); 1038 + if (!nf_ct_add_synproxy(ct, tmpl)) { 1039 + nf_conntrack_free(ct); 1040 + return ERR_PTR(-ENOMEM); 1041 1041 } 1042 1042 1043 1043 timeout_ext = tmpl ? nf_ct_timeout_find(tmpl) : NULL;
+3 -2
net/netfilter/nf_nat_core.c
··· 441 441 ct->status |= IPS_DST_NAT; 442 442 443 443 if (nfct_help(ct)) 444 - nfct_seqadj_ext_add(ct); 444 + if (!nfct_seqadj_ext_add(ct)) 445 + return NF_DROP; 445 446 } 446 447 447 448 if (maniptype == NF_NAT_MANIP_SRC) { ··· 808 807 if (err < 0) 809 808 return err; 810 809 811 - return nf_nat_setup_info(ct, &range, manip); 810 + return nf_nat_setup_info(ct, &range, manip) == NF_DROP ? -ENOMEM : 0; 812 811 } 813 812 #else 814 813 static int
+1 -1
net/netfilter/nf_tables_trace.c
··· 237 237 break; 238 238 case NFT_TRACETYPE_POLICY: 239 239 if (nla_put_be32(skb, NFTA_TRACE_POLICY, 240 - info->basechain->policy)) 240 + htonl(info->basechain->policy))) 241 241 goto nla_put_failure; 242 242 break; 243 243 }
+17 -10
net/sctp/input.c
··· 796 796 static inline int sctp_hash_cmp(struct rhashtable_compare_arg *arg, 797 797 const void *ptr) 798 798 { 799 + struct sctp_transport *t = (struct sctp_transport *)ptr; 799 800 const struct sctp_hash_cmp_arg *x = arg->key; 800 - const struct sctp_transport *t = ptr; 801 - struct sctp_association *asoc = t->asoc; 802 - const struct net *net = x->net; 801 + struct sctp_association *asoc; 802 + int err = 1; 803 803 804 804 if (!sctp_cmp_addr_exact(&t->ipaddr, x->paddr)) 805 - return 1; 806 - if (!net_eq(sock_net(asoc->base.sk), net)) 807 - return 1; 805 + return err; 806 + if (!sctp_transport_hold(t)) 807 + return err; 808 + 809 + asoc = t->asoc; 810 + if (!net_eq(sock_net(asoc->base.sk), x->net)) 811 + goto out; 808 812 if (x->ep) { 809 813 if (x->ep != asoc->ep) 810 - return 1; 814 + goto out; 811 815 } else { 812 816 if (x->laddr->v4.sin_port != htons(asoc->base.bind_addr.port)) 813 - return 1; 817 + goto out; 814 818 if (!sctp_bind_addr_match(&asoc->base.bind_addr, 815 819 x->laddr, sctp_sk(asoc->base.sk))) 816 - return 1; 820 + goto out; 817 821 } 818 822 819 - return 0; 823 + err = 0; 824 + out: 825 + sctp_transport_put(t); 826 + return err; 820 827 } 821 828 822 829 static inline u32 sctp_hash_obj(const void *data, u32 len, u32 seed)
+1 -1
net/wireless/nl80211.c
··· 6978 6978 6979 6979 params.n_counter_offsets_presp = len / sizeof(u16); 6980 6980 if (rdev->wiphy.max_num_csa_counters && 6981 - (params.n_counter_offsets_beacon > 6981 + (params.n_counter_offsets_presp > 6982 6982 rdev->wiphy.max_num_csa_counters)) 6983 6983 return -EINVAL; 6984 6984
+1
net/xfrm/xfrm_state.c
··· 332 332 { 333 333 tasklet_hrtimer_cancel(&x->mtimer); 334 334 del_timer_sync(&x->rtimer); 335 + kfree(x->aead); 335 336 kfree(x->aalg); 336 337 kfree(x->ealg); 337 338 kfree(x->calg);
+6 -3
net/xfrm/xfrm_user.c
··· 581 581 if (err) 582 582 goto error; 583 583 584 - if (attrs[XFRMA_SEC_CTX] && 585 - security_xfrm_state_alloc(x, nla_data(attrs[XFRMA_SEC_CTX]))) 586 - goto error; 584 + if (attrs[XFRMA_SEC_CTX]) { 585 + err = security_xfrm_state_alloc(x, 586 + nla_data(attrs[XFRMA_SEC_CTX])); 587 + if (err) 588 + goto error; 589 + } 587 590 588 591 if ((err = xfrm_alloc_replay_state_esn(&x->replay_esn, &x->preplay_esn, 589 592 attrs[XFRMA_REPLAY_ESN_VAL])))