Merge branch 'hns3-next'

Huazhong Tan says:

====================
net: hns3: some cleanups & bugfixes

This patch-set includes cleanups and bugfixes for
the HNS3 ethernet controller driver.

[patch 1/9] fixes VF's broadcast promisc mode not enabled after
initializing.

[patch 2/9] adds hints for fibre port not support flow control.

[patch 3/9] fixes a port capbility updating issue.

[patch 4/9 - 9/9] adds some cleanups for HNS3 driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2019-07-05 15:39:39 -07:00
commit 2bf8001e53
10 changed files with 149 additions and 65 deletions

View File

@ -951,8 +951,9 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto,
static void hns3_set_txbd_baseinfo(u16 *bdtp_fe_sc_vld_ra_ri, int frag_end) static void hns3_set_txbd_baseinfo(u16 *bdtp_fe_sc_vld_ra_ri, int frag_end)
{ {
/* Config bd buffer end */ /* Config bd buffer end */
hns3_set_field(*bdtp_fe_sc_vld_ra_ri, HNS3_TXD_FE_B, !!frag_end); if (!!frag_end)
hns3_set_field(*bdtp_fe_sc_vld_ra_ri, HNS3_TXD_VLD_B, 1); hns3_set_field(*bdtp_fe_sc_vld_ra_ri, HNS3_TXD_FE_B, 1U);
hns3_set_field(*bdtp_fe_sc_vld_ra_ri, HNS3_TXD_VLD_B, 1U);
} }
static int hns3_fill_desc_vtags(struct sk_buff *skb, static int hns3_fill_desc_vtags(struct sk_buff *skb,
@ -2575,7 +2576,7 @@ static bool hns3_parse_vlan_tag(struct hns3_enet_ring *ring,
} }
} }
static int hns3_alloc_skb(struct hns3_enet_ring *ring, int length, static int hns3_alloc_skb(struct hns3_enet_ring *ring, unsigned int length,
unsigned char *va) unsigned char *va)
{ {
#define HNS3_NEED_ADD_FRAG 1 #define HNS3_NEED_ADD_FRAG 1
@ -2818,8 +2819,8 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring,
struct sk_buff *skb = ring->skb; struct sk_buff *skb = ring->skb;
struct hns3_desc_cb *desc_cb; struct hns3_desc_cb *desc_cb;
struct hns3_desc *desc; struct hns3_desc *desc;
unsigned int length;
u32 bd_base_info; u32 bd_base_info;
int length;
int ret; int ret;
desc = &ring->desc[ring->next_to_clean]; desc = &ring->desc[ring->next_to_clean];

View File

@ -610,7 +610,7 @@ static inline bool hns3_nic_resetting(struct net_device *netdev)
#define hnae3_buf_size(_ring) ((_ring)->buf_size) #define hnae3_buf_size(_ring) ((_ring)->buf_size)
#define hnae3_page_order(_ring) (get_order(hnae3_buf_size(_ring))) #define hnae3_page_order(_ring) (get_order(hnae3_buf_size(_ring)))
#define hnae3_page_size(_ring) (PAGE_SIZE << hnae3_page_order(_ring)) #define hnae3_page_size(_ring) (PAGE_SIZE << (u32)hnae3_page_order(_ring))
/* iterator for handling rings in ring group */ /* iterator for handling rings in ring group */
#define hns3_for_each_ring(pos, head) \ #define hns3_for_each_ring(pos, head) \

View File

@ -188,12 +188,43 @@ static bool hclge_is_special_opcode(u16 opcode)
return false; return false;
} }
static int hclge_cmd_convert_err_code(u16 desc_ret)
{
switch (desc_ret) {
case HCLGE_CMD_EXEC_SUCCESS:
return 0;
case HCLGE_CMD_NO_AUTH:
return -EPERM;
case HCLGE_CMD_NOT_SUPPORTED:
return -EOPNOTSUPP;
case HCLGE_CMD_QUEUE_FULL:
return -EXFULL;
case HCLGE_CMD_NEXT_ERR:
return -ENOSR;
case HCLGE_CMD_UNEXE_ERR:
return -ENOTBLK;
case HCLGE_CMD_PARA_ERR:
return -EINVAL;
case HCLGE_CMD_RESULT_ERR:
return -ERANGE;
case HCLGE_CMD_TIMEOUT:
return -ETIME;
case HCLGE_CMD_HILINK_ERR:
return -ENOLINK;
case HCLGE_CMD_QUEUE_ILLEGAL:
return -ENXIO;
case HCLGE_CMD_INVALID:
return -EBADR;
default:
return -EIO;
}
}
static int hclge_cmd_check_retval(struct hclge_hw *hw, struct hclge_desc *desc, static int hclge_cmd_check_retval(struct hclge_hw *hw, struct hclge_desc *desc,
int num, int ntc) int num, int ntc)
{ {
u16 opcode, desc_ret; u16 opcode, desc_ret;
int handle; int handle;
int retval;
opcode = le16_to_cpu(desc[0].opcode); opcode = le16_to_cpu(desc[0].opcode);
for (handle = 0; handle < num; handle++) { for (handle = 0; handle < num; handle++) {
@ -207,17 +238,9 @@ static int hclge_cmd_check_retval(struct hclge_hw *hw, struct hclge_desc *desc,
else else
desc_ret = le16_to_cpu(desc[0].retval); desc_ret = le16_to_cpu(desc[0].retval);
if (desc_ret == HCLGE_CMD_EXEC_SUCCESS)
retval = 0;
else if (desc_ret == HCLGE_CMD_NO_AUTH)
retval = -EPERM;
else if (desc_ret == HCLGE_CMD_NOT_SUPPORTED)
retval = -EOPNOTSUPP;
else
retval = -EIO;
hw->cmq.last_status = desc_ret; hw->cmq.last_status = desc_ret;
return retval; return hclge_cmd_convert_err_code(desc_ret);
} }
/** /**

View File

@ -41,6 +41,14 @@ enum hclge_cmd_return_status {
HCLGE_CMD_NO_AUTH = 1, HCLGE_CMD_NO_AUTH = 1,
HCLGE_CMD_NOT_SUPPORTED = 2, HCLGE_CMD_NOT_SUPPORTED = 2,
HCLGE_CMD_QUEUE_FULL = 3, HCLGE_CMD_QUEUE_FULL = 3,
HCLGE_CMD_NEXT_ERR = 4,
HCLGE_CMD_UNEXE_ERR = 5,
HCLGE_CMD_PARA_ERR = 6,
HCLGE_CMD_RESULT_ERR = 7,
HCLGE_CMD_TIMEOUT = 8,
HCLGE_CMD_HILINK_ERR = 9,
HCLGE_CMD_QUEUE_ILLEGAL = 10,
HCLGE_CMD_INVALID = 11,
}; };
enum hclge_cmd_status { enum hclge_cmd_status {

View File

@ -1360,8 +1360,9 @@ static int hclge_map_tqps_to_func(struct hclge_dev *hdev, u16 func_id,
req = (struct hclge_tqp_map_cmd *)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 = func_id; req->tqp_vf = func_id;
req->tqp_flag = !is_pf << HCLGE_TQP_MAP_TYPE_B | req->tqp_flag = 1U << HCLGE_TQP_MAP_EN_B;
1 << HCLGE_TQP_MAP_EN_B; if (!is_pf)
req->tqp_flag |= 1U << HCLGE_TQP_MAP_TYPE_B;
req->tqp_vid = cpu_to_le16(tqp_vid); req->tqp_vid = cpu_to_le16(tqp_vid);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
@ -2320,7 +2321,8 @@ static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable)
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_cmd *)desc.data; req = (struct hclge_config_auto_neg_cmd *)desc.data;
hnae3_set_bit(flag, HCLGE_MAC_CFG_AN_EN_B, !!enable); if (enable)
hnae3_set_bit(flag, HCLGE_MAC_CFG_AN_EN_B, 1U);
req->cfg_an_cmd_flag = cpu_to_le32(flag); 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);
@ -2663,6 +2665,7 @@ static int hclge_get_sfp_info(struct hclge_dev *hdev, struct hclge_mac *mac)
mac->speed_ability = le32_to_cpu(resp->speed_ability); mac->speed_ability = le32_to_cpu(resp->speed_ability);
mac->autoneg = resp->autoneg; mac->autoneg = resp->autoneg;
mac->support_autoneg = resp->autoneg_ability; mac->support_autoneg = resp->autoneg_ability;
mac->speed_type = QUERY_ACTIVE_SPEED;
if (!resp->active_fec) if (!resp->active_fec)
mac->fec_mode = 0; mac->fec_mode = 0;
else else
@ -4091,11 +4094,11 @@ int hclge_rss_init_hw(struct hclge_dev *hdev)
struct hclge_vport *vport = hdev->vport; struct hclge_vport *vport = hdev->vport;
u8 *rss_indir = vport[0].rss_indirection_tbl; u8 *rss_indir = vport[0].rss_indirection_tbl;
u16 rss_size = vport[0].alloc_rss_size; u16 rss_size = vport[0].alloc_rss_size;
u16 tc_offset[HCLGE_MAX_TC_NUM] = {0};
u16 tc_size[HCLGE_MAX_TC_NUM] = {0};
u8 *key = vport[0].rss_hash_key; u8 *key = vport[0].rss_hash_key;
u8 hfunc = vport[0].rss_algo; u8 hfunc = vport[0].rss_algo;
u16 tc_offset[HCLGE_MAX_TC_NUM];
u16 tc_valid[HCLGE_MAX_TC_NUM]; u16 tc_valid[HCLGE_MAX_TC_NUM];
u16 tc_size[HCLGE_MAX_TC_NUM];
u16 roundup_size; u16 roundup_size;
unsigned int i; unsigned int i;
int ret; int ret;
@ -5934,20 +5937,20 @@ static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable)
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);
hnae3_set_bit(loop_en, HCLGE_MAC_TX_EN_B, enable);
hnae3_set_bit(loop_en, HCLGE_MAC_RX_EN_B, enable); if (enable) {
hnae3_set_bit(loop_en, HCLGE_MAC_PAD_TX_B, enable); hnae3_set_bit(loop_en, HCLGE_MAC_TX_EN_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_PAD_RX_B, enable); hnae3_set_bit(loop_en, HCLGE_MAC_RX_EN_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_1588_TX_B, 0); hnae3_set_bit(loop_en, HCLGE_MAC_PAD_TX_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_1588_RX_B, 0); hnae3_set_bit(loop_en, HCLGE_MAC_PAD_RX_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_APP_LP_B, 0); hnae3_set_bit(loop_en, HCLGE_MAC_FCS_TX_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_LINE_LP_B, 0); hnae3_set_bit(loop_en, HCLGE_MAC_RX_FCS_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_FCS_TX_B, enable); hnae3_set_bit(loop_en, HCLGE_MAC_RX_FCS_STRIP_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_RX_FCS_B, enable); hnae3_set_bit(loop_en, HCLGE_MAC_TX_OVERSIZE_TRUNCATE_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_RX_FCS_STRIP_B, enable); hnae3_set_bit(loop_en, HCLGE_MAC_RX_OVERSIZE_TRUNCATE_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_TX_OVERSIZE_TRUNCATE_B, enable); hnae3_set_bit(loop_en, HCLGE_MAC_TX_UNDER_MIN_ERR_B, 1U);
hnae3_set_bit(loop_en, HCLGE_MAC_RX_OVERSIZE_TRUNCATE_B, enable); }
hnae3_set_bit(loop_en, HCLGE_MAC_TX_UNDER_MIN_ERR_B, enable);
req->txrx_pad_fcs_loop_en = cpu_to_le32(loop_en); req->txrx_pad_fcs_loop_en = cpu_to_le32(loop_en);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
@ -6309,8 +6312,8 @@ static int hclge_update_desc_vfid(struct hclge_desc *desc, int vfid, bool clr)
{ {
#define HCLGE_VF_NUM_IN_FIRST_DESC 192 #define HCLGE_VF_NUM_IN_FIRST_DESC 192
int word_num; unsigned int word_num;
int bit_num; unsigned int bit_num;
if (vfid > 255 || vfid < 0) if (vfid > 255 || vfid < 0)
return -EIO; return -EIO;
@ -7971,7 +7974,8 @@ static int hclge_send_reset_tqp_cmd(struct hclge_dev *hdev, u16 queue_id,
req = (struct hclge_reset_tqp_queue_cmd *)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);
hnae3_set_bit(req->reset_req, HCLGE_TQP_RESET_B, enable); if (enable)
hnae3_set_bit(req->reset_req, HCLGE_TQP_RESET_B, 1U);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret) {
@ -8179,8 +8183,9 @@ static void hclge_get_pauseparam(struct hnae3_handle *handle, u32 *auto_neg,
{ {
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 phy_device *phydev = hdev->hw.mac.phydev;
*auto_neg = hclge_get_autoneg(handle); *auto_neg = phydev ? hclge_get_autoneg(handle) : 0;
if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) { if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) {
*rx_en = 0; *rx_en = 0;
@ -8211,11 +8216,13 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
struct phy_device *phydev = hdev->hw.mac.phydev; struct phy_device *phydev = hdev->hw.mac.phydev;
u32 fc_autoneg; u32 fc_autoneg;
fc_autoneg = hclge_get_autoneg(handle); if (phydev) {
if (auto_neg != fc_autoneg) { fc_autoneg = hclge_get_autoneg(handle);
dev_info(&hdev->pdev->dev, if (auto_neg != fc_autoneg) {
"To change autoneg please use: ethtool -s <dev> autoneg <on|off>\n"); dev_info(&hdev->pdev->dev,
return -EOPNOTSUPP; "To change autoneg please use: ethtool -s <dev> autoneg <on|off>\n");
return -EOPNOTSUPP;
}
} }
if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) { if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) {
@ -8226,16 +8233,13 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
hclge_set_flowctrl_adv(hdev, rx_en, tx_en); hclge_set_flowctrl_adv(hdev, rx_en, tx_en);
if (!fc_autoneg) if (!auto_neg)
return hclge_cfg_pauseparam(hdev, rx_en, tx_en); return hclge_cfg_pauseparam(hdev, rx_en, tx_en);
if (phydev) if (phydev)
return phy_start_aneg(phydev); return phy_start_aneg(phydev);
if (hdev->pdev->revision == 0x20) return -EOPNOTSUPP;
return -EOPNOTSUPP;
return hclge_restart_autoneg(handle);
} }
static void hclge_get_ksettings_an_result(struct hnae3_handle *handle, static void hclge_get_ksettings_an_result(struct hnae3_handle *handle,
@ -9035,12 +9039,12 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num,
{ {
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo; struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo;
u16 tc_offset[HCLGE_MAX_TC_NUM] = {0};
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
u16 tc_size[HCLGE_MAX_TC_NUM] = {0};
int cur_rss_size = kinfo->rss_size; int cur_rss_size = kinfo->rss_size;
int cur_tqps = kinfo->num_tqps; int cur_tqps = kinfo->num_tqps;
u16 tc_offset[HCLGE_MAX_TC_NUM];
u16 tc_valid[HCLGE_MAX_TC_NUM]; u16 tc_valid[HCLGE_MAX_TC_NUM];
u16 tc_size[HCLGE_MAX_TC_NUM];
u16 roundup_size; u16 roundup_size;
u32 *rss_indir; u32 *rss_indir;
unsigned int i; unsigned int i;

View File

@ -29,6 +29,10 @@ static int hclge_gen_resp_to_vf(struct hclge_vport *vport,
"PF fail to gen resp to VF len %d exceeds max len %d\n", "PF fail to gen resp to VF len %d exceeds max len %d\n",
resp_data_len, resp_data_len,
HCLGE_MBX_MAX_RESP_DATA_SIZE); HCLGE_MBX_MAX_RESP_DATA_SIZE);
/* If resp_data_len is too long, set the value to max length
* and return the msg to VF
*/
resp_data_len = HCLGE_MBX_MAX_RESP_DATA_SIZE;
} }
hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false); hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false);

View File

@ -177,6 +177,38 @@ void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc,
desc->flag &= cpu_to_le16(~HCLGEVF_CMD_FLAG_WR); desc->flag &= cpu_to_le16(~HCLGEVF_CMD_FLAG_WR);
} }
static int hclgevf_cmd_convert_err_code(u16 desc_ret)
{
switch (desc_ret) {
case HCLGEVF_CMD_EXEC_SUCCESS:
return 0;
case HCLGEVF_CMD_NO_AUTH:
return -EPERM;
case HCLGEVF_CMD_NOT_SUPPORTED:
return -EOPNOTSUPP;
case HCLGEVF_CMD_QUEUE_FULL:
return -EXFULL;
case HCLGEVF_CMD_NEXT_ERR:
return -ENOSR;
case HCLGEVF_CMD_UNEXE_ERR:
return -ENOTBLK;
case HCLGEVF_CMD_PARA_ERR:
return -EINVAL;
case HCLGEVF_CMD_RESULT_ERR:
return -ERANGE;
case HCLGEVF_CMD_TIMEOUT:
return -ETIME;
case HCLGEVF_CMD_HILINK_ERR:
return -ENOLINK;
case HCLGEVF_CMD_QUEUE_ILLEGAL:
return -ENXIO;
case HCLGEVF_CMD_INVALID:
return -EBADR;
default:
return -EIO;
}
}
/* hclgevf_cmd_send - send command to command queue /* hclgevf_cmd_send - send command to command queue
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
* @desc: prefilled descriptor for describing the command * @desc: prefilled descriptor for describing the command
@ -259,11 +291,7 @@ int hclgevf_cmd_send(struct hclgevf_hw *hw, struct hclgevf_desc *desc, int num)
else else
retval = le16_to_cpu(desc[0].retval); retval = le16_to_cpu(desc[0].retval);
if ((enum hclgevf_cmd_return_status)retval == status = hclgevf_cmd_convert_err_code(retval);
HCLGEVF_CMD_EXEC_SUCCESS)
status = 0;
else
status = -EIO;
hw->cmq.last_status = (enum hclgevf_cmd_status)retval; hw->cmq.last_status = (enum hclgevf_cmd_status)retval;
ntc++; ntc++;
handle++; handle++;

View File

@ -46,9 +46,17 @@ struct hclgevf_cmq_ring {
enum hclgevf_cmd_return_status { enum hclgevf_cmd_return_status {
HCLGEVF_CMD_EXEC_SUCCESS = 0, HCLGEVF_CMD_EXEC_SUCCESS = 0,
HCLGEVF_CMD_NO_AUTH = 1, HCLGEVF_CMD_NO_AUTH = 1,
HCLGEVF_CMD_NOT_EXEC = 2, HCLGEVF_CMD_NOT_SUPPORTED = 2,
HCLGEVF_CMD_QUEUE_FULL = 3, HCLGEVF_CMD_QUEUE_FULL = 3,
HCLGEVF_CMD_NEXT_ERR = 4,
HCLGEVF_CMD_UNEXE_ERR = 5,
HCLGEVF_CMD_PARA_ERR = 6,
HCLGEVF_CMD_RESULT_ERR = 7,
HCLGEVF_CMD_TIMEOUT = 8,
HCLGEVF_CMD_HILINK_ERR = 9,
HCLGEVF_CMD_QUEUE_ILLEGAL = 10,
HCLGEVF_CMD_INVALID = 11,
}; };
enum hclgevf_cmd_status { enum hclgevf_cmd_status {

View File

@ -994,6 +994,8 @@ static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en,
u8 type; u8 type;
req = (struct hclge_mbx_vf_to_pf_cmd *)desc.data; req = (struct hclge_mbx_vf_to_pf_cmd *)desc.data;
type = en ? HCLGE_MBX_MAP_RING_TO_VECTOR :
HCLGE_MBX_UNMAP_RING_TO_VECTOR;
for (node = ring_chain; node; node = node->next) { for (node = ring_chain; node; node = node->next) {
int idx_offset = HCLGE_MBX_RING_MAP_BASIC_MSG_NUM + int idx_offset = HCLGE_MBX_RING_MAP_BASIC_MSG_NUM +
@ -1003,9 +1005,6 @@ static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en,
hclgevf_cmd_setup_basic_desc(&desc, hclgevf_cmd_setup_basic_desc(&desc,
HCLGEVF_OPC_MBX_VF_TO_PF, HCLGEVF_OPC_MBX_VF_TO_PF,
false); false);
type = en ?
HCLGE_MBX_MAP_RING_TO_VECTOR :
HCLGE_MBX_UNMAP_RING_TO_VECTOR;
req->msg[0] = type; req->msg[0] = type;
req->msg[1] = vector_id; req->msg[1] = vector_id;
} }
@ -2589,6 +2588,12 @@ static int hclgevf_reset_hdev(struct hclgevf_dev *hdev)
return ret; return ret;
} }
if (pdev->revision >= 0x21) {
ret = hclgevf_set_promisc_mode(hdev, true);
if (ret)
return ret;
}
dev_info(&hdev->pdev->dev, "Reset done\n"); dev_info(&hdev->pdev->dev, "Reset done\n");
return 0; return 0;
@ -2668,9 +2673,11 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
* firmware makes sure broadcast packets can be accepted. * firmware makes sure broadcast packets can be accepted.
* For revision 0x21, default to enable broadcast promisc mode. * For revision 0x21, default to enable broadcast promisc mode.
*/ */
ret = hclgevf_set_promisc_mode(hdev, true); if (pdev->revision >= 0x21) {
if (ret) ret = hclgevf_set_promisc_mode(hdev, true);
goto err_config; if (ret)
goto err_config;
}
/* Initialize RSS for this VF */ /* Initialize RSS for this VF */
ret = hclgevf_rss_init_hw(hdev); ret = hclgevf_rss_init_hw(hdev);

View File

@ -102,7 +102,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, u16 code, u16 subcode,
~HCLGE_MBX_NEED_RESP_BIT; ~HCLGE_MBX_NEED_RESP_BIT;
req->msg[0] = code; req->msg[0] = code;
req->msg[1] = subcode; req->msg[1] = subcode;
memcpy(&req->msg[2], msg_data, msg_len); if (msg_data)
memcpy(&req->msg[2], msg_data, msg_len);
/* synchronous send */ /* synchronous send */
if (need_resp) { if (need_resp) {