@@ -58,6 +58,7 @@ struct bnxt_child_vf_info {
uint16_t fid;
uint16_t max_tx_rate;
uint32_t func_cfg_flags;
+ uint16_t dflt_vlan;
void *req_buf;
uint8_t mac_spoof_en;
};
@@ -2138,7 +2138,7 @@ int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf,
return rc;
}
-int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf, uint16_t vlan)
+int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf)
{
struct hwrm_func_cfg_input req = {0};
struct hwrm_func_cfg_output *resp = bp->hwrm_cmd_resp_addr;
@@ -2148,7 +2148,7 @@ int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf, uint16_t vlan)
req.flags = rte_cpu_to_le_32(bp->pf.vf_info[vf].func_cfg_flags);
req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
req.enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_VLAN);
- req.dflt_vlan = rte_cpu_to_le_16(vlan);
+ req.dflt_vlan = rte_cpu_to_le_16(bp->pf.vf_info[vf].dflt_vlan);
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
HWRM_CHECK_RESULT;
@@ -111,7 +111,6 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp);
int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs);
int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf, uint8_t *mac_addr);
int bnxt_hwrm_pf_evb_mode(struct bnxt *bp);
-int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf, uint16_t vlan);
int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf,
uint16_t max_bw, uint16_t enables);
int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
@@ -119,6 +118,7 @@ int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
uint8_t tunnel_type);
void bnxt_free_tunnel_ports(struct bnxt *bp);
+int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf);
int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf);
int bnxt_hwrm_func_vf_vnic_cfg_do(struct bnxt *bp, uint16_t vf,
void (*vnic_cb)(struct bnxt_vnic_info *,
@@ -247,7 +247,8 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
for (i = 0; vf_mask; i++, vf_mask >>= 1) {
if (vf_mask & 1) {
- ret = bnxt_hwrm_set_vf_vlan(bp, i, vlan_on ? vlan : 0);
+ bp->pf.vf_info[i].dflt_vlan = vlan_on ? vlan : 0;
+ ret = bnxt_hwrm_set_vf_vlan(bp, i);
if (ret)
rc = ret;
}
@@ -346,3 +347,33 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
return rc;
}
+
+int
+rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+ uint16_t vlan_id)
+{
+ struct rte_eth_dev *dev;
+ struct rte_eth_dev_info dev_info;
+ struct bnxt *bp;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+ rte_eth_dev_info_get(port, &dev_info);
+ bp = (struct bnxt *)dev->data->dev_private;
+
+ if (vf >= dev_info.max_vfs)
+ return -EINVAL;
+
+ if (!BNXT_PF(bp)) {
+ RTE_LOG(ERR, PMD,
+ "Attempt to set VF %d vlan insert on non-PF port %d\n",
+ vf, port);
+ return -ENOTSUP;
+ }
+
+ if (vlan_id != bp->pf.vf_info[vf].dflt_vlan)
+ return -ENOTSUP;
+
+ return 0;
+}
@@ -74,6 +74,26 @@ int
rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
/**
+ * Enable/Disable vf vlan insert
+ *
+ * @param port
+ * The port identifier of the Ethernet device.
+ * @param vf
+ * ID specifying VF.
+ * @param vlan_id
+ * 0 - Disable VF's vlan insert.
+ * n - Enable; n is inserted as the vlan id.
+ *
+ * @return
+ * - (0) if successful.
+ * - (-ENODEV) if *port* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+int
+rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+ uint16_t vlan_id);
+
+/**
* Response sent back to bnxt driver from user app after callback
*/
enum rte_pmd_bnxt_mb_event_rsp {
@@ -7,5 +7,6 @@ DPDK_17.05 {
rte_pmd_bnxt_set_vf_vlan_filter;
rte_pmd_bnxt_set_vf_mac_anti_spoof;
rte_pmd_bnxt_set_vf_vlan_stripq;
+ rte_pmd_bnxt_set_vf_vlan_insert;
};