From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v2 1/3] net/af_packet: set_mtu() decrements sockaddr twice Date: Fri, 21 Dec 2018 12:29:09 +0000 Message-ID: <803dcc36-68ea-f53e-93d0-4f8e37bcc0b2@intel.com> References: <1542707697-175836-1-git-send-email-tiago.lam@intel.com> <1542709592-215007-1-git-send-email-tiago.lam@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: linville@tuxdriver.com To: Tiago Lam , dev@dpdk.org Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 739B81BE38 for ; Fri, 21 Dec 2018 13:29:11 +0100 (CET) In-Reply-To: <1542709592-215007-1-git-send-email-tiago.lam@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 11/20/2018 10:26 AM, Tiago Lam wrote: > When setting the MTU, eth_dev_mtu_set() is called to validate the > provided MTU. As part of that, it calculates the useful area to store > data and compares it against the MTU, to guarantee that there's enough > space to store the data. It calculates that as: > "tp_frame_size - TPACKET2_HDRLEN - sizeof(struct sockaddr_ll)" > > However, the TPACKET2_HDRLEN macro already increaments sizeof(struct > sockaddr_ll) internally, meaning the useuful area of data above will > have sizeof(struct sockaddr_ll) decremented twice. > > Instead, the useful area of data should be calculated as: > "tp_frame_size - TPACKET2_HDRLEN" > > This makes sure that there's enough useful area to fit the provided MTU > after excluding tpacket2_hdr and sockaddr_ll. > > Fixes: cc68ac4 ("net/af_packet: support MTU change") > > Signed-off-by: Tiago Lam Reviewed-by: Ferruh Yigit Applied to dpdk-next-net/master, thanks.