From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ivan Boule Subject: Re: where to find ethernet CRC when stripping is off Date: Wed, 20 Jan 2016 16:49:06 +0100 Message-ID: <569FAC72.3090001@6wind.com> References: <30b91c74ca26434daac041713cffa153@bilemail1.empirix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit To: "Montorsi, Francesco" , "dev@dpdk.org" Return-path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id A2AFF8DAF for ; Wed, 20 Jan 2016 16:49:23 +0100 (CET) Received: by mail-wm0-f48.google.com with SMTP id r129so136633694wmr.0 for ; Wed, 20 Jan 2016 07:49:23 -0800 (PST) In-Reply-To: <30b91c74ca26434daac041713cffa153@bilemail1.empirix.com> 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 01/20/2016 04:02 PM, Montorsi, Francesco wrote: > Hi all, > > I need to get access to the Ethernet CRC of received packets. > To do this, I'm configuring: > > port_conf.rxmode.hw_strip_crc = 0; > > Now my question is: how am I supposed to access the Ethernet CRC from a DPDK mbuf? > Is the CRC just the 4 final bytes of the packets? > > Is this correct: > > uint32_t crc = rte_pktmbuf_mtod_offset (mymbuf, uint32_t*, mymbuf->pkt_len) ; > > ? > > Thanks, > Francesco Montorsi > Hi Francesco, You would be right... if the PMDs did not transparently strip the CRC in software when hardware CRC stripping is disabled at port configuration (as described above). See for instance how the function ixgbe_recv_pkts_lro() in file drivers/net/ixgbe/ixgbe_rxtx.c deals with crc_len. Considering your need, I think now that PMDs should keep the CRC that are stored in received packets when hardware CRC stripping is disabled by the application, so that the application can access it as needed. Note that this would impose that the input packet processing of such DPDK applications be aware of the CRC presence (+4 in the packet length , for instance). Let's see what others, if any, that might care think about such a change into the CRC stripping semantics. Ivan -- Ivan Boule 6WIND Development Engineer