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 branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue into main

Tony nguyen says:

====================
Intel Wired LAN Driver Updates 2024-06-28 (MAINTAINERS, ice)

This series contains updates to MAINTAINERS file and ice driver.

Jesse replaces himself with Przemek in the maintainers file.

Karthik Sundaravel adds support for VF get/set MAC address via devlink.

Eric checks for errors from ice_vsi_rebuild() during queue
reconfiguration.

Paul adjusts FW API version check for E830 devices.

Piotr adds differentiation of unload type when shutting down AdminQ.

Przemek changes ice_adapter initialization to occur once per physical
card.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+163 -62
+1 -1
MAINTAINERS
··· 11051 11051 F: include/uapi/drm/xe_drm.h 11052 11052 11053 11053 INTEL ETHERNET DRIVERS 11054 - M: Jesse Brandeburg <jesse.brandeburg@intel.com> 11055 11054 M: Tony Nguyen <anthony.l.nguyen@intel.com> 11055 + M: Przemek Kitszel <przemyslaw.kitszel@intel.com> 11056 11056 L: intel-wired-lan@lists.osuosl.org (moderated for non-subscribers) 11057 11057 S: Supported 11058 11058 W: https://www.intel.com/content/www/us/en/support.html
+26 -30
drivers/net/ethernet/intel/ice/ice_adapter.c
··· 11 11 #include "ice_adapter.h" 12 12 13 13 static DEFINE_XARRAY(ice_adapters); 14 + static DEFINE_MUTEX(ice_adapters_mutex); 14 15 15 16 /* PCI bus number is 8 bits. Slot is 5 bits. Domain can have the rest. */ 16 17 #define INDEX_FIELD_DOMAIN GENMASK(BITS_PER_LONG - 1, 13) ··· 48 47 kfree(adapter); 49 48 } 50 49 51 - DEFINE_FREE(ice_adapter_free, struct ice_adapter*, if (_T) ice_adapter_free(_T)) 52 - 53 50 /** 54 51 * ice_adapter_get - Get a shared ice_adapter structure. 55 52 * @pdev: Pointer to the pci_dev whose driver is getting the ice_adapter. ··· 63 64 */ 64 65 struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev) 65 66 { 66 - struct ice_adapter *ret, __free(ice_adapter_free) *adapter = NULL; 67 67 unsigned long index = ice_adapter_index(pdev); 68 + struct ice_adapter *adapter; 69 + int err; 68 70 69 - adapter = ice_adapter_new(); 70 - if (!adapter) 71 - return ERR_PTR(-ENOMEM); 71 + scoped_guard(mutex, &ice_adapters_mutex) { 72 + err = xa_insert(&ice_adapters, index, NULL, GFP_KERNEL); 73 + if (err == -EBUSY) { 74 + adapter = xa_load(&ice_adapters, index); 75 + refcount_inc(&adapter->refcount); 76 + return adapter; 77 + } 78 + if (err) 79 + return ERR_PTR(err); 72 80 73 - xa_lock(&ice_adapters); 74 - ret = __xa_cmpxchg(&ice_adapters, index, NULL, adapter, GFP_KERNEL); 75 - if (xa_is_err(ret)) { 76 - ret = ERR_PTR(xa_err(ret)); 77 - goto unlock; 81 + adapter = ice_adapter_new(); 82 + if (!adapter) 83 + return ERR_PTR(-ENOMEM); 84 + xa_store(&ice_adapters, index, adapter, GFP_KERNEL); 78 85 } 79 - if (ret) { 80 - refcount_inc(&ret->refcount); 81 - goto unlock; 82 - } 83 - ret = no_free_ptr(adapter); 84 - unlock: 85 - xa_unlock(&ice_adapters); 86 - return ret; 86 + return adapter; 87 87 } 88 88 89 89 /** ··· 92 94 * Releases the reference to ice_adapter previously obtained with 93 95 * ice_adapter_get. 94 96 * 95 - * Context: Any. 97 + * Context: Process, may sleep. 96 98 */ 97 99 void ice_adapter_put(const struct pci_dev *pdev) 98 100 { 99 101 unsigned long index = ice_adapter_index(pdev); 100 102 struct ice_adapter *adapter; 101 103 102 - xa_lock(&ice_adapters); 103 - adapter = xa_load(&ice_adapters, index); 104 - if (WARN_ON(!adapter)) 105 - goto unlock; 104 + scoped_guard(mutex, &ice_adapters_mutex) { 105 + adapter = xa_load(&ice_adapters, index); 106 + if (WARN_ON(!adapter)) 107 + return; 108 + if (!refcount_dec_and_test(&adapter->refcount)) 109 + return; 106 110 107 - if (!refcount_dec_and_test(&adapter->refcount)) 108 - goto unlock; 109 - 110 - WARN_ON(__xa_erase(&ice_adapters, index) != adapter); 111 + WARN_ON(xa_erase(&ice_adapters, index) != adapter); 112 + } 111 113 ice_adapter_free(adapter); 112 - unlock: 113 - xa_unlock(&ice_adapters); 114 114 }
+1 -1
drivers/net/ethernet/intel/ice/ice_common.h
··· 23 23 int ice_reset(struct ice_hw *hw, enum ice_reset_req req); 24 24 int ice_create_all_ctrlq(struct ice_hw *hw); 25 25 int ice_init_all_ctrlq(struct ice_hw *hw); 26 - void ice_shutdown_all_ctrlq(struct ice_hw *hw); 26 + void ice_shutdown_all_ctrlq(struct ice_hw *hw, bool unloading); 27 27 void ice_destroy_all_ctrlq(struct ice_hw *hw); 28 28 int 29 29 ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
+18 -12
drivers/net/ethernet/intel/ice/ice_controlq.c
··· 510 510 */ 511 511 static bool ice_aq_ver_check(struct ice_hw *hw) 512 512 { 513 - if (hw->api_maj_ver > EXP_FW_API_VER_MAJOR) { 513 + u8 exp_fw_api_ver_major = EXP_FW_API_VER_MAJOR_BY_MAC(hw); 514 + u8 exp_fw_api_ver_minor = EXP_FW_API_VER_MINOR_BY_MAC(hw); 515 + 516 + if (hw->api_maj_ver > exp_fw_api_ver_major) { 514 517 /* Major API version is newer than expected, don't load */ 515 518 dev_warn(ice_hw_to_dev(hw), 516 519 "The driver for the device stopped because the NVM image is newer than expected. You must install the most recent version of the network driver.\n"); 517 520 return false; 518 - } else if (hw->api_maj_ver == EXP_FW_API_VER_MAJOR) { 519 - if (hw->api_min_ver > (EXP_FW_API_VER_MINOR + 2)) 521 + } else if (hw->api_maj_ver == exp_fw_api_ver_major) { 522 + if (hw->api_min_ver > (exp_fw_api_ver_minor + 2)) 520 523 dev_info(ice_hw_to_dev(hw), 521 524 "The driver for the device detected a newer version of the NVM image than expected. Please install the most recent version of the network driver.\n"); 522 - else if ((hw->api_min_ver + 2) < EXP_FW_API_VER_MINOR) 525 + else if ((hw->api_min_ver + 2) < exp_fw_api_ver_minor) 523 526 dev_info(ice_hw_to_dev(hw), 524 527 "The driver for the device detected an older version of the NVM image than expected. Please update the NVM image.\n"); 525 528 } else { ··· 687 684 * ice_shutdown_ctrlq - shutdown routine for any control queue 688 685 * @hw: pointer to the hardware structure 689 686 * @q_type: specific Control queue type 687 + * @unloading: is the driver unloading itself 690 688 * 691 689 * NOTE: this function does not destroy the control queue locks. 692 690 */ 693 - static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type) 691 + static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type, 692 + bool unloading) 694 693 { 695 694 struct ice_ctl_q_info *cq; 696 695 ··· 700 695 case ICE_CTL_Q_ADMIN: 701 696 cq = &hw->adminq; 702 697 if (ice_check_sq_alive(hw, cq)) 703 - ice_aq_q_shutdown(hw, true); 698 + ice_aq_q_shutdown(hw, unloading); 704 699 break; 705 700 case ICE_CTL_Q_SB: 706 701 cq = &hw->sbq; ··· 719 714 /** 720 715 * ice_shutdown_all_ctrlq - shutdown routine for all control queues 721 716 * @hw: pointer to the hardware structure 717 + * @unloading: is the driver unloading itself 722 718 * 723 719 * NOTE: this function does not destroy the control queue locks. The driver 724 720 * may call this at runtime to shutdown and later restart control queues, such 725 721 * as in response to a reset event. 726 722 */ 727 - void ice_shutdown_all_ctrlq(struct ice_hw *hw) 723 + void ice_shutdown_all_ctrlq(struct ice_hw *hw, bool unloading) 728 724 { 729 725 /* Shutdown FW admin queue */ 730 - ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN); 726 + ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN, unloading); 731 727 /* Shutdown PHY Sideband */ 732 728 if (ice_is_sbq_supported(hw)) 733 - ice_shutdown_ctrlq(hw, ICE_CTL_Q_SB); 729 + ice_shutdown_ctrlq(hw, ICE_CTL_Q_SB, unloading); 734 730 /* Shutdown PF-VF Mailbox */ 735 - ice_shutdown_ctrlq(hw, ICE_CTL_Q_MAILBOX); 731 + ice_shutdown_ctrlq(hw, ICE_CTL_Q_MAILBOX, unloading); 736 732 } 737 733 738 734 /** ··· 765 759 break; 766 760 767 761 ice_debug(hw, ICE_DBG_AQ_MSG, "Retry Admin Queue init due to FW critical error\n"); 768 - ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN); 762 + ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN, true); 769 763 msleep(ICE_CTL_Q_ADMIN_INIT_MSEC); 770 764 } while (retry++ < ICE_CTL_Q_ADMIN_INIT_TIMEOUT); 771 765 ··· 846 840 void ice_destroy_all_ctrlq(struct ice_hw *hw) 847 841 { 848 842 /* shut down all the control queues first */ 849 - ice_shutdown_all_ctrlq(hw); 843 + ice_shutdown_all_ctrlq(hw, true); 850 844 851 845 ice_destroy_ctrlq_locks(&hw->adminq); 852 846 if (ice_is_sbq_supported(hw))
+12 -3
drivers/net/ethernet/intel/ice/ice_controlq.h
··· 21 21 /* Defines that help manage the driver vs FW API checks. 22 22 * Take a look at ice_aq_ver_check in ice_controlq.c for actual usage. 23 23 */ 24 - #define EXP_FW_API_VER_BRANCH 0x00 25 - #define EXP_FW_API_VER_MAJOR 0x01 26 - #define EXP_FW_API_VER_MINOR 0x05 24 + #define EXP_FW_API_VER_MAJOR_E810 0x01 25 + #define EXP_FW_API_VER_MINOR_E810 0x05 26 + 27 + #define EXP_FW_API_VER_MAJOR_E830 0x01 28 + #define EXP_FW_API_VER_MINOR_E830 0x07 29 + 30 + #define EXP_FW_API_VER_MAJOR_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? \ 31 + EXP_FW_API_VER_MAJOR_E830 : \ 32 + EXP_FW_API_VER_MAJOR_E810) 33 + #define EXP_FW_API_VER_MINOR_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? \ 34 + EXP_FW_API_VER_MINOR_E830 : \ 35 + EXP_FW_API_VER_MINOR_E810) 27 36 28 37 /* Different control queue types: These are mainly for SW consumption. */ 29 38 enum ice_ctl_q {
+14 -5
drivers/net/ethernet/intel/ice/ice_main.c
··· 623 623 if (hw->port_info) 624 624 ice_sched_clear_port(hw->port_info); 625 625 626 - ice_shutdown_all_ctrlq(hw); 626 + ice_shutdown_all_ctrlq(hw, false); 627 627 628 628 set_bit(ICE_PREPARED_FOR_RESET, pf->state); 629 629 } ··· 4158 4158 4159 4159 /* set for the next time the netdev is started */ 4160 4160 if (!netif_running(vsi->netdev)) { 4161 - ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); 4161 + err = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); 4162 + if (err) 4163 + goto rebuild_err; 4162 4164 dev_dbg(ice_pf_to_dev(pf), "Link is down, queue count change happens when link is brought up\n"); 4163 4165 goto done; 4164 4166 } 4165 4167 4166 4168 ice_vsi_close(vsi); 4167 - ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); 4169 + err = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); 4170 + if (err) 4171 + goto rebuild_err; 4168 4172 4169 4173 ice_for_each_traffic_class(i) { 4170 4174 if (vsi->tc_cfg.ena_tc & BIT(i)) ··· 4179 4175 } 4180 4176 ice_pf_dcb_recfg(pf, locked); 4181 4177 ice_vsi_open(vsi); 4178 + goto done; 4179 + 4180 + rebuild_err: 4181 + dev_err(ice_pf_to_dev(pf), "Error during VSI rebuild: %d. Unload and reload the driver.\n", 4182 + err); 4182 4183 done: 4183 4184 clear_bit(ICE_CFG_BUSY, pf->state); 4184 4185 return err; ··· 5499 5490 if (pf->vsi[v]) 5500 5491 pf->vsi[v]->vsi_num = 0; 5501 5492 5502 - ice_shutdown_all_ctrlq(hw); 5493 + ice_shutdown_all_ctrlq(hw, true); 5503 5494 } 5504 5495 5505 5496 /** ··· 7759 7750 err_sched_init_port: 7760 7751 ice_sched_cleanup_all(hw); 7761 7752 err_init_ctrlq: 7762 - ice_shutdown_all_ctrlq(hw); 7753 + ice_shutdown_all_ctrlq(hw, false); 7763 7754 set_bit(ICE_RESET_FAILED, pf->state); 7764 7755 clear_recovery: 7765 7756 /* set this bit in PF state to control service task scheduling */
+25 -9
drivers/net/ethernet/intel/ice/ice_sriov.c
··· 1416 1416 } 1417 1417 1418 1418 /** 1419 - * ice_set_vf_mac 1420 - * @netdev: network interface device structure 1419 + * __ice_set_vf_mac - program VF MAC address 1420 + * @pf: PF to be configure 1421 1421 * @vf_id: VF identifier 1422 1422 * @mac: MAC address 1423 1423 * 1424 1424 * program VF MAC address 1425 + * Return: zero on success or an error code on failure 1425 1426 */ 1426 - int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) 1427 + int __ice_set_vf_mac(struct ice_pf *pf, u16 vf_id, const u8 *mac) 1427 1428 { 1428 - struct ice_pf *pf = ice_netdev_to_pf(netdev); 1429 + struct device *dev; 1429 1430 struct ice_vf *vf; 1430 1431 int ret; 1431 1432 1433 + dev = ice_pf_to_dev(pf); 1432 1434 if (is_multicast_ether_addr(mac)) { 1433 - netdev_err(netdev, "%pM not a valid unicast address\n", mac); 1435 + dev_err(dev, "%pM not a valid unicast address\n", mac); 1434 1436 return -EINVAL; 1435 1437 } 1436 1438 ··· 1461 1459 if (is_zero_ether_addr(mac)) { 1462 1460 /* VF will send VIRTCHNL_OP_ADD_ETH_ADDR message with its MAC */ 1463 1461 vf->pf_set_mac = false; 1464 - netdev_info(netdev, "Removing MAC on VF %d. VF driver will be reinitialized\n", 1465 - vf->vf_id); 1462 + dev_info(dev, "Removing MAC on VF %d. VF driver will be reinitialized\n", 1463 + vf->vf_id); 1466 1464 } else { 1467 1465 /* PF will add MAC rule for the VF */ 1468 1466 vf->pf_set_mac = true; 1469 - netdev_info(netdev, "Setting MAC %pM on VF %d. VF driver will be reinitialized\n", 1470 - mac, vf_id); 1467 + dev_info(dev, "Setting MAC %pM on VF %d. VF driver will be reinitialized\n", 1468 + mac, vf_id); 1471 1469 } 1472 1470 1473 1471 ice_reset_vf(vf, ICE_VF_RESET_NOTIFY); ··· 1476 1474 out_put_vf: 1477 1475 ice_put_vf(vf); 1478 1476 return ret; 1477 + } 1478 + 1479 + /** 1480 + * ice_set_vf_mac - .ndo_set_vf_mac handler 1481 + * @netdev: network interface device structure 1482 + * @vf_id: VF identifier 1483 + * @mac: MAC address 1484 + * 1485 + * program VF MAC address 1486 + * Return: zero on success or an error code on failure 1487 + */ 1488 + int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) 1489 + { 1490 + return __ice_set_vf_mac(ice_netdev_to_pf(netdev), vf_id, mac); 1479 1491 } 1480 1492 1481 1493 /**
+8
drivers/net/ethernet/intel/ice/ice_sriov.h
··· 28 28 #ifdef CONFIG_PCI_IOV 29 29 void ice_process_vflr_event(struct ice_pf *pf); 30 30 int ice_sriov_configure(struct pci_dev *pdev, int num_vfs); 31 + int __ice_set_vf_mac(struct ice_pf *pf, u16 vf_id, const u8 *mac); 31 32 int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac); 32 33 int 33 34 ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi); ··· 77 76 static inline int 78 77 ice_sriov_configure(struct pci_dev __always_unused *pdev, 79 78 int __always_unused num_vfs) 79 + { 80 + return -EOPNOTSUPP; 81 + } 82 + 83 + static inline int 84 + __ice_set_vf_mac(struct ice_pf __always_unused *pf, 85 + u16 __always_unused vf_id, const u8 __always_unused *mac) 80 86 { 81 87 return -EOPNOTSUPP; 82 88 }