Message ID | 20230119113140.20208-6-alejandro.lucero-palau@amd.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | sfc: devlink support for ef100 | expand |
Hi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/intel-lab-lkp/linux/commits/alejandro-lucero-palau-amd-com/sfc-add-devlink-support-for-ef100/20230119-193440 patch link: https://lore.kernel.org/r/20230119113140.20208-6-alejandro.lucero-palau%40amd.com patch subject: [PATCH net-next 5/7] sfc: obtain device mac address based on firmware handle for ef100 config: i386-randconfig-a015 (https://download.01.org/0day-ci/archive/20230120/202301200333.BjjkOStI-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/94535fc2c87743925490d5ce0573b8e9b4b2690c git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review alejandro-lucero-palau-amd-com/sfc-add-devlink-support-for-ef100/20230119-193440 git checkout 94535fc2c87743925490d5ce0573b8e9b4b2690c # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/ethernet/sfc/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/net/ethernet/sfc/ef100_nic.c:1127:21: warning: unused variable 'net_dev' [-Wunused-variable] struct net_device *net_dev = efx->net_dev; ^ >> drivers/net/ethernet/sfc/ef100_nic.c:1172:9: warning: variable 'rc' is uninitialized when used here [-Wuninitialized] return rc; ^~ drivers/net/ethernet/sfc/ef100_nic.c:1128:8: note: initialize the variable 'rc' to silence this warning int rc; ^ = 0 2 warnings generated. vim +/net_dev +1127 drivers/net/ethernet/sfc/ef100_nic.c 51b35a454efdcd Edward Cree 2020-07-27 1123 98ff4c7c8ac7f5 Jonathan Cooper 2022-06-28 1124 int ef100_probe_netdev_pf(struct efx_nic *efx) 51b35a454efdcd Edward Cree 2020-07-27 1125 { 98ff4c7c8ac7f5 Jonathan Cooper 2022-06-28 1126 struct ef100_nic_data *nic_data = efx->nic_data; 29ec1b27e73990 Edward Cree 2020-07-27 @1127 struct net_device *net_dev = efx->net_dev; 98ff4c7c8ac7f5 Jonathan Cooper 2022-06-28 1128 int rc; 29ec1b27e73990 Edward Cree 2020-07-27 1129 6f6838aabff5ea Edward Cree 2022-07-28 1130 if (!nic_data->grp_mae) 6f6838aabff5ea Edward Cree 2022-07-28 1131 return 0; 6f6838aabff5ea Edward Cree 2022-07-28 1132 6f6838aabff5ea Edward Cree 2022-07-28 1133 #ifdef CONFIG_SFC_SRIOV 67ab160ed08f5b Edward Cree 2022-07-28 1134 rc = efx_init_struct_tc(efx); 67ab160ed08f5b Edward Cree 2022-07-28 1135 if (rc) 67ab160ed08f5b Edward Cree 2022-07-28 1136 return rc; 67ab160ed08f5b Edward Cree 2022-07-28 1137 6f6838aabff5ea Edward Cree 2022-07-28 1138 rc = efx_ef100_get_base_mport(efx); 6f6838aabff5ea Edward Cree 2022-07-28 1139 if (rc) { 6f6838aabff5ea Edward Cree 2022-07-28 1140 netif_warn(efx, probe, net_dev, 6f6838aabff5ea Edward Cree 2022-07-28 1141 "Failed to probe base mport rc %d; representors will not function\n", 6f6838aabff5ea Edward Cree 2022-07-28 1142 rc); f393f2642abb0e Alejandro Lucero 2023-01-19 1143 } else { f393f2642abb0e Alejandro Lucero 2023-01-19 1144 if (efx_probe_devlink(efx)) f393f2642abb0e Alejandro Lucero 2023-01-19 1145 netif_warn(efx, probe, net_dev, f393f2642abb0e Alejandro Lucero 2023-01-19 1146 "Failed to register devlink\n"); 1542af777ce523 Alejandro Lucero 2023-01-19 1147 rc = efx_init_mae(efx); 1542af777ce523 Alejandro Lucero 2023-01-19 1148 if (rc) 1542af777ce523 Alejandro Lucero 2023-01-19 1149 pci_warn(efx->pci_dev, 1542af777ce523 Alejandro Lucero 2023-01-19 1150 "Failed to init MAE rc %d; representors will not function\n", 1542af777ce523 Alejandro Lucero 2023-01-19 1151 rc); 1542af777ce523 Alejandro Lucero 2023-01-19 1152 else 1542af777ce523 Alejandro Lucero 2023-01-19 1153 efx_ef100_init_reps(efx); 6f6838aabff5ea Edward Cree 2022-07-28 1154 } 67ab160ed08f5b Edward Cree 2022-07-28 1155 67ab160ed08f5b Edward Cree 2022-07-28 1156 rc = efx_init_tc(efx); 67ab160ed08f5b Edward Cree 2022-07-28 1157 if (rc) { 67ab160ed08f5b Edward Cree 2022-07-28 1158 /* Either we don't have an MAE at all (i.e. legacy v-switching), 67ab160ed08f5b Edward Cree 2022-07-28 1159 * or we do but we failed to probe it. In the latter case, we 67ab160ed08f5b Edward Cree 2022-07-28 1160 * may not have set up default rules, in which case we won't be 67ab160ed08f5b Edward Cree 2022-07-28 1161 * able to pass any traffic. However, we don't fail the probe, 67ab160ed08f5b Edward Cree 2022-07-28 1162 * because the user might need to use the netdevice to apply 67ab160ed08f5b Edward Cree 2022-07-28 1163 * configuration changes to fix whatever's wrong with the MAE. 67ab160ed08f5b Edward Cree 2022-07-28 1164 */ 67ab160ed08f5b Edward Cree 2022-07-28 1165 netif_warn(efx, probe, net_dev, "Failed to probe MAE rc %d\n", 67ab160ed08f5b Edward Cree 2022-07-28 1166 rc); 9dc0cad203ab57 Edward Cree 2022-09-26 1167 } else { 9dc0cad203ab57 Edward Cree 2022-09-26 1168 net_dev->features |= NETIF_F_HW_TC; 9dc0cad203ab57 Edward Cree 2022-09-26 1169 efx->fixed_features |= NETIF_F_HW_TC; 67ab160ed08f5b Edward Cree 2022-07-28 1170 } 6f6838aabff5ea Edward Cree 2022-07-28 1171 #endif 29ec1b27e73990 Edward Cree 2020-07-27 @1172 return rc; 51b35a454efdcd Edward Cree 2020-07-27 1173 } 51b35a454efdcd Edward Cree 2020-07-27 1174
On 1/19/2023 3:31 AM, alejandro.lucero-palau@amd.com wrote: > From: Alejandro Lucero <alejandro.lucero-palau@amd.com> > > Getting device mac address is currently based on a specific MCDI command > only available for the PF. This patch changes the MCDI command to a > generic one for PFs and VFs based on a client handle. This allows both > PFs and VFs to ask for their mac address during initialization using the > CLIENT_HANDLE_SELF. > > Moreover, the patch allows other client handles which will be used by > the PF to ask for mac addresses linked to VFs. This is necessary for > suporting the port_function_hw_addr_get devlink function in further > patches. > > Signed-off-by: Alejandro Lucero <alejandro.lucero-palau@amd.com> > --- Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c index 4a5d028f757e..1a1842bd6e12 100644 --- a/drivers/net/ethernet/sfc/ef100_netdev.c +++ b/drivers/net/ethernet/sfc/ef100_netdev.c @@ -360,6 +360,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data) { struct efx_nic *efx = &probe_data->efx; struct efx_probe_data **probe_ptr; + struct ef100_nic_data *nic_data; struct net_device *net_dev; int rc; @@ -411,6 +412,15 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data) /* Don't fail init if RSS setup doesn't work. */ efx_mcdi_push_default_indir_table(efx, efx->n_rx_channels); + nic_data = efx->nic_data; + rc = ef100_get_mac_address(efx, net_dev->perm_addr, CLIENT_HANDLE_SELF, + efx->type->is_vf); + if (rc) + return rc; + /* Assign MAC address */ + eth_hw_addr_set(net_dev, net_dev->perm_addr); + ether_addr_copy(nic_data->port_id, net_dev->perm_addr); + if (!efx->type->is_vf) { rc = ef100_probe_netdev_pf(efx); if (rc) diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index 38c809eb7828..f4e913593f2b 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -131,23 +131,33 @@ static void ef100_mcdi_reboot_detected(struct efx_nic *efx) /* MCDI calls */ -static int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address) +int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address, + int client_handle, bool empty_ok) { - MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_MAC_ADDRESSES_OUT_LEN); + MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CLIENT_MAC_ADDRESSES_OUT_LEN(1)); + MCDI_DECLARE_BUF(inbuf, MC_CMD_GET_CLIENT_MAC_ADDRESSES_IN_LEN); size_t outlen; int rc; BUILD_BUG_ON(MC_CMD_GET_MAC_ADDRESSES_IN_LEN != 0); + MCDI_SET_DWORD(inbuf, GET_CLIENT_MAC_ADDRESSES_IN_CLIENT_HANDLE, + client_handle); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_MAC_ADDRESSES, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_mcdi_rpc(efx, MC_CMD_GET_CLIENT_MAC_ADDRESSES, inbuf, + sizeof(inbuf), outbuf, sizeof(outbuf), &outlen); if (rc) return rc; - if (outlen < MC_CMD_GET_MAC_ADDRESSES_OUT_LEN) - return -EIO; - - ether_addr_copy(mac_address, - MCDI_PTR(outbuf, GET_MAC_ADDRESSES_OUT_MAC_ADDR_BASE)); + if (outlen >= MC_CMD_GET_CLIENT_MAC_ADDRESSES_OUT_LEN(1)) { + ether_addr_copy(mac_address, + MCDI_PTR(outbuf, GET_CLIENT_MAC_ADDRESSES_OUT_MAC_ADDRS)); + } else if (empty_ok) { + pci_warn(efx->pci_dev, + "No MAC address provisioned for client ID %#x.\n", + client_handle); + eth_zero_addr(mac_address); + } else { + return -ENOENT; + } return 0; } @@ -1117,13 +1127,6 @@ int ef100_probe_netdev_pf(struct efx_nic *efx) struct net_device *net_dev = efx->net_dev; int rc; - rc = ef100_get_mac_address(efx, net_dev->perm_addr); - if (rc) - goto fail; - /* Assign MAC address */ - eth_hw_addr_set(net_dev, net_dev->perm_addr); - memcpy(nic_data->port_id, net_dev->perm_addr, ETH_ALEN); - if (!nic_data->grp_mae) return 0; @@ -1166,9 +1169,6 @@ int ef100_probe_netdev_pf(struct efx_nic *efx) efx->fixed_features |= NETIF_F_HW_TC; } #endif - return 0; - -fail: return rc; } diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h index 496aea43c60f..e59044072333 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.h +++ b/drivers/net/ethernet/sfc/ef100_nic.h @@ -92,4 +92,6 @@ int efx_ef100_init_datapath_caps(struct efx_nic *efx); int ef100_phy_probe(struct efx_nic *efx); int ef100_filter_table_probe(struct efx_nic *efx); +int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address, + int client_handle, bool empty_ok); #endif /* EFX_EF100_NIC_H */