DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>, <dev@dpdk.org>
Cc: <stable@dpdk.org>, <xiaolong.ye@intel.com>,
	"Loftus, Ciara" <ciara.loftus@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] net/af_xdp: fix support of secondary process
Date: Wed, 15 Sep 2021 09:19:56 +0100	[thread overview]
Message-ID: <ccb76c94-f507-80d1-8add-0475de93c44b@intel.com> (raw)
In-Reply-To: <20210903161525.9929-1-stephen@networkplumber.org>

On 9/3/2021 5:15 PM, Stephen Hemminger wrote:
> Doing basic operations like info_get or get_stats was broken
> in af_xdp PMD. The info_get would crash because dev->device
> was NULL in secondary process. Fix this by doing same initialization
> as af_packet and tap devices.
> 
> The get_stats would crash because the XDP socket is not open in
> primary process. As a workaround don't query kernel for dropped
> packets when called from secondary process.
> 
> Note: this does not address the other bug which is that transmitting
> in secondary process is broken because the send() in tx_kick
> will fail because XDP socket fd is not valid in secondary process.
> 
> Bugzilla ID: 805
> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
> Cc: stable@dpdk.org
> Cc: xiaolong.ye@intel.com
> Ciara Loftus <ciara.loftus@intel.com>
> Qi Zhang <qi.z.zhang@intel.com>
> Anatoly Burakov <anatoly.burakov@intel.com>
> 

+cc Ciara, Qi & Anatoly

> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index 74ffa4511284..70abc14fa753 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -860,7 +860,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  	struct pkt_rx_queue *rxq;
>  	struct pkt_tx_queue *txq;
>  	socklen_t optlen;
> -	int i, ret;
> +	int i;
>  
>  	for (i = 0; i < dev->data->nb_rx_queues; i++) {
>  		optlen = sizeof(struct xdp_statistics);
> @@ -876,13 +876,12 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  		stats->ibytes += stats->q_ibytes[i];
>  		stats->imissed += rxq->stats.rx_dropped;
>  		stats->oerrors += txq->stats.tx_dropped;
> -		ret = getsockopt(xsk_socket__fd(rxq->xsk), SOL_XDP,
> -				XDP_STATISTICS, &xdp_stats, &optlen);
> -		if (ret != 0) {
> -			AF_XDP_LOG(ERR, "getsockopt() failed for XDP_STATISTICS.\n");
> -			return -1;
> -		}
> -		stats->imissed += xdp_stats.rx_dropped;
> +
> +		/* The socket fd is not valid in secondary process */
> +		if (rte_eal_process_type() != RTE_PROC_SECONDARY &&
> +		    getsockopt(xsk_socket__fd(rxq->xsk), SOL_XDP,
> +			       XDP_STATISTICS, &xdp_stats, &optlen) == 0)
> +			stats->imissed += xdp_stats.rx_dropped;
>  
>  		stats->opackets += stats->q_opackets[i];
>  		stats->obytes += stats->q_obytes[i];
> @@ -1799,7 +1798,9 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
>  			AF_XDP_LOG(ERR, "Failed to probe %s\n", name);
>  			return -EINVAL;
>  		}
> +		/* TODO: reconnect socket from primary */
>  		eth_dev->dev_ops = &ops;
> +		eth_dev->device = &dev->device;
>  		rte_eth_dev_probing_finish(eth_dev);
>  		return 0;
>  	}
> 


  reply	other threads:[~2021-09-15  8:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 16:15 [dpdk-dev] " Stephen Hemminger
2021-09-15  8:19 ` Ferruh Yigit [this message]
2021-09-20 13:23 ` Loftus, Ciara
2021-09-20 14:43   ` Stephen Hemminger
2021-09-20 15:09     ` Loftus, Ciara
2021-09-21 17:45       ` Stephen Hemminger
2021-09-23 12:33         ` Loftus, Ciara
2021-10-05 15:02           ` Ferruh Yigit

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=ccb76c94-f507-80d1-8add-0475de93c44b@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=xiaolong.ye@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).