ixgbe: Add L2 Ethertype, SYN and Five tuple queue filters
v2 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.
V2 changes:
* Fixing various checkpatch.pl errors
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 | 273 ++++++++++++++++++++++++++++++++ 4 files changed, 758 insertions(+)
Signature · 1 line
1.8.3.2
A message that is not in the archive (sent off-list or not yet received): 1401895122-7895-1-git-send-email-medvedkinv-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v2 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 | 103 ++++++++++++++++++++++++++++++++ 4 files changed, 268 insertions(+)
lib/librte_ether/rte_ethdev.c +81 -0
@@ -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 Ð_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
@@ -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 +103 -0
118 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v2 2/3 ixgbe: Add syn queue filter for ixgbe
In reply to a message not in the archiveThis 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
@@ -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
@@ -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
PATCH v2 3/3 ixgbe: Add five tuple filter for ixgbe
In reply to a message not in the archiveThis 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
@@ -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 Ð_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
@@ -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