Merge in the fixes we had queued in case there was another -rc.
Unified · Split
| @@ -1331,6 +1331,10 @@ · 1330 unmodified lines | ||
| 1331 | 1331 | #define MDIO_VEND2_PMA_CDR_CONTROL 0x8056 |
| 1332 | 1332 | #endif |
| 1333 | 1333 | |
| 1334 | +#ifndef MDIO_VEND2_PMA_MISC_CTRL0 | |
| 1335 | +#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090 | |
| 1336 | +#endif | |
| 1337 | + | |
| 1334 | 1338 | #ifndef MDIO_CTRL1_SPEED1G |
| 1335 | 1339 | #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100) |
| 1336 | 1340 | #endif |
| @@ -1389,6 +1393,10 @@ · 52 unmodified lines | ||
| 1389 | 1393 | #define XGBE_PMA_RX_RST_0_RESET_ON 0x10 |
| 1390 | 1394 | #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 | 1400 | /* Bit setting and getting macros |
| 1393 | 1401 | * The get macro will extract the current bit field value from within |
| 1394 | 1402 | * the variable |
| @@ -1977,12 +1977,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) · 1976 unmodified lines | ||
| 1977 | 1977 | } |
| 1978 | 1978 | } |
| 1979 | 1979 | |
| 1980 | +static 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 | + | |
| 1980 | 1991 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, |
| 1981 | 1992 | unsigned int cmd, unsigned int sub_cmd) |
| 1982 | 1993 | { |
| 1983 | 1994 | unsigned int s0 = 0; |
| 1984 | 1995 | unsigned int wait; |
| 1985 | 1996 | |
| 1997 | + /* Disable PLL re-initialization during FW command processing */ | |
| 1998 | + xgbe_phy_pll_ctrl(pdata, false); | |
| 1999 | + | |
| 1986 | 2000 | /* Log if a previous command did not complete */ |
| 1987 | 2001 | if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) { |
| 1988 | 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 | 2017 | wait = XGBE_RATECHANGE_COUNT; |
| 2004 | 2018 | while (wait--) { |
| 2005 | 2019 | if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) |
| 2006 | − return; | |
| 2020 | + goto reenable_pll; | |
| 2007 | 2021 | |
| 2008 | 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 | 2028 | /* Reset on error */ |
| 2015 | 2029 | xgbe_phy_rx_reset(pdata); |
| 2030 | + | |
| 2031 | +reenable_pll: | |
| 2032 | + /* Enable PLL re-initialization */ | |
| 2033 | + xgbe_phy_pll_ctrl(pdata, true); | |
| 2016 | 2034 | } |
| 2017 | 2035 | |
| 2018 | 2036 | static void xgbe_phy_rrc(struct xgbe_prv_data *pdata) |
| @@ -1914,8 +1914,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 1913 unmodified lines | ||
| 1914 | 1914 | ind_bufp = &tx_scrq->ind_buf; |
| 1915 | 1915 | |
| 1916 | 1916 | if (test_bit(0, &adapter->resetting)) { |
| 1917 | − if (!netif_subqueue_stopped(netdev, skb)) | |
| 1918 | − netif_stop_subqueue(netdev, queue_num); | |
| 1919 | 1917 | dev_kfree_skb_any(skb); |
| 1920 | 1918 | |
| 1921 | 1919 | tx_send_failed++; |
| @@ -2757,7 +2755,7 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, · 835 unmodified lines | ||
| 2757 | 2755 | |
| 2758 | 2756 | if (adapter->state == VNIC_PROBING) { |
| 2759 | 2757 | netdev_warn(netdev, "Adapter reset during probe\n"); |
| 2760 | − adapter->init_done_rc = EAGAIN; | |
| 2758 | + adapter->init_done_rc = -EAGAIN; | |
| 2761 | 2759 | ret = EAGAIN; |
| 2762 | 2760 | goto err; |
| 2763 | 2761 | } |
| @@ -5259,11 +5257,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 2495 unmodified lines | ||
| 5259 | 5257 | */ |
| 5260 | 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 | 5260 | if (adapter->state == VNIC_DOWN) |
| 5268 | 5261 | rc = ibmvnic_reset(adapter, VNIC_RESET_PASSIVE_INIT); |
| 5269 | 5262 | else |
| @@ -5284,6 +5277,13 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 14 unmodified lines | ||
| 5284 | 5277 | rc); |
| 5285 | 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 | 5287 | break; |
| 5288 | 5288 | case IBMVNIC_CRQ_INIT_COMPLETE: |
| 5289 | 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 | 5604 | crq->cur = 0; |
| 5605 | 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 | 5610 | return retrc; |
| 5608 | 5611 | |
| 5609 | 5612 | req_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 | 5758 | rc = ibmvnic_reset_init(adapter, false); |
| 5756 | − } while (rc == EAGAIN); | |
| 5759 | + } while (rc == -EAGAIN); | |
| 5757 | 5760 | |
| 5758 | 5761 | /* We are ignoring the error from ibmvnic_reset_init() assuming that the |
| 5759 | 5762 | * partner is not ready. CRQ is not active. When the partner becomes |
| @@ -2067,7 +2067,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) · 2066 unmodified lines | ||
| 2067 | 2067 | if (napi_complete_done(napi, pkts_polled)) |
| 2068 | 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 | 2071 | struct dim_sample dim_sample = {}; |
| 2072 | 2072 | unsigned int start; |
| 2073 | 2073 | u64 pkts, bytes; |
| @@ -2082,7 +2082,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) · 8 unmodified lines | ||
| 2082 | 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 | 2086 | struct dim_sample dim_sample = {}; |
| 2087 | 2087 | unsigned int start; |
| 2088 | 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 | 3017 | /* copy RX interrupt coalesce parameters */ |
| 3018 | 3018 | value = (moder.pkts << 16) | (factor * moder.usec); |
| 3019 | − rtnl_lock(); | |
| 3020 | 3019 | nn_writel(nn, NFP_NET_CFG_RXR_IRQ_MOD(r_vec->rx_ring->idx), value); |
| 3021 | 3020 | (void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD); |
| 3022 | − rtnl_unlock(); | |
| 3023 | 3021 | |
| 3024 | 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 | 3046 | /* copy TX interrupt coalesce parameters */ |
| 3049 | 3047 | value = (moder.pkts << 16) | (factor * moder.usec); |
| 3050 | − rtnl_lock(); | |
| 3051 | 3048 | nn_writel(nn, NFP_NET_CFG_TXR_IRQ_MOD(r_vec->tx_ring->idx), value); |
| 3052 | 3049 | (void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD); |
| 3053 | − rtnl_unlock(); | |
| 3054 | 3050 | |
| 3055 | 3051 | dim->state = DIM_START_MEASURE; |
| 3056 | 3052 | } |
| @@ -1780,7 +1780,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, · 1779 unmodified lines | ||
| 1780 | 1780 | return -EOPNOTSUPP; |
| 1781 | 1781 | |
| 1782 | 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 | 1784 | return -EINVAL; |
| 1785 | 1785 | |
| 1786 | 1786 | pause_state = 0; |
| @@ -287,6 +287,7 @@ enum flow_dissector_key_id { · 286 unmodified lines | ||
| 287 | 287 | #define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0) |
| 288 | 288 | #define FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL BIT(1) |
| 289 | 289 | #define FLOW_DISSECTOR_F_STOP_AT_ENCAP BIT(2) |
| 290 | +#define FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP BIT(3) | |
| 290 | 291 | |
| 291 | 292 | struct flow_dissector_key { |
| 292 | 293 | enum flow_dissector_key_id key_id; |
| @@ -626,7 +626,8 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize) · 625 unmodified lines | ||
| 626 | 626 | |
| 627 | 627 | static 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 | |
| 632 | 633 | static 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 | 654 | if (t->pl.state == SCTP_PL_DISABLED) |
| 654 | 655 | return; |
| 655 | 656 | |
| 656 | − if (del_timer(&t->probe_timer)) | |
| 657 | − sctp_transport_put(t); | |
| 658 | − | |
| 659 | 657 | t->pl.state = SCTP_PL_BASE; |
| 660 | 658 | t->pl.pmtu = SCTP_BASE_PLPMTU; |
| 661 | 659 | t->pl.probe_size = SCTP_BASE_PLPMTU; |
| 660 | + sctp_transport_reset_probe_timer(t); | |
| 662 | 661 | } |
| 663 | 662 | |
| 664 | 663 | static inline bool sctp_transport_pl_enabled(struct sctp_transport *t) |
| @@ -1893,11 +1893,13 @@ static inline int br_cfm_status_fill_info(struct sk_buff *skb, · 1892 unmodified lines | ||
| 1893 | 1893 | |
| 1894 | 1894 | static inline int br_cfm_mep_count(struct net_bridge *br, u32 *count) |
| 1895 | 1895 | { |
| 1896 | + *count = 0; | |
| 1896 | 1897 | return -EOPNOTSUPP; |
| 1897 | 1898 | } |
| 1898 | 1899 | |
| 1899 | 1900 | static inline int br_cfm_peer_mep_count(struct net_bridge *br, u32 *count) |
| 1900 | 1901 | { |
| 1902 | + *count = 0; | |
| 1901 | 1903 | return -EOPNOTSUPP; |
| 1902 | 1904 | } |
| 1903 | 1905 | #endif |
| @@ -1306,6 +1306,11 @@ ip_proto_again: · 1305 unmodified lines | ||
| 1306 | 1306 | |
| 1307 | 1307 | switch (ip_proto) { |
| 1308 | 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 | 1314 | fdret = __skb_flow_dissect_gre(skb, key_control, flow_dissector, |
| 1310 | 1315 | target_container, data, |
| 1311 | 1316 | &proto, &nhoff, &hlen, flags); |
| @@ -1363,6 +1368,11 @@ ip_proto_again: · 51 unmodified lines | ||
| 1363 | 1368 | break; |
| 1364 | 1369 | } |
| 1365 | 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 | 1376 | proto = htons(ETH_P_IP); |
| 1367 | 1377 | |
| 1368 | 1378 | key_control->flags |= FLOW_DIS_ENCAPSULATION; |
| @@ -1375,6 +1385,11 @@ ip_proto_again: · 6 unmodified lines | ||
| 1375 | 1385 | break; |
| 1376 | 1386 | |
| 1377 | 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 | 1393 | proto = htons(ETH_P_IPV6); |
| 1379 | 1394 | |
| 1380 | 1395 | key_control->flags |= FLOW_DIS_ENCAPSULATION; |
| @@ -1435,7 +1435,6 @@ do_udp_sendmsg: · 1434 unmodified lines | ||
| 1435 | 1435 | if (!fl6.flowi6_oif) |
| 1436 | 1436 | fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; |
| 1437 | 1437 | |
| 1438 | − fl6.flowi6_mark = ipc6.sockc.mark; | |
| 1439 | 1438 | fl6.flowi6_uid = sk->sk_uid; |
| 1440 | 1439 | |
| 1441 | 1440 | if (msg->msg_controllen) { |
| @@ -1471,6 +1470,7 @@ do_udp_sendmsg: · 29 unmodified lines | ||
| 1471 | 1470 | ipc6.opt = opt; |
| 1472 | 1471 | |
| 1473 | 1472 | fl6.flowi6_proto = sk->sk_protocol; |
| 1473 | + fl6.flowi6_mark = ipc6.sockc.mark; | |
| 1474 | 1474 | fl6.daddr = *daddr; |
| 1475 | 1475 | if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr)) |
| 1476 | 1476 | fl6.saddr = np->saddr; |
| @@ -329,7 +329,8 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, · 328 unmodified lines | ||
| 329 | 329 | ARRAY_SIZE(fl_ct_info_to_flower_map), |
| 330 | 330 | post_ct); |
| 331 | 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 | 335 | f = fl_mask_lookup(mask, &skb_key); |
| 335 | 336 | if (f && !tc_skip_sw(f->flags)) { |
| @@ -581,13 +581,16 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) · 580 unmodified lines | ||
| 581 | 581 | chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list); |
| 582 | 582 | sk = chunk->skb->sk; |
| 583 | 583 | |
| 584 | − /* check gso */ | |
| 585 | 584 | if (packet->size > tp->pathmtu && !packet->ipfragok && !chunk->pmtu_probe) { |
| 586 | − if (!sk_can_gso(sk)) { | |
| 587 | − pr_err_once("Trying to GSO but underlying device doesn't support it."); | |
| 588 | − goto out; | |
| 585 | + if (tp->pl.state == SCTP_PL_ERROR) { /* do IP fragmentation if in Error state */ | |
| 586 | + packet->ipfragok = 1; | |
| 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 | 596 | /* alloc head skb */ |
| @@ -269,7 +269,7 @@ bool sctp_transport_pl_send(struct sctp_transport *t) · 268 unmodified lines | ||
| 269 | 269 | if (t->pl.probe_size == SCTP_BASE_PLPMTU) { /* BASE_PLPMTU Confirmation Failed */ |
| 270 | 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 | 273 | t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t); |
| 274 | 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 | 366 | if (pmtu >= SCTP_MIN_PLPMTU && pmtu < SCTP_BASE_PLPMTU) { |
| 367 | 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 | 370 | t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t); |
| 371 | + return true; | |
| 371 | 372 | } |
| 372 | 373 | } else if (t->pl.state == SCTP_PL_SEARCH) { |
| 373 | 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 | 379 | t->pl.probe_high = 0; |
| 379 | 380 | t->pl.pmtu = SCTP_BASE_PLPMTU; |
| 380 | 381 | t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t); |
| 382 | + return true; | |
| 381 | 383 | } else if (pmtu > t->pl.pmtu && pmtu < t->pl.probe_size) { |
| 382 | 384 | t->pl.probe_size = pmtu; |
| 383 | 385 | t->pl.probe_count = 0; |
| 384 | − | |
| 385 | − return false; | |
| 386 | 386 | } |
| 387 | 387 | } else if (t->pl.state == SCTP_PL_COMPLETE) { |
| 388 | 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 | 393 | t->pl.probe_high = 0; |
| 394 | 394 | t->pl.pmtu = SCTP_BASE_PLPMTU; |
| 395 | 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 | |
| 402 | 403 | bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) |
| @@ -31,3 +31,8 @@ rxtimestamp · 30 unmodified lines | ||
| 31 | 31 | timestamping |
| 32 | 32 | txtimestamp |
| 33 | 33 | so_netns_cookie |
| 34 | +test_unix_oob | |
| 35 | +gro | |
| 36 | +ioam6_parser | |
| 37 | +toeplitz | |
| 38 | +cmsg_so_mark | |
| @@ -29,6 +29,7 @@ TEST_PROGS += veth.sh · 28 unmodified lines | ||
| 29 | 29 | TEST_PROGS += ioam6.sh |
| 30 | 30 | TEST_PROGS += gro.sh |
| 31 | 31 | TEST_PROGS += gre_gso.sh |
| 32 | +TEST_PROGS += cmsg_so_mark.sh | |
| 32 | 33 | TEST_PROGS_EXTENDED := in_netns.sh |
| 33 | 34 | TEST_GEN_FILES = socket nettest |
| 34 | 35 | TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any |
| @@ -45,6 +46,7 @@ TEST_GEN_FILES += gro · 10 unmodified lines | ||
| 45 | 46 | TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa |
| 46 | 47 | TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls |
| 47 | 48 | TEST_GEN_FILES += toeplitz |
| 49 | +TEST_GEN_FILES += cmsg_so_mark | |
| 48 | 50 | |
| 49 | 51 | TEST_FILES := settings |
| 50 | 52 | |
| @@ -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 | + | |
| 11 | +int 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 | +} | |
| @@ -0,0 +1,61 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 3 | + | |
| 4 | +NS=ns | |
| 5 | +IP4=172.16.0.1/24 | |
| 6 | +TGT4=172.16.0.2 | |
| 7 | +IP6=2001:db8:1::1/64 | |
| 8 | +TGT6=2001:db8:1::2 | |
| 9 | +MARK=1000 | |
| 10 | + | |
| 11 | +cleanup() | |
| 12 | +{ | |
| 13 | + ip netns del $NS | |
| 14 | +} | |
| 15 | + | |
| 16 | +trap cleanup EXIT | |
| 17 | + | |
| 18 | +# Namespaces | |
| 19 | +ip netns add $NS | |
| 20 | + | |
| 21 | +# Connectivity | |
| 22 | +ip -netns $NS link add type dummy | |
| 23 | +ip -netns $NS link set dev dummy0 up | |
| 24 | +ip -netns $NS addr add $IP4 dev dummy0 | |
| 25 | +ip -netns $NS addr add $IP6 dev dummy0 | |
| 26 | + | |
| 27 | +ip -netns $NS rule add fwmark $MARK lookup 300 | |
| 28 | +ip -6 -netns $NS rule add fwmark $MARK lookup 300 | |
| 29 | +ip -netns $NS route add prohibit any table 300 | |
| 30 | +ip -6 -netns $NS route add prohibit any table 300 | |
| 31 | + | |
| 32 | +# Test | |
| 33 | +BAD=0 | |
| 34 | +TOTAL=0 | |
| 35 | + | |
| 36 | +check_result() { | |
| 37 | + ((TOTAL++)) | |
| 38 | + if [ $1 -ne $2 ]; then | |
| 39 | + echo " Case $3 returned $1, expected $2" | |
| 40 | + ((BAD++)) | |
| 41 | + fi | |
| 42 | +} | |
| 43 | + | |
| 44 | +ip netns exec $NS ./cmsg_so_mark $TGT4 1234 $((MARK + 1)) | |
| 45 | +check_result $? 0 "IPv4 pass" | |
| 46 | +ip netns exec $NS ./cmsg_so_mark $TGT6 1234 $((MARK + 1)) | |
| 47 | +check_result $? 0 "IPv6 pass" | |
| 48 | + | |
| 49 | +ip netns exec $NS ./cmsg_so_mark $TGT4 1234 $MARK | |
| 50 | +check_result $? 1 "IPv4 rejection" | |
| 51 | +ip netns exec $NS ./cmsg_so_mark $TGT6 1234 $MARK | |
| 52 | +check_result $? 1 "IPv6 rejection" | |
| 53 | + | |
| 54 | +# Summary | |
| 55 | +if [ $BAD -ne 0 ]; then | |
| 56 | + echo "FAIL - $BAD/$TOTAL cases failed" | |
| 57 | + exit 1 | |
| 58 | +else | |
| 59 | + echo "OK" | |
| 60 | + exit 0 | |
| 61 | +fi | |
| @@ -482,10 +482,15 @@ v3exc_timeout_test() · 481 unmodified lines | ||
| 482 | 482 | local X=("192.0.2.20" "192.0.2.30") |
| 483 | 483 | |
| 484 | 484 | # GMI should be 3 seconds |
| 485 | − ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100 | |
| 485 | + 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 | 489 | v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP |
| 488 | − ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500 | |
| 490 | + ip link set dev br0 type bridge mcast_query_interval 500 \ | |
| 491 | + mcast_query_response_interval 500 \ | |
| 492 | + mcast_membership_interval 1500 | |
| 493 | + | |
| 489 | 494 | $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q |
| 490 | 495 | sleep 3 |
| 491 | 496 | bridge -j -d -s mdb show dev br0 \ |
| @@ -517,7 +522,8 @@ v3exc_timeout_test() · 25 unmodified lines | ||
| 517 | 522 | log_test "IGMPv3 group $TEST_GROUP exclude timeout" |
| 518 | 523 | |
| 519 | 524 | ip link set dev br0 type bridge mcast_query_interval 12500 \ |
| 520 | − mcast_query_response_interval 1000 | |
| 525 | + mcast_query_response_interval 1000 \ | |
| 526 | + mcast_membership_interval 26000 | |
| 521 | 527 | |
| 522 | 528 | v3cleanup $swp1 $TEST_GROUP |
| 523 | 529 | } |
| @@ -479,10 +479,15 @@ mldv2exc_timeout_test() · 478 unmodified lines | ||
| 479 | 479 | local X=("2001:db8:1::20" "2001:db8:1::30") |
| 480 | 480 | |
| 481 | 481 | # GMI should be 3 seconds |
| 482 | − ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100 | |
| 482 | + 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 | 486 | mldv2exclude_prepare $h1 |
| 485 | − ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500 | |
| 487 | + ip link set dev br0 type bridge mcast_query_interval 500 \ | |
| 488 | + mcast_query_response_interval 500 \ | |
| 489 | + mcast_membership_interval 1500 | |
| 490 | + | |
| 486 | 491 | $MZ $h1 -c 1 $MZPKT_ALLOW2 -q |
| 487 | 492 | sleep 3 |
| 488 | 493 | bridge -j -d -s mdb show dev br0 \ |
| @@ -514,7 +519,8 @@ mldv2exc_timeout_test() · 25 unmodified lines | ||
| 514 | 519 | log_test "MLDv2 group $TEST_GROUP exclude timeout" |
| 515 | 520 | |
| 516 | 521 | ip link set dev br0 type bridge mcast_query_interval 12500 \ |
| 517 | − mcast_query_response_interval 1000 | |
| 522 | + mcast_query_response_interval 1000 \ | |
| 523 | + mcast_membership_interval 26000 | |
| 518 | 524 | |
| 519 | 525 | mldv2cleanup $swp1 |
| 520 | 526 | } |