Re: [PATCH net-next v4 6/8] net: ethtool: add ring parameter filtering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 1, 2024 at 11:35 PM Mina Almasry <almasrymina@xxxxxxxxxx> wrote:
>
> On Tue, Oct 22, 2024 at 9:25 AM Taehee Yoo <ap420073@xxxxxxxxx> wrote:
> >
> > While the devmem is running, the tcp-data-split and
> > header-data-split-thresh configuration should not be changed.
> > If user tries to change tcp-data-split and threshold value while the
> > devmem is running, it fails and shows extack message.
> >
> > Tested-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>
> > Signed-off-by: Taehee Yoo <ap420073@xxxxxxxxx>
> > ---
> >
> > v4:
> >  - Add netdev_devmem_enabled() helper.
> >  - Add Test tag from Stanislav.
> >
> > v3:
> >  - Patch added
> >
> >  include/net/netdev_rx_queue.h | 14 ++++++++++++++
> >  net/ethtool/common.h          |  1 +
> >  net/ethtool/rings.c           | 13 +++++++++++++
> >  3 files changed, 28 insertions(+)
> >
> > diff --git a/include/net/netdev_rx_queue.h b/include/net/netdev_rx_queue.h
> > index 596836abf7bf..7fbb64ce8d89 100644
> > --- a/include/net/netdev_rx_queue.h
> > +++ b/include/net/netdev_rx_queue.h
> > @@ -55,6 +55,20 @@ get_netdev_rx_queue_index(struct netdev_rx_queue *queue)
> >         return index;
> >  }
> >
> > +static inline bool netdev_devmem_enabled(struct net_device *dev)
>
> Mega nit: netdev_memory_provider_enabled().
>
> This is actually not devmem specific, and there is already an io_uring
> provider in the works.
>
> But, also, we already have dev_get_min_mp_channel_count() defined in
> linux/netdevice.h. Lets re-use that one instead of adding another
> helper that does almost the same thing. Sorry, I should have
> remembered we already have this helper in the last iteration.

Ah, I didn't catch it too.
I will use dev_get_min_mp_channel_count() instead.
Thanks a lot!

>
> Other than that, looks fine to me.
>
> > +{
> > +       struct netdev_rx_queue *queue;
> > +       int i;
> > +
> > +       for (i = 0; i < dev->real_num_rx_queues; i++) {
> > +               queue = __netif_get_rx_queue(dev, i);
> > +               if (queue->mp_params.mp_priv)
> > +                       return true;
> > +       }
> > +
> > +       return false;
> > +}
> > +
> >  int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq);
> >
> >  #endif
> > diff --git a/net/ethtool/common.h b/net/ethtool/common.h
> > index 4a2de3ce7354..5b8e5847ba3c 100644
> > --- a/net/ethtool/common.h
> > +++ b/net/ethtool/common.h
> > @@ -5,6 +5,7 @@
> >
> >  #include <linux/netdevice.h>
> >  #include <linux/ethtool.h>
> > +#include <net/netdev_rx_queue.h>
> >
> >  #define ETHTOOL_DEV_FEATURE_WORDS      DIV_ROUND_UP(NETDEV_FEATURE_COUNT, 32)
> >
> > diff --git a/net/ethtool/rings.c b/net/ethtool/rings.c
> > index e1fd82a91014..ca313c301081 100644
> > --- a/net/ethtool/rings.c
> > +++ b/net/ethtool/rings.c
> > @@ -258,6 +258,19 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
> >                 return -ERANGE;
> >         }
> >
> > +       if (netdev_devmem_enabled(dev)) {
> > +               if (kernel_ringparam.tcp_data_split !=
> > +                   ETHTOOL_TCP_DATA_SPLIT_ENABLED) {
> > +                       NL_SET_ERR_MSG(info->extack,
> > +                                      "tcp-data-split should be enabled while devmem is running");
>
> Maybe: "can't disable tcp-data-split while device has memory provider enabled"

Thanks! I will use it!

>
> > +                       return -EINVAL;
> > +               } else if (kernel_ringparam.hds_thresh) {
> > +                       NL_SET_ERR_MSG(info->extack,
> > +                                      "header-data-split-thresh should be zero while devmem is running");
>
> Maybe: "can't set non-zero hds_thresh while device is memory provider enabled".

Thanks, I will use it too.

Thanks a lot!
Taehee Yoo

>
>
> --
> Thanks,
> Mina





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux