From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 554CFA0C4B; Fri, 15 Oct 2021 11:36:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD684410F1; Fri, 15 Oct 2021 11:36:04 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 3498A40692 for ; Fri, 15 Oct 2021 11:36:02 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10137"; a="227838397" X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="227838397" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 02:36:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="461518512" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga002.jf.intel.com with ESMTP; 15 Oct 2021 02:36:02 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 15 Oct 2021 02:36:01 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.2242.12 via Frontend Transport; Fri, 15 Oct 2021 02:36:01 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.170) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Fri, 15 Oct 2021 02:36:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T9Of6OcmyqM8mLHA2lonD8Iz56Gu0nZwTkESAXet1YYg6JD0HVGPtg6e5n7+pYJw16RDpIK6hTT4VB6+TQHZPa0A4mD6fN/P4/fcqybJPp8TXarFXpp6ZlqX8S7AUQrUXZw6b7w84E5VR81QAoD5VOu8Kjvyz0HwcmO+FlCM70qtGzFW1aiUkcpWcq0XHQ6yym8HyNN0Gwo2OETG0mmwHbEtq3qTdMewytSvt40r4oEeNIlmxonoepxP7yLHeWJAz8zrnFgn3FWTu24lkWbKe4m1zFIv0wtUI7FTFe/g0QD98RRnLn9+iEH8n+AeHNsuF7AH3rlpLmTwFLlwFhpMAw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8g/sWCGv48IbFkTXnBtFkL/E3itF3pK7EUrQujj2cF4=; b=UO82f7xwDFvu35I+UDOfP0ZJGv5Fml0c5InAyJx3jRoo5/Se0CVEhIwm4cBLen4YLiEdcZwDnZPTJzRSfr1q1VXlLA5+xfL0/PDogKjmaWGI2JkFZXGVS/kQY8ycPaPfu9ET2tSLFycLGg2L/qBr+stNPotgR7e+kedaJJBunyXlPQPLk7bAQztgfBe2qkEpYHaLNrWen6J451KA0cx/XJuIavDQDVuG4uQHnOlk4WOaMza6fL/KsotU1AD5MKYPnfbdBxnk0l3OdU7dgvdN5WON2rl7mWG+aMCA0PClausiOgaRIfGeMK8s47OvpNpqb4MLYR/hTcetploF9KaDQA== 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=8g/sWCGv48IbFkTXnBtFkL/E3itF3pK7EUrQujj2cF4=; b=kcNAHb+rCihKZjVuDHS/rgH8PhgkSyvko208nMwybHvgipypTDOf9yDkabERO+MkXBFtiw1I/BPfKXieJoYEzqloVqLSW32pJGy8etAXb8N68yCUCRxp2+v/IEZLEjbQNJC9lhzwMMAJo4wxRM6gpnXrAtBFADQFOJhH+wBHkZ0= Received: from BYAPR11MB3366.namprd11.prod.outlook.com (2603:10b6:a03:7f::20) by SJ0PR11MB4878.namprd11.prod.outlook.com (2603:10b6:a03:2d8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Fri, 15 Oct 2021 09:36:00 +0000 Received: from BYAPR11MB3366.namprd11.prod.outlook.com ([fe80::e0b7:5b23:adc6:8c11]) by BYAPR11MB3366.namprd11.prod.outlook.com ([fe80::e0b7:5b23:adc6:8c11%7]) with mapi id 15.20.4608.016; Fri, 15 Oct 2021 09:36:00 +0000 From: "Pattan, Reshma" To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v12 02/12] librte_pcapng: add new library for writing pcapng files Thread-Index: AQHXtuInn8TZyeDmLkKVsV8tEQh/z6vT2jAA Date: Fri, 15 Oct 2021 09:36:00 +0000 Message-ID: References: <20210903004732.109023-1-stephen@networkplumber.org> <20211001162705.442298-1-stephen@networkplumber.org> <20211001162705.442298-3-stephen@networkplumber.org> In-Reply-To: <20211001162705.442298-3-stephen@networkplumber.org> Accept-Language: en-GB, 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.200.16 authentication-results: networkplumber.org; dkim=none (message not signed) header.d=none;networkplumber.org; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e52a5eb3-0380-4bce-8b0d-08d98fbf32da x-ms-traffictypediagnostic: SJ0PR11MB4878: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tGAtHma4iNthQ0dsTon3MhxG77RQIadcHaRHk/0eqfAmmH051zCacAzOmLUToci7dHatdYqlNxbZYPE2KG0HuN4+9MOX+FXNKFk/kmcmRdcGzVkQKnbJZWBrLoma7RAXxNdUayO+ImjhiPXeupd/r75oo39G+aoTsml7YDgyeoRrpN+JPtMvhoacj4ZhW+7tPIQNgyVhsURW8sJlszkN6JVeLt3rJoc8zhU5AHBt81JVt+IMZsjx3T3SYQ/owgdz1eV6FvZZ60tKcCmEH4o48TZW3GEFGOoyi249L+QNryRmFIRdCzt0L5N8tHdBUao22Cc5FxO7zZFKlk5rbPXd2V3x3mZ95xNko9mgtnyZCRYq+V9k5QbM0WaZiUFj7xb5lc/1iCAi86sYUfRkm7pM02nLqkk000brDJh7pKvRFZY7d8FM2UzDkht+DSKl0s/zxBP6w30HkmBVw+RFcA+mdBNOWyHOqqrg4aRVJJb8FJ+mo5tRHfBftGgrblFUXSHkESQ4wACjVpSQDPUBaq314ATLKCDNJnYREojBvI5ik8W8kg2uGXx1XRtbzerBjkKXsHRJIhmFtGpaTBIskmt312KGFcGUH/AI1101Fg23sI6mEWVvW/H/FV5IgE11GzRHvIBAl8PG+C2EMf6254bULKeF5KW+S7Iv074zMLodXEgK4PeGNTTnmlMidDHPW5EChU0uxdWI3+tBeKZoi3bDn6kFxnPsEEAUV3pp6CDGjqOPsJenYZCHbmh6THDjKy5T6cCR2VBXPqOq8tSPjdJAy0n4cmz/cBwnIyOm6kKc8HA= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3366.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(966005)(52536014)(83380400001)(2906002)(71200400001)(8676002)(8936002)(110136005)(5660300002)(316002)(6506007)(66556008)(38070700005)(122000001)(186003)(26005)(9686003)(66446008)(66946007)(86362001)(66476007)(55016002)(33656002)(7696005)(64756008)(38100700002)(76116006)(508600001)(82960400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?qVD5jg53PWO0yoRiVEyM26unOBGfMbtoGTqL2Nu2UE/9Xe4rAguvOm1vDPUj?= =?us-ascii?Q?+0P+85Ul7Lg+zVurPom9LBQoeyPcy3/zufASYParRTSefewHY3kOPFQd8dFy?= =?us-ascii?Q?JzvGdvrKWFsxVpVwSwsLGGVCakoSjcQu2DBtMM64CuAsMmiGHB7YnfbNxIv2?= =?us-ascii?Q?GnmCgNLDfeJ8RJ7WmBsEDgKJkpuPFT4TKY8YVssQOWQPfszGcArJLuw9ua7P?= =?us-ascii?Q?m55Usr3bYvJkngyDa/uh9BlRVZwZZNq42ue/CUdXDcS+HpmQTqpVD73bWdbl?= =?us-ascii?Q?XIS3RzIrUGa01ap38CqA2KDKVESjt9j4oN2KmgtWsaq9crsqmUip7rsfM7yK?= =?us-ascii?Q?iJ4rpRDxN7cWcvQFUTJ+2u0+9gLw7ifMV2fmCnXcW6gLZXnx/sIk3njYazc3?= =?us-ascii?Q?Ml452hupPZY85e+eecxrRmYqfutPi3k88HqYOVchVzUpcMWnL127lcR2sJZd?= =?us-ascii?Q?+YvVw72/l3g7FMkjMZ7zERhQqQD2Ps/2DJw1mns/0RHOxBZPul/bCJR4HGkh?= =?us-ascii?Q?KtIlliYYQgWvVIIX3PE4sWDoLAQDn5Sf7JrxwRTqY4uMkSxnDFAPxwGAKgz6?= =?us-ascii?Q?wEK58GNfhZBJCEnlF+yWnEWQQXd/4knMk0DoCUjzzU1hh7ittbTxjXAnJ4aL?= =?us-ascii?Q?0Dp1unNqa2iEQN/qEEyFCd58tcEayD/E9ZdM6jSQMsqILMc45xUQO2W/W3z5?= =?us-ascii?Q?gkLv4GyBRBmB1XH8/mzsAJ69+QOSKlLGyD1258JikGzDZ3F1iUPu4FRpu1bY?= =?us-ascii?Q?3KD+bJu8IAfda3SP/n9voXQdmPUEo0KkrkXeNDSFIk8HgEHguimRfVa9KELz?= =?us-ascii?Q?hz0B507rYWUf534FWLMbuvxoDqeFa6ctMx54u558iWTurh64yyms6d9cXrik?= =?us-ascii?Q?b9sG/Jp/l5EHggUSGss05pb70w5F4dlQQTcTQX/7jwXXJfs4sstIAziue+Z9?= =?us-ascii?Q?qNKSS6HJWZMjC66IDitzpBzXSz682qPiQXf01CA1Y6KMn2LzCyg31bCIoyHS?= =?us-ascii?Q?ly3Zof2g0f3PWTYOVkdfa/9sfWULqJ8UM/+4Z5LXqxOkOgni2a15E6wQ7pb2?= =?us-ascii?Q?vSALElVij5+34Ktui6lrAg1MWfaP7gRRIRUNusIRDP/54EHqYy+6hnBsdamP?= =?us-ascii?Q?ic5YO5VYb1tEFk+XSjgOTQcNQJJndR6g0SQP9LGXHB6fO8Ak+DdIS4du0QBC?= =?us-ascii?Q?8xtsvK308zF73vLuL6rS5+D9IY22mIUaFDI9yOArEYbAczMfRDd+uikpyCfm?= =?us-ascii?Q?j4VbAiBNo4tUuI5VtU/0wMRTmfEDRKVxsI+IkF54LF93N+8qk5I7pc5COiiL?= =?us-ascii?Q?dhD0Zl4RoOT2+yFdEDIipHMd?= x-ms-exchange-transport-forked: True 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: BYAPR11MB3366.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e52a5eb3-0380-4bce-8b0d-08d98fbf32da X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Oct 2021 09:36:00.2835 (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: GiN6ZxNAxhmiQwE3lfwiFq3raylS+TcWghcK249NEc03Zr2ei3fvP8ACx7QwKJ058Dy0HSHJCDOXAkwJ588pJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4878 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v12 02/12] librte_pcapng: add new library for writing pcapng files X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > -----Original Message----- > From: dev On Behalf Of Stephen Hemminger > See draft RFC > https://www.ietf.org/id/draft-tuexen-opsawg-pcapng-03.html The page is not found. Might need to add new link I guess > +enum pcapng_interface_options { > + PCAPNG_IFB_NAME =3D 2, > + PCAPNG_IFB_DESCRIPTION, Can IFB(interface block) be replaced with IF(interface) only? But that's o= k, upto u. > + buf =3D calloc(1, len); > + if (!buf) > + return -1; How about returning -ENOMEM > + > + hdr =3D (struct pcapng_section_header *)buf; > + *hdr =3D (struct pcapng_section_header) { > + .block_type =3D PCAPNG_SECTION_BLOCK, > + .block_length =3D len, > + .byte_order_magic =3D PCAPNG_BYTE_ORDER_MAGIC, > + .major_version =3D PCAPNG_MAJOR_VERS, > + .minor_version =3D PCAPNG_MINOR_VERS, > + .section_length =3D UINT64_MAX, > + }; > + hdr->block_length =3D len; Why to assign block_len with len again? as it is already done few lines abo= ve. > + opt =3D pcapng_add_option(opt, PCAPNG_OPT_END, NULL, 0); Some comments around this code, about adding end of options at the end of o= ptions list would be helpful. > + > +/* Write the PCAPNG section header at start of file */ static ssize_t :s/section header/ interface header? > +pcapng_interface_block(rte_pcapng_t *self, const char *if_name, > + if (mac_addr) > + len +=3D pcapng_optlen(6); How about using RTE_ETHER_ADDR_LEN instead of 6 > +struct rte_mbuf * rte_pcapng_copy(uint16_t port_id, uint32_t queue, > +fail: > + rte_pktmbuf_free(mc); Freeing mc , would that take care of freeing up the additional byte prepen= ded after mc creation? > + opt =3D pcapng_add_option(opt, PCAPNG_EPB_QUEUE, > + &queue, sizeof(queue)); Don't we need to add end of options to the end of option list, like did in = Interface block and section header block? > diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h new file m= ode > + * > + * Packets to be captured are copied by rte_pcapng_mbuf() Do you mean by rte_pcapng_copy()?