Skip to contentSkip to conversation

ixgbe: Add L2 Ethertype, SYN and Five tuple queue filters

PATCH Superseded Vladimir Medvedkin 2 participants 6 messages May 19, 2014 – Jun 4, 2014 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ixgbe: Add L2 Ethertype, SYN and Five tuple queue filters

This patchset adds in addition to the Flow Director filters L2 Ethertype, SYN and Five tuple queue filters to route packets according to ethertype, l4 proto, source/destination ip/ports pool and presence of SYN flag in TCP packet. Unlike http://dpdk.org/ml/archives/dev/2014-May/002512.html this gives capability to work with pools. This patch functionality can be merged with the patch above.

Vladimir Medvedkin (3):
ixgbe: Add L2 ethertype filter for ixgbe
ixgbe: Add syn queue filter for ixgbe
ixgbe: Add five tuple filter for ixgbe

 lib/librte_ether/rte_ethdev.c           | 228 ++++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h           | 237 +++++++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |  20 +++
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c     | 274 ++++++++++++++++++++++++++++++++
 4 files changed, 759 insertions(+)
Signature · 1 line
1.8.3.2

A message that is not in the archive (sent off-list or not yet received): 1400543506-24717-1-git-send-email-medvedkinv-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/3 ixgbe: Add L2 ethertype filter for ixgbe

This patch adds ability to route packets according to ethertype, priority and pool to certain queue specified in rx_queue field.

---
 lib/librte_ether/rte_ethdev.c           |  81 +++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h           |  78 ++++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |   6 ++
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c     | 104 ++++++++++++++++++++++++++++++++
 4 files changed, 269 insertions(+)
lib/librte_ether/rte_ethdev.c +81 -0
index a5727dd..5cd0148 100644
@@ -1194,6 +1194,87 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id)
 	return ret;
 }
 
+int
+rte_eth_dev_l2_etype_add_filter(uint8_t port_id, uint8_t filter_id, struct rte_eth_l2etype_filter *filter)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info info;
+
+	rte_eth_dev_info_get(port_id, &info);
+
+	if (port_id >= nb_ports) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return (-ENODEV);
+	}
+
+	dev = &rte_eth_devices[port_id];
+
+        if (filter == NULL) {
+                PMD_DEBUG_TRACE("Invalid filter pointer\n");
+                return (-EINVAL);
+        }
+
+        if(filter->rx_queue >= info.max_rx_queues) {
+                PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", filter->rx_queue);
+                return (-EINVAL);
+        }
+
+	if (filter->etype == ETHER_TYPE_IPv4 || filter->etype == ETHER_TYPE_IPv6){
+		PMD_DEBUG_TRACE("IP and IPv6 are not supported in ethertype filter\n");
+		return (-EINVAL);
+	}
+
+        if(filter->flags & ETH_L2ETYPE_POOL_EN) {
+                if(dev->data->dev_conf.rxmode.mq_mode < ETH_MQ_RX_VMDQ_ONLY) {
+                        PMD_DEBUG_TRACE("Port %d is in non-VT mode\n", port_id);
+                        return (-EINVAL);
+                }
+                if(filter->pool >= dev->data->dev_conf.rx_adv_conf.vmdq_rx_conf.nb_queue_pools) {
+                        PMD_DEBUG_TRACE("Invalid pool number %d\n", filter->pool);
+                        return (-EINVAL);
+                }
+        }
+
+        FUNC_PTR_OR_ERR_RET(*dev->dev_ops->l2_etype_add_filter, -ENOTSUP);
+        return (*dev->dev_ops->l2_etype_add_filter)(dev, filter_id, filter);
+}
+
+int
+rte_eth_dev_l2_etype_get_filter(uint8_t port_id, uint8_t filter_id, struct rte_eth_l2etype_filter *filter)
+{
+	struct rte_eth_dev *dev;
+
+	if (port_id >= nb_ports) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return (-ENODEV);
+	}
+
+	dev = &rte_eth_devices[port_id];
+
+	if (filter == NULL) {
+		PMD_DEBUG_TRACE("Invalid filter pointer\n");
+		return (-EINVAL);
+	}
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->l2_etype_add_filter, -ENOTSUP);
+	return (*dev->dev_ops->l2_etype_get_filter)(dev, filter_id, filter);
+}
+
+int
+rte_eth_dev_l2_etype_del_filter(uint8_t port_id, uint8_t filter_id)
+{
+        struct rte_eth_dev *dev;
+
+        if (port_id >= nb_ports) {
+                PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+                return (-ENODEV);
+        }
+
+        dev = &rte_eth_devices[port_id];
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->l2_etype_add_filter, -ENOTSUP);
+	return (*dev->dev_ops->l2_etype_del_filter)(dev, filter_id);
+}
 
 int
 rte_eth_dev_fdir_add_signature_filter(uint8_t port_id,
lib/librte_ether/rte_ethdev.h +78 -0

108 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h +6 -0
index f03046f..28653d5 100644
@@ -1537,6 +1537,12 @@ enum {
 #define IXGBE_ETQF_FILTER_EN		0x80000000 /* bit 31 */
 #define IXGBE_ETQF_POOL_ENABLE		(1 << 26) /* bit 26 */
 #define IXGBE_ETQF_POOL_SHIFT		20
+#define IXGBE_ETQF_POOL_MASK            0x03F00000 /* bits 25:20 */
+#define IXGBE_ETQF_UP_ENABLE            (1 << 19) /* bit 19 */
+#define IXGBE_ETQF_UP_SHIFT             16
+#define IXGBE_ETQF_UP_MASK              0x00070000 /* bits 18:16 */
+#define IXGBE_ETQF_UP_NUMBER		8
+#define IXGBE_ETQF_ETYPE                0x0000FFFF /* bits 15:0 */
 
 #define IXGBE_ETQS_RX_QUEUE		0x007F0000 /* bits 22:16 */
 #define IXGBE_ETQS_RX_QUEUE_SHIFT	16
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +104 -0

119 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 2/3 ixgbe: Add syn queue filter for ixgbe

In reply to a message not in the archive

This patch adds ability to route TCP packets according to SYN flag presence to certain queue.

---
 lib/librte_ether/rte_ethdev.c           | 66 +++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h           | 63 +++++++++++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |  6 +++
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c     | 57 +++++++++++++++++++++++++++-
 4 files changed, 191 insertions(+), 1 deletion(-)
lib/librte_ether/rte_ethdev.c +66 -0
index 5cd0148..4597176 100644
@@ -1195,6 +1195,72 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id)
 }
 
 int
+rte_eth_dev_synq_add_filter(uint8_t port_id, struct rte_eth_synq_filter *filter)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info info;
+
+	rte_eth_dev_info_get(port_id, &info);
+
+	if (port_id >= nb_ports) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return (-ENODEV);
+	}
+
+	dev = &rte_eth_devices[port_id];
+
+	if (filter == NULL) {
+		PMD_DEBUG_TRACE("Invalid filter pointer\n");
+		return (-EINVAL);
+	}
+
+	if(filter->rx_queue >= info.max_rx_queues) {
+		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", filter->rx_queue);
+		return (-EINVAL);
+	}
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->synq_add_filter, -ENOTSUP);
+	return (*dev->dev_ops->synq_add_filter)(dev, filter);
+}
+
+int
+rte_eth_dev_synq_get_filter(uint8_t port_id, struct rte_eth_synq_filter *filter)
+{
+	struct rte_eth_dev *dev;
+
+	if (port_id >= nb_ports) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return (-ENODEV);
+	}
+
+	dev = &rte_eth_devices[port_id];
+
+	if (filter == NULL) {
+		PMD_DEBUG_TRACE("Invalid filter pointer\n");
+		return (-EINVAL);
+	}
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->synq_add_filter, -ENOTSUP);
+	return (*dev->dev_ops->synq_get_filter)(dev, filter);
+}
+
+int
+rte_eth_dev_synq_del_filter(uint8_t port_id)
+{
+	struct rte_eth_dev *dev;
+
+	if (port_id >= nb_ports) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return (-ENODEV);
+	}
+
+	dev = &rte_eth_devices[port_id];
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->synq_add_filter, -ENOTSUP);
+	return (*dev->dev_ops->synq_del_filter)(dev);
+}
+
+int
 rte_eth_dev_l2_etype_add_filter(uint8_t port_id, uint8_t filter_id, struct rte_eth_l2etype_filter *filter)
 {
 	struct rte_eth_dev *dev;
lib/librte_ether/rte_ethdev.h +63 -0

87 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h +6 -0
index 28653d5..8f911ff 100644
@@ -1529,6 +1529,12 @@ enum {
 
 #define IXGBE_IVAR_ALLOC_VAL		0x80 /* Interrupt Allocation valid */
 
+/* SYN Packet Queue Filter */
+#define IXGBE_SYNQF_EN			0x00000001
+#define IXGBE_SYNQF_RX_QUEUE		0x000000FE
+#define IXGBE_SYNQF_SHIFT		1
+#define IXGBE_SYNQF_SYN_FIRST		(1 << 31) /* bit 31 */
+
 /* ETYPE Queue Filter/Select Bit Masks */
 #define IXGBE_MAX_ETQF_FILTERS		8
 #define IXGBE_ETQF_FCOE			0x08000000 /* bit 27 */
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +56 -1

75 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#4 lore raw

PATCH 3/3 ixgbe: Add five tuple filter for ixgbe

In reply to a message not in the archive

This patch adds ability to route packets according to source, destination ip/ports, L4 proto and pool to certain queue.

---
 lib/librte_ether/rte_ethdev.c           |  81 ++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h           |  96 ++++++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |   8 +++
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c     | 115 ++++++++++++++++++++++++++++++++
 4 files changed, 300 insertions(+)
lib/librte_ether/rte_ethdev.c +81 -0
index 4597176..6cf838b 100644
@@ -1195,6 +1195,87 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id)
 }
 
 int
+rte_eth_dev_5tuple_add_filter(uint8_t port_id, uint8_t filter_id, struct rte_eth_5tuple_filter *filter)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info info;
+
+	rte_eth_dev_info_get(port_id, &info);
+
+	if (port_id >= nb_ports) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return (-ENODEV);
+	}
+
+	dev = &rte_eth_devices[port_id];
+
+	if (filter == NULL) {
+		PMD_DEBUG_TRACE("Invalid filter pointer\n");
+		return (-EINVAL);
+	}
+
+	if(filter->rx_queue >= info.max_rx_queues) {
+		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", filter->rx_queue);
+		return (-EINVAL);
+	}
+
+	if ((filter->proto == RTE_5TUPLE_PROTO_OTHER) && (filter->mask & (ETH_5TUPLE_MASK_SRCPORT|ETH_5TUPLE_MASK_DSTPORT))) {
+		PMD_DEBUG_TRACE(" L4 protocol not TCP, UDP or SCTP, ports are meaningless /n");
+		return(-EINVAL);
+	}
+
+	if (filter->mask & ETH_5TUPLE_MASK_POOL) {
+		if(dev->data->dev_conf.rxmode.mq_mode < ETH_MQ_RX_VMDQ_ONLY) {
+			PMD_DEBUG_TRACE("Port %d is in non-VT mode\n", port_id);
+			return (-EINVAL);
+		}
+		if(filter->pool >= dev->data->dev_conf.rx_adv_conf.vmdq_rx_conf.nb_queue_pools) {
+			PMD_DEBUG_TRACE("Invalid pool number %d\n", filter->pool);
+			return (-EINVAL);
+		}
+	}
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->add_5tuple_filter, -ENOTSUP);
+	return (*dev->dev_ops->add_5tuple_filter)(dev, filter_id, filter);
+}
+
+int
+rte_eth_dev_5tuple_get_filter(uint8_t port_id, uint8_t filter_id, struct rte_eth_5tuple_filter *filter)
+{
+        struct rte_eth_dev *dev;
+
+        if (port_id >= nb_ports) {
+                PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+                return (-ENODEV);
+        }
+
+        dev = &rte_eth_devices[port_id];
+
+        if (filter == NULL) {
+                PMD_DEBUG_TRACE("Invalid filter pointer\n");
+                return (-EINVAL);
+        }
+
+        FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_5tuple_filter, -ENOTSUP);
+        return (*dev->dev_ops->get_5tuple_filter)(dev, filter_id, filter);
+}
+
+int
+rte_eth_dev_5tuple_del_filter(uint8_t port_id, uint8_t filter_id)
+{
+	struct rte_eth_dev *dev;
+
+	if (port_id >= nb_ports) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return (-ENODEV);
+	}
+
+	dev = &rte_eth_devices[port_id];
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->del_5tuple_filter, -ENOTSUP);
+	return (*dev->dev_ops->del_5tuple_filter)(dev, filter_id);
+}
+int
 rte_eth_dev_synq_add_filter(uint8_t port_id, struct rte_eth_synq_filter *filter)
 {
 	struct rte_eth_dev *dev;
lib/librte_ether/rte_ethdev.h +96 -0

126 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h +8 -0
index 8f911ff..b4b3644 100644
@@ -1509,6 +1509,14 @@ enum {
 #define IXGBE_FTQF_PROTOCOL_COMP_MASK	0x0F
 #define IXGBE_FTQF_POOL_MASK_EN		0x40000000
 #define IXGBE_FTQF_QUEUE_ENABLE		0x80000000
+#define IXGBE_FTQF_MAX_PRIORITY		7
+
+#define IXGBE_SDQPF_PORT_MASK		0x0000ffff
+#define IXGBE_SDQPF_DSTPORT_SHIFT	16
+
+#define IXGBE_L34TIMIR_RESERVE		0x00080000
+#define IXGBE_L34TIMIR_QUEUE_MASK	0x7f
+#define IXGBE_L34TIMIR_QUEUE_SHIFT	21
 
 /* Interrupt clear mask */
 #define IXGBE_IRQ_CLEAR_MASK	0xFFFFFFFF
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +115 -0

133 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#5 lore raw
In reply to a message not in the archive

Hi Vladimir,

Seems like hardware filtering becomes useful these days :)

2014-05-19 19:51, Vladimir Medvedkin:

Quoted 6 lines

This patchset adds in addition to the Flow Director filters L2 Ethertype, SYN and Five tuple queue filters to route packets according to ethertype, l4 proto, source/destination ip/ports pool and presence of SYN flag in TCP packet. Unlike http://dpdk.org/ml/archives/dev/2014-May/002512.html this gives capability to work with pools. This patch functionality can be merged with the patch above.

2 comments:

1) Do you have a good confidence that this new API is generic enough to be used by other NICs than ixgbe?

2) Could you try to check your patches with the kernel script checkpatch.pl, please?

Thanks

Signature · 1 line
Thomas
#6 lore raw

Hi Thomas,

Sorry for late reply, I'm on vacation now.

1. I'm not shure about other NICs but Intel. API for Intel NICs is generic enough, even more generic than Jingjing's API because of pool logic. Besides I think it's more properly make rx_queue as part of filter struct for Jingjing's etype and 5-tuple filters implementation.

2. I'll try to send checked patch today.

Regards,
Vladimir.

2014-05-28 3:09 GMT+04:00 Thomas Monjalon <[email protected]>:

Quoted 27 lines

Hi Vladimir,

Seems like hardware filtering becomes useful these days :)

2014-05-19 19:51, Vladimir Medvedkin:

Quoted 3 lines

This patchset adds in addition to the Flow Director filters L2 Ethertype, SYN and Five tuple queue filters to route packets according to ethertype, l4 proto, source/destination ip/ports pool and presence of SYN flag in

TCP

Quoted 2 lines

packet. Unlike http://dpdk.org/ml/archives/dev/2014-May/002512.html this gives capability to work with pools. This patch functionality can be

merged

Quoted 1 line

with the patch above.

2 comments:

1) Do you have a good confidence that this new API is generic enough to be used by other NICs than ixgbe?

2) Could you try to check your patches with the kernel script checkpatch.pl,
please?

Thanks
--
Thomas