History

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

Merge in the fixes we had queued in case there was another -rc.

Jakub Kicinski committed 5 years ago

Commit 8a33dcc2 parents b7b98f8 6b278c019 files · +233 −39Browse files

Unified · Split

19 files
  1. drivers/net/ethernet/amd/xgbe/xgbe-common.h +8 −0
  2. drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +19 −1
  3. drivers/net/ethernet/ibm/ibmvnic.c +12 −9
  4. drivers/net/ethernet/netronome/nfp/nfp_net_common.c +2 −6
  5. drivers/net/phy/phylink.c +1 −1
  6. include/net/flow_dissector.h +1 −0
  7. include/net/sctp/sctp.h +3 −4
  8. net/bridge/br_private.h +2 −0
  9. net/core/flow_dissector.c +15 −0
  10. net/ipv6/udp.c +1 −1
  11. net/sched/cls_flower.c +2 −1
  12. net/sctp/output.c +8 −5
  13. net/sctp/transport.c +6 −5
  14. tools/testing/selftests/net/.gitignore +5 −0
  15. tools/testing/selftests/net/Makefile +2 −0
  16. tools/testing/selftests/net/cmsg_so_mark.c +67 −0
  17. tools/testing/selftests/net/cmsg_so_mark.sh +61 −0
  18. tools/testing/selftests/net/forwarding/bridge_igmp.sh +9 −3
  19. tools/testing/selftests/net/forwarding/bridge_mld.sh +9 −3
drivers/net/ethernet/amd/xgbe/xgbe-common.h+8−0
@@ -1331,6 +1331,10 @@ · 1330 unmodified lines
1331#define MDIO_VEND2_PMA_CDR_CONTROL 0x80561331#define MDIO_VEND2_PMA_CDR_CONTROL 0x8056
1332#endif1332#endif
1333 1333
1334#ifndef MDIO_VEND2_PMA_MISC_CTRL0
1335#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090
1336#endif
1337
1334#ifndef MDIO_CTRL1_SPEED1G1338#ifndef MDIO_CTRL1_SPEED1G
1335#define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)1339#define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
1336#endif1340#endif
@@ -1389,6 +1393,10 @@ · 52 unmodified lines
1389#define XGBE_PMA_RX_RST_0_RESET_ON 0x101393#define XGBE_PMA_RX_RST_0_RESET_ON 0x10
1390#define XGBE_PMA_RX_RST_0_RESET_OFF 0x001394#define XGBE_PMA_RX_RST_0_RESET_OFF 0x00
1391 1395
1396#define XGBE_PMA_PLL_CTRL_MASK BIT(15)
1397#define XGBE_PMA_PLL_CTRL_ENABLE BIT(15)
1398#define XGBE_PMA_PLL_CTRL_DISABLE 0x0000
1399
1392/* Bit setting and getting macros1400/* Bit setting and getting macros
1393 * The get macro will extract the current bit field value from within1401 * The get macro will extract the current bit field value from within
1394 * the variable1402 * the variable
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c+19−1
@@ -1977,12 +1977,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) · 1976 unmodified lines
1977 }1977 }
1978}1978}
1979 1979
1980static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable)
1981{
1982 XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0,
1983 XGBE_PMA_PLL_CTRL_MASK,
1984 enable ? XGBE_PMA_PLL_CTRL_ENABLE
1985 : XGBE_PMA_PLL_CTRL_DISABLE);
1986
1987 /* Wait for command to complete */
1988 usleep_range(100, 200);
1989}
1990
1980static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,1991static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
1981 unsigned int cmd, unsigned int sub_cmd)1992 unsigned int cmd, unsigned int sub_cmd)
1982{1993{
1983 unsigned int s0 = 0;1994 unsigned int s0 = 0;
1984 unsigned int wait;1995 unsigned int wait;
1985 1996
1997 /* Disable PLL re-initialization during FW command processing */
1998 xgbe_phy_pll_ctrl(pdata, false);
1999
1986 /* Log if a previous command did not complete */2000 /* Log if a previous command did not complete */
1987 if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) {2001 if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) {
1988 netif_dbg(pdata, link, pdata->netdev,2002 netif_dbg(pdata, link, pdata->netdev,
@@ -2003,7 +2017,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, · 14 unmodified lines
2003 wait = XGBE_RATECHANGE_COUNT;2017 wait = XGBE_RATECHANGE_COUNT;
2004 while (wait--) {2018 while (wait--) {
2005 if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))2019 if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
2006 return;2020 goto reenable_pll;
2007 2021
2008 usleep_range(1000, 2000);2022 usleep_range(1000, 2000);
2009 }2023 }
@@ -2013,6 +2027,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, · 3 unmodified lines
2013 2027
2014 /* Reset on error */2028 /* Reset on error */
2015 xgbe_phy_rx_reset(pdata);2029 xgbe_phy_rx_reset(pdata);
2030
2031reenable_pll:
2032 /* Enable PLL re-initialization */
2033 xgbe_phy_pll_ctrl(pdata, true);
2016}2034}
2017 2035
2018static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)2036static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)
drivers/net/ethernet/ibm/ibmvnic.c+12−9
@@ -1914,8 +1914,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 1913 unmodified lines
1914 ind_bufp = &tx_scrq->ind_buf;1914 ind_bufp = &tx_scrq->ind_buf;
1915 1915
1916 if (test_bit(0, &adapter->resetting)) {1916 if (test_bit(0, &adapter->resetting)) {
1917 if (!netif_subqueue_stopped(netdev, skb))
1918 netif_stop_subqueue(netdev, queue_num);
1919 dev_kfree_skb_any(skb);1917 dev_kfree_skb_any(skb);
1920 1918
1921 tx_send_failed++;1919 tx_send_failed++;
@@ -2757,7 +2755,7 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, · 835 unmodified lines
2757 2755
2758 if (adapter->state == VNIC_PROBING) {2756 if (adapter->state == VNIC_PROBING) {
2759 netdev_warn(netdev, "Adapter reset during probe\n");2757 netdev_warn(netdev, "Adapter reset during probe\n");
2760 adapter->init_done_rc = EAGAIN;2758 adapter->init_done_rc = -EAGAIN;
2761 ret = EAGAIN;2759 ret = EAGAIN;
2762 goto err;2760 goto err;
2763 }2761 }
@@ -5259,11 +5257,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 2495 unmodified lines
5259 */5257 */
5260 adapter->login_pending = false;5258 adapter->login_pending = false;
5261 5259
5262 if (!completion_done(&adapter->init_done)) {
5263 complete(&adapter->init_done);
5264 adapter->init_done_rc = -EIO;
5265 }
5266
5267 if (adapter->state == VNIC_DOWN)5260 if (adapter->state == VNIC_DOWN)
5268 rc = ibmvnic_reset(adapter, VNIC_RESET_PASSIVE_INIT);5261 rc = ibmvnic_reset(adapter, VNIC_RESET_PASSIVE_INIT);
5269 else5262 else
@@ -5284,6 +5277,13 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 14 unmodified lines
5284 rc);5277 rc);
5285 adapter->failover_pending = false;5278 adapter->failover_pending = false;
5286 }5279 }
5280
5281 if (!completion_done(&adapter->init_done)) {
5282 complete(&adapter->init_done);
5283 if (!adapter->init_done_rc)
5284 adapter->init_done_rc = -EAGAIN;
5285 }
5286
5287 break;5287 break;
5288 case IBMVNIC_CRQ_INIT_COMPLETE:5288 case IBMVNIC_CRQ_INIT_COMPLETE:
5289 dev_info(dev, "Partner initialization complete\n");5289 dev_info(dev, "Partner initialization complete\n");
@@ -5604,6 +5604,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter) · 314 unmodified lines
5604 crq->cur = 0;5604 crq->cur = 0;
5605 spin_lock_init(&crq->lock);5605 spin_lock_init(&crq->lock);
5606 5606
5607 /* process any CRQs that were queued before we enabled interrupts */
5608 tasklet_schedule(&adapter->tasklet);
5609
5607 return retrc;5610 return retrc;
5608 5611
5609req_irq_failed:5612req_irq_failed:
@@ -5753,7 +5756,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) · 143 unmodified lines
5753 }5756 }
5754 5757
5755 rc = ibmvnic_reset_init(adapter, false);5758 rc = ibmvnic_reset_init(adapter, false);
5756 } while (rc == EAGAIN);5759 } while (rc == -EAGAIN);
5757 5760
5758 /* We are ignoring the error from ibmvnic_reset_init() assuming that the5761 /* We are ignoring the error from ibmvnic_reset_init() assuming that the
5759 * partner is not ready. CRQ is not active. When the partner becomes5762 * partner is not ready. CRQ is not active. When the partner becomes
drivers/net/ethernet/netronome/nfp/nfp_net_common.c+2−6
@@ -2067,7 +2067,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) · 2066 unmodified lines
2067 if (napi_complete_done(napi, pkts_polled))2067 if (napi_complete_done(napi, pkts_polled))
2068 nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);2068 nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);
2069 2069
2070 if (r_vec->nfp_net->rx_coalesce_adapt_on) {2070 if (r_vec->nfp_net->rx_coalesce_adapt_on && r_vec->rx_ring) {
2071 struct dim_sample dim_sample = {};2071 struct dim_sample dim_sample = {};
2072 unsigned int start;2072 unsigned int start;
2073 u64 pkts, bytes;2073 u64 pkts, bytes;
@@ -2082,7 +2082,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) · 8 unmodified lines
2082 net_dim(&r_vec->rx_dim, dim_sample);2082 net_dim(&r_vec->rx_dim, dim_sample);
2083 }2083 }
2084 2084
2085 if (r_vec->nfp_net->tx_coalesce_adapt_on) {2085 if (r_vec->nfp_net->tx_coalesce_adapt_on && r_vec->tx_ring) {
2086 struct dim_sample dim_sample = {};2086 struct dim_sample dim_sample = {};
2087 unsigned int start;2087 unsigned int start;
2088 u64 pkts, bytes;2088 u64 pkts, bytes;
@@ -3016,10 +3016,8 @@ static void nfp_net_rx_dim_work(struct work_struct *work) · 927 unmodified lines
3016 3016
3017 /* copy RX interrupt coalesce parameters */3017 /* copy RX interrupt coalesce parameters */
3018 value = (moder.pkts << 16) | (factor * moder.usec);3018 value = (moder.pkts << 16) | (factor * moder.usec);
3019 rtnl_lock();
3020 nn_writel(nn, NFP_NET_CFG_RXR_IRQ_MOD(r_vec->rx_ring->idx), value);3019 nn_writel(nn, NFP_NET_CFG_RXR_IRQ_MOD(r_vec->rx_ring->idx), value);
3021 (void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD);3020 (void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD);
3022 rtnl_unlock();
3023 3021
3024 dim->state = DIM_START_MEASURE;3022 dim->state = DIM_START_MEASURE;
3025}3023}
@@ -3047,10 +3045,8 @@ static void nfp_net_tx_dim_work(struct work_struct *work) · 21 unmodified lines
3047 3045
3048 /* copy TX interrupt coalesce parameters */3046 /* copy TX interrupt coalesce parameters */
3049 value = (moder.pkts << 16) | (factor * moder.usec);3047 value = (moder.pkts << 16) | (factor * moder.usec);
3050 rtnl_lock();
3051 nn_writel(nn, NFP_NET_CFG_TXR_IRQ_MOD(r_vec->tx_ring->idx), value);3048 nn_writel(nn, NFP_NET_CFG_TXR_IRQ_MOD(r_vec->tx_ring->idx), value);
3052 (void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD);3049 (void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD);
3053 rtnl_unlock();
3054 3050
3055 dim->state = DIM_START_MEASURE;3051 dim->state = DIM_START_MEASURE;
3056}3052}
drivers/net/phy/phylink.c+1−1
@@ -1780,7 +1780,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, · 1779 unmodified lines
1780 return -EOPNOTSUPP;1780 return -EOPNOTSUPP;
1781 1781
1782 if (!phylink_test(pl->supported, Asym_Pause) &&1782 if (!phylink_test(pl->supported, Asym_Pause) &&
1783 !pause->autoneg && pause->rx_pause != pause->tx_pause)1783 pause->rx_pause != pause->tx_pause)
1784 return -EINVAL;1784 return -EINVAL;
1785 1785
1786 pause_state = 0;1786 pause_state = 0;
include/net/flow_dissector.h+1−0
@@ -287,6 +287,7 @@ enum flow_dissector_key_id { · 286 unmodified lines
287#define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0)287#define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0)
288#define FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL BIT(1)288#define FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL BIT(1)
289#define FLOW_DISSECTOR_F_STOP_AT_ENCAP BIT(2)289#define FLOW_DISSECTOR_F_STOP_AT_ENCAP BIT(2)
290#define FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP BIT(3)
290 291
291struct flow_dissector_key {292struct flow_dissector_key {
292 enum flow_dissector_key_id key_id;293 enum flow_dissector_key_id key_id;
include/net/sctp/sctp.h+3−4
@@ -626,7 +626,8 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize) · 625 unmodified lines
626 626
627static inline int sctp_transport_pl_hlen(struct sctp_transport *t)627static inline int sctp_transport_pl_hlen(struct sctp_transport *t)
628{628{
629 return __sctp_mtu_payload(sctp_sk(t->asoc->base.sk), t, 0, 0);629 return __sctp_mtu_payload(sctp_sk(t->asoc->base.sk), t, 0, 0) -
630 sizeof(struct sctphdr);
630}631}
631 632
632static inline void sctp_transport_pl_reset(struct sctp_transport *t)633static inline void sctp_transport_pl_reset(struct sctp_transport *t)
@@ -653,12 +654,10 @@ static inline void sctp_transport_pl_update(struct sctp_transport *t) · 20 unmodified lines
653 if (t->pl.state == SCTP_PL_DISABLED)654 if (t->pl.state == SCTP_PL_DISABLED)
654 return;655 return;
655 656
656 if (del_timer(&t->probe_timer))
657 sctp_transport_put(t);
658
659 t->pl.state = SCTP_PL_BASE;657 t->pl.state = SCTP_PL_BASE;
660 t->pl.pmtu = SCTP_BASE_PLPMTU;658 t->pl.pmtu = SCTP_BASE_PLPMTU;
661 t->pl.probe_size = SCTP_BASE_PLPMTU;659 t->pl.probe_size = SCTP_BASE_PLPMTU;
660 sctp_transport_reset_probe_timer(t);
662}661}
663 662
664static inline bool sctp_transport_pl_enabled(struct sctp_transport *t)663static inline bool sctp_transport_pl_enabled(struct sctp_transport *t)
net/bridge/br_private.h+2−0
@@ -1893,11 +1893,13 @@ static inline int br_cfm_status_fill_info(struct sk_buff *skb, · 1892 unmodified lines
1893 1893
1894static inline int br_cfm_mep_count(struct net_bridge *br, u32 *count)1894static inline int br_cfm_mep_count(struct net_bridge *br, u32 *count)
1895{1895{
1896 *count = 0;
1896 return -EOPNOTSUPP;1897 return -EOPNOTSUPP;
1897}1898}
1898 1899
1899static inline int br_cfm_peer_mep_count(struct net_bridge *br, u32 *count)1900static inline int br_cfm_peer_mep_count(struct net_bridge *br, u32 *count)
1900{1901{
1902 *count = 0;
1901 return -EOPNOTSUPP;1903 return -EOPNOTSUPP;
1902}1904}
1903#endif1905#endif
net/core/flow_dissector.c+15−0
@@ -1306,6 +1306,11 @@ ip_proto_again: · 1305 unmodified lines
1306 1306
1307 switch (ip_proto) {1307 switch (ip_proto) {
1308 case IPPROTO_GRE:1308 case IPPROTO_GRE:
1309 if (flags & FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP) {
1310 fdret = FLOW_DISSECT_RET_OUT_GOOD;
1311 break;
1312 }
1313
1309 fdret = __skb_flow_dissect_gre(skb, key_control, flow_dissector,1314 fdret = __skb_flow_dissect_gre(skb, key_control, flow_dissector,
1310 target_container, data,1315 target_container, data,
1311 &proto, &nhoff, &hlen, flags);1316 &proto, &nhoff, &hlen, flags);
@@ -1363,6 +1368,11 @@ ip_proto_again: · 51 unmodified lines
1363 break;1368 break;
1364 }1369 }
1365 case IPPROTO_IPIP:1370 case IPPROTO_IPIP:
1371 if (flags & FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP) {
1372 fdret = FLOW_DISSECT_RET_OUT_GOOD;
1373 break;
1374 }
1375
1366 proto = htons(ETH_P_IP);1376 proto = htons(ETH_P_IP);
1367 1377
1368 key_control->flags |= FLOW_DIS_ENCAPSULATION;1378 key_control->flags |= FLOW_DIS_ENCAPSULATION;
@@ -1375,6 +1385,11 @@ ip_proto_again: · 6 unmodified lines
1375 break;1385 break;
1376 1386
1377 case IPPROTO_IPV6:1387 case IPPROTO_IPV6:
1388 if (flags & FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP) {
1389 fdret = FLOW_DISSECT_RET_OUT_GOOD;
1390 break;
1391 }
1392
1378 proto = htons(ETH_P_IPV6);1393 proto = htons(ETH_P_IPV6);
1379 1394
1380 key_control->flags |= FLOW_DIS_ENCAPSULATION;1395 key_control->flags |= FLOW_DIS_ENCAPSULATION;
net/ipv6/udp.c+1−1
@@ -1435,7 +1435,6 @@ do_udp_sendmsg: · 1434 unmodified lines
1435 if (!fl6.flowi6_oif)1435 if (!fl6.flowi6_oif)
1436 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;1436 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
1437 1437
1438 fl6.flowi6_mark = ipc6.sockc.mark;
1439 fl6.flowi6_uid = sk->sk_uid;1438 fl6.flowi6_uid = sk->sk_uid;
1440 1439
1441 if (msg->msg_controllen) {1440 if (msg->msg_controllen) {
@@ -1471,6 +1470,7 @@ do_udp_sendmsg: · 29 unmodified lines
1471 ipc6.opt = opt;1470 ipc6.opt = opt;
1472 1471
1473 fl6.flowi6_proto = sk->sk_protocol;1472 fl6.flowi6_proto = sk->sk_protocol;
1473 fl6.flowi6_mark = ipc6.sockc.mark;
1474 fl6.daddr = *daddr;1474 fl6.daddr = *daddr;
1475 if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr))1475 if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr))
1476 fl6.saddr = np->saddr;1476 fl6.saddr = np->saddr;
net/sched/cls_flower.c+2−1
@@ -329,7 +329,8 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, · 328 unmodified lines
329 ARRAY_SIZE(fl_ct_info_to_flower_map),329 ARRAY_SIZE(fl_ct_info_to_flower_map),
330 post_ct);330 post_ct);
331 skb_flow_dissect_hash(skb, &mask->dissector, &skb_key);331 skb_flow_dissect_hash(skb, &mask->dissector, &skb_key);
332 skb_flow_dissect(skb, &mask->dissector, &skb_key, 0);332 skb_flow_dissect(skb, &mask->dissector, &skb_key,
333 FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP);
333 334
334 f = fl_mask_lookup(mask, &skb_key);335 f = fl_mask_lookup(mask, &skb_key);
335 if (f && !tc_skip_sw(f->flags)) {336 if (f && !tc_skip_sw(f->flags)) {
net/sctp/output.c+8−5
@@ -581,13 +581,16 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) · 580 unmodified lines
581 chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list);581 chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list);
582 sk = chunk->skb->sk;582 sk = chunk->skb->sk;
583 583
584 /* check gso */
585 if (packet->size > tp->pathmtu && !packet->ipfragok && !chunk->pmtu_probe) {584 if (packet->size > tp->pathmtu && !packet->ipfragok && !chunk->pmtu_probe) {
586 if (!sk_can_gso(sk)) {585 if (tp->pl.state == SCTP_PL_ERROR) { /* do IP fragmentation if in Error state */
587 pr_err_once("Trying to GSO but underlying device doesn't support it.");586 packet->ipfragok = 1;
588 goto out;587 } else {
588 if (!sk_can_gso(sk)) { /* check gso */
589 pr_err_once("Trying to GSO but underlying device doesn't support it.");
590 goto out;
591 }
592 gso = 1;
589 }593 }
590 gso = 1;
591 }594 }
592 595
593 /* alloc head skb */596 /* alloc head skb */
net/sctp/transport.c+6−5
@@ -269,7 +269,7 @@ bool sctp_transport_pl_send(struct sctp_transport *t) · 268 unmodified lines
269 if (t->pl.probe_size == SCTP_BASE_PLPMTU) { /* BASE_PLPMTU Confirmation Failed */269 if (t->pl.probe_size == SCTP_BASE_PLPMTU) { /* BASE_PLPMTU Confirmation Failed */
270 t->pl.state = SCTP_PL_ERROR; /* Base -> Error */270 t->pl.state = SCTP_PL_ERROR; /* Base -> Error */
271 271
272 t->pl.pmtu = SCTP_MIN_PLPMTU;272 t->pl.pmtu = SCTP_BASE_PLPMTU;
273 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);273 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
274 sctp_assoc_sync_pmtu(t->asoc);274 sctp_assoc_sync_pmtu(t->asoc);
275 }275 }
@@ -366,8 +366,9 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) · 90 unmodified lines
366 if (pmtu >= SCTP_MIN_PLPMTU && pmtu < SCTP_BASE_PLPMTU) {366 if (pmtu >= SCTP_MIN_PLPMTU && pmtu < SCTP_BASE_PLPMTU) {
367 t->pl.state = SCTP_PL_ERROR; /* Base -> Error */367 t->pl.state = SCTP_PL_ERROR; /* Base -> Error */
368 368
369 t->pl.pmtu = SCTP_MIN_PLPMTU;369 t->pl.pmtu = SCTP_BASE_PLPMTU;
370 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);370 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
371 return true;
371 }372 }
372 } else if (t->pl.state == SCTP_PL_SEARCH) {373 } else if (t->pl.state == SCTP_PL_SEARCH) {
373 if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {374 if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -378,11 +379,10 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) · 4 unmodified lines
378 t->pl.probe_high = 0;379 t->pl.probe_high = 0;
379 t->pl.pmtu = SCTP_BASE_PLPMTU;380 t->pl.pmtu = SCTP_BASE_PLPMTU;
380 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);381 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
382 return true;
381 } else if (pmtu > t->pl.pmtu && pmtu < t->pl.probe_size) {383 } else if (pmtu > t->pl.pmtu && pmtu < t->pl.probe_size) {
382 t->pl.probe_size = pmtu;384 t->pl.probe_size = pmtu;
383 t->pl.probe_count = 0;385 t->pl.probe_count = 0;
384
385 return false;
386 }386 }
387 } else if (t->pl.state == SCTP_PL_COMPLETE) {387 } else if (t->pl.state == SCTP_PL_COMPLETE) {
388 if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {388 if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -393,10 +393,11 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) · 4 unmodified lines
393 t->pl.probe_high = 0;393 t->pl.probe_high = 0;
394 t->pl.pmtu = SCTP_BASE_PLPMTU;394 t->pl.pmtu = SCTP_BASE_PLPMTU;
395 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);395 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
396 return true;
396 }397 }
397 }398 }
398 399
399 return true;400 return false;
400}401}
401 402
402bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)403bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
tools/testing/selftests/net/.gitignore+5−0
@@ -31,3 +31,8 @@ rxtimestamp · 30 unmodified lines
31timestamping31timestamping
32txtimestamp32txtimestamp
33so_netns_cookie33so_netns_cookie
34test_unix_oob
35gro
36ioam6_parser
37toeplitz
38cmsg_so_mark
tools/testing/selftests/net/Makefile+2−0
@@ -29,6 +29,7 @@ TEST_PROGS += veth.sh · 28 unmodified lines
29TEST_PROGS += ioam6.sh29TEST_PROGS += ioam6.sh
30TEST_PROGS += gro.sh30TEST_PROGS += gro.sh
31TEST_PROGS += gre_gso.sh31TEST_PROGS += gre_gso.sh
32TEST_PROGS += cmsg_so_mark.sh
32TEST_PROGS_EXTENDED := in_netns.sh33TEST_PROGS_EXTENDED := in_netns.sh
33TEST_GEN_FILES = socket nettest34TEST_GEN_FILES = socket nettest
34TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any35TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any
@@ -45,6 +46,7 @@ TEST_GEN_FILES += gro · 10 unmodified lines
45TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa46TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
46TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls47TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls
47TEST_GEN_FILES += toeplitz48TEST_GEN_FILES += toeplitz
49TEST_GEN_FILES += cmsg_so_mark
48 50
49TEST_FILES := settings51TEST_FILES := settings
50 52
tools/testing/selftests/net/cmsg_so_mark.c+67−0
@@ -0,0 +1,67 @@
1// SPDX-License-Identifier: GPL-2.0-or-later
2#include <errno.h>
3#include <netdb.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <unistd.h>
8#include <linux/types.h>
9#include <sys/socket.h>
10
11int main(int argc, const char **argv)
12{
13 char cbuf[CMSG_SPACE(sizeof(__u32))];
14 struct addrinfo hints, *ai;
15 struct cmsghdr *cmsg;
16 struct iovec iov[1];
17 struct msghdr msg;
18 int mark;
19 int err;
20 int fd;
21
22 if (argc != 4) {
23 fprintf(stderr, "Usage: %s <dst_ip> <port> <mark>\n", argv[0]);
24 return 1;
25 }
26 mark = atoi(argv[3]);
27
28 memset(&hints, 0, sizeof(hints));
29 hints.ai_family = AF_UNSPEC;
30 hints.ai_socktype = SOCK_DGRAM;
31
32 ai = NULL;
33 err = getaddrinfo(argv[1], argv[2], &hints, &ai);
34 if (err) {
35 fprintf(stderr, "Can't resolve address: %s\n", strerror(errno));
36 return 1;
37 }
38
39 fd = socket(ai->ai_family, SOCK_DGRAM, IPPROTO_UDP);
40 if (fd < 0) {
41 fprintf(stderr, "Can't open socket: %s\n", strerror(errno));
42 freeaddrinfo(ai);
43 return 1;
44 }
45
46 iov[0].iov_base = "bla";
47 iov[0].iov_len = 4;
48
49 msg.msg_name = ai->ai_addr;
50 msg.msg_namelen = ai->ai_addrlen;
51 msg.msg_iov = iov;
52 msg.msg_iovlen = 1;
53 msg.msg_control = cbuf;
54 msg.msg_controllen = sizeof(cbuf);
55
56 cmsg = CMSG_FIRSTHDR(&msg);
57 cmsg->cmsg_level = SOL_SOCKET;
58 cmsg->cmsg_type = SO_MARK;
59 cmsg->cmsg_len = CMSG_LEN(sizeof(__u32));
60 *(__u32 *)CMSG_DATA(cmsg) = mark;
61
62 err = sendmsg(fd, &msg, 0);
63
64 close(fd);
65 freeaddrinfo(ai);
66 return err != 4;
67}
tools/testing/selftests/net/cmsg_so_mark.sh+61−0
@@ -0,0 +1,61 @@
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4NS=ns
5IP4=172.16.0.1/24
6TGT4=172.16.0.2
7IP6=2001:db8:1::1/64
8TGT6=2001:db8:1::2
9MARK=1000
10
11cleanup()
12{
13 ip netns del $NS
14}
15
16trap cleanup EXIT
17
18# Namespaces
19ip netns add $NS
20
21# Connectivity
22ip -netns $NS link add type dummy
23ip -netns $NS link set dev dummy0 up
24ip -netns $NS addr add $IP4 dev dummy0
25ip -netns $NS addr add $IP6 dev dummy0
26
27ip -netns $NS rule add fwmark $MARK lookup 300
28ip -6 -netns $NS rule add fwmark $MARK lookup 300
29ip -netns $NS route add prohibit any table 300
30ip -6 -netns $NS route add prohibit any table 300
31
32# Test
33BAD=0
34TOTAL=0
35
36check_result() {
37 ((TOTAL++))
38 if [ $1 -ne $2 ]; then
39 echo " Case $3 returned $1, expected $2"
40 ((BAD++))
41 fi
42}
43
44ip netns exec $NS ./cmsg_so_mark $TGT4 1234 $((MARK + 1))
45check_result $? 0 "IPv4 pass"
46ip netns exec $NS ./cmsg_so_mark $TGT6 1234 $((MARK + 1))
47check_result $? 0 "IPv6 pass"
48
49ip netns exec $NS ./cmsg_so_mark $TGT4 1234 $MARK
50check_result $? 1 "IPv4 rejection"
51ip netns exec $NS ./cmsg_so_mark $TGT6 1234 $MARK
52check_result $? 1 "IPv6 rejection"
53
54# Summary
55if [ $BAD -ne 0 ]; then
56 echo "FAIL - $BAD/$TOTAL cases failed"
57 exit 1
58else
59 echo "OK"
60 exit 0
61fi
tools/testing/selftests/net/forwarding/bridge_igmp.sh+9−3
@@ -482,10 +482,15 @@ v3exc_timeout_test() · 481 unmodified lines
482 local X=("192.0.2.20" "192.0.2.30")482 local X=("192.0.2.20" "192.0.2.30")
483 483
484 # GMI should be 3 seconds484 # GMI should be 3 seconds
485 ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100485 ip link set dev br0 type bridge mcast_query_interval 100 \
486 mcast_query_response_interval 100 \
487 mcast_membership_interval 300
486 488
487 v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP489 v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
488 ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500490 ip link set dev br0 type bridge mcast_query_interval 500 \
491 mcast_query_response_interval 500 \
492 mcast_membership_interval 1500
493
489 $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q494 $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q
490 sleep 3495 sleep 3
491 bridge -j -d -s mdb show dev br0 \496 bridge -j -d -s mdb show dev br0 \
@@ -517,7 +522,8 @@ v3exc_timeout_test() · 25 unmodified lines
517 log_test "IGMPv3 group $TEST_GROUP exclude timeout"522 log_test "IGMPv3 group $TEST_GROUP exclude timeout"
518 523
519 ip link set dev br0 type bridge mcast_query_interval 12500 \524 ip link set dev br0 type bridge mcast_query_interval 12500 \
520 mcast_query_response_interval 1000525 mcast_query_response_interval 1000 \
526 mcast_membership_interval 26000
521 527
522 v3cleanup $swp1 $TEST_GROUP528 v3cleanup $swp1 $TEST_GROUP
523}529}
tools/testing/selftests/net/forwarding/bridge_mld.sh+9−3
@@ -479,10 +479,15 @@ mldv2exc_timeout_test() · 478 unmodified lines
479 local X=("2001:db8:1::20" "2001:db8:1::30")479 local X=("2001:db8:1::20" "2001:db8:1::30")
480 480
481 # GMI should be 3 seconds481 # GMI should be 3 seconds
482 ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100482 ip link set dev br0 type bridge mcast_query_interval 100 \
483 mcast_query_response_interval 100 \
484 mcast_membership_interval 300
483 485
484 mldv2exclude_prepare $h1486 mldv2exclude_prepare $h1
485 ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500487 ip link set dev br0 type bridge mcast_query_interval 500 \
488 mcast_query_response_interval 500 \
489 mcast_membership_interval 1500
490
486 $MZ $h1 -c 1 $MZPKT_ALLOW2 -q491 $MZ $h1 -c 1 $MZPKT_ALLOW2 -q
487 sleep 3492 sleep 3
488 bridge -j -d -s mdb show dev br0 \493 bridge -j -d -s mdb show dev br0 \
@@ -514,7 +519,8 @@ mldv2exc_timeout_test() · 25 unmodified lines
514 log_test "MLDv2 group $TEST_GROUP exclude timeout"519 log_test "MLDv2 group $TEST_GROUP exclude timeout"
515 520
516 ip link set dev br0 type bridge mcast_query_interval 12500 \521 ip link set dev br0 type bridge mcast_query_interval 12500 \
517 mcast_query_response_interval 1000522 mcast_query_response_interval 1000 \
523 mcast_membership_interval 26000
518 524
519 mldv2cleanup $swp1525 mldv2cleanup $swp1
520}526}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t