From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v1] add mtu set in virtio Date: Mon, 29 Aug 2016 12:33:06 -0700 Message-ID: <20160829123306.4e2bf00d@xeon-e3> References: <20160827005428.16556-1-sodey@sonusnet.com> <20160827171541.5f6b17c2@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "huawei.xie@intel.com" , "yuanhan.liu@linux.intel.com" , "dev@dpdk.org" To: "Dey, Souvik" Return-path: Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by dpdk.org (Postfix) with ESMTP id B328DFFA for ; Mon, 29 Aug 2016 21:32:55 +0200 (CEST) Received: by mail-pf0-f171.google.com with SMTP id x72so55018849pfd.2 for ; Mon, 29 Aug 2016 12:32:55 -0700 (PDT) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sun, 28 Aug 2016 22:43:54 +0000 "Dey, Souvik" wrote: > Hi , > Currently as you have mentioned, I have changed the code to: > static int > virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) > { > struct virtio_hw *hw = dev->data->dev_private; > - if (unlikely(mtu < (uint32_t)hw->vtnet_hdr_size + ETHER_HDR_LEN)) { > - return -1; > + if (unlikely(mtu < VIRTIO_MIN_RX_BUFSIZE || mtu > VIRTIO_MAX_RX_PKTLEN)) { > + PMD_INIT_LOG(ERR,"Mtu should be between 64 and 9728." > + return -EINVAL; > } > return 0; > } > > Yes, we should support till 64K as the kernel does , but I need to go through the changes and test it properly before submitting it for review. Moreover I was thinking with the changes in the mtu, we should also support multi-segment buffers in kni. What do you suggest ? This looks good, but you really don't need likely/unlikely in this code. It is not at all performance critical.