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

Pull networking fixes from Jakub Kicinski:
"Including fixes from wireless, and bluetooth.

No outstanding fires.

Current release - regressions:

- eth: atlantic: always deep reset on pm op, fix null-deref

Current release - new code bugs:

- rds: use maybe_get_net() when acquiring refcount on TCP sockets
[refinement of a previous fix]

- eth: ocelot: mark traps with a bool instead of guessing type based
on list membership

Previous releases - regressions:

- net: fix skipping features in for_each_netdev_feature()

- phy: micrel: fix null-derefs on suspend/resume and probe

- bcmgenet: check for Wake-on-LAN interrupt probe deferral

Previous releases - always broken:

- ipv4: drop dst in multicast routing path, prevent leaks

- ping: fix address binding wrt vrf

- net: fix wrong network header length when BPF protocol translation
is used on skbs with a fraglist

- bluetooth: fix the creation of hdev->name

- rfkill: uapi: fix RFKILL_IOCTL_MAX_SIZE ioctl request definition

- wifi: iwlwifi: iwl-dbg: use del_timer_sync() before freeing

- wifi: ath11k: reduce the wait time of 11d scan and hw scan while
adding an interface

- mac80211: fix rx reordering with non explicit / psmp ack policy

- mac80211: reset MBSSID parameters upon connection

- nl80211: fix races in nl80211_set_tx_bitrate_mask()

- tls: fix context leak on tls_device_down

- sched: act_pedit: really ensure the skb is writable

- batman-adv: don't skb_split skbuffs with frag_list

- eth: ocelot: fix various issues with TC actions (null-deref; bad
stats; ineffective drops; ineffective filter removal)"

* tag 'net-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (61 commits)
tls: Fix context leak on tls_device_down
net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe()
net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending
net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down()
mlxsw: Avoid warning during ip6gre device removal
net: bcmgenet: Check for Wake-on-LAN interrupt probe deferral
net: ethernet: mediatek: ppe: fix wrong size passed to memset()
Bluetooth: Fix the creation of hdev->name
i40e: i40e_main: fix a missing check on list iterator
net/sched: act_pedit: really ensure the skb is writable
s390/lcs: fix variable dereferenced before check
s390/ctcm: fix potential memory leak
s390/ctcm: fix variable dereferenced before check
net: atlantic: verify hw_head_ lies within TX buffer ring
net: atlantic: add check for MAX_SKB_FRAGS
net: atlantic: reduce scope of is_rsc_complete
net: atlantic: fix "frag[0] not initialized"
net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
net: phy: micrel: Fix incorrect variable type in micrel
decnet: Use container_of() for struct dn_neigh casts
...

+848 -228
+1
.mailmap
··· 205 205 Juha Yrjola <juha.yrjola@nokia.com> 206 206 Juha Yrjola <juha.yrjola@solidboot.com> 207 207 Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com> 208 + Kalle Valo <kvalo@kernel.org> <kvalo@codeaurora.org> 208 209 Kalyan Thota <quic_kalyant@quicinc.com> <kalyan_t@codeaurora.org> 209 210 Kay Sievers <kay.sievers@vrfy.org> 210 211 Kees Cook <keescook@chromium.org> <kees.cook@canonical.com>
+3 -2
MAINTAINERS
··· 3571 3571 L: netdev@vger.kernel.org 3572 3572 S: Supported 3573 3573 W: http://sourceforge.net/projects/bonding/ 3574 + F: Documentation/networking/bonding.rst 3574 3575 F: drivers/net/bonding/ 3575 - F: include/net/bonding.h 3576 + F: include/net/bond* 3576 3577 F: include/uapi/linux/if_bonding.h 3577 3578 3578 3579 BOSCH SENSORTEC BMA400 ACCELEROMETER IIO DRIVER ··· 10132 10131 F: drivers/net/wireless/intel/iwlegacy/ 10133 10132 10134 10133 INTEL WIRELESS WIFI LINK (iwlwifi) 10135 - M: Luca Coelho <luciano.coelho@intel.com> 10134 + M: Gregory Greenman <gregory.greenman@intel.com> 10136 10135 L: linux-wireless@vger.kernel.org 10137 10136 S: Supported 10138 10137 W: https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi
+3
drivers/net/dsa/bcm_sf2.c
··· 809 809 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); 810 810 u32 reg, offset; 811 811 812 + if (priv->wol_ports_mask & BIT(port)) 813 + return; 814 + 812 815 if (port != core_readl(priv, CORE_IMP0_PRT_ID)) { 813 816 if (priv->type == BCM4908_DEVICE_ID || 814 817 priv->type == BCM7445_DEVICE_ID)
+6 -1
drivers/net/dsa/ocelot/felix.c
··· 403 403 { 404 404 struct ocelot *ocelot = ds->priv; 405 405 struct felix *felix = ocelot_to_felix(ocelot); 406 + struct ocelot_vcap_block *block_vcap_is2; 406 407 struct ocelot_vcap_filter *trap; 407 408 enum ocelot_mask_mode mask_mode; 408 409 unsigned long port_mask; ··· 423 422 /* We are sure that "cpu" was found, otherwise 424 423 * dsa_tree_setup_default_cpu() would have failed earlier. 425 424 */ 425 + block_vcap_is2 = &ocelot->block[VCAP_IS2]; 426 426 427 427 /* Make sure all traps are set up for that destination */ 428 - list_for_each_entry(trap, &ocelot->traps, trap_list) { 428 + list_for_each_entry(trap, &block_vcap_is2->rules, list) { 429 + if (!trap->is_trap) 430 + continue; 431 + 429 432 /* Figure out the current trapping destination */ 430 433 if (using_tag_8021q) { 431 434 /* Redirect to the tag_8021q CPU port. If timestamps
+2 -2
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
··· 449 449 450 450 static int aq_pm_suspend_poweroff(struct device *dev) 451 451 { 452 - return aq_suspend_common(dev, false); 452 + return aq_suspend_common(dev, true); 453 453 } 454 454 455 455 static int aq_pm_thaw(struct device *dev) ··· 459 459 460 460 static int aq_pm_resume_restore(struct device *dev) 461 461 { 462 - return atl_resume_common(dev, false); 462 + return atl_resume_common(dev, true); 463 463 } 464 464 465 465 static const struct dev_pm_ops aq_pm_ops = {
+11 -9
drivers/net/ethernet/aquantia/atlantic/aq_ring.c
··· 346 346 int budget) 347 347 { 348 348 struct net_device *ndev = aq_nic_get_ndev(self->aq_nic); 349 - bool is_rsc_completed = true; 350 349 int err = 0; 351 350 352 351 for (; (self->sw_head != self->hw_head) && budget; ··· 363 364 continue; 364 365 365 366 if (!buff->is_eop) { 367 + unsigned int frag_cnt = 0U; 366 368 buff_ = buff; 367 369 do { 370 + bool is_rsc_completed = true; 371 + 368 372 if (buff_->next >= self->size) { 369 373 err = -EIO; 370 374 goto err_exit; 371 375 } 376 + 377 + frag_cnt++; 372 378 next_ = buff_->next, 373 379 buff_ = &self->buff_ring[next_]; 374 380 is_rsc_completed = ··· 381 377 next_, 382 378 self->hw_head); 383 379 384 - if (unlikely(!is_rsc_completed)) 385 - break; 380 + if (unlikely(!is_rsc_completed) || 381 + frag_cnt > MAX_SKB_FRAGS) { 382 + err = 0; 383 + goto err_exit; 384 + } 386 385 387 386 buff->is_error |= buff_->is_error; 388 387 buff->is_cso_err |= buff_->is_cso_err; 389 388 390 389 } while (!buff_->is_eop); 391 390 392 - if (!is_rsc_completed) { 393 - err = 0; 394 - goto err_exit; 395 - } 396 391 if (buff->is_error || 397 392 (buff->is_lro && buff->is_cso_err)) { 398 393 buff_ = buff; ··· 449 446 ALIGN(hdr_len, sizeof(long))); 450 447 451 448 if (buff->len - hdr_len > 0) { 452 - skb_add_rx_frag(skb, 0, buff->rxdata.page, 449 + skb_add_rx_frag(skb, i++, buff->rxdata.page, 453 450 buff->rxdata.pg_off + hdr_len, 454 451 buff->len - hdr_len, 455 452 AQ_CFG_RX_FRAME_MAX); ··· 458 455 459 456 if (!buff->is_eop) { 460 457 buff_ = buff; 461 - i = 1U; 462 458 do { 463 459 next_ = buff_->next; 464 460 buff_ = &self->buff_ring[next_];
+7
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
··· 889 889 err = -ENXIO; 890 890 goto err_exit; 891 891 } 892 + 893 + /* Validate that the new hw_head_ is reasonable. */ 894 + if (hw_head_ >= ring->size) { 895 + err = -ENXIO; 896 + goto err_exit; 897 + } 898 + 892 899 ring->hw_head = hw_head_; 893 900 err = aq_hw_err_from_flags(self); 894 901
+4
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 3999 3999 goto err; 4000 4000 } 4001 4001 priv->wol_irq = platform_get_irq_optional(pdev, 2); 4002 + if (priv->wol_irq == -EPROBE_DEFER) { 4003 + err = priv->wol_irq; 4004 + goto err; 4005 + } 4002 4006 4003 4007 priv->base = devm_platform_ioremap_resource(pdev, 0); 4004 4008 if (IS_ERR(priv->base)) {
+5 -5
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
··· 2793 2793 goto out; 2794 2794 na = ret; 2795 2795 2796 - memcpy(p->id, vpd + id, min_t(int, id_len, ID_LEN)); 2796 + memcpy(p->id, vpd + id, min_t(unsigned int, id_len, ID_LEN)); 2797 2797 strim(p->id); 2798 - memcpy(p->sn, vpd + sn, min_t(int, sn_len, SERNUM_LEN)); 2798 + memcpy(p->sn, vpd + sn, min_t(unsigned int, sn_len, SERNUM_LEN)); 2799 2799 strim(p->sn); 2800 - memcpy(p->pn, vpd + pn, min_t(int, pn_len, PN_LEN)); 2800 + memcpy(p->pn, vpd + pn, min_t(unsigned int, pn_len, PN_LEN)); 2801 2801 strim(p->pn); 2802 - memcpy(p->na, vpd + na, min_t(int, na_len, MACADDR_LEN)); 2803 - strim((char *)p->na); 2802 + memcpy(p->na, vpd + na, min_t(unsigned int, na_len, MACADDR_LEN)); 2803 + strim(p->na); 2804 2804 2805 2805 out: 2806 2806 vfree(vpd);
+4 -1
drivers/net/ethernet/dec/tulip/tulip_core.c
··· 1399 1399 1400 1400 /* alloc_etherdev ensures aligned and zeroed private structures */ 1401 1401 dev = alloc_etherdev (sizeof (*tp)); 1402 - if (!dev) 1402 + if (!dev) { 1403 + pci_disable_device(pdev); 1403 1404 return -ENOMEM; 1405 + } 1404 1406 1405 1407 SET_NETDEV_DEV(dev, &pdev->dev); 1406 1408 if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { ··· 1787 1785 1788 1786 err_out_free_netdev: 1789 1787 free_netdev (dev); 1788 + pci_disable_device(pdev); 1790 1789 return -ENODEV; 1791 1790 } 1792 1791
+14 -13
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 7549 7549 static int i40e_fwd_ring_up(struct i40e_vsi *vsi, struct net_device *vdev, 7550 7550 struct i40e_fwd_adapter *fwd) 7551 7551 { 7552 + struct i40e_channel *ch = NULL, *ch_tmp, *iter; 7552 7553 int ret = 0, num_tc = 1, i, aq_err; 7553 - struct i40e_channel *ch, *ch_tmp; 7554 7554 struct i40e_pf *pf = vsi->back; 7555 7555 struct i40e_hw *hw = &pf->hw; 7556 7556 7557 - if (list_empty(&vsi->macvlan_list)) 7558 - return -EINVAL; 7559 - 7560 7557 /* Go through the list and find an available channel */ 7561 - list_for_each_entry_safe(ch, ch_tmp, &vsi->macvlan_list, list) { 7562 - if (!i40e_is_channel_macvlan(ch)) { 7563 - ch->fwd = fwd; 7558 + list_for_each_entry_safe(iter, ch_tmp, &vsi->macvlan_list, list) { 7559 + if (!i40e_is_channel_macvlan(iter)) { 7560 + iter->fwd = fwd; 7564 7561 /* record configuration for macvlan interface in vdev */ 7565 7562 for (i = 0; i < num_tc; i++) 7566 7563 netdev_bind_sb_channel_queue(vsi->netdev, vdev, 7567 7564 i, 7568 - ch->num_queue_pairs, 7569 - ch->base_queue); 7570 - for (i = 0; i < ch->num_queue_pairs; i++) { 7565 + iter->num_queue_pairs, 7566 + iter->base_queue); 7567 + for (i = 0; i < iter->num_queue_pairs; i++) { 7571 7568 struct i40e_ring *tx_ring, *rx_ring; 7572 7569 u16 pf_q; 7573 7570 7574 - pf_q = ch->base_queue + i; 7571 + pf_q = iter->base_queue + i; 7575 7572 7576 7573 /* Get to TX ring ptr */ 7577 7574 tx_ring = vsi->tx_rings[pf_q]; 7578 - tx_ring->ch = ch; 7575 + tx_ring->ch = iter; 7579 7576 7580 7577 /* Get the RX ring ptr */ 7581 7578 rx_ring = vsi->rx_rings[pf_q]; 7582 - rx_ring->ch = ch; 7579 + rx_ring->ch = iter; 7583 7580 } 7581 + ch = iter; 7584 7582 break; 7585 7583 } 7586 7584 } 7585 + 7586 + if (!ch) 7587 + return -EINVAL; 7587 7588 7588 7589 /* Guarantee all rings are updated before we update the 7589 7590 * MAC address filter.
+1
drivers/net/ethernet/intel/ice/ice.h
··· 540 540 struct mutex avail_q_mutex; /* protects access to avail_[rx|tx]qs */ 541 541 struct mutex sw_mutex; /* lock for protecting VSI alloc flow */ 542 542 struct mutex tc_mutex; /* lock to protect TC changes */ 543 + struct mutex adev_mutex; /* lock to protect aux device access */ 543 544 u32 msg_enable; 544 545 struct ice_ptp ptp; 545 546 struct tty_driver *ice_gnss_tty_driver;
+17 -8
drivers/net/ethernet/intel/ice/ice_idc.c
··· 37 37 if (WARN_ON_ONCE(!in_task())) 38 38 return; 39 39 40 + mutex_lock(&pf->adev_mutex); 40 41 if (!pf->adev) 41 - return; 42 + goto finish; 42 43 43 44 device_lock(&pf->adev->dev); 44 45 iadrv = ice_get_auxiliary_drv(pf); 45 46 if (iadrv && iadrv->event_handler) 46 47 iadrv->event_handler(pf, event); 47 48 device_unlock(&pf->adev->dev); 49 + finish: 50 + mutex_unlock(&pf->adev_mutex); 48 51 } 49 52 50 53 /** ··· 293 290 return -ENOMEM; 294 291 295 292 adev = &iadev->adev; 296 - pf->adev = adev; 297 293 iadev->pf = pf; 298 294 299 295 adev->id = pf->aux_idx; ··· 302 300 303 301 ret = auxiliary_device_init(adev); 304 302 if (ret) { 305 - pf->adev = NULL; 306 303 kfree(iadev); 307 304 return ret; 308 305 } 309 306 310 307 ret = auxiliary_device_add(adev); 311 308 if (ret) { 312 - pf->adev = NULL; 313 309 auxiliary_device_uninit(adev); 314 310 return ret; 315 311 } 312 + 313 + mutex_lock(&pf->adev_mutex); 314 + pf->adev = adev; 315 + mutex_unlock(&pf->adev_mutex); 316 316 317 317 return 0; 318 318 } ··· 324 320 */ 325 321 void ice_unplug_aux_dev(struct ice_pf *pf) 326 322 { 327 - if (!pf->adev) 328 - return; 323 + struct auxiliary_device *adev; 329 324 330 - auxiliary_device_delete(pf->adev); 331 - auxiliary_device_uninit(pf->adev); 325 + mutex_lock(&pf->adev_mutex); 326 + adev = pf->adev; 332 327 pf->adev = NULL; 328 + mutex_unlock(&pf->adev_mutex); 329 + 330 + if (adev) { 331 + auxiliary_device_delete(adev); 332 + auxiliary_device_uninit(adev); 333 + } 333 334 } 334 335 335 336 /**
+2
drivers/net/ethernet/intel/ice/ice_main.c
··· 3769 3769 static void ice_deinit_pf(struct ice_pf *pf) 3770 3770 { 3771 3771 ice_service_task_stop(pf); 3772 + mutex_destroy(&pf->adev_mutex); 3772 3773 mutex_destroy(&pf->sw_mutex); 3773 3774 mutex_destroy(&pf->tc_mutex); 3774 3775 mutex_destroy(&pf->avail_q_mutex); ··· 3848 3847 3849 3848 mutex_init(&pf->sw_mutex); 3850 3849 mutex_init(&pf->tc_mutex); 3850 + mutex_init(&pf->adev_mutex); 3851 3851 3852 3852 INIT_HLIST_HEAD(&pf->aq_wait_list); 3853 3853 spin_lock_init(&pf->aq_wait_lock);
+8 -2
drivers/net/ethernet/intel/ice/ice_ptp.c
··· 2287 2287 2288 2288 /** 2289 2289 * ice_ptp_tx_tstamp_cleanup - Cleanup old timestamp requests that got dropped 2290 + * @hw: pointer to the hw struct 2290 2291 * @tx: PTP Tx tracker to clean up 2291 2292 * 2292 2293 * Loop through the Tx timestamp requests and see if any of them have been ··· 2296 2295 * timestamp will never be captured. This might happen if the packet gets 2297 2296 * discarded before it reaches the PHY timestamping block. 2298 2297 */ 2299 - static void ice_ptp_tx_tstamp_cleanup(struct ice_ptp_tx *tx) 2298 + static void ice_ptp_tx_tstamp_cleanup(struct ice_hw *hw, struct ice_ptp_tx *tx) 2300 2299 { 2301 2300 u8 idx; 2302 2301 ··· 2305 2304 2306 2305 for_each_set_bit(idx, tx->in_use, tx->len) { 2307 2306 struct sk_buff *skb; 2307 + u64 raw_tstamp; 2308 2308 2309 2309 /* Check if this SKB has been waiting for too long */ 2310 2310 if (time_is_after_jiffies(tx->tstamps[idx].start + 2 * HZ)) 2311 2311 continue; 2312 + 2313 + /* Read tstamp to be able to use this register again */ 2314 + ice_read_phy_tstamp(hw, tx->quad, idx + tx->quad_offset, 2315 + &raw_tstamp); 2312 2316 2313 2317 spin_lock(&tx->lock); 2314 2318 skb = tx->tstamps[idx].skb; ··· 2336 2330 2337 2331 ice_ptp_update_cached_phctime(pf); 2338 2332 2339 - ice_ptp_tx_tstamp_cleanup(&pf->ptp.port.tx); 2333 + ice_ptp_tx_tstamp_cleanup(&pf->hw, &pf->ptp.port.tx); 2340 2334 2341 2335 /* Run twice a second */ 2342 2336 kthread_queue_delayed_work(ptp->kworker, &ptp->work,
+50 -18
drivers/net/ethernet/intel/ice/ice_virtchnl.c
··· 1308 1308 } 1309 1309 1310 1310 /** 1311 + * ice_vf_vsi_dis_single_txq - disable a single Tx queue 1312 + * @vf: VF to disable queue for 1313 + * @vsi: VSI for the VF 1314 + * @q_id: VF relative (0-based) queue ID 1315 + * 1316 + * Attempt to disable the Tx queue passed in. If the Tx queue was successfully 1317 + * disabled then clear q_id bit in the enabled queues bitmap and return 1318 + * success. Otherwise return error. 1319 + */ 1320 + static int 1321 + ice_vf_vsi_dis_single_txq(struct ice_vf *vf, struct ice_vsi *vsi, u16 q_id) 1322 + { 1323 + struct ice_txq_meta txq_meta = { 0 }; 1324 + struct ice_tx_ring *ring; 1325 + int err; 1326 + 1327 + if (!test_bit(q_id, vf->txq_ena)) 1328 + dev_dbg(ice_pf_to_dev(vsi->back), "Queue %u on VSI %u is not enabled, but stopping it anyway\n", 1329 + q_id, vsi->vsi_num); 1330 + 1331 + ring = vsi->tx_rings[q_id]; 1332 + if (!ring) 1333 + return -EINVAL; 1334 + 1335 + ice_fill_txq_meta(vsi, ring, &txq_meta); 1336 + 1337 + err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, vf->vf_id, ring, &txq_meta); 1338 + if (err) { 1339 + dev_err(ice_pf_to_dev(vsi->back), "Failed to stop Tx ring %d on VSI %d\n", 1340 + q_id, vsi->vsi_num); 1341 + return err; 1342 + } 1343 + 1344 + /* Clear enabled queues flag */ 1345 + clear_bit(q_id, vf->txq_ena); 1346 + 1347 + return 0; 1348 + } 1349 + 1350 + /** 1311 1351 * ice_vc_dis_qs_msg 1312 1352 * @vf: pointer to the VF info 1313 1353 * @msg: pointer to the msg buffer 1314 1354 * 1315 - * called from the VF to disable all or specific 1316 - * queue(s) 1355 + * called from the VF to disable all or specific queue(s) 1317 1356 */ 1318 1357 static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) 1319 1358 { ··· 1389 1350 q_map = vqs->tx_queues; 1390 1351 1391 1352 for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) { 1392 - struct ice_tx_ring *ring = vsi->tx_rings[vf_q_id]; 1393 - struct ice_txq_meta txq_meta = { 0 }; 1394 - 1395 1353 if (!ice_vc_isvalid_q_id(vf, vqs->vsi_id, vf_q_id)) { 1396 1354 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1397 1355 goto error_param; 1398 1356 } 1399 1357 1400 - if (!test_bit(vf_q_id, vf->txq_ena)) 1401 - dev_dbg(ice_pf_to_dev(vsi->back), "Queue %u on VSI %u is not enabled, but stopping it anyway\n", 1402 - vf_q_id, vsi->vsi_num); 1403 - 1404 - ice_fill_txq_meta(vsi, ring, &txq_meta); 1405 - 1406 - if (ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, vf->vf_id, 1407 - ring, &txq_meta)) { 1408 - dev_err(ice_pf_to_dev(vsi->back), "Failed to stop Tx ring %d on VSI %d\n", 1409 - vf_q_id, vsi->vsi_num); 1358 + if (ice_vf_vsi_dis_single_txq(vf, vsi, vf_q_id)) { 1410 1359 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1411 1360 goto error_param; 1412 1361 } 1413 - 1414 - /* Clear enabled queues flag */ 1415 - clear_bit(vf_q_id, vf->txq_ena); 1416 1362 } 1417 1363 } 1418 1364 ··· 1646 1622 if (qpi->txq.ring_len > 0) { 1647 1623 vsi->tx_rings[i]->dma = qpi->txq.dma_ring_addr; 1648 1624 vsi->tx_rings[i]->count = qpi->txq.ring_len; 1625 + 1626 + /* Disable any existing queue first */ 1627 + if (ice_vf_vsi_dis_single_txq(vf, vsi, q_idx)) { 1628 + v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1629 + goto error_param; 1630 + } 1631 + 1632 + /* Configure a queue with the requested settings */ 1649 1633 if (ice_vsi_cfg_single_txq(vsi, vsi->tx_rings, q_idx)) { 1650 1634 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1651 1635 goto error_param;
+1 -1
drivers/net/ethernet/mediatek/mtk_ppe.c
··· 395 395 static const u8 skip[] = { 12, 25, 38, 51, 76, 89, 102 }; 396 396 int i, k; 397 397 398 - memset(ppe->foe_table, 0, MTK_PPE_ENTRIES * sizeof(ppe->foe_table)); 398 + memset(ppe->foe_table, 0, MTK_PPE_ENTRIES * sizeof(*ppe->foe_table)); 399 399 400 400 if (!IS_ENABLED(CONFIG_SOC_MT7621)) 401 401 return;
+3 -8
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
··· 568 568 mlxsw_sp2_ipip_rem_addr_set_gre6(struct mlxsw_sp *mlxsw_sp, 569 569 struct mlxsw_sp_ipip_entry *ipip_entry) 570 570 { 571 - struct __ip6_tnl_parm parms6; 572 - 573 - parms6 = mlxsw_sp_ipip_netdev_parms6(ipip_entry->ol_dev); 574 - return mlxsw_sp_ipv6_addr_kvdl_index_get(mlxsw_sp, &parms6.raddr, 571 + return mlxsw_sp_ipv6_addr_kvdl_index_get(mlxsw_sp, 572 + &ipip_entry->parms.daddr.addr6, 575 573 &ipip_entry->dip_kvdl_index); 576 574 } 577 575 ··· 577 579 mlxsw_sp2_ipip_rem_addr_unset_gre6(struct mlxsw_sp *mlxsw_sp, 578 580 const struct mlxsw_sp_ipip_entry *ipip_entry) 579 581 { 580 - struct __ip6_tnl_parm parms6; 581 - 582 - parms6 = mlxsw_sp_ipip_netdev_parms6(ipip_entry->ol_dev); 583 - mlxsw_sp_ipv6_addr_put(mlxsw_sp, &parms6.raddr); 582 + mlxsw_sp_ipv6_addr_put(mlxsw_sp, &ipip_entry->parms.daddr.addr6); 584 583 } 585 584 586 585 static const struct mlxsw_sp_ipip_ops mlxsw_sp2_ipip_gre6_ops = {
+3 -8
drivers/net/ethernet/mscc/ocelot.c
··· 1622 1622 trap->action.mask_mode = OCELOT_MASK_MODE_PERMIT_DENY; 1623 1623 trap->action.port_mask = 0; 1624 1624 trap->take_ts = take_ts; 1625 - list_add_tail(&trap->trap_list, &ocelot->traps); 1625 + trap->is_trap = true; 1626 1626 new = true; 1627 1627 } 1628 1628 ··· 1634 1634 err = ocelot_vcap_filter_replace(ocelot, trap); 1635 1635 if (err) { 1636 1636 trap->ingress_port_mask &= ~BIT(port); 1637 - if (!trap->ingress_port_mask) { 1638 - list_del(&trap->trap_list); 1637 + if (!trap->ingress_port_mask) 1639 1638 kfree(trap); 1640 - } 1641 1639 return err; 1642 1640 } 1643 1641 ··· 1655 1657 return 0; 1656 1658 1657 1659 trap->ingress_port_mask &= ~BIT(port); 1658 - if (!trap->ingress_port_mask) { 1659 - list_del(&trap->trap_list); 1660 - 1660 + if (!trap->ingress_port_mask) 1661 1661 return ocelot_vcap_filter_del(ocelot, trap); 1662 - } 1663 1662 1664 1663 return ocelot_vcap_filter_replace(ocelot, trap); 1665 1664 }
+4 -5
drivers/net/ethernet/mscc/ocelot_flower.c
··· 280 280 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; 281 281 break; 282 282 case FLOW_ACTION_TRAP: 283 - if (filter->block_id != VCAP_IS2) { 283 + if (filter->block_id != VCAP_IS2 || 284 + filter->lookup != 0) { 284 285 NL_SET_ERR_MSG_MOD(extack, 285 - "Trap action can only be offloaded to VCAP IS2"); 286 + "Trap action can only be offloaded to VCAP IS2 lookup 0"); 286 287 return -EOPNOTSUPP; 287 288 } 288 289 if (filter->goto_target != -1) { ··· 296 295 filter->action.cpu_copy_ena = true; 297 296 filter->action.cpu_qu_num = 0; 298 297 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; 299 - list_add_tail(&filter->trap_list, &ocelot->traps); 298 + filter->is_trap = true; 300 299 break; 301 300 case FLOW_ACTION_POLICE: 302 301 if (filter->block_id == PSFP_BLOCK_ID) { ··· 879 878 880 879 ret = ocelot_flower_parse(ocelot, port, ingress, f, filter); 881 880 if (ret) { 882 - if (!list_empty(&filter->trap_list)) 883 - list_del(&filter->trap_list); 884 881 kfree(filter); 885 882 return ret; 886 883 }
+8 -1
drivers/net/ethernet/mscc/ocelot_vcap.c
··· 374 374 OCELOT_VCAP_BIT_0); 375 375 vcap_key_set(vcap, &data, VCAP_IS2_HK_IGR_PORT_MASK, 0, 376 376 ~filter->ingress_port_mask); 377 - vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_FIRST, OCELOT_VCAP_BIT_ANY); 378 377 vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_HOST_MATCH, 379 378 OCELOT_VCAP_BIT_ANY); 380 379 vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_L2_MC, filter->dmac_mc); ··· 1216 1217 struct ocelot_vcap_filter *tmp; 1217 1218 1218 1219 tmp = ocelot_vcap_block_find_filter_by_index(block, i); 1220 + /* Read back the filter's counters before moving it */ 1221 + vcap_entry_get(ocelot, i - 1, tmp); 1219 1222 vcap_entry_set(ocelot, i, tmp); 1220 1223 } 1221 1224 ··· 1251 1250 struct ocelot_vcap_filter del_filter; 1252 1251 int i, index; 1253 1252 1253 + /* Need to inherit the block_id so that vcap_entry_set() 1254 + * does not get confused and knows where to install it. 1255 + */ 1254 1256 memset(&del_filter, 0, sizeof(del_filter)); 1257 + del_filter.block_id = filter->block_id; 1255 1258 1256 1259 /* Gets index of the filter */ 1257 1260 index = ocelot_vcap_block_get_filter_index(block, filter); ··· 1270 1265 struct ocelot_vcap_filter *tmp; 1271 1266 1272 1267 tmp = ocelot_vcap_block_find_filter_by_index(block, i); 1268 + /* Read back the filter's counters before moving it */ 1269 + vcap_entry_get(ocelot, i + 1, tmp); 1273 1270 vcap_entry_set(ocelot, i, tmp); 1274 1271 } 1275 1272
+2 -1
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
··· 256 256 257 257 err = ionic_map_bars(ionic); 258 258 if (err) 259 - goto err_out_pci_disable_device; 259 + goto err_out_pci_release_regions; 260 260 261 261 /* Configure the device */ 262 262 err = ionic_setup(ionic); ··· 360 360 361 361 err_out_unmap_bars: 362 362 ionic_unmap_bars(ionic); 363 + err_out_pci_release_regions: 363 364 pci_release_regions(pdev); 364 365 err_out_pci_disable_device: 365 366 pci_disable_device(pdev);
+5
drivers/net/ethernet/sfc/ef10.c
··· 3579 3579 n_parts++; 3580 3580 } 3581 3581 3582 + if (!n_parts) { 3583 + kfree(parts); 3584 + return 0; 3585 + } 3586 + 3582 3587 rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); 3583 3588 fail: 3584 3589 if (rc)
+6 -1
drivers/net/ethernet/sfc/efx_channels.c
··· 867 867 868 868 int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) 869 869 { 870 - struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel; 870 + struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel, 871 + *ptp_channel = efx_ptp_channel(efx); 872 + struct efx_ptp_data *ptp_data = efx->ptp_data; 871 873 unsigned int i, next_buffer_table = 0; 872 874 u32 old_rxq_entries, old_txq_entries; 873 875 int rc, rc2; ··· 940 938 941 939 efx_set_xdp_channels(efx); 942 940 out: 941 + efx->ptp_data = NULL; 943 942 /* Destroy unused channel structures */ 944 943 for (i = 0; i < efx->n_channels; i++) { 945 944 channel = other_channel[i]; ··· 951 948 } 952 949 } 953 950 951 + efx->ptp_data = ptp_data; 954 952 rc2 = efx_soft_enable_interrupts(efx); 955 953 if (rc2) { 956 954 rc = rc ? rc : rc2; ··· 970 966 efx->txq_entries = old_txq_entries; 971 967 for (i = 0; i < efx->n_channels; i++) 972 968 swap(efx->channel[i], other_channel[i]); 969 + efx_ptp_update_channel(efx, ptp_channel); 973 970 goto out; 974 971 } 975 972
+13 -1
drivers/net/ethernet/sfc/ptp.c
··· 45 45 #include "farch_regs.h" 46 46 #include "tx.h" 47 47 #include "nic.h" /* indirectly includes ptp.h */ 48 + #include "efx_channels.h" 48 49 49 50 /* Maximum number of events expected to make up a PTP event */ 50 51 #define MAX_EVENT_FRAGS 3 ··· 540 539 struct efx_channel *efx_ptp_channel(struct efx_nic *efx) 541 540 { 542 541 return efx->ptp_data ? efx->ptp_data->channel : NULL; 542 + } 543 + 544 + void efx_ptp_update_channel(struct efx_nic *efx, struct efx_channel *channel) 545 + { 546 + if (efx->ptp_data) 547 + efx->ptp_data->channel = channel; 543 548 } 544 549 545 550 static u32 last_sync_timestamp_major(struct efx_nic *efx) ··· 1450 1443 int rc = 0; 1451 1444 unsigned int pos; 1452 1445 1446 + if (efx->ptp_data) { 1447 + efx->ptp_data->channel = channel; 1448 + return 0; 1449 + } 1450 + 1453 1451 ptp = kzalloc(sizeof(struct efx_ptp_data), GFP_KERNEL); 1454 1452 efx->ptp_data = ptp; 1455 1453 if (!efx->ptp_data) ··· 2188 2176 .pre_probe = efx_ptp_probe_channel, 2189 2177 .post_remove = efx_ptp_remove_channel, 2190 2178 .get_name = efx_ptp_get_channel_name, 2191 - /* no copy operation; there is no need to reallocate this channel */ 2179 + .copy = efx_copy_channel, 2192 2180 .receive_skb = efx_ptp_rx, 2193 2181 .want_txqs = efx_ptp_want_txqs, 2194 2182 .keep_eventq = false,
+1
drivers/net/ethernet/sfc/ptp.h
··· 16 16 int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel); 17 17 void efx_ptp_defer_probe_with_channel(struct efx_nic *efx); 18 18 struct efx_channel *efx_ptp_channel(struct efx_nic *efx); 19 + void efx_ptp_update_channel(struct efx_nic *efx, struct efx_channel *channel); 19 20 void efx_ptp_remove(struct efx_nic *efx); 20 21 int efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr); 21 22 int efx_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr);
+1 -3
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
··· 181 181 return -ENOMEM; 182 182 183 183 /* Enable pci device */ 184 - ret = pci_enable_device(pdev); 184 + ret = pcim_enable_device(pdev); 185 185 if (ret) { 186 186 dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n", 187 187 __func__); ··· 241 241 pcim_iounmap_regions(pdev, BIT(i)); 242 242 break; 243 243 } 244 - 245 - pci_disable_device(pdev); 246 244 } 247 245 248 246 static int __maybe_unused stmmac_pci_suspend(struct device *dev)
+5 -5
drivers/net/phy/micrel.c
··· 1743 1743 1744 1744 static int lanphy_read_page_reg(struct phy_device *phydev, int page, u32 addr) 1745 1745 { 1746 - u32 data; 1746 + int data; 1747 1747 1748 1748 phy_lock_mdio_bus(phydev); 1749 1749 __phy_write(phydev, LAN_EXT_PAGE_ACCESS_CONTROL, page); ··· 2444 2444 2445 2445 static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev) 2446 2446 { 2447 - u16 tsu_irq_status; 2448 - int irq_status; 2447 + int irq_status, tsu_irq_status; 2449 2448 2450 2449 irq_status = phy_read(phydev, LAN8814_INTS); 2451 2450 if (irq_status > 0 && (irq_status & LAN8814_INT_LINK)) ··· 2656 2657 .name = "Micrel KS8737", 2657 2658 /* PHY_BASIC_FEATURES */ 2658 2659 .driver_data = &ks8737_type, 2660 + .probe = kszphy_probe, 2659 2661 .config_init = kszphy_config_init, 2660 2662 .config_intr = kszphy_config_intr, 2661 2663 .handle_interrupt = kszphy_handle_interrupt, ··· 2782 2782 .config_init = ksz8061_config_init, 2783 2783 .config_intr = kszphy_config_intr, 2784 2784 .handle_interrupt = kszphy_handle_interrupt, 2785 - .suspend = kszphy_suspend, 2786 - .resume = kszphy_resume, 2785 + .suspend = genphy_suspend, 2786 + .resume = genphy_resume, 2787 2787 }, { 2788 2788 .phy_id = PHY_ID_KSZ9021, 2789 2789 .phy_id_mask = 0x000ffffe,
+6 -1
drivers/net/phy/phy.c
··· 970 970 { 971 971 struct phy_device *phydev = phy_dat; 972 972 struct phy_driver *drv = phydev->drv; 973 + irqreturn_t ret; 973 974 974 - return drv->handle_interrupt(phydev); 975 + mutex_lock(&phydev->lock); 976 + ret = drv->handle_interrupt(phydev); 977 + mutex_unlock(&phydev->lock); 978 + 979 + return ret; 975 980 } 976 981 977 982 /**
+1
drivers/net/wireless/ath/ath11k/core.c
··· 1288 1288 1289 1289 ieee80211_stop_queues(ar->hw); 1290 1290 ath11k_mac_drain_tx(ar); 1291 + complete(&ar->completed_11d_scan); 1291 1292 complete(&ar->scan.started); 1292 1293 complete(&ar->scan.completed); 1293 1294 complete(&ar->peer_assoc_done);
+10 -3
drivers/net/wireless/ath/ath11k/core.h
··· 38 38 39 39 extern unsigned int ath11k_frame_mode; 40 40 41 + #define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ) 42 + 41 43 #define ATH11K_MON_TIMER_INTERVAL 10 42 44 43 45 enum ath11k_supported_bw { ··· 189 187 ATH11K_SCAN_STARTING, 190 188 ATH11K_SCAN_RUNNING, 191 189 ATH11K_SCAN_ABORTING, 190 + }; 191 + 192 + enum ath11k_11d_state { 193 + ATH11K_11D_IDLE, 194 + ATH11K_11D_PREPARING, 195 + ATH11K_11D_RUNNING, 192 196 }; 193 197 194 198 enum ath11k_dev_flags { ··· 615 607 bool dfs_block_radar_events; 616 608 struct ath11k_thermal thermal; 617 609 u32 vdev_id_11d_scan; 618 - struct completion finish_11d_scan; 619 - struct completion finish_11d_ch_list; 620 - bool pending_11d; 610 + struct completion completed_11d_scan; 611 + enum ath11k_11d_state state_11d; 621 612 bool regdom_set_by_user; 622 613 int hw_rate_code; 623 614 u8 twt_enabled;
+29 -42
drivers/net/wireless/ath/ath11k/mac.c
··· 3601 3601 if (ret) 3602 3602 goto exit; 3603 3603 3604 - /* Currently the pending_11d=true only happened 1 time while 3605 - * wlan interface up in ath11k_mac_11d_scan_start(), it is called by 3606 - * ath11k_mac_op_add_interface(), after wlan interface up, 3607 - * pending_11d=false always. 3608 - * If remove below wait, it always happened scan fail and lead connect 3609 - * fail while wlan interface up, because it has a 11d scan which is running 3610 - * in firmware, and lead this scan failed. 3611 - */ 3612 - if (ar->pending_11d) { 3613 - long time_left; 3614 - unsigned long timeout = 5 * HZ; 3615 - 3616 - if (ar->supports_6ghz) 3617 - timeout += 5 * HZ; 3618 - 3619 - time_left = wait_for_completion_timeout(&ar->finish_11d_ch_list, timeout); 3620 - ath11k_dbg(ar->ab, ATH11K_DBG_MAC, 3621 - "mac wait 11d channel list time left %ld\n", time_left); 3622 - } 3623 - 3624 3604 memset(&arg, 0, sizeof(arg)); 3625 3605 ath11k_wmi_start_scan_init(ar, &arg); 3626 3606 arg.vdev_id = arvif->vdev_id; ··· 3666 3686 kfree(arg.extraie.ptr); 3667 3687 3668 3688 mutex_unlock(&ar->conf_mutex); 3689 + 3690 + if (ar->state_11d == ATH11K_11D_PREPARING) 3691 + ath11k_mac_11d_scan_start(ar, arvif->vdev_id); 3692 + 3669 3693 return ret; 3670 3694 } 3671 3695 ··· 5798 5814 5799 5815 /* TODO: Do we need to enable ANI? */ 5800 5816 5801 - ath11k_reg_update_chan_list(ar); 5817 + ath11k_reg_update_chan_list(ar, false); 5802 5818 5803 5819 ar->num_started_vdevs = 0; 5804 5820 ar->num_created_vdevs = 0; ··· 5864 5880 cancel_work_sync(&ar->regd_update_work); 5865 5881 cancel_work_sync(&ar->ab->update_11d_work); 5866 5882 cancel_work_sync(&ar->ab->rfkill_work); 5883 + 5884 + if (ar->state_11d == ATH11K_11D_PREPARING) { 5885 + ar->state_11d = ATH11K_11D_IDLE; 5886 + complete(&ar->completed_11d_scan); 5887 + } 5867 5888 5868 5889 spin_lock_bh(&ar->data_lock); 5869 5890 list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { ··· 6040 6051 return false; 6041 6052 } 6042 6053 6043 - void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait) 6054 + void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id) 6044 6055 { 6045 6056 struct wmi_11d_scan_start_params param; 6046 6057 int ret; ··· 6068 6079 6069 6080 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac start 11d scan\n"); 6070 6081 6071 - if (wait) 6072 - reinit_completion(&ar->finish_11d_scan); 6073 - 6074 6082 ret = ath11k_wmi_send_11d_scan_start_cmd(ar, &param); 6075 6083 if (ret) { 6076 6084 ath11k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n", 6077 6085 vdev_id, ret); 6078 6086 } else { 6079 6087 ar->vdev_id_11d_scan = vdev_id; 6080 - if (wait) { 6081 - ar->pending_11d = true; 6082 - ret = wait_for_completion_timeout(&ar->finish_11d_scan, 6083 - 5 * HZ); 6084 - ath11k_dbg(ar->ab, ATH11K_DBG_MAC, 6085 - "mac 11d scan left time %d\n", ret); 6086 - 6087 - if (!ret) 6088 - ar->pending_11d = false; 6089 - } 6088 + if (ar->state_11d == ATH11K_11D_PREPARING) 6089 + ar->state_11d = ATH11K_11D_RUNNING; 6090 6090 } 6091 6091 6092 6092 fin: 6093 + if (ar->state_11d == ATH11K_11D_PREPARING) { 6094 + ar->state_11d = ATH11K_11D_IDLE; 6095 + complete(&ar->completed_11d_scan); 6096 + } 6097 + 6093 6098 mutex_unlock(&ar->ab->vdev_id_11d_lock); 6094 6099 } 6095 6100 ··· 6106 6123 vdev_id = ar->vdev_id_11d_scan; 6107 6124 6108 6125 ret = ath11k_wmi_send_11d_scan_stop_cmd(ar, vdev_id); 6109 - if (ret) 6126 + if (ret) { 6110 6127 ath11k_warn(ar->ab, 6111 6128 "failed to stopt 11d scan vdev %d ret: %d\n", 6112 6129 vdev_id, ret); 6113 - else 6130 + } else { 6114 6131 ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; 6132 + ar->state_11d = ATH11K_11D_IDLE; 6133 + complete(&ar->completed_11d_scan); 6134 + } 6115 6135 } 6116 6136 mutex_unlock(&ar->ab->vdev_id_11d_lock); 6117 6137 } ··· 6310 6324 goto err_peer_del; 6311 6325 } 6312 6326 6313 - ath11k_mac_11d_scan_start(ar, arvif->vdev_id, true); 6314 - 6327 + if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map)) { 6328 + reinit_completion(&ar->completed_11d_scan); 6329 + ar->state_11d = ATH11K_11D_PREPARING; 6330 + } 6315 6331 break; 6316 6332 case WMI_VDEV_TYPE_MONITOR: 6317 6333 set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); ··· 7178 7190 } 7179 7191 7180 7192 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) 7181 - ath11k_mac_11d_scan_start(ar, arvif->vdev_id, false); 7193 + ath11k_mac_11d_scan_start(ar, arvif->vdev_id); 7182 7194 7183 7195 mutex_unlock(&ar->conf_mutex); 7184 7196 } ··· 8659 8671 ar->monitor_vdev_id = -1; 8660 8672 clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); 8661 8673 ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; 8662 - init_completion(&ar->finish_11d_scan); 8663 - init_completion(&ar->finish_11d_ch_list); 8674 + init_completion(&ar->completed_11d_scan); 8664 8675 } 8665 8676 8666 8677 return 0;
+1 -1
drivers/net/wireless/ath/ath11k/mac.h
··· 130 130 #define ATH11K_SCAN_11D_INTERVAL 600000 131 131 #define ATH11K_11D_INVALID_VDEV_ID 0xFFFF 132 132 133 - void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait); 133 + void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id); 134 134 void ath11k_mac_11d_scan_stop(struct ath11k *ar); 135 135 void ath11k_mac_11d_scan_stop_all(struct ath11k_base *ab); 136 136
+28 -15
drivers/net/wireless/ath/ath11k/reg.c
··· 102 102 ar->regdom_set_by_user = true; 103 103 } 104 104 105 - int ath11k_reg_update_chan_list(struct ath11k *ar) 105 + int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait) 106 106 { 107 107 struct ieee80211_supported_band **bands; 108 108 struct scan_chan_list_params *params; ··· 111 111 struct channel_param *ch; 112 112 enum nl80211_band band; 113 113 int num_channels = 0; 114 - int i, ret; 114 + int i, ret, left; 115 + 116 + if (wait && ar->state_11d != ATH11K_11D_IDLE) { 117 + left = wait_for_completion_timeout(&ar->completed_11d_scan, 118 + ATH11K_SCAN_TIMEOUT_HZ); 119 + if (!left) { 120 + ath11k_dbg(ar->ab, ATH11K_DBG_REG, 121 + "failed to receive 11d scan complete: timed out\n"); 122 + ar->state_11d = ATH11K_11D_IDLE; 123 + } 124 + ath11k_dbg(ar->ab, ATH11K_DBG_REG, 125 + "reg 11d scan wait left time %d\n", left); 126 + } 127 + 128 + if (wait && 129 + (ar->scan.state == ATH11K_SCAN_STARTING || 130 + ar->scan.state == ATH11K_SCAN_RUNNING)) { 131 + left = wait_for_completion_timeout(&ar->scan.completed, 132 + ATH11K_SCAN_TIMEOUT_HZ); 133 + if (!left) 134 + ath11k_dbg(ar->ab, ATH11K_DBG_REG, 135 + "failed to receive hw scan complete: timed out\n"); 136 + 137 + ath11k_dbg(ar->ab, ATH11K_DBG_REG, 138 + "reg hw scan wait left time %d\n", left); 139 + } 115 140 116 141 bands = hw->wiphy->bands; 117 142 for (band = 0; band < NUM_NL80211_BANDS; band++) { ··· 218 193 ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params); 219 194 kfree(params); 220 195 221 - if (ar->pending_11d) { 222 - complete(&ar->finish_11d_ch_list); 223 - ar->pending_11d = false; 224 - } 225 - 226 196 return ret; 227 197 } 228 198 ··· 283 263 goto err; 284 264 } 285 265 286 - if (ar->pending_11d) 287 - complete(&ar->finish_11d_scan); 288 - 289 266 rtnl_lock(); 290 267 wiphy_lock(ar->hw->wiphy); 291 - 292 - if (ar->pending_11d) 293 - reinit_completion(&ar->finish_11d_ch_list); 294 - 295 268 ret = regulatory_set_wiphy_regd_sync(ar->hw->wiphy, regd_copy); 296 269 wiphy_unlock(ar->hw->wiphy); 297 270 rtnl_unlock(); ··· 295 282 goto err; 296 283 297 284 if (ar->state == ATH11K_STATE_ON) { 298 - ret = ath11k_reg_update_chan_list(ar); 285 + ret = ath11k_reg_update_chan_list(ar, true); 299 286 if (ret) 300 287 goto err; 301 288 }
+1 -1
drivers/net/wireless/ath/ath11k/reg.h
··· 32 32 ath11k_reg_build_regd(struct ath11k_base *ab, 33 33 struct cur_regulatory_info *reg_info, bool intersect); 34 34 int ath11k_regd_update(struct ath11k *ar); 35 - int ath11k_reg_update_chan_list(struct ath11k *ar); 35 + int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait); 36 36 #endif
+14 -2
drivers/net/wireless/ath/ath11k/wmi.c
··· 2015 2015 { 2016 2016 /* setup commonly used values */ 2017 2017 arg->scan_req_id = 1; 2018 - arg->scan_priority = WMI_SCAN_PRIORITY_LOW; 2018 + if (ar->state_11d == ATH11K_11D_PREPARING) 2019 + arg->scan_priority = WMI_SCAN_PRIORITY_MEDIUM; 2020 + else 2021 + arg->scan_priority = WMI_SCAN_PRIORITY_LOW; 2019 2022 arg->dwell_time_active = 50; 2020 2023 arg->dwell_time_active_2g = 0; 2021 2024 arg->dwell_time_passive = 150; ··· 6353 6350 static int ath11k_reg_11d_new_cc_event(struct ath11k_base *ab, struct sk_buff *skb) 6354 6351 { 6355 6352 const struct wmi_11d_new_cc_ev *ev; 6353 + struct ath11k *ar; 6354 + struct ath11k_pdev *pdev; 6356 6355 const void **tb; 6357 - int ret; 6356 + int ret, i; 6358 6357 6359 6358 tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); 6360 6359 if (IS_ERR(tb)) { ··· 6381 6376 ab->new_alpha2[1]); 6382 6377 6383 6378 kfree(tb); 6379 + 6380 + for (i = 0; i < ab->num_radios; i++) { 6381 + pdev = &ab->pdevs[i]; 6382 + ar = pdev->ar; 6383 + ar->state_11d = ATH11K_11D_IDLE; 6384 + complete(&ar->completed_11d_scan); 6385 + } 6384 6386 6385 6387 queue_work(ab->workqueue, &ab->update_11d_work); 6386 6388
+1 -1
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
··· 371 371 struct iwl_dbg_tlv_timer_node *node, *tmp; 372 372 373 373 list_for_each_entry_safe(node, tmp, timer_list, list) { 374 - del_timer(&node->timer); 374 + del_timer_sync(&node->timer); 375 375 list_del(&node->list); 376 376 kfree(node); 377 377 }
+8 -2
drivers/net/wireless/mac80211_hwsim.c
··· 2202 2202 if (!data->use_chanctx) { 2203 2203 confbw = data->bw; 2204 2204 } else { 2205 - struct ieee80211_chanctx_conf *chanctx_conf = 2206 - rcu_dereference(vif->chanctx_conf); 2205 + struct ieee80211_chanctx_conf *chanctx_conf; 2206 + 2207 + rcu_read_lock(); 2208 + chanctx_conf = rcu_dereference(vif->chanctx_conf); 2207 2209 2208 2210 if (!WARN_ON(!chanctx_conf)) 2209 2211 confbw = chanctx_conf->def.width; 2212 + rcu_read_unlock(); 2210 2213 } 2211 2214 2212 2215 WARN(bw > hwsim_get_chanwidth(confbw), ··· 2478 2475 if (req->ie_len) 2479 2476 skb_put_data(probe, req->ie, req->ie_len); 2480 2477 2478 + rcu_read_lock(); 2481 2479 if (!ieee80211_tx_prepare_skb(hwsim->hw, 2482 2480 hwsim->hw_scan_vif, 2483 2481 probe, 2484 2482 hwsim->tmp_chan->band, 2485 2483 NULL)) { 2484 + rcu_read_unlock(); 2486 2485 kfree_skb(probe); 2487 2486 continue; 2488 2487 } ··· 2492 2487 local_bh_disable(); 2493 2488 mac80211_hwsim_tx_frame(hwsim->hw, probe, 2494 2489 hwsim->tmp_chan); 2490 + rcu_read_unlock(); 2495 2491 local_bh_enable(); 2496 2492 } 2497 2493 }
+1 -1
drivers/ptp/ptp_ocp.c
··· 1557 1557 start_ns = ktime_set(ts.tv_sec, ts.tv_nsec) + NSEC_PER_MSEC; 1558 1558 if (!s->start) { 1559 1559 /* roundup() does not work on 32-bit systems */ 1560 - s->start = DIV_ROUND_UP_ULL(start_ns, s->period); 1560 + s->start = DIV64_U64_ROUND_UP(start_ns, s->period); 1561 1561 s->start = ktime_add(s->start, s->phase); 1562 1562 } 1563 1563
+1 -5
drivers/s390/net/ctcm_mpc.c
··· 626 626 ctcm_clear_busy_do(dev); 627 627 } 628 628 629 - kfree(mpcginfo); 630 - 631 629 return; 632 630 633 631 } ··· 1190 1192 CTCM_FUNTAIL, dev->name); 1191 1193 priv->stats.rx_dropped++; 1192 1194 /* mpcginfo only used for non-data transfers */ 1193 - kfree(mpcginfo); 1194 1195 if (do_debug_data) 1195 1196 ctcmpc_dump_skb(pskb, -8); 1196 1197 } 1198 + kfree(mpcginfo); 1197 1199 } 1198 1200 done: 1199 1201 ··· 1975 1977 } 1976 1978 break; 1977 1979 } 1978 - kfree(mpcginfo); 1979 1980 1980 1981 CTCM_PR_DEBUG("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", 1981 1982 __func__, ch->id, grp->outstanding_xid2, ··· 2035 2038 mpc_validate_xid(mpcginfo); 2036 2039 break; 2037 2040 } 2038 - kfree(mpcginfo); 2039 2041 return; 2040 2042 } 2041 2043
+3 -2
drivers/s390/net/ctcm_sysfs.c
··· 39 39 struct ctcm_priv *priv = dev_get_drvdata(dev); 40 40 int rc; 41 41 42 - ndev = priv->channel[CTCM_READ]->netdev; 43 - if (!(priv && priv->channel[CTCM_READ] && ndev)) { 42 + if (!(priv && priv->channel[CTCM_READ] && 43 + priv->channel[CTCM_READ]->netdev)) { 44 44 CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, "bfnondev"); 45 45 return -ENODEV; 46 46 } 47 + ndev = priv->channel[CTCM_READ]->netdev; 47 48 48 49 rc = kstrtouint(buf, 0, &bs1); 49 50 if (rc)
+4 -3
drivers/s390/net/lcs.c
··· 1736 1736 lcs_schedule_recovery(card); 1737 1737 break; 1738 1738 case LCS_CMD_STOPLAN: 1739 - pr_warn("Stoplan for %s initiated by LGW\n", 1740 - card->dev->name); 1741 - if (card->dev) 1739 + if (card->dev) { 1740 + pr_warn("Stoplan for %s initiated by LGW\n", 1741 + card->dev->name); 1742 1742 netif_carrier_off(card->dev); 1743 + } 1743 1744 break; 1744 1745 default: 1745 1746 LCS_DBF_TEXT(5, trace, "noLGWcmd");
+2 -2
include/linux/netdev_features.h
··· 169 169 #define NETIF_F_HW_HSR_FWD __NETIF_F(HW_HSR_FWD) 170 170 #define NETIF_F_HW_HSR_DUP __NETIF_F(HW_HSR_DUP) 171 171 172 - /* Finds the next feature with the highest number of the range of start till 0. 172 + /* Finds the next feature with the highest number of the range of start-1 till 0. 173 173 */ 174 174 static inline int find_next_netdev_feature(u64 feature, unsigned long start) 175 175 { ··· 188 188 for ((bit) = find_next_netdev_feature((mask_addr), \ 189 189 NETDEV_FEATURE_COUNT); \ 190 190 (bit) >= 0; \ 191 - (bit) = find_next_netdev_feature((mask_addr), (bit) - 1)) 191 + (bit) = find_next_netdev_feature((mask_addr), (bit))) 192 192 193 193 /* Features valid for ethtool to change */ 194 194 /* = all defined minus driver/device-class-related */
+3
include/net/bluetooth/hci_core.h
··· 36 36 /* HCI priority */ 37 37 #define HCI_PRIO_MAX 7 38 38 39 + /* HCI maximum id value */ 40 + #define HCI_MAX_ID 10000 41 + 39 42 /* HCI Core structures */ 40 43 struct inquiry_data { 41 44 bdaddr_t bdaddr;
+1
include/net/tc_act/tc_pedit.h
··· 14 14 struct tc_action common; 15 15 unsigned char tcfp_nkeys; 16 16 unsigned char tcfp_flags; 17 + u32 tcfp_off_max_hint; 17 18 struct tc_pedit_key *tcfp_keys; 18 19 struct tcf_pedit_key_ex *tcfp_keys_ex; 19 20 };
+1 -1
include/soc/mscc/ocelot_vcap.h
··· 681 681 682 682 struct ocelot_vcap_filter { 683 683 struct list_head list; 684 - struct list_head trap_list; 685 684 686 685 enum ocelot_vcap_filter_type type; 687 686 int block_id; ··· 694 695 struct ocelot_vcap_stats stats; 695 696 /* For VCAP IS1 and IS2 */ 696 697 bool take_ts; 698 + bool is_trap; 697 699 unsigned long ingress_port_mask; 698 700 /* For VCAP ES0 */ 699 701 struct ocelot_vcap_port ingress_port;
+1 -1
include/uapi/linux/rfkill.h
··· 184 184 #define RFKILL_IOC_NOINPUT 1 185 185 #define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) 186 186 #define RFKILL_IOC_MAX_SIZE 2 187 - #define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_EXT_SIZE, __u32) 187 + #define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_MAX_SIZE, __u32) 188 188 189 189 /* and that's all userspace gets */ 190 190
+22 -22
lib/dim/net_dim.c
··· 12 12 * Each profile size must be of NET_DIM_PARAMS_NUM_PROFILES 13 13 */ 14 14 #define NET_DIM_PARAMS_NUM_PROFILES 5 15 - #define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 16 - #define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128 15 + #define NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE 256 16 + #define NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE 128 17 17 #define NET_DIM_DEF_PROFILE_CQE 1 18 18 #define NET_DIM_DEF_PROFILE_EQE 1 19 19 20 20 #define NET_DIM_RX_EQE_PROFILES { \ 21 - {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 22 - {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 23 - {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 24 - {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 25 - {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 21 + {.usec = 1, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \ 22 + {.usec = 8, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \ 23 + {.usec = 64, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \ 24 + {.usec = 128, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \ 25 + {.usec = 256, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,} \ 26 26 } 27 27 28 28 #define NET_DIM_RX_CQE_PROFILES { \ 29 - {2, 256}, \ 30 - {8, 128}, \ 31 - {16, 64}, \ 32 - {32, 64}, \ 33 - {64, 64} \ 29 + {.usec = 2, .pkts = 256,}, \ 30 + {.usec = 8, .pkts = 128,}, \ 31 + {.usec = 16, .pkts = 64,}, \ 32 + {.usec = 32, .pkts = 64,}, \ 33 + {.usec = 64, .pkts = 64,} \ 34 34 } 35 35 36 36 #define NET_DIM_TX_EQE_PROFILES { \ 37 - {1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 38 - {8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 39 - {32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 40 - {64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 41 - {128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \ 37 + {.usec = 1, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,}, \ 38 + {.usec = 8, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,}, \ 39 + {.usec = 32, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,}, \ 40 + {.usec = 64, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,}, \ 41 + {.usec = 128, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,} \ 42 42 } 43 43 44 44 #define NET_DIM_TX_CQE_PROFILES { \ 45 - {5, 128}, \ 46 - {8, 64}, \ 47 - {16, 32}, \ 48 - {32, 32}, \ 49 - {64, 32} \ 45 + {.usec = 5, .pkts = 128,}, \ 46 + {.usec = 8, .pkts = 64,}, \ 47 + {.usec = 16, .pkts = 32,}, \ 48 + {.usec = 32, .pkts = 32,}, \ 49 + {.usec = 64, .pkts = 32,} \ 50 50 } 51 51 52 52 static const struct dim_cq_moder
+11
net/batman-adv/fragmentation.c
··· 475 475 goto free_skb; 476 476 } 477 477 478 + /* GRO might have added fragments to the fragment list instead of 479 + * frags[]. But this is not handled by skb_split and must be 480 + * linearized to avoid incorrect length information after all 481 + * batman-adv fragments were created and submitted to the 482 + * hard-interface 483 + */ 484 + if (skb_has_frag_list(skb) && __skb_linearize(skb)) { 485 + ret = -ENOMEM; 486 + goto free_skb; 487 + } 488 + 478 489 /* Create one header to be copied to all fragments */ 479 490 frag_header.packet_type = BATADV_UNICAST_FRAG; 480 491 frag_header.version = BATADV_COMPAT_VERSION;
+3 -3
net/bluetooth/hci_core.c
··· 2555 2555 */ 2556 2556 switch (hdev->dev_type) { 2557 2557 case HCI_PRIMARY: 2558 - id = ida_simple_get(&hci_index_ida, 0, 0, GFP_KERNEL); 2558 + id = ida_simple_get(&hci_index_ida, 0, HCI_MAX_ID, GFP_KERNEL); 2559 2559 break; 2560 2560 case HCI_AMP: 2561 - id = ida_simple_get(&hci_index_ida, 1, 0, GFP_KERNEL); 2561 + id = ida_simple_get(&hci_index_ida, 1, HCI_MAX_ID, GFP_KERNEL); 2562 2562 break; 2563 2563 default: 2564 2564 return -EINVAL; ··· 2567 2567 if (id < 0) 2568 2568 return id; 2569 2569 2570 - sprintf(hdev->name, "hci%d", id); 2570 + snprintf(hdev->name, sizeof(hdev->name), "hci%d", id); 2571 2571 hdev->id = id; 2572 2572 2573 2573 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
+3 -1
net/core/skbuff.c
··· 3897 3897 unsigned int delta_len = 0; 3898 3898 struct sk_buff *tail = NULL; 3899 3899 struct sk_buff *nskb, *tmp; 3900 - int err; 3900 + int len_diff, err; 3901 3901 3902 3902 skb_push(skb, -skb_network_offset(skb) + offset); 3903 3903 ··· 3937 3937 skb_push(nskb, -skb_network_offset(nskb) + offset); 3938 3938 3939 3939 skb_release_head_state(nskb); 3940 + len_diff = skb_network_header_len(nskb) - skb_network_header_len(skb); 3940 3941 __copy_skb_header(nskb, skb); 3941 3942 3942 3943 skb_headers_offset_update(nskb, skb_headroom(nskb) - skb_headroom(skb)); 3944 + nskb->transport_header += len_diff; 3943 3945 skb_copy_from_linear_data_offset(skb, -tnl_hlen, 3944 3946 nskb->data - tnl_hlen, 3945 3947 offset + tnl_hlen);
+2 -2
net/decnet/dn_dev.c
··· 854 854 memcpy(msg->neighbor, dn_hiord, ETH_ALEN); 855 855 856 856 if (dn_db->router) { 857 - struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; 857 + struct dn_neigh *dn = container_of(dn_db->router, struct dn_neigh, n); 858 858 dn_dn2eth(msg->neighbor, dn->addr); 859 859 } 860 860 ··· 902 902 { 903 903 int n; 904 904 struct dn_dev *dn_db = rcu_dereference_raw(dev->dn_ptr); 905 - struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; 905 + struct dn_neigh *dn = container_of(dn_db->router, struct dn_neigh, n); 906 906 struct sk_buff *skb; 907 907 size_t size; 908 908 unsigned char *ptr;
+2 -1
net/decnet/dn_neigh.c
··· 426 426 if (!dn_db->router) { 427 427 dn_db->router = neigh_clone(neigh); 428 428 } else { 429 - if (msg->priority > ((struct dn_neigh *)dn_db->router)->priority) 429 + if (msg->priority > container_of(dn_db->router, 430 + struct dn_neigh, n)->priority) 430 431 neigh_release(xchg(&dn_db->router, neigh_clone(neigh))); 431 432 } 432 433 }
+2 -2
net/decnet/dn_route.c
··· 1120 1120 /* Ok then, we assume its directly connected and move on */ 1121 1121 select_source: 1122 1122 if (neigh) 1123 - gateway = ((struct dn_neigh *)neigh)->addr; 1123 + gateway = container_of(neigh, struct dn_neigh, n)->addr; 1124 1124 if (gateway == 0) 1125 1125 gateway = fld.daddr; 1126 1126 if (fld.saddr == 0) { ··· 1429 1429 /* Use the default router if there is one */ 1430 1430 neigh = neigh_clone(dn_db->router); 1431 1431 if (neigh) { 1432 - gateway = ((struct dn_neigh *)neigh)->addr; 1432 + gateway = container_of(neigh, struct dn_neigh, n)->addr; 1433 1433 goto make_route; 1434 1434 } 1435 1435
+1
net/dsa/port.c
··· 451 451 switchdev_bridge_port_unoffload(brport_dev, dp, 452 452 &dsa_slave_switchdev_notifier, 453 453 &dsa_slave_switchdev_blocking_notifier); 454 + dsa_flush_workqueue(); 454 455 out_rollback_unbridge: 455 456 dsa_broadcast(DSA_NOTIFIER_BRIDGE_LEAVE, &info); 456 457 out_rollback:
+11 -1
net/ipv4/ping.c
··· 305 305 struct net *net = sock_net(sk); 306 306 if (sk->sk_family == AF_INET) { 307 307 struct sockaddr_in *addr = (struct sockaddr_in *) uaddr; 308 + u32 tb_id = RT_TABLE_LOCAL; 308 309 int chk_addr_ret; 309 310 310 311 if (addr_len < sizeof(*addr)) ··· 319 318 pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n", 320 319 sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port)); 321 320 322 - chk_addr_ret = inet_addr_type(net, addr->sin_addr.s_addr); 321 + tb_id = l3mdev_fib_table_by_index(net, sk->sk_bound_dev_if) ? : tb_id; 322 + chk_addr_ret = inet_addr_type_table(net, addr->sin_addr.s_addr, tb_id); 323 323 324 324 if (!inet_addr_valid_or_nonlocal(net, inet_sk(sk), 325 325 addr->sin_addr.s_addr, ··· 352 350 rcu_read_lock(); 353 351 if (addr->sin6_scope_id) { 354 352 dev = dev_get_by_index_rcu(net, addr->sin6_scope_id); 353 + if (!dev) { 354 + rcu_read_unlock(); 355 + return -ENODEV; 356 + } 357 + } 358 + 359 + if (!dev && sk->sk_bound_dev_if) { 360 + dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if); 355 361 if (!dev) { 356 362 rcu_read_unlock(); 357 363 return -ENODEV;
+1
net/ipv4/route.c
··· 1753 1753 #endif 1754 1754 RT_CACHE_STAT_INC(in_slow_mc); 1755 1755 1756 + skb_dst_drop(skb); 1756 1757 skb_dst_set(skb, &rth->dst); 1757 1758 return 0; 1758 1759 }
+6
net/mac80211/mlme.c
··· 3657 3657 cbss->transmitted_bss->bssid); 3658 3658 bss_conf->bssid_indicator = cbss->max_bssid_indicator; 3659 3659 bss_conf->bssid_index = cbss->bssid_index; 3660 + } else { 3661 + bss_conf->nontransmitted = false; 3662 + memset(bss_conf->transmitter_bssid, 0, 3663 + sizeof(bss_conf->transmitter_bssid)); 3664 + bss_conf->bssid_indicator = 0; 3665 + bss_conf->bssid_index = 0; 3660 3666 } 3661 3667 3662 3668 /*
+1 -2
net/mac80211/rx.c
··· 1405 1405 goto dont_reorder; 1406 1406 1407 1407 /* not part of a BA session */ 1408 - if (ack_policy != IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK && 1409 - ack_policy != IEEE80211_QOS_CTL_ACK_POLICY_NORMAL) 1408 + if (ack_policy == IEEE80211_QOS_CTL_ACK_POLICY_NOACK) 1410 1409 goto dont_reorder; 1411 1410 1412 1411 /* new, potentially un-ordered, ampdu frame - process it */
-1
net/netlink/af_netlink.c
··· 1975 1975 copied = len; 1976 1976 } 1977 1977 1978 - skb_reset_transport_header(data_skb); 1979 1978 err = skb_copy_datagram_msg(data_skb, 0, msg, copied); 1980 1979 1981 1980 if (msg->msg_name) {
+9 -3
net/rds/tcp.c
··· 487 487 /* All module specific customizations to the RDS-TCP socket should be done in 488 488 * rds_tcp_tune() and applied after socket creation. 489 489 */ 490 - void rds_tcp_tune(struct socket *sock) 490 + bool rds_tcp_tune(struct socket *sock) 491 491 { 492 492 struct sock *sk = sock->sk; 493 493 struct net *net = sock_net(sk); 494 - struct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid); 494 + struct rds_tcp_net *rtn; 495 495 496 496 tcp_sock_set_nodelay(sock->sk); 497 497 lock_sock(sk); ··· 499 499 * a process which created this net namespace terminated. 500 500 */ 501 501 if (!sk->sk_net_refcnt) { 502 + if (!maybe_get_net(net)) { 503 + release_sock(sk); 504 + return false; 505 + } 502 506 sk->sk_net_refcnt = 1; 503 - get_net_track(net, &sk->ns_tracker, GFP_KERNEL); 507 + netns_tracker_alloc(net, &sk->ns_tracker, GFP_KERNEL); 504 508 sock_inuse_add(net, 1); 505 509 } 510 + rtn = net_generic(net, rds_tcp_netid); 506 511 if (rtn->sndbuf_size > 0) { 507 512 sk->sk_sndbuf = rtn->sndbuf_size; 508 513 sk->sk_userlocks |= SOCK_SNDBUF_LOCK; ··· 517 512 sk->sk_userlocks |= SOCK_RCVBUF_LOCK; 518 513 } 519 514 release_sock(sk); 515 + return true; 520 516 } 521 517 522 518 static void rds_tcp_accept_worker(struct work_struct *work)
+1 -1
net/rds/tcp.h
··· 49 49 }; 50 50 51 51 /* tcp.c */ 52 - void rds_tcp_tune(struct socket *sock); 52 + bool rds_tcp_tune(struct socket *sock); 53 53 void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp); 54 54 void rds_tcp_reset_callbacks(struct socket *sock, struct rds_conn_path *cp); 55 55 void rds_tcp_restore_callbacks(struct socket *sock,
+4 -1
net/rds/tcp_connect.c
··· 124 124 if (ret < 0) 125 125 goto out; 126 126 127 - rds_tcp_tune(sock); 127 + if (!rds_tcp_tune(sock)) { 128 + ret = -EINVAL; 129 + goto out; 130 + } 128 131 129 132 if (isv6) { 130 133 sin6.sin6_family = AF_INET6;
+4 -1
net/rds/tcp_listen.c
··· 133 133 __module_get(new_sock->ops->owner); 134 134 135 135 rds_tcp_keepalive(new_sock); 136 - rds_tcp_tune(new_sock); 136 + if (!rds_tcp_tune(new_sock)) { 137 + ret = -EINVAL; 138 + goto out; 139 + } 137 140 138 141 inet = inet_sk(new_sock->sk); 139 142
+22 -4
net/sched/act_pedit.c
··· 149 149 struct nlattr *pattr; 150 150 struct tcf_pedit *p; 151 151 int ret = 0, err; 152 - int ksize; 152 + int i, ksize; 153 153 u32 index; 154 154 155 155 if (!nla) { ··· 228 228 p->tcfp_nkeys = parm->nkeys; 229 229 } 230 230 memcpy(p->tcfp_keys, parm->keys, ksize); 231 + p->tcfp_off_max_hint = 0; 232 + for (i = 0; i < p->tcfp_nkeys; ++i) { 233 + u32 cur = p->tcfp_keys[i].off; 234 + 235 + /* The AT option can read a single byte, we can bound the actual 236 + * value with uchar max. 237 + */ 238 + cur += (0xff & p->tcfp_keys[i].offmask) >> p->tcfp_keys[i].shift; 239 + 240 + /* Each key touches 4 bytes starting from the computed offset */ 241 + p->tcfp_off_max_hint = max(p->tcfp_off_max_hint, cur + 4); 242 + } 231 243 232 244 p->tcfp_flags = parm->flags; 233 245 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); ··· 320 308 struct tcf_result *res) 321 309 { 322 310 struct tcf_pedit *p = to_pedit(a); 311 + u32 max_offset; 323 312 int i; 324 313 325 - if (skb_unclone(skb, GFP_ATOMIC)) 326 - return p->tcf_action; 327 - 328 314 spin_lock(&p->tcf_lock); 315 + 316 + max_offset = (skb_transport_header_was_set(skb) ? 317 + skb_transport_offset(skb) : 318 + skb_network_offset(skb)) + 319 + p->tcfp_off_max_hint; 320 + if (skb_ensure_writable(skb, min(skb->len, max_offset))) 321 + goto unlock; 329 322 330 323 tcf_lastuse_update(&p->tcf_tm); 331 324 ··· 420 403 p->tcf_qstats.overlimits++; 421 404 done: 422 405 bstats_update(&p->tcf_bstats, skb); 406 + unlock: 423 407 spin_unlock(&p->tcf_lock); 424 408 return p->tcf_action; 425 409 }
+2 -2
net/smc/smc_rx.c
··· 355 355 } 356 356 break; 357 357 } 358 + if (!timeo) 359 + return -EAGAIN; 358 360 if (signal_pending(current)) { 359 361 read_done = sock_intr_errno(timeo); 360 362 break; 361 363 } 362 - if (!timeo) 363 - return -EAGAIN; 364 364 } 365 365 366 366 if (!smc_rx_data_available(conn)) {
+3
net/tls/tls_device.c
··· 1347 1347 1348 1348 /* Device contexts for RX and TX will be freed in on sk_destruct 1349 1349 * by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW. 1350 + * Now release the ref taken above. 1350 1351 */ 1352 + if (refcount_dec_and_test(&ctx->refcount)) 1353 + tls_device_free_ctx(ctx); 1351 1354 } 1352 1355 1353 1356 up_write(&device_offload_lock);
+16 -2
net/wireless/nl80211.c
··· 3173 3173 } else if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) { 3174 3174 chandef->width = 3175 3175 nla_get_u32(attrs[NL80211_ATTR_CHANNEL_WIDTH]); 3176 + if (chandef->chan->band == NL80211_BAND_S1GHZ) { 3177 + /* User input error for channel width doesn't match channel */ 3178 + if (chandef->width != ieee80211_s1g_channel_width(chandef->chan)) { 3179 + NL_SET_ERR_MSG_ATTR(extack, 3180 + attrs[NL80211_ATTR_CHANNEL_WIDTH], 3181 + "bad channel width"); 3182 + return -EINVAL; 3183 + } 3184 + } 3176 3185 if (attrs[NL80211_ATTR_CENTER_FREQ1]) { 3177 3186 chandef->center_freq1 = 3178 3187 nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ1]); ··· 11666 11657 struct cfg80211_bitrate_mask mask; 11667 11658 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 11668 11659 struct net_device *dev = info->user_ptr[1]; 11660 + struct wireless_dev *wdev = dev->ieee80211_ptr; 11669 11661 int err; 11670 11662 11671 11663 if (!rdev->ops->set_bitrate_mask) 11672 11664 return -EOPNOTSUPP; 11673 11665 11666 + wdev_lock(wdev); 11674 11667 err = nl80211_parse_tx_bitrate_mask(info, info->attrs, 11675 11668 NL80211_ATTR_TX_RATES, &mask, 11676 11669 dev, true); 11677 11670 if (err) 11678 - return err; 11671 + goto out; 11679 11672 11680 - return rdev_set_bitrate_mask(rdev, dev, NULL, &mask); 11673 + err = rdev_set_bitrate_mask(rdev, dev, NULL, &mask); 11674 + out: 11675 + wdev_unlock(wdev); 11676 + return err; 11681 11677 } 11682 11678 11683 11679 static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
+1 -1
net/wireless/scan.c
··· 1829 1829 if (tmp && tmp->datalen >= sizeof(struct ieee80211_s1g_oper_ie)) { 1830 1830 struct ieee80211_s1g_oper_ie *s1gop = (void *)tmp->data; 1831 1831 1832 - return s1gop->primary_ch; 1832 + return s1gop->oper_ch; 1833 1833 } 1834 1834 } else { 1835 1835 tmp = cfg80211_find_elem(WLAN_EID_DS_PARAMS, ie, ielen);
+3
tools/testing/selftests/net/Makefile
··· 25 25 TEST_PROGS += amt.sh 26 26 TEST_PROGS += unicast_extensions.sh 27 27 TEST_PROGS += udpgro_fwd.sh 28 + TEST_PROGS += udpgro_frglist.sh 28 29 TEST_PROGS += veth.sh 29 30 TEST_PROGS += ioam6.sh 30 31 TEST_PROGS += gro.sh ··· 61 60 62 61 KSFT_KHDR_INSTALL := 1 63 62 include ../lib.mk 63 + 64 + include bpf/Makefile 64 65 65 66 $(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma 66 67 $(OUTPUT)/tcp_mmap: LDLIBS += -lpthread
+14
tools/testing/selftests/net/bpf/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + 3 + CLANG ?= clang 4 + CCINCLUDE += -I../../bpf 5 + CCINCLUDE += -I../../../../../usr/include/ 6 + 7 + TEST_CUSTOM_PROGS = $(OUTPUT)/bpf/nat6to4.o 8 + all: $(TEST_CUSTOM_PROGS) 9 + 10 + $(OUTPUT)/%.o: %.c 11 + $(CLANG) -O2 -target bpf -c $< $(CCINCLUDE) -o $@ 12 + 13 + clean: 14 + rm -f $(TEST_CUSTOM_PROGS)
+285
tools/testing/selftests/net/bpf/nat6to4.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * This code is taken from the Android Open Source Project and the author 4 + * (Maciej Żenczykowski) has gave permission to relicense it under the 5 + * GPLv2. Therefore this program is free software; 6 + * You can redistribute it and/or modify it under the terms of the GNU 7 + * General Public License version 2 as published by the Free Software 8 + * Foundation 9 + 10 + * The original headers, including the original license headers, are 11 + * included below for completeness. 12 + * 13 + * Copyright (C) 2019 The Android Open Source Project 14 + * 15 + * Licensed under the Apache License, Version 2.0 (the "License"); 16 + * you may not use this file except in compliance with the License. 17 + * You may obtain a copy of the License at 18 + * 19 + * http://www.apache.org/licenses/LICENSE-2.0 20 + * 21 + * Unless required by applicable law or agreed to in writing, software 22 + * distributed under the License is distributed on an "AS IS" BASIS, 23 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 + * See the License for the specific language governing permissions and 25 + * limitations under the License. 26 + */ 27 + #include <linux/bpf.h> 28 + #include <linux/if.h> 29 + #include <linux/if_ether.h> 30 + #include <linux/if_packet.h> 31 + #include <linux/in.h> 32 + #include <linux/in6.h> 33 + #include <linux/ip.h> 34 + #include <linux/ipv6.h> 35 + #include <linux/pkt_cls.h> 36 + #include <linux/swab.h> 37 + #include <stdbool.h> 38 + #include <stdint.h> 39 + 40 + 41 + #include <linux/udp.h> 42 + 43 + #include <bpf/bpf_helpers.h> 44 + #include <bpf/bpf_endian.h> 45 + 46 + #define IP_DF 0x4000 // Flag: "Don't Fragment" 47 + 48 + SEC("schedcls/ingress6/nat_6") 49 + int sched_cls_ingress6_nat_6_prog(struct __sk_buff *skb) 50 + { 51 + const int l2_header_size = sizeof(struct ethhdr); 52 + void *data = (void *)(long)skb->data; 53 + const void *data_end = (void *)(long)skb->data_end; 54 + const struct ethhdr * const eth = data; // used iff is_ethernet 55 + const struct ipv6hdr * const ip6 = (void *)(eth + 1); 56 + 57 + // Require ethernet dst mac address to be our unicast address. 58 + if (skb->pkt_type != PACKET_HOST) 59 + return TC_ACT_OK; 60 + 61 + // Must be meta-ethernet IPv6 frame 62 + if (skb->protocol != bpf_htons(ETH_P_IPV6)) 63 + return TC_ACT_OK; 64 + 65 + // Must have (ethernet and) ipv6 header 66 + if (data + l2_header_size + sizeof(*ip6) > data_end) 67 + return TC_ACT_OK; 68 + 69 + // Ethertype - if present - must be IPv6 70 + if (eth->h_proto != bpf_htons(ETH_P_IPV6)) 71 + return TC_ACT_OK; 72 + 73 + // IP version must be 6 74 + if (ip6->version != 6) 75 + return TC_ACT_OK; 76 + // Maximum IPv6 payload length that can be translated to IPv4 77 + if (bpf_ntohs(ip6->payload_len) > 0xFFFF - sizeof(struct iphdr)) 78 + return TC_ACT_OK; 79 + switch (ip6->nexthdr) { 80 + case IPPROTO_TCP: // For TCP & UDP the checksum neutrality of the chosen IPv6 81 + case IPPROTO_UDP: // address means there is no need to update their checksums. 82 + case IPPROTO_GRE: // We do not need to bother looking at GRE/ESP headers, 83 + case IPPROTO_ESP: // since there is never a checksum to update. 84 + break; 85 + default: // do not know how to handle anything else 86 + return TC_ACT_OK; 87 + } 88 + 89 + struct ethhdr eth2; // used iff is_ethernet 90 + 91 + eth2 = *eth; // Copy over the ethernet header (src/dst mac) 92 + eth2.h_proto = bpf_htons(ETH_P_IP); // But replace the ethertype 93 + 94 + struct iphdr ip = { 95 + .version = 4, // u4 96 + .ihl = sizeof(struct iphdr) / sizeof(__u32), // u4 97 + .tos = (ip6->priority << 4) + (ip6->flow_lbl[0] >> 4), // u8 98 + .tot_len = bpf_htons(bpf_ntohs(ip6->payload_len) + sizeof(struct iphdr)), // u16 99 + .id = 0, // u16 100 + .frag_off = bpf_htons(IP_DF), // u16 101 + .ttl = ip6->hop_limit, // u8 102 + .protocol = ip6->nexthdr, // u8 103 + .check = 0, // u16 104 + .saddr = 0x0201a8c0, // u32 105 + .daddr = 0x0101a8c0, // u32 106 + }; 107 + 108 + // Calculate the IPv4 one's complement checksum of the IPv4 header. 109 + __wsum sum4 = 0; 110 + 111 + for (int i = 0; i < sizeof(ip) / sizeof(__u16); ++i) 112 + sum4 += ((__u16 *)&ip)[i]; 113 + 114 + // Note that sum4 is guaranteed to be non-zero by virtue of ip.version == 4 115 + sum4 = (sum4 & 0xFFFF) + (sum4 >> 16); // collapse u32 into range 1 .. 0x1FFFE 116 + sum4 = (sum4 & 0xFFFF) + (sum4 >> 16); // collapse any potential carry into u16 117 + ip.check = (__u16)~sum4; // sum4 cannot be zero, so this is never 0xFFFF 118 + 119 + // Calculate the *negative* IPv6 16-bit one's complement checksum of the IPv6 header. 120 + __wsum sum6 = 0; 121 + // We'll end up with a non-zero sum due to ip6->version == 6 (which has '0' bits) 122 + for (int i = 0; i < sizeof(*ip6) / sizeof(__u16); ++i) 123 + sum6 += ~((__u16 *)ip6)[i]; // note the bitwise negation 124 + 125 + // Note that there is no L4 checksum update: we are relying on the checksum neutrality 126 + // of the ipv6 address chosen by netd's ClatdController. 127 + 128 + // Packet mutations begin - point of no return, but if this first modification fails 129 + // the packet is probably still pristine, so let clatd handle it. 130 + if (bpf_skb_change_proto(skb, bpf_htons(ETH_P_IP), 0)) 131 + return TC_ACT_OK; 132 + bpf_csum_update(skb, sum6); 133 + 134 + data = (void *)(long)skb->data; 135 + data_end = (void *)(long)skb->data_end; 136 + if (data + l2_header_size + sizeof(struct iphdr) > data_end) 137 + return TC_ACT_SHOT; 138 + 139 + struct ethhdr *new_eth = data; 140 + 141 + // Copy over the updated ethernet header 142 + *new_eth = eth2; 143 + 144 + // Copy over the new ipv4 header. 145 + *(struct iphdr *)(new_eth + 1) = ip; 146 + return bpf_redirect(skb->ifindex, BPF_F_INGRESS); 147 + } 148 + 149 + SEC("schedcls/egress4/snat4") 150 + int sched_cls_egress4_snat4_prog(struct __sk_buff *skb) 151 + { 152 + const int l2_header_size = sizeof(struct ethhdr); 153 + void *data = (void *)(long)skb->data; 154 + const void *data_end = (void *)(long)skb->data_end; 155 + const struct ethhdr *const eth = data; // used iff is_ethernet 156 + const struct iphdr *const ip4 = (void *)(eth + 1); 157 + 158 + // Must be meta-ethernet IPv4 frame 159 + if (skb->protocol != bpf_htons(ETH_P_IP)) 160 + return TC_ACT_OK; 161 + 162 + // Must have ipv4 header 163 + if (data + l2_header_size + sizeof(struct ipv6hdr) > data_end) 164 + return TC_ACT_OK; 165 + 166 + // Ethertype - if present - must be IPv4 167 + if (eth->h_proto != bpf_htons(ETH_P_IP)) 168 + return TC_ACT_OK; 169 + 170 + // IP version must be 4 171 + if (ip4->version != 4) 172 + return TC_ACT_OK; 173 + 174 + // We cannot handle IP options, just standard 20 byte == 5 dword minimal IPv4 header 175 + if (ip4->ihl != 5) 176 + return TC_ACT_OK; 177 + 178 + // Maximum IPv6 payload length that can be translated to IPv4 179 + if (bpf_htons(ip4->tot_len) > 0xFFFF - sizeof(struct ipv6hdr)) 180 + return TC_ACT_OK; 181 + 182 + // Calculate the IPv4 one's complement checksum of the IPv4 header. 183 + __wsum sum4 = 0; 184 + 185 + for (int i = 0; i < sizeof(*ip4) / sizeof(__u16); ++i) 186 + sum4 += ((__u16 *)ip4)[i]; 187 + 188 + // Note that sum4 is guaranteed to be non-zero by virtue of ip4->version == 4 189 + sum4 = (sum4 & 0xFFFF) + (sum4 >> 16); // collapse u32 into range 1 .. 0x1FFFE 190 + sum4 = (sum4 & 0xFFFF) + (sum4 >> 16); // collapse any potential carry into u16 191 + // for a correct checksum we should get *a* zero, but sum4 must be positive, ie 0xFFFF 192 + if (sum4 != 0xFFFF) 193 + return TC_ACT_OK; 194 + 195 + // Minimum IPv4 total length is the size of the header 196 + if (bpf_ntohs(ip4->tot_len) < sizeof(*ip4)) 197 + return TC_ACT_OK; 198 + 199 + // We are incapable of dealing with IPv4 fragments 200 + if (ip4->frag_off & ~bpf_htons(IP_DF)) 201 + return TC_ACT_OK; 202 + 203 + switch (ip4->protocol) { 204 + case IPPROTO_TCP: // For TCP & UDP the checksum neutrality of the chosen IPv6 205 + case IPPROTO_GRE: // address means there is no need to update their checksums. 206 + case IPPROTO_ESP: // We do not need to bother looking at GRE/ESP headers, 207 + break; // since there is never a checksum to update. 208 + 209 + case IPPROTO_UDP: // See above comment, but must also have UDP header... 210 + if (data + sizeof(*ip4) + sizeof(struct udphdr) > data_end) 211 + return TC_ACT_OK; 212 + const struct udphdr *uh = (const struct udphdr *)(ip4 + 1); 213 + // If IPv4/UDP checksum is 0 then fallback to clatd so it can calculate the 214 + // checksum. Otherwise the network or more likely the NAT64 gateway might 215 + // drop the packet because in most cases IPv6/UDP packets with a zero checksum 216 + // are invalid. See RFC 6935. TODO: calculate checksum via bpf_csum_diff() 217 + if (!uh->check) 218 + return TC_ACT_OK; 219 + break; 220 + 221 + default: // do not know how to handle anything else 222 + return TC_ACT_OK; 223 + } 224 + struct ethhdr eth2; // used iff is_ethernet 225 + 226 + eth2 = *eth; // Copy over the ethernet header (src/dst mac) 227 + eth2.h_proto = bpf_htons(ETH_P_IPV6); // But replace the ethertype 228 + 229 + struct ipv6hdr ip6 = { 230 + .version = 6, // __u8:4 231 + .priority = ip4->tos >> 4, // __u8:4 232 + .flow_lbl = {(ip4->tos & 0xF) << 4, 0, 0}, // __u8[3] 233 + .payload_len = bpf_htons(bpf_ntohs(ip4->tot_len) - 20), // __be16 234 + .nexthdr = ip4->protocol, // __u8 235 + .hop_limit = ip4->ttl, // __u8 236 + }; 237 + ip6.saddr.in6_u.u6_addr32[0] = bpf_htonl(0x20010db8); 238 + ip6.saddr.in6_u.u6_addr32[1] = 0; 239 + ip6.saddr.in6_u.u6_addr32[2] = 0; 240 + ip6.saddr.in6_u.u6_addr32[3] = bpf_htonl(1); 241 + ip6.daddr.in6_u.u6_addr32[0] = bpf_htonl(0x20010db8); 242 + ip6.daddr.in6_u.u6_addr32[1] = 0; 243 + ip6.daddr.in6_u.u6_addr32[2] = 0; 244 + ip6.daddr.in6_u.u6_addr32[3] = bpf_htonl(2); 245 + 246 + // Calculate the IPv6 16-bit one's complement checksum of the IPv6 header. 247 + __wsum sum6 = 0; 248 + // We'll end up with a non-zero sum due to ip6.version == 6 249 + for (int i = 0; i < sizeof(ip6) / sizeof(__u16); ++i) 250 + sum6 += ((__u16 *)&ip6)[i]; 251 + 252 + // Packet mutations begin - point of no return, but if this first modification fails 253 + // the packet is probably still pristine, so let clatd handle it. 254 + if (bpf_skb_change_proto(skb, bpf_htons(ETH_P_IPV6), 0)) 255 + return TC_ACT_OK; 256 + 257 + // This takes care of updating the skb->csum field for a CHECKSUM_COMPLETE packet. 258 + // In such a case, skb->csum is a 16-bit one's complement sum of the entire payload, 259 + // thus we need to subtract out the ipv4 header's sum, and add in the ipv6 header's sum. 260 + // However, we've already verified the ipv4 checksum is correct and thus 0. 261 + // Thus we only need to add the ipv6 header's sum. 262 + // 263 + // bpf_csum_update() always succeeds if the skb is CHECKSUM_COMPLETE and returns an error 264 + // (-ENOTSUPP) if it isn't. So we just ignore the return code (see above for more details). 265 + bpf_csum_update(skb, sum6); 266 + 267 + // bpf_skb_change_proto() invalidates all pointers - reload them. 268 + data = (void *)(long)skb->data; 269 + data_end = (void *)(long)skb->data_end; 270 + 271 + // I cannot think of any valid way for this error condition to trigger, however I do 272 + // believe the explicit check is required to keep the in kernel ebpf verifier happy. 273 + if (data + l2_header_size + sizeof(ip6) > data_end) 274 + return TC_ACT_SHOT; 275 + 276 + struct ethhdr *new_eth = data; 277 + 278 + // Copy over the updated ethernet header 279 + *new_eth = eth2; 280 + // Copy over the new ipv4 header. 281 + *(struct ipv6hdr *)(new_eth + 1) = ip6; 282 + return TC_ACT_OK; 283 + } 284 + 285 + char _license[] SEC("license") = ("GPL");
+12
tools/testing/selftests/net/fcnal-test.sh
··· 810 810 setup 811 811 set_sysctl net.ipv4.raw_l3mdev_accept=1 2>/dev/null 812 812 ipv4_ping_novrf 813 + setup 814 + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null 815 + ipv4_ping_novrf 813 816 814 817 log_subsection "With VRF" 815 818 setup "yes" 819 + ipv4_ping_vrf 820 + setup "yes" 821 + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null 816 822 ipv4_ping_vrf 817 823 } 818 824 ··· 2354 2348 log_subsection "No VRF" 2355 2349 setup 2356 2350 ipv6_ping_novrf 2351 + setup 2352 + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null 2353 + ipv6_ping_novrf 2357 2354 2358 2355 log_subsection "With VRF" 2359 2356 setup "yes" 2357 + ipv6_ping_vrf 2358 + setup "yes" 2359 + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null 2360 2360 ipv6_ping_vrf 2361 2361 } 2362 2362
+101
tools/testing/selftests/net/udpgro_frglist.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Run a series of udpgro benchmarks 5 + 6 + readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" 7 + 8 + cleanup() { 9 + local -r jobs="$(jobs -p)" 10 + local -r ns="$(ip netns list|grep $PEER_NS)" 11 + 12 + [ -n "${jobs}" ] && kill -INT ${jobs} 2>/dev/null 13 + [ -n "$ns" ] && ip netns del $ns 2>/dev/null 14 + } 15 + trap cleanup EXIT 16 + 17 + run_one() { 18 + # use 'rx' as separator between sender args and receiver args 19 + local -r all="$@" 20 + local -r tx_args=${all%rx*} 21 + local rx_args=${all#*rx} 22 + 23 + 24 + 25 + ip netns add "${PEER_NS}" 26 + ip -netns "${PEER_NS}" link set lo up 27 + ip link add type veth 28 + ip link set dev veth0 up 29 + ip addr add dev veth0 192.168.1.2/24 30 + ip addr add dev veth0 2001:db8::2/64 nodad 31 + 32 + ip link set dev veth1 netns "${PEER_NS}" 33 + ip -netns "${PEER_NS}" addr add dev veth1 192.168.1.1/24 34 + ip -netns "${PEER_NS}" addr add dev veth1 2001:db8::1/64 nodad 35 + ip -netns "${PEER_NS}" link set dev veth1 up 36 + ip netns exec "${PEER_NS}" ethtool -K veth1 rx-gro-list on 37 + 38 + 39 + ip -n "${PEER_NS}" link set veth1 xdp object ../bpf/xdp_dummy.o section xdp_dummy 40 + tc -n "${PEER_NS}" qdisc add dev veth1 clsact 41 + tc -n "${PEER_NS}" filter add dev veth1 ingress prio 4 protocol ipv6 bpf object-file ../bpf/nat6to4.o section schedcls/ingress6/nat_6 direct-action 42 + tc -n "${PEER_NS}" filter add dev veth1 egress prio 4 protocol ip bpf object-file ../bpf/nat6to4.o section schedcls/egress4/snat4 direct-action 43 + echo ${rx_args} 44 + ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -r & 45 + 46 + # Hack: let bg programs complete the startup 47 + sleep 0.1 48 + ./udpgso_bench_tx ${tx_args} 49 + } 50 + 51 + run_in_netns() { 52 + local -r args=$@ 53 + echo ${args} 54 + ./in_netns.sh $0 __subprocess ${args} 55 + } 56 + 57 + run_udp() { 58 + local -r args=$@ 59 + 60 + echo "udp gso - over veth touching data" 61 + run_in_netns ${args} -u -S 0 rx -4 -v 62 + 63 + echo "udp gso and gro - over veth touching data" 64 + run_in_netns ${args} -S 0 rx -4 -G 65 + } 66 + 67 + run_tcp() { 68 + local -r args=$@ 69 + 70 + echo "tcp - over veth touching data" 71 + run_in_netns ${args} -t rx -4 -t 72 + } 73 + 74 + run_all() { 75 + local -r core_args="-l 4" 76 + local -r ipv4_args="${core_args} -4 -D 192.168.1.1" 77 + local -r ipv6_args="${core_args} -6 -D 2001:db8::1" 78 + 79 + echo "ipv6" 80 + run_tcp "${ipv6_args}" 81 + run_udp "${ipv6_args}" 82 + } 83 + 84 + if [ ! -f ../bpf/xdp_dummy.o ]; then 85 + echo "Missing xdp_dummy helper. Build bpf selftest first" 86 + exit -1 87 + fi 88 + 89 + if [ ! -f bpf/nat6to4.o ]; then 90 + echo "Missing nat6to4 helper. Build bpfnat6to4.o selftest first" 91 + exit -1 92 + fi 93 + 94 + if [[ $# -eq 0 ]]; then 95 + run_all 96 + elif [[ $1 == "__subprocess" ]]; then 97 + shift 98 + run_one $@ 99 + else 100 + run_in_netns $@ 101 + fi