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 tag 'net-6.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
"Including fixes from can. Slim pickings, I'm guessing people haven't
really started testing.

Current release - new code bugs:

- eth: mlx5e:
- psp: avoid 'accel' NULL pointer dereference
- skip PPHCR register query for FEC histogram if not supported

Previous releases - regressions:

- bonding: update the slave array for broadcast mode

- rtnetlink: re-allow deleting FDB entries in user namespace

- eth: dpaa2: fix the pointer passed to PTR_ALIGN on Tx path

Previous releases - always broken:

- can: drop skb on xmit if device is in listen-only mode

- gro: clear skb_shinfo(skb)->hwtstamps in napi_reuse_skb()

- eth: mlx5e
- RX, fix generating skb from non-linear xdp_buff if program
trims frags
- make devcom init failures non-fatal, fix races with IPSec

Misc:

- some documentation formatting 'fixes'"

* tag 'net-6.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (47 commits)
net/mlx5: Fix IPsec cleanup over MPV device
net/mlx5: Refactor devcom to return NULL on failure
net/mlx5e: Skip PPHCR register query if not supported by the device
net/mlx5: Add PPHCR to PCAM supported registers mask
virtio-net: zero unused hash fields
net: phy: micrel: always set shared->phydev for LAN8814
vsock: fix lock inversion in vsock_assign_transport()
ovpn: use datagram_poll_queue for socket readiness in TCP
espintcp: use datagram_poll_queue for socket readiness
net: datagram: introduce datagram_poll_queue for custom receive queues
net: bonding: fix possible peer notify event loss or dup issue
net: hsr: prevent creation of HSR device with slaves from another netns
sctp: avoid NULL dereference when chunk data buffer is missing
ptp: ocp: Fix typo using index 1 instead of i in SMA initialization loop
net: ravb: Ensure memory write completes before ringing TX doorbell
net: ravb: Enforce descriptor type ordering
net: hibmcge: select FIXED_PHY
net: dlink: use dev_kfree_skb_any instead of dev_kfree_skb
Documentation: networking: ax25: update the mailing list info.
net: gro_cells: fix lock imbalance in gro_cells_receive()
...

+451 -263
+4 -3
Documentation/networking/ax25.rst
··· 11 11 12 12 There is a mailing list for discussing Linux amateur radio matters 13 13 called linux-hams@vger.kernel.org. To subscribe to it, send a message to 14 - majordomo@vger.kernel.org with the words "subscribe linux-hams" in the body 15 - of the message, the subject field is ignored. You don't need to be 16 - subscribed to post but of course that means you might miss an answer. 14 + linux-hams+subscribe@vger.kernel.org or use the web interface at 15 + https://vger.kernel.org. The subject and body of the message are 16 + ignored. You don't need to be subscribed to post but of course that 17 + means you might miss an answer.
+9 -3
Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
··· 137 137 138 138 Checksum offload header fields are in big endian format. 139 139 140 + Packet format:: 141 + 140 142 Bit 0 - 6 7 8-15 16-31 141 143 Function Header Type Next Header Checksum Valid Reserved 142 144 143 145 Header Type is to indicate the type of header, this usually is set to CHECKSUM 144 146 145 147 Header types 146 - = ========================================== 148 + 149 + = =============== 147 150 0 Reserved 148 151 1 Reserved 149 152 2 checksum header 153 + = =============== 150 154 151 155 Checksum Valid is to indicate whether the header checksum is valid. Value of 1 152 156 implies that checksum is calculated on this packet and is valid, value of 0 ··· 187 183 packets and either ACK the MAP command or deliver the IP packet to the 188 184 network stack as needed 189 185 190 - MAP header|IP Packet|Optional padding|MAP header|IP Packet|Optional padding.... 186 + Packet format:: 191 187 192 - MAP header|IP Packet|Optional padding|MAP header|Command Packet|Optional pad... 188 + MAP header|IP Packet|Optional padding|MAP header|IP Packet|Optional padding.... 189 + 190 + MAP header|IP Packet|Optional padding|MAP header|Command Packet|Optional pad... 193 191 194 192 3. Userspace configuration 195 193 ==========================
+2 -4
Documentation/networking/net_failover.rst
··· 96 96 received only on the 'failover' device. 97 97 98 98 Below is the patch snippet used with 'cloud-ifupdown-helper' script found on 99 - Debian cloud images: 99 + Debian cloud images:: 100 100 101 - :: 102 101 @@ -27,6 +27,8 @@ do_setup() { 103 102 local working="$cfgdir/.$INTERFACE" 104 103 local final="$cfgdir/$INTERFACE" ··· 171 172 172 173 The following script is executed on the destination hypervisor once migration 173 174 completes, and it reattaches the VF to the VM and brings down the virtio-net 174 - interface. 175 + interface:: 175 176 176 - :: 177 177 # reattach-vf.sh 178 178 #!/bin/bash 179 179
+23 -24
drivers/net/bonding/bond_main.c
··· 2287 2287 unblock_netpoll_tx(); 2288 2288 } 2289 2289 2290 - if (bond_mode_can_use_xmit_hash(bond)) 2290 + /* broadcast mode uses the all_slaves to loop through slaves. */ 2291 + if (bond_mode_can_use_xmit_hash(bond) || 2292 + BOND_MODE(bond) == BOND_MODE_BROADCAST) 2291 2293 bond_update_slave_arr(bond, NULL); 2292 2294 2293 2295 if (!slave_dev->netdev_ops->ndo_bpf || ··· 2465 2463 2466 2464 bond_upper_dev_unlink(bond, slave); 2467 2465 2468 - if (bond_mode_can_use_xmit_hash(bond)) 2466 + if (bond_mode_can_use_xmit_hash(bond) || 2467 + BOND_MODE(bond) == BOND_MODE_BROADCAST) 2469 2468 bond_update_slave_arr(bond, slave); 2470 2469 2471 2470 slave_info(bond_dev, slave_dev, "Releasing %s interface\n", ··· 2874 2871 { 2875 2872 struct bonding *bond = container_of(work, struct bonding, 2876 2873 mii_work.work); 2877 - bool should_notify_peers = false; 2874 + bool should_notify_peers; 2878 2875 bool commit; 2879 2876 unsigned long delay; 2880 2877 struct slave *slave; ··· 2886 2883 goto re_arm; 2887 2884 2888 2885 rcu_read_lock(); 2886 + 2889 2887 should_notify_peers = bond_should_notify_peers(bond); 2890 2888 commit = !!bond_miimon_inspect(bond); 2891 - if (bond->send_peer_notif) { 2892 - rcu_read_unlock(); 2893 - if (rtnl_trylock()) { 2894 - bond->send_peer_notif--; 2895 - rtnl_unlock(); 2896 - } 2897 - } else { 2898 - rcu_read_unlock(); 2899 - } 2900 2889 2901 - if (commit) { 2890 + rcu_read_unlock(); 2891 + 2892 + if (commit || bond->send_peer_notif) { 2902 2893 /* Race avoidance with bond_close cancel of workqueue */ 2903 2894 if (!rtnl_trylock()) { 2904 2895 delay = 1; 2905 - should_notify_peers = false; 2906 2896 goto re_arm; 2907 2897 } 2908 2898 2909 - bond_for_each_slave(bond, slave, iter) { 2910 - bond_commit_link_state(slave, BOND_SLAVE_NOTIFY_LATER); 2899 + if (commit) { 2900 + bond_for_each_slave(bond, slave, iter) { 2901 + bond_commit_link_state(slave, 2902 + BOND_SLAVE_NOTIFY_LATER); 2903 + } 2904 + bond_miimon_commit(bond); 2911 2905 } 2912 - bond_miimon_commit(bond); 2906 + 2907 + if (bond->send_peer_notif) { 2908 + bond->send_peer_notif--; 2909 + if (should_notify_peers) 2910 + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, 2911 + bond->dev); 2912 + } 2913 2913 2914 2914 rtnl_unlock(); /* might sleep, hold no other locks */ 2915 2915 } ··· 2920 2914 re_arm: 2921 2915 if (bond->params.miimon) 2922 2916 queue_delayed_work(bond->wq, &bond->mii_work, delay); 2923 - 2924 - if (should_notify_peers) { 2925 - if (!rtnl_trylock()) 2926 - return; 2927 - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); 2928 - rtnl_unlock(); 2929 - } 2930 2917 } 2931 2918 2932 2919 static int bond_upper_dev_walk(struct net_device *upper,
+1 -1
drivers/net/can/bxcan.c
··· 842 842 u32 id; 843 843 int i, j; 844 844 845 - if (can_dropped_invalid_skb(ndev, skb)) 845 + if (can_dev_dropped_skb(ndev, skb)) 846 846 return NETDEV_TX_OK; 847 847 848 848 if (bxcan_tx_busy(priv))
+4 -2
drivers/net/can/dev/netlink.c
··· 452 452 } 453 453 454 454 if (data[IFLA_CAN_RESTART_MS]) { 455 - if (!priv->do_set_mode) { 455 + unsigned int restart_ms = nla_get_u32(data[IFLA_CAN_RESTART_MS]); 456 + 457 + if (restart_ms != 0 && !priv->do_set_mode) { 456 458 NL_SET_ERR_MSG(extack, 457 459 "Device doesn't support restart from Bus Off"); 458 460 return -EOPNOTSUPP; ··· 463 461 /* Do not allow changing restart delay while running */ 464 462 if (dev->flags & IFF_UP) 465 463 return -EBUSY; 466 - priv->restart_ms = nla_get_u32(data[IFLA_CAN_RESTART_MS]); 464 + priv->restart_ms = restart_ms; 467 465 } 468 466 469 467 if (data[IFLA_CAN_RESTART]) {
+1 -1
drivers/net/can/esd/esdacc.c
··· 254 254 u32 acc_id; 255 255 u32 acc_dlc; 256 256 257 - if (can_dropped_invalid_skb(netdev, skb)) 257 + if (can_dev_dropped_skb(netdev, skb)) 258 258 return NETDEV_TX_OK; 259 259 260 260 /* Access core->tx_fifo_tail only once because it may be changed
+1 -1
drivers/net/can/rockchip/rockchip_canfd-tx.c
··· 72 72 int err; 73 73 u8 i; 74 74 75 - if (can_dropped_invalid_skb(ndev, skb)) 75 + if (can_dev_dropped_skb(ndev, skb)) 76 76 return NETDEV_TX_OK; 77 77 78 78 if (!netif_subqueue_maybe_stop(priv->ndev, 0,
+1 -1
drivers/net/ethernet/dlink/dl2k.c
··· 733 733 u64 tfc_vlan_tag = 0; 734 734 735 735 if (np->link_status == 0) { /* Link Down */ 736 - dev_kfree_skb(skb); 736 + dev_kfree_skb_any(skb); 737 737 return NETDEV_TX_OK; 738 738 } 739 739 entry = np->cur_tx % TX_RING_SIZE;
+1 -2
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
··· 1077 1077 dma_addr_t addr; 1078 1078 1079 1079 buffer_start = skb->data - dpaa2_eth_needed_headroom(skb); 1080 - aligned_start = PTR_ALIGN(buffer_start - DPAA2_ETH_TX_BUF_ALIGN, 1081 - DPAA2_ETH_TX_BUF_ALIGN); 1080 + aligned_start = PTR_ALIGN(buffer_start, DPAA2_ETH_TX_BUF_ALIGN); 1082 1081 if (aligned_start >= skb->head) 1083 1082 buffer_start = aligned_start; 1084 1083 else
+21 -4
drivers/net/ethernet/freescale/enetc/enetc.c
··· 1595 1595 /* next descriptor to process */ 1596 1596 i = rx_ring->next_to_clean; 1597 1597 1598 + enetc_lock_mdio(); 1599 + 1598 1600 while (likely(rx_frm_cnt < work_limit)) { 1599 1601 union enetc_rx_bd *rxbd; 1600 1602 struct sk_buff *skb; ··· 1632 1630 rx_byte_cnt += skb->len + ETH_HLEN; 1633 1631 rx_frm_cnt++; 1634 1632 1633 + enetc_unlock_mdio(); 1635 1634 napi_gro_receive(napi, skb); 1635 + enetc_lock_mdio(); 1636 1636 } 1637 1637 1638 1638 rx_ring->next_to_clean = i; 1639 1639 1640 1640 rx_ring->stats.packets += rx_frm_cnt; 1641 1641 rx_ring->stats.bytes += rx_byte_cnt; 1642 + 1643 + enetc_unlock_mdio(); 1642 1644 1643 1645 return rx_frm_cnt; 1644 1646 } ··· 1953 1947 /* next descriptor to process */ 1954 1948 i = rx_ring->next_to_clean; 1955 1949 1950 + enetc_lock_mdio(); 1951 + 1956 1952 while (likely(rx_frm_cnt < work_limit)) { 1957 1953 union enetc_rx_bd *rxbd, *orig_rxbd; 1958 1954 struct xdp_buff xdp_buff; ··· 2018 2010 */ 2019 2011 enetc_bulk_flip_buff(rx_ring, orig_i, i); 2020 2012 2013 + enetc_unlock_mdio(); 2021 2014 napi_gro_receive(napi, skb); 2015 + enetc_lock_mdio(); 2022 2016 break; 2023 2017 case XDP_TX: 2024 2018 tx_ring = priv->xdp_tx_ring[rx_ring->index]; ··· 2055 2045 } 2056 2046 break; 2057 2047 case XDP_REDIRECT: 2048 + enetc_unlock_mdio(); 2058 2049 err = xdp_do_redirect(rx_ring->ndev, &xdp_buff, prog); 2050 + enetc_lock_mdio(); 2059 2051 if (unlikely(err)) { 2060 2052 enetc_xdp_drop(rx_ring, orig_i, i); 2061 2053 rx_ring->stats.xdp_redirect_failures++; ··· 2077 2065 rx_ring->stats.packets += rx_frm_cnt; 2078 2066 rx_ring->stats.bytes += rx_byte_cnt; 2079 2067 2080 - if (xdp_redirect_frm_cnt) 2068 + if (xdp_redirect_frm_cnt) { 2069 + enetc_unlock_mdio(); 2081 2070 xdp_do_flush(); 2071 + enetc_lock_mdio(); 2072 + } 2082 2073 2083 2074 if (xdp_tx_frm_cnt) 2084 2075 enetc_update_tx_ring_tail(tx_ring); ··· 2089 2074 if (cleaned_cnt > rx_ring->xdp.xdp_tx_in_flight) 2090 2075 enetc_refill_rx_ring(rx_ring, enetc_bd_unused(rx_ring) - 2091 2076 rx_ring->xdp.xdp_tx_in_flight); 2077 + 2078 + enetc_unlock_mdio(); 2092 2079 2093 2080 return rx_frm_cnt; 2094 2081 } ··· 2110 2093 for (i = 0; i < v->count_tx_rings; i++) 2111 2094 if (!enetc_clean_tx_ring(&v->tx_ring[i], budget)) 2112 2095 complete = false; 2096 + enetc_unlock_mdio(); 2113 2097 2114 2098 prog = rx_ring->xdp.prog; 2115 2099 if (prog) ··· 2122 2104 if (work_done) 2123 2105 v->rx_napi_work = true; 2124 2106 2125 - if (!complete) { 2126 - enetc_unlock_mdio(); 2107 + if (!complete) 2127 2108 return budget; 2128 - } 2129 2109 2130 2110 napi_complete_done(napi, work_done); 2131 2111 ··· 2132 2116 2133 2117 v->rx_napi_work = false; 2134 2118 2119 + enetc_lock_mdio(); 2135 2120 /* enable interrupts */ 2136 2121 enetc_wr_reg_hot(v->rbier, ENETC_RBIER_RXTIE); 2137 2122
+1 -1
drivers/net/ethernet/freescale/enetc/enetc.h
··· 76 76 #define ENETC_LSO_MAX_DATA_LEN SZ_256K 77 77 78 78 #define ENETC_RX_MAXFRM_SIZE ENETC_MAC_MAXFRM_SIZE 79 - #define ENETC_RXB_TRUESIZE 2048 /* PAGE_SIZE >> 1 */ 79 + #define ENETC_RXB_TRUESIZE (PAGE_SIZE >> 1) 80 80 #define ENETC_RXB_PAD NET_SKB_PAD /* add extra space if needed */ 81 81 #define ENETC_RXB_DMA_SIZE \ 82 82 (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD)
+1
drivers/net/ethernet/hisilicon/Kconfig
··· 148 148 tristate "Hisilicon BMC Gigabit Ethernet Device Support" 149 149 depends on PCI && PCI_MSI 150 150 select PHYLIB 151 + select FIXED_PHY 151 152 select MOTORCOMM_PHY 152 153 select REALTEK_PHY 153 154 help
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en/params.c
··· 100 100 return sizeof(struct mlx5_ksm) * 4; 101 101 } 102 102 WARN_ONCE(1, "MPWRQ UMR mode %d is not known\n", mode); 103 - return 0; 103 + return 1; 104 104 } 105 105 106 106 u8 mlx5e_mpwrq_log_wqe_sz(struct mlx5_core_dev *mdev, u8 page_shift,
+5
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h
··· 342 342 void mlx5e_ipsec_handle_mpv_event(int event, struct mlx5e_priv *slave_priv, 343 343 struct mlx5e_priv *master_priv); 344 344 void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event); 345 + void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv); 345 346 346 347 static inline struct mlx5_core_dev * 347 348 mlx5e_ipsec_sa2dev(struct mlx5e_ipsec_sa_entry *sa_entry) ··· 386 385 } 387 386 388 387 static inline void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event) 388 + { 389 + } 390 + 391 + static inline void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv) 389 392 { 390 393 } 391 394 #endif
+23 -2
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
··· 2893 2893 2894 2894 void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event) 2895 2895 { 2896 - if (!priv->ipsec) 2897 - return; /* IPsec not supported */ 2896 + if (!priv->ipsec || mlx5_devcom_comp_get_size(priv->devcom) < 2) 2897 + return; /* IPsec not supported or no peers */ 2898 2898 2899 2899 mlx5_devcom_send_event(priv->devcom, event, event, priv); 2900 2900 wait_for_completion(&priv->ipsec->comp); 2901 + } 2902 + 2903 + void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv) 2904 + { 2905 + struct mlx5_devcom_comp_dev *tmp = NULL; 2906 + struct mlx5e_priv *peer_priv; 2907 + 2908 + if (!priv->devcom) 2909 + return; 2910 + 2911 + if (!mlx5_devcom_for_each_peer_begin(priv->devcom)) 2912 + goto out; 2913 + 2914 + peer_priv = mlx5_devcom_get_next_peer_data(priv->devcom, &tmp); 2915 + if (peer_priv) 2916 + complete_all(&peer_priv->ipsec->comp); 2917 + 2918 + mlx5_devcom_for_each_peer_end(priv->devcom); 2919 + out: 2920 + mlx5_devcom_unregister_component(priv->devcom); 2921 + priv->devcom = NULL; 2901 2922 }
+5 -3
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 242 242 &attr, 243 243 mlx5e_devcom_event_mpv, 244 244 priv); 245 - if (IS_ERR(priv->devcom)) 246 - return PTR_ERR(priv->devcom); 245 + if (!priv->devcom) 246 + return -EINVAL; 247 247 248 248 if (mlx5_core_is_mp_master(priv->mdev)) { 249 249 mlx5_devcom_send_event(priv->devcom, MPV_DEVCOM_MASTER_UP, ··· 256 256 257 257 static void mlx5e_devcom_cleanup_mpv(struct mlx5e_priv *priv) 258 258 { 259 - if (IS_ERR_OR_NULL(priv->devcom)) 259 + if (!priv->devcom) 260 260 return; 261 261 262 262 if (mlx5_core_is_mp_master(priv->mdev)) { ··· 266 266 } 267 267 268 268 mlx5_devcom_unregister_component(priv->devcom); 269 + priv->devcom = NULL; 269 270 } 270 271 271 272 static int blocking_event(struct notifier_block *nb, unsigned long event, void *data) ··· 6121 6120 if (mlx5e_monitor_counter_supported(priv)) 6122 6121 mlx5e_monitor_counter_cleanup(priv); 6123 6122 6123 + mlx5e_ipsec_disable_events(priv); 6124 6124 mlx5e_disable_blocking_events(priv); 6125 6125 mlx5e_disable_async_events(priv); 6126 6126 mlx5_lag_remove_netdev(mdev, priv->netdev);
+42 -9
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
··· 1794 1794 } 1795 1795 1796 1796 prog = rcu_dereference(rq->xdp_prog); 1797 - if (prog && mlx5e_xdp_handle(rq, prog, mxbuf)) { 1798 - if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)) { 1799 - struct mlx5e_wqe_frag_info *pwi; 1797 + if (prog) { 1798 + u8 nr_frags_free, old_nr_frags = sinfo->nr_frags; 1800 1799 1801 - for (pwi = head_wi; pwi < wi; pwi++) 1802 - pwi->frag_page->frags++; 1800 + if (mlx5e_xdp_handle(rq, prog, mxbuf)) { 1801 + if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, 1802 + rq->flags)) { 1803 + struct mlx5e_wqe_frag_info *pwi; 1804 + 1805 + wi -= old_nr_frags - sinfo->nr_frags; 1806 + 1807 + for (pwi = head_wi; pwi < wi; pwi++) 1808 + pwi->frag_page->frags++; 1809 + } 1810 + return NULL; /* page/packet was consumed by XDP */ 1803 1811 } 1804 - return NULL; /* page/packet was consumed by XDP */ 1812 + 1813 + nr_frags_free = old_nr_frags - sinfo->nr_frags; 1814 + if (unlikely(nr_frags_free)) { 1815 + wi -= nr_frags_free; 1816 + truesize -= nr_frags_free * frag_info->frag_stride; 1817 + } 1805 1818 } 1806 1819 1807 1820 skb = mlx5e_build_linear_skb( ··· 2040 2027 u32 byte_cnt = cqe_bcnt; 2041 2028 struct skb_shared_info *sinfo; 2042 2029 unsigned int truesize = 0; 2030 + u32 pg_consumed_bytes; 2043 2031 struct bpf_prog *prog; 2044 2032 struct sk_buff *skb; 2045 2033 u32 linear_frame_sz; ··· 2094 2080 2095 2081 while (byte_cnt) { 2096 2082 /* Non-linear mode, hence non-XSK, which always uses PAGE_SIZE. */ 2097 - u32 pg_consumed_bytes = min_t(u32, PAGE_SIZE - frag_offset, byte_cnt); 2083 + pg_consumed_bytes = 2084 + min_t(u32, PAGE_SIZE - frag_offset, byte_cnt); 2098 2085 2099 2086 if (test_bit(MLX5E_RQ_STATE_SHAMPO, &rq->state)) 2100 2087 truesize += pg_consumed_bytes; ··· 2111 2096 } 2112 2097 2113 2098 if (prog) { 2099 + u8 nr_frags_free, old_nr_frags = sinfo->nr_frags; 2100 + u32 len; 2101 + 2114 2102 if (mlx5e_xdp_handle(rq, prog, mxbuf)) { 2115 2103 if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)) { 2116 2104 struct mlx5e_frag_page *pfp; 2105 + 2106 + frag_page -= old_nr_frags - sinfo->nr_frags; 2117 2107 2118 2108 for (pfp = head_page; pfp < frag_page; pfp++) 2119 2109 pfp->frags++; ··· 2130 2110 return NULL; /* page/packet was consumed by XDP */ 2131 2111 } 2132 2112 2113 + nr_frags_free = old_nr_frags - sinfo->nr_frags; 2114 + if (unlikely(nr_frags_free)) { 2115 + frag_page -= nr_frags_free; 2116 + truesize -= (nr_frags_free - 1) * PAGE_SIZE + 2117 + ALIGN(pg_consumed_bytes, 2118 + BIT(rq->mpwqe.log_stride_sz)); 2119 + } 2120 + 2121 + len = mxbuf->xdp.data_end - mxbuf->xdp.data; 2122 + 2133 2123 skb = mlx5e_build_linear_skb( 2134 2124 rq, mxbuf->xdp.data_hard_start, linear_frame_sz, 2135 - mxbuf->xdp.data - mxbuf->xdp.data_hard_start, 0, 2125 + mxbuf->xdp.data - mxbuf->xdp.data_hard_start, len, 2136 2126 mxbuf->xdp.data - mxbuf->xdp.data_meta); 2137 2127 if (unlikely(!skb)) { 2138 2128 mlx5e_page_release_fragmented(rq->page_pool, ··· 2167 2137 do 2168 2138 pagep->frags++; 2169 2139 while (++pagep < frag_page); 2140 + 2141 + headlen = min_t(u16, MLX5E_RX_MAX_HEAD - len, 2142 + skb->data_len); 2143 + __pskb_pull_tail(skb, headlen); 2170 2144 } 2171 - __pskb_pull_tail(skb, headlen); 2172 2145 } else { 2173 2146 dma_addr_t addr; 2174 2147
+3 -1
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 1614 1614 1615 1615 fec_set_corrected_bits_total(priv, fec_stats); 1616 1616 fec_set_block_stats(priv, mode, fec_stats); 1617 - fec_set_histograms_stats(priv, mode, hist); 1617 + 1618 + if (MLX5_CAP_PCAM_REG(priv->mdev, pphcr)) 1619 + fec_set_histograms_stats(priv, mode, hist); 1618 1620 } 1619 1621 1620 1622 #define PPORT_ETH_EXT_OFF(c) \
+4 -3
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
··· 256 256 u8 mode; 257 257 258 258 #ifdef CONFIG_MLX5_EN_TLS 259 - if (accel && accel->tls.tls_tisn) 259 + if (accel->tls.tls_tisn) 260 260 return MLX5_INLINE_MODE_TCP_UDP; 261 261 #endif 262 262 ··· 982 982 struct mlx5e_tx_attr attr; 983 983 struct mlx5i_tx_wqe *wqe; 984 984 985 + struct mlx5e_accel_tx_state accel = {}; 985 986 struct mlx5_wqe_datagram_seg *datagram; 986 987 struct mlx5_wqe_ctrl_seg *cseg; 987 988 struct mlx5_wqe_eth_seg *eseg; ··· 993 992 int num_dma; 994 993 u16 pi; 995 994 996 - mlx5e_sq_xmit_prepare(sq, skb, NULL, &attr); 995 + mlx5e_sq_xmit_prepare(sq, skb, &accel, &attr); 997 996 mlx5i_sq_calc_wqe_attr(skb, &attr, &wqe_attr); 998 997 999 998 pi = mlx5e_txqsq_get_next_pi(sq, wqe_attr.num_wqebbs); ··· 1010 1009 1011 1010 mlx5i_txwqe_build_datagram(av, dqpn, dqkey, datagram); 1012 1011 1013 - mlx5e_txwqe_build_eseg_csum(sq, skb, NULL, eseg); 1012 + mlx5e_txwqe_build_eseg_csum(sq, skb, &accel, eseg); 1014 1013 1015 1014 eseg->mss = attr.mss; 1016 1015
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 3129 3129 attr, 3130 3130 mlx5_esw_offloads_devcom_event, 3131 3131 esw); 3132 - if (IS_ERR(esw->devcom)) 3132 + if (!esw->devcom) 3133 3133 return; 3134 3134 3135 3135 mlx5_devcom_send_event(esw->devcom, ··· 3140 3140 3141 3141 void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw) 3142 3142 { 3143 - if (IS_ERR_OR_NULL(esw->devcom)) 3143 + if (!esw->devcom) 3144 3144 return; 3145 3145 3146 3146 mlx5_devcom_send_event(esw->devcom,
+3 -4
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
··· 1430 1430 mlx5_devcom_register_component(dev->priv.devc, 1431 1431 MLX5_DEVCOM_HCA_PORTS, 1432 1432 &attr, NULL, dev); 1433 - if (IS_ERR(dev->priv.hca_devcom_comp)) { 1433 + if (!dev->priv.hca_devcom_comp) { 1434 1434 mlx5_core_err(dev, 1435 - "Failed to register devcom HCA component, err: %ld\n", 1436 - PTR_ERR(dev->priv.hca_devcom_comp)); 1437 - return PTR_ERR(dev->priv.hca_devcom_comp); 1435 + "Failed to register devcom HCA component."); 1436 + return -EINVAL; 1438 1437 } 1439 1438 1440 1439 return 0;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
··· 1444 1444 compd = mlx5_devcom_register_component(mdev->priv.devc, 1445 1445 MLX5_DEVCOM_SHARED_CLOCK, 1446 1446 &attr, NULL, mdev); 1447 - if (IS_ERR(compd)) 1447 + if (!compd) 1448 1448 return; 1449 1449 1450 1450 mdev->clock_state->compdev = compd;
+26 -27
drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c
··· 76 76 struct mlx5_devcom_dev * 77 77 mlx5_devcom_register_device(struct mlx5_core_dev *dev) 78 78 { 79 - struct mlx5_devcom_dev *devc; 79 + struct mlx5_devcom_dev *devc = NULL; 80 80 81 81 mutex_lock(&dev_list_lock); 82 82 83 83 if (devcom_dev_exists(dev)) { 84 - devc = ERR_PTR(-EEXIST); 84 + mlx5_core_err(dev, "devcom device already exists"); 85 85 goto out; 86 86 } 87 87 88 88 devc = mlx5_devcom_dev_alloc(dev); 89 - if (!devc) { 90 - devc = ERR_PTR(-ENOMEM); 89 + if (!devc) 91 90 goto out; 92 - } 93 91 94 92 list_add_tail(&devc->list, &devcom_dev_list); 95 93 out: ··· 108 110 109 111 void mlx5_devcom_unregister_device(struct mlx5_devcom_dev *devc) 110 112 { 111 - if (!IS_ERR_OR_NULL(devc)) 112 - kref_put(&devc->ref, mlx5_devcom_dev_release); 113 + if (!devc) 114 + return; 115 + 116 + kref_put(&devc->ref, mlx5_devcom_dev_release); 113 117 } 114 118 115 119 static struct mlx5_devcom_comp * ··· 122 122 123 123 comp = kzalloc(sizeof(*comp), GFP_KERNEL); 124 124 if (!comp) 125 - return ERR_PTR(-ENOMEM); 125 + return NULL; 126 126 127 127 comp->id = id; 128 128 comp->key.key = attr->key; ··· 160 160 161 161 devcom = kzalloc(sizeof(*devcom), GFP_KERNEL); 162 162 if (!devcom) 163 - return ERR_PTR(-ENOMEM); 163 + return NULL; 164 164 165 165 kref_get(&devc->ref); 166 166 devcom->devc = devc; ··· 240 240 mlx5_devcom_event_handler_t handler, 241 241 void *data) 242 242 { 243 - struct mlx5_devcom_comp_dev *devcom; 243 + struct mlx5_devcom_comp_dev *devcom = NULL; 244 244 struct mlx5_devcom_comp *comp; 245 245 246 - if (IS_ERR_OR_NULL(devc)) 247 - return ERR_PTR(-EINVAL); 246 + if (!devc) 247 + return NULL; 248 248 249 249 mutex_lock(&comp_list_lock); 250 250 comp = devcom_component_get(devc, id, attr, handler); 251 - if (IS_ERR(comp)) { 252 - devcom = ERR_PTR(-EINVAL); 251 + if (IS_ERR(comp)) 253 252 goto out_unlock; 254 - } 255 253 256 254 if (!comp) { 257 255 comp = mlx5_devcom_comp_alloc(id, attr, handler); 258 - if (IS_ERR(comp)) { 259 - devcom = ERR_CAST(comp); 256 + if (!comp) 260 257 goto out_unlock; 261 - } 258 + 262 259 list_add_tail(&comp->comp_list, &devcom_comp_list); 263 260 } 264 261 mutex_unlock(&comp_list_lock); 265 262 266 263 devcom = devcom_alloc_comp_dev(devc, comp, data); 267 - if (IS_ERR(devcom)) 264 + if (!devcom) 268 265 kref_put(&comp->ref, mlx5_devcom_comp_release); 269 266 270 267 return devcom; ··· 273 276 274 277 void mlx5_devcom_unregister_component(struct mlx5_devcom_comp_dev *devcom) 275 278 { 276 - if (!IS_ERR_OR_NULL(devcom)) 277 - devcom_free_comp_dev(devcom); 279 + if (!devcom) 280 + return; 281 + 282 + devcom_free_comp_dev(devcom); 278 283 } 279 284 280 285 int mlx5_devcom_comp_get_size(struct mlx5_devcom_comp_dev *devcom) ··· 295 296 int err = 0; 296 297 void *data; 297 298 298 - if (IS_ERR_OR_NULL(devcom)) 299 + if (!devcom) 299 300 return -ENODEV; 300 301 301 302 comp = devcom->comp; ··· 337 338 338 339 bool mlx5_devcom_comp_is_ready(struct mlx5_devcom_comp_dev *devcom) 339 340 { 340 - if (IS_ERR_OR_NULL(devcom)) 341 + if (!devcom) 341 342 return false; 342 343 343 344 return READ_ONCE(devcom->comp->ready); ··· 347 348 { 348 349 struct mlx5_devcom_comp *comp; 349 350 350 - if (IS_ERR_OR_NULL(devcom)) 351 + if (!devcom) 351 352 return false; 352 353 353 354 comp = devcom->comp; ··· 420 421 421 422 void mlx5_devcom_comp_lock(struct mlx5_devcom_comp_dev *devcom) 422 423 { 423 - if (IS_ERR_OR_NULL(devcom)) 424 + if (!devcom) 424 425 return; 425 426 down_write(&devcom->comp->sem); 426 427 } 427 428 428 429 void mlx5_devcom_comp_unlock(struct mlx5_devcom_comp_dev *devcom) 429 430 { 430 - if (IS_ERR_OR_NULL(devcom)) 431 + if (!devcom) 431 432 return; 432 433 up_write(&devcom->comp->sem); 433 434 } 434 435 435 436 int mlx5_devcom_comp_trylock(struct mlx5_devcom_comp_dev *devcom) 436 437 { 437 - if (IS_ERR_OR_NULL(devcom)) 438 + if (!devcom) 438 439 return 0; 439 440 return down_write_trylock(&devcom->comp->sem); 440 441 }
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c
··· 221 221 attr.net = mlx5_core_net(dev); 222 222 devcom = mlx5_devcom_register_component(dev->priv.devc, MLX5_DEVCOM_SD_GROUP, 223 223 &attr, NULL, dev); 224 - if (IS_ERR(devcom)) 225 - return PTR_ERR(devcom); 224 + if (!devcom) 225 + return -EINVAL; 226 226 227 227 sd->devcom = devcom; 228 228
+2 -3
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 978 978 int err; 979 979 980 980 dev->priv.devc = mlx5_devcom_register_device(dev); 981 - if (IS_ERR(dev->priv.devc)) 982 - mlx5_core_warn(dev, "failed to register devcom device %pe\n", 983 - dev->priv.devc); 981 + if (!dev->priv.devc) 982 + mlx5_core_warn(dev, "failed to register devcom device\n"); 984 983 985 984 err = mlx5_query_board_id(dev); 986 985 if (err) {
+22 -2
drivers/net/ethernet/renesas/ravb_main.c
··· 2211 2211 2212 2212 skb_tx_timestamp(skb); 2213 2213 } 2214 - /* Descriptor type must be set after all the above writes */ 2215 - dma_wmb(); 2214 + 2216 2215 if (num_tx_desc > 1) { 2217 2216 desc->die_dt = DT_FEND; 2218 2217 desc--; 2218 + /* When using multi-descriptors, DT_FEND needs to get written 2219 + * before DT_FSTART, but the compiler may reorder the memory 2220 + * writes in an attempt to optimize the code. 2221 + * Use a dma_wmb() barrier to make sure DT_FEND and DT_FSTART 2222 + * are written exactly in the order shown in the code. 2223 + * This is particularly important for cases where the DMA engine 2224 + * is already running when we are running this code. If the DMA 2225 + * sees DT_FSTART without the corresponding DT_FEND it will enter 2226 + * an error condition. 2227 + */ 2228 + dma_wmb(); 2219 2229 desc->die_dt = DT_FSTART; 2220 2230 } else { 2231 + /* Descriptor type must be set after all the above writes */ 2232 + dma_wmb(); 2221 2233 desc->die_dt = DT_FSINGLE; 2222 2234 } 2235 + 2236 + /* Before ringing the doorbell we need to make sure that the latest 2237 + * writes have been committed to memory, otherwise it could delay 2238 + * things until the doorbell is rang again. 2239 + * This is in replacement of the read operation mentioned in the HW 2240 + * manuals. 2241 + */ 2242 + dma_wmb(); 2223 2243 ravb_modify(ndev, TCCR, TCCR_TSRQ0 << q, TCCR_TSRQ0 << q); 2224 2244 2225 2245 priv->cur_tx[q] += num_tx_desc;
+5 -4
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
··· 1446 1446 } 1447 1447 } else { 1448 1448 if (bsp_priv->clk_enabled) { 1449 + if (bsp_priv->ops && bsp_priv->ops->set_clock_selection) { 1450 + bsp_priv->ops->set_clock_selection(bsp_priv, 1451 + bsp_priv->clock_input, false); 1452 + } 1453 + 1449 1454 clk_bulk_disable_unprepare(bsp_priv->num_clks, 1450 1455 bsp_priv->clks); 1451 1456 clk_disable_unprepare(bsp_priv->clk_phy); 1452 - 1453 - if (bsp_priv->ops && bsp_priv->ops->set_clock_selection) 1454 - bsp_priv->ops->set_clock_selection(bsp_priv, 1455 - bsp_priv->clock_input, false); 1456 1457 1457 1458 bsp_priv->clk_enabled = false; 1458 1459 }
+43 -20
drivers/net/ethernet/ti/am65-cpts.c
··· 163 163 struct device_node *clk_mux_np; 164 164 struct clk *refclk; 165 165 u32 refclk_freq; 166 - struct list_head events; 166 + /* separate lists to handle TX and RX timestamp independently */ 167 + struct list_head events_tx; 168 + struct list_head events_rx; 167 169 struct list_head pool; 168 170 struct am65_cpts_event pool_data[AM65_CPTS_MAX_EVENTS]; 169 171 spinlock_t lock; /* protects events lists*/ ··· 229 227 am65_cpts_write32(cpts, 0, int_enable); 230 228 } 231 229 230 + static int am65_cpts_purge_event_list(struct am65_cpts *cpts, 231 + struct list_head *events) 232 + { 233 + struct list_head *this, *next; 234 + struct am65_cpts_event *event; 235 + int removed = 0; 236 + 237 + list_for_each_safe(this, next, events) { 238 + event = list_entry(this, struct am65_cpts_event, list); 239 + if (time_after(jiffies, event->tmo)) { 240 + list_del_init(&event->list); 241 + list_add(&event->list, &cpts->pool); 242 + ++removed; 243 + } 244 + } 245 + return removed; 246 + } 247 + 232 248 static int am65_cpts_event_get_port(struct am65_cpts_event *event) 233 249 { 234 250 return (event->event1 & AM65_CPTS_EVENT_1_PORT_NUMBER_MASK) >> ··· 259 239 AM65_CPTS_EVENT_1_EVENT_TYPE_SHIFT; 260 240 } 261 241 262 - static int am65_cpts_cpts_purge_events(struct am65_cpts *cpts) 242 + static int am65_cpts_purge_events(struct am65_cpts *cpts) 263 243 { 264 - struct list_head *this, *next; 265 - struct am65_cpts_event *event; 266 244 int removed = 0; 267 245 268 - list_for_each_safe(this, next, &cpts->events) { 269 - event = list_entry(this, struct am65_cpts_event, list); 270 - if (time_after(jiffies, event->tmo)) { 271 - list_del_init(&event->list); 272 - list_add(&event->list, &cpts->pool); 273 - ++removed; 274 - } 275 - } 246 + removed += am65_cpts_purge_event_list(cpts, &cpts->events_tx); 247 + removed += am65_cpts_purge_event_list(cpts, &cpts->events_rx); 276 248 277 249 if (removed) 278 250 dev_dbg(cpts->dev, "event pool cleaned up %d\n", removed); ··· 299 287 struct am65_cpts_event, list); 300 288 301 289 if (!event) { 302 - if (am65_cpts_cpts_purge_events(cpts)) { 290 + if (am65_cpts_purge_events(cpts)) { 303 291 dev_err(cpts->dev, "cpts: event pool empty\n"); 304 292 ret = -1; 305 293 goto out; ··· 318 306 cpts->timestamp); 319 307 break; 320 308 case AM65_CPTS_EV_RX: 309 + event->tmo = jiffies + 310 + msecs_to_jiffies(AM65_CPTS_EVENT_RX_TX_TIMEOUT); 311 + 312 + list_move_tail(&event->list, &cpts->events_rx); 313 + 314 + dev_dbg(cpts->dev, 315 + "AM65_CPTS_EV_RX e1:%08x e2:%08x t:%lld\n", 316 + event->event1, event->event2, 317 + event->timestamp); 318 + break; 321 319 case AM65_CPTS_EV_TX: 322 320 event->tmo = jiffies + 323 321 msecs_to_jiffies(AM65_CPTS_EVENT_RX_TX_TIMEOUT); 324 322 325 - list_move_tail(&event->list, &cpts->events); 323 + list_move_tail(&event->list, &cpts->events_tx); 326 324 327 325 dev_dbg(cpts->dev, 328 326 "AM65_CPTS_EV_TX e1:%08x e2:%08x t:%lld\n", ··· 850 828 return found; 851 829 } 852 830 853 - static void am65_cpts_find_ts(struct am65_cpts *cpts) 831 + static void am65_cpts_find_tx_ts(struct am65_cpts *cpts) 854 832 { 855 833 struct am65_cpts_event *event; 856 834 struct list_head *this, *next; ··· 859 837 LIST_HEAD(events); 860 838 861 839 spin_lock_irqsave(&cpts->lock, flags); 862 - list_splice_init(&cpts->events, &events); 840 + list_splice_init(&cpts->events_tx, &events); 863 841 spin_unlock_irqrestore(&cpts->lock, flags); 864 842 865 843 list_for_each_safe(this, next, &events) { ··· 872 850 } 873 851 874 852 spin_lock_irqsave(&cpts->lock, flags); 875 - list_splice_tail(&events, &cpts->events); 853 + list_splice_tail(&events, &cpts->events_tx); 876 854 list_splice_tail(&events_free, &cpts->pool); 877 855 spin_unlock_irqrestore(&cpts->lock, flags); 878 856 } ··· 883 861 unsigned long flags; 884 862 long delay = -1; 885 863 886 - am65_cpts_find_ts(cpts); 864 + am65_cpts_find_tx_ts(cpts); 887 865 888 866 spin_lock_irqsave(&cpts->txq.lock, flags); 889 867 if (!skb_queue_empty(&cpts->txq)) ··· 927 905 928 906 spin_lock_irqsave(&cpts->lock, flags); 929 907 __am65_cpts_fifo_read(cpts); 930 - list_for_each_safe(this, next, &cpts->events) { 908 + list_for_each_safe(this, next, &cpts->events_rx) { 931 909 event = list_entry(this, struct am65_cpts_event, list); 932 910 if (time_after(jiffies, event->tmo)) { 933 911 list_move(&event->list, &cpts->pool); ··· 1177 1155 return ERR_PTR(ret); 1178 1156 1179 1157 mutex_init(&cpts->ptp_clk_lock); 1180 - INIT_LIST_HEAD(&cpts->events); 1158 + INIT_LIST_HEAD(&cpts->events_tx); 1159 + INIT_LIST_HEAD(&cpts->events_rx); 1181 1160 INIT_LIST_HEAD(&cpts->pool); 1182 1161 spin_lock_init(&cpts->lock); 1183 1162 skb_queue_head_init(&cpts->txq);
+22 -4
drivers/net/ovpn/tcp.c
··· 560 560 static __poll_t ovpn_tcp_poll(struct file *file, struct socket *sock, 561 561 poll_table *wait) 562 562 { 563 - __poll_t mask = datagram_poll(file, sock, wait); 563 + struct sk_buff_head *queue = &sock->sk->sk_receive_queue; 564 564 struct ovpn_socket *ovpn_sock; 565 + struct ovpn_peer *peer = NULL; 566 + __poll_t mask; 565 567 566 568 rcu_read_lock(); 567 569 ovpn_sock = rcu_dereference_sk_user_data(sock->sk); 568 - if (ovpn_sock && ovpn_sock->peer && 569 - !skb_queue_empty(&ovpn_sock->peer->tcp.user_queue)) 570 - mask |= EPOLLIN | EPOLLRDNORM; 570 + /* if we landed in this callback, we expect to have a 571 + * meaningful state. The ovpn_socket lifecycle would 572 + * prevent it otherwise. 573 + */ 574 + if (WARN(!ovpn_sock || !ovpn_sock->peer, 575 + "ovpn: null state in ovpn_tcp_poll!")) { 576 + rcu_read_unlock(); 577 + return 0; 578 + } 579 + 580 + if (ovpn_peer_hold(ovpn_sock->peer)) { 581 + peer = ovpn_sock->peer; 582 + queue = &peer->tcp.user_queue; 583 + } 571 584 rcu_read_unlock(); 585 + 586 + mask = datagram_poll_queue(file, sock, wait, queue); 587 + 588 + if (peer) 589 + ovpn_peer_put(peer); 572 590 573 591 return mask; 574 592 }
+2 -2
drivers/net/phy/micrel.c
··· 4262 4262 { 4263 4263 struct lan8814_shared_priv *shared = phy_package_get_priv(phydev); 4264 4264 4265 + shared->phydev = phydev; 4266 + 4265 4267 /* Initialise shared lock for clock*/ 4266 4268 mutex_init(&shared->shared_lock); 4267 4269 ··· 4318 4316 return 0; 4319 4317 4320 4318 phydev_dbg(phydev, "successfully registered ptp clock\n"); 4321 - 4322 - shared->phydev = phydev; 4323 4319 4324 4320 /* The EP.4 is shared between all the PHYs in the package and also it 4325 4321 * can be accessed by any of the PHYs
+8 -8
drivers/net/phy/realtek/realtek_main.c
··· 154 154 #define RTL_8211FVD_PHYID 0x001cc878 155 155 #define RTL_8221B 0x001cc840 156 156 #define RTL_8221B_VB_CG 0x001cc849 157 - #define RTL_8221B_VN_CG 0x001cc84a 157 + #define RTL_8221B_VM_CG 0x001cc84a 158 158 #define RTL_8251B 0x001cc862 159 159 #define RTL_8261C 0x001cc890 160 160 ··· 1523 1523 return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, true); 1524 1524 } 1525 1525 1526 - static int rtl8221b_vn_cg_c22_match_phy_device(struct phy_device *phydev, 1526 + static int rtl8221b_vm_cg_c22_match_phy_device(struct phy_device *phydev, 1527 1527 const struct phy_driver *phydrv) 1528 1528 { 1529 - return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, false); 1529 + return rtlgen_is_c45_match(phydev, RTL_8221B_VM_CG, false); 1530 1530 } 1531 1531 1532 - static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev, 1532 + static int rtl8221b_vm_cg_c45_match_phy_device(struct phy_device *phydev, 1533 1533 const struct phy_driver *phydrv) 1534 1534 { 1535 - return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); 1535 + return rtlgen_is_c45_match(phydev, RTL_8221B_VM_CG, true); 1536 1536 } 1537 1537 1538 1538 static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev, ··· 1879 1879 .suspend = genphy_c45_pma_suspend, 1880 1880 .resume = rtlgen_c45_resume, 1881 1881 }, { 1882 - .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, 1882 + .match_phy_device = rtl8221b_vm_cg_c22_match_phy_device, 1883 1883 .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", 1884 1884 .probe = rtl822x_probe, 1885 1885 .get_features = rtl822x_get_features, ··· 1892 1892 .read_page = rtl821x_read_page, 1893 1893 .write_page = rtl821x_write_page, 1894 1894 }, { 1895 - .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, 1896 - .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", 1895 + .match_phy_device = rtl8221b_vm_cg_c45_match_phy_device, 1896 + .name = "RTL8221B-VM-CG 2.5Gbps PHY (C45)", 1897 1897 .probe = rtl822x_probe, 1898 1898 .config_init = rtl822xb_config_init, 1899 1899 .get_rate_matching = rtl822xb_get_rate_matching,
+9 -2
drivers/net/usb/rtl8150.c
··· 685 685 rtl8150_t *dev = netdev_priv(netdev); 686 686 int count, res; 687 687 688 + /* pad the frame and ensure terminating USB packet, datasheet 9.2.3 */ 689 + count = max(skb->len, ETH_ZLEN); 690 + if (count % 64 == 0) 691 + count++; 692 + if (skb_padto(skb, count)) { 693 + netdev->stats.tx_dropped++; 694 + return NETDEV_TX_OK; 695 + } 696 + 688 697 netif_stop_queue(netdev); 689 - count = (skb->len < 60) ? 60 : skb->len; 690 - count = (count & 0x3f) ? count : count + 1; 691 698 dev->tx_skb = skb; 692 699 usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2), 693 700 skb->data, count, write_bulk_callback, dev);
+1 -1
drivers/ptp/ptp_ocp.c
··· 2548 2548 for (i = 0; i < OCP_SMA_NUM; i++) { 2549 2549 bp->sma[i].fixed_fcn = true; 2550 2550 bp->sma[i].fixed_dir = true; 2551 - bp->sma[1].dpll_prop.capabilities &= 2551 + bp->sma[i].dpll_prop.capabilities &= 2552 2552 ~DPLL_PIN_CAPABILITIES_DIRECTION_CAN_CHANGE; 2553 2553 } 2554 2554 return;
+3 -1
include/linux/mlx5/mlx5_ifc.h
··· 10833 10833 u8 port_access_reg_cap_mask_127_to_96[0x20]; 10834 10834 u8 port_access_reg_cap_mask_95_to_64[0x20]; 10835 10835 10836 - u8 port_access_reg_cap_mask_63_to_36[0x1c]; 10836 + u8 port_access_reg_cap_mask_63[0x1]; 10837 + u8 pphcr[0x1]; 10838 + u8 port_access_reg_cap_mask_61_to_36[0x1a]; 10837 10839 u8 pplm[0x1]; 10838 10840 u8 port_access_reg_cap_mask_34_to_32[0x3]; 10839 10841
+3
include/linux/skbuff.h
··· 4204 4204 struct sk_buff_head *sk_queue, 4205 4205 unsigned int flags, int *off, int *err); 4206 4206 struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned int flags, int *err); 4207 + __poll_t datagram_poll_queue(struct file *file, struct socket *sock, 4208 + struct poll_table_struct *wait, 4209 + struct sk_buff_head *rcv_queue); 4207 4210 __poll_t datagram_poll(struct file *file, struct socket *sock, 4208 4211 struct poll_table_struct *wait); 4209 4212 int skb_copy_datagram_iter(const struct sk_buff *from, int offset,
+4
include/linux/virtio_net.h
··· 401 401 if (!tnl_hdr_negotiated) 402 402 return -EINVAL; 403 403 404 + vhdr->hash_hdr.hash_value = 0; 405 + vhdr->hash_hdr.hash_report = 0; 406 + vhdr->hash_hdr.padding = 0; 407 + 404 408 /* Let the basic parsing deal with plain GSO features. */ 405 409 skb_shinfo(skb)->gso_type &= ~tnl_gso_type; 406 410 ret = virtio_net_hdr_from_skb(skb, hdr, true, false, vlan_hlen);
+34 -10
net/core/datagram.c
··· 920 920 EXPORT_SYMBOL(skb_copy_and_csum_datagram_msg); 921 921 922 922 /** 923 - * datagram_poll - generic datagram poll 923 + * datagram_poll_queue - same as datagram_poll, but on a specific receive 924 + * queue 924 925 * @file: file struct 925 926 * @sock: socket 926 927 * @wait: poll table 928 + * @rcv_queue: receive queue to poll 927 929 * 928 - * Datagram poll: Again totally generic. This also handles 929 - * sequenced packet sockets providing the socket receive queue 930 - * is only ever holding data ready to receive. 930 + * Performs polling on the given receive queue, handling shutdown, error, 931 + * and connection state. This is useful for protocols that deliver 932 + * userspace-bound packets through a custom queue instead of 933 + * sk->sk_receive_queue. 931 934 * 932 - * Note: when you *don't* use this routine for this protocol, 933 - * and you use a different write policy from sock_writeable() 934 - * then please supply your own write_space callback. 935 + * Return: poll bitmask indicating the socket's current state 935 936 */ 936 - __poll_t datagram_poll(struct file *file, struct socket *sock, 937 - poll_table *wait) 937 + __poll_t datagram_poll_queue(struct file *file, struct socket *sock, 938 + poll_table *wait, struct sk_buff_head *rcv_queue) 938 939 { 939 940 struct sock *sk = sock->sk; 940 941 __poll_t mask; ··· 957 956 mask |= EPOLLHUP; 958 957 959 958 /* readable? */ 960 - if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 959 + if (!skb_queue_empty_lockless(rcv_queue)) 961 960 mask |= EPOLLIN | EPOLLRDNORM; 962 961 963 962 /* Connection-based need to check for termination and startup */ ··· 978 977 sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); 979 978 980 979 return mask; 980 + } 981 + EXPORT_SYMBOL(datagram_poll_queue); 982 + 983 + /** 984 + * datagram_poll - generic datagram poll 985 + * @file: file struct 986 + * @sock: socket 987 + * @wait: poll table 988 + * 989 + * Datagram poll: Again totally generic. This also handles 990 + * sequenced packet sockets providing the socket receive queue 991 + * is only ever holding data ready to receive. 992 + * 993 + * Note: when you *don't* use this routine for this protocol, 994 + * and you use a different write policy from sock_writeable() 995 + * then please supply your own write_space callback. 996 + * 997 + * Return: poll bitmask indicating the socket's current state 998 + */ 999 + __poll_t datagram_poll(struct file *file, struct socket *sock, poll_table *wait) 1000 + { 1001 + return datagram_poll_queue(file, sock, wait, 1002 + &sock->sk->sk_receive_queue); 981 1003 } 982 1004 EXPORT_SYMBOL(datagram_poll);
+8 -2
net/core/gro.c
··· 639 639 640 640 static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) 641 641 { 642 + struct skb_shared_info *shinfo; 643 + 642 644 if (unlikely(skb->pfmemalloc)) { 643 645 consume_skb(skb); 644 646 return; ··· 657 655 658 656 skb->encapsulation = 0; 659 657 skb->ip_summed = CHECKSUM_NONE; 660 - skb_shinfo(skb)->gso_type = 0; 661 - skb_shinfo(skb)->gso_size = 0; 658 + 659 + shinfo = skb_shinfo(skb); 660 + shinfo->gso_type = 0; 661 + shinfo->gso_size = 0; 662 + shinfo->hwtstamps.hwtstamp = 0; 663 + 662 664 if (unlikely(skb->slow_gro)) { 663 665 skb_orphan(skb); 664 666 skb_ext_reset(skb);
+2 -3
net/core/gro_cells.c
··· 43 43 if (skb_queue_len(&cell->napi_skbs) == 1) 44 44 napi_schedule(&cell->napi); 45 45 46 - if (have_bh_lock) 47 - local_unlock_nested_bh(&gcells->cells->bh_lock); 48 - 49 46 res = NET_RX_SUCCESS; 50 47 51 48 unlock: 49 + if (have_bh_lock) 50 + local_unlock_nested_bh(&gcells->cells->bh_lock); 52 51 rcu_read_unlock(); 53 52 return res; 54 53 }
-3
net/core/rtnetlink.c
··· 4715 4715 int err; 4716 4716 u16 vid; 4717 4717 4718 - if (!netlink_capable(skb, CAP_NET_ADMIN)) 4719 - return -EPERM; 4720 - 4721 4718 if (!del_bulk) { 4722 4719 err = nlmsg_parse_deprecated(nlh, sizeof(*ndm), tb, NDA_MAX, 4723 4720 NULL, extack);
+7 -1
net/hsr/hsr_netlink.c
··· 34 34 struct netlink_ext_ack *extack) 35 35 { 36 36 struct net *link_net = rtnl_newlink_link_net(params); 37 + struct net_device *link[2], *interlink = NULL; 37 38 struct nlattr **data = params->data; 38 39 enum hsr_version proto_version; 39 40 unsigned char multicast_spec; 40 41 u8 proto = HSR_PROTOCOL_HSR; 41 42 42 - struct net_device *link[2], *interlink = NULL; 43 + if (!net_eq(link_net, dev_net(dev))) { 44 + NL_SET_ERR_MSG_MOD(extack, 45 + "HSR slaves/interlink must be on the same net namespace than HSR link"); 46 + return -EINVAL; 47 + } 48 + 43 49 if (!data) { 44 50 NL_SET_ERR_MSG_MOD(extack, "No slave devices specified"); 45 51 return -EINVAL;
+6
net/mptcp/pm_kernel.c
··· 370 370 } 371 371 372 372 subflow: 373 + /* No need to try establishing subflows to remote id0 if not allowed */ 374 + if (mptcp_pm_add_addr_c_flag_case(msk)) 375 + goto exit; 376 + 373 377 /* check if should create a new subflow */ 374 378 while (msk->pm.local_addr_used < endp_subflow_max && 375 379 msk->pm.extra_subflows < limit_extra_subflows) { ··· 405 401 __mptcp_subflow_connect(sk, &local, &addrs[i]); 406 402 spin_lock_bh(&msk->pm.lock); 407 403 } 404 + 405 + exit: 408 406 mptcp_pm_nl_check_work_pending(msk); 409 407 } 410 408
+7 -6
net/sctp/inqueue.c
··· 169 169 chunk->head_skb = chunk->skb; 170 170 171 171 /* skbs with "cover letter" */ 172 - if (chunk->head_skb && chunk->skb->data_len == chunk->skb->len) 172 + if (chunk->head_skb && chunk->skb->data_len == chunk->skb->len) { 173 + if (WARN_ON(!skb_shinfo(chunk->skb)->frag_list)) { 174 + __SCTP_INC_STATS(dev_net(chunk->skb->dev), 175 + SCTP_MIB_IN_PKT_DISCARDS); 176 + sctp_chunk_free(chunk); 177 + goto next_chunk; 178 + } 173 179 chunk->skb = skb_shinfo(chunk->skb)->frag_list; 174 - 175 - if (WARN_ON(!chunk->skb)) { 176 - __SCTP_INC_STATS(dev_net(chunk->skb->dev), SCTP_MIB_IN_PKT_DISCARDS); 177 - sctp_chunk_free(chunk); 178 - goto next_chunk; 179 180 } 180 181 } 181 182
-13
net/smc/smc_inet.c
··· 56 56 .protocol = IPPROTO_SMC, 57 57 .prot = &smc_inet_prot, 58 58 .ops = &smc_inet_stream_ops, 59 - .flags = INET_PROTOSW_ICSK, 60 59 }; 61 60 62 61 #if IS_ENABLED(CONFIG_IPV6) ··· 103 104 .protocol = IPPROTO_SMC, 104 105 .prot = &smc_inet6_prot, 105 106 .ops = &smc_inet6_stream_ops, 106 - .flags = INET_PROTOSW_ICSK, 107 107 }; 108 108 #endif /* CONFIG_IPV6 */ 109 - 110 - static unsigned int smc_sync_mss(struct sock *sk, u32 pmtu) 111 - { 112 - /* No need pass it through to clcsock, mss can always be set by 113 - * sock_create_kern or smc_setsockopt. 114 - */ 115 - return 0; 116 - } 117 109 118 110 static int smc_inet_init_sock(struct sock *sk) 119 111 { ··· 112 122 113 123 /* init common smc sock */ 114 124 smc_sk_init(net, sk, IPPROTO_SMC); 115 - 116 - inet_csk(sk)->icsk_sync_mss = smc_sync_mss; 117 - 118 125 /* create clcsock */ 119 126 return smc_create_clcsk(net, sk, sk->sk_family); 120 127 }
+19 -19
net/vmw_vsock/af_vsock.c
··· 487 487 goto err; 488 488 } 489 489 490 - if (vsk->transport) { 491 - if (vsk->transport == new_transport) { 492 - ret = 0; 493 - goto err; 494 - } 490 + if (vsk->transport && vsk->transport == new_transport) { 491 + ret = 0; 492 + goto err; 493 + } 495 494 495 + /* We increase the module refcnt to prevent the transport unloading 496 + * while there are open sockets assigned to it. 497 + */ 498 + if (!new_transport || !try_module_get(new_transport->module)) { 499 + ret = -ENODEV; 500 + goto err; 501 + } 502 + 503 + /* It's safe to release the mutex after a successful try_module_get(). 504 + * Whichever transport `new_transport` points at, it won't go away until 505 + * the last module_put() below or in vsock_deassign_transport(). 506 + */ 507 + mutex_unlock(&vsock_register_mutex); 508 + 509 + if (vsk->transport) { 496 510 /* transport->release() must be called with sock lock acquired. 497 511 * This path can only be taken during vsock_connect(), where we 498 512 * have already held the sock lock. In the other cases, this ··· 525 511 sk->sk_state = TCP_CLOSE; 526 512 vsk->peer_shutdown = 0; 527 513 } 528 - 529 - /* We increase the module refcnt to prevent the transport unloading 530 - * while there are open sockets assigned to it. 531 - */ 532 - if (!new_transport || !try_module_get(new_transport->module)) { 533 - ret = -ENODEV; 534 - goto err; 535 - } 536 - 537 - /* It's safe to release the mutex after a successful try_module_get(). 538 - * Whichever transport `new_transport` points at, it won't go away until 539 - * the last module_put() below or in vsock_deassign_transport(). 540 - */ 541 - mutex_unlock(&vsock_register_mutex); 542 514 543 515 if (sk->sk_type == SOCK_SEQPACKET) { 544 516 if (!new_transport->seqpacket_allow ||
+1 -5
net/xfrm/espintcp.c
··· 555 555 static __poll_t espintcp_poll(struct file *file, struct socket *sock, 556 556 poll_table *wait) 557 557 { 558 - __poll_t mask = datagram_poll(file, sock, wait); 559 558 struct sock *sk = sock->sk; 560 559 struct espintcp_ctx *ctx = espintcp_getctx(sk); 561 560 562 - if (!skb_queue_empty(&ctx->ike_queue)) 563 - mask |= EPOLLIN | EPOLLRDNORM; 564 - 565 - return mask; 561 + return datagram_poll_queue(file, sock, wait, &ctx->ike_queue); 566 562 } 567 563 568 564 static void build_protos(struct proto *espintcp_prot,
+9 -9
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 2324 2324 { 2325 2325 # no laminar endpoints: routing rules are used 2326 2326 if reset_with_tcp_filter "without a laminar endpoint" ns1 10.0.2.2 REJECT && 2327 - mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2327 + continue_if mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2328 2328 pm_nl_set_limits $ns1 0 2 2329 2329 pm_nl_set_limits $ns2 2 2 2330 2330 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal ··· 2336 2336 2337 2337 # laminar endpoints: this endpoint is used 2338 2338 if reset_with_tcp_filter "with a laminar endpoint" ns1 10.0.2.2 REJECT && 2339 - mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2339 + continue_if mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2340 2340 pm_nl_set_limits $ns1 0 2 2341 2341 pm_nl_set_limits $ns2 2 2 2342 2342 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal ··· 2348 2348 2349 2349 # laminar endpoints: these endpoints are used 2350 2350 if reset_with_tcp_filter "with multiple laminar endpoints" ns1 10.0.2.2 REJECT && 2351 - mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2351 + continue_if mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2352 2352 pm_nl_set_limits $ns1 0 2 2353 2353 pm_nl_set_limits $ns2 2 2 2354 2354 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal ··· 2363 2363 2364 2364 # laminar endpoints: only one endpoint is used 2365 2365 if reset_with_tcp_filter "single laminar endpoint" ns1 10.0.2.2 REJECT && 2366 - mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2366 + continue_if mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2367 2367 pm_nl_set_limits $ns1 0 2 2368 2368 pm_nl_set_limits $ns2 2 2 2369 2369 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal ··· 2376 2376 2377 2377 # laminar endpoints: subflow and laminar flags 2378 2378 if reset_with_tcp_filter "sublow + laminar endpoints" ns1 10.0.2.2 REJECT && 2379 - mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2379 + continue_if mptcp_lib_kallsyms_has "mptcp_pm_get_endp_laminar_max$"; then 2380 2380 pm_nl_set_limits $ns1 0 4 2381 2381 pm_nl_set_limits $ns2 2 4 2382 2382 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal ··· 3939 3939 # subflow_rebuild_header is needed to support the implicit flag 3940 3940 # userspace pm type prevents add_addr 3941 3941 if reset "implicit EP" && 3942 - mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 3942 + continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 3943 3943 pm_nl_set_limits $ns1 2 2 3944 3944 pm_nl_set_limits $ns2 2 2 3945 3945 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal ··· 3964 3964 fi 3965 3965 3966 3966 if reset_with_tcp_filter "delete and re-add" ns2 10.0.3.2 REJECT OUTPUT && 3967 - mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 3967 + continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 3968 3968 start_events 3969 3969 pm_nl_set_limits $ns1 0 3 3970 3970 pm_nl_set_limits $ns2 0 3 ··· 4040 4040 4041 4041 # remove and re-add 4042 4042 if reset_with_events "delete re-add signal" && 4043 - mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 4043 + continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 4044 4044 ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=0 4045 4045 pm_nl_set_limits $ns1 0 3 4046 4046 pm_nl_set_limits $ns2 3 3 ··· 4115 4115 4116 4116 # flush and re-add 4117 4117 if reset_with_tcp_filter "flush re-add" ns2 10.0.3.2 REJECT OUTPUT && 4118 - mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 4118 + continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 4119 4119 pm_nl_set_limits $ns1 0 2 4120 4120 pm_nl_set_limits $ns2 1 2 4121 4121 # broadcast IP: no packet for this address will be received on ns1
+2 -15
tools/testing/selftests/net/sctp_hello.c
··· 29 29 static int do_client(int argc, char *argv[]) 30 30 { 31 31 struct sockaddr_storage ss; 32 - char buf[] = "hello"; 33 32 int csk, ret, len; 34 33 35 34 if (argc < 5) { ··· 55 56 56 57 set_addr(&ss, argv[3], argv[4], &len); 57 58 ret = connect(csk, (struct sockaddr *)&ss, len); 58 - if (ret < 0) { 59 - printf("failed to connect to peer\n"); 59 + if (ret < 0) 60 60 return -1; 61 - } 62 61 63 - ret = send(csk, buf, strlen(buf) + 1, 0); 64 - if (ret < 0) { 65 - printf("failed to send msg %d\n", ret); 66 - return -1; 67 - } 62 + recv(csk, NULL, 0, 0); 68 63 close(csk); 69 64 70 65 return 0; ··· 68 75 { 69 76 struct sockaddr_storage ss; 70 77 int lsk, csk, ret, len; 71 - char buf[20]; 72 78 73 79 if (argc < 2 || (strcmp(argv[1], "server") && strcmp(argv[1], "client"))) { 74 80 printf("%s server|client ...\n", argv[0]); ··· 117 125 return -1; 118 126 } 119 127 120 - ret = recv(csk, buf, sizeof(buf), 0); 121 - if (ret <= 0) { 122 - printf("failed to recv msg %d\n", ret); 123 - return -1; 124 - } 125 128 close(csk); 126 129 close(lsk); 127 130
+45 -28
tools/testing/selftests/net/sctp_vrf.sh
··· 20 20 modprobe sctp_diag 21 21 setup_ns CLIENT_NS1 CLIENT_NS2 SERVER_NS 22 22 23 - ip net exec $CLIENT_NS1 sysctl -w net.ipv6.conf.default.accept_dad=0 2>&1 >/dev/null 24 - ip net exec $CLIENT_NS2 sysctl -w net.ipv6.conf.default.accept_dad=0 2>&1 >/dev/null 25 - ip net exec $SERVER_NS sysctl -w net.ipv6.conf.default.accept_dad=0 2>&1 >/dev/null 23 + ip net exec $CLIENT_NS1 sysctl -wq net.ipv6.conf.default.accept_dad=0 24 + ip net exec $CLIENT_NS2 sysctl -wq net.ipv6.conf.default.accept_dad=0 25 + ip net exec $SERVER_NS sysctl -wq net.ipv6.conf.default.accept_dad=0 26 26 27 27 ip -n $SERVER_NS link add veth1 type veth peer name veth1 netns $CLIENT_NS1 28 28 ip -n $SERVER_NS link add veth2 type veth peer name veth1 netns $CLIENT_NS2 ··· 62 62 } 63 63 64 64 cleanup() { 65 - ip netns exec $SERVER_NS pkill sctp_hello 2>&1 >/dev/null 65 + wait_client $CLIENT_NS1 66 + wait_client $CLIENT_NS2 67 + stop_server 66 68 cleanup_ns $CLIENT_NS1 $CLIENT_NS2 $SERVER_NS 67 69 } 68 70 69 - wait_server() { 71 + start_server() { 70 72 local IFACE=$1 71 73 local CNT=0 72 74 73 - until ip netns exec $SERVER_NS ss -lS src $SERVER_IP:$SERVER_PORT | \ 74 - grep LISTEN | grep "$IFACE" 2>&1 >/dev/null; do 75 - [ $((CNT++)) = "20" ] && { RET=3; return $RET; } 75 + ip netns exec $SERVER_NS ./sctp_hello server $AF $SERVER_IP $SERVER_PORT $IFACE & 76 + disown 77 + until ip netns exec $SERVER_NS ss -SlH | grep -q "$IFACE"; do 78 + [ $((CNT++)) -eq 30 ] && { RET=3; return $RET; } 79 + sleep 0.1 80 + done 81 + } 82 + 83 + stop_server() { 84 + local CNT=0 85 + 86 + ip netns exec $SERVER_NS pkill sctp_hello 87 + while ip netns exec $SERVER_NS ss -SaH | grep -q .; do 88 + [ $((CNT++)) -eq 30 ] && break 89 + sleep 0.1 90 + done 91 + } 92 + 93 + wait_client() { 94 + local CLIENT_NS=$1 95 + local CNT=0 96 + 97 + while ip netns exec $CLIENT_NS ss -SaH | grep -q .; do 98 + [ $((CNT++)) -eq 30 ] && break 76 99 sleep 0.1 77 100 done 78 101 } ··· 104 81 local CLIENT_NS=$1 105 82 local IFACE=$2 106 83 107 - ip netns exec $SERVER_NS pkill sctp_hello 2>&1 >/dev/null 108 - ip netns exec $SERVER_NS ./sctp_hello server $AF $SERVER_IP \ 109 - $SERVER_PORT $IFACE 2>&1 >/dev/null & 110 - disown 111 - wait_server $IFACE || return $RET 84 + start_server $IFACE || return $RET 112 85 timeout 3 ip netns exec $CLIENT_NS ./sctp_hello client $AF \ 113 - $SERVER_IP $SERVER_PORT $CLIENT_IP $CLIENT_PORT 2>&1 >/dev/null 86 + $SERVER_IP $SERVER_PORT $CLIENT_IP $CLIENT_PORT 114 87 RET=$? 88 + wait_client $CLIENT_NS 89 + stop_server 115 90 return $RET 116 91 } 117 92 ··· 117 96 local IFACE1=$1 118 97 local IFACE2=$2 119 98 120 - ip netns exec $SERVER_NS pkill sctp_hello 2>&1 >/dev/null 121 - ip netns exec $SERVER_NS ./sctp_hello server $AF $SERVER_IP \ 122 - $SERVER_PORT $IFACE1 2>&1 >/dev/null & 123 - disown 124 - wait_server $IFACE1 || return $RET 125 - ip netns exec $SERVER_NS ./sctp_hello server $AF $SERVER_IP \ 126 - $SERVER_PORT $IFACE2 2>&1 >/dev/null & 127 - disown 128 - wait_server $IFACE2 || return $RET 99 + start_server $IFACE1 || return $RET 100 + start_server $IFACE2 || return $RET 129 101 timeout 3 ip netns exec $CLIENT_NS1 ./sctp_hello client $AF \ 130 - $SERVER_IP $SERVER_PORT $CLIENT_IP $CLIENT_PORT 2>&1 >/dev/null && \ 102 + $SERVER_IP $SERVER_PORT $CLIENT_IP $CLIENT_PORT && \ 131 103 timeout 3 ip netns exec $CLIENT_NS2 ./sctp_hello client $AF \ 132 - $SERVER_IP $SERVER_PORT $CLIENT_IP $CLIENT_PORT 2>&1 >/dev/null 104 + $SERVER_IP $SERVER_PORT $CLIENT_IP $CLIENT_PORT 133 105 RET=$? 106 + wait_client $CLIENT_NS1 107 + wait_client $CLIENT_NS2 108 + stop_server 134 109 return $RET 135 110 } 136 111 137 112 testup() { 138 - ip netns exec $SERVER_NS sysctl -w net.sctp.l3mdev_accept=1 2>&1 >/dev/null 113 + ip netns exec $SERVER_NS sysctl -wq net.sctp.l3mdev_accept=1 139 114 echo -n "TEST 01: nobind, connect from client 1, l3mdev_accept=1, Y " 140 115 do_test $CLIENT_NS1 || { echo "[FAIL]"; return $RET; } 141 116 echo "[PASS]" ··· 140 123 do_test $CLIENT_NS2 && { echo "[FAIL]"; return $RET; } 141 124 echo "[PASS]" 142 125 143 - ip netns exec $SERVER_NS sysctl -w net.sctp.l3mdev_accept=0 2>&1 >/dev/null 126 + ip netns exec $SERVER_NS sysctl -wq net.sctp.l3mdev_accept=0 144 127 echo -n "TEST 03: nobind, connect from client 1, l3mdev_accept=0, N " 145 128 do_test $CLIENT_NS1 && { echo "[FAIL]"; return $RET; } 146 129 echo "[PASS]" ··· 177 160 do_testx vrf-1 vrf-2 || { echo "[FAIL]"; return $RET; } 178 161 echo "[PASS]" 179 162 180 - echo -n "TEST 12: bind vrf-2 & 1 in server, connect from client 1 & 2, N " 163 + echo -n "TEST 12: bind vrf-2 & 1 in server, connect from client 1 & 2, Y " 181 164 do_testx vrf-2 vrf-1 || { echo "[FAIL]"; return $RET; } 182 165 echo "[PASS]" 183 166 }