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 0DBD5A0C4C; Tue, 23 Nov 2021 18:40:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7CED040040; Tue, 23 Nov 2021 18:40:01 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140088.outbound.protection.outlook.com [40.107.14.88]) by mails.dpdk.org (Postfix) with ESMTP id CC2CF4003C; Tue, 23 Nov 2021 18:39:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U5VlHEElfpA/DcjEVsrSxYDn56+9VJ7p+cZt+/lvviXIoHifKQCHLy0s5kAfmcvPBRN8HpLctIyL5EO53wj7tEwPht9v+brcs0BFtFpLps4VHO3LwFQ4sJd9Rq+En+drQlvnf0GYIlqCGv/Cvp9XAB7IQ5fvntI0UEkAIIzw0FFTEbN3OY2S9JuYJ1qQ540yBZR+ylNbTDrM+Uy5lC5YNmIcU8OBfj0F97ELaltqmLtYEG3SfS3hu30Y4ejV4dea27Wfd5GD4fqRMZUuagsBV1SFtFMgRib5RidQcK7SuiAL7D4HfQmCId8MkyjL7qCgh2CdeSe4238qi4F5f0hMaA== 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=8AT1zwR1uoiRIAE/7lgOB3NLMUnr+A2HsoEPWaVtcjk=; b=ORGZqVNH7jczkZhGWmuWQfepO1pIPbs8I8uK9EupT7cnuh0sadJh3AVCHlAgxhsgbCOOmP1Th3RzmoDFnuvVPtv6akqkM6ea+JIkeeOMHIKUdG+b/9GuSFvDDsnq++GgZu3F2ZvC0D2xju8WrBqpHmK/w6CycDeWY0ax2sMOqwdMvxikAYc4SSvLjYMtaRFQNz4jsCklMv1avL2p9QAjO5EXwbOFZcLCCgZ/M6MqmGQSdlYYFdUuuzZxWf6rJuXZpr4zJrycJNN6taj7i1tcACZx60XSKGVe/kjA4NScu503q8k9HzTeDtJhMg8Q2wtprtNmlWq7ORHkiEtIok9u2A== 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=8AT1zwR1uoiRIAE/7lgOB3NLMUnr+A2HsoEPWaVtcjk=; b=ElUw9Nk07B0Po/Y1f5qMYc2c2syZ4D7PQEFlEYAzHBv/IftFqBpt16e28tqEgbBnfwrv0QBr69qBU6f0Qhv5It8JOvufRLLQoj3ugdgVMLfcO3lxZDXoDPC+uR8rHkVZpM5BkR/f+KkZ7/hJIgyswbjOCeGppL4dfXrTTai8tbo= Received: from DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:24e::23) by DBAPR04MB7333.eurprd04.prod.outlook.com (2603:10a6:10:1b2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Tue, 23 Nov 2021 17:39:58 +0000 Received: from DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::c94c:cbd8:dee0:70f6]) by DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::c94c:cbd8:dee0:70f6%4]) with mapi id 15.20.4713.026; Tue, 23 Nov 2021 17:39:58 +0000 From: Nipun Gupta To: Vanshika Shukla , "dev@dpdk.org" , "thomas@monjalon.net" CC: "david.marchand@redhat.com" , "stable@dpdk.org" , Vanshika Shukla Subject: RE: [PATCH v2] examples/ptpclient: fix delay request message Thread-Topic: [PATCH v2] examples/ptpclient: fix delay request message Thread-Index: AQHX33L1FpCHaoMK3kugkoMiCRYd/6wRYyTA Date: Tue, 23 Nov 2021 17:39:58 +0000 Message-ID: References: <20211117061853.20979-1-vanshika.shukla@nxp.com> <20211122073122.10052-1-vanshika.shukla@nxp.com> In-Reply-To: <20211122073122.10052-1-vanshika.shukla@nxp.com> Accept-Language: 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: 1f5f9cf2-24b3-428a-215a-08d9aea84516 x-ms-traffictypediagnostic: DBAPR04MB7333: 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: DCF1/Sb0nWqnq/p6ab6tfnYq7nesfD4Nh5ZUKk0K1vO86uoKmjyx7HZ5A1aFyB/9X6kGIQedIzEDinw7jjbBabILO/RYSWVzctAym7XPQ0sjOdtGT5TSd1WFIOWF//+BrPvtgkYtUWcGirY2XCktrNDl+VTvdnNAfMcWQQwoqPn+YH7jtawdVgnrHeeeR8eK+OsbRKy1wvFXWKPq3VDE/nUkL7S4BXTSZ/MFka5dAJRq2et0widFY4ojl6fADIeGgWhLZG+PZk4ZPodgq3Oadr5cq22pGZxHSXW/7bK9pZKqrGaXi3cecE8MT75xlZfETY8QMAYHaOjM3nmrs93j+b0x6mKT5w3Nx5kmRXEnqR014+WB8zUf6Etona532Y+qgXexwuRMfqs1uPWClyhtVYTOOp0nKPof8s4XtjEO3MbZ452M+XKnZwEoyzQwNU1NjURREzQ4aeSF13ZWGJ22ctmCFnb/hisvCJaNcK2/g59Sv7ggQLMs/AbYeAFAXl3BdNjec6olSN57XiEXAN+PiJueeH89YwNLJCnNWDl9mTucAeLC9zMCXQoO5dc/HPODI08IJeIaXpkCIvTK8geQrkQKGYmmy3YwOyaVZpKqEWZHhP6u0dL+mzib48GbXmgliVgQquSsLEFycRApy3jxAA9y6rarPeJN1IX6SZWT2z4BeRPJ7ghDtilfRvOsiYdhCODvyaVH3lImypHf/kubAg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR04MB8429.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(86362001)(44832011)(4326008)(71200400001)(38100700002)(66446008)(7696005)(110136005)(122000001)(55016003)(54906003)(64756008)(8676002)(8936002)(38070700005)(2906002)(15650500001)(53546011)(6506007)(316002)(26005)(66946007)(66556008)(66476007)(5660300002)(55236004)(83380400001)(9686003)(33656002)(52536014)(508600001)(186003)(76116006); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wVzmaM979/4KwJIJDvuVJdoFKAPVfyDFzQUlch5vBYdml/xQblrhCqYKtbb5?= =?us-ascii?Q?zWmSKXE/Ii0oSvbOcAi6zAZ7n2O6icsjyk6UJnif6au1emq14XdxRWfIxnYZ?= =?us-ascii?Q?fejL7jG/TMrK3L4yA2cSEXSfydjlLiahcLosHe06NQ+dEqyEBUYOKVu4os49?= =?us-ascii?Q?gotvkOWl0Y1wlzTX+0pGnmQHEbHEm2UTQD/LskA840wsXUechxndYeVUoY5S?= =?us-ascii?Q?2KRprqBw5y2PgrRAksOxLP0jumaOtsFMbVqgHNTpVCWKSuxUrP/tONVIihXP?= =?us-ascii?Q?JE380Wxh6+2kt/2B3nro5OvMH+9QvPXGf3bo2G/gosgT72R1V+p2LEpQodqw?= =?us-ascii?Q?TQ2u42PfxkMaZWwxeXX1JZrAxvSPF0u8WLNF36G8e106o3pNLfJrdu7iQogw?= =?us-ascii?Q?ANwBSXtA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-ascii?Q?ofWUhafUgjFjO8TTLQcr/BO1zY1ZnXmRHQFHzeBuQlkFrAEq2XNc1vJvcKeS?= =?us-ascii?Q?spG7EVq69HFhagiMsVeC0VhCFlHi+RijsiHqC53UkaU+VnHP6BwQy3xk5+Ae?= =?us-ascii?Q?8ptMhrFzcUiQ9U2+/zL98KD1HiNSW/Evxr1BdZXYHedQaFXrglML+oA+aM3S?= =?us-ascii?Q?/8cB7XirBq/CsT4PLTLCjKTLUwOyS8P/XzGTd/M7zAWiEHGVrcLczCaDaNIH?= =?us-ascii?Q?/3NFyBY/EWy5/1N9Zy6a41a3+7bAnJd1g1ebSTlY5dIKQUscki8LV4ZvCQLn?= =?us-ascii?Q?rw=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: DB9PR04MB8429.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5f9cf2-24b3-428a-215a-08d9aea84516 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Nov 2021 17:39:58.5666 (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: BMestBiUIAKLuh4nSKshuuaDgkpQOLwSrAXG1vtBC+Is77QHGJ9J6Nt98501p/Ch268XjQPU2CTM0fdnBTtcig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7333 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 Acked-by: Nipun Gupta > -----Original Message----- > From: vanshika.shukla@nxp.com > Sent: 22 November 2021 13:01 > To: dev@dpdk.org; thomas@monjalon.net > Cc: Nipun Gupta ; david.marchand@redhat.com; > stable@dpdk.org; Vanshika Shukla > Subject: [PATCH v2] examples/ptpclient: fix delay request message >=20 > From: Vanshika Shukla >=20 > The size of delay request message sent out by the DPDK > ptpclient application was observed to have extra length > than expected. Due to this, bad messages were observed > on the master side and delay response was not received. > This patch fixes this bug. >=20 > Fixes: ab129e9065a5 ("examples/ptpclient: add minimal PTP client") > Cc: stable@dpdk.org >=20 > 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 >=20 > examples/ptpclient/ptpclient.c | 32 +++++++++++++++++++------------- > 1 file changed, 19 insertions(+), 13 deletions(-) >=20 > diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclien= t.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,12 @@ 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 > *); > @@ -433,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