}
if (i >= VFRESET_MAX_WAIT_CNT) {
- PMD_DRV_LOG(ERR, "VF reset timeout\n");
+ PMD_DRV_LOG(ERR, "VF reset timeout");
return -ETIMEDOUT;
}
qsel.tx_queues = qsel.rx_queues;
ret = i40e_pf_host_switch_queues(vf, &qsel, false);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Disable VF queues failed\n");
+ PMD_DRV_LOG(ERR, "Disable VF queues failed");
return -EFAULT;
}
/* remove VSI */
ret = i40e_vsi_release(vf->vsi);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Release VSI failed\n");
+ PMD_DRV_LOG(ERR, "Release VSI failed");
return -EFAULT;
}
}
}
if (i >= VFRESET_MAX_WAIT_CNT) {
- PMD_DRV_LOG(ERR, "Wait VF PCI transaction end timeout\n");
+ PMD_DRV_LOG(ERR, "Wait VF PCI transaction end timeout");
return -ETIMEDOUT;
}
vf->vsi = i40e_vsi_setup(vf->pf, I40E_VSI_SRIOV,
vf->pf->main_vsi, vf->vf_idx);
if (vf->vsi == NULL) {
- PMD_DRV_LOG(ERR, "Add vsi failed\n");
+ PMD_DRV_LOG(ERR, "Add vsi failed");
return -EFAULT;
}
ret = i40e_pf_vf_queues_mapping(vf);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "queue mapping error\n");
+ PMD_DRV_LOG(ERR, "queue mapping error");
i40e_vsi_release(vf->vsi);
return -EFAULT;
}
ret = i40e_aq_send_msg_to_vf(hw, abs_vf_id, opcode, retval,
msg, msglen, NULL);
if (ret) {
- PMD_DRV_LOG(ERR, "Fail to send message to VF, err %u\n",
- hw->aq.asq_last_status);
- printf("Fail to send message to VF, err %u\n",
- hw->aq.asq_last_status);
+ PMD_INIT_LOG(ERR, "Fail to send message to VF, err %u",
+ hw->aq.asq_last_status);
}
return ret;
vf_res = rte_zmalloc("i40e_vf_res", len, 0);
if (vf_res == NULL) {
- PMD_DRV_LOG(ERR, "failed to allocate mem\n");
+ PMD_DRV_LOG(ERR, "failed to allocate mem");
ret = I40E_ERR_NO_MEMORY;
vf_res = NULL;
len = 0;
goto send_msg;
}
- vf_res->vf_offload_flags = I40E_VIRTCHNL_VF_OFFLOAD_L2;
+ vf_res->vf_offload_flags = I40E_VIRTCHNL_VF_OFFLOAD_L2 |
+ I40E_VIRTCHNL_VF_OFFLOAD_VLAN;
vf_res->max_vectors = hw->func_caps.num_msix_vectors_vf;
vf_res->num_queue_pairs = vf->vsi->nb_qps;
vf_res->num_vsis = I40E_DEFAULT_VF_VSI_NUM;
rx_ctx.tphhead_ena = 1;
rx_ctx.lrxqthresh = 2;
rx_ctx.crcstrip = 1;
+ rx_ctx.l2tsel = 1;
rx_ctx.prefena = 1;
err = i40e_clear_lan_rx_queue_context(hw, abs_queue_id);
int i;
struct i40e_virtchnl_queue_pair_info *qpair;
- if (msglen <= sizeof(*qconfig) ||
+ if (msg == NULL || msglen <= sizeof(*qconfig) ||
qconfig->num_queue_pairs > vsi->nb_qps) {
- PMD_DRV_LOG(ERR, "vsi_queue_config_info argument wrong\n");
+ PMD_DRV_LOG(ERR, "vsi_queue_config_info argument wrong");
ret = I40E_ERR_PARAM;
goto send_msg;
}
struct i40e_virtchnl_irq_map_info *irqmap =
(struct i40e_virtchnl_irq_map_info *)msg;
- if (msglen < sizeof(struct i40e_virtchnl_irq_map_info)) {
- PMD_DRV_LOG(ERR, "buffer too short\n");
+ if (msg == NULL || msglen < sizeof(struct i40e_virtchnl_irq_map_info)) {
+ PMD_DRV_LOG(ERR, "buffer too short");
ret = I40E_ERR_PARAM;
goto send_msg;
}
/* Assume VF only have 1 vector to bind all queues */
if (irqmap->num_vectors != 1) {
- PMD_DRV_LOG(ERR, "DKDK host only support 1 vector\n");
+ PMD_DRV_LOG(ERR, "DKDK host only support 1 vector");
ret = I40E_ERR_PARAM;
goto send_msg;
}
if (irqmap->vecmap[0].vector_id == 0) {
- PMD_DRV_LOG(ERR, "DPDK host don't support use IRQ0\n");
+ PMD_DRV_LOG(ERR, "DPDK host don't support use IRQ0");
ret = I40E_ERR_PARAM;
goto send_msg;
}
struct i40e_virtchnl_queue_select *q_sel =
(struct i40e_virtchnl_queue_select *)msg;
- if (msglen != sizeof(*q_sel)) {
+ if (msg == NULL || msglen != sizeof(*q_sel)) {
ret = I40E_ERR_PARAM;
goto send_msg;
}
struct i40e_virtchnl_queue_select *q_sel =
(struct i40e_virtchnl_queue_select *)msg;
- if (msglen != sizeof(*q_sel)) {
+ if (msg == NULL || msglen != sizeof(*q_sel)) {
ret = I40E_ERR_PARAM;
goto send_msg;
}
int i;
struct ether_addr *mac;
- if (msglen <= sizeof(*addr_list)) {
- PMD_DRV_LOG(ERR, "add_ether_address argument too short\n");
+ if (msg == NULL || msglen <= sizeof(*addr_list)) {
+ PMD_DRV_LOG(ERR, "add_ether_address argument too short");
ret = I40E_ERR_PARAM;
goto send_msg;
}
int i;
struct ether_addr *mac;
- if (msglen <= sizeof(*addr_list)) {
- PMD_DRV_LOG(ERR, "delete_ether_address argument too short\n");
+ if (msg == NULL || msglen <= sizeof(*addr_list)) {
+ PMD_DRV_LOG(ERR, "delete_ether_address argument too short");
ret = I40E_ERR_PARAM;
goto send_msg;
}
int i;
uint16_t *vid;
- if (msglen <= sizeof(*vlan_filter_list)) {
- PMD_DRV_LOG(ERR, "add_vlan argument too short\n");
+ if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
+ PMD_DRV_LOG(ERR, "add_vlan argument too short");
ret = I40E_ERR_PARAM;
goto send_msg;
}
int i;
uint16_t *vid;
- if (msglen <= sizeof(*vlan_filter_list)) {
- PMD_DRV_LOG(ERR, "delete_vlan argument too short\n");
+ if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
+ PMD_DRV_LOG(ERR, "delete_vlan argument too short");
ret = I40E_ERR_PARAM;
goto send_msg;
}
i40e_pf_host_process_cmd_config_promisc_mode(
struct i40e_pf_vf *vf,
uint8_t *msg,
- __rte_unused uint16_t msglen)
+ uint16_t msglen)
{
int ret = I40E_SUCCESS;
struct i40e_virtchnl_promisc_info *promisc =
struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
bool unicast = FALSE, multicast = FALSE;
+ if (msg == NULL || msglen != sizeof(*promisc)) {
+ ret = I40E_ERR_PARAM;
+ goto send_msg;
+ }
+
if (promisc->flags & I40E_FLAG_VF_UNICAST_PROMISC)
unicast = TRUE;
ret = i40e_aq_set_vsi_unicast_promiscuous(hw,
sizeof(struct rte_eth_link));
}
+static int
+i40e_pf_host_process_cmd_cfg_vlan_offload(
+ struct i40e_pf_vf *vf,
+ uint8_t *msg,
+ uint16_t msglen)
+{
+ int ret = I40E_SUCCESS;
+ struct i40e_virtchnl_vlan_offload_info *offload =
+ (struct i40e_virtchnl_vlan_offload_info *)msg;
+
+ if (msg == NULL || msglen != sizeof(*offload)) {
+ ret = I40E_ERR_PARAM;
+ goto send_msg;
+ }
+
+ ret = i40e_vsi_config_vlan_stripping(vf->vsi,
+ !!offload->enable_vlan_strip);
+ if (ret != 0)
+ PMD_DRV_LOG(ERR, "Failed to configure vlan stripping");
+
+send_msg:
+ i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD,
+ ret, NULL, 0);
+
+ return ret;
+}
+
+static int
+i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
+ uint8_t *msg,
+ uint16_t msglen)
+{
+ int ret = I40E_SUCCESS;
+ struct i40e_virtchnl_pvid_info *tpid_info =
+ (struct i40e_virtchnl_pvid_info *)msg;
+
+ if (msg == NULL || msglen != sizeof(*tpid_info)) {
+ ret = I40E_ERR_PARAM;
+ goto send_msg;
+ }
+
+ ret = i40e_vsi_vlan_pvid_set(vf->vsi, &tpid_info->info);
+
+send_msg:
+ i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
+ ret, NULL, 0);
+
+ return ret;
+}
+
void
i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
uint16_t abs_vf_id, uint32_t opcode,
uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id;
if (!dev || vf_id > pf->vf_num - 1 || !pf->vfs) {
- PMD_DRV_LOG(ERR, "invalid argument\n");
+ PMD_DRV_LOG(ERR, "invalid argument");
return;
}
vf = &pf->vfs[vf_id];
if (!vf->vsi) {
- PMD_DRV_LOG(ERR, "NO VSI associated with VF found\n");
+ PMD_DRV_LOG(ERR, "NO VSI associated with VF found");
i40e_pf_host_send_msg_to_vf(vf, opcode,
I40E_ERR_NO_AVAILABLE_VSI, NULL, 0);
return;
switch (opcode) {
case I40E_VIRTCHNL_OP_VERSION :
- PMD_DRV_LOG(INFO, "OP_VERSION received\n");
+ PMD_DRV_LOG(INFO, "OP_VERSION received");
i40e_pf_host_process_cmd_version(vf);
break;
case I40E_VIRTCHNL_OP_RESET_VF :
- PMD_DRV_LOG(INFO, "OP_RESET_VF received\n");
+ PMD_DRV_LOG(INFO, "OP_RESET_VF received");
i40e_pf_host_process_cmd_reset_vf(vf);
break;
case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
- PMD_DRV_LOG(INFO, "OP_GET_VF_RESOURCES received\n");
+ PMD_DRV_LOG(INFO, "OP_GET_VF_RESOURCES received");
i40e_pf_host_process_cmd_get_vf_resource(vf);
break;
case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES:
- PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES received\n");
+ PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES received");
i40e_pf_host_process_cmd_config_vsi_queues(vf,
msg, msglen);
break;
case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
- PMD_DRV_LOG(INFO, "OP_CONFIG_IRQ_MAP received\n");
+ PMD_DRV_LOG(INFO, "OP_CONFIG_IRQ_MAP received");
i40e_pf_host_process_cmd_config_irq_map(vf, msg, msglen);
break;
case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
- PMD_DRV_LOG(INFO, "OP_ENABLE_QUEUES received\n");
+ PMD_DRV_LOG(INFO, "OP_ENABLE_QUEUES received");
i40e_pf_host_process_cmd_enable_queues(vf,
msg, msglen);
break;
case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
- PMD_DRV_LOG(INFO, "OP_DISABLE_QUEUE received\n");
+ PMD_DRV_LOG(INFO, "OP_DISABLE_QUEUE received");
i40e_pf_host_process_cmd_disable_queues(vf,
msg, msglen);
break;
case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
- PMD_DRV_LOG(INFO, "OP_ADD_ETHER_ADDRESS received\n");
+ PMD_DRV_LOG(INFO, "OP_ADD_ETHER_ADDRESS received");
i40e_pf_host_process_cmd_add_ether_address(vf,
msg, msglen);
break;
case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
- PMD_DRV_LOG(INFO, "OP_DEL_ETHER_ADDRESS received\n");
+ PMD_DRV_LOG(INFO, "OP_DEL_ETHER_ADDRESS received");
i40e_pf_host_process_cmd_del_ether_address(vf,
msg, msglen);
break;
case I40E_VIRTCHNL_OP_ADD_VLAN:
- PMD_DRV_LOG(INFO, "OP_ADD_VLAN received\n");
+ PMD_DRV_LOG(INFO, "OP_ADD_VLAN received");
i40e_pf_host_process_cmd_add_vlan(vf, msg, msglen);
break;
case I40E_VIRTCHNL_OP_DEL_VLAN:
- PMD_DRV_LOG(INFO, "OP_DEL_VLAN received\n");
+ PMD_DRV_LOG(INFO, "OP_DEL_VLAN received");
i40e_pf_host_process_cmd_del_vlan(vf, msg, msglen);
break;
case I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
- PMD_DRV_LOG(INFO, "OP_CONFIG_PROMISCUOUS_MODE received\n");
+ PMD_DRV_LOG(INFO, "OP_CONFIG_PROMISCUOUS_MODE received");
i40e_pf_host_process_cmd_config_promisc_mode(vf, msg, msglen);
break;
case I40E_VIRTCHNL_OP_GET_STATS:
- PMD_DRV_LOG(INFO, "OP_GET_STATS received\n");
+ PMD_DRV_LOG(INFO, "OP_GET_STATS received");
i40e_pf_host_process_cmd_get_stats(vf);
break;
case I40E_VIRTCHNL_OP_GET_LINK_STAT:
- PMD_DRV_LOG(INFO, "OP_GET_LINK_STAT received\n");
+ PMD_DRV_LOG(INFO, "OP_GET_LINK_STAT received");
i40e_pf_host_process_cmd_get_link_status(vf);
break;
+ case I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD:
+ PMD_DRV_LOG(INFO, "OP_CFG_VLAN_OFFLOAD received");
+ i40e_pf_host_process_cmd_cfg_vlan_offload(vf, msg, msglen);
+ break;
+ case I40E_VIRTCHNL_OP_CFG_VLAN_PVID:
+ PMD_DRV_LOG(INFO, "OP_CFG_VLAN_PVID received");
+ i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen);
+ break;
/* Don't add command supported below, which will
* return an error code.
*/
case I40E_VIRTCHNL_OP_FCOE:
- PMD_DRV_LOG(ERR, "OP_FCOE received, not supported\n");
+ PMD_DRV_LOG(ERR, "OP_FCOE received, not supported");
default:
- PMD_DRV_LOG(ERR, "%u received, not supported\n",
- opcode);
+ PMD_DRV_LOG(ERR, "%u received, not supported", opcode);
i40e_pf_host_send_msg_to_vf(vf, opcode,
I40E_ERR_PARAM, NULL, 0);
break;