From: Tonghao Zhang <xiangxia.m.yue@gmail.com> To: Willem de Bruijn <willemdebruijn.kernel@gmail.com> Cc: Jason Wang <jasowang@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, virtualization@lists.linux-foundation.org, Network Development <netdev@vger.kernel.org> Subject: Re: [PATCH net-next v2] virtio-net: ethtool configurable RXCSUM Date: Fri, 9 Oct 2020 09:16:14 +0800 [thread overview] Message-ID: <CAMDZJNWX=3ikS5f0H+xD-dByW2=JHXjvk1=R=CkDLt0TW-orTg@mail.gmail.com> (raw) In-Reply-To: <CA+FuTSed1GsGp8a=GnHqV-HUcsOSZ0tb0NCe8360S8Md3MbS3g@mail.gmail.com> On Wed, Sep 30, 2020 at 6:05 PM Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote: > > On Wed, Sep 30, 2020 at 4:05 AM <xiangxia.m.yue@gmail.com> wrote: > > > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com> > > > > Allow user configuring RXCSUM separately with ethtool -K, > > reusing the existing virtnet_set_guest_offloads helper > > that configures RXCSUM for XDP. This is conditional on > > VIRTIO_NET_F_CTRL_GUEST_OFFLOADS. > > > > If Rx checksum is disabled, LRO should also be disabled. > > > > Cc: Michael S. Tsirkin <mst@redhat.com> > > Cc: Jason Wang <jasowang@redhat.com> > > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> > > The first patch was merged into net. > > Please wait until that is merged into net-next, as this depends on the > other patch. > > > --- > > v2: > > * LRO depends the rx csum > > * remove the unnecessary check > > --- > > drivers/net/virtio_net.c | 49 ++++++++++++++++++++++++++++++---------- > > 1 file changed, 37 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > index 21b71148c532..5407a0106771 100644 > > --- a/drivers/net/virtio_net.c > > +++ b/drivers/net/virtio_net.c > > @@ -68,6 +68,8 @@ static const unsigned long guest_offloads[] = { > > (1ULL << VIRTIO_NET_F_GUEST_ECN) | \ > > (1ULL << VIRTIO_NET_F_GUEST_UFO)) > > > > +#define GUEST_OFFLOAD_CSUM_MASK (1ULL << VIRTIO_NET_F_GUEST_CSUM) > > + > > struct virtnet_stat_desc { > > char desc[ETH_GSTRING_LEN]; > > size_t offset; > > @@ -2522,29 +2524,49 @@ static int virtnet_get_phys_port_name(struct net_device *dev, char *buf, > > return 0; > > } > > > > +static netdev_features_t virtnet_fix_features(struct net_device *netdev, > > + netdev_features_t features) > > +{ > > + /* If Rx checksum is disabled, LRO should also be disabled. > > + * That is life. :) > > Please remove this second line. OK > > + */ > > + if (!(features & NETIF_F_RXCSUM)) > > + features &= ~NETIF_F_LRO; > > + > > + return features; > > +} > > + > > static int virtnet_set_features(struct net_device *dev, > > netdev_features_t features) > > { > > struct virtnet_info *vi = netdev_priv(dev); > > - u64 offloads; > > + u64 offloads = vi->guest_offloads & > > + vi->guest_offloads_capable; > > When can vi->guest_offloads have bits set outside the mask of > vi->guest_offloads_capable? In this case, we can use only vi->guest_offloads. and guest_offloads_capable will not be used any more. so should we remove guest_offloads_capable ? -- Best regards, Tonghao
WARNING: multiple messages have this Message-ID (diff)
From: Tonghao Zhang <xiangxia.m.yue@gmail.com> To: Willem de Bruijn <willemdebruijn.kernel@gmail.com> Cc: Network Development <netdev@vger.kernel.org>, virtualization@lists.linux-foundation.org, "Michael S. Tsirkin" <mst@redhat.com> Subject: Re: [PATCH net-next v2] virtio-net: ethtool configurable RXCSUM Date: Fri, 9 Oct 2020 09:16:14 +0800 [thread overview] Message-ID: <CAMDZJNWX=3ikS5f0H+xD-dByW2=JHXjvk1=R=CkDLt0TW-orTg@mail.gmail.com> (raw) In-Reply-To: <CA+FuTSed1GsGp8a=GnHqV-HUcsOSZ0tb0NCe8360S8Md3MbS3g@mail.gmail.com> On Wed, Sep 30, 2020 at 6:05 PM Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote: > > On Wed, Sep 30, 2020 at 4:05 AM <xiangxia.m.yue@gmail.com> wrote: > > > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com> > > > > Allow user configuring RXCSUM separately with ethtool -K, > > reusing the existing virtnet_set_guest_offloads helper > > that configures RXCSUM for XDP. This is conditional on > > VIRTIO_NET_F_CTRL_GUEST_OFFLOADS. > > > > If Rx checksum is disabled, LRO should also be disabled. > > > > Cc: Michael S. Tsirkin <mst@redhat.com> > > Cc: Jason Wang <jasowang@redhat.com> > > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> > > The first patch was merged into net. > > Please wait until that is merged into net-next, as this depends on the > other patch. > > > --- > > v2: > > * LRO depends the rx csum > > * remove the unnecessary check > > --- > > drivers/net/virtio_net.c | 49 ++++++++++++++++++++++++++++++---------- > > 1 file changed, 37 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > index 21b71148c532..5407a0106771 100644 > > --- a/drivers/net/virtio_net.c > > +++ b/drivers/net/virtio_net.c > > @@ -68,6 +68,8 @@ static const unsigned long guest_offloads[] = { > > (1ULL << VIRTIO_NET_F_GUEST_ECN) | \ > > (1ULL << VIRTIO_NET_F_GUEST_UFO)) > > > > +#define GUEST_OFFLOAD_CSUM_MASK (1ULL << VIRTIO_NET_F_GUEST_CSUM) > > + > > struct virtnet_stat_desc { > > char desc[ETH_GSTRING_LEN]; > > size_t offset; > > @@ -2522,29 +2524,49 @@ static int virtnet_get_phys_port_name(struct net_device *dev, char *buf, > > return 0; > > } > > > > +static netdev_features_t virtnet_fix_features(struct net_device *netdev, > > + netdev_features_t features) > > +{ > > + /* If Rx checksum is disabled, LRO should also be disabled. > > + * That is life. :) > > Please remove this second line. OK > > + */ > > + if (!(features & NETIF_F_RXCSUM)) > > + features &= ~NETIF_F_LRO; > > + > > + return features; > > +} > > + > > static int virtnet_set_features(struct net_device *dev, > > netdev_features_t features) > > { > > struct virtnet_info *vi = netdev_priv(dev); > > - u64 offloads; > > + u64 offloads = vi->guest_offloads & > > + vi->guest_offloads_capable; > > When can vi->guest_offloads have bits set outside the mask of > vi->guest_offloads_capable? In this case, we can use only vi->guest_offloads. and guest_offloads_capable will not be used any more. so should we remove guest_offloads_capable ? -- Best regards, Tonghao _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2020-10-09 1:19 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-30 2:03 [PATCH net-next v2] virtio-net: ethtool configurable RXCSUM xiangxia.m.yue 2020-09-30 2:03 ` xiangxia.m.yue 2020-09-30 10:05 ` Willem de Bruijn 2020-09-30 10:05 ` Willem de Bruijn 2020-10-09 1:16 ` Tonghao Zhang [this message] 2020-10-09 1:16 ` Tonghao Zhang 2020-10-09 13:48 ` Willem de Bruijn 2020-10-09 13:48 ` Willem de Bruijn 2020-10-10 1:53 ` Tonghao Zhang 2020-10-10 1:53 ` Tonghao Zhang 2020-10-10 18:58 ` Willem de Bruijn 2020-10-10 18:58 ` Willem de Bruijn 2020-10-12 5:13 ` Tonghao Zhang 2020-09-30 10:06 ` Michael S. Tsirkin 2020-09-30 10:06 ` Michael S. Tsirkin
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='CAMDZJNWX=3ikS5f0H+xD-dByW2=JHXjvk1=R=CkDLt0TW-orTg@mail.gmail.com' \ --to=xiangxia.m.yue@gmail.com \ --cc=jasowang@redhat.com \ --cc=mst@redhat.com \ --cc=netdev@vger.kernel.org \ --cc=virtualization@lists.linux-foundation.org \ --cc=willemdebruijn.kernel@gmail.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: linkBe 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.