All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 2/2] i40e: add support for XDP_REDIRECT
Date: Thu, 22 Mar 2018 12:58:11 +0100	[thread overview]
Message-ID: <20180322125811.0dcc1b28@redhat.com> (raw)
In-Reply-To: <20180322090307.14409-2-bjorn.topel@gmail.com>


On Thu, 22 Mar 2018 10:03:07 +0100 Bj?rn T?pel <bjorn.topel@gmail.com> wrote:

> +/**
> + * i40e_xdp_xmit - Implements ndo_xdp_xmit
> + * @dev: netdev
> + * @xdp: XDP buffer
> + *
> + * Returns Zero if sent, else an error code
> + **/
> +int i40e_xdp_xmit(struct net_device *dev, struct xdp_buff *xdp)
> +{

The return code is used by the XDP redirect tracepoint... this is the
only way we have to debug/troubleshoot runtime issues with XDP. Thus,
these need to be consistent across drives and distinguishable.

> +	struct i40e_netdev_priv *np = netdev_priv(dev);
> +	unsigned int queue_index = smp_processor_id();
> +	struct i40e_vsi *vsi = np->vsi;
> +	int err;
> +
> +	if (test_bit(__I40E_VSI_DOWN, vsi->state))
> +		return -EINVAL;

Should be: -ENETDOWN

> +
> +	if (!i40e_enabled_xdp_vsi(vsi) || queue_index >= vsi->num_queue_pairs)
> +		return -EINVAL;

Should be: -ENXIO

> +	err = i40e_xmit_xdp_ring(xdp, vsi->xdp_rings[queue_index]);
> +	if (err != I40E_XDP_TX)
> +		return -ENOMEM;

Should be: -ENOSPC

The ENOSPC return code is important, as this can be used as a feedback
to a XDP_REDIRECT load-balancer facility.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

WARNING: multiple messages have this Message-ID (diff)
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: "Björn Töpel" <bjorn.topel@gmail.com>
Cc: brouer@redhat.com, jeffrey.t.kirsher@intel.com,
	intel-wired-lan@lists.osuosl.org,
	"Björn Töpel" <bjorn.topel@intel.com>,
	magnus.karlsson@intel.com, netdev@vger.kernel.org,
	alexander.h.duyck@intel.com, alexander.duyck@gmail.com
Subject: Re: [PATCH v2 2/2] i40e: add support for XDP_REDIRECT
Date: Thu, 22 Mar 2018 12:58:11 +0100	[thread overview]
Message-ID: <20180322125811.0dcc1b28@redhat.com> (raw)
In-Reply-To: <20180322090307.14409-2-bjorn.topel@gmail.com>


On Thu, 22 Mar 2018 10:03:07 +0100 Björn Töpel <bjorn.topel@gmail.com> wrote:

> +/**
> + * i40e_xdp_xmit - Implements ndo_xdp_xmit
> + * @dev: netdev
> + * @xdp: XDP buffer
> + *
> + * Returns Zero if sent, else an error code
> + **/
> +int i40e_xdp_xmit(struct net_device *dev, struct xdp_buff *xdp)
> +{

The return code is used by the XDP redirect tracepoint... this is the
only way we have to debug/troubleshoot runtime issues with XDP. Thus,
these need to be consistent across drives and distinguishable.

> +	struct i40e_netdev_priv *np = netdev_priv(dev);
> +	unsigned int queue_index = smp_processor_id();
> +	struct i40e_vsi *vsi = np->vsi;
> +	int err;
> +
> +	if (test_bit(__I40E_VSI_DOWN, vsi->state))
> +		return -EINVAL;

Should be: -ENETDOWN

> +
> +	if (!i40e_enabled_xdp_vsi(vsi) || queue_index >= vsi->num_queue_pairs)
> +		return -EINVAL;

Should be: -ENXIO

> +	err = i40e_xmit_xdp_ring(xdp, vsi->xdp_rings[queue_index]);
> +	if (err != I40E_XDP_TX)
> +		return -ENOMEM;

Should be: -ENOSPC

The ENOSPC return code is important, as this can be used as a feedback
to a XDP_REDIRECT load-balancer facility.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  reply	other threads:[~2018-03-22 11:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-22  9:03 [Intel-wired-lan] [PATCH v2 1/2] i40e: tweak page counting for XDP_REDIRECT =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2018-03-22  9:03 ` Björn Töpel
2018-03-22  9:03 ` [Intel-wired-lan] [PATCH v2 2/2] i40e: add support " =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2018-03-22  9:03   ` Björn Töpel
2018-03-22 11:58   ` Jesper Dangaard Brouer [this message]
2018-03-22 11:58     ` Jesper Dangaard Brouer
2018-03-22 12:20     ` [Intel-wired-lan] " =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2018-03-22 12:20       ` Björn Töpel
2018-03-22 14:52       ` [Intel-wired-lan] " Alexander Duyck
2018-03-22 14:52         ` Alexander Duyck

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=20180322125811.0dcc1b28@redhat.com \
    --to=brouer@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.