Ramaxel inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4OENF CVE: NA
Firmware is responsible for the application and release of RSS module ID. And the driver no longer perceives it .
Signed-off-by: Yanling Song songyl@ramaxel.com Reviewed-by: Yang Gan yanggan@ramaxel.com --- .../net/ethernet/ramaxel/spnic/spnic_main.c | 6 -- .../ramaxel/spnic/spnic_mgmt_interface.h | 12 ---- .../ethernet/ramaxel/spnic/spnic_nic_cfg.c | 16 +++--- .../ethernet/ramaxel/spnic/spnic_nic_cfg.h | 16 ------ .../net/ethernet/ramaxel/spnic/spnic_rss.c | 16 +----- .../ethernet/ramaxel/spnic/spnic_rss_cfg.c | 57 ------------------- 6 files changed, 8 insertions(+), 115 deletions(-)
diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_main.c b/drivers/net/ethernet/ramaxel/spnic/spnic_main.c index f09f11488042..3670d92eaf2a 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_main.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_main.c @@ -350,9 +350,6 @@ static void spnic_sw_deinit(struct spnic_nic_dev *nic_dev) spnic_del_mac(nic_dev->hwdev, nic_dev->netdev->dev_addr, 0, sphw_global_func_id(nic_dev->hwdev), SPHW_CHANNEL_NIC);
- if (test_bit(SPNIC_RSS_ENABLE, &nic_dev->flags)) - spnic_rss_template_free(nic_dev->hwdev); - spnic_clear_rss_config(nic_dev); }
@@ -423,9 +420,6 @@ static int spnic_sw_init(struct spnic_nic_dev *nic_dev) set_mac_err: err_mac: get_mac_err: - - if (test_bit(SPNIC_RSS_ENABLE, &nic_dev->flags)) - spnic_rss_template_free(nic_dev->hwdev); spnic_clear_rss_config(nic_dev);
return err; diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_mgmt_interface.h b/drivers/net/ethernet/ramaxel/spnic/spnic_mgmt_interface.h index 58ab35c18057..720f6fcf5f0a 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_mgmt_interface.h +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_mgmt_interface.h @@ -350,18 +350,6 @@ struct spnic_rss_indir_table { u8 indir[SPNIC_RSS_INDIR_SIZE]; };
-#define NIC_RSS_CMD_TEMP_ALLOC 0x01 -#define NIC_RSS_CMD_TEMP_FREE 0x02 - -struct spnic_rss_template_mgmt { - struct mgmt_msg_head msg_head; - - u16 func_id; - u8 cmd; - u8 template_id; - u8 rsvd1[4]; -}; - #define SPNIC_DCB_UP_MAX 0x8 #define SPNIC_DCB_COS_MAX 0x8 #define SPNIC_DCB_TC_MAX 0x8 diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_nic_cfg.c b/drivers/net/ethernet/ramaxel/spnic/spnic_nic_cfg.c index 5bde91f35cca..24e55c087da5 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_nic_cfg.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_nic_cfg.c @@ -844,6 +844,12 @@ int spnic_init_nic_hwdev(void *hwdev, void *pcidev_hdl, void *dev_hdl, u16 rx_bu goto register_sa_err; }
+ err = spnic_init_function_table(nic_cfg); + if (err) { + nic_err(nic_cfg->dev_hdl, "Failed to init function table\n"); + goto init_func_tbl_err; + } + err = spnic_get_nic_feature(hwdev, &nic_cfg->feature_cap, 1); if (err) { nic_err(nic_cfg->dev_hdl, "Failed to get nic features\n"); @@ -867,22 +873,14 @@ int spnic_init_nic_hwdev(void *hwdev, void *pcidev_hdl, void *dev_hdl, u16 rx_bu
nic_cfg->rx_buff_len = rx_buff_len;
- err = spnic_init_function_table(nic_cfg); - if (err) { - nic_err(nic_cfg->dev_hdl, "Failed to init function table\n"); - goto init_func_tbl_err; - } - return 0;
-init_func_tbl_err: - spnic_vf_func_free(nic_cfg); - vf_init_err: sphw_aeq_unregister_swe_cb(hwdev, SPHW_STATELESS_EVENT);
register_sw_aeqe_err: get_feature_err: +init_func_tbl_err: sphw_unregister_service_adapter(hwdev, SERVICE_T_NIC);
register_sa_err: diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_nic_cfg.h b/drivers/net/ethernet/ramaxel/spnic/spnic_nic_cfg.h index 0872a2f94655..8be8f5334f72 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_nic_cfg.h +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_nic_cfg.h @@ -403,22 +403,6 @@ int spnic_set_vf_link_state(void *hwdev, u16 vf_id, int link); */ int spnic_get_port_info(void *hwdev, struct nic_port_info *port_info, u16 channel);
-/* * - * @brief spnic_rss_template_alloc - alloc rss template table - * @param hwdev: device pointer to hwdev - * @retval zero: success - * @retval non-zero: failure - */ -int spnic_rss_template_alloc(void *hwdev); - -/* * - * @brief spnic_rss_template_free - free rss template table - * @param hwdev: device pointer to hwdev - * @retval zero: success - * @retval non-zero: failure - */ -int spnic_rss_template_free(void *hwdev); - /* * * @brief spnic_set_rss_type - set rss type * @param hwdev: device pointer to hwdev diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c index 86f6f92f669b..956d868df5b5 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c @@ -224,7 +224,7 @@ void spnic_try_to_enable_rss(struct spnic_nic_dev *nic_dev) return;
nic_dev->max_qps = sphw_func_max_nic_qnum(nic_dev->hwdev); - if (nic_dev->max_qps <= 1) + if (nic_dev->max_qps <= 1 || !SPNIC_SUPPORT_RSS(nic_dev->hwdev)) goto set_q_params;
err = alloc_rss_resource(nic_dev); @@ -233,17 +233,6 @@ void spnic_try_to_enable_rss(struct spnic_nic_dev *nic_dev) goto set_q_params; }
- err = spnic_rss_template_alloc(nic_dev->hwdev); - if (err) { - if (err == -ENOSPC) - nic_err(&nic_dev->pdev->dev, "Failed to alloc template for rss, table is full\n"); - else - nic_err(&nic_dev->pdev->dev, "Failed to alloc template for rss, can't enable rss for this function\n"); - spnic_clear_rss_config(nic_dev); - nic_dev->max_qps = 1; - goto set_q_params; - } - set_bit(SPNIC_RSS_ENABLE, &nic_dev->flags); nic_dev->max_qps = sphw_func_max_nic_qnum(nic_dev->hwdev);
@@ -258,9 +247,6 @@ void spnic_try_to_enable_rss(struct spnic_nic_dev *nic_dev) nic_err(&nic_dev->pdev->dev, "Failed to set hardware rss parameters\n");
spnic_clear_rss_config(nic_dev); - err = spnic_rss_template_free(nic_dev->hwdev); - if (err) - return; nic_dev->max_qps = 1; goto set_q_params; } diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_rss_cfg.c b/drivers/net/ethernet/ramaxel/spnic/spnic_rss_cfg.c index b5be80cc304f..12da3aa59400 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_rss_cfg.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_rss_cfg.c @@ -18,63 +18,6 @@ #include "spnic_nic.h" #include "sphw_common.h"
-int spnic_rss_template_alloc(void *hwdev) -{ - struct spnic_rss_template_mgmt template_mgmt; - struct spnic_nic_cfg *nic_cfg = NULL; - u16 out_size = sizeof(template_mgmt); - int err; - - if (!hwdev) - return -EINVAL; - - nic_cfg = sphw_get_service_adapter(hwdev, SERVICE_T_NIC); - - memset(&template_mgmt, 0, sizeof(struct spnic_rss_template_mgmt)); - - template_mgmt.func_id = sphw_global_func_id(hwdev); - template_mgmt.cmd = NIC_RSS_CMD_TEMP_ALLOC; - - err = l2nic_msg_to_mgmt_sync(hwdev, SPNIC_NIC_CMD_RSS_TEMP_MGR, - &template_mgmt, sizeof(template_mgmt), - &template_mgmt, &out_size); - if (err || !out_size || template_mgmt.msg_head.status) { - nic_err(nic_cfg->dev_hdl, "Failed to alloc rss template, err: %d, status: 0x%x, out size: 0x%x\n", - err, template_mgmt.msg_head.status, out_size); - return -EINVAL; - } - - return 0; -} - -int spnic_rss_template_free(void *hwdev) -{ - struct spnic_rss_template_mgmt template_mgmt; - struct spnic_nic_cfg *nic_cfg = NULL; - u16 out_size = sizeof(template_mgmt); - int err; - - if (!hwdev) - return -EINVAL; - - nic_cfg = sphw_get_service_adapter(hwdev, SERVICE_T_NIC); - memset(&template_mgmt, 0, sizeof(struct spnic_rss_template_mgmt)); - - template_mgmt.func_id = sphw_global_func_id(hwdev); - template_mgmt.cmd = NIC_RSS_CMD_TEMP_FREE; - - err = l2nic_msg_to_mgmt_sync(hwdev, SPNIC_NIC_CMD_RSS_TEMP_MGR, - &template_mgmt, sizeof(template_mgmt), - &template_mgmt, &out_size); - if (err || !out_size || template_mgmt.msg_head.status) { - nic_err(nic_cfg->dev_hdl, "Failed to free rss template, err: %d, status: 0x%x, out size: 0x%x\n", - err, template_mgmt.msg_head.status, out_size); - return -EINVAL; - } - - return 0; -} - static int spnic_rss_cfg_hash_key(struct spnic_nic_cfg *nic_cfg, u8 opcode, u8 *key) { struct spnic_cmd_rss_hash_key hash_key;