All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Gur Stavi <gur.stavi@huawei.com>
Cc: <dev@dpdk.org>, "John W. Linville" <linville@tuxdriver.com>
Subject: Re: [PATCH v01] net/af_packet: support link status update
Date: Mon, 14 Oct 2024 10:41:18 -0700	[thread overview]
Message-ID: <20241014104118.45aaf3cd@hermes.local> (raw)
In-Reply-To: <330d6b3cea8a28688e9b58ea4a02ca68ac3aab96.1728829107.git.gur.stavi@huawei.com>

On Sun, 13 Oct 2024 17:29:23 +0300
Gur Stavi <gur.stavi@huawei.com> wrote:

>  static int
> -eth_link_update(struct rte_eth_dev *dev __rte_unused,
> +eth_link_update(struct rte_eth_dev *dev,
>                  int wait_to_complete __rte_unused)
>  {
> +	const struct pmd_internals *internals = dev->data->dev_private;
> +	struct rte_eth_link *dev_link = &dev->data->dev_link;
> +	int sockfd = internals->rx_queue[0].sockfd;
> +	struct ifreq ifr = { };
> +	int ret;
> +
> +	if (sockfd == -1)
> +		return 0;
> +
> +	strlcpy(ifr.ifr_name, internals->if_name, IFNAMSIZ);
> +	ret = ioctl(sockfd, SIOCGIFFLAGS, &ifr);
> +	if (!ret)
> +		dev_link->link_status = (ifr.ifr_flags & IFF_RUNNING) ?
> +			RTE_ETH_LINK_UP : RTE_ETH_LINK_DOWN;

If ioctl() fails, the function should return an error.
something like:

	if (ioctl(sockfd, SIOCGIFFFLAGS, &ifr) != 0)
		return -errno;


	

      reply	other threads:[~2024-10-14 17:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13 14:29 [PATCH v01] net/af_packet: support link status update Gur Stavi
2024-10-14 17:41 ` Stephen Hemminger [this message]

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=20241014104118.45aaf3cd@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=gur.stavi@huawei.com \
    --cc=linville@tuxdriver.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 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.