Commit 1c3dc891 authored by David S. Miller's avatar David S. Miller

Merge branch 'hns3-cleanups'

Yunsheng Lin says:

====================
A few cleanup for hns3 ethernet driver

This patchset contains a few cleanup for hns3 ethernet driver.
No functional change intended.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c49c777f 1db9b1bf
...@@ -208,7 +208,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num) ...@@ -208,7 +208,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
* which will be use for hardware to write back * which will be use for hardware to write back
*/ */
ntc = hw->cmq.csq.next_to_use; ntc = hw->cmq.csq.next_to_use;
opcode = desc[0].opcode; opcode = le16_to_cpu(desc[0].opcode);
while (handle < num) { while (handle < num) {
desc_to_use = &hw->cmq.csq.desc[hw->cmq.csq.next_to_use]; desc_to_use = &hw->cmq.csq.desc[hw->cmq.csq.next_to_use];
*desc_to_use = desc[handle]; *desc_to_use = desc[handle];
...@@ -225,7 +225,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num) ...@@ -225,7 +225,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
* If the command is sync, wait for the firmware to write back, * If the command is sync, wait for the firmware to write back,
* if multi descriptors to be sent, use the first one to check * if multi descriptors to be sent, use the first one to check
*/ */
if (HCLGE_SEND_SYNC(desc->flag)) { if (HCLGE_SEND_SYNC(le16_to_cpu(desc->flag))) {
do { do {
if (hclge_cmd_csq_done(hw)) if (hclge_cmd_csq_done(hw))
break; break;
...@@ -244,9 +244,9 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num) ...@@ -244,9 +244,9 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
pr_debug("Get cmd desc:\n"); pr_debug("Get cmd desc:\n");
if (likely(!hclge_is_special_opcode(opcode))) if (likely(!hclge_is_special_opcode(opcode)))
desc_ret = desc[handle].retval; desc_ret = le16_to_cpu(desc[handle].retval);
else else
desc_ret = desc[0].retval; desc_ret = le16_to_cpu(desc[0].retval);
if ((enum hclge_cmd_return_status)desc_ret == if ((enum hclge_cmd_return_status)desc_ret ==
HCLGE_CMD_EXEC_SUCCESS) HCLGE_CMD_EXEC_SUCCESS)
...@@ -276,15 +276,15 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num) ...@@ -276,15 +276,15 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
return retval; return retval;
} }
enum hclge_cmd_status hclge_cmd_query_firmware_version(struct hclge_hw *hw, static enum hclge_cmd_status hclge_cmd_query_firmware_version(
u32 *version) struct hclge_hw *hw, u32 *version)
{ {
struct hclge_query_version *resp; struct hclge_query_version_cmd *resp;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_FW_VER, 1); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_FW_VER, 1);
resp = (struct hclge_query_version *)desc.data; resp = (struct hclge_query_version_cmd *)desc.data;
ret = hclge_cmd_send(hw, &desc, 1); ret = hclge_cmd_send(hw, &desc, 1);
if (!ret) if (!ret)
......
...@@ -221,12 +221,12 @@ enum hclge_opcode_type { ...@@ -221,12 +221,12 @@ enum hclge_opcode_type {
#define HCLGE_RCB_INIT_QUERY_TIMEOUT 10 #define HCLGE_RCB_INIT_QUERY_TIMEOUT 10
#define HCLGE_RCB_INIT_FLAG_EN_B 0 #define HCLGE_RCB_INIT_FLAG_EN_B 0
#define HCLGE_RCB_INIT_FLAG_FINI_B 8 #define HCLGE_RCB_INIT_FLAG_FINI_B 8
struct hclge_config_rcb_init { struct hclge_config_rcb_init_cmd {
__le16 rcb_init_flag; __le16 rcb_init_flag;
u8 rsv[22]; u8 rsv[22];
}; };
struct hclge_tqp_map { struct hclge_tqp_map_cmd {
__le16 tqp_id; /* Absolute tqp id for in this pf */ __le16 tqp_id; /* Absolute tqp id for in this pf */
u8 tqp_vf; /* VF id */ u8 tqp_vf; /* VF id */
#define HCLGE_TQP_MAP_TYPE_PF 0 #define HCLGE_TQP_MAP_TYPE_PF 0
...@@ -246,15 +246,15 @@ enum hclge_int_type { ...@@ -246,15 +246,15 @@ enum hclge_int_type {
HCLGE_INT_EVENT, HCLGE_INT_EVENT,
}; };
struct hclge_ctrl_vector_chain { struct hclge_ctrl_vector_chain_cmd {
u8 int_vector_id; u8 int_vector_id;
u8 int_cause_num; u8 int_cause_num;
#define HCLGE_INT_TYPE_S 0 #define HCLGE_INT_TYPE_S 0
#define HCLGE_INT_TYPE_M 0x3 #define HCLGE_INT_TYPE_M GENMASK(1, 0)
#define HCLGE_TQP_ID_S 2 #define HCLGE_TQP_ID_S 2
#define HCLGE_TQP_ID_M (0x7ff << HCLGE_TQP_ID_S) #define HCLGE_TQP_ID_M GENMASK(12, 2)
#define HCLGE_INT_GL_IDX_S 13 #define HCLGE_INT_GL_IDX_S 13
#define HCLGE_INT_GL_IDX_M (0x3 << HCLGE_INT_GL_IDX_S) #define HCLGE_INT_GL_IDX_M GENMASK(14, 13)
__le16 tqp_type_and_id[HCLGE_VECTOR_ELEMENTS_PER_CMD]; __le16 tqp_type_and_id[HCLGE_VECTOR_ELEMENTS_PER_CMD];
u8 vfid; u8 vfid;
u8 rsv; u8 rsv;
...@@ -263,18 +263,18 @@ struct hclge_ctrl_vector_chain { ...@@ -263,18 +263,18 @@ struct hclge_ctrl_vector_chain {
#define HCLGE_TC_NUM 8 #define HCLGE_TC_NUM 8
#define HCLGE_TC0_PRI_BUF_EN_B 15 /* Bit 15 indicate enable or not */ #define HCLGE_TC0_PRI_BUF_EN_B 15 /* Bit 15 indicate enable or not */
#define HCLGE_BUF_UNIT_S 7 /* Buf size is united by 128 bytes */ #define HCLGE_BUF_UNIT_S 7 /* Buf size is united by 128 bytes */
struct hclge_tx_buff_alloc { struct hclge_tx_buff_alloc_cmd {
__le16 tx_pkt_buff[HCLGE_TC_NUM]; __le16 tx_pkt_buff[HCLGE_TC_NUM];
u8 tx_buff_rsv[8]; u8 tx_buff_rsv[8];
}; };
struct hclge_rx_priv_buff { struct hclge_rx_priv_buff_cmd {
__le16 buf_num[HCLGE_TC_NUM]; __le16 buf_num[HCLGE_TC_NUM];
__le16 shared_buf; __le16 shared_buf;
u8 rsv[6]; u8 rsv[6];
}; };
struct hclge_query_version { struct hclge_query_version_cmd {
__le32 firmware; __le32 firmware;
__le32 firmware_rsv[5]; __le32 firmware_rsv[5];
}; };
...@@ -328,14 +328,14 @@ struct hclge_pkt_buf_alloc { ...@@ -328,14 +328,14 @@ struct hclge_pkt_buf_alloc {
}; };
#define HCLGE_RX_COM_WL_EN_B 15 #define HCLGE_RX_COM_WL_EN_B 15
struct hclge_rx_com_wl_buf { struct hclge_rx_com_wl_buf_cmd {
__le16 high_wl; __le16 high_wl;
__le16 low_wl; __le16 low_wl;
u8 rsv[20]; u8 rsv[20];
}; };
#define HCLGE_RX_PKT_EN_B 15 #define HCLGE_RX_PKT_EN_B 15
struct hclge_rx_pkt_buf { struct hclge_rx_pkt_buf_cmd {
__le16 high_pkt; __le16 high_pkt;
__le16 low_pkt; __le16 low_pkt;
u8 rsv[20]; u8 rsv[20];
...@@ -348,7 +348,7 @@ struct hclge_rx_pkt_buf { ...@@ -348,7 +348,7 @@ struct hclge_rx_pkt_buf {
#define HCLGE_PF_MAC_NUM_MASK 0x3 #define HCLGE_PF_MAC_NUM_MASK 0x3
#define HCLGE_PF_STATE_MAIN BIT(HCLGE_PF_STATE_MAIN_B) #define HCLGE_PF_STATE_MAIN BIT(HCLGE_PF_STATE_MAIN_B)
#define HCLGE_PF_STATE_DONE BIT(HCLGE_PF_STATE_DONE_B) #define HCLGE_PF_STATE_DONE BIT(HCLGE_PF_STATE_DONE_B)
struct hclge_func_status { struct hclge_func_status_cmd {
__le32 vf_rst_state[4]; __le32 vf_rst_state[4];
u8 pf_state; u8 pf_state;
u8 mac_id; u8 mac_id;
...@@ -359,7 +359,7 @@ struct hclge_func_status { ...@@ -359,7 +359,7 @@ struct hclge_func_status {
u8 rsv[2]; u8 rsv[2];
}; };
struct hclge_pf_res { struct hclge_pf_res_cmd {
__le16 tqp_num; __le16 tqp_num;
__le16 buf_size; __le16 buf_size;
__le16 msixcap_localid_ba_nic; __le16 msixcap_localid_ba_nic;
...@@ -372,30 +372,30 @@ struct hclge_pf_res { ...@@ -372,30 +372,30 @@ struct hclge_pf_res {
}; };
#define HCLGE_CFG_OFFSET_S 0 #define HCLGE_CFG_OFFSET_S 0
#define HCLGE_CFG_OFFSET_M 0xfffff /* Byte (8-10.3) */ #define HCLGE_CFG_OFFSET_M GENMASK(19, 0)
#define HCLGE_CFG_RD_LEN_S 24 #define HCLGE_CFG_RD_LEN_S 24
#define HCLGE_CFG_RD_LEN_M (0xf << HCLGE_CFG_RD_LEN_S) #define HCLGE_CFG_RD_LEN_M GENMASK(27, 24)
#define HCLGE_CFG_RD_LEN_BYTES 16 #define HCLGE_CFG_RD_LEN_BYTES 16
#define HCLGE_CFG_RD_LEN_UNIT 4 #define HCLGE_CFG_RD_LEN_UNIT 4
#define HCLGE_CFG_VMDQ_S 0 #define HCLGE_CFG_VMDQ_S 0
#define HCLGE_CFG_VMDQ_M (0xff << HCLGE_CFG_VMDQ_S) #define HCLGE_CFG_VMDQ_M GENMASK(7, 0)
#define HCLGE_CFG_TC_NUM_S 8 #define HCLGE_CFG_TC_NUM_S 8
#define HCLGE_CFG_TC_NUM_M (0xff << HCLGE_CFG_TC_NUM_S) #define HCLGE_CFG_TC_NUM_M GENMASK(15, 8)
#define HCLGE_CFG_TQP_DESC_N_S 16 #define HCLGE_CFG_TQP_DESC_N_S 16
#define HCLGE_CFG_TQP_DESC_N_M (0xffff << HCLGE_CFG_TQP_DESC_N_S) #define HCLGE_CFG_TQP_DESC_N_M GENMASK(31, 16)
#define HCLGE_CFG_PHY_ADDR_S 0 #define HCLGE_CFG_PHY_ADDR_S 0
#define HCLGE_CFG_PHY_ADDR_M (0x1f << HCLGE_CFG_PHY_ADDR_S) #define HCLGE_CFG_PHY_ADDR_M GENMASK(4, 0)
#define HCLGE_CFG_MEDIA_TP_S 8 #define HCLGE_CFG_MEDIA_TP_S 8
#define HCLGE_CFG_MEDIA_TP_M (0xff << HCLGE_CFG_MEDIA_TP_S) #define HCLGE_CFG_MEDIA_TP_M GENMASK(15, 8)
#define HCLGE_CFG_RX_BUF_LEN_S 16 #define HCLGE_CFG_RX_BUF_LEN_S 16
#define HCLGE_CFG_RX_BUF_LEN_M (0xffff << HCLGE_CFG_RX_BUF_LEN_S) #define HCLGE_CFG_RX_BUF_LEN_M GENMASK(31, 16)
#define HCLGE_CFG_MAC_ADDR_H_S 0 #define HCLGE_CFG_MAC_ADDR_H_S 0
#define HCLGE_CFG_MAC_ADDR_H_M (0xffff << HCLGE_CFG_MAC_ADDR_H_S) #define HCLGE_CFG_MAC_ADDR_H_M GENMASK(15, 0)
#define HCLGE_CFG_DEFAULT_SPEED_S 16 #define HCLGE_CFG_DEFAULT_SPEED_S 16
#define HCLGE_CFG_DEFAULT_SPEED_M (0xff << HCLGE_CFG_DEFAULT_SPEED_S) #define HCLGE_CFG_DEFAULT_SPEED_M GENMASK(23, 16)
struct hclge_cfg_param { struct hclge_cfg_param_cmd {
__le32 offset; __le32 offset;
__le32 rsv; __le32 rsv;
__le32 param[4]; __le32 param[4];
...@@ -405,7 +405,7 @@ struct hclge_cfg_param { ...@@ -405,7 +405,7 @@ struct hclge_cfg_param {
#define HCLGE_DESC_NUM 0x40 #define HCLGE_DESC_NUM 0x40
#define HCLGE_ALLOC_VALID_B 0 #define HCLGE_ALLOC_VALID_B 0
struct hclge_vf_num { struct hclge_vf_num_cmd {
u8 alloc_valid; u8 alloc_valid;
u8 rsv[23]; u8 rsv[23];
}; };
...@@ -413,13 +413,13 @@ struct hclge_vf_num { ...@@ -413,13 +413,13 @@ struct hclge_vf_num {
#define HCLGE_RSS_DEFAULT_OUTPORT_B 4 #define HCLGE_RSS_DEFAULT_OUTPORT_B 4
#define HCLGE_RSS_HASH_KEY_OFFSET_B 4 #define HCLGE_RSS_HASH_KEY_OFFSET_B 4
#define HCLGE_RSS_HASH_KEY_NUM 16 #define HCLGE_RSS_HASH_KEY_NUM 16
struct hclge_rss_config { struct hclge_rss_config_cmd {
u8 hash_config; u8 hash_config;
u8 rsv[7]; u8 rsv[7];
u8 hash_key[HCLGE_RSS_HASH_KEY_NUM]; u8 hash_key[HCLGE_RSS_HASH_KEY_NUM];
}; };
struct hclge_rss_input_tuple { struct hclge_rss_input_tuple_cmd {
u8 ipv4_tcp_en; u8 ipv4_tcp_en;
u8 ipv4_udp_en; u8 ipv4_udp_en;
u8 ipv4_sctp_en; u8 ipv4_sctp_en;
...@@ -433,26 +433,26 @@ struct hclge_rss_input_tuple { ...@@ -433,26 +433,26 @@ struct hclge_rss_input_tuple {
#define HCLGE_RSS_CFG_TBL_SIZE 16 #define HCLGE_RSS_CFG_TBL_SIZE 16
struct hclge_rss_indirection_table { struct hclge_rss_indirection_table_cmd {
u16 start_table_index; __le16 start_table_index;
u16 rss_set_bitmap; __le16 rss_set_bitmap;
u8 rsv[4]; u8 rsv[4];
u8 rss_result[HCLGE_RSS_CFG_TBL_SIZE]; u8 rss_result[HCLGE_RSS_CFG_TBL_SIZE];
}; };
#define HCLGE_RSS_TC_OFFSET_S 0 #define HCLGE_RSS_TC_OFFSET_S 0
#define HCLGE_RSS_TC_OFFSET_M (0x3ff << HCLGE_RSS_TC_OFFSET_S) #define HCLGE_RSS_TC_OFFSET_M GENMASK(9, 0)
#define HCLGE_RSS_TC_SIZE_S 12 #define HCLGE_RSS_TC_SIZE_S 12
#define HCLGE_RSS_TC_SIZE_M (0x7 << HCLGE_RSS_TC_SIZE_S) #define HCLGE_RSS_TC_SIZE_M GENMASK(14, 12)
#define HCLGE_RSS_TC_VALID_B 15 #define HCLGE_RSS_TC_VALID_B 15
struct hclge_rss_tc_mode { struct hclge_rss_tc_mode_cmd {
u16 rss_tc_mode[HCLGE_MAX_TC_NUM]; __le16 rss_tc_mode[HCLGE_MAX_TC_NUM];
u8 rsv[8]; u8 rsv[8];
}; };
#define HCLGE_LINK_STS_B 0 #define HCLGE_LINK_STS_B 0
#define HCLGE_LINK_STATUS BIT(HCLGE_LINK_STS_B) #define HCLGE_LINK_STATUS BIT(HCLGE_LINK_STS_B)
struct hclge_link_status { struct hclge_link_status_cmd {
u8 status; u8 status;
u8 rsv[23]; u8 rsv[23];
}; };
...@@ -467,7 +467,7 @@ struct hclge_promisc_param { ...@@ -467,7 +467,7 @@ struct hclge_promisc_param {
#define HCLGE_PROMISC_EN_UC 0x1 #define HCLGE_PROMISC_EN_UC 0x1
#define HCLGE_PROMISC_EN_MC 0x2 #define HCLGE_PROMISC_EN_MC 0x2
#define HCLGE_PROMISC_EN_BC 0x4 #define HCLGE_PROMISC_EN_BC 0x4
struct hclge_promisc_cfg { struct hclge_promisc_cfg_cmd {
u8 flag; u8 flag;
u8 vf_id; u8 vf_id;
__le16 rsv0; __le16 rsv0;
...@@ -495,18 +495,18 @@ enum hclge_promisc_type { ...@@ -495,18 +495,18 @@ enum hclge_promisc_type {
#define HCLGE_MAC_TX_UNDER_MIN_ERR_B 21 #define HCLGE_MAC_TX_UNDER_MIN_ERR_B 21
#define HCLGE_MAC_TX_OVERSIZE_TRUNCATE_B 22 #define HCLGE_MAC_TX_OVERSIZE_TRUNCATE_B 22
struct hclge_config_mac_mode { struct hclge_config_mac_mode_cmd {
__le32 txrx_pad_fcs_loop_en; __le32 txrx_pad_fcs_loop_en;
u8 rsv[20]; u8 rsv[20];
}; };
#define HCLGE_CFG_SPEED_S 0 #define HCLGE_CFG_SPEED_S 0
#define HCLGE_CFG_SPEED_M (0x3f << HCLGE_CFG_SPEED_S) #define HCLGE_CFG_SPEED_M GENMASK(5, 0)
#define HCLGE_CFG_DUPLEX_B 7 #define HCLGE_CFG_DUPLEX_B 7
#define HCLGE_CFG_DUPLEX_M BIT(HCLGE_CFG_DUPLEX_B) #define HCLGE_CFG_DUPLEX_M BIT(HCLGE_CFG_DUPLEX_B)
struct hclge_config_mac_speed_dup { struct hclge_config_mac_speed_dup_cmd {
u8 speed_dup; u8 speed_dup;
#define HCLGE_CFG_MAC_SPEED_CHANGE_EN_B 0 #define HCLGE_CFG_MAC_SPEED_CHANGE_EN_B 0
...@@ -518,17 +518,17 @@ struct hclge_config_mac_speed_dup { ...@@ -518,17 +518,17 @@ struct hclge_config_mac_speed_dup {
#define HCLGE_QUERY_AN_B 0 #define HCLGE_QUERY_AN_B 0
#define HCLGE_QUERY_DUPLEX_B 2 #define HCLGE_QUERY_DUPLEX_B 2
#define HCLGE_QUERY_SPEED_M (0x1f << HCLGE_QUERY_SPEED_S) #define HCLGE_QUERY_SPEED_M GENMASK(4, 0)
#define HCLGE_QUERY_AN_M BIT(HCLGE_QUERY_AN_B) #define HCLGE_QUERY_AN_M BIT(HCLGE_QUERY_AN_B)
#define HCLGE_QUERY_DUPLEX_M BIT(HCLGE_QUERY_DUPLEX_B) #define HCLGE_QUERY_DUPLEX_M BIT(HCLGE_QUERY_DUPLEX_B)
struct hclge_query_an_speed_dup { struct hclge_query_an_speed_dup_cmd {
u8 an_syn_dup_speed; u8 an_syn_dup_speed;
u8 pause; u8 pause;
u8 rsv[23]; u8 rsv[23];
}; };
#define HCLGE_RING_ID_MASK 0x3ff #define HCLGE_RING_ID_MASK GENMASK(9, 0)
#define HCLGE_TQP_ENABLE_B 0 #define HCLGE_TQP_ENABLE_B 0
#define HCLGE_MAC_CFG_AN_EN_B 0 #define HCLGE_MAC_CFG_AN_EN_B 0
...@@ -539,7 +539,7 @@ struct hclge_query_an_speed_dup { ...@@ -539,7 +539,7 @@ struct hclge_query_an_speed_dup {
#define HCLGE_MAC_CFG_AN_EN BIT(HCLGE_MAC_CFG_AN_EN_B) #define HCLGE_MAC_CFG_AN_EN BIT(HCLGE_MAC_CFG_AN_EN_B)
struct hclge_config_auto_neg { struct hclge_config_auto_neg_cmd {
__le32 cfg_an_cmd_flag; __le32 cfg_an_cmd_flag;
u8 rsv[20]; u8 rsv[20];
}; };
...@@ -548,7 +548,7 @@ struct hclge_config_auto_neg { ...@@ -548,7 +548,7 @@ struct hclge_config_auto_neg {
#define HCLGE_MAC_MAX_MTU 9728 #define HCLGE_MAC_MAX_MTU 9728
#define HCLGE_MAC_UPLINK_PORT 0x100 #define HCLGE_MAC_UPLINK_PORT 0x100
struct hclge_config_max_frm_size { struct hclge_config_max_frm_size_cmd {
__le16 max_frm_size; __le16 max_frm_size;
u8 rsv[22]; u8 rsv[22];
}; };
...@@ -565,10 +565,10 @@ enum hclge_mac_vlan_tbl_opcode { ...@@ -565,10 +565,10 @@ enum hclge_mac_vlan_tbl_opcode {
#define HCLGE_MAC_EPORT_SW_EN_B 0xc #define HCLGE_MAC_EPORT_SW_EN_B 0xc
#define HCLGE_MAC_EPORT_TYPE_B 0xb #define HCLGE_MAC_EPORT_TYPE_B 0xb
#define HCLGE_MAC_EPORT_VFID_S 0x3 #define HCLGE_MAC_EPORT_VFID_S 0x3
#define HCLGE_MAC_EPORT_VFID_M (0xff << HCLGE_MAC_EPORT_VFID_S) #define HCLGE_MAC_EPORT_VFID_M GENMASK(10, 3)
#define HCLGE_MAC_EPORT_PFID_S 0x0 #define HCLGE_MAC_EPORT_PFID_S 0x0
#define HCLGE_MAC_EPORT_PFID_M (0x7 << HCLGE_MAC_EPORT_PFID_S) #define HCLGE_MAC_EPORT_PFID_M GENMASK(2, 0)
struct hclge_mac_vlan_tbl_entry { struct hclge_mac_vlan_tbl_entry_cmd {
u8 flags; u8 flags;
u8 resp_code; u8 resp_code;
__le16 vlan_tag; __le16 vlan_tag;
...@@ -583,15 +583,15 @@ struct hclge_mac_vlan_tbl_entry { ...@@ -583,15 +583,15 @@ struct hclge_mac_vlan_tbl_entry {
}; };
#define HCLGE_CFG_MTA_MAC_SEL_S 0x0 #define HCLGE_CFG_MTA_MAC_SEL_S 0x0
#define HCLGE_CFG_MTA_MAC_SEL_M (0x3 << HCLGE_CFG_MTA_MAC_SEL_S) #define HCLGE_CFG_MTA_MAC_SEL_M GENMASK(1, 0)
#define HCLGE_CFG_MTA_MAC_EN_B 0x7 #define HCLGE_CFG_MTA_MAC_EN_B 0x7
struct hclge_mta_filter_mode { struct hclge_mta_filter_mode_cmd {
u8 dmac_sel_en; /* Use lowest 2 bit as sel_mode, bit 7 as enable */ u8 dmac_sel_en; /* Use lowest 2 bit as sel_mode, bit 7 as enable */
u8 rsv[23]; u8 rsv[23];
}; };
#define HCLGE_CFG_FUNC_MTA_ACCEPT_B 0x0 #define HCLGE_CFG_FUNC_MTA_ACCEPT_B 0x0
struct hclge_cfg_func_mta_filter { struct hclge_cfg_func_mta_filter_cmd {
u8 accept; /* Only used lowest 1 bit */ u8 accept; /* Only used lowest 1 bit */
u8 function_id; u8 function_id;
u8 rsv[22]; u8 rsv[22];
...@@ -599,14 +599,14 @@ struct hclge_cfg_func_mta_filter { ...@@ -599,14 +599,14 @@ struct hclge_cfg_func_mta_filter {
#define HCLGE_CFG_MTA_ITEM_ACCEPT_B 0x0 #define HCLGE_CFG_MTA_ITEM_ACCEPT_B 0x0
#define HCLGE_CFG_MTA_ITEM_IDX_S 0x0 #define HCLGE_CFG_MTA_ITEM_IDX_S 0x0
#define HCLGE_CFG_MTA_ITEM_IDX_M (0xfff << HCLGE_CFG_MTA_ITEM_IDX_S) #define HCLGE_CFG_MTA_ITEM_IDX_M GENMASK(11, 0)
struct hclge_cfg_func_mta_item { struct hclge_cfg_func_mta_item_cmd {
u16 item_idx; /* Only used lowest 12 bit */ __le16 item_idx; /* Only used lowest 12 bit */
u8 accept; /* Only used lowest 1 bit */ u8 accept; /* Only used lowest 1 bit */
u8 rsv[21]; u8 rsv[21];
}; };
struct hclge_mac_vlan_add { struct hclge_mac_vlan_add_cmd {
__le16 flags; __le16 flags;
__le16 mac_addr_hi16; __le16 mac_addr_hi16;
__le32 mac_addr_lo32; __le32 mac_addr_lo32;
...@@ -619,7 +619,7 @@ struct hclge_mac_vlan_add { ...@@ -619,7 +619,7 @@ struct hclge_mac_vlan_add {
}; };
#define HNS3_MAC_VLAN_CFG_FLAG_BIT 0 #define HNS3_MAC_VLAN_CFG_FLAG_BIT 0
struct hclge_mac_vlan_remove { struct hclge_mac_vlan_remove_cmd {
__le16 flags; __le16 flags;
__le16 mac_addr_hi16; __le16 mac_addr_hi16;
__le32 mac_addr_lo32; __le32 mac_addr_lo32;
...@@ -631,21 +631,21 @@ struct hclge_mac_vlan_remove { ...@@ -631,21 +631,21 @@ struct hclge_mac_vlan_remove {
u8 rsv[4]; u8 rsv[4];
}; };
struct hclge_vlan_filter_ctrl { struct hclge_vlan_filter_ctrl_cmd {
u8 vlan_type; u8 vlan_type;
u8 vlan_fe; u8 vlan_fe;
u8 rsv[22]; u8 rsv[22];
}; };
struct hclge_vlan_filter_pf_cfg { struct hclge_vlan_filter_pf_cfg_cmd {
u8 vlan_offset; u8 vlan_offset;
u8 vlan_cfg; u8 vlan_cfg;
u8 rsv[2]; u8 rsv[2];
u8 vlan_offset_bitmap[20]; u8 vlan_offset_bitmap[20];
}; };
struct hclge_vlan_filter_vf_cfg { struct hclge_vlan_filter_vf_cfg_cmd {
u16 vlan_id; __le16 vlan_id;
u8 resp_code; u8 resp_code;
u8 rsv; u8 rsv;
u8 vlan_cfg; u8 vlan_cfg;
...@@ -653,14 +653,14 @@ struct hclge_vlan_filter_vf_cfg { ...@@ -653,14 +653,14 @@ struct hclge_vlan_filter_vf_cfg {
u8 vf_bitmap[16]; u8 vf_bitmap[16];
}; };
struct hclge_cfg_com_tqp_queue { struct hclge_cfg_com_tqp_queue_cmd {
__le16 tqp_id; __le16 tqp_id;
__le16 stream_id; __le16 stream_id;
u8 enable; u8 enable;
u8 rsv[19]; u8 rsv[19];
}; };
struct hclge_cfg_tx_queue_pointer { struct hclge_cfg_tx_queue_pointer_cmd {
__le16 tqp_id; __le16 tqp_id;
__le16 tx_tail; __le16 tx_tail;
__le16 tx_head; __le16 tx_head;
...@@ -670,12 +670,12 @@ struct hclge_cfg_tx_queue_pointer { ...@@ -670,12 +670,12 @@ struct hclge_cfg_tx_queue_pointer {
}; };
#define HCLGE_TSO_MSS_MIN_S 0 #define HCLGE_TSO_MSS_MIN_S 0
#define HCLGE_TSO_MSS_MIN_M (0x3FFF << HCLGE_TSO_MSS_MIN_S) #define HCLGE_TSO_MSS_MIN_M GENMASK(13, 0)
#define HCLGE_TSO_MSS_MAX_S 16 #define HCLGE_TSO_MSS_MAX_S 16
#define HCLGE_TSO_MSS_MAX_M (0x3FFF << HCLGE_TSO_MSS_MAX_S) #define HCLGE_TSO_MSS_MAX_M GENMASK(29, 16)
struct hclge_cfg_tso_status { struct hclge_cfg_tso_status_cmd {
__le16 tso_mss_min; __le16 tso_mss_min;
__le16 tso_mss_max; __le16 tso_mss_max;
u8 rsv[20]; u8 rsv[20];
...@@ -685,7 +685,7 @@ struct hclge_cfg_tso_status { ...@@ -685,7 +685,7 @@ struct hclge_cfg_tso_status {
#define HCLGE_TSO_MSS_MAX 9668 #define HCLGE_TSO_MSS_MAX 9668
#define HCLGE_TQP_RESET_B 0 #define HCLGE_TQP_RESET_B 0
struct hclge_reset_tqp_queue { struct hclge_reset_tqp_queue_cmd {
__le16 tqp_id; __le16 tqp_id;
u8 reset_req; u8 reset_req;
u8 ready_to_reset; u8 ready_to_reset;
......
...@@ -362,7 +362,7 @@ static int hclge_64_bit_update_stats(struct hclge_dev *hdev) ...@@ -362,7 +362,7 @@ static int hclge_64_bit_update_stats(struct hclge_dev *hdev)
#define HCLGE_64_BIT_RTN_DATANUM 4 #define HCLGE_64_BIT_RTN_DATANUM 4
u64 *data = (u64 *)(&hdev->hw_stats.all_64_bit_stats); u64 *data = (u64 *)(&hdev->hw_stats.all_64_bit_stats);
struct hclge_desc desc[HCLGE_64_BIT_CMD_NUM]; struct hclge_desc desc[HCLGE_64_BIT_CMD_NUM];
u64 *desc_data; __le64 *desc_data;
int i, k, n; int i, k, n;
int ret; int ret;
...@@ -376,14 +376,14 @@ static int hclge_64_bit_update_stats(struct hclge_dev *hdev) ...@@ -376,14 +376,14 @@ static int hclge_64_bit_update_stats(struct hclge_dev *hdev)
for (i = 0; i < HCLGE_64_BIT_CMD_NUM; i++) { for (i = 0; i < HCLGE_64_BIT_CMD_NUM; i++) {
if (unlikely(i == 0)) { if (unlikely(i == 0)) {
desc_data = (u64 *)(&desc[i].data[0]); desc_data = (__le64 *)(&desc[i].data[0]);
n = HCLGE_64_BIT_RTN_DATANUM - 1; n = HCLGE_64_BIT_RTN_DATANUM - 1;
} else { } else {
desc_data = (u64 *)(&desc[i]); desc_data = (__le64 *)(&desc[i]);
n = HCLGE_64_BIT_RTN_DATANUM; n = HCLGE_64_BIT_RTN_DATANUM;
} }
for (k = 0; k < n; k++) { for (k = 0; k < n; k++) {
*data++ += cpu_to_le64(*desc_data); *data++ += le64_to_cpu(*desc_data);
desc_data++; desc_data++;
} }
} }
...@@ -411,7 +411,7 @@ static int hclge_32_bit_update_stats(struct hclge_dev *hdev) ...@@ -411,7 +411,7 @@ static int hclge_32_bit_update_stats(struct hclge_dev *hdev)
struct hclge_desc desc[HCLGE_32_BIT_CMD_NUM]; struct hclge_desc desc[HCLGE_32_BIT_CMD_NUM];
struct hclge_32_bit_stats *all_32_bit_stats; struct hclge_32_bit_stats *all_32_bit_stats;
u32 *desc_data; __le32 *desc_data;
int i, k, n; int i, k, n;
u64 *data; u64 *data;
int ret; int ret;
...@@ -431,21 +431,27 @@ static int hclge_32_bit_update_stats(struct hclge_dev *hdev) ...@@ -431,21 +431,27 @@ static int hclge_32_bit_update_stats(struct hclge_dev *hdev)
hclge_reset_partial_32bit_counter(all_32_bit_stats); hclge_reset_partial_32bit_counter(all_32_bit_stats);
for (i = 0; i < HCLGE_32_BIT_CMD_NUM; i++) { for (i = 0; i < HCLGE_32_BIT_CMD_NUM; i++) {
if (unlikely(i == 0)) { if (unlikely(i == 0)) {
__le16 *desc_data_16bit;
all_32_bit_stats->igu_rx_err_pkt += all_32_bit_stats->igu_rx_err_pkt +=
cpu_to_le32(desc[i].data[0]); le32_to_cpu(desc[i].data[0]);
desc_data_16bit = (__le16 *)&desc[i].data[1];
all_32_bit_stats->igu_rx_no_eof_pkt += all_32_bit_stats->igu_rx_no_eof_pkt +=
cpu_to_le32(desc[i].data[1] & 0xffff); le16_to_cpu(*desc_data_16bit);
desc_data_16bit++;
all_32_bit_stats->igu_rx_no_sof_pkt += all_32_bit_stats->igu_rx_no_sof_pkt +=
cpu_to_le32((desc[i].data[1] >> 16) & 0xffff); le16_to_cpu(*desc_data_16bit);
desc_data = (u32 *)(&desc[i].data[2]); desc_data = &desc[i].data[2];
n = HCLGE_32_BIT_RTN_DATANUM - 4; n = HCLGE_32_BIT_RTN_DATANUM - 4;
} else { } else {
desc_data = (u32 *)(&desc[i]); desc_data = (__le32 *)&desc[i];
n = HCLGE_32_BIT_RTN_DATANUM; n = HCLGE_32_BIT_RTN_DATANUM;
} }
for (k = 0; k < n; k++) { for (k = 0; k < n; k++) {
*data++ += cpu_to_le32(*desc_data); *data++ += le32_to_cpu(*desc_data);
desc_data++; desc_data++;
} }
} }
...@@ -460,7 +466,7 @@ static int hclge_mac_update_stats(struct hclge_dev *hdev) ...@@ -460,7 +466,7 @@ static int hclge_mac_update_stats(struct hclge_dev *hdev)
u64 *data = (u64 *)(&hdev->hw_stats.mac_stats); u64 *data = (u64 *)(&hdev->hw_stats.mac_stats);
struct hclge_desc desc[HCLGE_MAC_CMD_NUM]; struct hclge_desc desc[HCLGE_MAC_CMD_NUM];
u64 *desc_data; __le64 *desc_data;
int i, k, n; int i, k, n;
int ret; int ret;
...@@ -475,14 +481,14 @@ static int hclge_mac_update_stats(struct hclge_dev *hdev) ...@@ -475,14 +481,14 @@ static int hclge_mac_update_stats(struct hclge_dev *hdev)
for (i = 0; i < HCLGE_MAC_CMD_NUM; i++) { for (i = 0; i < HCLGE_MAC_CMD_NUM; i++) {
if (unlikely(i == 0)) { if (unlikely(i == 0)) {
desc_data = (u64 *)(&desc[i].data[0]); desc_data = (__le64 *)(&desc[i].data[0]);
n = HCLGE_RTN_DATA_NUM - 2; n = HCLGE_RTN_DATA_NUM - 2;
} else { } else {
desc_data = (u64 *)(&desc[i]); desc_data = (__le64 *)(&desc[i]);
n = HCLGE_RTN_DATA_NUM; n = HCLGE_RTN_DATA_NUM;
} }
for (k = 0; k < n; k++) { for (k = 0; k < n; k++) {
*data++ += cpu_to_le64(*desc_data); *data++ += le64_to_cpu(*desc_data);
desc_data++; desc_data++;
} }
} }
...@@ -508,7 +514,7 @@ static int hclge_tqps_update_stats(struct hnae3_handle *handle) ...@@ -508,7 +514,7 @@ static int hclge_tqps_update_stats(struct hnae3_handle *handle)
HCLGE_OPC_QUERY_RX_STATUS, HCLGE_OPC_QUERY_RX_STATUS,
true); true);
desc[0].data[0] = (tqp->index & 0x1ff); desc[0].data[0] = cpu_to_le32((tqp->index & 0x1ff));
ret = hclge_cmd_send(&hdev->hw, desc, 1); ret = hclge_cmd_send(&hdev->hw, desc, 1);
if (ret) { if (ret) {
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
...@@ -517,7 +523,7 @@ static int hclge_tqps_update_stats(struct hnae3_handle *handle) ...@@ -517,7 +523,7 @@ static int hclge_tqps_update_stats(struct hnae3_handle *handle)
return ret; return ret;
} }
tqp->tqp_stats.rcb_rx_ring_pktnum_rcd += tqp->tqp_stats.rcb_rx_ring_pktnum_rcd +=
cpu_to_le32(desc[0].data[4]); le32_to_cpu(desc[0].data[4]);
} }
for (i = 0; i < kinfo->num_tqps; i++) { for (i = 0; i < kinfo->num_tqps; i++) {
...@@ -528,7 +534,7 @@ static int hclge_tqps_update_stats(struct hnae3_handle *handle) ...@@ -528,7 +534,7 @@ static int hclge_tqps_update_stats(struct hnae3_handle *handle)
HCLGE_OPC_QUERY_TX_STATUS, HCLGE_OPC_QUERY_TX_STATUS,
true); true);
desc[0].data[0] = (tqp->index & 0x1ff); desc[0].data[0] = cpu_to_le32((tqp->index & 0x1ff));
ret = hclge_cmd_send(&hdev->hw, desc, 1); ret = hclge_cmd_send(&hdev->hw, desc, 1);
if (ret) { if (ret) {
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
...@@ -537,7 +543,7 @@ static int hclge_tqps_update_stats(struct hnae3_handle *handle) ...@@ -537,7 +543,7 @@ static int hclge_tqps_update_stats(struct hnae3_handle *handle)
return ret; return ret;
} }
tqp->tqp_stats.rcb_tx_ring_pktnum_rcd += tqp->tqp_stats.rcb_tx_ring_pktnum_rcd +=
cpu_to_le32(desc[0].data[4]); le32_to_cpu(desc[0].data[4]);
} }
return 0; return 0;
...@@ -552,12 +558,12 @@ static u64 *hclge_tqps_get_stats(struct hnae3_handle *handle, u64 *data) ...@@ -552,12 +558,12 @@ static u64 *hclge_tqps_get_stats(struct hnae3_handle *handle, u64 *data)
for (i = 0; i < kinfo->num_tqps; i++) { for (i = 0; i < kinfo->num_tqps; i++) {
tqp = container_of(kinfo->tqp[i], struct hclge_tqp, q); tqp = container_of(kinfo->tqp[i], struct hclge_tqp, q);
*buff++ = cpu_to_le64(tqp->tqp_stats.rcb_tx_ring_pktnum_rcd); *buff++ = tqp->tqp_stats.rcb_tx_ring_pktnum_rcd;
} }
for (i = 0; i < kinfo->num_tqps; i++) { for (i = 0; i < kinfo->num_tqps; i++) {
tqp = container_of(kinfo->tqp[i], struct hclge_tqp, q); tqp = container_of(kinfo->tqp[i], struct hclge_tqp, q);
*buff++ = cpu_to_le64(tqp->tqp_stats.rcb_rx_ring_pktnum_rcd); *buff++ = tqp->tqp_stats.rcb_rx_ring_pktnum_rcd;
} }
return buff; return buff;
...@@ -820,7 +826,7 @@ static void hclge_get_stats(struct hnae3_handle *handle, u64 *data) ...@@ -820,7 +826,7 @@ static void hclge_get_stats(struct hnae3_handle *handle, u64 *data)
} }
static int hclge_parse_func_status(struct hclge_dev *hdev, static int hclge_parse_func_status(struct hclge_dev *hdev,
struct hclge_func_status *status) struct hclge_func_status_cmd *status)
{ {
if (!(status->pf_state & HCLGE_PF_STATE_DONE)) if (!(status->pf_state & HCLGE_PF_STATE_DONE))
return -EINVAL; return -EINVAL;
...@@ -837,13 +843,13 @@ static int hclge_parse_func_status(struct hclge_dev *hdev, ...@@ -837,13 +843,13 @@ static int hclge_parse_func_status(struct hclge_dev *hdev,
static int hclge_query_function_status(struct hclge_dev *hdev) static int hclge_query_function_status(struct hclge_dev *hdev)
{ {
struct hclge_func_status *req; struct hclge_func_status_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int timeout = 0; int timeout = 0;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_FUNC_STATUS, true); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_FUNC_STATUS, true);
req = (struct hclge_func_status *)desc.data; req = (struct hclge_func_status_cmd *)desc.data;
do { do {
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
...@@ -868,7 +874,7 @@ static int hclge_query_function_status(struct hclge_dev *hdev) ...@@ -868,7 +874,7 @@ static int hclge_query_function_status(struct hclge_dev *hdev)
static int hclge_query_pf_resource(struct hclge_dev *hdev) static int hclge_query_pf_resource(struct hclge_dev *hdev)
{ {
struct hclge_pf_res *req; struct hclge_pf_res_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
...@@ -880,7 +886,7 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev) ...@@ -880,7 +886,7 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev)
return ret; return ret;
} }
req = (struct hclge_pf_res *)desc.data; req = (struct hclge_pf_res_cmd *)desc.data;
hdev->num_tqps = __le16_to_cpu(req->tqp_num); hdev->num_tqps = __le16_to_cpu(req->tqp_num);
hdev->pkt_buf_size = __le16_to_cpu(req->buf_size) << HCLGE_BUF_UNIT_S; hdev->pkt_buf_size = __le16_to_cpu(req->buf_size) << HCLGE_BUF_UNIT_S;
...@@ -938,12 +944,12 @@ static int hclge_parse_speed(int speed_cmd, int *speed) ...@@ -938,12 +944,12 @@ static int hclge_parse_speed(int speed_cmd, int *speed)
static void hclge_parse_cfg(struct hclge_cfg *cfg, struct hclge_desc *desc) static void hclge_parse_cfg(struct hclge_cfg *cfg, struct hclge_desc *desc)
{ {
struct hclge_cfg_param *req; struct hclge_cfg_param_cmd *req;
u64 mac_addr_tmp_high; u64 mac_addr_tmp_high;
u64 mac_addr_tmp; u64 mac_addr_tmp;
int i; int i;
req = (struct hclge_cfg_param *)desc[0].data; req = (struct hclge_cfg_param_cmd *)desc[0].data;
/* get the configuration */ /* get the configuration */
cfg->vmdq_vport_num = hnae_get_field(__le32_to_cpu(req->param[0]), cfg->vmdq_vport_num = hnae_get_field(__le32_to_cpu(req->param[0]),
...@@ -978,7 +984,7 @@ static void hclge_parse_cfg(struct hclge_cfg *cfg, struct hclge_desc *desc) ...@@ -978,7 +984,7 @@ static void hclge_parse_cfg(struct hclge_cfg *cfg, struct hclge_desc *desc)
for (i = 0; i < ETH_ALEN; i++) for (i = 0; i < ETH_ALEN; i++)
cfg->mac_addr[i] = (mac_addr_tmp >> (8 * i)) & 0xff; cfg->mac_addr[i] = (mac_addr_tmp >> (8 * i)) & 0xff;
req = (struct hclge_cfg_param *)desc[1].data; req = (struct hclge_cfg_param_cmd *)desc[1].data;
cfg->numa_node_map = __le32_to_cpu(req->param[0]); cfg->numa_node_map = __le32_to_cpu(req->param[0]);
} }
...@@ -989,20 +995,21 @@ static void hclge_parse_cfg(struct hclge_cfg *cfg, struct hclge_desc *desc) ...@@ -989,20 +995,21 @@ static void hclge_parse_cfg(struct hclge_cfg *cfg, struct hclge_desc *desc)
static int hclge_get_cfg(struct hclge_dev *hdev, struct hclge_cfg *hcfg) static int hclge_get_cfg(struct hclge_dev *hdev, struct hclge_cfg *hcfg)
{ {
struct hclge_desc desc[HCLGE_PF_CFG_DESC_NUM]; struct hclge_desc desc[HCLGE_PF_CFG_DESC_NUM];
struct hclge_cfg_param *req; struct hclge_cfg_param_cmd *req;
int i, ret; int i, ret;
for (i = 0; i < HCLGE_PF_CFG_DESC_NUM; i++) { for (i = 0; i < HCLGE_PF_CFG_DESC_NUM; i++) {
req = (struct hclge_cfg_param *)desc[i].data; u32 offset = 0;
req = (struct hclge_cfg_param_cmd *)desc[i].data;
hclge_cmd_setup_basic_desc(&desc[i], HCLGE_OPC_GET_CFG_PARAM, hclge_cmd_setup_basic_desc(&desc[i], HCLGE_OPC_GET_CFG_PARAM,
true); true);
hnae_set_field(req->offset, HCLGE_CFG_OFFSET_M, hnae_set_field(offset, HCLGE_CFG_OFFSET_M,
HCLGE_CFG_OFFSET_S, i * HCLGE_CFG_RD_LEN_BYTES); HCLGE_CFG_OFFSET_S, i * HCLGE_CFG_RD_LEN_BYTES);
/* Len should be united by 4 bytes when send to hardware */ /* Len should be united by 4 bytes when send to hardware */
hnae_set_field(req->offset, HCLGE_CFG_RD_LEN_M, hnae_set_field(offset, HCLGE_CFG_RD_LEN_M, HCLGE_CFG_RD_LEN_S,
HCLGE_CFG_RD_LEN_S,
HCLGE_CFG_RD_LEN_BYTES / HCLGE_CFG_RD_LEN_UNIT); HCLGE_CFG_RD_LEN_BYTES / HCLGE_CFG_RD_LEN_UNIT);
req->offset = cpu_to_le32(req->offset); req->offset = cpu_to_le32(offset);
} }
ret = hclge_cmd_send(&hdev->hw, desc, HCLGE_PF_CFG_DESC_NUM); ret = hclge_cmd_send(&hdev->hw, desc, HCLGE_PF_CFG_DESC_NUM);
...@@ -1099,16 +1106,23 @@ static int hclge_configure(struct hclge_dev *hdev) ...@@ -1099,16 +1106,23 @@ static int hclge_configure(struct hclge_dev *hdev)
static int hclge_config_tso(struct hclge_dev *hdev, int tso_mss_min, static int hclge_config_tso(struct hclge_dev *hdev, int tso_mss_min,
int tso_mss_max) int tso_mss_max)
{ {
struct hclge_cfg_tso_status *req; struct hclge_cfg_tso_status_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
u16 tso_mss;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_TSO_GENERIC_CONFIG, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_TSO_GENERIC_CONFIG, false);
req = (struct hclge_cfg_tso_status *)desc.data; req = (struct hclge_cfg_tso_status_cmd *)desc.data;
hnae_set_field(req->tso_mss_min, HCLGE_TSO_MSS_MIN_M,
tso_mss = 0;
hnae_set_field(tso_mss, HCLGE_TSO_MSS_MIN_M,
HCLGE_TSO_MSS_MIN_S, tso_mss_min); HCLGE_TSO_MSS_MIN_S, tso_mss_min);
hnae_set_field(req->tso_mss_max, HCLGE_TSO_MSS_MIN_M, req->tso_mss_min = cpu_to_le16(tso_mss);
tso_mss = 0;
hnae_set_field(tso_mss, HCLGE_TSO_MSS_MIN_M,
HCLGE_TSO_MSS_MIN_S, tso_mss_max); HCLGE_TSO_MSS_MIN_S, tso_mss_max);
req->tso_mss_max = cpu_to_le16(tso_mss);
return hclge_cmd_send(&hdev->hw, &desc, 1); return hclge_cmd_send(&hdev->hw, &desc, 1);
} }
...@@ -1144,15 +1158,15 @@ static int hclge_alloc_tqps(struct hclge_dev *hdev) ...@@ -1144,15 +1158,15 @@ static int hclge_alloc_tqps(struct hclge_dev *hdev)
static int hclge_map_tqps_to_func(struct hclge_dev *hdev, u16 func_id, static int hclge_map_tqps_to_func(struct hclge_dev *hdev, u16 func_id,
u16 tqp_pid, u16 tqp_vid, bool is_pf) u16 tqp_pid, u16 tqp_vid, bool is_pf)
{ {
struct hclge_tqp_map *req; struct hclge_tqp_map_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_SET_TQP_MAP, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_SET_TQP_MAP, false);
req = (struct hclge_tqp_map *)desc.data; req = (struct hclge_tqp_map_cmd *)desc.data;
req->tqp_id = cpu_to_le16(tqp_pid); req->tqp_id = cpu_to_le16(tqp_pid);
req->tqp_vf = cpu_to_le16(func_id); req->tqp_vf = func_id;
req->tqp_flag = !is_pf << HCLGE_TQP_MAP_TYPE_B | req->tqp_flag = !is_pf << HCLGE_TQP_MAP_TYPE_B |
1 << HCLGE_TQP_MAP_EN_B; 1 << HCLGE_TQP_MAP_EN_B;
req->tqp_vid = cpu_to_le16(tqp_vid); req->tqp_vid = cpu_to_le16(tqp_vid);
...@@ -1340,12 +1354,12 @@ static int hclge_cmd_alloc_tx_buff(struct hclge_dev *hdev, ...@@ -1340,12 +1354,12 @@ static int hclge_cmd_alloc_tx_buff(struct hclge_dev *hdev,
/* TX buffer size is unit by 128 byte */ /* TX buffer size is unit by 128 byte */
#define HCLGE_BUF_SIZE_UNIT_SHIFT 7 #define HCLGE_BUF_SIZE_UNIT_SHIFT 7
#define HCLGE_BUF_SIZE_UPDATE_EN_MSK BIT(15) #define HCLGE_BUF_SIZE_UPDATE_EN_MSK BIT(15)
struct hclge_tx_buff_alloc *req; struct hclge_tx_buff_alloc_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
u8 i; u8 i;
req = (struct hclge_tx_buff_alloc *)desc.data; req = (struct hclge_tx_buff_alloc_cmd *)desc.data;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_TX_BUFF_ALLOC, 0); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_TX_BUFF_ALLOC, 0);
for (i = 0; i < HCLGE_TC_NUM; i++) { for (i = 0; i < HCLGE_TC_NUM; i++) {
...@@ -1536,7 +1550,7 @@ static int hclge_tx_buffer_calc(struct hclge_dev *hdev, ...@@ -1536,7 +1550,7 @@ static int hclge_tx_buffer_calc(struct hclge_dev *hdev,
* @buf_alloc: pointer to buffer calculation data * @buf_alloc: pointer to buffer calculation data
* @return: 0: calculate sucessful, negative: fail * @return: 0: calculate sucessful, negative: fail
*/ */
int hclge_rx_buffer_calc(struct hclge_dev *hdev, static int hclge_rx_buffer_calc(struct hclge_dev *hdev,
struct hclge_pkt_buf_alloc *buf_alloc) struct hclge_pkt_buf_alloc *buf_alloc)
{ {
u32 rx_all = hdev->pkt_buf_size; u32 rx_all = hdev->pkt_buf_size;
...@@ -1672,13 +1686,13 @@ int hclge_rx_buffer_calc(struct hclge_dev *hdev, ...@@ -1672,13 +1686,13 @@ int hclge_rx_buffer_calc(struct hclge_dev *hdev,
static int hclge_rx_priv_buf_alloc(struct hclge_dev *hdev, static int hclge_rx_priv_buf_alloc(struct hclge_dev *hdev,
struct hclge_pkt_buf_alloc *buf_alloc) struct hclge_pkt_buf_alloc *buf_alloc)
{ {
struct hclge_rx_priv_buff *req; struct hclge_rx_priv_buff_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
int i; int i;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RX_PRIV_BUFF_ALLOC, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RX_PRIV_BUFF_ALLOC, false);
req = (struct hclge_rx_priv_buff *)desc.data; req = (struct hclge_rx_priv_buff_cmd *)desc.data;
/* Alloc private buffer TCs */ /* Alloc private buffer TCs */
for (i = 0; i < HCLGE_MAX_TC_NUM; i++) { for (i = 0; i < HCLGE_MAX_TC_NUM; i++) {
...@@ -1687,7 +1701,7 @@ static int hclge_rx_priv_buf_alloc(struct hclge_dev *hdev, ...@@ -1687,7 +1701,7 @@ static int hclge_rx_priv_buf_alloc(struct hclge_dev *hdev,
req->buf_num[i] = req->buf_num[i] =
cpu_to_le16(priv->buf_size >> HCLGE_BUF_UNIT_S); cpu_to_le16(priv->buf_size >> HCLGE_BUF_UNIT_S);
req->buf_num[i] |= req->buf_num[i] |=
cpu_to_le16(true << HCLGE_TC0_PRI_BUF_EN_B); cpu_to_le16(1 << HCLGE_TC0_PRI_BUF_EN_B);
} }
req->shared_buf = req->shared_buf =
...@@ -2000,11 +2014,11 @@ static void hclge_check_speed_dup(struct hclge_dev *hdev, int duplex, int speed) ...@@ -2000,11 +2014,11 @@ static void hclge_check_speed_dup(struct hclge_dev *hdev, int duplex, int speed)
int hclge_cfg_mac_speed_dup(struct hclge_dev *hdev, int speed, u8 duplex) int hclge_cfg_mac_speed_dup(struct hclge_dev *hdev, int speed, u8 duplex)
{ {
struct hclge_config_mac_speed_dup *req; struct hclge_config_mac_speed_dup_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
req = (struct hclge_config_mac_speed_dup *)desc.data; req = (struct hclge_config_mac_speed_dup_cmd *)desc.data;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CONFIG_SPEED_DUP, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CONFIG_SPEED_DUP, false);
...@@ -2075,12 +2089,12 @@ static int hclge_cfg_mac_speed_dup_h(struct hnae3_handle *handle, int speed, ...@@ -2075,12 +2089,12 @@ static int hclge_cfg_mac_speed_dup_h(struct hnae3_handle *handle, int speed,
static int hclge_query_mac_an_speed_dup(struct hclge_dev *hdev, int *speed, static int hclge_query_mac_an_speed_dup(struct hclge_dev *hdev, int *speed,
u8 *duplex) u8 *duplex)
{ {
struct hclge_query_an_speed_dup *req; struct hclge_query_an_speed_dup_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int speed_tmp; int speed_tmp;
int ret; int ret;
req = (struct hclge_query_an_speed_dup *)desc.data; req = (struct hclge_query_an_speed_dup_cmd *)desc.data;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_AN_RESULT, true); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_AN_RESULT, true);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
...@@ -2108,11 +2122,11 @@ static int hclge_query_mac_an_speed_dup(struct hclge_dev *hdev, int *speed, ...@@ -2108,11 +2122,11 @@ static int hclge_query_mac_an_speed_dup(struct hclge_dev *hdev, int *speed,
static int hclge_query_autoneg_result(struct hclge_dev *hdev) static int hclge_query_autoneg_result(struct hclge_dev *hdev)
{ {
struct hclge_mac *mac = &hdev->hw.mac; struct hclge_mac *mac = &hdev->hw.mac;
struct hclge_query_an_speed_dup *req; struct hclge_query_an_speed_dup_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
req = (struct hclge_query_an_speed_dup *)desc.data; req = (struct hclge_query_an_speed_dup_cmd *)desc.data;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_AN_RESULT, true); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_AN_RESULT, true);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
...@@ -2129,14 +2143,16 @@ static int hclge_query_autoneg_result(struct hclge_dev *hdev) ...@@ -2129,14 +2143,16 @@ static int hclge_query_autoneg_result(struct hclge_dev *hdev)
static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable) static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable)
{ {
struct hclge_config_auto_neg *req; struct hclge_config_auto_neg_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
u32 flag = 0;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CONFIG_AN_MODE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CONFIG_AN_MODE, false);
req = (struct hclge_config_auto_neg *)desc.data; req = (struct hclge_config_auto_neg_cmd *)desc.data;
hnae_set_bit(req->cfg_an_cmd_flag, HCLGE_MAC_CFG_AN_EN_B, !!enable); hnae_set_bit(flag, HCLGE_MAC_CFG_AN_EN_B, !!enable);
req->cfg_an_cmd_flag = cpu_to_le32(flag);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret) {
...@@ -2214,7 +2230,7 @@ static void hclge_task_schedule(struct hclge_dev *hdev) ...@@ -2214,7 +2230,7 @@ static void hclge_task_schedule(struct hclge_dev *hdev)
static int hclge_get_mac_link_status(struct hclge_dev *hdev) static int hclge_get_mac_link_status(struct hclge_dev *hdev)
{ {
struct hclge_link_status *req; struct hclge_link_status_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int link_status; int link_status;
int ret; int ret;
...@@ -2227,7 +2243,7 @@ static int hclge_get_mac_link_status(struct hclge_dev *hdev) ...@@ -2227,7 +2243,7 @@ static int hclge_get_mac_link_status(struct hclge_dev *hdev)
return ret; return ret;
} }
req = (struct hclge_link_status *)desc.data; req = (struct hclge_link_status_cmd *)desc.data;
link_status = req->status & HCLGE_LINK_STATUS; link_status = req->status & HCLGE_LINK_STATUS;
return !!link_status; return !!link_status;
...@@ -2451,7 +2467,7 @@ static u32 hclge_get_rss_indir_size(struct hnae3_handle *handle) ...@@ -2451,7 +2467,7 @@ static u32 hclge_get_rss_indir_size(struct hnae3_handle *handle)
static int hclge_get_rss_algo(struct hclge_dev *hdev) static int hclge_get_rss_algo(struct hclge_dev *hdev)
{ {
struct hclge_rss_config *req; struct hclge_rss_config_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int rss_hash_algo; int rss_hash_algo;
int ret; int ret;
...@@ -2465,7 +2481,7 @@ static int hclge_get_rss_algo(struct hclge_dev *hdev) ...@@ -2465,7 +2481,7 @@ static int hclge_get_rss_algo(struct hclge_dev *hdev)
return ret; return ret;
} }
req = (struct hclge_rss_config *)desc.data; req = (struct hclge_rss_config_cmd *)desc.data;
rss_hash_algo = (req->hash_config & HCLGE_RSS_HASH_ALGO_MASK); rss_hash_algo = (req->hash_config & HCLGE_RSS_HASH_ALGO_MASK);
if (rss_hash_algo == HCLGE_RSS_HASH_ALGO_TOEPLITZ) if (rss_hash_algo == HCLGE_RSS_HASH_ALGO_TOEPLITZ)
...@@ -2477,13 +2493,13 @@ static int hclge_get_rss_algo(struct hclge_dev *hdev) ...@@ -2477,13 +2493,13 @@ static int hclge_get_rss_algo(struct hclge_dev *hdev)
static int hclge_set_rss_algo_key(struct hclge_dev *hdev, static int hclge_set_rss_algo_key(struct hclge_dev *hdev,
const u8 hfunc, const u8 *key) const u8 hfunc, const u8 *key)
{ {
struct hclge_rss_config *req; struct hclge_rss_config_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int key_offset; int key_offset;
int key_size; int key_size;
int ret; int ret;
req = (struct hclge_rss_config *)desc.data; req = (struct hclge_rss_config_cmd *)desc.data;
for (key_offset = 0; key_offset < 3; key_offset++) { for (key_offset = 0; key_offset < 3; key_offset++) {
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_GENERIC_CONFIG, hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_GENERIC_CONFIG,
...@@ -2514,19 +2530,20 @@ static int hclge_set_rss_algo_key(struct hclge_dev *hdev, ...@@ -2514,19 +2530,20 @@ static int hclge_set_rss_algo_key(struct hclge_dev *hdev,
static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u32 *indir) static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u32 *indir)
{ {
struct hclge_rss_indirection_table *req; struct hclge_rss_indirection_table_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int i, j; int i, j;
int ret; int ret;
req = (struct hclge_rss_indirection_table *)desc.data; req = (struct hclge_rss_indirection_table_cmd *)desc.data;
for (i = 0; i < HCLGE_RSS_CFG_TBL_NUM; i++) { for (i = 0; i < HCLGE_RSS_CFG_TBL_NUM; i++) {
hclge_cmd_setup_basic_desc hclge_cmd_setup_basic_desc
(&desc, HCLGE_OPC_RSS_INDIR_TABLE, false); (&desc, HCLGE_OPC_RSS_INDIR_TABLE, false);
req->start_table_index = i * HCLGE_RSS_CFG_TBL_SIZE; req->start_table_index =
req->rss_set_bitmap = HCLGE_RSS_SET_BITMAP_MSK; cpu_to_le16(i * HCLGE_RSS_CFG_TBL_SIZE);
req->rss_set_bitmap = cpu_to_le16(HCLGE_RSS_SET_BITMAP_MSK);
for (j = 0; j < HCLGE_RSS_CFG_TBL_SIZE; j++) for (j = 0; j < HCLGE_RSS_CFG_TBL_SIZE; j++)
req->rss_result[j] = req->rss_result[j] =
...@@ -2546,21 +2563,24 @@ static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u32 *indir) ...@@ -2546,21 +2563,24 @@ static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u32 *indir)
static int hclge_set_rss_tc_mode(struct hclge_dev *hdev, u16 *tc_valid, static int hclge_set_rss_tc_mode(struct hclge_dev *hdev, u16 *tc_valid,
u16 *tc_size, u16 *tc_offset) u16 *tc_size, u16 *tc_offset)
{ {
struct hclge_rss_tc_mode *req; struct hclge_rss_tc_mode_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
int i; int i;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_TC_MODE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_TC_MODE, false);
req = (struct hclge_rss_tc_mode *)desc.data; req = (struct hclge_rss_tc_mode_cmd *)desc.data;
for (i = 0; i < HCLGE_MAX_TC_NUM; i++) { for (i = 0; i < HCLGE_MAX_TC_NUM; i++) {
hnae_set_bit(req->rss_tc_mode[i], HCLGE_RSS_TC_VALID_B, u16 mode = 0;
(tc_valid[i] & 0x1));
hnae_set_field(req->rss_tc_mode[i], HCLGE_RSS_TC_SIZE_M, hnae_set_bit(mode, HCLGE_RSS_TC_VALID_B, (tc_valid[i] & 0x1));
hnae_set_field(mode, HCLGE_RSS_TC_SIZE_M,
HCLGE_RSS_TC_SIZE_S, tc_size[i]); HCLGE_RSS_TC_SIZE_S, tc_size[i]);
hnae_set_field(req->rss_tc_mode[i], HCLGE_RSS_TC_OFFSET_M, hnae_set_field(mode, HCLGE_RSS_TC_OFFSET_M,
HCLGE_RSS_TC_OFFSET_S, tc_offset[i]); HCLGE_RSS_TC_OFFSET_S, tc_offset[i]);
req->rss_tc_mode[i] = cpu_to_le16(mode);
} }
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
...@@ -2577,13 +2597,13 @@ static int hclge_set_rss_input_tuple(struct hclge_dev *hdev) ...@@ -2577,13 +2597,13 @@ static int hclge_set_rss_input_tuple(struct hclge_dev *hdev)
{ {
#define HCLGE_RSS_INPUT_TUPLE_OTHER 0xf #define HCLGE_RSS_INPUT_TUPLE_OTHER 0xf
#define HCLGE_RSS_INPUT_TUPLE_SCTP 0x1f #define HCLGE_RSS_INPUT_TUPLE_SCTP 0x1f
struct hclge_rss_input_tuple *req; struct hclge_rss_input_tuple_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_INPUT_TUPLE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_INPUT_TUPLE, false);
req = (struct hclge_rss_input_tuple *)desc.data; req = (struct hclge_rss_input_tuple_cmd *)desc.data;
req->ipv4_tcp_en = HCLGE_RSS_INPUT_TUPLE_OTHER; req->ipv4_tcp_en = HCLGE_RSS_INPUT_TUPLE_OTHER;
req->ipv4_udp_en = HCLGE_RSS_INPUT_TUPLE_OTHER; req->ipv4_udp_en = HCLGE_RSS_INPUT_TUPLE_OTHER;
req->ipv4_sctp_en = HCLGE_RSS_INPUT_TUPLE_SCTP; req->ipv4_sctp_en = HCLGE_RSS_INPUT_TUPLE_SCTP;
...@@ -2750,7 +2770,7 @@ int hclge_map_vport_ring_to_vector(struct hclge_vport *vport, int vector_id, ...@@ -2750,7 +2770,7 @@ int hclge_map_vport_ring_to_vector(struct hclge_vport *vport, int vector_id,
struct hnae3_ring_chain_node *ring_chain) struct hnae3_ring_chain_node *ring_chain)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_ctrl_vector_chain *req; struct hclge_ctrl_vector_chain_cmd *req;
struct hnae3_ring_chain_node *node; struct hnae3_ring_chain_node *node;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
...@@ -2758,20 +2778,21 @@ int hclge_map_vport_ring_to_vector(struct hclge_vport *vport, int vector_id, ...@@ -2758,20 +2778,21 @@ int hclge_map_vport_ring_to_vector(struct hclge_vport *vport, int vector_id,
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_ADD_RING_TO_VECTOR, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_ADD_RING_TO_VECTOR, false);
req = (struct hclge_ctrl_vector_chain *)desc.data; req = (struct hclge_ctrl_vector_chain_cmd *)desc.data;
req->int_vector_id = vector_id; req->int_vector_id = vector_id;
i = 0; i = 0;
for (node = ring_chain; node; node = node->next) { for (node = ring_chain; node; node = node->next) {
hnae_set_field(req->tqp_type_and_id[i], HCLGE_INT_TYPE_M, u16 type_and_id = 0;
HCLGE_INT_TYPE_S,
hnae_set_field(type_and_id, HCLGE_INT_TYPE_M, HCLGE_INT_TYPE_S,
hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); hnae_get_bit(node->flag, HNAE3_RING_TYPE_B));
hnae_set_field(req->tqp_type_and_id[i], HCLGE_TQP_ID_M, hnae_set_field(type_and_id, HCLGE_TQP_ID_M, HCLGE_TQP_ID_S,
HCLGE_TQP_ID_S, node->tqp_index); node->tqp_index);
hnae_set_field(req->tqp_type_and_id[i], HCLGE_INT_GL_IDX_M, hnae_set_field(type_and_id, HCLGE_INT_GL_IDX_M,
HCLGE_INT_GL_IDX_S, HCLGE_INT_GL_IDX_S,
hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); hnae_get_bit(node->flag, HNAE3_RING_TYPE_B));
req->tqp_type_and_id[i] = cpu_to_le16(req->tqp_type_and_id[i]); req->tqp_type_and_id[i] = cpu_to_le16(type_and_id);
req->vfid = vport->vport_id; req->vfid = vport->vport_id;
if (++i >= HCLGE_VECTOR_ELEMENTS_PER_CMD) { if (++i >= HCLGE_VECTOR_ELEMENTS_PER_CMD) {
...@@ -2807,8 +2828,8 @@ int hclge_map_vport_ring_to_vector(struct hclge_vport *vport, int vector_id, ...@@ -2807,8 +2828,8 @@ int hclge_map_vport_ring_to_vector(struct hclge_vport *vport, int vector_id,
return 0; return 0;
} }
int hclge_map_handle_ring_to_vector(struct hnae3_handle *handle, static int hclge_map_handle_ring_to_vector(
int vector, struct hnae3_handle *handle, int vector,
struct hnae3_ring_chain_node *ring_chain) struct hnae3_ring_chain_node *ring_chain)
{ {
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
...@@ -2831,7 +2852,7 @@ static int hclge_unmap_ring_from_vector( ...@@ -2831,7 +2852,7 @@ static int hclge_unmap_ring_from_vector(
{ {
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_ctrl_vector_chain *req; struct hclge_ctrl_vector_chain_cmd *req;
struct hnae3_ring_chain_node *node; struct hnae3_ring_chain_node *node;
struct hclge_desc desc; struct hclge_desc desc;
int i, vector_id; int i, vector_id;
...@@ -2846,21 +2867,22 @@ static int hclge_unmap_ring_from_vector( ...@@ -2846,21 +2867,22 @@ static int hclge_unmap_ring_from_vector(
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_DEL_RING_TO_VECTOR, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_DEL_RING_TO_VECTOR, false);
req = (struct hclge_ctrl_vector_chain *)desc.data; req = (struct hclge_ctrl_vector_chain_cmd *)desc.data;
req->int_vector_id = vector_id; req->int_vector_id = vector_id;
i = 0; i = 0;
for (node = ring_chain; node; node = node->next) { for (node = ring_chain; node; node = node->next) {
hnae_set_field(req->tqp_type_and_id[i], HCLGE_INT_TYPE_M, u16 type_and_id = 0;
HCLGE_INT_TYPE_S,
hnae_set_field(type_and_id, HCLGE_INT_TYPE_M, HCLGE_INT_TYPE_S,
hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); hnae_get_bit(node->flag, HNAE3_RING_TYPE_B));
hnae_set_field(req->tqp_type_and_id[i], HCLGE_TQP_ID_M, hnae_set_field(type_and_id, HCLGE_TQP_ID_M, HCLGE_TQP_ID_S,
HCLGE_TQP_ID_S, node->tqp_index); node->tqp_index);
hnae_set_field(req->tqp_type_and_id[i], HCLGE_INT_GL_IDX_M, hnae_set_field(type_and_id, HCLGE_INT_GL_IDX_M,
HCLGE_INT_GL_IDX_S, HCLGE_INT_GL_IDX_S,
hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); hnae_get_bit(node->flag, HNAE3_RING_TYPE_B));
req->tqp_type_and_id[i] = cpu_to_le16(req->tqp_type_and_id[i]); req->tqp_type_and_id[i] = cpu_to_le16(type_and_id);
req->vfid = vport->vport_id; req->vfid = vport->vport_id;
if (++i >= HCLGE_VECTOR_ELEMENTS_PER_CMD) { if (++i >= HCLGE_VECTOR_ELEMENTS_PER_CMD) {
...@@ -2898,13 +2920,13 @@ static int hclge_unmap_ring_from_vector( ...@@ -2898,13 +2920,13 @@ static int hclge_unmap_ring_from_vector(
int hclge_cmd_set_promisc_mode(struct hclge_dev *hdev, int hclge_cmd_set_promisc_mode(struct hclge_dev *hdev,
struct hclge_promisc_param *param) struct hclge_promisc_param *param)
{ {
struct hclge_promisc_cfg *req; struct hclge_promisc_cfg_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_PROMISC_MODE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_PROMISC_MODE, false);
req = (struct hclge_promisc_cfg *)desc.data; req = (struct hclge_promisc_cfg_cmd *)desc.data;
req->vf_id = param->vf_id; req->vf_id = param->vf_id;
req->flag = (param->enable << HCLGE_PROMISC_EN_B); req->flag = (param->enable << HCLGE_PROMISC_EN_B);
...@@ -2946,29 +2968,27 @@ static void hclge_set_promisc_mode(struct hnae3_handle *handle, u32 en) ...@@ -2946,29 +2968,27 @@ static void hclge_set_promisc_mode(struct hnae3_handle *handle, u32 en)
static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable) static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable)
{ {
struct hclge_desc desc; struct hclge_desc desc;
struct hclge_config_mac_mode *req = struct hclge_config_mac_mode_cmd *req =
(struct hclge_config_mac_mode *)desc.data; (struct hclge_config_mac_mode_cmd *)desc.data;
u32 loop_en = 0;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CONFIG_MAC_MODE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CONFIG_MAC_MODE, false);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_TX_EN_B, enable); hnae_set_bit(loop_en, HCLGE_MAC_TX_EN_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_RX_EN_B, enable); hnae_set_bit(loop_en, HCLGE_MAC_RX_EN_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_PAD_TX_B, enable); hnae_set_bit(loop_en, HCLGE_MAC_PAD_TX_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_PAD_RX_B, enable); hnae_set_bit(loop_en, HCLGE_MAC_PAD_RX_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_1588_TX_B, 0); hnae_set_bit(loop_en, HCLGE_MAC_1588_TX_B, 0);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_1588_RX_B, 0); hnae_set_bit(loop_en, HCLGE_MAC_1588_RX_B, 0);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_APP_LP_B, 0); hnae_set_bit(loop_en, HCLGE_MAC_APP_LP_B, 0);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_LINE_LP_B, 0); hnae_set_bit(loop_en, HCLGE_MAC_LINE_LP_B, 0);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_FCS_TX_B, enable); hnae_set_bit(loop_en, HCLGE_MAC_FCS_TX_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en, HCLGE_MAC_RX_FCS_B, enable); hnae_set_bit(loop_en, HCLGE_MAC_RX_FCS_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en, hnae_set_bit(loop_en, HCLGE_MAC_RX_FCS_STRIP_B, enable);
HCLGE_MAC_RX_FCS_STRIP_B, enable); hnae_set_bit(loop_en, HCLGE_MAC_TX_OVERSIZE_TRUNCATE_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en, hnae_set_bit(loop_en, HCLGE_MAC_RX_OVERSIZE_TRUNCATE_B, enable);
HCLGE_MAC_TX_OVERSIZE_TRUNCATE_B, enable); hnae_set_bit(loop_en, HCLGE_MAC_TX_UNDER_MIN_ERR_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en, req->txrx_pad_fcs_loop_en = cpu_to_le32(loop_en);
HCLGE_MAC_RX_OVERSIZE_TRUNCATE_B, enable);
hnae_set_bit(req->txrx_pad_fcs_loop_en,
HCLGE_MAC_TX_UNDER_MIN_ERR_B, enable);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) if (ret)
...@@ -2980,8 +3000,8 @@ static int hclge_tqp_enable(struct hclge_dev *hdev, int tqp_id, ...@@ -2980,8 +3000,8 @@ static int hclge_tqp_enable(struct hclge_dev *hdev, int tqp_id,
int stream_id, bool enable) int stream_id, bool enable)
{ {
struct hclge_desc desc; struct hclge_desc desc;
struct hclge_cfg_com_tqp_queue *req = struct hclge_cfg_com_tqp_queue_cmd *req =
(struct hclge_cfg_com_tqp_queue *)desc.data; (struct hclge_cfg_com_tqp_queue_cmd *)desc.data;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_COM_TQP_QUEUE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_COM_TQP_QUEUE, false);
...@@ -3145,16 +3165,16 @@ static int hclge_update_desc_vfid(struct hclge_desc *desc, int vfid, bool clr) ...@@ -3145,16 +3165,16 @@ static int hclge_update_desc_vfid(struct hclge_desc *desc, int vfid, bool clr)
word_num = vfid / 32; word_num = vfid / 32;
bit_num = vfid % 32; bit_num = vfid % 32;
if (clr) if (clr)
desc[1].data[word_num] &= ~(1 << bit_num); desc[1].data[word_num] &= cpu_to_le32(~(1 << bit_num));
else else
desc[1].data[word_num] |= (1 << bit_num); desc[1].data[word_num] |= cpu_to_le32(1 << bit_num);
} else { } else {
word_num = (vfid - 192) / 32; word_num = (vfid - 192) / 32;
bit_num = vfid % 32; bit_num = vfid % 32;
if (clr) if (clr)
desc[2].data[word_num] &= ~(1 << bit_num); desc[2].data[word_num] &= cpu_to_le32(~(1 << bit_num));
else else
desc[2].data[word_num] |= (1 << bit_num); desc[2].data[word_num] |= cpu_to_le32(1 << bit_num);
} }
return 0; return 0;
...@@ -3174,7 +3194,7 @@ static bool hclge_is_all_function_id_zero(struct hclge_desc *desc) ...@@ -3174,7 +3194,7 @@ static bool hclge_is_all_function_id_zero(struct hclge_desc *desc)
return true; return true;
} }
static void hclge_prepare_mac_addr(struct hclge_mac_vlan_tbl_entry *new_req, static void hclge_prepare_mac_addr(struct hclge_mac_vlan_tbl_entry_cmd *new_req,
const u8 *addr) const u8 *addr)
{ {
const unsigned char *mac_addr = addr; const unsigned char *mac_addr = addr;
...@@ -3186,7 +3206,7 @@ static void hclge_prepare_mac_addr(struct hclge_mac_vlan_tbl_entry *new_req, ...@@ -3186,7 +3206,7 @@ static void hclge_prepare_mac_addr(struct hclge_mac_vlan_tbl_entry *new_req,
new_req->mac_addr_lo16 = cpu_to_le16(low_val & 0xffff); new_req->mac_addr_lo16 = cpu_to_le16(low_val & 0xffff);
} }
u16 hclge_get_mac_addr_to_mta_index(struct hclge_vport *vport, static u16 hclge_get_mac_addr_to_mta_index(struct hclge_vport *vport,
const u8 *addr) const u8 *addr)
{ {
u16 high_val = addr[1] | (addr[0] << 8); u16 high_val = addr[1] | (addr[0] << 8);
...@@ -3201,11 +3221,11 @@ static int hclge_set_mta_filter_mode(struct hclge_dev *hdev, ...@@ -3201,11 +3221,11 @@ static int hclge_set_mta_filter_mode(struct hclge_dev *hdev,
enum hclge_mta_dmac_sel_type mta_mac_sel, enum hclge_mta_dmac_sel_type mta_mac_sel,
bool enable) bool enable)
{ {
struct hclge_mta_filter_mode *req; struct hclge_mta_filter_mode_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
req = (struct hclge_mta_filter_mode *)desc.data; req = (struct hclge_mta_filter_mode_cmd *)desc.data;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MTA_MAC_MODE_CFG, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MTA_MAC_MODE_CFG, false);
hnae_set_bit(req->dmac_sel_en, HCLGE_CFG_MTA_MAC_EN_B, hnae_set_bit(req->dmac_sel_en, HCLGE_CFG_MTA_MAC_EN_B,
...@@ -3228,11 +3248,11 @@ int hclge_cfg_func_mta_filter(struct hclge_dev *hdev, ...@@ -3228,11 +3248,11 @@ int hclge_cfg_func_mta_filter(struct hclge_dev *hdev,
u8 func_id, u8 func_id,
bool enable) bool enable)
{ {
struct hclge_cfg_func_mta_filter *req; struct hclge_cfg_func_mta_filter_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
req = (struct hclge_cfg_func_mta_filter *)desc.data; req = (struct hclge_cfg_func_mta_filter_cmd *)desc.data;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MTA_MAC_FUNC_CFG, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MTA_MAC_FUNC_CFG, false);
hnae_set_bit(req->accept, HCLGE_CFG_FUNC_MTA_ACCEPT_B, hnae_set_bit(req->accept, HCLGE_CFG_FUNC_MTA_ACCEPT_B,
...@@ -3255,17 +3275,18 @@ static int hclge_set_mta_table_item(struct hclge_vport *vport, ...@@ -3255,17 +3275,18 @@ static int hclge_set_mta_table_item(struct hclge_vport *vport,
bool enable) bool enable)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_cfg_func_mta_item *req; struct hclge_cfg_func_mta_item_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
u16 item_idx = 0;
int ret; int ret;
req = (struct hclge_cfg_func_mta_item *)desc.data; req = (struct hclge_cfg_func_mta_item_cmd *)desc.data;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MTA_TBL_ITEM_CFG, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MTA_TBL_ITEM_CFG, false);
hnae_set_bit(req->accept, HCLGE_CFG_MTA_ITEM_ACCEPT_B, enable); hnae_set_bit(req->accept, HCLGE_CFG_MTA_ITEM_ACCEPT_B, enable);
hnae_set_field(req->item_idx, HCLGE_CFG_MTA_ITEM_IDX_M, hnae_set_field(item_idx, HCLGE_CFG_MTA_ITEM_IDX_M,
HCLGE_CFG_MTA_ITEM_IDX_S, idx); HCLGE_CFG_MTA_ITEM_IDX_S, idx);
req->item_idx = cpu_to_le16(req->item_idx); req->item_idx = cpu_to_le16(item_idx);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret) {
...@@ -3279,16 +3300,17 @@ static int hclge_set_mta_table_item(struct hclge_vport *vport, ...@@ -3279,16 +3300,17 @@ static int hclge_set_mta_table_item(struct hclge_vport *vport,
} }
static int hclge_remove_mac_vlan_tbl(struct hclge_vport *vport, static int hclge_remove_mac_vlan_tbl(struct hclge_vport *vport,
struct hclge_mac_vlan_tbl_entry *req) struct hclge_mac_vlan_tbl_entry_cmd *req)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_desc desc; struct hclge_desc desc;
u8 resp_code; u8 resp_code;
u16 retval;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MAC_VLAN_REMOVE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MAC_VLAN_REMOVE, false);
memcpy(desc.data, req, sizeof(struct hclge_mac_vlan_tbl_entry)); memcpy(desc.data, req, sizeof(struct hclge_mac_vlan_tbl_entry_cmd));
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret) {
...@@ -3297,19 +3319,21 @@ static int hclge_remove_mac_vlan_tbl(struct hclge_vport *vport, ...@@ -3297,19 +3319,21 @@ static int hclge_remove_mac_vlan_tbl(struct hclge_vport *vport,
ret); ret);
return ret; return ret;
} }
resp_code = (desc.data[0] >> 8) & 0xff; resp_code = (le32_to_cpu(desc.data[0]) >> 8) & 0xff;
retval = le16_to_cpu(desc.retval);
return hclge_get_mac_vlan_cmd_status(vport, desc.retval, resp_code, return hclge_get_mac_vlan_cmd_status(vport, retval, resp_code,
HCLGE_MAC_VLAN_REMOVE); HCLGE_MAC_VLAN_REMOVE);
} }
static int hclge_lookup_mac_vlan_tbl(struct hclge_vport *vport, static int hclge_lookup_mac_vlan_tbl(struct hclge_vport *vport,
struct hclge_mac_vlan_tbl_entry *req, struct hclge_mac_vlan_tbl_entry_cmd *req,
struct hclge_desc *desc, struct hclge_desc *desc,
bool is_mc) bool is_mc)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
u8 resp_code; u8 resp_code;
u16 retval;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc[0], HCLGE_OPC_MAC_VLAN_ADD, true); hclge_cmd_setup_basic_desc(&desc[0], HCLGE_OPC_MAC_VLAN_ADD, true);
...@@ -3317,7 +3341,7 @@ static int hclge_lookup_mac_vlan_tbl(struct hclge_vport *vport, ...@@ -3317,7 +3341,7 @@ static int hclge_lookup_mac_vlan_tbl(struct hclge_vport *vport,
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT); desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
memcpy(desc[0].data, memcpy(desc[0].data,
req, req,
sizeof(struct hclge_mac_vlan_tbl_entry)); sizeof(struct hclge_mac_vlan_tbl_entry_cmd));
hclge_cmd_setup_basic_desc(&desc[1], hclge_cmd_setup_basic_desc(&desc[1],
HCLGE_OPC_MAC_VLAN_ADD, HCLGE_OPC_MAC_VLAN_ADD,
true); true);
...@@ -3329,7 +3353,7 @@ static int hclge_lookup_mac_vlan_tbl(struct hclge_vport *vport, ...@@ -3329,7 +3353,7 @@ static int hclge_lookup_mac_vlan_tbl(struct hclge_vport *vport,
} else { } else {
memcpy(desc[0].data, memcpy(desc[0].data,
req, req,
sizeof(struct hclge_mac_vlan_tbl_entry)); sizeof(struct hclge_mac_vlan_tbl_entry_cmd));
ret = hclge_cmd_send(&hdev->hw, desc, 1); ret = hclge_cmd_send(&hdev->hw, desc, 1);
} }
if (ret) { if (ret) {
...@@ -3338,19 +3362,21 @@ static int hclge_lookup_mac_vlan_tbl(struct hclge_vport *vport, ...@@ -3338,19 +3362,21 @@ static int hclge_lookup_mac_vlan_tbl(struct hclge_vport *vport,
ret); ret);
return ret; return ret;
} }
resp_code = (desc[0].data[0] >> 8) & 0xff; resp_code = (le32_to_cpu(desc[0].data[0]) >> 8) & 0xff;
retval = le16_to_cpu(desc[0].retval);
return hclge_get_mac_vlan_cmd_status(vport, desc[0].retval, resp_code, return hclge_get_mac_vlan_cmd_status(vport, retval, resp_code,
HCLGE_MAC_VLAN_LKUP); HCLGE_MAC_VLAN_LKUP);
} }
static int hclge_add_mac_vlan_tbl(struct hclge_vport *vport, static int hclge_add_mac_vlan_tbl(struct hclge_vport *vport,
struct hclge_mac_vlan_tbl_entry *req, struct hclge_mac_vlan_tbl_entry_cmd *req,
struct hclge_desc *mc_desc) struct hclge_desc *mc_desc)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
int cfg_status; int cfg_status;
u8 resp_code; u8 resp_code;
u16 retval;
int ret; int ret;
if (!mc_desc) { if (!mc_desc) {
...@@ -3359,10 +3385,13 @@ static int hclge_add_mac_vlan_tbl(struct hclge_vport *vport, ...@@ -3359,10 +3385,13 @@ static int hclge_add_mac_vlan_tbl(struct hclge_vport *vport,
hclge_cmd_setup_basic_desc(&desc, hclge_cmd_setup_basic_desc(&desc,
HCLGE_OPC_MAC_VLAN_ADD, HCLGE_OPC_MAC_VLAN_ADD,
false); false);
memcpy(desc.data, req, sizeof(struct hclge_mac_vlan_tbl_entry)); memcpy(desc.data, req,
sizeof(struct hclge_mac_vlan_tbl_entry_cmd));
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
resp_code = (desc.data[0] >> 8) & 0xff; resp_code = (le32_to_cpu(desc.data[0]) >> 8) & 0xff;
cfg_status = hclge_get_mac_vlan_cmd_status(vport, desc.retval, retval = le16_to_cpu(desc.retval);
cfg_status = hclge_get_mac_vlan_cmd_status(vport, retval,
resp_code, resp_code,
HCLGE_MAC_VLAN_ADD); HCLGE_MAC_VLAN_ADD);
} else { } else {
...@@ -3373,11 +3402,12 @@ static int hclge_add_mac_vlan_tbl(struct hclge_vport *vport, ...@@ -3373,11 +3402,12 @@ static int hclge_add_mac_vlan_tbl(struct hclge_vport *vport,
mc_desc[2].flag &= cpu_to_le16(~HCLGE_CMD_FLAG_WR); mc_desc[2].flag &= cpu_to_le16(~HCLGE_CMD_FLAG_WR);
mc_desc[2].flag &= cpu_to_le16(~HCLGE_CMD_FLAG_NEXT); mc_desc[2].flag &= cpu_to_le16(~HCLGE_CMD_FLAG_NEXT);
memcpy(mc_desc[0].data, req, memcpy(mc_desc[0].data, req,
sizeof(struct hclge_mac_vlan_tbl_entry)); sizeof(struct hclge_mac_vlan_tbl_entry_cmd));
ret = hclge_cmd_send(&hdev->hw, mc_desc, 3); ret = hclge_cmd_send(&hdev->hw, mc_desc, 3);
resp_code = (mc_desc[0].data[0] >> 8) & 0xff; resp_code = (le32_to_cpu(mc_desc[0].data[0]) >> 8) & 0xff;
cfg_status = hclge_get_mac_vlan_cmd_status(vport, retval = le16_to_cpu(mc_desc[0].retval);
mc_desc[0].retval,
cfg_status = hclge_get_mac_vlan_cmd_status(vport, retval,
resp_code, resp_code,
HCLGE_MAC_VLAN_ADD); HCLGE_MAC_VLAN_ADD);
} }
...@@ -3404,8 +3434,9 @@ int hclge_add_uc_addr_common(struct hclge_vport *vport, ...@@ -3404,8 +3434,9 @@ int hclge_add_uc_addr_common(struct hclge_vport *vport,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_mac_vlan_tbl_entry req; struct hclge_mac_vlan_tbl_entry_cmd req;
enum hclge_cmd_status status; enum hclge_cmd_status status;
u16 egress_port = 0;
/* mac addr check */ /* mac addr check */
if (is_zero_ether_addr(addr) || if (is_zero_ether_addr(addr) ||
...@@ -3425,15 +3456,15 @@ int hclge_add_uc_addr_common(struct hclge_vport *vport, ...@@ -3425,15 +3456,15 @@ int hclge_add_uc_addr_common(struct hclge_vport *vport,
hnae_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT0_EN_B, 0); hnae_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT0_EN_B, 0);
hnae_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT1_EN_B, 0); hnae_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT1_EN_B, 0);
hnae_set_bit(req.mc_mac_en, HCLGE_MAC_VLAN_BIT0_EN_B, 0); hnae_set_bit(req.mc_mac_en, HCLGE_MAC_VLAN_BIT0_EN_B, 0);
hnae_set_bit(req.egress_port,
HCLGE_MAC_EPORT_SW_EN_B, 0); hnae_set_bit(egress_port, HCLGE_MAC_EPORT_SW_EN_B, 0);
hnae_set_bit(req.egress_port, hnae_set_bit(egress_port, HCLGE_MAC_EPORT_TYPE_B, 0);
HCLGE_MAC_EPORT_TYPE_B, 0); hnae_set_field(egress_port, HCLGE_MAC_EPORT_VFID_M,
hnae_set_field(req.egress_port, HCLGE_MAC_EPORT_VFID_M,
HCLGE_MAC_EPORT_VFID_S, vport->vport_id); HCLGE_MAC_EPORT_VFID_S, vport->vport_id);
hnae_set_field(req.egress_port, HCLGE_MAC_EPORT_PFID_M, hnae_set_field(egress_port, HCLGE_MAC_EPORT_PFID_M,
HCLGE_MAC_EPORT_PFID_S, 0); HCLGE_MAC_EPORT_PFID_S, 0);
req.egress_port = cpu_to_le16(req.egress_port);
req.egress_port = cpu_to_le16(egress_port);
hclge_prepare_mac_addr(&req, addr); hclge_prepare_mac_addr(&req, addr);
...@@ -3454,7 +3485,7 @@ int hclge_rm_uc_addr_common(struct hclge_vport *vport, ...@@ -3454,7 +3485,7 @@ int hclge_rm_uc_addr_common(struct hclge_vport *vport,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_mac_vlan_tbl_entry req; struct hclge_mac_vlan_tbl_entry_cmd req;
enum hclge_cmd_status status; enum hclge_cmd_status status;
/* mac addr check */ /* mac addr check */
...@@ -3488,7 +3519,7 @@ int hclge_add_mc_addr_common(struct hclge_vport *vport, ...@@ -3488,7 +3519,7 @@ int hclge_add_mc_addr_common(struct hclge_vport *vport,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_mac_vlan_tbl_entry req; struct hclge_mac_vlan_tbl_entry_cmd req;
struct hclge_desc desc[3]; struct hclge_desc desc[3];
u16 tbl_idx; u16 tbl_idx;
int status; int status;
...@@ -3539,7 +3570,7 @@ int hclge_rm_mc_addr_common(struct hclge_vport *vport, ...@@ -3539,7 +3570,7 @@ int hclge_rm_mc_addr_common(struct hclge_vport *vport,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_mac_vlan_tbl_entry req; struct hclge_mac_vlan_tbl_entry_cmd req;
enum hclge_cmd_status status; enum hclge_cmd_status status;
struct hclge_desc desc[3]; struct hclge_desc desc[3];
u16 tbl_idx; u16 tbl_idx;
...@@ -3622,13 +3653,13 @@ static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p) ...@@ -3622,13 +3653,13 @@ static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p)
static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type, static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type,
bool filter_en) bool filter_en)
{ {
struct hclge_vlan_filter_ctrl *req; struct hclge_vlan_filter_ctrl_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_FILTER_CTRL, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_FILTER_CTRL, false);
req = (struct hclge_vlan_filter_ctrl *)desc.data; req = (struct hclge_vlan_filter_ctrl_cmd *)desc.data;
req->vlan_type = vlan_type; req->vlan_type = vlan_type;
req->vlan_fe = filter_en; req->vlan_fe = filter_en;
...@@ -3646,8 +3677,8 @@ int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid, ...@@ -3646,8 +3677,8 @@ int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid,
bool is_kill, u16 vlan, u8 qos, __be16 proto) bool is_kill, u16 vlan, u8 qos, __be16 proto)
{ {
#define HCLGE_MAX_VF_BYTES 16 #define HCLGE_MAX_VF_BYTES 16
struct hclge_vlan_filter_vf_cfg *req0; struct hclge_vlan_filter_vf_cfg_cmd *req0;
struct hclge_vlan_filter_vf_cfg *req1; struct hclge_vlan_filter_vf_cfg_cmd *req1;
struct hclge_desc desc[2]; struct hclge_desc desc[2];
u8 vf_byte_val; u8 vf_byte_val;
u8 vf_byte_off; u8 vf_byte_off;
...@@ -3663,10 +3694,10 @@ int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid, ...@@ -3663,10 +3694,10 @@ int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid,
vf_byte_off = vfid / 8; vf_byte_off = vfid / 8;
vf_byte_val = 1 << (vfid % 8); vf_byte_val = 1 << (vfid % 8);
req0 = (struct hclge_vlan_filter_vf_cfg *)desc[0].data; req0 = (struct hclge_vlan_filter_vf_cfg_cmd *)desc[0].data;
req1 = (struct hclge_vlan_filter_vf_cfg *)desc[1].data; req1 = (struct hclge_vlan_filter_vf_cfg_cmd *)desc[1].data;
req0->vlan_id = vlan; req0->vlan_id = cpu_to_le16(vlan);
req0->vlan_cfg = is_kill; req0->vlan_cfg = is_kill;
if (vf_byte_off < HCLGE_MAX_VF_BYTES) if (vf_byte_off < HCLGE_MAX_VF_BYTES)
...@@ -3707,7 +3738,7 @@ static int hclge_set_port_vlan_filter(struct hnae3_handle *handle, ...@@ -3707,7 +3738,7 @@ static int hclge_set_port_vlan_filter(struct hnae3_handle *handle,
{ {
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_vlan_filter_pf_cfg *req; struct hclge_vlan_filter_pf_cfg_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
u8 vlan_offset_byte_val; u8 vlan_offset_byte_val;
u8 vlan_offset_byte; u8 vlan_offset_byte;
...@@ -3720,7 +3751,7 @@ static int hclge_set_port_vlan_filter(struct hnae3_handle *handle, ...@@ -3720,7 +3751,7 @@ static int hclge_set_port_vlan_filter(struct hnae3_handle *handle,
vlan_offset_byte = (vlan_id % 160) / 8; vlan_offset_byte = (vlan_id % 160) / 8;
vlan_offset_byte_val = 1 << (vlan_id % 8); vlan_offset_byte_val = 1 << (vlan_id % 8);
req = (struct hclge_vlan_filter_pf_cfg *)desc.data; req = (struct hclge_vlan_filter_pf_cfg_cmd *)desc.data;
req->vlan_offset = vlan_offset_160; req->vlan_offset = vlan_offset_160;
req->vlan_cfg = is_kill; req->vlan_cfg = is_kill;
req->vlan_offset_bitmap[vlan_offset_byte] = vlan_offset_byte_val; req->vlan_offset_bitmap[vlan_offset_byte] = vlan_offset_byte_val;
...@@ -3782,7 +3813,7 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) ...@@ -3782,7 +3813,7 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev)
static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu) static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu)
{ {
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_config_max_frm_size *req; struct hclge_config_max_frm_size_cmd *req;
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
...@@ -3793,7 +3824,7 @@ static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu) ...@@ -3793,7 +3824,7 @@ static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu)
hdev->mps = new_mtu; hdev->mps = new_mtu;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CONFIG_MAX_FRM_SIZE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CONFIG_MAX_FRM_SIZE, false);
req = (struct hclge_config_max_frm_size *)desc.data; req = (struct hclge_config_max_frm_size_cmd *)desc.data;
req->max_frm_size = cpu_to_le16(new_mtu); req->max_frm_size = cpu_to_le16(new_mtu);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
...@@ -3808,13 +3839,13 @@ static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu) ...@@ -3808,13 +3839,13 @@ static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu)
static int hclge_send_reset_tqp_cmd(struct hclge_dev *hdev, u16 queue_id, static int hclge_send_reset_tqp_cmd(struct hclge_dev *hdev, u16 queue_id,
bool enable) bool enable)
{ {
struct hclge_reset_tqp_queue *req; struct hclge_reset_tqp_queue_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RESET_TQP_QUEUE, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RESET_TQP_QUEUE, false);
req = (struct hclge_reset_tqp_queue *)desc.data; req = (struct hclge_reset_tqp_queue_cmd *)desc.data;
req->tqp_id = cpu_to_le16(queue_id & HCLGE_RING_ID_MASK); req->tqp_id = cpu_to_le16(queue_id & HCLGE_RING_ID_MASK);
hnae_set_bit(req->reset_req, HCLGE_TQP_RESET_B, enable); hnae_set_bit(req->reset_req, HCLGE_TQP_RESET_B, enable);
...@@ -3830,13 +3861,13 @@ static int hclge_send_reset_tqp_cmd(struct hclge_dev *hdev, u16 queue_id, ...@@ -3830,13 +3861,13 @@ static int hclge_send_reset_tqp_cmd(struct hclge_dev *hdev, u16 queue_id,
static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id) static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id)
{ {
struct hclge_reset_tqp_queue *req; struct hclge_reset_tqp_queue_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RESET_TQP_QUEUE, true); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RESET_TQP_QUEUE, true);
req = (struct hclge_reset_tqp_queue *)desc.data; req = (struct hclge_reset_tqp_queue_cmd *)desc.data;
req->tqp_id = cpu_to_le16(queue_id & HCLGE_RING_ID_MASK); req->tqp_id = cpu_to_le16(queue_id & HCLGE_RING_ID_MASK);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define HCLGE_VECTOR_VF_OFFSET 0x100000 #define HCLGE_VECTOR_VF_OFFSET 0x100000
#define HCLGE_RSS_IND_TBL_SIZE 512 #define HCLGE_RSS_IND_TBL_SIZE 512
#define HCLGE_RSS_SET_BITMAP_MSK 0xffff #define HCLGE_RSS_SET_BITMAP_MSK GENMASK(15, 0)
#define HCLGE_RSS_KEY_SIZE 40 #define HCLGE_RSS_KEY_SIZE 40
#define HCLGE_RSS_HASH_ALGO_TOEPLITZ 0 #define HCLGE_RSS_HASH_ALGO_TOEPLITZ 0
#define HCLGE_RSS_HASH_ALGO_SIMPLE 1 #define HCLGE_RSS_HASH_ALGO_SIMPLE 1
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#define HCLGE_PHY_CSS_REG 17 #define HCLGE_PHY_CSS_REG 17
#define HCLGE_PHY_MDIX_CTRL_S (5) #define HCLGE_PHY_MDIX_CTRL_S (5)
#define HCLGE_PHY_MDIX_CTRL_M (3 << HCLGE_PHY_MDIX_CTRL_S) #define HCLGE_PHY_MDIX_CTRL_M GENMASK(6, 5)
#define HCLGE_PHY_MDIX_STATUS_B (6) #define HCLGE_PHY_MDIX_STATUS_B (6)
#define HCLGE_PHY_SPEED_DUP_RESOLVE_B (11) #define HCLGE_PHY_SPEED_DUP_RESOLVE_B (11)
......
...@@ -283,6 +283,7 @@ static int hclge_tm_pg_shapping_cfg(struct hclge_dev *hdev, ...@@ -283,6 +283,7 @@ static int hclge_tm_pg_shapping_cfg(struct hclge_dev *hdev,
struct hclge_pg_shapping_cmd *shap_cfg_cmd; struct hclge_pg_shapping_cmd *shap_cfg_cmd;
enum hclge_opcode_type opcode; enum hclge_opcode_type opcode;
struct hclge_desc desc; struct hclge_desc desc;
u32 shapping_para = 0;
opcode = bucket ? HCLGE_OPC_TM_PG_P_SHAPPING : opcode = bucket ? HCLGE_OPC_TM_PG_P_SHAPPING :
HCLGE_OPC_TM_PG_C_SHAPPING; HCLGE_OPC_TM_PG_C_SHAPPING;
...@@ -292,11 +293,13 @@ static int hclge_tm_pg_shapping_cfg(struct hclge_dev *hdev, ...@@ -292,11 +293,13 @@ static int hclge_tm_pg_shapping_cfg(struct hclge_dev *hdev,
shap_cfg_cmd->pg_id = pg_id; shap_cfg_cmd->pg_id = pg_id;
hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_B, ir_b); hclge_tm_set_field(shapping_para, IR_B, ir_b);
hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_U, ir_u); hclge_tm_set_field(shapping_para, IR_U, ir_u);
hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_S, ir_s); hclge_tm_set_field(shapping_para, IR_S, ir_s);
hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, BS_B, bs_b); hclge_tm_set_field(shapping_para, BS_B, bs_b);
hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, BS_S, bs_s); hclge_tm_set_field(shapping_para, BS_S, bs_s);
shap_cfg_cmd->pg_shapping_para = cpu_to_le32(shapping_para);
return hclge_cmd_send(&hdev->hw, &desc, 1); return hclge_cmd_send(&hdev->hw, &desc, 1);
} }
...@@ -337,6 +340,7 @@ static int hclge_tm_pri_shapping_cfg(struct hclge_dev *hdev, ...@@ -337,6 +340,7 @@ static int hclge_tm_pri_shapping_cfg(struct hclge_dev *hdev,
struct hclge_pri_shapping_cmd *shap_cfg_cmd; struct hclge_pri_shapping_cmd *shap_cfg_cmd;
enum hclge_opcode_type opcode; enum hclge_opcode_type opcode;
struct hclge_desc desc; struct hclge_desc desc;
u32 shapping_para = 0;
opcode = bucket ? HCLGE_OPC_TM_PRI_P_SHAPPING : opcode = bucket ? HCLGE_OPC_TM_PRI_P_SHAPPING :
HCLGE_OPC_TM_PRI_C_SHAPPING; HCLGE_OPC_TM_PRI_C_SHAPPING;
...@@ -347,11 +351,13 @@ static int hclge_tm_pri_shapping_cfg(struct hclge_dev *hdev, ...@@ -347,11 +351,13 @@ static int hclge_tm_pri_shapping_cfg(struct hclge_dev *hdev,
shap_cfg_cmd->pri_id = pri_id; shap_cfg_cmd->pri_id = pri_id;
hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_B, ir_b); hclge_tm_set_field(shapping_para, IR_B, ir_b);
hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_U, ir_u); hclge_tm_set_field(shapping_para, IR_U, ir_u);
hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_S, ir_s); hclge_tm_set_field(shapping_para, IR_S, ir_s);
hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, BS_B, bs_b); hclge_tm_set_field(shapping_para, BS_B, bs_b);
hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, BS_S, bs_s); hclge_tm_set_field(shapping_para, BS_S, bs_s);
shap_cfg_cmd->pri_shapping_para = cpu_to_le32(shapping_para);
return hclge_cmd_send(&hdev->hw, &desc, 1); return hclge_cmd_send(&hdev->hw, &desc, 1);
} }
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
static static
int hns3_dcbnl_ieee_getets(struct net_device *ndev, struct ieee_ets *ets) int hns3_dcbnl_ieee_getets(struct net_device *ndev, struct ieee_ets *ets)
{ {
struct hns3_nic_priv *priv = netdev_priv(ndev); struct hnae3_handle *h = hns3_get_handle(ndev);
struct hnae3_handle *h = priv->ae_handle;
if (h->kinfo.dcb_ops->ieee_getets) if (h->kinfo.dcb_ops->ieee_getets)
return h->kinfo.dcb_ops->ieee_getets(h, ets); return h->kinfo.dcb_ops->ieee_getets(h, ets);
...@@ -25,8 +24,7 @@ int hns3_dcbnl_ieee_getets(struct net_device *ndev, struct ieee_ets *ets) ...@@ -25,8 +24,7 @@ int hns3_dcbnl_ieee_getets(struct net_device *ndev, struct ieee_ets *ets)
static static
int hns3_dcbnl_ieee_setets(struct net_device *ndev, struct ieee_ets *ets) int hns3_dcbnl_ieee_setets(struct net_device *ndev, struct ieee_ets *ets)
{ {
struct hns3_nic_priv *priv = netdev_priv(ndev); struct hnae3_handle *h = hns3_get_handle(ndev);
struct hnae3_handle *h = priv->ae_handle;
if (h->kinfo.dcb_ops->ieee_setets) if (h->kinfo.dcb_ops->ieee_setets)
return h->kinfo.dcb_ops->ieee_setets(h, ets); return h->kinfo.dcb_ops->ieee_setets(h, ets);
...@@ -37,8 +35,7 @@ int hns3_dcbnl_ieee_setets(struct net_device *ndev, struct ieee_ets *ets) ...@@ -37,8 +35,7 @@ int hns3_dcbnl_ieee_setets(struct net_device *ndev, struct ieee_ets *ets)
static static
int hns3_dcbnl_ieee_getpfc(struct net_device *ndev, struct ieee_pfc *pfc) int hns3_dcbnl_ieee_getpfc(struct net_device *ndev, struct ieee_pfc *pfc)
{ {
struct hns3_nic_priv *priv = netdev_priv(ndev); struct hnae3_handle *h = hns3_get_handle(ndev);
struct hnae3_handle *h = priv->ae_handle;
if (h->kinfo.dcb_ops->ieee_getpfc) if (h->kinfo.dcb_ops->ieee_getpfc)
return h->kinfo.dcb_ops->ieee_getpfc(h, pfc); return h->kinfo.dcb_ops->ieee_getpfc(h, pfc);
...@@ -49,8 +46,7 @@ int hns3_dcbnl_ieee_getpfc(struct net_device *ndev, struct ieee_pfc *pfc) ...@@ -49,8 +46,7 @@ int hns3_dcbnl_ieee_getpfc(struct net_device *ndev, struct ieee_pfc *pfc)
static static
int hns3_dcbnl_ieee_setpfc(struct net_device *ndev, struct ieee_pfc *pfc) int hns3_dcbnl_ieee_setpfc(struct net_device *ndev, struct ieee_pfc *pfc)
{ {
struct hns3_nic_priv *priv = netdev_priv(ndev); struct hnae3_handle *h = hns3_get_handle(ndev);
struct hnae3_handle *h = priv->ae_handle;
if (h->kinfo.dcb_ops->ieee_setpfc) if (h->kinfo.dcb_ops->ieee_setpfc)
return h->kinfo.dcb_ops->ieee_setpfc(h, pfc); return h->kinfo.dcb_ops->ieee_setpfc(h, pfc);
...@@ -61,8 +57,7 @@ int hns3_dcbnl_ieee_setpfc(struct net_device *ndev, struct ieee_pfc *pfc) ...@@ -61,8 +57,7 @@ int hns3_dcbnl_ieee_setpfc(struct net_device *ndev, struct ieee_pfc *pfc)
/* DCBX configuration */ /* DCBX configuration */
static u8 hns3_dcbnl_getdcbx(struct net_device *ndev) static u8 hns3_dcbnl_getdcbx(struct net_device *ndev)
{ {
struct hns3_nic_priv *priv = netdev_priv(ndev); struct hnae3_handle *h = hns3_get_handle(ndev);
struct hnae3_handle *h = priv->ae_handle;
if (h->kinfo.dcb_ops->getdcbx) if (h->kinfo.dcb_ops->getdcbx)
return h->kinfo.dcb_ops->getdcbx(h); return h->kinfo.dcb_ops->getdcbx(h);
...@@ -73,8 +68,7 @@ static u8 hns3_dcbnl_getdcbx(struct net_device *ndev) ...@@ -73,8 +68,7 @@ static u8 hns3_dcbnl_getdcbx(struct net_device *ndev)
/* return 0 if successful, otherwise fail */ /* return 0 if successful, otherwise fail */
static u8 hns3_dcbnl_setdcbx(struct net_device *ndev, u8 mode) static u8 hns3_dcbnl_setdcbx(struct net_device *ndev, u8 mode)
{ {
struct hns3_nic_priv *priv = netdev_priv(ndev); struct hnae3_handle *h = hns3_get_handle(ndev);
struct hnae3_handle *h = priv->ae_handle;
if (h->kinfo.dcb_ops->setdcbx) if (h->kinfo.dcb_ops->setdcbx)
return h->kinfo.dcb_ops->setdcbx(h, mode); return h->kinfo.dcb_ops->setdcbx(h, mode);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "hnae3.h" #include "hnae3.h"
#include "hns3_enet.h" #include "hns3_enet.h"
const char hns3_driver_name[] = "hns3"; static const char hns3_driver_name[] = "hns3";
const char hns3_driver_version[] = VERMAGIC_STRING; const char hns3_driver_version[] = VERMAGIC_STRING;
static const char hns3_driver_string[] = static const char hns3_driver_string[] =
"Hisilicon Ethernet Network Driver for Hip08 Family"; "Hisilicon Ethernet Network Driver for Hip08 Family";
...@@ -198,8 +198,7 @@ static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector) ...@@ -198,8 +198,7 @@ static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector)
static int hns3_nic_set_real_num_queue(struct net_device *netdev) static int hns3_nic_set_real_num_queue(struct net_device *netdev)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
struct hnae3_knic_private_info *kinfo = &h->kinfo; struct hnae3_knic_private_info *kinfo = &h->kinfo;
unsigned int queue_size = kinfo->rss_size * kinfo->num_tc; unsigned int queue_size = kinfo->rss_size * kinfo->num_tc;
int ret; int ret;
...@@ -305,24 +304,10 @@ static int hns3_nic_net_stop(struct net_device *netdev) ...@@ -305,24 +304,10 @@ static int hns3_nic_net_stop(struct net_device *netdev)
return 0; return 0;
} }
void hns3_set_multicast_list(struct net_device *netdev)
{
struct hns3_nic_priv *priv = netdev_priv(netdev);
struct hnae3_handle *h = priv->ae_handle;
struct netdev_hw_addr *ha = NULL;
if (h->ae_algo->ops->set_mc_addr) {
netdev_for_each_mc_addr(ha, netdev)
if (h->ae_algo->ops->set_mc_addr(h, ha->addr))
netdev_err(netdev, "set multicast fail\n");
}
}
static int hns3_nic_uc_sync(struct net_device *netdev, static int hns3_nic_uc_sync(struct net_device *netdev,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (h->ae_algo->ops->add_uc_addr) if (h->ae_algo->ops->add_uc_addr)
return h->ae_algo->ops->add_uc_addr(h, addr); return h->ae_algo->ops->add_uc_addr(h, addr);
...@@ -333,8 +318,7 @@ static int hns3_nic_uc_sync(struct net_device *netdev, ...@@ -333,8 +318,7 @@ static int hns3_nic_uc_sync(struct net_device *netdev,
static int hns3_nic_uc_unsync(struct net_device *netdev, static int hns3_nic_uc_unsync(struct net_device *netdev,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (h->ae_algo->ops->rm_uc_addr) if (h->ae_algo->ops->rm_uc_addr)
return h->ae_algo->ops->rm_uc_addr(h, addr); return h->ae_algo->ops->rm_uc_addr(h, addr);
...@@ -345,8 +329,7 @@ static int hns3_nic_uc_unsync(struct net_device *netdev, ...@@ -345,8 +329,7 @@ static int hns3_nic_uc_unsync(struct net_device *netdev,
static int hns3_nic_mc_sync(struct net_device *netdev, static int hns3_nic_mc_sync(struct net_device *netdev,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (h->ae_algo->ops->add_mc_addr) if (h->ae_algo->ops->add_mc_addr)
return h->ae_algo->ops->add_mc_addr(h, addr); return h->ae_algo->ops->add_mc_addr(h, addr);
...@@ -357,8 +340,7 @@ static int hns3_nic_mc_sync(struct net_device *netdev, ...@@ -357,8 +340,7 @@ static int hns3_nic_mc_sync(struct net_device *netdev,
static int hns3_nic_mc_unsync(struct net_device *netdev, static int hns3_nic_mc_unsync(struct net_device *netdev,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (h->ae_algo->ops->rm_mc_addr) if (h->ae_algo->ops->rm_mc_addr)
return h->ae_algo->ops->rm_mc_addr(h, addr); return h->ae_algo->ops->rm_mc_addr(h, addr);
...@@ -366,10 +348,9 @@ static int hns3_nic_mc_unsync(struct net_device *netdev, ...@@ -366,10 +348,9 @@ static int hns3_nic_mc_unsync(struct net_device *netdev,
return 0; return 0;
} }
void hns3_nic_set_rx_mode(struct net_device *netdev) static void hns3_nic_set_rx_mode(struct net_device *netdev)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (h->ae_algo->ops->set_promisc_mode) { if (h->ae_algo->ops->set_promisc_mode) {
if (netdev->flags & IFF_PROMISC) if (netdev->flags & IFF_PROMISC)
...@@ -768,7 +749,7 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv, ...@@ -768,7 +749,7 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv,
if (type == DESC_TYPE_SKB) { if (type == DESC_TYPE_SKB) {
skb = (struct sk_buff *)priv; skb = (struct sk_buff *)priv;
paylen = cpu_to_le16(skb->len); paylen = skb->len;
if (skb->ip_summed == CHECKSUM_PARTIAL) { if (skb->ip_summed == CHECKSUM_PARTIAL) {
skb_reset_mac_len(skb); skb_reset_mac_len(skb);
...@@ -802,7 +783,7 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv, ...@@ -802,7 +783,7 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv,
cpu_to_le32(ol_type_vlan_len_msec); cpu_to_le32(ol_type_vlan_len_msec);
desc->tx.type_cs_vlan_tso_len = desc->tx.type_cs_vlan_tso_len =
cpu_to_le32(type_cs_vlan_tso); cpu_to_le32(type_cs_vlan_tso);
desc->tx.paylen = cpu_to_le16(paylen); desc->tx.paylen = cpu_to_le32(paylen);
desc->tx.mss = cpu_to_le16(mss); desc->tx.mss = cpu_to_le16(mss);
} }
...@@ -1025,8 +1006,7 @@ static netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, ...@@ -1025,8 +1006,7 @@ static netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb,
static int hns3_nic_net_set_mac_address(struct net_device *netdev, void *p) static int hns3_nic_net_set_mac_address(struct net_device *netdev, void *p)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
struct sockaddr *mac_addr = p; struct sockaddr *mac_addr = p;
int ret; int ret;
...@@ -1208,8 +1188,7 @@ static void hns3_nic_udp_tunnel_del(struct net_device *netdev, ...@@ -1208,8 +1188,7 @@ static void hns3_nic_udp_tunnel_del(struct net_device *netdev,
static int hns3_setup_tc(struct net_device *netdev, u8 tc) static int hns3_setup_tc(struct net_device *netdev, u8 tc)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
struct hnae3_knic_private_info *kinfo = &h->kinfo; struct hnae3_knic_private_info *kinfo = &h->kinfo;
unsigned int i; unsigned int i;
int ret; int ret;
...@@ -1259,8 +1238,7 @@ static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type, ...@@ -1259,8 +1238,7 @@ static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type,
static int hns3_vlan_rx_add_vid(struct net_device *netdev, static int hns3_vlan_rx_add_vid(struct net_device *netdev,
__be16 proto, u16 vid) __be16 proto, u16 vid)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
int ret = -EIO; int ret = -EIO;
if (h->ae_algo->ops->set_vlan_filter) if (h->ae_algo->ops->set_vlan_filter)
...@@ -1272,8 +1250,7 @@ static int hns3_vlan_rx_add_vid(struct net_device *netdev, ...@@ -1272,8 +1250,7 @@ static int hns3_vlan_rx_add_vid(struct net_device *netdev,
static int hns3_vlan_rx_kill_vid(struct net_device *netdev, static int hns3_vlan_rx_kill_vid(struct net_device *netdev,
__be16 proto, u16 vid) __be16 proto, u16 vid)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
int ret = -EIO; int ret = -EIO;
if (h->ae_algo->ops->set_vlan_filter) if (h->ae_algo->ops->set_vlan_filter)
...@@ -1285,8 +1262,7 @@ static int hns3_vlan_rx_kill_vid(struct net_device *netdev, ...@@ -1285,8 +1262,7 @@ static int hns3_vlan_rx_kill_vid(struct net_device *netdev,
static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
u8 qos, __be16 vlan_proto) u8 qos, __be16 vlan_proto)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
int ret = -EIO; int ret = -EIO;
if (h->ae_algo->ops->set_vf_vlan_filter) if (h->ae_algo->ops->set_vf_vlan_filter)
...@@ -1298,8 +1274,7 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, ...@@ -1298,8 +1274,7 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
bool if_running = netif_running(netdev); bool if_running = netif_running(netdev);
int ret; int ret;
...@@ -2609,7 +2584,7 @@ static void hns3_fini_ring(struct hns3_enet_ring *ring) ...@@ -2609,7 +2584,7 @@ static void hns3_fini_ring(struct hns3_enet_ring *ring)
ring->next_to_use = 0; ring->next_to_use = 0;
} }
int hns3_buf_size2type(u32 buf_size) static int hns3_buf_size2type(u32 buf_size)
{ {
int bd_size_type; int bd_size_type;
...@@ -2921,7 +2896,7 @@ static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc) ...@@ -2921,7 +2896,7 @@ static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)
return ret; return ret;
} }
const struct hnae3_client_ops client_ops = { static const struct hnae3_client_ops client_ops = {
.init_instance = hns3_client_init, .init_instance = hns3_client_init,
.uninit_instance = hns3_client_uninit, .uninit_instance = hns3_client_uninit,
.link_status_change = hns3_link_status_change, .link_status_change = hns3_link_status_change,
......
...@@ -587,6 +587,9 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value) ...@@ -587,6 +587,9 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)
#define hns3_for_each_ring(pos, head) \ #define hns3_for_each_ring(pos, head) \
for (pos = (head).ring; pos; pos = pos->next) for (pos = (head).ring; pos; pos = pos->next)
#define hns3_get_handle(ndev) \
(((struct hns3_nic_priv *)netdev_priv(ndev))->ae_handle)
void hns3_ethtool_set_ops(struct net_device *netdev); void hns3_ethtool_set_ops(struct net_device *netdev);
int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget); int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
......
...@@ -102,8 +102,7 @@ static void hns3_driv_to_eth_caps(u32 caps, struct ethtool_link_ksettings *cmd, ...@@ -102,8 +102,7 @@ static void hns3_driv_to_eth_caps(u32 caps, struct ethtool_link_ksettings *cmd,
static int hns3_get_sset_count(struct net_device *netdev, int stringset) static int hns3_get_sset_count(struct net_device *netdev, int stringset)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
const struct hnae3_ae_ops *ops = h->ae_algo->ops; const struct hnae3_ae_ops *ops = h->ae_algo->ops;
if (!ops->get_sset_count) if (!ops->get_sset_count)
...@@ -164,8 +163,7 @@ static u8 *hns3_get_strings_tqps(struct hnae3_handle *handle, u8 *data) ...@@ -164,8 +163,7 @@ static u8 *hns3_get_strings_tqps(struct hnae3_handle *handle, u8 *data)
static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 *data) static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
const struct hnae3_ae_ops *ops = h->ae_algo->ops; const struct hnae3_ae_ops *ops = h->ae_algo->ops;
char *buff = (char *)data; char *buff = (char *)data;
...@@ -217,11 +215,10 @@ static u64 *hns3_get_stats_tqps(struct hnae3_handle *handle, u64 *data) ...@@ -217,11 +215,10 @@ static u64 *hns3_get_stats_tqps(struct hnae3_handle *handle, u64 *data)
* @stats: statistics info. * @stats: statistics info.
* @data: statistics data. * @data: statistics data.
*/ */
void hns3_get_stats(struct net_device *netdev, struct ethtool_stats *stats, static void hns3_get_stats(struct net_device *netdev,
u64 *data) struct ethtool_stats *stats, u64 *data)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
u64 *p = data; u64 *p = data;
if (!h->ae_algo->ops->get_stats || !h->ae_algo->ops->update_stats) { if (!h->ae_algo->ops->get_stats || !h->ae_algo->ops->update_stats) {
...@@ -262,10 +259,7 @@ static void hns3_get_drvinfo(struct net_device *netdev, ...@@ -262,10 +259,7 @@ static void hns3_get_drvinfo(struct net_device *netdev,
static u32 hns3_get_link(struct net_device *netdev) static u32 hns3_get_link(struct net_device *netdev)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h;
h = priv->ae_handle;
if (h->ae_algo && h->ae_algo->ops && h->ae_algo->ops->get_status) if (h->ae_algo && h->ae_algo->ops && h->ae_algo->ops->get_status)
return h->ae_algo->ops->get_status(h); return h->ae_algo->ops->get_status(h);
...@@ -277,7 +271,8 @@ static void hns3_get_ringparam(struct net_device *netdev, ...@@ -277,7 +271,8 @@ static void hns3_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *param) struct ethtool_ringparam *param)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hns3_nic_priv *priv = netdev_priv(netdev);
int queue_num = priv->ae_handle->kinfo.num_tqps; struct hnae3_handle *h = priv->ae_handle;
int queue_num = h->kinfo.num_tqps;
param->tx_max_pending = HNS3_RING_MAX_PENDING; param->tx_max_pending = HNS3_RING_MAX_PENDING;
param->rx_max_pending = HNS3_RING_MAX_PENDING; param->rx_max_pending = HNS3_RING_MAX_PENDING;
...@@ -289,8 +284,7 @@ static void hns3_get_ringparam(struct net_device *netdev, ...@@ -289,8 +284,7 @@ static void hns3_get_ringparam(struct net_device *netdev,
static void hns3_get_pauseparam(struct net_device *netdev, static void hns3_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *param) struct ethtool_pauseparam *param)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (h->ae_algo && h->ae_algo->ops && h->ae_algo->ops->get_pauseparam) if (h->ae_algo && h->ae_algo->ops && h->ae_algo->ops->get_pauseparam)
h->ae_algo->ops->get_pauseparam(h, &param->autoneg, h->ae_algo->ops->get_pauseparam(h, &param->autoneg,
...@@ -300,8 +294,7 @@ static void hns3_get_pauseparam(struct net_device *netdev, ...@@ -300,8 +294,7 @@ static void hns3_get_pauseparam(struct net_device *netdev,
static int hns3_get_link_ksettings(struct net_device *netdev, static int hns3_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd) struct ethtool_link_ksettings *cmd)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
u32 supported_caps; u32 supported_caps;
u32 advertised_caps; u32 advertised_caps;
u8 media_type = HNAE3_MEDIA_TYPE_UNKNOWN; u8 media_type = HNAE3_MEDIA_TYPE_UNKNOWN;
...@@ -392,8 +385,7 @@ static int hns3_get_link_ksettings(struct net_device *netdev, ...@@ -392,8 +385,7 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
static u32 hns3_get_rss_key_size(struct net_device *netdev) static u32 hns3_get_rss_key_size(struct net_device *netdev)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (!h->ae_algo || !h->ae_algo->ops || if (!h->ae_algo || !h->ae_algo->ops ||
!h->ae_algo->ops->get_rss_key_size) !h->ae_algo->ops->get_rss_key_size)
...@@ -404,8 +396,7 @@ static u32 hns3_get_rss_key_size(struct net_device *netdev) ...@@ -404,8 +396,7 @@ static u32 hns3_get_rss_key_size(struct net_device *netdev)
static u32 hns3_get_rss_indir_size(struct net_device *netdev) static u32 hns3_get_rss_indir_size(struct net_device *netdev)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (!h->ae_algo || !h->ae_algo->ops || if (!h->ae_algo || !h->ae_algo->ops ||
!h->ae_algo->ops->get_rss_indir_size) !h->ae_algo->ops->get_rss_indir_size)
...@@ -417,8 +408,7 @@ static u32 hns3_get_rss_indir_size(struct net_device *netdev) ...@@ -417,8 +408,7 @@ static u32 hns3_get_rss_indir_size(struct net_device *netdev)
static int hns3_get_rss(struct net_device *netdev, u32 *indir, u8 *key, static int hns3_get_rss(struct net_device *netdev, u32 *indir, u8 *key,
u8 *hfunc) u8 *hfunc)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->get_rss) if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->get_rss)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -429,8 +419,7 @@ static int hns3_get_rss(struct net_device *netdev, u32 *indir, u8 *key, ...@@ -429,8 +419,7 @@ static int hns3_get_rss(struct net_device *netdev, u32 *indir, u8 *key,
static int hns3_set_rss(struct net_device *netdev, const u32 *indir, static int hns3_set_rss(struct net_device *netdev, const u32 *indir,
const u8 *key, const u8 hfunc) const u8 *key, const u8 hfunc)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->set_rss) if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->set_rss)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -454,8 +443,7 @@ static int hns3_get_rxnfc(struct net_device *netdev, ...@@ -454,8 +443,7 @@ static int hns3_get_rxnfc(struct net_device *netdev,
struct ethtool_rxnfc *cmd, struct ethtool_rxnfc *cmd,
u32 *rule_locs) u32 *rule_locs)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_handle *h = priv->ae_handle;
if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->get_tc_size) if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->get_tc_size)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment