DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 5/6] i40e: PF host driver to support VF vlan offload and set pvid
Date: Fri, 20 Jun 2014 18:24:43 +0800	[thread overview]
Message-ID: <1403259884-6498-6-git-send-email-jing.d.chen@intel.com> (raw)
In-Reply-To: <1403259884-6498-1-git-send-email-jing.d.chen@intel.com>

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

  parent reply	other threads:[~2014-06-20 10:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` [dpdk-dev] [PATCH 3/6] i40e: Add sanity check in pf host driver 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)
2014-06-20 10:24 ` Chen Jing D(Mark) [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403259884-6498-6-git-send-email-jing.d.chen@intel.com \
    --to=jing.d.chen@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).