From: Beilei Xing <beilei.xing@intel.com>
To: jingjing.wu@intel.com
Cc: helin.zhang@intel.com, dev@dpdk.org,
Bernard Iremonger <bernard.iremonger@intel.com>,
Stroe Laura <laura.stroe@intel.com>
Subject: [dpdk-dev] [PATCH 1/4] net/i40e: support replace filter type
Date: Fri, 3 Mar 2017 17:31:34 +0800 [thread overview]
Message-ID: <1488533497-27682-2-git-send-email-beilei.xing@intel.com> (raw)
In-Reply-To: <1488533497-27682-1-git-send-email-beilei.xing@intel.com>
Add new admin queue function and extended fields
in DCR 288:
- Add admin queue function for Replace filter
command (Opcode: 0x025F)
- Add General fields for Add/Remove Cloud filters
command
This patch will be removed to base driver in future.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Signed-off-by: Stroe Laura <laura.stroe@intel.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
drivers/net/i40e/i40e_ethdev.h | 106 ++++++++++++++++++++++++++++
drivers/net/i40e/i40e_flow.c | 152 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 258 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index f545850..3a49865 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -729,6 +729,100 @@ struct i40e_valid_pattern {
parse_filter_t parse_filter;
};
+/* Support replace filter */
+
+/* i40e_aqc_add_remove_cloud_filters_element_big_data is used when
+ * I40E_AQC_ADD_REM_CLOUD_CMD_BIG_BUFFER flag is set. refer to
+ * DCR288
+ */
+struct i40e_aqc_add_remove_cloud_filters_element_big_data {
+ struct i40e_aqc_add_remove_cloud_filters_element_data element;
+ uint16_t general_fields[32];
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD0 0
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD1 1
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD2 2
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD0 3
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD1 4
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD2 5
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD0 6
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD1 7
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD2 8
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD0 9
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD1 10
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD2 11
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD0 12
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD1 13
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD2 14
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD0 15
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD1 16
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD2 17
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD3 18
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD4 19
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD5 20
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD6 21
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD7 22
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD0 23
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD1 24
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD2 25
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD3 26
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD4 27
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD5 28
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD6 29
+#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD7 30
+};
+
+/* Replace filter Command 0x025F
+ * uses the i40e_aqc_replace_cloud_filters,
+ * and the generic indirect completion structure
+ */
+struct i40e_filter_data {
+ uint8_t filter_type;
+ uint8_t input[3];
+};
+
+struct i40e_aqc_replace_cloud_filters_cmd {
+ uint8_t valid_flags;
+#define I40E_AQC_REPLACE_L1_FILTER 0x0
+#define I40E_AQC_REPLACE_CLOUD_FILTER 0x1
+#define I40E_AQC_GET_CLOUD_FILTERS 0x2
+#define I40E_AQC_MIRROR_CLOUD_FILTER 0x4
+#define I40E_AQC_HIGH_PRIORITY_CLOUD_FILTER 0x8
+ uint8_t old_filter_type;
+ uint8_t new_filter_type;
+ uint8_t tr_bit;
+ uint8_t valid_bit_mask;
+#define I40E_AQC_REPLACE_CLOUD_CMD_ENABLE_INPUT 0x80
+ uint8_t reserved[4];
+ uint32_t addr_high;
+ uint32_t addr_low;
+};
+
+struct i40e_aqc_replace_cloud_filters_cmd_buf {
+ uint8_t data[32];
+ /* Filter type INPUT codes*/
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_ENTRIES_MAX 3
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED (1 << 7UL)
+
+ /* Field Vector offsets */
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_MAC_DA 0
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_ETH 6
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG 7
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_VLAN 8
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_OVLAN 9
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_IVLAN 10
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_TUNNLE_KEY 11
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IMAC 12
+ /* big FLU */
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IP_DA 14
+ /* big FLU */
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_OIP_DA 15
+
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_INNER_VLAN 37
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_TEID_WORD0 44
+#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_TEID_WORD1 45
+ struct i40e_filter_data filters[8];
+};
+
int i40e_dev_switch_queues(struct i40e_pf *pf, bool on);
int i40e_vsi_release(struct i40e_vsi *vsi);
struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf,
@@ -806,6 +900,18 @@ int i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
uint8_t add);
int i40e_fdir_flush(struct rte_eth_dev *dev);
+enum i40e_status_code i40e_aq_add_cloud_filters_big_buffer(struct i40e_hw *hw,
+ uint16_t seid,
+ struct i40e_aqc_add_remove_cloud_filters_element_big_data *filters,
+ uint8_t filter_count);
+enum i40e_status_code i40e_aq_remove_cloud_filters_big_buffer(
+ struct i40e_hw *hw, uint16_t seid,
+ struct i40e_aqc_add_remove_cloud_filters_element_big_data *filters,
+ uint8_t filter_count);
+enum i40e_status_code i40e_aq_replace_cloud_filters(struct i40e_hw *hw,
+ struct i40e_aqc_replace_cloud_filters_cmd *filters,
+ struct i40e_aqc_replace_cloud_filters_cmd_buf *cmd_buf);
+
#define I40E_DEV_TO_PCI(eth_dev) \
RTE_DEV_TO_PCI((eth_dev)->device)
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index f163ce5..3c49228 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -1874,3 +1874,155 @@ i40e_flow_flush_tunnel_filter(struct i40e_pf *pf)
return ret;
}
+
+#define i40e_aqc_opc_replace_cloud_filters 0x025F
+#define I40E_AQC_ADD_REM_CLOUD_CMD_BIG_BUFFER 1
+/**
+ * i40e_aq_add_cloud_filters_big_buffer
+ * @hw: pointer to the hardware structure
+ * @seid: VSI seid to add cloud filters from
+ * @filters: Buffer which contains the filters in big buffer to be added
+ * @filter_count: number of filters contained in the buffer
+ *
+ * Set the cloud filters for a given VSI. The contents of the
+ * i40e_aqc_add_remove_cloud_filters_element_big_data are filled
+ * in by the caller of the function.
+ *
+ **/
+enum i40e_status_code i40e_aq_add_cloud_filters_big_buffer(
+ struct i40e_hw *hw, uint16_t seid,
+ struct i40e_aqc_add_remove_cloud_filters_element_big_data *filters,
+ uint8_t filter_count)
+{
+ struct i40e_aq_desc desc;
+ struct i40e_aqc_add_remove_cloud_filters *cmd =
+ (struct i40e_aqc_add_remove_cloud_filters *)&desc.params.raw;
+ enum i40e_status_code status;
+ uint16_t buff_len;
+ int i;
+
+ i40e_fill_default_direct_cmd_desc(&desc,
+ i40e_aqc_opc_add_cloud_filters);
+
+ buff_len = filter_count * sizeof(*filters);
+ desc.datalen = CPU_TO_LE16(buff_len);
+ desc.flags |= CPU_TO_LE16(
+ (uint16_t)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
+ cmd->num_filters = filter_count;
+ cmd->seid = CPU_TO_LE16(seid);
+ cmd->reserved2[0] = I40E_AQC_ADD_REM_CLOUD_CMD_BIG_BUFFER;
+
+ /* adjust Geneve VNI for HW issue */
+ for (i = 0; i < filter_count; i++) {
+ uint16_t tnl_type;
+ uint32_t ti;
+
+ tnl_type = (LE16_TO_CPU(filters[i].element.flags) &
+ I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK) >>
+ I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT;
+ if (tnl_type == I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE) {
+ ti = LE32_TO_CPU(filters[i].element.tenant_id);
+ filters[i].element.tenant_id = CPU_TO_LE32(ti << 8);
+ }
+ }
+
+ status = i40e_asq_send_command(hw, &desc, filters, buff_len, NULL);
+
+ return status;
+}
+
+/**
+ * i40e_aq_remove_cloud_filters_big_buffer
+ * @hw: pointer to the hardware structure
+ * @seid: VSI seid to remove cloud filters from
+ * @filters: Buffer which contains the filters in big buffer to be removed
+ * @filter_count: number of filters contained in the buffer
+ *
+ * Remove the cloud filters for a given VSI. The contents of the
+ * i40e_aqc_add_remove_cloud_filters_element_big_data are filled
+ * in by the caller of the function.
+ *
+ **/
+enum i40e_status_code i40e_aq_remove_cloud_filters_big_buffer(
+ struct i40e_hw *hw, uint16_t seid,
+ struct i40e_aqc_add_remove_cloud_filters_element_big_data *filters,
+ uint8_t filter_count)
+{
+ struct i40e_aq_desc desc;
+ struct i40e_aqc_add_remove_cloud_filters *cmd =
+ (struct i40e_aqc_add_remove_cloud_filters *)&desc.params.raw;
+ enum i40e_status_code status;
+ uint16_t buff_len;
+ int i;
+
+ i40e_fill_default_direct_cmd_desc(&desc,
+ i40e_aqc_opc_remove_cloud_filters);
+
+ buff_len = filter_count * sizeof(*filters);
+ desc.datalen = CPU_TO_LE16(buff_len);
+ desc.flags |= CPU_TO_LE16(
+ (uint16_t)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
+ cmd->num_filters = filter_count;
+ cmd->seid = CPU_TO_LE16(seid);
+ cmd->reserved2[0] = I40E_AQC_ADD_REM_CLOUD_CMD_BIG_BUFFER;
+
+ /* adjust Geneve VNI for HW issue */
+ for (i = 0; i < filter_count; i++) {
+ uint16_t tnl_type;
+ uint32_t ti;
+
+ tnl_type = (LE16_TO_CPU(filters[i].element.flags) &
+ I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK) >>
+ I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT;
+ if (tnl_type == I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE) {
+ ti = LE32_TO_CPU(filters[i].element.tenant_id);
+ filters[i].element.tenant_id = CPU_TO_LE32(ti << 8);
+ }
+ }
+
+ status = i40e_asq_send_command(hw, &desc, filters, buff_len, NULL);
+
+ return status;
+}
+
+/**
+ * i40e_aq_replace_cloud_filters - Replace cloud filter command
+ * @hw: pointer to the hw struct
+ * @filters: pointer to the i40e_aqc_replace_cloud_filter_cmd struct
+ * @cmd_buf: pointer to the i40e_aqc_replace_cloud_filter_cmd_buf struct
+ **/
+enum
+i40e_status_code i40e_aq_replace_cloud_filters(struct i40e_hw *hw,
+ struct i40e_aqc_replace_cloud_filters_cmd *filters,
+ struct i40e_aqc_replace_cloud_filters_cmd_buf *cmd_buf)
+{
+ struct i40e_aq_desc desc;
+ struct i40e_aqc_replace_cloud_filters_cmd *cmd =
+ (struct i40e_aqc_replace_cloud_filters_cmd *)&desc.params.raw;
+ enum i40e_status_code status = I40E_SUCCESS;
+ int i = 0;
+
+ i40e_fill_default_direct_cmd_desc(&desc,
+ i40e_aqc_opc_replace_cloud_filters);
+
+ desc.datalen = CPU_TO_LE16(32);
+ desc.flags |= CPU_TO_LE16(
+ (uint16_t)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
+ cmd->old_filter_type = filters->old_filter_type;
+ cmd->new_filter_type = filters->new_filter_type;
+ cmd->valid_flags = filters->valid_flags;
+ cmd->tr_bit = filters->tr_bit;
+
+ status = i40e_asq_send_command(hw, &desc, cmd_buf,
+ sizeof(struct i40e_aqc_replace_cloud_filters_cmd_buf), NULL);
+
+ /* for get cloud filters command */
+ for (i = 0; i < 32; i += 4) {
+ cmd_buf->filters[i / 4].filter_type = cmd_buf->data[i];
+ cmd_buf->filters[i / 4].input[0] = cmd_buf->data[i + 1];
+ cmd_buf->filters[i / 4].input[1] = cmd_buf->data[i + 2];
+ cmd_buf->filters[i / 4].input[2] = cmd_buf->data[i + 3];
+ }
+
+ return status;
+}
--
2.5.5
next prev parent reply other threads:[~2017-03-03 9:32 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 9:31 [dpdk-dev] [PATCH 0/4] support replace filter function Beilei Xing
2017-03-03 9:31 ` Beilei Xing [this message]
2017-03-08 15:50 ` [dpdk-dev] [PATCH 1/4] net/i40e: support replace filter type Ferruh Yigit
2017-03-09 5:59 ` Xing, Beilei
2017-03-09 10:01 ` Ferruh Yigit
2017-03-09 10:43 ` Xing, Beilei
2017-03-03 9:31 ` [dpdk-dev] [PATCH 2/4] net/i40e: rework tunnel filter functions Beilei Xing
2017-03-08 15:50 ` Ferruh Yigit
2017-03-09 6:00 ` Xing, Beilei
2017-03-03 9:31 ` [dpdk-dev] [PATCH 3/4] net/i40e: support tunnel filter to VF Beilei Xing
2017-03-08 15:50 ` Ferruh Yigit
2017-03-09 6:08 ` Xing, Beilei
2017-03-27 16:34 ` Ferruh Yigit
2017-03-03 9:31 ` [dpdk-dev] [PATCH 4/4] net/i40e: refine consistent tunnel filter Beilei Xing
2017-03-08 15:50 ` Ferruh Yigit
2017-03-09 6:11 ` Xing, Beilei
2017-03-08 15:50 ` [dpdk-dev] [PATCH 0/4] support replace filter function Ferruh Yigit
2017-03-09 5:13 ` Xing, Beilei
2017-03-23 10:46 ` [dpdk-dev] [PATCH v2 0/4] Rework tunnel filter functions Beilei Xing
2017-03-23 10:46 ` [dpdk-dev] [PATCH v2 1/4] net/i40e: rework " Beilei Xing
2017-03-27 9:47 ` Wu, Jingjing
2017-03-27 10:33 ` Xing, Beilei
2017-03-23 10:46 ` [dpdk-dev] [PATCH v2 2/4] net/i40e: change tunnel filter function name Beilei Xing
2017-03-23 10:46 ` [dpdk-dev] [PATCH v2 3/4] net/i40e: support tunnel filter to VF Beilei Xing
2017-03-27 9:54 ` Wu, Jingjing
2017-03-27 10:37 ` Xing, Beilei
2017-03-23 10:46 ` [dpdk-dev] [PATCH v2 4/4] net/i40e: refine consistent tunnel filter Beilei Xing
2017-03-28 3:23 ` [dpdk-dev] [PATCH v3 0/4] Rework tunnel filter functions Beilei Xing
2017-03-28 3:23 ` [dpdk-dev] [PATCH v3 1/4] net/i40e: rework " Beilei Xing
2017-03-28 3:23 ` [dpdk-dev] [PATCH v3 2/4] net/i40e: change tunnel filter function name Beilei Xing
2017-03-28 3:23 ` [dpdk-dev] [PATCH v3 3/4] net/i40e: support tunnel filter to VF Beilei Xing
2017-03-28 3:23 ` [dpdk-dev] [PATCH v3 4/4] net/i40e: refine consistent tunnel filter Beilei Xing
2017-03-28 9:28 ` [dpdk-dev] [PATCH v4 0/4] Rework tunnel filter functions Beilei Xing
2017-03-28 9:28 ` [dpdk-dev] [PATCH v4 1/4] net/i40e: rework " Beilei Xing
2017-03-28 9:28 ` [dpdk-dev] [PATCH v4 2/4] net/i40e: change tunnel filter function name Beilei Xing
2017-03-28 9:28 ` [dpdk-dev] [PATCH v4 3/4] net/i40e: support tunnel filter to VF Beilei Xing
2017-03-28 9:28 ` [dpdk-dev] [PATCH v4 4/4] net/i40e: refine consistent tunnel filter Beilei Xing
2017-03-29 13:23 ` [dpdk-dev] [PATCH v4 0/4] Rework tunnel filter functions Wu, Jingjing
2017-03-30 13:03 ` Ferruh Yigit
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=1488533497-27682-2-git-send-email-beilei.xing@intel.com \
--to=beilei.xing@intel.com \
--cc=bernard.iremonger@intel.com \
--cc=dev@dpdk.org \
--cc=helin.zhang@intel.com \
--cc=jingjing.wu@intel.com \
--cc=laura.stroe@intel.com \
/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).