From: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v5 9/9] igc: Add support for XDP_REDIRECT action
Date: Wed, 10 Feb 2021 01:47:25 +0000 [thread overview]
Message-ID: <8c6e414e03c2bdd01916ee63f6912df3b24e86fa.camel@intel.com> (raw)
In-Reply-To: <20210209024141.23298-10-vedang.patel@intel.com>
On Mon, 2021-02-08 at 18:41 -0800, Vedang Patel wrote:
> From: Andre Guedes <andre.guedes@intel.com>
>
> This patch adds support for the XDP_REDIRECT action which enables XDP
> programs to redirect packets arriving at I225 NIC. It also implements
> the ndo_xdp_xmit ops, enabling the igc driver to transmit packets
> forwarded to it by xdp programs running on other interfaces.
>
> The patch tweaks the driver's page counting scheme (as described in
> '8ce29c679a6e i40e: tweak page counting for XDP_REDIRECT' and
> implemented by other Intel drivers) in order to properly support
> XDP_REDIRECT action.
>
> This patch has been tested with the sample apps "xdp_redirect_cpu"
> and
> "xdp_redirect_map" located in samples/bpf/.
>
> Signed-off-by: Andre Guedes <andre.guedes@intel.com>
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Signed-off-by: Vedang Patel <vedang.patel@intel.com>
> ---
> drivers/net/ethernet/intel/igc/igc_main.c | 59
> +++++++++++++++++++++--
> 1 file changed, 56 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c
> b/drivers/net/ethernet/intel/igc/igc_main.c
> index d34d35789e2e..8bb1f8a54368 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -26,6 +26,7 @@
> #define IGC_XDP_PASS 0
> #define IGC_XDP_CONSUMED BIT(0)
> #define IGC_XDP_TX BIT(1)
> +#define IGC_XDP_REDIRECT BIT(2)
>
> static int debug = -1;
>
> @@ -1708,8 +1709,8 @@ static bool igc_can_reuse_rx_page(struct
> igc_rx_buffer *rx_buffer)
> * the pagecnt_bias and page count so that we fully restock the
> * number of references the driver holds.
> */
> - if (unlikely(!pagecnt_bias)) {
> - page_ref_add(page, USHRT_MAX);
> + if (unlikely(pagecnt_bias == 1)) {
> + page_ref_add(page, USHRT_MAX - 1);
> rx_buffer->pagecnt_bias = USHRT_MAX;
> }
All of our drivers have needed this fix[1]. I suspect this will need it
as well.
[1]https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-
next.git/commit/?id=75aab4e10ae6a4593a60f66d13de755d4e91f400
next prev parent reply other threads:[~2021-02-10 1:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-09 2:41 [Intel-wired-lan] [PATCH net-next v5 0/9] igc: Add XDP support Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 1/9] igc: Fix igc_ptp_rx_pktstamp() Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 2/9] igc: Remove unused argument from igc_tx_cmd_type() Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 3/9] igc: Introduce igc_rx_buffer_flip() helper Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 4/9] igc: Introduce igc_get_rx_frame_truesize() helper Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 5/9] igc: Refactor Rx timestamp handling Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 6/9] igc: Add set/clear large buffer helpers Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 7/9] igc: Add initial XDP support Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 8/9] igc: Add support for XDP_TX action Vedang Patel
2021-02-09 2:41 ` [Intel-wired-lan] [PATCH net-next v5 9/9] igc: Add support for XDP_REDIRECT action Vedang Patel
2021-02-10 1:47 ` Nguyen, Anthony L [this message]
2021-02-10 17:50 ` Patel, Vedang
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=8c6e414e03c2bdd01916ee63f6912df3b24e86fa.camel@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@osuosl.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox