Re: [PATCH net-next v3 6/7] net: ethtool: add ring parameter filtering

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

 



On Fri, Oct 4, 2024 at 3:33 AM Mina Almasry <almasrymina@xxxxxxxxxx> wrote:
>
> On Thu, Oct 3, 2024 at 9:07 AM Taehee Yoo <ap420073@xxxxxxxxx> wrote:
> >
> > While the devmem is running, the tcp-data-split and
> > tcp-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.
> >
> > Signed-off-by: Taehee Yoo <ap420073@xxxxxxxxx>
> > ---
> >
> > v3:
> >  - Patch added
> >
> >  net/ethtool/common.h |  1 +
> >  net/ethtool/rings.c  | 15 ++++++++++++++-
> >  2 files changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/ethtool/common.h b/net/ethtool/common.h
> > index d55d5201b085..beebd4db3e10 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 c7824515857f..0afc6b29a229 100644
> > --- a/net/ethtool/rings.c
> > +++ b/net/ethtool/rings.c
> > @@ -216,7 +216,8 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
> >         bool mod = false, thresh_mod = false;
> >         struct nlattr **tb = info->attrs;
> >         const struct nlattr *err_attr;
> > -       int ret;
> > +       struct netdev_rx_queue *rxq;
> > +       int ret, i;
> >
> >         dev->ethtool_ops->get_ringparam(dev, &ringparam,
> >                                         &kernel_ringparam, info->extack);
> > @@ -263,6 +264,18 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
> >                 return -EINVAL;
> >         }
> >
> > +       if (kernel_ringparam.tcp_data_split != ETHTOOL_TCP_DATA_SPLIT_ENABLED ||
> > +           kernel_ringparam.tcp_data_split_thresh) {
> > +               for (i = 0; i < dev->real_num_rx_queues; i++) {
> > +                       rxq = __netif_get_rx_queue(dev, i);
> > +                       if (rxq->mp_params.mp_priv) {
> > +                               NL_SET_ERR_MSG(info->extack,
> > +                                              "tcp-header-data-split is disabled or threshold is not zero");
> > +                               return -EINVAL;
> > +                       }
>
> Probably worth adding a helper for this. I think the same loop is
> checked in a few places.
>
> Other than that, yes, this looks good to me.

Thanks, I will add a helper function for this in a v4 patch.

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