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 3D479A0C45 for ; Mon, 22 Nov 2021 08:28:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05C9C4003C; Mon, 22 Nov 2021 08:28:47 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2084.outbound.protection.outlook.com [40.107.20.84]) by mails.dpdk.org (Postfix) with ESMTP id 078F04003C for ; Mon, 22 Nov 2021 08:28:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U3JUYzp0dQGf4jFITg3cxzOfZSXE6m9HlEkcCrcJ28juCIXQn3yVBYEKLCdSW24DJujqsvBRfdjqbt4mjdSmaBHswy2zwzYdA5X73e/dmS4Wfhdicqp7AcgYGgBiBbPqtsaNWS2Rb/4GLRNciFn5ser1KwtAwr7lnqhLilDK6bSUxM0oaN8fk058SfuaVHmw+ZevJzJJtXdlv47FvrJBLPCeLdaltx4l1RNFA6xvaXhTQ/EFf5QSt7P6Hpv22t0IT/KUxlgXO4jgcfCfztwFY2A8w1GiTbNLCZ41gU5F4OmTVcNeSBRVy69xSVozPkucrpNWaOHNrn3WYdMMoFLCjA== 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=khd4gZDEmax2YRUsmyoTv+LVg7bs1EAdrCHNoJsSE1Y=; b=FGbtn2/Ux2xwxCdPdKNlsoEsfCaP7XWjw+Xlxp1YYIy2S1ccz/Rx8MYD+9eD3uJkBsaSkTsmKXoKDg0rI1DCqaj+5rxQQhRU6SySyz0YIKQvh0bLygwEPce36i65SlnOxbgsQi7+OQjk2V1drXqkAtqvWuiBeQqVgv6IYVqKgGBIOWeONhfzCHSqFgpZtZbQrbbnlo+UN55yM5B11NPYUbJRI8UnSqQO9dtm3WM4hTBTcoBO38OG3KvblA8AhMs659L4Se67L7OOTj+euZUPLh+UiUH1wfn7fzXYcI5foQCk+U+OMyaWVne9gROXnw5lJUZs+HRee9Diw/VHlHBdWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=khd4gZDEmax2YRUsmyoTv+LVg7bs1EAdrCHNoJsSE1Y=; b=PovsqBLBRE48CY8kTseNZ6R851CRFbgBIUzFy5uiTyhR0DukTQmyzvdXJR1oAF36M9ByDUgzjev+YXQF0/b3ObwweBxxfBE1L6lATFHk/G5+i/glFZrtCxDvMWLpKfsiueAVxuxS0ePNv9Ke0Uc+5G/+YwCyogXGmMuvw2ild1w= Received: from AM0PR0402MB3938.eurprd04.prod.outlook.com (2603:10a6:208:7::32) by AM9PR04MB8381.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Mon, 22 Nov 2021 07:28:44 +0000 Received: from AM0PR0402MB3938.eurprd04.prod.outlook.com ([fe80::741c:df49:1ee4:2a05]) by AM0PR0402MB3938.eurprd04.prod.outlook.com ([fe80::741c:df49:1ee4:2a05%4]) with mapi id 15.20.4713.025; Mon, 22 Nov 2021 07:28:44 +0000 From: Vanshika Shukla CC: Nipun Gupta , "david.marchand@redhat.com" , "stable@dpdk.org" Subject: RE: [PATCH] examples/ptpclient: fix delay request message Thread-Topic: [PATCH] examples/ptpclient: fix delay request message Thread-Index: AQHX23sYl8JQJ9iA7kGIdKkZaeMDG6wPEHoAgAAdn3A= Date: Mon, 22 Nov 2021 07:28:43 +0000 Message-ID: References: <20211117061853.20979-1-vanshika.shukla@nxp.com> <20211122054222.4604-1-vanshika.shukla@nxp.com> In-Reply-To: <20211122054222.4604-1-vanshika.shukla@nxp.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1a0b3b7a-a0e4-4ae0-1411-08d9ad89b6f9 x-ms-traffictypediagnostic: AM9PR04MB8381: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /mYaPQip+qzs33d6AqvPuy8iHbWkvjUuYanGDXskakiFpr3fYlqOwd86wFjgE2Uaobi6/JJ/I/NHzXx7L8JdgilGvXTndWokpqF3X5V9XDJfLg3QiAaCA7f4AvMnyEgaDTWPyxuhtpebk1/1CoRXoVcH3D/bDh+Tsn+dQiADZYbrusQ4oewl/WNVuZ1zwQTp5dj3iP+rQQvukxMtop5C1oSzP+r9YYE6mpAQYKRZyZ0Fq+wqLWA9nFBFDya1v1Dc4BoFoPBygh6JeRQJHS8+PQYxrJDRYWl1kTKXNtGZn8s8BXSm8KTL5zjspEvrnVpzzBpD7Lkp5uyJ1bNwMB+GgQk5wTjbTAqz84KlWx87jSzq1267SyQnO4GNJhHULBziTo3NMJvca83GkLMicA79S+URXmLF2ndCWpJdgrNSjkGjdledrnFZOj4kz1xJXyqMoLzl7NRVd35Q9wdvDtm2Zf+T73bs57zMJV5sHyYhwnJLwM1/MOK/csVBjaXmaDSuTqnfYKltZRGB30CrCX3OEUicqltwxOC/c1Z12mLjnXD614HA+Io5Epzr3Xui7bSP9QY4JKT22QhtUUKspF2Q+TL3p7HZYFJ2P/oeOHoXmT5ewnUHNUCa6/V3xBaUJ7homYq6sm/AtkgYIIF3PDTYsjrirE6+gKcp7VvcRD1C6yOS31AwtlFY+yJHG9C6H/wCo652O9PqnjFgvyU8LoTxhg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR0402MB3938.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(2906002)(38070700005)(86362001)(64756008)(15650500001)(66556008)(66476007)(66946007)(4326008)(52536014)(6506007)(55016002)(109986005)(71200400001)(83380400001)(44832011)(38100700002)(186003)(33656002)(8676002)(66446008)(5660300002)(76116006)(54906003)(7696005)(8936002)(122000001)(316002)(508600001)(9686003)(26005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nXccL4P4h+wwNSuvqNmFb4+1g88LVxOBY6/15NO5jboMOQhEwrhecP2jf6om?= =?us-ascii?Q?qUq9NEQJEvqyLhkIMRsqOPJjisw2Ooqa5utjIbVq+ZivHKW1ZbpDTguYBT/t?= =?us-ascii?Q?IsCyJEXtscsqQRfWoAUTBQLRc4cwtatJor330CJfgPX6FmQrKFrtNGAcC6mr?= =?us-ascii?Q?VjyKNIqg9j2pJlTlkO5j1u00VMNn2TTZUM82+9L8zua6n03qXEhAY4bjCnGE?= =?us-ascii?Q?GdR7FuzjocS+rmqGDGDEnjRvyUa4KhEHXUU4RJ6GJdWPNHfZ+PCmRy0Eyc+p?= =?us-ascii?Q?uuyBljmuRsJnTucDOrge2tMIXThopZx1Wnba5lm7+6Hj6IAxR6tHYmANJ/Gx?= =?us-ascii?Q?l482A3skDB0I1jtHs/VFjKnU8F+vgFSViRHt4fWLLM6nmkb4tyFPR3YwnqJW?= =?us-ascii?Q?Efh3ZUksGDSpF2dmA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O9?= =?us-ascii?Q?2XFhqeoo5HQBvqnjoOO3TJQX3jtxcA/ZZSFJ+dQ6VwJ04HAwLA2Ko1Aveoew?= =?us-ascii?Q?Lknx/bxRgcTxzNPBoxPzF0MFgJfbKKGPja/73UgPZ18d9alUXd3I5Ex0PAT3?= =?us-ascii?Q?0nWuTx4kIZUDCy+lDbHIgllpiygVUF3UT/owtM6h++EsHVx91BMo9LAropfK?= =?us-ascii?Q?Tjogt+buzpB7H07ShoujzbVCZyMdfN25c+HWtScLIHamru4SWrgAAVoYmMQm?= =?us-ascii?Q?v1oasJc98L+BtB0Bt5RE8MUVbkU75HwCS/HPM7fQ644THpSbqPJWRcnPb86f?= =?us-ascii?Q?mA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR0402MB3938.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a0b3b7a-a0e4-4ae0-1411-08d9ad89b6f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2021 07:28:44.0108 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Q6yf5IMpO9kmEvSNdhpi0vjT4qrLtcxLjsBBE7gkcPM3Sd5MxJVKt50JCmEUm+9kkgsBWQnOsWLKcfPwgqEFfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8381 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Please ignore this. -----Original Message----- From: vanshika.shukla@nxp.com =20 Sent: Monday, 22 November 2021 11:12 am Cc: Nipun Gupta ; david.marchand@redhat.com; stable@dp= dk.org; Vanshika Shukla Subject: [PATCH] examples/ptpclient: fix delay request message From: Vanshika Shukla The size of delay request message sent out by the DPDK ptpclient applicatio= n was observed to have extra length than expected. Due to this, bad message= s were observed on the master side and delay response was not received. This patch fixes this bug. Fixes: ab129e9065a5 ("examples/ptpclient: add minimal PTP client") Cc: stable@dpdk.org Signed-off-by: Vanshika Shukla --- Changes in v2: - Added a check on available size in allocated buffer - Created the right type of pointer when sending DELAY_REQ packet examples/ptpclient/ptpclient.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.= c index 354c7b2c90..de799f698b 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -386,6 +386,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) struct ptp_header *ptp_hdr; struct clock_id *client_clkid; struct ptp_message *ptp_msg; + struct delay_req_msg *req_msg; struct rte_mbuf *created_pkt; struct tstamp *origin_tstamp; struct rte_ether_addr eth_multicast =3D ether_multicast; @@ -423,7 +424,1= 2 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) =20 created_pkt =3D rte_pktmbuf_alloc(mbuf_pool); pkt_size =3D sizeof(struct rte_ether_hdr) + - sizeof(struct ptp_message); + sizeof(struct delay_req_msg); + + if (rte_pktmbuf_append(created_pkt, pkt_size) =3D=3D NULL) { + rte_pktmbuf_free(created_pkt); + return; + } created_pkt->data_len =3D pkt_size; created_pkt->pkt_len =3D pkt_size; eth_hdr =3D rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); @@ -4= 33,22 +439,22 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) rte_ether_addr_copy(ð_multicast, ð_hdr->dst_addr); =20 eth_hdr->ether_type =3D htons(PTP_PROTOCOL); - ptp_msg =3D (struct ptp_message *) - (rte_pktmbuf_mtod(created_pkt, char *) + - sizeof(struct rte_ether_hdr)); - - ptp_msg->delay_req.hdr.seq_id =3D htons(ptp_data->seqID_SYNC); - ptp_msg->delay_req.hdr.msg_type =3D DELAY_REQ; - ptp_msg->delay_req.hdr.ver =3D 2; - ptp_msg->delay_req.hdr.control =3D 1; - ptp_msg->delay_req.hdr.log_message_interval =3D 127; - ptp_msg->delay_req.hdr.message_length =3D + req_msg =3D rte_pktmbuf_mtod_offset(created_pkt, + struct delay_req_msg *, sizeof(struct + rte_ether_hdr)); + + req_msg->hdr.seq_id =3D htons(ptp_data->seqID_SYNC); + req_msg->hdr.msg_type =3D DELAY_REQ; + req_msg->hdr.ver =3D 2; + req_msg->hdr.control =3D 1; + req_msg->hdr.log_message_interval =3D 127; + req_msg->hdr.message_length =3D htons(sizeof(struct delay_req_msg)); - ptp_msg->delay_req.hdr.domain_number =3D ptp_hdr->domain_number; + req_msg->hdr.domain_number =3D ptp_hdr->domain_number; =20 /* Set up clock id. */ client_clkid =3D - &ptp_msg->delay_req.hdr.source_port_id.clock_id; + &req_msg->hdr.source_port_id.clock_id; =20 client_clkid->id[0] =3D eth_hdr->src_addr.addr_bytes[0]; client_clkid->id[1] =3D eth_hdr->src_addr.addr_bytes[1]; -- 2.17.1