From: Wei Zhao <wei.zhao1@intel.com>
To: dev@dpdk.org
Cc: wenzhuo.lu@intel.com, Wei Zhao <wei.zhao1@intel.com>
Subject: [PATCH v3 03/11] net/e1000: restore ether type filter
Date: Fri, 9 Jun 2017 11:11:40 +0800 [thread overview]
Message-ID: <1496977908-2149-4-git-send-email-wei.zhao1@intel.com> (raw)
In-Reply-To: <1496977908-2149-1-git-send-email-wei.zhao1@intel.com>
Add support for restoring ether type filter in SW.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
drivers/net/e1000/e1000_ethdev.h | 10 +++++++--
drivers/net/e1000/igb_ethdev.c | 47 ++++++++++++++++++++++++++++++----------
2 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index ac4d55d..0a6ebce 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -237,13 +237,19 @@ struct e1000_2tuple_filter {
uint16_t queue; /* rx queue assigned to */
};
+/* ethertype filter structure */
+struct igb_ethertype_filter {
+ uint16_t ethertype;
+ uint32_t etqf;
+};
+
/*
- * Structure to store filters' info.
+ * Structure to store filters'info.
*/
struct e1000_filter_info {
uint8_t ethertype_mask; /* Bit mask for every used ethertype filter */
/* store used ethertype filters*/
- uint16_t ethertype_filters[E1000_MAX_ETQF_FILTERS];
+ struct igb_ethertype_filter ethertype_filters[E1000_MAX_ETQF_FILTERS];
uint8_t flex_mask; /* Bit mask for every used flex filter */
struct e1000_flex_filter_list flex_list;
/* Bit mask for every used 5tuple filter */
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 45a1660..9d8e4bf 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -991,6 +991,11 @@ eth_igb_dev_uninit(struct rte_eth_dev *eth_dev)
/* clear the SYN filter info */
filter_info->syn_info = 0;
+ /* clear the ethertype filters info */
+ filter_info->ethertype_mask = 0;
+ memset(filter_info->ethertype_filters, 0,
+ E1000_MAX_ETQF_FILTERS * sizeof(struct igb_ethertype_filter));
+
/* remove all ntuple filters of the device */
igb_ntuple_filter_uninit(eth_dev);
@@ -4623,7 +4628,7 @@ igb_ethertype_filter_lookup(struct e1000_filter_info *filter_info,
int i;
for (i = 0; i < E1000_MAX_ETQF_FILTERS; i++) {
- if (filter_info->ethertype_filters[i] == ethertype &&
+ if (filter_info->ethertype_filters[i].ethertype == ethertype &&
(filter_info->ethertype_mask & (1 << i)))
return i;
}
@@ -4632,33 +4637,35 @@ igb_ethertype_filter_lookup(struct e1000_filter_info *filter_info,
static inline int
igb_ethertype_filter_insert(struct e1000_filter_info *filter_info,
- uint16_t ethertype)
+ uint16_t ethertype, uint32_t etqf)
{
int i;
for (i = 0; i < E1000_MAX_ETQF_FILTERS; i++) {
if (!(filter_info->ethertype_mask & (1 << i))) {
filter_info->ethertype_mask |= 1 << i;
- filter_info->ethertype_filters[i] = ethertype;
+ filter_info->ethertype_filters[i].ethertype = ethertype;
+ filter_info->ethertype_filters[i].etqf = etqf;
return i;
}
}
return -1;
}
-static inline int
+static int
igb_ethertype_filter_remove(struct e1000_filter_info *filter_info,
uint8_t idx)
{
if (idx >= E1000_MAX_ETQF_FILTERS)
return -1;
filter_info->ethertype_mask &= ~(1 << idx);
- filter_info->ethertype_filters[idx] = 0;
+ filter_info->ethertype_filters[idx].ethertype = 0;
+ filter_info->ethertype_filters[idx].etqf = 0;
return idx;
}
-static int
+int
igb_add_del_ethertype_filter(struct rte_eth_dev *dev,
struct rte_eth_ethertype_filter *filter,
bool add)
@@ -4698,16 +4705,15 @@ igb_add_del_ethertype_filter(struct rte_eth_dev *dev,
}
if (add) {
+ etqf |= E1000_ETQF_FILTER_ENABLE | E1000_ETQF_QUEUE_ENABLE;
+ etqf |= (uint32_t)(filter->ether_type & E1000_ETQF_ETHERTYPE);
+ etqf |= filter->queue << E1000_ETQF_QUEUE_SHIFT;
ret = igb_ethertype_filter_insert(filter_info,
- filter->ether_type);
+ filter->ether_type, etqf);
if (ret < 0) {
PMD_DRV_LOG(ERR, "ethertype filters are full.");
return -ENOSYS;
}
-
- etqf |= E1000_ETQF_FILTER_ENABLE | E1000_ETQF_QUEUE_ENABLE;
- etqf |= (uint32_t)(filter->ether_type & E1000_ETQF_ETHERTYPE);
- etqf |= filter->queue << E1000_ETQF_QUEUE_SHIFT;
} else {
ret = igb_ethertype_filter_remove(filter_info, (uint8_t)ret);
if (ret < 0)
@@ -5504,11 +5510,30 @@ igb_syn_filter_restore(struct rte_eth_dev *dev)
}
}
+/* restore ethernet type filter */
+static inline void
+igb_ethertype_filter_restore(struct rte_eth_dev *dev)
+{
+ struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct e1000_filter_info *filter_info =
+ E1000_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
+ int i;
+
+ for (i = 0; i < E1000_MAX_ETQF_FILTERS; i++) {
+ if (filter_info->ethertype_mask & (1 << i)) {
+ E1000_WRITE_REG(hw, E1000_ETQF(i),
+ filter_info->ethertype_filters[i].etqf);
+ E1000_WRITE_FLUSH(hw);
+ }
+ }
+}
+
/* restore all types filter */
static int
igb_filter_restore(struct rte_eth_dev *dev)
{
igb_ntuple_filter_restore(dev);
+ igb_ethertype_filter_restore(dev);
igb_syn_filter_restore(dev);
return 0;
--
2.9.3
next prev parent reply other threads:[~2017-06-09 3:21 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 7:12 [PATCH 00/11] net/e1000: Consistent filter API Wei Zhao
2017-05-23 7:12 ` [PATCH 01/11] net/e1000: store and restore TCP SYN filter Wei Zhao
2017-05-23 7:12 ` [PATCH 02/11] net/e1000: restore n-tuple filter Wei Zhao
2017-05-23 7:12 ` [PATCH 03/11] net/e1000: restore ether type filter Wei Zhao
2017-05-23 7:12 ` [PATCH 04/11] net/e1000: restore flex " Wei Zhao
2017-05-23 7:12 ` [PATCH 05/11] net/e1000: parse n-tuple filter Wei Zhao
2017-05-23 7:12 ` [PATCH 06/11] net/e1000: parse ethertype filter Wei Zhao
2017-05-23 7:12 ` [PATCH 07/11] net/e1000: parse TCP SYN filter Wei Zhao
2017-05-23 7:12 ` [PATCH 08/11] net/e1000: parse flex filter Wei Zhao
2017-05-23 7:12 ` [PATCH 09/11] net/e1000: create consistent filter Wei Zhao
2017-05-23 7:13 ` [PATCH 10/11] net/e1000: destroy " Wei Zhao
2017-05-23 7:13 ` [PATCH 11/11] net/e1000: flush all the filter Wei Zhao
2017-05-29 11:01 ` [PATCH 00/11] net/e1000: Consistent filter API Ferruh Yigit
2017-05-31 3:17 ` Zhao1, Wei
2017-06-02 6:36 ` Wei Zhao
2017-06-02 6:36 ` [PATCH v2 01/11] net/e1000: store and restore TCP SYN filter Wei Zhao
2017-06-02 7:51 ` Lu, Wenzhuo
2017-06-02 6:36 ` [PATCH v2 02/11] net/e1000: restore n-tuple filter Wei Zhao
2017-06-02 7:56 ` Lu, Wenzhuo
2017-06-02 8:00 ` Zhao1, Wei
2017-06-02 6:36 ` [PATCH v2 03/11] net/e1000: restore ether type filter Wei Zhao
2017-06-02 8:08 ` Lu, Wenzhuo
2017-06-02 6:36 ` [PATCH v2 04/11] net/e1000: restore flex " Wei Zhao
2017-06-02 8:17 ` Lu, Wenzhuo
2017-06-02 6:36 ` [PATCH v2 05/11] net/e1000: parse n-tuple filter Wei Zhao
2017-06-05 1:21 ` Lu, Wenzhuo
2017-06-05 1:55 ` Zhao1, Wei
2017-06-05 2:36 ` Lu, Wenzhuo
2017-06-05 2:39 ` Zhao1, Wei
2017-06-02 6:36 ` [PATCH v2 06/11] net/e1000: parse ethertype filter Wei Zhao
2017-06-05 3:13 ` Lu, Wenzhuo
2017-06-05 3:26 ` Zhao1, Wei
2017-06-02 6:36 ` [PATCH v2 07/11] net/e1000: parse TCP SYN filter Wei Zhao
2017-06-05 3:16 ` Lu, Wenzhuo
2017-06-02 6:36 ` [PATCH v2 08/11] net/e1000: parse flex filter Wei Zhao
2017-06-05 3:38 ` Lu, Wenzhuo
2017-06-05 3:41 ` Zhao1, Wei
2017-06-02 6:36 ` [PATCH v2 09/11] net/e1000: create consistent filter Wei Zhao
2017-06-05 5:14 ` Lu, Wenzhuo
2017-06-02 6:36 ` [PATCH v2 10/11] net/e1000: destroy " Wei Zhao
2017-06-05 5:41 ` Lu, Wenzhuo
2017-06-05 6:00 ` Zhao1, Wei
2017-06-05 6:08 ` Lu, Wenzhuo
2017-06-02 6:36 ` [PATCH v2 11/11] net/e1000: flush all the filter Wei Zhao
2017-06-05 6:09 ` Lu, Wenzhuo
2017-06-09 3:11 ` [PATCH 00/11] net/e1000: Consistent filter API Wei Zhao
2017-06-09 3:11 ` [PATCH v3 01/11] net/e1000: store and restore TCP SYN filter Wei Zhao
2017-06-09 3:11 ` [PATCH v3 02/11] net/e1000: restore n-tuple filter Wei Zhao
2017-06-09 3:11 ` Wei Zhao [this message]
2017-06-09 3:11 ` [PATCH v3 04/11] net/e1000: restore flex type filter Wei Zhao
2017-06-09 3:11 ` [PATCH v3 05/11] net/e1000: parse n-tuple filter Wei Zhao
2017-06-09 12:29 ` Ferruh Yigit
2017-06-12 7:47 ` Zhao1, Wei
2017-06-09 3:11 ` [PATCH v3 06/11] net/e1000: parse ethertype filter Wei Zhao
2017-06-09 3:11 ` [PATCH v3 07/11] net/e1000: parse TCP SYN filter Wei Zhao
2017-06-09 3:11 ` [PATCH v3 08/11] net/e1000: parse flex filter Wei Zhao
2017-06-09 12:23 ` Ferruh Yigit
2017-06-12 3:25 ` Zhao1, Wei
2017-06-09 3:11 ` [PATCH v3 09/11] net/e1000: create consistent filter Wei Zhao
2017-06-09 3:11 ` [PATCH v3 10/11] net/e1000: destroy " Wei Zhao
2017-06-09 3:11 ` [PATCH v3 11/11] net/e1000: flush all the filter Wei Zhao
2017-06-12 6:30 ` [PATCH 00/11] net/e1000: Consistent filter API Wei Zhao
2017-06-12 6:30 ` [PATCH v4] net/e1000: parse n-tuple filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 01/11] net/e1000: store and restore TCP SYN filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 02/11] net/e1000: restore n-tuple filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 03/11] net/e1000: restore ether type filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 04/11] net/e1000: restore flex " Wei Zhao
2017-06-12 6:30 ` [PATCH v4 05/11] net/e1000: parse n-tuple filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 06/11] net/e1000: parse ethertype filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 07/11] net/e1000: parse TCP SYN filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 08/11] net/e1000: parse flex filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 09/11] net/e1000: create consistent filter Wei Zhao
2017-06-12 6:30 ` [PATCH v4 10/11] net/e1000: destroy " Wei Zhao
2017-06-12 6:30 ` [PATCH v4 11/11] net/e1000: flush all the filter Wei Zhao
2017-06-12 6:48 ` [PATCH 00/11] net/e1000: Consistent filter API Wei Zhao
2017-06-12 6:48 ` [PATCH v5 01/11] net/e1000: store and restore TCP SYN filter Wei Zhao
2017-06-12 10:45 ` Ferruh Yigit
2017-06-14 8:59 ` Zhao1, Wei
2017-06-12 6:48 ` [PATCH v5 02/11] net/e1000: restore n-tuple filter Wei Zhao
2017-06-12 6:48 ` [PATCH v5 03/11] net/e1000: restore ether type filter Wei Zhao
2017-06-12 6:48 ` [PATCH v5 04/11] net/e1000: restore flex " Wei Zhao
2017-06-12 6:48 ` [PATCH v5 05/11] net/e1000: parse n-tuple filter Wei Zhao
2017-06-12 6:48 ` [PATCH v5 06/11] net/e1000: parse ethertype filter Wei Zhao
2017-06-12 6:48 ` [PATCH v5 07/11] net/e1000: parse TCP SYN filter Wei Zhao
2017-06-12 6:48 ` [PATCH v5 08/11] net/e1000: parse flex filter Wei Zhao
2017-06-12 6:48 ` [PATCH v5 09/11] net/e1000: create consistent filter Wei Zhao
2017-06-12 6:48 ` [PATCH v5 10/11] net/e1000: destroy " Wei Zhao
2017-06-12 6:48 ` [PATCH v5 11/11] net/e1000: flush all the filter Wei Zhao
2017-06-12 10:47 ` [PATCH 00/11] net/e1000: Consistent filter API 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=1496977908-2149-4-git-send-email-wei.zhao1@intel.com \
--to=wei.zhao1@intel.com \
--cc=dev@dpdk.org \
--cc=wenzhuo.lu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.