
From: Chiqijun <chiqijun@huawei.com> driver inclusion category: bugfix bugzilla: 4472 ----------------------------------------------------------------------- Hardware rx csum offload is a chip-level configuration, and VF is not allowed to turn it off. The force packet drop configuration is at the port level, VF can only configure the corresponding port. Signed-off-by: Chiqijun <chiqijun@huawei.com> Reviewed-by: Wangxiaoyun <cloud.wangxiaoyun@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- .../net/ethernet/huawei/hinic/hinic_mbox.c | 2 ++ .../net/ethernet/huawei/hinic/hinic_nic_cfg.c | 29 ++++++++++++++++++- .../net/ethernet/huawei/hinic/hinic_nic_cfg.h | 2 ++ drivers/net/ethernet/huawei/hinic/hinic_rx.h | 2 -- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_mbox.c b/drivers/net/ethernet/huawei/hinic/hinic_mbox.c index 24f119bb5938..c2a07565fc54 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_mbox.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_mbox.c @@ -589,6 +589,8 @@ bool hinic_mbox_check_cmd_valid(struct hinic_hwdev *hwdev, } } + sdk_err(hwdev->dev_hdl, "Unsupported vf cmd %d\n", cmd); + return false; } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c index fbc7c9d1cb3c..921c8baef204 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c @@ -69,6 +69,32 @@ static bool check_func_table(struct hinic_hwdev *hwdev, u16 func_idx, return true; } +static bool check_rxcsum_setting(struct hinic_hwdev *hwdev, u16 func_idx, + void *buf_in, u16 in_size) +{ + struct hinic_checksum_offload *rx_csum_cfg = NULL; + + if (!hinic_mbox_check_func_id_8B(hwdev, func_idx, buf_in, in_size)) + return false; + + rx_csum_cfg = buf_in; + if (rx_csum_cfg->rx_csum_offload != HINIC_RX_CSUM_OFFLOAD_EN) + return false; + + return true; +} + +static bool check_force_pkt_drop(struct hinic_hwdev *hwdev, u16 func_idx, + void *buf_in, u16 in_size) +{ + struct hinic_force_pkt_drop *pkt_drop = buf_in; + + if (pkt_drop->port != hinic_physical_port_id(hwdev)) + return false; + + return true; +} + struct vf_cmd_check_handle nic_cmd_support_vf[] = { {HINIC_PORT_CMD_VF_REGISTER, NULL}, {HINIC_PORT_CMD_VF_UNREGISTER, NULL}, @@ -88,7 +114,7 @@ struct vf_cmd_check_handle nic_cmd_support_vf[] = { {HINIC_PORT_CMD_GET_LINK_STATE, hinic_mbox_check_func_id_8B}, {HINIC_PORT_CMD_SET_LRO, hinic_mbox_check_func_id_8B}, - {HINIC_PORT_CMD_SET_RX_CSUM, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_SET_RX_CSUM, check_rxcsum_setting}, {HINIC_PORT_CMD_SET_RX_VLAN_OFFLOAD, hinic_mbox_check_func_id_8B}, {HINIC_PORT_CMD_GET_VPORT_STAT, hinic_mbox_check_func_id_8B}, @@ -139,6 +165,7 @@ struct vf_cmd_check_handle nic_cmd_support_vf[] = { {HINIC_PORT_CMD_SET_VHD_CFG, hinic_mbox_check_func_id_8B}, {HINIC_PORT_CMD_SET_VLAN_FILTER, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_FORCE_PKT_DROP, check_force_pkt_drop}, }; int hinic_init_function_table(void *hwdev, u16 rx_buf_sz) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h index f0810b201d51..08bb4404e7cf 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h @@ -425,6 +425,8 @@ enum hinic_lro_en_status { #define HINIC_VLAN_FILTER_EN (1U << 0) #define HINIC_BROADCAST_FILTER_EX_EN (1U << 1) +#define HINIC_RX_CSUM_OFFLOAD_EN 0xFFF + /* Set mac_vlan table */ int hinic_set_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.h b/drivers/net/ethernet/huawei/hinic/hinic_rx.h index 11c68c09835b..09f8784157cf 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.h @@ -27,8 +27,6 @@ #define HINIC_RX_CSUM_HW_CHECK_NONE BIT(7) #define HINIC_RX_CSUM_IPSU_OTHER_ERR BIT(8) -#define HINIC_RX_CSUM_OFFLOAD_EN 0xFFF - #define HINIC_SUPPORT_LRO_ADAP_QPS_MAX 16 #define HINIC_RX_BUFFER_WRITE 16 -- 2.25.1