From: Stephen Hemminger <stephen@networkplumber.org>
To: "Dey, Souvik" <sodey@sonusnet.com>
Cc: "mark.b.kavanagh@intel.com" <mark.b.kavanagh@intel.com>,
"yuanhan.liu@linux.intel.com" <yuanhan.liu@linux.intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v6] net/virtio: add set_mtu in virtio
Date: Wed, 21 Sep 2016 18:45:05 -0700 [thread overview]
Message-ID: <20160921184505.584367ef@xeon-e3> (raw)
In-Reply-To: <BN3PR03MB14941D7F017B6EB98BD19298DAC90@BN3PR03MB1494.namprd03.prod.outlook.com>
On Thu, 22 Sep 2016 00:08:38 +0000
"Dey, Souvik" <sodey@sonusnet.com> wrote:
> Answers inline.
>
> --
> Regards,
> Souvik
>
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Wednesday, September 21, 2016 7:22 PM
> To: Dey, Souvik <sodey@sonusnet.com>
> Cc: mark.b.kavanagh@intel.com; yuanhan.liu@linux.intel.com; dev@dpdk.org
> Subject: Re: [PATCH v6] net/virtio: add set_mtu in virtio
>
> On Wed, 21 Sep 2016 19:11:47 -0400
> Dey <sodey@sonusnet.com> wrote:
>
> >
> > +
> > +#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMA'd) */
> > +
> > +static int virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
> > + struct rte_eth_dev_info dev_info;
> > + uint32_t ether_hdr_len = ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE;
> > + uint32_t frame_size = mtu + ether_hdr_len;
> > +
> > + virtio_dev_info_get(dev, &dev_info);
> > +
> > + if (mtu < ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen) {
> > + PMD_INIT_LOG(ERR, "MTU should be between %d and %d\n",
> > + ETHER_MIN_MTU,
> > + (dev_info.max_rx_pktlen - ether_hdr_len));
> > + return -EINVAL;
> > + }
> > + return 0;
> > +}
>
> I am fine with the general idea of this patch but:
> 1. Calling virtio_dev_info_get is needlessly wasteful when all you want
> is to access the max packet length. Since max_rx_pktlen is always
> VIRTIO_MAX_RX_PKTLEN, please just use that.
> [Dey, Souvik] I am using the virtio_dev_info_get as in future can/may support the max_rx_pktlen as a variable to be set by the application. This will keep the changes future proof. As we need to support till 65535 instead of 9728 as the linux does.
Fine, then just dereference hw->rx_max_pktlen. Driver code can/should reference
its own data directly.
>
> 2. Defining VLAN_TAG_SIZE is irrelevant if doing vlan offload.
> [Dey, Souvik] vlan offload is not mandatory. Se again still have vlan being sent up to the application. In that case we need to consider the vlan length in the Ethernet size.
The code needs to handle both vlan offload (or not), correctly. You are assuming
the worst case here.
>
> 3. Virtio doesn't insert CRC, therefore CRC_LEN is irrelevant
> [Dey, Souvik] I am not sure of this. Mark commented earlier to consider this length too. Mark what do you suggest ?
Actually, the thing that matters is the size of the merge rx buf header, not the CRC.
The patch is still buggy.
next prev parent reply other threads:[~2016-09-22 1:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-21 23:11 Dey
2016-09-21 23:22 ` Stephen Hemminger
2016-09-22 0:08 ` Dey, Souvik
2016-09-22 1:45 ` Stephen Hemminger [this message]
2016-09-22 2:29 ` Dey, Souvik
2016-09-23 7:53 ` Yuanhan Liu
2016-09-23 9:07 ` Kavanagh, Mark B
2016-09-23 15:17 ` Dey, Souvik
2016-09-26 3:21 ` Yuanhan Liu
2016-09-27 15:41 ` Dey, Souvik
2016-09-27 18:56 ` Stephen Hemminger
2016-09-27 20:44 ` Dey, Souvik
2016-09-27 23:11 ` Yuanhan Liu
2016-09-28 15:31 ` Dey, Souvik
2016-09-22 15:57 ` Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2016-09-21 21:10 Dey
2016-09-16 17:13 [dpdk-dev] [PATCH v5]net/virtio: add mtu set " souvikdey33
2016-09-22 13:56 ` [dpdk-dev] [PATCH v6] net/virtio: add set_mtu " Dey
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=20160921184505.584367ef@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=mark.b.kavanagh@intel.com \
--cc=sodey@sonusnet.com \
--cc=yuanhan.liu@linux.intel.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 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).