From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id D615F5F1F for ; Thu, 6 Dec 2018 05:20:10 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2018 20:20:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,320,1539673200"; d="scan'208";a="107690901" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 05 Dec 2018 20:20:09 -0800 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 5 Dec 2018 20:20:09 -0800 Received: from bgsmsx155.gar.corp.intel.com (10.224.48.102) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 5 Dec 2018 20:20:08 -0800 Received: from bgsmsx101.gar.corp.intel.com ([169.254.1.20]) by BGSMSX155.gar.corp.intel.com ([169.254.12.114]) with mapi id 14.03.0415.000; Thu, 6 Dec 2018 09:50:06 +0530 From: "Varghese, Vipin" To: bai bakari <912873551@qq.com>, dev Thread-Topic: [dpdk-dev] About the data payload of rte_mbuf? Thread-Index: AQHUjRY7WaZyy/LCMkON2xNoav5OM6VxGyTg Date: Thu, 6 Dec 2018 04:20:05 +0000 Message-ID: <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D2D40E2@BGSMSX101.gar.corp.intel.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGY4MzM2NDQtNDMzMS00MzhhLTg3MDYtZjFmMjlhMDQyZWMyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieGxNZ1FxVFp1SFM0ekxvUHNCVjBjQkVxWDNrUXkrOHFjZWUwUmtBOXpcLzNndkhrYXpXUmYwblhtUXdwN1ZYN1wvIn0= dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.223.10.10] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] About the data payload of rte_mbuf? X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 04:20:11 -0000 Hi, A quick query from your email Snipped > ipv4_hdr =3D rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, sizeof(struct > ether_hdr));=20 Questions: 1. Should not be sizeof(struct ipv4_hdr) since you are passing second argum= ent as ipv4_hdr? 2. you are getting packets which starts from ether or ipv4? If it is ethern= et header would not you checking if ether type is ipv4 first? You can get a= rp, vlan, mpls right? ip_len =3D ntohs(ipv4_hdr->total_length); >=20 >=20 >=20 > if (ipv4_hdr->next_proto_id =3D=3D IPPROTO_TCP) { > tcp_hdr =3D (struct tcp_hdr *)((uint8_t *)ipv4_hdr + ((ipv4_hdr->vers= ion_ihl & > 0xf) << 2)); > payload =3D (uint8_t *)tcp_hdr + (tcp_hdr->data_off << 2); > payload_len =3D ip_len - (payload - (uint8_t *)ipv4_hdr); >=20 > } >=20 >=20 > when i send packets using dpdk-pktgen, i found: > ip_len =3D 46 > ip_header_len =3D 20 > but the tcp_header_len=3D(tcp_hdr->data_off << 2)=3D0, and (payload - (ui= nt8_t > *)ipv4_hdr) =3D 340 > ip_len. >=20 >=20 > I'm confused, is there any errors about the code to compute the payload_l= en of > rte_mbuf? > I think maybe the dpdk-pktgen cannot send the packets with payload? >=20 >=20 > I'm a beginner, anyone can help me how to compute the payload_len of > rte_mbuf and test it? >=20 >=20 > Thank you in advance!