Merge branch 'hns3-next'
Guangbin Huang says: ==================== net: hns3: updates for -next This series includes some updates for the HNS3 ethernet driver. Change logs: V1 -> V2: - Fix some sparse warnings of patch 3# and 4#. - Add patch #6 to fix sparse warnings of incorrect type of argument. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Коммит
9c095bd0d4
|
@ -46,6 +46,7 @@ enum HCLGE_MBX_OPCODE {
|
|||
HCLGE_MBX_PUSH_PROMISC_INFO, /* (PF -> VF) push vf promisc info */
|
||||
HCLGE_MBX_VF_UNINIT, /* (VF -> PF) vf is unintializing */
|
||||
HCLGE_MBX_HANDLE_VF_TBL, /* (VF -> PF) store/clear hw table */
|
||||
HCLGE_MBX_GET_RING_VECTOR_MAP, /* (VF -> PF) get ring-to-vector map */
|
||||
|
||||
HCLGE_MBX_GET_VF_FLR_STATUS = 200, /* (M7 -> PF) get vf flr status */
|
||||
HCLGE_MBX_PUSH_LINK_STATUS, /* (M7 -> PF) get port link status */
|
||||
|
@ -92,8 +93,8 @@ struct hclge_ring_chain_param {
|
|||
struct hclge_basic_info {
|
||||
u8 hw_tc_map;
|
||||
u8 rsv;
|
||||
u16 mbx_api_version;
|
||||
u32 pf_caps;
|
||||
__le16 mbx_api_version;
|
||||
__le32 pf_caps;
|
||||
};
|
||||
|
||||
struct hclgevf_mbx_resp_status {
|
||||
|
@ -134,13 +135,13 @@ struct hclge_vf_to_pf_msg {
|
|||
};
|
||||
|
||||
struct hclge_pf_to_vf_msg {
|
||||
u16 code;
|
||||
__le16 code;
|
||||
union {
|
||||
/* used for mbx response */
|
||||
struct {
|
||||
u16 vf_mbx_msg_code;
|
||||
u16 vf_mbx_msg_subcode;
|
||||
u16 resp_status;
|
||||
__le16 vf_mbx_msg_code;
|
||||
__le16 vf_mbx_msg_subcode;
|
||||
__le16 resp_status;
|
||||
u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE];
|
||||
};
|
||||
/* used for general mbx */
|
||||
|
@ -157,7 +158,7 @@ struct hclge_mbx_vf_to_pf_cmd {
|
|||
u8 rsv1[1];
|
||||
u8 msg_len;
|
||||
u8 rsv2;
|
||||
u16 match_id;
|
||||
__le16 match_id;
|
||||
struct hclge_vf_to_pf_msg msg;
|
||||
};
|
||||
|
||||
|
@ -168,7 +169,7 @@ struct hclge_mbx_pf_to_vf_cmd {
|
|||
u8 rsv[3];
|
||||
u8 msg_len;
|
||||
u8 rsv1;
|
||||
u16 match_id;
|
||||
__le16 match_id;
|
||||
struct hclge_pf_to_vf_msg msg;
|
||||
};
|
||||
|
||||
|
@ -178,6 +179,49 @@ struct hclge_vf_rst_cmd {
|
|||
u8 rsv[22];
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct hclge_mbx_link_status {
|
||||
__le16 link_status;
|
||||
__le32 speed;
|
||||
__le16 duplex;
|
||||
u8 flag;
|
||||
};
|
||||
|
||||
struct hclge_mbx_link_mode {
|
||||
__le16 idx;
|
||||
__le64 link_mode;
|
||||
};
|
||||
|
||||
struct hclge_mbx_port_base_vlan {
|
||||
__le16 state;
|
||||
__le16 vlan_proto;
|
||||
__le16 qos;
|
||||
__le16 vlan_tag;
|
||||
};
|
||||
|
||||
struct hclge_mbx_vf_queue_info {
|
||||
__le16 num_tqps;
|
||||
__le16 rss_size;
|
||||
__le16 rx_buf_len;
|
||||
};
|
||||
|
||||
struct hclge_mbx_vf_queue_depth {
|
||||
__le16 num_tx_desc;
|
||||
__le16 num_rx_desc;
|
||||
};
|
||||
|
||||
struct hclge_mbx_vlan_filter {
|
||||
u8 is_kill;
|
||||
__le16 vlan_id;
|
||||
__le16 proto;
|
||||
};
|
||||
|
||||
struct hclge_mbx_mtu_info {
|
||||
__le32 mtu;
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* used by VF to store the received Async responses from PF */
|
||||
struct hclgevf_mbx_arq_ring {
|
||||
#define HCLGE_MBX_MAX_ARQ_MSG_SIZE 8
|
||||
|
@ -186,7 +230,7 @@ struct hclgevf_mbx_arq_ring {
|
|||
u32 head;
|
||||
u32 tail;
|
||||
atomic_t count;
|
||||
u16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE];
|
||||
__le16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE];
|
||||
};
|
||||
|
||||
#define hclge_mbx_ring_ptr_move_crq(crq) \
|
||||
|
|
|
@ -106,7 +106,7 @@ int hclge_comm_parse_rss_hfunc(struct hclge_comm_rss_cfg *rss_cfg,
|
|||
void hclge_comm_get_rss_hash_info(struct hclge_comm_rss_cfg *rss_cfg, u8 *key,
|
||||
u8 *hfunc);
|
||||
void hclge_comm_get_rss_indir_tbl(struct hclge_comm_rss_cfg *rss_cfg,
|
||||
u32 *indir, __le16 rss_ind_tbl_size);
|
||||
u32 *indir, u16 rss_ind_tbl_size);
|
||||
int hclge_comm_set_rss_algo_key(struct hclge_comm_hw *hw, const u8 hfunc,
|
||||
const u8 *key);
|
||||
int hclge_comm_init_rss_tuple_cmd(struct hclge_comm_rss_cfg *rss_cfg,
|
||||
|
|
|
@ -1915,8 +1915,11 @@ static int hns3_set_tunable(struct net_device *netdev,
|
|||
return ret;
|
||||
}
|
||||
|
||||
netdev_info(netdev, "the active tx spare buf size is %u, due to page order\n",
|
||||
priv->ring->tx_spare->len);
|
||||
if (!priv->ring->tx_spare)
|
||||
netdev_info(netdev, "the active tx spare buf size is 0, disable tx spare buffer\n");
|
||||
else
|
||||
netdev_info(netdev, "the active tx spare buf size is %u, due to page order\n",
|
||||
priv->ring->tx_spare->len);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1546,9 +1546,8 @@ static void hclge_init_tc_config(struct hclge_dev *hdev)
|
|||
static int hclge_configure(struct hclge_dev *hdev)
|
||||
{
|
||||
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
|
||||
const struct cpumask *cpumask = cpu_online_mask;
|
||||
struct hclge_cfg cfg;
|
||||
int node, ret;
|
||||
int ret;
|
||||
|
||||
ret = hclge_get_cfg(hdev, &cfg);
|
||||
if (ret)
|
||||
|
@ -1594,13 +1593,6 @@ static int hclge_configure(struct hclge_dev *hdev)
|
|||
hclge_init_tc_config(hdev);
|
||||
hclge_init_kdump_kernel_config(hdev);
|
||||
|
||||
/* Set the affinity based on numa node */
|
||||
node = dev_to_node(&hdev->pdev->dev);
|
||||
if (node != NUMA_NO_NODE)
|
||||
cpumask = cpumask_of_node(node);
|
||||
|
||||
cpumask_copy(&hdev->affinity_mask, cpumask);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3564,17 +3556,6 @@ static void hclge_get_misc_vector(struct hclge_dev *hdev)
|
|||
hdev->num_msi_used += 1;
|
||||
}
|
||||
|
||||
static void hclge_misc_affinity_setup(struct hclge_dev *hdev)
|
||||
{
|
||||
irq_set_affinity_hint(hdev->misc_vector.vector_irq,
|
||||
&hdev->affinity_mask);
|
||||
}
|
||||
|
||||
static void hclge_misc_affinity_teardown(struct hclge_dev *hdev)
|
||||
{
|
||||
irq_set_affinity_hint(hdev->misc_vector.vector_irq, NULL);
|
||||
}
|
||||
|
||||
static int hclge_misc_irq_init(struct hclge_dev *hdev)
|
||||
{
|
||||
int ret;
|
||||
|
@ -11457,11 +11438,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|||
timer_setup(&hdev->reset_timer, hclge_reset_timer, 0);
|
||||
INIT_DELAYED_WORK(&hdev->service_task, hclge_service_task);
|
||||
|
||||
/* Setup affinity after service timer setup because add_timer_on
|
||||
* is called in affinity notify.
|
||||
*/
|
||||
hclge_misc_affinity_setup(hdev);
|
||||
|
||||
hclge_clear_all_event_cause(hdev);
|
||||
hclge_clear_resetting_state(hdev);
|
||||
|
||||
|
@ -11879,7 +11855,6 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|||
|
||||
hclge_reset_vf_rate(hdev);
|
||||
hclge_clear_vf_vlan(hdev);
|
||||
hclge_misc_affinity_teardown(hdev);
|
||||
hclge_state_uninit(hdev);
|
||||
hclge_ptp_uninit(hdev);
|
||||
hclge_uninit_rxd_adv_layout(hdev);
|
||||
|
|
|
@ -780,8 +780,8 @@ struct hclge_vf_vlan_cfg {
|
|||
union {
|
||||
struct {
|
||||
u8 is_kill;
|
||||
u16 vlan;
|
||||
u16 proto;
|
||||
__le16 vlan;
|
||||
__le16 proto;
|
||||
};
|
||||
u8 enable;
|
||||
};
|
||||
|
@ -938,8 +938,6 @@ struct hclge_dev {
|
|||
DECLARE_KFIFO(mac_tnl_log, struct hclge_mac_tnl_stats,
|
||||
HCLGE_MAC_TNL_LOG_SIZE);
|
||||
|
||||
/* affinity mask and notify for misc interrupt */
|
||||
cpumask_t affinity_mask;
|
||||
struct hclge_ptp *ptp;
|
||||
struct devlink *devlink;
|
||||
struct hclge_comm_rss_cfg rss_cfg;
|
||||
|
|
|
@ -57,17 +57,19 @@ static int hclge_gen_resp_to_vf(struct hclge_vport *vport,
|
|||
resp_pf_to_vf->msg_len = vf_to_pf_req->msg_len;
|
||||
resp_pf_to_vf->match_id = vf_to_pf_req->match_id;
|
||||
|
||||
resp_pf_to_vf->msg.code = HCLGE_MBX_PF_VF_RESP;
|
||||
resp_pf_to_vf->msg.vf_mbx_msg_code = vf_to_pf_req->msg.code;
|
||||
resp_pf_to_vf->msg.vf_mbx_msg_subcode = vf_to_pf_req->msg.subcode;
|
||||
resp_pf_to_vf->msg.code = cpu_to_le16(HCLGE_MBX_PF_VF_RESP);
|
||||
resp_pf_to_vf->msg.vf_mbx_msg_code =
|
||||
cpu_to_le16(vf_to_pf_req->msg.code);
|
||||
resp_pf_to_vf->msg.vf_mbx_msg_subcode =
|
||||
cpu_to_le16(vf_to_pf_req->msg.subcode);
|
||||
resp = hclge_errno_to_resp(resp_msg->status);
|
||||
if (resp < SHRT_MAX) {
|
||||
resp_pf_to_vf->msg.resp_status = resp;
|
||||
resp_pf_to_vf->msg.resp_status = cpu_to_le16(resp);
|
||||
} else {
|
||||
dev_warn(&hdev->pdev->dev,
|
||||
"failed to send response to VF, response status %u is out-of-bound\n",
|
||||
resp);
|
||||
resp_pf_to_vf->msg.resp_status = EIO;
|
||||
resp_pf_to_vf->msg.resp_status = cpu_to_le16(EIO);
|
||||
}
|
||||
|
||||
if (resp_msg->len > 0)
|
||||
|
@ -107,7 +109,7 @@ static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 *msg, u16 msg_len,
|
|||
|
||||
resp_pf_to_vf->dest_vfid = dest_vfid;
|
||||
resp_pf_to_vf->msg_len = msg_len;
|
||||
resp_pf_to_vf->msg.code = mbx_opcode;
|
||||
resp_pf_to_vf->msg.code = cpu_to_le16(mbx_opcode);
|
||||
|
||||
memcpy(resp_pf_to_vf->msg.msg_data, msg, msg_len);
|
||||
|
||||
|
@ -125,8 +127,8 @@ static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 *msg, u16 msg_len,
|
|||
int hclge_inform_reset_assert_to_vf(struct hclge_vport *vport)
|
||||
{
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
__le16 msg_data;
|
||||
u16 reset_type;
|
||||
u8 msg_data[2];
|
||||
u8 dest_vfid;
|
||||
|
||||
BUILD_BUG_ON(HNAE3_MAX_RESET > U16_MAX);
|
||||
|
@ -140,10 +142,10 @@ int hclge_inform_reset_assert_to_vf(struct hclge_vport *vport)
|
|||
else
|
||||
reset_type = HNAE3_VF_FUNC_RESET;
|
||||
|
||||
memcpy(&msg_data[0], &reset_type, sizeof(u16));
|
||||
msg_data = cpu_to_le16(reset_type);
|
||||
|
||||
/* send this requested info to VF */
|
||||
return hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data),
|
||||
return hclge_send_mbx_msg(vport, (u8 *)&msg_data, sizeof(msg_data),
|
||||
HCLGE_MBX_ASSERTING_RESET, dest_vfid);
|
||||
}
|
||||
|
||||
|
@ -249,6 +251,81 @@ static int hclge_map_unmap_ring_to_vf_vector(struct hclge_vport *vport, bool en,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int hclge_query_ring_vector_map(struct hclge_vport *vport,
|
||||
struct hnae3_ring_chain_node *ring_chain,
|
||||
struct hclge_desc *desc)
|
||||
{
|
||||
struct hclge_ctrl_vector_chain_cmd *req =
|
||||
(struct hclge_ctrl_vector_chain_cmd *)desc->data;
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
u16 tqp_type_and_id;
|
||||
int status;
|
||||
|
||||
hclge_cmd_setup_basic_desc(desc, HCLGE_OPC_ADD_RING_TO_VECTOR, true);
|
||||
|
||||
tqp_type_and_id = le16_to_cpu(req->tqp_type_and_id[0]);
|
||||
hnae3_set_field(tqp_type_and_id, HCLGE_INT_TYPE_M, HCLGE_INT_TYPE_S,
|
||||
hnae3_get_bit(ring_chain->flag, HNAE3_RING_TYPE_B));
|
||||
hnae3_set_field(tqp_type_and_id, HCLGE_TQP_ID_M, HCLGE_TQP_ID_S,
|
||||
ring_chain->tqp_index);
|
||||
req->tqp_type_and_id[0] = cpu_to_le16(tqp_type_and_id);
|
||||
req->vfid = vport->vport_id;
|
||||
|
||||
status = hclge_cmd_send(&hdev->hw, desc, 1);
|
||||
if (status)
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"Get VF ring vector map info fail, status is %d.\n",
|
||||
status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static int hclge_get_vf_ring_vector_map(struct hclge_vport *vport,
|
||||
struct hclge_mbx_vf_to_pf_cmd *req,
|
||||
struct hclge_respond_to_vf_msg *resp)
|
||||
{
|
||||
#define HCLGE_LIMIT_RING_NUM 1
|
||||
#define HCLGE_RING_TYPE_OFFSET 0
|
||||
#define HCLGE_TQP_INDEX_OFFSET 1
|
||||
#define HCLGE_INT_GL_INDEX_OFFSET 2
|
||||
#define HCLGE_VECTOR_ID_OFFSET 3
|
||||
#define HCLGE_RING_VECTOR_MAP_INFO_LEN 4
|
||||
struct hnae3_ring_chain_node ring_chain;
|
||||
struct hclge_desc desc;
|
||||
struct hclge_ctrl_vector_chain_cmd *data =
|
||||
(struct hclge_ctrl_vector_chain_cmd *)desc.data;
|
||||
u16 tqp_type_and_id;
|
||||
u8 int_gl_index;
|
||||
int ret;
|
||||
|
||||
req->msg.ring_num = HCLGE_LIMIT_RING_NUM;
|
||||
|
||||
memset(&ring_chain, 0, sizeof(ring_chain));
|
||||
ret = hclge_get_ring_chain_from_mbx(req, &ring_chain, vport);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = hclge_query_ring_vector_map(vport, &ring_chain, &desc);
|
||||
if (ret) {
|
||||
hclge_free_vector_ring_chain(&ring_chain);
|
||||
return ret;
|
||||
}
|
||||
|
||||
tqp_type_and_id = le16_to_cpu(data->tqp_type_and_id[0]);
|
||||
int_gl_index = hnae3_get_field(tqp_type_and_id,
|
||||
HCLGE_INT_GL_IDX_M, HCLGE_INT_GL_IDX_S);
|
||||
|
||||
resp->data[HCLGE_RING_TYPE_OFFSET] = req->msg.param[0].ring_type;
|
||||
resp->data[HCLGE_TQP_INDEX_OFFSET] = req->msg.param[0].tqp_index;
|
||||
resp->data[HCLGE_INT_GL_INDEX_OFFSET] = int_gl_index;
|
||||
resp->data[HCLGE_VECTOR_ID_OFFSET] = data->int_vector_id_l;
|
||||
resp->len = HCLGE_RING_VECTOR_MAP_INFO_LEN;
|
||||
|
||||
hclge_free_vector_ring_chain(&ring_chain);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void hclge_set_vf_promisc_mode(struct hclge_vport *vport,
|
||||
struct hclge_mbx_vf_to_pf_cmd *req)
|
||||
{
|
||||
|
@ -339,16 +416,14 @@ int hclge_push_vf_port_base_vlan_info(struct hclge_vport *vport, u8 vfid,
|
|||
u16 state,
|
||||
struct hclge_vlan_info *vlan_info)
|
||||
{
|
||||
#define MSG_DATA_SIZE 8
|
||||
struct hclge_mbx_port_base_vlan base_vlan;
|
||||
|
||||
u8 msg_data[MSG_DATA_SIZE];
|
||||
base_vlan.state = cpu_to_le16(state);
|
||||
base_vlan.vlan_proto = cpu_to_le16(vlan_info->vlan_proto);
|
||||
base_vlan.qos = cpu_to_le16(vlan_info->qos);
|
||||
base_vlan.vlan_tag = cpu_to_le16(vlan_info->vlan_tag);
|
||||
|
||||
memcpy(&msg_data[0], &state, sizeof(u16));
|
||||
memcpy(&msg_data[2], &vlan_info->vlan_proto, sizeof(u16));
|
||||
memcpy(&msg_data[4], &vlan_info->qos, sizeof(u16));
|
||||
memcpy(&msg_data[6], &vlan_info->vlan_tag, sizeof(u16));
|
||||
|
||||
return hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data),
|
||||
return hclge_send_mbx_msg(vport, (u8 *)&base_vlan, sizeof(base_vlan),
|
||||
HCLGE_MBX_PUSH_VLAN_INFO, vfid);
|
||||
}
|
||||
|
||||
|
@ -362,13 +437,16 @@ static int hclge_set_vf_vlan_cfg(struct hclge_vport *vport,
|
|||
struct hnae3_handle *handle = &vport->nic;
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
struct hclge_vf_vlan_cfg *msg_cmd;
|
||||
__be16 proto;
|
||||
u16 vlan_id;
|
||||
|
||||
msg_cmd = (struct hclge_vf_vlan_cfg *)&mbx_req->msg;
|
||||
switch (msg_cmd->subcode) {
|
||||
case HCLGE_MBX_VLAN_FILTER:
|
||||
return hclge_set_vlan_filter(handle,
|
||||
cpu_to_be16(msg_cmd->proto),
|
||||
msg_cmd->vlan, msg_cmd->is_kill);
|
||||
proto = cpu_to_be16(le16_to_cpu(msg_cmd->proto));
|
||||
vlan_id = le16_to_cpu(msg_cmd->vlan);
|
||||
return hclge_set_vlan_filter(handle, proto, vlan_id,
|
||||
msg_cmd->is_kill);
|
||||
case HCLGE_MBX_VLAN_RX_OFF_CFG:
|
||||
return hclge_en_hw_strip_rxvtag(handle, msg_cmd->enable);
|
||||
case HCLGE_MBX_GET_PORT_BASE_VLAN_STATE:
|
||||
|
@ -411,15 +489,17 @@ static void hclge_get_basic_info(struct hclge_vport *vport,
|
|||
struct hnae3_ae_dev *ae_dev = vport->back->ae_dev;
|
||||
struct hclge_basic_info *basic_info;
|
||||
unsigned int i;
|
||||
u32 pf_caps;
|
||||
|
||||
basic_info = (struct hclge_basic_info *)resp_msg->data;
|
||||
for (i = 0; i < kinfo->tc_info.num_tc; i++)
|
||||
basic_info->hw_tc_map |= BIT(i);
|
||||
|
||||
pf_caps = le32_to_cpu(basic_info->pf_caps);
|
||||
if (test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps))
|
||||
hnae3_set_bit(basic_info->pf_caps,
|
||||
HNAE3_PF_SUPPORT_VLAN_FLTR_MDF_B, 1);
|
||||
hnae3_set_bit(pf_caps, HNAE3_PF_SUPPORT_VLAN_FLTR_MDF_B, 1);
|
||||
|
||||
basic_info->pf_caps = cpu_to_le32(pf_caps);
|
||||
resp_msg->len = HCLGE_MBX_MAX_RESP_DATA_SIZE;
|
||||
}
|
||||
|
||||
|
@ -427,19 +507,15 @@ static void hclge_get_vf_queue_info(struct hclge_vport *vport,
|
|||
struct hclge_respond_to_vf_msg *resp_msg)
|
||||
{
|
||||
#define HCLGE_TQPS_RSS_INFO_LEN 6
|
||||
#define HCLGE_TQPS_ALLOC_OFFSET 0
|
||||
#define HCLGE_TQPS_RSS_SIZE_OFFSET 2
|
||||
#define HCLGE_TQPS_RX_BUFFER_LEN_OFFSET 4
|
||||
|
||||
struct hclge_mbx_vf_queue_info *queue_info;
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
|
||||
/* get the queue related info */
|
||||
memcpy(&resp_msg->data[HCLGE_TQPS_ALLOC_OFFSET],
|
||||
&vport->alloc_tqps, sizeof(u16));
|
||||
memcpy(&resp_msg->data[HCLGE_TQPS_RSS_SIZE_OFFSET],
|
||||
&vport->nic.kinfo.rss_size, sizeof(u16));
|
||||
memcpy(&resp_msg->data[HCLGE_TQPS_RX_BUFFER_LEN_OFFSET],
|
||||
&hdev->rx_buf_len, sizeof(u16));
|
||||
queue_info = (struct hclge_mbx_vf_queue_info *)resp_msg->data;
|
||||
queue_info->num_tqps = cpu_to_le16(vport->alloc_tqps);
|
||||
queue_info->rss_size = cpu_to_le16(vport->nic.kinfo.rss_size);
|
||||
queue_info->rx_buf_len = cpu_to_le16(hdev->rx_buf_len);
|
||||
resp_msg->len = HCLGE_TQPS_RSS_INFO_LEN;
|
||||
}
|
||||
|
||||
|
@ -454,16 +530,15 @@ static void hclge_get_vf_queue_depth(struct hclge_vport *vport,
|
|||
struct hclge_respond_to_vf_msg *resp_msg)
|
||||
{
|
||||
#define HCLGE_TQPS_DEPTH_INFO_LEN 4
|
||||
#define HCLGE_TQPS_NUM_TX_DESC_OFFSET 0
|
||||
#define HCLGE_TQPS_NUM_RX_DESC_OFFSET 2
|
||||
|
||||
struct hclge_mbx_vf_queue_depth *queue_depth;
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
|
||||
/* get the queue depth info */
|
||||
memcpy(&resp_msg->data[HCLGE_TQPS_NUM_TX_DESC_OFFSET],
|
||||
&hdev->num_tx_desc, sizeof(u16));
|
||||
memcpy(&resp_msg->data[HCLGE_TQPS_NUM_RX_DESC_OFFSET],
|
||||
&hdev->num_rx_desc, sizeof(u16));
|
||||
queue_depth = (struct hclge_mbx_vf_queue_depth *)resp_msg->data;
|
||||
queue_depth->num_tx_desc = cpu_to_le16(hdev->num_tx_desc);
|
||||
queue_depth->num_rx_desc = cpu_to_le16(hdev->num_rx_desc);
|
||||
|
||||
resp_msg->len = HCLGE_TQPS_DEPTH_INFO_LEN;
|
||||
}
|
||||
|
||||
|
@ -488,10 +563,9 @@ int hclge_push_vf_link_status(struct hclge_vport *vport)
|
|||
#define HCLGE_VF_LINK_STATE_UP 1U
|
||||
#define HCLGE_VF_LINK_STATE_DOWN 0U
|
||||
|
||||
struct hclge_mbx_link_status link_info;
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
u16 link_status;
|
||||
u8 msg_data[9];
|
||||
u16 duplex;
|
||||
|
||||
/* mac.link can only be 0 or 1 */
|
||||
switch (vport->vf_info.link_state) {
|
||||
|
@ -507,14 +581,13 @@ int hclge_push_vf_link_status(struct hclge_vport *vport)
|
|||
break;
|
||||
}
|
||||
|
||||
duplex = hdev->hw.mac.duplex;
|
||||
memcpy(&msg_data[0], &link_status, sizeof(u16));
|
||||
memcpy(&msg_data[2], &hdev->hw.mac.speed, sizeof(u32));
|
||||
memcpy(&msg_data[6], &duplex, sizeof(u16));
|
||||
msg_data[8] = HCLGE_MBX_PUSH_LINK_STATUS_EN;
|
||||
link_info.link_status = cpu_to_le16(link_status);
|
||||
link_info.speed = cpu_to_le32(hdev->hw.mac.speed);
|
||||
link_info.duplex = cpu_to_le16(hdev->hw.mac.duplex);
|
||||
link_info.flag = HCLGE_MBX_PUSH_LINK_STATUS_EN;
|
||||
|
||||
/* send this requested info to VF */
|
||||
return hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data),
|
||||
return hclge_send_mbx_msg(vport, (u8 *)&link_info, sizeof(link_info),
|
||||
HCLGE_MBX_LINK_STAT_CHANGE, vport->vport_id);
|
||||
}
|
||||
|
||||
|
@ -522,22 +595,22 @@ static void hclge_get_link_mode(struct hclge_vport *vport,
|
|||
struct hclge_mbx_vf_to_pf_cmd *mbx_req)
|
||||
{
|
||||
#define HCLGE_SUPPORTED 1
|
||||
struct hclge_mbx_link_mode link_mode;
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
unsigned long advertising;
|
||||
unsigned long supported;
|
||||
unsigned long send_data;
|
||||
u8 msg_data[10] = {};
|
||||
u8 dest_vfid;
|
||||
|
||||
advertising = hdev->hw.mac.advertising[0];
|
||||
supported = hdev->hw.mac.supported[0];
|
||||
dest_vfid = mbx_req->mbx_src_vfid;
|
||||
msg_data[0] = mbx_req->msg.data[0];
|
||||
send_data = mbx_req->msg.data[0] == HCLGE_SUPPORTED ? supported :
|
||||
advertising;
|
||||
link_mode.idx = cpu_to_le16((u16)mbx_req->msg.data[0]);
|
||||
link_mode.link_mode = cpu_to_le64(send_data);
|
||||
|
||||
send_data = msg_data[0] == HCLGE_SUPPORTED ? supported : advertising;
|
||||
|
||||
memcpy(&msg_data[2], &send_data, sizeof(unsigned long));
|
||||
hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data),
|
||||
hclge_send_mbx_msg(vport, (u8 *)&link_mode, sizeof(link_mode),
|
||||
HCLGE_MBX_LINK_STAT_MODE, dest_vfid);
|
||||
}
|
||||
|
||||
|
@ -551,7 +624,7 @@ static int hclge_mbx_reset_vf_queue(struct hclge_vport *vport,
|
|||
u16 queue_id;
|
||||
int ret;
|
||||
|
||||
memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id));
|
||||
queue_id = le16_to_cpu(*(__le16 *)mbx_req->msg.data);
|
||||
resp_msg->data[0] = HCLGE_RESET_ALL_QUEUE_DONE;
|
||||
resp_msg->len = sizeof(u8);
|
||||
|
||||
|
@ -587,9 +660,11 @@ static void hclge_vf_keep_alive(struct hclge_vport *vport)
|
|||
static int hclge_set_vf_mtu(struct hclge_vport *vport,
|
||||
struct hclge_mbx_vf_to_pf_cmd *mbx_req)
|
||||
{
|
||||
struct hclge_mbx_mtu_info *mtu_info;
|
||||
u32 mtu;
|
||||
|
||||
memcpy(&mtu, mbx_req->msg.data, sizeof(mtu));
|
||||
mtu_info = (struct hclge_mbx_mtu_info *)mbx_req->msg.data;
|
||||
mtu = le32_to_cpu(mtu_info->mtu);
|
||||
|
||||
return hclge_set_vport_mtu(vport, mtu);
|
||||
}
|
||||
|
@ -602,7 +677,7 @@ static int hclge_get_queue_id_in_pf(struct hclge_vport *vport,
|
|||
struct hclge_dev *hdev = vport->back;
|
||||
u16 queue_id, qid_in_pf;
|
||||
|
||||
memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id));
|
||||
queue_id = le16_to_cpu(*(__le16 *)mbx_req->msg.data);
|
||||
if (queue_id >= handle->kinfo.num_tqps) {
|
||||
dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n",
|
||||
queue_id, mbx_req->mbx_src_vfid);
|
||||
|
@ -610,7 +685,7 @@ static int hclge_get_queue_id_in_pf(struct hclge_vport *vport,
|
|||
}
|
||||
|
||||
qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id);
|
||||
memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf));
|
||||
*(__le16 *)resp_msg->data = cpu_to_le16(qid_in_pf);
|
||||
resp_msg->len = sizeof(qid_in_pf);
|
||||
return 0;
|
||||
}
|
||||
|
@ -755,6 +830,14 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
|
|||
ret = hclge_map_unmap_ring_to_vf_vector(vport, false,
|
||||
req);
|
||||
break;
|
||||
case HCLGE_MBX_GET_RING_VECTOR_MAP:
|
||||
ret = hclge_get_vf_ring_vector_map(vport, req,
|
||||
&resp_msg);
|
||||
if (ret)
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"PF fail(%d) to get VF ring vector map\n",
|
||||
ret);
|
||||
break;
|
||||
case HCLGE_MBX_SET_PROMISC_MODE:
|
||||
hclge_set_vf_promisc_mode(vport, req);
|
||||
break;
|
||||
|
|
|
@ -62,7 +62,7 @@ TRACE_EVENT(hclge_pf_mbx_send,
|
|||
|
||||
TP_fast_assign(
|
||||
__entry->vfid = req->dest_vfid;
|
||||
__entry->code = req->msg.code;
|
||||
__entry->code = le16_to_cpu(req->msg.code);
|
||||
__assign_str(pciname, pci_name(hdev->pdev));
|
||||
__assign_str(devname, &hdev->vport[0].nic.kinfo.netdev->name);
|
||||
memcpy(__entry->mbx_data, req,
|
||||
|
|
|
@ -189,8 +189,8 @@ static int hclgevf_get_basic_info(struct hclgevf_dev *hdev)
|
|||
basic_info = (struct hclge_basic_info *)resp_msg;
|
||||
|
||||
hdev->hw_tc_map = basic_info->hw_tc_map;
|
||||
hdev->mbx_api_version = basic_info->mbx_api_version;
|
||||
caps = basic_info->pf_caps;
|
||||
hdev->mbx_api_version = le16_to_cpu(basic_info->mbx_api_version);
|
||||
caps = le32_to_cpu(basic_info->pf_caps);
|
||||
if (test_bit(HNAE3_PF_SUPPORT_VLAN_FLTR_MDF_B, &caps))
|
||||
set_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps);
|
||||
|
||||
|
@ -223,10 +223,8 @@ static int hclgevf_get_port_base_vlan_filter_state(struct hclgevf_dev *hdev)
|
|||
static int hclgevf_get_queue_info(struct hclgevf_dev *hdev)
|
||||
{
|
||||
#define HCLGEVF_TQPS_RSS_INFO_LEN 6
|
||||
#define HCLGEVF_TQPS_ALLOC_OFFSET 0
|
||||
#define HCLGEVF_TQPS_RSS_SIZE_OFFSET 2
|
||||
#define HCLGEVF_TQPS_RX_BUFFER_LEN_OFFSET 4
|
||||
|
||||
struct hclge_mbx_vf_queue_info *queue_info;
|
||||
u8 resp_msg[HCLGEVF_TQPS_RSS_INFO_LEN];
|
||||
struct hclge_vf_to_pf_msg send_msg;
|
||||
int status;
|
||||
|
@ -241,12 +239,10 @@ static int hclgevf_get_queue_info(struct hclgevf_dev *hdev)
|
|||
return status;
|
||||
}
|
||||
|
||||
memcpy(&hdev->num_tqps, &resp_msg[HCLGEVF_TQPS_ALLOC_OFFSET],
|
||||
sizeof(u16));
|
||||
memcpy(&hdev->rss_size_max, &resp_msg[HCLGEVF_TQPS_RSS_SIZE_OFFSET],
|
||||
sizeof(u16));
|
||||
memcpy(&hdev->rx_buf_len, &resp_msg[HCLGEVF_TQPS_RX_BUFFER_LEN_OFFSET],
|
||||
sizeof(u16));
|
||||
queue_info = (struct hclge_mbx_vf_queue_info *)resp_msg;
|
||||
hdev->num_tqps = le16_to_cpu(queue_info->num_tqps);
|
||||
hdev->rss_size_max = le16_to_cpu(queue_info->rss_size);
|
||||
hdev->rx_buf_len = le16_to_cpu(queue_info->rx_buf_len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -254,9 +250,8 @@ static int hclgevf_get_queue_info(struct hclgevf_dev *hdev)
|
|||
static int hclgevf_get_queue_depth(struct hclgevf_dev *hdev)
|
||||
{
|
||||
#define HCLGEVF_TQPS_DEPTH_INFO_LEN 4
|
||||
#define HCLGEVF_TQPS_NUM_TX_DESC_OFFSET 0
|
||||
#define HCLGEVF_TQPS_NUM_RX_DESC_OFFSET 2
|
||||
|
||||
struct hclge_mbx_vf_queue_depth *queue_depth;
|
||||
u8 resp_msg[HCLGEVF_TQPS_DEPTH_INFO_LEN];
|
||||
struct hclge_vf_to_pf_msg send_msg;
|
||||
int ret;
|
||||
|
@ -271,10 +266,9 @@ static int hclgevf_get_queue_depth(struct hclgevf_dev *hdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
memcpy(&hdev->num_tx_desc, &resp_msg[HCLGEVF_TQPS_NUM_TX_DESC_OFFSET],
|
||||
sizeof(u16));
|
||||
memcpy(&hdev->num_rx_desc, &resp_msg[HCLGEVF_TQPS_NUM_RX_DESC_OFFSET],
|
||||
sizeof(u16));
|
||||
queue_depth = (struct hclge_mbx_vf_queue_depth *)resp_msg;
|
||||
hdev->num_tx_desc = le16_to_cpu(queue_depth->num_tx_desc);
|
||||
hdev->num_rx_desc = le16_to_cpu(queue_depth->num_rx_desc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -288,11 +282,11 @@ static u16 hclgevf_get_qid_global(struct hnae3_handle *handle, u16 queue_id)
|
|||
int ret;
|
||||
|
||||
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_GET_QID_IN_PF, 0);
|
||||
memcpy(send_msg.data, &queue_id, sizeof(queue_id));
|
||||
*(__le16 *)send_msg.data = cpu_to_le16(queue_id);
|
||||
ret = hclgevf_send_mbx_msg(hdev, &send_msg, true, resp_data,
|
||||
sizeof(resp_data));
|
||||
if (!ret)
|
||||
qid_in_pf = *(u16 *)resp_data;
|
||||
qid_in_pf = le16_to_cpu(*(__le16 *)resp_data);
|
||||
|
||||
return qid_in_pf;
|
||||
}
|
||||
|
@ -1245,11 +1239,8 @@ static int hclgevf_set_vlan_filter(struct hnae3_handle *handle,
|
|||
__be16 proto, u16 vlan_id,
|
||||
bool is_kill)
|
||||
{
|
||||
#define HCLGEVF_VLAN_MBX_IS_KILL_OFFSET 0
|
||||
#define HCLGEVF_VLAN_MBX_VLAN_ID_OFFSET 1
|
||||
#define HCLGEVF_VLAN_MBX_PROTO_OFFSET 3
|
||||
|
||||
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
|
||||
struct hclge_mbx_vlan_filter *vlan_filter;
|
||||
struct hclge_vf_to_pf_msg send_msg;
|
||||
int ret;
|
||||
|
||||
|
@ -1271,11 +1262,11 @@ static int hclgevf_set_vlan_filter(struct hnae3_handle *handle,
|
|||
|
||||
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN,
|
||||
HCLGE_MBX_VLAN_FILTER);
|
||||
send_msg.data[HCLGEVF_VLAN_MBX_IS_KILL_OFFSET] = is_kill;
|
||||
memcpy(&send_msg.data[HCLGEVF_VLAN_MBX_VLAN_ID_OFFSET], &vlan_id,
|
||||
sizeof(vlan_id));
|
||||
memcpy(&send_msg.data[HCLGEVF_VLAN_MBX_PROTO_OFFSET], &proto,
|
||||
sizeof(proto));
|
||||
vlan_filter = (struct hclge_mbx_vlan_filter *)send_msg.data;
|
||||
vlan_filter->is_kill = is_kill;
|
||||
vlan_filter->vlan_id = cpu_to_le16(vlan_id);
|
||||
vlan_filter->proto = cpu_to_le16(be16_to_cpu(proto));
|
||||
|
||||
/* when remove hw vlan filter failed, record the vlan id,
|
||||
* and try to remove it from hw later, to be consistence
|
||||
* with stack.
|
||||
|
@ -1347,7 +1338,7 @@ static int hclgevf_reset_tqp(struct hnae3_handle *handle)
|
|||
|
||||
for (i = 1; i < handle->kinfo.num_tqps; i++) {
|
||||
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_QUEUE_RESET, 0);
|
||||
memcpy(send_msg.data, &i, sizeof(i));
|
||||
*(__le16 *)send_msg.data = cpu_to_le16(i);
|
||||
ret = hclgevf_send_mbx_msg(hdev, &send_msg, true, NULL, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -1359,10 +1350,13 @@ static int hclgevf_reset_tqp(struct hnae3_handle *handle)
|
|||
static int hclgevf_set_mtu(struct hnae3_handle *handle, int new_mtu)
|
||||
{
|
||||
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
|
||||
struct hclge_mbx_mtu_info *mtu_info;
|
||||
struct hclge_vf_to_pf_msg send_msg;
|
||||
|
||||
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_MTU, 0);
|
||||
memcpy(send_msg.data, &new_mtu, sizeof(new_mtu));
|
||||
mtu_info = (struct hclge_mbx_mtu_info *)send_msg.data;
|
||||
mtu_info->mtu = cpu_to_le32(new_mtu);
|
||||
|
||||
return hclgevf_send_mbx_msg(hdev, &send_msg, true, NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -3333,7 +3327,7 @@ static void hclgevf_get_regs(struct hnae3_handle *handle, u32 *version,
|
|||
}
|
||||
|
||||
void hclgevf_update_port_base_vlan_info(struct hclgevf_dev *hdev, u16 state,
|
||||
u8 *port_base_vlan_info, u8 data_size)
|
||||
struct hclge_mbx_port_base_vlan *port_base_vlan)
|
||||
{
|
||||
struct hnae3_handle *nic = &hdev->nic;
|
||||
struct hclge_vf_to_pf_msg send_msg;
|
||||
|
@ -3358,7 +3352,7 @@ void hclgevf_update_port_base_vlan_info(struct hclgevf_dev *hdev, u16 state,
|
|||
/* send msg to PF and wait update port based vlan info */
|
||||
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN,
|
||||
HCLGE_MBX_PORT_BASE_VLAN_CFG);
|
||||
memcpy(send_msg.data, port_base_vlan_info, data_size);
|
||||
memcpy(send_msg.data, port_base_vlan, sizeof(*port_base_vlan));
|
||||
ret = hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0);
|
||||
if (!ret) {
|
||||
if (state == HNAE3_PORT_BASE_VLAN_DISABLE)
|
||||
|
|
|
@ -293,5 +293,5 @@ void hclgevf_update_speed_duplex(struct hclgevf_dev *hdev, u32 speed,
|
|||
void hclgevf_reset_task_schedule(struct hclgevf_dev *hdev);
|
||||
void hclgevf_mbx_task_schedule(struct hclgevf_dev *hdev);
|
||||
void hclgevf_update_port_base_vlan_info(struct hclgevf_dev *hdev, u16 state,
|
||||
u8 *port_base_vlan_info, u8 data_size);
|
||||
struct hclge_mbx_port_base_vlan *port_base_vlan);
|
||||
#endif
|
||||
|
|
|
@ -124,7 +124,7 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev,
|
|||
if (need_resp) {
|
||||
mutex_lock(&hdev->mbx_resp.mbx_mutex);
|
||||
hclgevf_reset_mbx_resp_status(hdev);
|
||||
req->match_id = hdev->mbx_resp.match_id;
|
||||
req->match_id = cpu_to_le16(hdev->mbx_resp.match_id);
|
||||
status = hclgevf_cmd_send(&hdev->hw, &desc, 1);
|
||||
if (status) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
|
@ -162,27 +162,29 @@ static bool hclgevf_cmd_crq_empty(struct hclgevf_hw *hw)
|
|||
static void hclgevf_handle_mbx_response(struct hclgevf_dev *hdev,
|
||||
struct hclge_mbx_pf_to_vf_cmd *req)
|
||||
{
|
||||
u16 vf_mbx_msg_subcode = le16_to_cpu(req->msg.vf_mbx_msg_subcode);
|
||||
u16 vf_mbx_msg_code = le16_to_cpu(req->msg.vf_mbx_msg_code);
|
||||
struct hclgevf_mbx_resp_status *resp = &hdev->mbx_resp;
|
||||
u16 resp_status = le16_to_cpu(req->msg.resp_status);
|
||||
u16 match_id = le16_to_cpu(req->match_id);
|
||||
|
||||
if (resp->received_resp)
|
||||
dev_warn(&hdev->pdev->dev,
|
||||
"VF mbx resp flag not clear(%u)\n",
|
||||
req->msg.vf_mbx_msg_code);
|
||||
"VF mbx resp flag not clear(%u)\n",
|
||||
vf_mbx_msg_code);
|
||||
|
||||
resp->origin_mbx_msg =
|
||||
(req->msg.vf_mbx_msg_code << 16);
|
||||
resp->origin_mbx_msg |= req->msg.vf_mbx_msg_subcode;
|
||||
resp->resp_status =
|
||||
hclgevf_resp_to_errno(req->msg.resp_status);
|
||||
resp->origin_mbx_msg = (vf_mbx_msg_code << 16);
|
||||
resp->origin_mbx_msg |= vf_mbx_msg_subcode;
|
||||
resp->resp_status = hclgevf_resp_to_errno(resp_status);
|
||||
memcpy(resp->additional_info, req->msg.resp_data,
|
||||
HCLGE_MBX_MAX_RESP_DATA_SIZE * sizeof(u8));
|
||||
if (req->match_id) {
|
||||
if (match_id) {
|
||||
/* If match_id is not zero, it means PF support match_id.
|
||||
* if the match_id is right, VF get the right response, or
|
||||
* ignore the response. and driver will clear hdev->mbx_resp
|
||||
* when send next message which need response.
|
||||
*/
|
||||
if (req->match_id == resp->match_id)
|
||||
if (match_id == resp->match_id)
|
||||
resp->received_resp = true;
|
||||
} else {
|
||||
resp->received_resp = true;
|
||||
|
@ -199,7 +201,7 @@ static void hclgevf_handle_mbx_msg(struct hclgevf_dev *hdev,
|
|||
HCLGE_MBX_MAX_ARQ_MSG_NUM) {
|
||||
dev_warn(&hdev->pdev->dev,
|
||||
"Async Q full, dropping msg(%u)\n",
|
||||
req->msg.code);
|
||||
le16_to_cpu(req->msg.code));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -218,6 +220,7 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
|
|||
struct hclge_comm_cmq_ring *crq;
|
||||
struct hclge_desc *desc;
|
||||
u16 flag;
|
||||
u16 code;
|
||||
|
||||
crq = &hdev->hw.hw.cmq.crq;
|
||||
|
||||
|
@ -232,10 +235,11 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
|
|||
req = (struct hclge_mbx_pf_to_vf_cmd *)desc->data;
|
||||
|
||||
flag = le16_to_cpu(crq->desc[crq->next_to_use].flag);
|
||||
code = le16_to_cpu(req->msg.code);
|
||||
if (unlikely(!hnae3_get_bit(flag, HCLGEVF_CMDQ_RX_OUTVLD_B))) {
|
||||
dev_warn(&hdev->pdev->dev,
|
||||
"dropped invalid mailbox message, code = %u\n",
|
||||
req->msg.code);
|
||||
code);
|
||||
|
||||
/* dropping/not processing this invalid message */
|
||||
crq->desc[crq->next_to_use].flag = 0;
|
||||
|
@ -251,7 +255,7 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
|
|||
* timeout and simultaneously queue the async messages for later
|
||||
* prcessing in context of mailbox task i.e. the slow path.
|
||||
*/
|
||||
switch (req->msg.code) {
|
||||
switch (code) {
|
||||
case HCLGE_MBX_PF_VF_RESP:
|
||||
hclgevf_handle_mbx_response(hdev, req);
|
||||
break;
|
||||
|
@ -265,7 +269,7 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
|
|||
default:
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"VF received unsupported(%u) mbx msg from PF\n",
|
||||
req->msg.code);
|
||||
code);
|
||||
break;
|
||||
}
|
||||
crq->desc[crq->next_to_use].flag = 0;
|
||||
|
@ -287,14 +291,18 @@ static void hclgevf_parse_promisc_info(struct hclgevf_dev *hdev,
|
|||
|
||||
void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
|
||||
{
|
||||
struct hclge_mbx_port_base_vlan *vlan_info;
|
||||
struct hclge_mbx_link_status *link_info;
|
||||
struct hclge_mbx_link_mode *link_mode;
|
||||
enum hnae3_reset_type reset_type;
|
||||
u16 link_status, state;
|
||||
u16 *msg_q, *vlan_info;
|
||||
__le16 *msg_q;
|
||||
u16 opcode;
|
||||
u8 duplex;
|
||||
u32 speed;
|
||||
u32 tail;
|
||||
u8 flag;
|
||||
u8 idx;
|
||||
u16 idx;
|
||||
|
||||
tail = hdev->arq.tail;
|
||||
|
||||
|
@ -308,13 +316,14 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
|
|||
}
|
||||
|
||||
msg_q = hdev->arq.msg_q[hdev->arq.head];
|
||||
|
||||
switch (msg_q[0]) {
|
||||
opcode = le16_to_cpu(msg_q[0]);
|
||||
switch (opcode) {
|
||||
case HCLGE_MBX_LINK_STAT_CHANGE:
|
||||
link_status = msg_q[1];
|
||||
memcpy(&speed, &msg_q[2], sizeof(speed));
|
||||
duplex = (u8)msg_q[4];
|
||||
flag = (u8)msg_q[5];
|
||||
link_info = (struct hclge_mbx_link_status *)(msg_q + 1);
|
||||
link_status = le16_to_cpu(link_info->link_status);
|
||||
speed = le32_to_cpu(link_info->speed);
|
||||
duplex = (u8)le16_to_cpu(link_info->duplex);
|
||||
flag = link_info->flag;
|
||||
|
||||
/* update upper layer with new link link status */
|
||||
hclgevf_update_speed_duplex(hdev, speed, duplex);
|
||||
|
@ -326,13 +335,14 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
|
|||
|
||||
break;
|
||||
case HCLGE_MBX_LINK_STAT_MODE:
|
||||
idx = (u8)msg_q[1];
|
||||
link_mode = (struct hclge_mbx_link_mode *)(msg_q + 1);
|
||||
idx = le16_to_cpu(link_mode->idx);
|
||||
if (idx)
|
||||
memcpy(&hdev->hw.mac.supported, &msg_q[2],
|
||||
sizeof(unsigned long));
|
||||
hdev->hw.mac.supported =
|
||||
le64_to_cpu(link_mode->link_mode);
|
||||
else
|
||||
memcpy(&hdev->hw.mac.advertising, &msg_q[2],
|
||||
sizeof(unsigned long));
|
||||
hdev->hw.mac.advertising =
|
||||
le64_to_cpu(link_mode->link_mode);
|
||||
break;
|
||||
case HCLGE_MBX_ASSERTING_RESET:
|
||||
/* PF has asserted reset hence VF should go in pending
|
||||
|
@ -340,25 +350,27 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
|
|||
* has been completely reset. After this stack should
|
||||
* eventually be re-initialized.
|
||||
*/
|
||||
reset_type = (enum hnae3_reset_type)msg_q[1];
|
||||
reset_type =
|
||||
(enum hnae3_reset_type)le16_to_cpu(msg_q[1]);
|
||||
set_bit(reset_type, &hdev->reset_pending);
|
||||
set_bit(HCLGEVF_RESET_PENDING, &hdev->reset_state);
|
||||
hclgevf_reset_task_schedule(hdev);
|
||||
|
||||
break;
|
||||
case HCLGE_MBX_PUSH_VLAN_INFO:
|
||||
state = msg_q[1];
|
||||
vlan_info = &msg_q[1];
|
||||
vlan_info =
|
||||
(struct hclge_mbx_port_base_vlan *)(msg_q + 1);
|
||||
state = le16_to_cpu(vlan_info->state);
|
||||
hclgevf_update_port_base_vlan_info(hdev, state,
|
||||
(u8 *)vlan_info, 8);
|
||||
vlan_info);
|
||||
break;
|
||||
case HCLGE_MBX_PUSH_PROMISC_INFO:
|
||||
hclgevf_parse_promisc_info(hdev, msg_q[1]);
|
||||
hclgevf_parse_promisc_info(hdev, le16_to_cpu(msg_q[1]));
|
||||
break;
|
||||
default:
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"fetched unsupported(%u) message from arq\n",
|
||||
msg_q[0]);
|
||||
opcode);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ TRACE_EVENT(hclge_vf_mbx_get,
|
|||
|
||||
TP_fast_assign(
|
||||
__entry->vfid = req->dest_vfid;
|
||||
__entry->code = req->msg.code;
|
||||
__entry->code = le16_to_cpu(req->msg.code);
|
||||
__assign_str(pciname, pci_name(hdev->pdev));
|
||||
__assign_str(devname, &hdev->nic.kinfo.netdev->name);
|
||||
memcpy(__entry->mbx_data, req,
|
||||
|
|
Загрузка…
Ссылка в новой задаче