DPDK patches and discussions
 help / color / mirror / Atom feed
From: Igor Ryzhov <iryzhov@nfware.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev <dev@dpdk.org>, Ferruh Yigit <ferruh.yigit@intel.com>,
	Dan Gora <dg@adax.com>
Subject: Re: [dpdk-dev] [PATCH v5 1/3] kni: rework rte_kni_update_link using ioctl
Date: Thu, 26 Aug 2021 20:46:47 +0300	[thread overview]
Message-ID: <CAF+s_FwtghaLv7-wQQL5Yr4YvT9gd_K5gcQBF-7VW=1jxzO5AA@mail.gmail.com> (raw)
In-Reply-To: <20210826101535.7b9c08c1@hermes.local>

Could you please clarify where exactly do I need to use rtnl lock?
From what I understand, netif_carrier_on/off can be called without the lock.

On Thu, Aug 26, 2021 at 8:15 PM Stephen Hemminger <
stephen@networkplumber.org> wrote:

> On Thu, 26 Aug 2021 18:19:09 +0300
> Igor Ryzhov <iryzhov@nfware.com> wrote:
>
> >
> > +static int
> > +kni_ioctl_link(struct net *net, uint32_t ioctl_num,
> > +             unsigned long ioctl_param)
> > +{
> > +     struct kni_net *knet = net_generic(net, kni_net_id);
> > +     int ret = -EINVAL;
> > +     struct kni_dev *dev, *n;
> > +     struct rte_kni_link_info link_info;
> > +     struct net_device *netdev;
> > +
> > +     if (_IOC_SIZE(ioctl_num) > sizeof(link_info))
> > +             return -EINVAL;
> > +
> > +     if (copy_from_user(&link_info, (void *)ioctl_param,
> sizeof(link_info)))
> > +             return -EFAULT;
> > +
> > +     if (strlen(link_info.name) == 0)
> > +             return -EINVAL;
> > +
> > +     down_read(&knet->kni_list_lock);
> > +     list_for_each_entry_safe(dev, n, &knet->kni_list_head, list) {
> > +             if (strncmp(dev->name, link_info.name, RTE_KNI_NAMESIZE)
> != 0)
> > +                     continue;
> > +
> > +             netdev = dev->net_dev;
> > +
> > +             if (link_info.status) {
> > +                     netif_carrier_on(netdev);
> > +
> > +                     dev->speed = link_info.speed;
> > +                     dev->duplex = link_info.duplex;
> > +                     dev->autoneg = link_info.autoneg;
> > +             } else {
> > +                     netif_carrier_off(netdev);
> > +             }
> > +
> > +             ret = 0;
> > +             break;
> > +     }
> > +     up_read(&knet->kni_list_lock);
> > +
> > +     return ret;
> > +}
> > +
>
> You need to be using the RTNL mutex in KNI here (and probably elsewhere).
> The use of semaphore for list lock should also be replaced by a mutex.
>
> The KNI driver was written long ago and was never reviewed by people
> knowledgeable about kernel networking. That is one reason IMHO KNI
> should not be used in production systems.
>
>

  reply	other threads:[~2021-08-26 17:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 19:25 [dpdk-dev] [PATCH] " Igor Ryzhov
2019-09-24 19:33 ` [dpdk-dev] [PATCH v2] " Igor Ryzhov
2019-09-24 20:37   ` Aaron Conole
2019-09-25  9:00     ` Igor Ryzhov
2019-09-25  9:36   ` [dpdk-dev] [PATCH v3] " Igor Ryzhov
2019-10-14 16:10     ` Ferruh Yigit
2019-10-14 16:17       ` Ferruh Yigit
2019-10-14 19:01         ` Dan Gora
2019-10-14 20:55           ` Dan Gora
2019-10-27 20:16             ` Igor Ryzhov
2021-06-28 12:55               ` Ferruh Yigit
2021-06-28 13:16                 ` Igor Ryzhov
2021-07-04 16:06   ` [dpdk-dev] [PATCH v4 1/2] " Igor Ryzhov
2021-07-04 16:06     ` [dpdk-dev] [PATCH v4 2/2] kni: implement basic get_link_ksettings callback Igor Ryzhov
2021-07-05 11:58     ` [dpdk-dev] [PATCH v4 1/2] kni: rework rte_kni_update_link using ioctl Ferruh Yigit
2021-07-06  9:14       ` Igor Ryzhov
2021-08-26 15:19     ` [dpdk-dev] [PATCH v5 1/3] " Igor Ryzhov
2021-08-26 15:19       ` [dpdk-dev] [PATCH v5 2/3] kni: implement basic get_link_ksettings callback Igor Ryzhov
2021-08-26 15:19       ` [dpdk-dev] [PATCH v5 3/3] app/test: fix return value of test_kni_link_change Igor Ryzhov
2021-08-26 17:15       ` [dpdk-dev] [PATCH v5 1/3] kni: rework rte_kni_update_link using ioctl Stephen Hemminger
2021-08-26 17:46         ` Igor Ryzhov [this message]
2021-08-26 18:06           ` Stephen Hemminger
2021-08-30 18:05             ` Igor Ryzhov
2021-08-30 14:27       ` [dpdk-dev] [PATCH v6 " Igor Ryzhov
2021-08-30 14:27         ` [dpdk-dev] [PATCH v6 2/3] kni: implement basic get_link_ksettings callback Igor Ryzhov
2021-08-30 14:27         ` [dpdk-dev] [PATCH v6 3/3] app/test: fix return value of test_kni_link_change Igor Ryzhov
2023-06-29 17:05         ` [dpdk-dev] [PATCH v6 1/3] kni: rework rte_kni_update_link using ioctl Stephen Hemminger

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='CAF+s_FwtghaLv7-wQQL5Yr4YvT9gd_K5gcQBF-7VW=1jxzO5AA@mail.gmail.com' \
    --to=iryzhov@nfware.com \
    --cc=dev@dpdk.org \
    --cc=dg@adax.com \
    --cc=ferruh.yigit@intel.com \
    --cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).