Skip to content

Commit

Permalink
ON-13897: AF_XDP: add module option to allow disabling use of flow fi…
Browse files Browse the repository at this point in the history
…lters

Change-Id: Icc8e68dfdd621cf21b0f3aa7c15f888a83698395
  • Loading branch information
maciejj-xilinx committed Feb 28, 2022
1 parent 06fa408 commit b8ba4e2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/efhw/af_xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
#include "ethtool_rxclass.h"
#include "ethtool_flow.h"


int enable_af_xdp_flow_filters = 1;
module_param(enable_af_xdp_flow_filters, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(enable_af_xdp_flow_filters,
"Enables flow filter use for AF_XDP devices ");
/* filter id when no actual filter is installed */
#define AF_XDP_NO_FILTER_MAGIC_ID 0x7FFFFF00

/* sys_call_area: a process-mapped area which can be used to perform
* system calls from a module.
*
Expand Down Expand Up @@ -1443,6 +1451,8 @@ af_xdp_filter_insert(struct efhw_nic *nic, struct efx_filter_spec *spec,
const struct ethtool_ops *ops;
struct cmd_context ctx;

if (!enable_af_xdp_flow_filters)
return AF_XDP_NO_FILTER_MAGIC_ID; /* pretend a filter is installed */
memset(&info, 0, sizeof(info));
info.cmd = ETHTOOL_SRXCLSRLINS;
rc = af_xdp_efx_spec_to_ethtool_flow(spec, &info.fs);
Expand Down Expand Up @@ -1478,6 +1488,9 @@ af_xdp_filter_remove(struct efhw_nic *nic, int filter_id)
struct ethtool_rxnfc info;
const struct ethtool_ops *ops;

if (filter_id == AF_XDP_NO_FILTER_MAGIC_ID)
return;

memset(&info, 0, sizeof(info));
info.cmd = ETHTOOL_SRXCLSRLDEL;
info.fs.location = filter_id;
Expand Down

0 comments on commit b8ba4e2

Please sign in to comment.