* [dpdk-dev] [PATCH 1/6] i40e: destroy MSIX pool when device is closed
2014-06-20 10:24 [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Chen Jing D(Mark)
@ 2014-06-20 10:24 ` Chen Jing D(Mark)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 2/6] i40e: Add permenant mac address into mac list Chen Jing D(Mark)
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chen Jing D(Mark) @ 2014-06-20 10:24 UTC (permalink / raw)
To: dev
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
Free MSIX pool resource in function i40e_dev_close.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index a335242..7ee6a70 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -740,6 +740,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
i40e_shutdown_adminq(hw);
i40e_res_pool_destroy(&pf->qp_pool);
+ i40e_res_pool_destroy(&pf->msix_pool);
/* force a PF reset to clean anything leftover */
reg = I40E_READ_REG(hw, I40E_PFGEN_CTRL);
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 2/6] i40e: Add permenant mac address into mac list
2014-06-20 10:24 [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Chen Jing D(Mark)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 1/6] i40e: destroy MSIX pool when device is closed Chen Jing D(Mark)
@ 2014-06-20 10:24 ` Chen Jing D(Mark)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 3/6] i40e: Add sanity check in pf host driver Chen Jing D(Mark)
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chen Jing D(Mark) @ 2014-06-20 10:24 UTC (permalink / raw)
To: dev
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
In old firmware versions, the default mac vlan filter setting is
not the one that we expected, so we'll try to remove it and add
new one to change default setting. After firmware updated, it
change default setting to the one that we expected and don't
allow to remove the setting. In this case, we should add the
perenant mac address into mac list and then return.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 7ee6a70..4535cdf 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -2277,8 +2277,24 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi)
def_filter.flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH |
I40E_AQC_MACVLAN_DEL_IGNORE_VLAN;
ret = i40e_aq_remove_macvlan(hw, vsi->seid, &def_filter, 1, NULL);
- if (ret != I40E_SUCCESS)
+ if (ret != I40E_SUCCESS) {
+ struct i40e_mac_filter *f;
+ PMD_DRV_LOG(WARNING, "Failed to remove default [mac,vlan] config\n");
+
+ /* Even failed to update default setting, still needs to add the permanent
+ * mac into mac list.
+ */
+ f = rte_zmalloc("macv_filter", sizeof(*f), 0);
+ if (f == NULL) {
+ PMD_DRV_LOG(ERR, "failed to allocate memory\n");
+ return I40E_ERR_NO_MEMORY;
+ }
+ (void)rte_memcpy(&f->macaddr.addr_bytes, hw->mac.perm_addr,
+ ETH_ADDR_LEN);
+ TAILQ_INSERT_TAIL(&vsi->mac_list, f, next);
+ vsi->mac_num++;
return ret;
+ }
return i40e_vsi_add_mac(vsi, (struct ether_addr *)(hw->mac.perm_addr));
}
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 3/6] i40e: Add sanity check in pf host driver
2014-06-20 10:24 [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Chen Jing D(Mark)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 1/6] i40e: destroy MSIX pool when device is closed Chen Jing D(Mark)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 2/6] i40e: Add permenant mac address into mac list Chen Jing D(Mark)
@ 2014-06-20 10:24 ` Chen Jing D(Mark)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 4/6] i40e: make change to vlan_strip and vlan_set_pvid function Chen Jing D(Mark)
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chen Jing D(Mark) @ 2014-06-20 10:24 UTC (permalink / raw)
To: dev
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
Add sanity check in message handling functions on the request
buffer pointer from VF.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_i40e/i40e_pf.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_pf.c b/lib/librte_pmd_i40e/i40e_pf.c
index 76405d3..1fa65e9 100644
--- a/lib/librte_pmd_i40e/i40e_pf.c
+++ b/lib/librte_pmd_i40e/i40e_pf.c
@@ -419,7 +419,7 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
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");
ret = I40E_ERR_PARAM;
@@ -465,7 +465,7 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf,
struct i40e_virtchnl_irq_map_info *irqmap =
(struct i40e_virtchnl_irq_map_info *)msg;
- if (msglen < sizeof(struct i40e_virtchnl_irq_map_info)) {
+ if (msg == NULL || msglen < sizeof(struct i40e_virtchnl_irq_map_info)) {
PMD_DRV_LOG(ERR, "buffer too short\n");
ret = I40E_ERR_PARAM;
goto send_msg;
@@ -553,7 +553,7 @@ i40e_pf_host_process_cmd_enable_queues(struct i40e_pf_vf *vf,
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;
}
@@ -575,7 +575,7 @@ i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,
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;
}
@@ -600,7 +600,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
int i;
struct ether_addr *mac;
- if (msglen <= sizeof(*addr_list)) {
+ if (msg == NULL || msglen <= sizeof(*addr_list)) {
PMD_DRV_LOG(ERR, "add_ether_address argument too short\n");
ret = I40E_ERR_PARAM;
goto send_msg;
@@ -633,7 +633,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
int i;
struct ether_addr *mac;
- if (msglen <= sizeof(*addr_list)) {
+ if (msg == NULL || msglen <= sizeof(*addr_list)) {
PMD_DRV_LOG(ERR, "delete_ether_address argument too short\n");
ret = I40E_ERR_PARAM;
goto send_msg;
@@ -666,7 +666,7 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
int i;
uint16_t *vid;
- if (msglen <= sizeof(*vlan_filter_list)) {
+ if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
PMD_DRV_LOG(ERR, "add_vlan argument too short\n");
ret = I40E_ERR_PARAM;
goto send_msg;
@@ -698,7 +698,7 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
int i;
uint16_t *vid;
- if (msglen <= sizeof(*vlan_filter_list)) {
+ if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
PMD_DRV_LOG(ERR, "delete_vlan argument too short\n");
ret = I40E_ERR_PARAM;
goto send_msg;
@@ -722,7 +722,7 @@ static int
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 =
@@ -730,6 +730,11 @@ i40e_pf_host_process_cmd_config_promisc_mode(
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,
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 4/6] i40e: make change to vlan_strip and vlan_set_pvid function
2014-06-20 10:24 [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Chen Jing D(Mark)
` (2 preceding siblings ...)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 3/6] i40e: Add sanity check in pf host driver Chen Jing D(Mark)
@ 2014-06-20 10:24 ` Chen Jing D(Mark)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 5/6] i40e: PF host driver to support VF vlan offload and set pvid Chen Jing D(Mark)
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chen Jing D(Mark) @ 2014-06-20 10:24 UTC (permalink / raw)
To: dev
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
Change original 2 functions to common ones that can take effect on
both VF and PF VSIs.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev.c | 141 ++++++++++++++++++-------------------
lib/librte_pmd_i40e/i40e_ethdev.h | 17 +++++
2 files changed, 87 insertions(+), 71 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 4535cdf..1b4e822 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -182,11 +182,10 @@ static int i40e_res_pool_free(struct i40e_res_pool_info *pool,
uint32_t base);
static int i40e_res_pool_alloc(struct i40e_res_pool_info *pool,
uint16_t num);
-static int i40e_vsi_init_vlan(struct i40e_vsi *vsi);
+static int i40e_dev_init_vlan(struct rte_eth_dev *dev);
static int i40e_veb_release(struct i40e_veb *veb);
static struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf,
struct i40e_vsi *vsi);
-static int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
static int i40e_pf_config_mq_rx(struct i40e_pf *pf);
static int i40e_vsi_config_double_vlan(struct i40e_vsi *vsi, int on);
static int i40e_pf_disable_all_queues(struct i40e_hw *hw);
@@ -534,13 +533,7 @@ err_get_capabilities:
static int
i40e_dev_configure(struct rte_eth_dev *dev)
{
- struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
- struct i40e_vsi *vsi = pf->main_vsi;
- int ret;
-
- ret = i40e_vsi_init_vlan(vsi);
-
- return ret;
+ return i40e_dev_init_vlan(dev);
}
void
@@ -1293,39 +1286,22 @@ static int
i40e_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
- struct i40e_hw *hw = I40E_PF_TO_HW(pf);
struct i40e_vsi *vsi = pf->main_vsi;
struct rte_eth_dev_data *data = I40E_VSI_TO_DEV_DATA(vsi);
- struct i40e_vsi_context ctxt;
- uint8_t vlan_flags = 0;
- int ret;
+ struct i40e_vsi_vlan_pvid_info info;
- if (on) {
- /**
- * If insert pvid is enabled, only tagged pkts are
- * allowed to be sent out.
- */
- vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID |
- I40E_AQ_VSI_PVLAN_MODE_TAGGED;
- } else {
- if (data->dev_conf.txmode.hw_vlan_reject_tagged == 0)
- vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_TAGGED;
- if (data->dev_conf.txmode.hw_vlan_reject_untagged == 0)
- vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+ memset(&info, 0, sizeof(info));
+ info.on = on;
+ if (info.on)
+ info.config.pvid = pvid;
+ else {
+ info.config.reject.tagged =
+ data->dev_conf.txmode.hw_vlan_reject_tagged;
+ info.config.reject.untagged =
+ data->dev_conf.txmode.hw_vlan_reject_untagged;
}
- vsi->info.port_vlan_flags &= ~(I40E_AQ_VSI_PVLAN_INSERT_PVID |
- I40E_AQ_VSI_PVLAN_MODE_MASK);
- vsi->info.port_vlan_flags |= vlan_flags;
- vsi->info.pvid = pvid;
- vsi->info.valid_sections =
- rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID);
- (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
- ctxt.seid = vsi->seid;
- ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
- if (ret != I40E_SUCCESS)
- PMD_DRV_LOG(INFO, "Failed to update VSI params\n");
- return ret;
+ return i40e_vsi_vlan_pvid_set(vsi, &info);
}
static int
@@ -2039,6 +2015,53 @@ validate_tcmap_parameter(struct i40e_vsi *vsi, uint8_t enabled_tcmap)
return I40E_SUCCESS;
}
+int
+i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
+ struct i40e_vsi_vlan_pvid_info *info)
+{
+ struct i40e_hw *hw;
+ struct i40e_vsi_context ctxt;
+ uint8_t vlan_flags = 0;
+ int ret;
+
+ if (vsi == NULL || info == NULL) {
+ PMD_DRV_LOG(ERR, "invalid parameters\n");
+ return I40E_ERR_PARAM;
+ }
+
+ if (info->on) {
+ vsi->info.pvid = info->config.pvid;
+ /**
+ * If insert pvid is enabled, only tagged pkts are
+ * allowed to be sent out.
+ */
+ vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID |
+ I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+ } else {
+ vsi->info.pvid = 0;
+ if (info->config.reject.tagged == 0)
+ vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+
+ if (info->config.reject.untagged == 0)
+ vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+ }
+ vsi->info.port_vlan_flags &= ~(I40E_AQ_VSI_PVLAN_INSERT_PVID |
+ I40E_AQ_VSI_PVLAN_MODE_MASK);
+ vsi->info.port_vlan_flags |= vlan_flags;
+ vsi->info.valid_sections =
+ rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID);
+ memset(&ctxt, 0, sizeof(ctxt));
+ (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+ ctxt.seid = vsi->seid;
+
+ hw = I40E_VSI_TO_HW(vsi);
+ ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+ if (ret != I40E_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to update VSI params\n");
+
+ return ret;
+}
+
static int
i40e_vsi_update_tc_bandwidth(struct i40e_vsi *vsi, uint8_t enabled_tcmap)
{
@@ -2574,7 +2597,7 @@ fail_mem:
}
/* Configure vlan stripping on or off */
-static int
+int
i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on)
{
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
@@ -2616,44 +2639,20 @@ i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on)
}
static int
-i40e_vsi_init_vlan(struct i40e_vsi *vsi)
+i40e_dev_init_vlan(struct rte_eth_dev *dev)
{
- struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
- struct rte_eth_dev_data *data = I40E_VSI_TO_DEV_DATA(vsi);
- struct i40e_vsi_context ctxt;
- uint8_t vlan_flags = 0;
+ struct rte_eth_dev_data *data = dev->data;
int ret;
- /* Set PVID */
- if (data->dev_conf.txmode.hw_vlan_insert_pvid == 1) {
- /**
- * If insert pvid is enabled, only tagged pkts are
- * allowed to be sent out.
- */
- vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID |
- I40E_AQ_VSI_PVLAN_MODE_TAGGED;
- } else {
- if (data->dev_conf.txmode.hw_vlan_reject_tagged == 0)
- vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_TAGGED;
- if (data->dev_conf.txmode.hw_vlan_reject_untagged == 0)
- vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
- }
-
- /* Strip VLAN tag or not */
- if (data->dev_conf.rxmode.hw_vlan_strip == 0)
- vlan_flags |= I40E_AQ_VSI_PVLAN_EMOD_NOTHING;
+ /* Apply vlan offload setting */
+ i40e_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
- vsi->info.port_vlan_flags &= ~(I40E_AQ_VSI_PVLAN_MODE_MASK |
- I40E_AQ_VSI_PVLAN_INSERT_PVID | I40E_AQ_VSI_PVLAN_EMOD_MASK);
- vsi->info.port_vlan_flags |= vlan_flags;
- vsi->info.pvid = data->dev_conf.txmode.pvid;
- vsi->info.valid_sections =
- rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID);
+ /* Apply double-vlan setting, not implemented yet */
- (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
- ctxt.seid = vsi->seid;
- ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
- if (ret != I40E_SUCCESS)
+ /* Apply pvid setting */
+ ret = i40e_vlan_pvid_set(dev, data->dev_conf.txmode.pvid,
+ data->dev_conf.txmode.hw_vlan_insert_pvid);
+ if (ret)
PMD_DRV_LOG(INFO, "Failed to update VSI params\n");
return ret;
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h b/lib/librte_pmd_i40e/i40e_ethdev.h
index e00895d..64deef2 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.h
+++ b/lib/librte_pmd_i40e/i40e_ethdev.h
@@ -224,6 +224,20 @@ enum pending_msg {
PFMSG_DRIVER_CLOSE = 0x4,
};
+struct i40e_vsi_vlan_pvid_info {
+ uint16_t on; /* Enable or disable pvid */
+ union {
+ uint16_t pvid; /* Valid in case 'on' is set to set pvid */
+ struct {
+ /* Valid in case 'on' is cleared. 'tagged' will reject tagged packets,
+ * while 'untagged' will reject untagged packets.
+ */
+ uint8_t tagged;
+ uint8_t untagged;
+ } reject;
+ } config;
+};
+
struct i40e_vf_rx_queues {
uint64_t rx_dma_addr;
uint32_t rx_ring_len;
@@ -295,6 +309,9 @@ int i40e_dev_link_update(struct rte_eth_dev *dev,
__rte_unused int wait_to_complete);
void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi);
void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
+int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
+ struct i40e_vsi_vlan_pvid_info *info);
+int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
/* I40E_DEV_PRIVATE_TO */
#define I40E_DEV_PRIVATE_TO_PF(adapter) \
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 5/6] i40e: PF host driver to support VF vlan offload and set pvid
2014-06-20 10:24 [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Chen Jing D(Mark)
` (3 preceding siblings ...)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 4/6] i40e: make change to vlan_strip and vlan_set_pvid function Chen Jing D(Mark)
@ 2014-06-20 10:24 ` Chen Jing D(Mark)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 6/6] i40e: VF to support VLAN strip and pvid set/clear Chen Jing D(Mark)
2014-06-20 13:51 ` [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Thomas Monjalon
6 siblings, 0 replies; 8+ messages in thread
From: Chen Jing D(Mark) @ 2014-06-20 10:24 UTC (permalink / raw)
To: dev
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
PF driver add 2 commands, data structures and corresponding
message handling functions to support VF doing VLAN offload
and set/clear pvid operation.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_i40e/i40e_pf.c | 62 ++++++++++++++++++++++++++++++++++++++++-
lib/librte_pmd_i40e/i40e_pf.h | 17 +++++++++++
2 files changed, 78 insertions(+), 1 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_pf.c b/lib/librte_pmd_i40e/i40e_pf.c
index 1fa65e9..e8b154d 100644
--- a/lib/librte_pmd_i40e/i40e_pf.c
+++ b/lib/librte_pmd_i40e/i40e_pf.c
@@ -304,7 +304,8 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf)
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;
@@ -356,6 +357,7 @@ i40e_pf_host_hmc_config_rxq(struct i40e_hw *hw,
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);
@@ -778,6 +780,56 @@ i40e_pf_host_process_cmd_get_link_status(struct i40e_pf_vf *vf)
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\n");
+
+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,
@@ -866,6 +918,14 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
PMD_DRV_LOG(INFO, "OP_GET_LINK_STAT received\n");
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\n");
+ 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\n");
+ i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen);
+ break;
/* Don't add command supported below, which will
* return an error code.
*/
diff --git a/lib/librte_pmd_i40e/i40e_pf.h b/lib/librte_pmd_i40e/i40e_pf.h
index ccbd0d8..41b6826 100644
--- a/lib/librte_pmd_i40e/i40e_pf.h
+++ b/lib/librte_pmd_i40e/i40e_pf.h
@@ -55,6 +55,23 @@ enum i40e_pf_vfr_state {
enum i40e_virtchnl_ops_DPDK {
/* Keep some gap between Linu PF commands and DPDK PF specific commands */
I40E_VIRTCHNL_OP_GET_LINK_STAT = I40E_VIRTCHNL_OP_EVENT + 0x100,
+ I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD,
+ I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
+};
+struct i40e_virtchnl_vlan_offload_info {
+ uint16_t vsi_id;
+ uint8_t enable_vlan_strip;
+ uint8_t reserved;
+};
+
+/* I40E_VIRTCHNL_OP_CFG_VLAN_PVID
+ * VF sends this message to enable/disable pvid. If it's enable op, needs to specify the
+ * pvid.
+ * PF returns status code in retval.
+ */
+struct i40e_virtchnl_pvid_info {
+ uint16_t vsi_id;
+ struct i40e_vsi_vlan_pvid_info info;
};
int i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset);
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 6/6] i40e: VF to support VLAN strip and pvid set/clear
2014-06-20 10:24 [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Chen Jing D(Mark)
` (4 preceding siblings ...)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 5/6] i40e: PF host driver to support VF vlan offload and set pvid Chen Jing D(Mark)
@ 2014-06-20 10:24 ` Chen Jing D(Mark)
2014-06-20 13:51 ` [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Thomas Monjalon
6 siblings, 0 replies; 8+ messages in thread
From: Chen Jing D(Mark) @ 2014-06-20 10:24 UTC (permalink / raw)
To: dev
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
VF driver add support to configure vlan offload and pvid set/clear
when host driver is DPDK. For Linux driver, it's not supported yet
since it doesn't support from host side.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev_vf.c | 127 +++++++++++++++++++++++++++++++++-
1 files changed, 126 insertions(+), 1 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index 4851df9..9e86285 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -114,6 +114,9 @@ static void i40evf_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int i40evf_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
+static void i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int i40evf_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid,
+ int on);
static void i40evf_dev_close(struct rte_eth_dev *dev);
static void i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev);
static void i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev);
@@ -121,6 +124,7 @@ static void i40evf_dev_allmulticast_enable(struct rte_eth_dev *dev);
static void i40evf_dev_allmulticast_disable(struct rte_eth_dev *dev);
static int i40evf_get_link_status(struct rte_eth_dev *dev,
struct rte_eth_link *link);
+static int i40evf_init_vlan(struct rte_eth_dev *dev);
static struct eth_dev_ops i40evf_eth_dev_ops = {
.dev_configure = i40evf_dev_configure,
.dev_start = i40evf_dev_start,
@@ -134,6 +138,8 @@ static struct eth_dev_ops i40evf_eth_dev_ops = {
.dev_close = i40evf_dev_close,
.dev_infos_get = i40evf_dev_info_get,
.vlan_filter_set = i40evf_vlan_filter_set,
+ .vlan_offload_set = i40evf_vlan_offload_set,
+ .vlan_pvid_set = i40evf_vlan_pvid_set,
.rx_queue_setup = i40e_dev_rx_queue_setup,
.rx_queue_release = i40e_dev_rx_queue_release,
.tx_queue_setup = i40e_dev_tx_queue_setup,
@@ -449,6 +455,62 @@ i40evf_config_promisc(struct rte_eth_dev *dev,
if (err)
PMD_DRV_LOG(ERR, "fail to execute command "
"CONFIG_PROMISCUOUS_MODE\n");
+ return err;
+}
+
+/* Configure vlan and double vlan offload. Use flag to specify which part to configure */
+static int
+i40evf_config_vlan_offload(struct rte_eth_dev *dev,
+ bool enable_vlan_strip)
+{
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ int err;
+ struct vf_cmd_info args;
+ struct i40e_virtchnl_vlan_offload_info offload;
+
+ offload.vsi_id = vf->vsi_res->vsi_id;
+ offload.enable_vlan_strip = enable_vlan_strip;
+
+ args.ops = I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD;
+ args.in_args = (uint8_t *)&offload;
+ args.in_args_size = sizeof(offload);
+ args.out_buffer = cmd_result_buffer;
+ args.out_size = I40E_AQ_BUF_SZ;
+
+ err = i40evf_execute_vf_cmd(dev, &args);
+ if (err)
+ PMD_DRV_LOG(ERR, "fail to execute command CFG_VLAN_OFFLOAD\n");
+
+ return err;
+}
+
+static int
+i40evf_config_vlan_pvid(struct rte_eth_dev *dev,
+ struct i40e_vsi_vlan_pvid_info *info)
+{
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ int err;
+ struct vf_cmd_info args;
+ struct i40e_virtchnl_pvid_info tpid_info;
+
+ if (dev == NULL || info == NULL) {
+ PMD_DRV_LOG(ERR, "invalid parameters\n");
+ return I40E_ERR_PARAM;
+ }
+
+ memset(&tpid_info, 0, sizeof(tpid_info));
+ tpid_info.vsi_id = vf->vsi_res->vsi_id;
+ (void)rte_memcpy(&tpid_info.info, info, sizeof(*info));
+
+ args.ops = I40E_VIRTCHNL_OP_CFG_VLAN_PVID;
+ args.in_args = (uint8_t *)&tpid_info;
+ args.in_args_size = sizeof(tpid_info);
+ args.out_buffer = cmd_result_buffer;
+ args.out_size = I40E_AQ_BUF_SZ;
+
+ err = i40evf_execute_vf_cmd(dev, &args);
+ if (err)
+ PMD_DRV_LOG(ERR, "fail to execute command CFG_VLAN_PVID\n");
return err;
}
@@ -1062,8 +1124,71 @@ static struct rte_driver rte_i40evf_driver = {
PMD_REGISTER_DRIVER(rte_i40evf_driver);
static int
-i40evf_dev_configure(__rte_unused struct rte_eth_dev *dev)
+i40evf_dev_configure(struct rte_eth_dev *dev)
+{
+ return i40evf_init_vlan(dev);
+}
+
+static int
+i40evf_init_vlan(struct rte_eth_dev *dev)
{
+ struct rte_eth_dev_data *data = dev->data;
+ int ret;
+
+ /* Apply vlan offload setting */
+ i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
+
+ /* Apply pvid setting */
+ ret = i40evf_vlan_pvid_set(dev, data->dev_conf.txmode.pvid,
+ data->dev_conf.txmode.hw_vlan_insert_pvid);
+ return ret;
+}
+
+static void
+i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
+{
+ bool enable_vlan_strip = 0;
+ struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+ /* Linux pf host doesn't support vlan offload yet */
+ if (vf->host_is_dpdk) {
+ /* Vlan stripping setting */
+ if (mask & ETH_VLAN_STRIP_MASK) {
+ /* Enable or disable VLAN stripping */
+ if (dev_conf->rxmode.hw_vlan_strip)
+ enable_vlan_strip = 1;
+ else
+ enable_vlan_strip = 0;
+
+ i40evf_config_vlan_offload(dev, enable_vlan_strip);
+ }
+ }
+}
+
+static int
+i40evf_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on)
+{
+ struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+ struct i40e_vsi_vlan_pvid_info info;
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+ memset(&info, 0, sizeof(info));
+ info.on = on;
+
+ /* Linux pf host don't support vlan offload yet */
+ if (vf->host_is_dpdk) {
+ if (info.on)
+ info.config.pvid = pvid;
+ else {
+ info.config.reject.tagged =
+ dev_conf->txmode.hw_vlan_reject_tagged;
+ info.config.reject.untagged =
+ dev_conf->txmode.hw_vlan_reject_untagged;
+ }
+ return i40evf_config_vlan_pvid(dev, &info);
+ }
+
return 0;
}
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config
2014-06-20 10:24 [dpdk-dev] [PATCH 0/6] Support i40e VF vlan offload and pvid config Chen Jing D(Mark)
` (5 preceding siblings ...)
2014-06-20 10:24 ` [dpdk-dev] [PATCH 6/6] i40e: VF to support VLAN strip and pvid set/clear Chen Jing D(Mark)
@ 2014-06-20 13:51 ` Thomas Monjalon
6 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2014-06-20 13:51 UTC (permalink / raw)
To: Chen Jing D(Mark); +Cc: dev
2014-06-20 18:24, Chen Jing D:
> The patch includes the changes in pf, pf host and vf driver for i40e to
> support VF vlan strip and pvid set/clear. In the meanwhile, make several
> minor changes to do sanity check and bug fixes.
Applied for version 1.7.0.
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 8+ messages in thread