Skip to content

Commit

Permalink
net/sfc: support flow API filters
Browse files Browse the repository at this point in the history
Only pattern items VOID, ETH and actions VOID, QUEUE is now
supported.

Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
  • Loading branch information
ol-romanzh authored and Ferruh Yigit committed Apr 4, 2017
1 parent 791f57a commit a9825cc
Show file tree
Hide file tree
Showing 9 changed files with 823 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/guides/nics/features/sfc_efx.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RSS hash = Y
RSS key update = Y
RSS reta update = Y
Flow control = Y
Flow API = Y
VLAN offload = P
L3 checksum offload = Y
L4 checksum offload = Y
Expand Down
24 changes: 24 additions & 0 deletions doc/guides/nics/sfc_efx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ SFC EFX PMD has support for:

- Transmit VLAN insertion (if running firmware variant supports it)

- Flow API


Non-supported Features
----------------------
Expand Down Expand Up @@ -114,6 +116,28 @@ required in the receive buffer.
It should be taken into account when mbuf pool for receive is created.


Flow API support
----------------

Supported attributes:

- Ingress

Supported pattern items:

- VOID

- ETH (exact match of source/destination addresses, EtherType)

Supported actions:

- VOID

- QUEUE

Validating flow rules depends on the firmware variant.


Supported NICs
--------------

Expand Down
5 changes: 5 additions & 0 deletions doc/guides/rel_notes/release_17_05.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ New Features
Added support for Hardware TSO for tunneled and non-tunneled packets.
Tunneling protocols supported are GRE and VXLAN.

* **Updated the sfc_efx driver.**

* Generic flow API support for Ethernet, VLAN, IPv4, IPv6, UDP and TCP
pattern items with QUEUE action for ingress traffic.

* **Added vmxnet3 version 3 support.**

Added support for vmxnet3 version 3 which includes several
Expand Down
1 change: 1 addition & 0 deletions drivers/net/sfc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_rx.c
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_tx.c
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_tso.c
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_filter.c
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_flow.c

VPATH += $(SRCDIR)/base

Expand Down
11 changes: 11 additions & 0 deletions drivers/net/sfc/sfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,17 @@ sfc_start(struct sfc_adapter *sa)
if (rc != 0)
goto fail_tx_start;

rc = sfc_flow_start(sa);
if (rc != 0)
goto fail_flows_insert;

sa->state = SFC_ADAPTER_STARTED;
sfc_log_init(sa, "done");
return 0;

fail_flows_insert:
sfc_tx_stop(sa);

fail_tx_start:
sfc_rx_stop(sa);

Expand Down Expand Up @@ -368,6 +375,7 @@ sfc_stop(struct sfc_adapter *sa)

sa->state = SFC_ADAPTER_STOPPING;

sfc_flow_stop(sa);
sfc_tx_stop(sa);
sfc_rx_stop(sa);
sfc_port_stop(sa);
Expand Down Expand Up @@ -640,6 +648,8 @@ sfc_attach(struct sfc_adapter *sa)
sfc_log_init(sa, "fini nic");
efx_nic_fini(enp);

sfc_flow_init(sa);

sa->state = SFC_ADAPTER_INITIALIZED;

sfc_log_init(sa, "done");
Expand Down Expand Up @@ -698,5 +708,6 @@ sfc_detach(struct sfc_adapter *sa)

sfc_mem_bar_fini(sa);

sfc_flow_fini(sa);
sa->state = SFC_ADAPTER_UNINITIALIZED;
}
14 changes: 11 additions & 3 deletions drivers/net/sfc/sfc_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "sfc_ev.h"
#include "sfc_rx.h"
#include "sfc_tx.h"

#include "sfc_flow.h"

static void
sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
Expand Down Expand Up @@ -1210,8 +1210,8 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev,

static int
sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
__rte_unused enum rte_filter_op filter_op,
__rte_unused void *arg)
enum rte_filter_op filter_op,
void *arg)
{
struct sfc_adapter *sa = dev->data->dev_private;
int rc = ENOTSUP;
Expand Down Expand Up @@ -1246,6 +1246,14 @@ sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
case RTE_ETH_FILTER_HASH:
sfc_err(sa, "Hash filters not supported");
break;
case RTE_ETH_FILTER_GENERIC:
if (filter_op != RTE_ETH_FILTER_GET) {
rc = EINVAL;
} else {
*(const void **)arg = &sfc_flow_ops;
rc = 0;
}
break;
default:
sfc_err(sa, "Unknown filter type %u", filter_type);
break;
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/sfc/sfc_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

#include "efx.h"

#include "sfc_flow.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -41,6 +43,8 @@ struct sfc_filter {
size_t supported_match_num;
/** Driver cache of supported filter match masks */
uint32_t *supported_match;
/** List of flow rules */
struct sfc_flow_list flow_list;
};

struct sfc_adapter;
Expand Down
Loading

0 comments on commit a9825cc

Please sign in to comment.