From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67D9EA0524; Sat, 28 Nov 2020 06:31:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E568BC958; Sat, 28 Nov 2020 06:31:31 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 284C8C93C for ; Sat, 28 Nov 2020 06:31:29 +0100 (CET) IronPort-SDR: LjByx6ocKrM8XdxsyS5qXyAI5GIbBvG/n1U+Hd+3VwMX6QHCV0639q3r1genpQUr8BkE1sr7Gl iuOELQU6OftQ== X-IronPort-AV: E=McAfee;i="6000,8403,9818"; a="168953892" X-IronPort-AV: E=Sophos;i="5.78,376,1599548400"; d="scan'208";a="168953892" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2020 21:31:27 -0800 IronPort-SDR: NJTrDeGb5x7Sm/c77ScLrNL+B6KnBqptI1+SsueDSnfM3BcEiNsDJ36LnwXonZW+V76tyq51tr nkkvd9yJZ5Tg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,376,1599548400"; d="scan'208";a="333879329" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga006.jf.intel.com with ESMTP; 27 Nov 2020 21:31:27 -0800 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 27 Nov 2020 21:31:27 -0800 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 27 Nov 2020 21:31:26 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Fri, 27 Nov 2020 21:31:26 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.176) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Fri, 27 Nov 2020 21:31:26 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JVd6bwjPuP5WXRx82t6SV6BDEUcyfRKsH0SYTUxif/K0amNxsIxN9fUdGzh8NxOCvHt1syVf0LH2r34PM4/mVUE+nm0pCliiLHvoTUPljy+cwzBrkAAg+2gHGdhXOnTiv7xG1OOzobl21A19bqUECfRdxonq7NHIi2l+b7XD09TgJ/cTSP93gMkUzsZw/9dFCMu/+a+/tUOjUZGByviHRbH0bbjnBOWeE4FtuDBesr7HfBLn4zVYz0ln2lO9Y9AknbojLXr0eZDur4kR2k5V66btDsLLbqOVRqQnCts3gheMY0ooepWmrsX9pUX4I2T+Lc4jLGWB1aYjsvWYQp/eWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=piIydhTFxeKS7LX8eaj8kUbSOix5ROlTn+rT1vm/qAo=; b=NRqAPj6fPVHIhxici/enYz8bxNMVDmvmPK2/AsC86KBCtTkh8FMJiYzhUVyzL+M2wQOYBWQVjM9RDj/wGvhyzzuZIZ58kt5t6LrABzHLBFOdp1dzVzL1VPmsgf5LjUQoyu5I5zyaEPIym8uAaL0n0uO76nR3/jpKX3XIUdgGMeKIbhnpc8WFG1mc3oQIfEAlYINKGvm6bX0QEWDb6Lz8c8NZlgOMm3nfbBdooPMU8xSrVSKbaJyj1Sp8lpuh2LI1hAbSPyaWaPwazKwX1pRWkvkBKypPXdoNOmwj5btJ9d2Il0U7t3SOa8QDcyoeTt+tk1oU219/F/FNHVEa0T2nmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=piIydhTFxeKS7LX8eaj8kUbSOix5ROlTn+rT1vm/qAo=; b=YNDu2d1vZx58Gw3JbuREr6sUPjG/WD1EWcROh503q4XZiKHongTir5Qn/YBCL9w0HjSRMkPiu9mHO1WIO0VS7+M1kOCcT/PSCwacjJx517FpffrrKn3H6vIn+IFYMTvsmiPUszjqpbJMAAKO3Vu2ottN+Xuh8lFWj2y/uLRzeDA= Received: from BYAPR11MB3800.namprd11.prod.outlook.com (2603:10b6:a03:f5::21) by BYAPR11MB3751.namprd11.prod.outlook.com (2603:10b6:a03:f8::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.22; Sat, 28 Nov 2020 05:31:25 +0000 Received: from BYAPR11MB3800.namprd11.prod.outlook.com ([fe80::b19b:c132:7eff:551]) by BYAPR11MB3800.namprd11.prod.outlook.com ([fe80::b19b:c132:7eff:551%2]) with mapi id 15.20.3611.025; Sat, 28 Nov 2020 05:31:18 +0000 From: "Wang, Haiyue" To: Bing Zhao , "Yigit, Ferruh" , Olivier Matz CC: "dev@dpdk.org" , Stephen Hemminger Thread-Topic: [RFC] net: make eCPRI header host network order Thread-Index: AQHWxPDW9J3k1kFpHUakKwbI7pbU1anc4GKAgAAgdKA= Date: Sat, 28 Nov 2020 05:31:18 +0000 Message-ID: References: <20201127190920.3312280-1-ferruh.yigit@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.0.76 authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.196] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 93816704-0741-47c5-b11e-08d8935ed506 x-ms-traffictypediagnostic: BYAPR11MB3751: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:514; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: c9Pnf6hu8E9hJC36hwkVjEI7MSolLMQ+xBmFDPxOgCuOUPAfaQF8qdSCRPsvJbmfQS4GT2oDibOjSlYgpGrFyL6feTRnX6n2EBndeauUj981meMFf4TPFqpkI/lCa43/PbGbbrgpb7HovVCGzRpZV/g9V9fI/qxxOq7Pdk+02QqXwOtmDAIeU3J5NMWz8Mvu+CePi5qLV0z3ka9tEhj1s2nY597iIis5fpMH287JNheEJVpEk2hUio6UcYJE92kosKxNdSiFk9R9qPe7S30Zr6huZcdTqeQ14ZVMfCGYG25IB0ujqG8SbjBE+MS5Eq/4nfJ/5RzVyz7p/pZsTZf7oA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3800.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39860400002)(376002)(346002)(136003)(366004)(8676002)(2906002)(5660300002)(7696005)(4326008)(53546011)(86362001)(6506007)(55016002)(9686003)(186003)(8936002)(316002)(71200400001)(83380400001)(66446008)(110136005)(66556008)(478600001)(66476007)(54906003)(66946007)(33656002)(76116006)(52536014)(26005)(64756008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?S1NK1oW2DjTd43EFfq9JrsuS+Zft91jVf4ZpEFy2Ld1TxhPfJEgSetWEZYFR?= =?us-ascii?Q?3zzGvXvdJ7XcPq5CaUZrX/HqZwogxRe8f/+i114c+FBNp+3NqEs9phddo4Qs?= =?us-ascii?Q?0ADEAThXhL9d+NOx+C0klD1zbhrviA3nMXbQDYYZe9Pa0qxfChrcROEs/qUZ?= =?us-ascii?Q?qLJIkLpvj9k9WYHBtHoiFhGnrOZ0Jt80zeFpBKd5JNS0/ceJCFoFNfGg9RyO?= =?us-ascii?Q?eget22Lposu9QtcDxpFbO1dVykl35WleCy2UOLqHGIy0JXFGK3oKzggpN25V?= =?us-ascii?Q?At5dFXxtPv4FYLuY2hrqfzkGo/x2K12HluwMEcirdGOBF3ZoyEpU/hf0lWt8?= =?us-ascii?Q?TCja7a9qdo8TMYaySAjQkSMy9ptcjGfffKZlCbRGzWxcTWgVvc22KPBD3B2w?= =?us-ascii?Q?kXQnFmFuPFq3goeOUXDu70CcUwD2UX5h7dGocCwDJd9ol9nHxGmiCGwWrPdW?= =?us-ascii?Q?hdCzjLmfwbQvBrVvLtY+GjZw/ykFacGHNsrQ3oezIxM2IkhilsNyf9KZUyc9?= =?us-ascii?Q?JWTuZgiGcrTi/AA920BmkqYECevvnGtIAetFQF4qnEfNWEsxHFTr8XuVyWVF?= =?us-ascii?Q?d6jApnzP981HSSApb59Gchp9lqvNUgm3yBtuwMtKVhxJOU3BJ3a+2jU0QEEw?= =?us-ascii?Q?uEXH922hCR45Yth2LodBPb5SHk2Zq/sHsBI4AtfCtZ8I4DwEzk7w/c1J70in?= =?us-ascii?Q?wpuFqN3tYkC8tSNmjk8W4Vm8vYQl1ez3cVRJiZaaP6qvP1m7k23XibusKJan?= =?us-ascii?Q?VaT760kMWViicPh0VwmJixcQfbtb+mSHgu4ajbYBtV/3wTGdfr49RAPcf4Y+?= =?us-ascii?Q?SikPjdL6Bgst9oVTqiLsuDPbuvaCMfgbFVv6eV6kDpD0uimSwF23Ck+TiAjM?= =?us-ascii?Q?Gp+Rhd+qKFlF+MRFTizqX292C97OKZQuVrKodHLq2/yZZgqAJd/UDGaCaQJP?= =?us-ascii?Q?yiGzdZo3KMu6ZXlqP9oW9GbeSX52gbOtIUingUmyEPo=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3800.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93816704-0741-47c5-b11e-08d8935ed506 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Nov 2020 05:31:18.1710 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 13tEFkjwuPp/n9HLeNmTHaYDGJn7BPlEczcizVpjK2pDL42KEtaNwOjuyhh7OP/SfvrL8aFQnY1cumaUP3/UIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3751 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [RFC] net: make eCPRI header host network order 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Bing, > -----Original Message----- > From: Bing Zhao > Sent: Saturday, November 28, 2020 11:18 > To: Yigit, Ferruh ; Olivier Matz > Cc: dev@dpdk.org; Wang, Haiyue ; Stephen Hemminger= > Subject: RE: [RFC] net: make eCPRI header host network order >=20 > Hi Ferruh & Haiyue, > Have you checked other headers? Like: > rte_ipv4_hdr > rte_ipv6_hdr > rte_tcp_hdr > ... >=20 > Also > [ITEM_UDP_SRC] =3D { > .name =3D "src", > .help =3D "UDP source port", > .next =3D NEXT(item_udp, NEXT_ENTRY(UNSIGNED), item_param), > .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_udp, > hdr.src_port)), > }, > [ITEM_UDP_DST] =3D { > .name =3D "dst", > .help =3D "UDP destination port", > .next =3D NEXT(item_udp, NEXT_ENTRY(UNSIGNED), item_param), > .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_udp, > hdr.dst_port)), > }, >=20 > Or did I get sth. wrong? >=20 The original design is not wrong. ;-) Since it is defined in librte_net, people will think it is just union for network order quick access like 'struct rte_gre_hdr', but in fact the bit field here is something like auxiliary data structure, we have to translate the whole 4 byte from network order to host order for accessing one bit field member, otherwise it will be wrong. Like: struct rte_ecpri_common_hdr *eh; uint8_t pkt[4]; pkt[0] =3D 0x10; pkt[1] =3D 0x03; pkt[2] =3D 0x00; pkt[3] =3D 0x18; eh =3D (struct rte_ecpri_common_hdr *)pkt; printf("eCPRI: 0x%08x, revision =3D %u, type =3D %u size =3D %u\n", eh->u32, eh->revision, eh->type, ntohs(eh->size)); eCPRI: 0x18000310, revision =3D 1, type =3D 0 size =3D 4099 But in fact it should be: eCPRI: 0x18000310, revision =3D 1, type =3D 3 size =3D 24 After the enhancement (new revision from RFCv1): struct rte_ecpri_common_hdr { union { rte_be32_t u32; /**< 4B common header in BE */ struct { #if RTE_BYTE_ORDER =3D=3D RTE_LITTLE_ENDIAN uint16_t c:1; /**< Concatenation Indicator */ uint16_t res:3; /**< Reserved */ uint16_t revision:4; /**< Protocol Revision */ uint16_t type:8; /**< Message Type */ #elif RTE_BYTE_ORDER =3D=3D RTE_BIG_ENDIAN uint16_t revision:4; /**< Protocol Revision */ uint16_t res:3; /**< Reserved */ uint16_t c:1; /**< Concatenation Indicator */ uint16_t type:8; /**< Message Type */ #endif rte_be16_t size; /**< Payload Size */ }; }; }; The assignment in flow_dv_validate can also be simple: .common =3D { .u32 =3D RTE_BE32(((const struct rte_ecpri_common_hdr) { .type =3D 0xFF, }).u32), }, New: struct rte_ecpri_common_hdr common =3D { .type =3D 0xff }; BR, Haiyue > BR. Bing >=20 > > -----Original Message----- > > From: Ferruh Yigit > > Sent: Saturday, November 28, 2020 3:09 AM > > To: Olivier Matz > > Cc: Ferruh Yigit ; dev@dpdk.org; Haiyue Wang > > ; Stephen Hemminger > > ; Bing Zhao > > Subject: [RFC] net: make eCPRI header host network order > > > > External email: Use caution opening links or attachments > > > > > > Other protocol structs are in the host byte order, having eCPRI in > > network byte order is insistent and error prone. > > > > Making eCPRI protocol header host byte order. > > > > Signed-off-by: Haiyue Wang > > Signed-off-by: Ferruh Yigit > > --- > > Cc: Stephen Hemminger > > Cc: Bing Zhao > > Cc: Olivier Matz > > --- > > lib/librte_net/rte_ecpri.h | 7 +++---- > > 1 file changed, 3 insertions(+), 4 deletions(-) > > > > diff --git a/lib/librte_net/rte_ecpri.h b/lib/librte_net/rte_ecpri.h > > index 1cbd6d813363..67bf9186ff6f 100644 > > --- a/lib/librte_net/rte_ecpri.h > > +++ b/lib/librte_net/rte_ecpri.h > > @@ -60,21 +60,20 @@ extern "C" { > > RTE_STD_C11 > > struct rte_ecpri_common_hdr { > > union { > > - rte_be32_t u32; /**< 4B common > > header in BE */ > > + uint32_t u32; /**< 4B common > > header in host byte order */ > > struct { > > #if RTE_BYTE_ORDER =3D=3D RTE_LITTLE_ENDIAN > > - uint32_t size:16; /**< Payload Size */ > > - uint32_t type:8; /**< Message Type */ > > uint32_t c:1; /**< Concatenation > > Indicator */ > > uint32_t res:3; /**< Reserved */ > > uint32_t revision:4; /**< Protocol > > Revision */ > > + uint32_t type:8; /**< Message Type */ > > #elif RTE_BYTE_ORDER =3D=3D RTE_BIG_ENDIAN > > uint32_t revision:4; /**< Protocol > > Revision */ > > uint32_t res:3; /**< Reserved */ > > uint32_t c:1; /**< Concatenation > > Indicator */ > > uint32_t type:8; /**< Message Type */ > > - uint32_t size:16; /**< Payload Size */ > > #endif > > + uint32_t size:16; /**< Payload Size */ > > }; > > }; > > }; > > -- > > 2.26.2