From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20043.outbound.protection.outlook.com [40.107.2.43]) by dpdk.org (Postfix) with ESMTP id BB36F493D for ; Tue, 13 Nov 2018 14:21:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6CvciQp8QIVLaq2tVrWQMhuiiw48lmEBLkrjA/+Q7cg=; b=ESC+OBOBC8Rtj22igihiMGhtKwcur6XyPcgDq09Ks9/7Ht1xqOEBAdpYlr0715xngdGzvHLKBU2Qgpms4NIdCvMSsJg4QgEtttLrS0W/EgpFw3EEiuxUQkebzDdtqFIYM0DEUajBuyx1fPhrHwZkubGoTcfOtVH2G2k+Nud9I7A= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4891.eurprd05.prod.outlook.com (20.176.235.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Tue, 13 Nov 2018 13:21:34 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::bc22:c2f5:208d:826f]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::bc22:c2f5:208d:826f%2]) with mapi id 15.20.1294.044; Tue, 13 Nov 2018 13:21:34 +0000 From: Shahaf Shuler To: Slava Ovsiienko , Yongseok Koh CC: "dev@dpdk.org" Thread-Topic: [PATCH 2/4] net/mlx5: fix Netlink communication routine Thread-Index: AQHUesKHlrwexhli9EKNbB5Nn5zr7KVNnPiA Date: Tue, 13 Nov 2018 13:21:34 +0000 Message-ID: References: <1541225876-8817-2-git-send-email-viacheslavo@mellanox.com> <1542052877-41512-1-git-send-email-viacheslavo@mellanox.com> <1542052877-41512-3-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1542052877-41512-3-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4891; 6:ocZPEIWqlx/gK9HWSkFtKmQu9TYL8afO5gNwTc/2GjzBEl1gUxQ1QL1bOu5vEOcowf8veObfRm/tYopMLMN6wfpoHBZKQEf4Iaukhj8cnDtt4X6Y082rqozlumiy5a5evJow4BsHVsJaE157vWeVcOhsTXk5yPIl2YJXYwVrATUl6klKRNx0zhUwgMuefcPQzuKMAO9d05ZFGzky9M4rHGsXrYlXgdKy+opRrP2ArwQ1/BhObWUW4WCD1xInc7HoRs2qrkOX5Hx7Q1y7jwUvUtXMAQ1oU3HkpY+e93c4b4TVMgVlPlbSgPBgAlXx6lIhvYDBz09BqljbFFwUV9wsioh0PaPMCPV7C79V7lEHEJ2HAGpIljCGU0ABSDUhunAvlhJViOrgbi5aXVZFDNU72/N1udkp6cpbQtjf5ILSyynYXauMemWFdRPFDr679rPRJS5+EnKImry1UGclbL3VLw==; 5:gNXpnPNQ1C8QyFq8YDKhX2nItpiPUTI+iyjTQxiW8KVmmGH1mMUAvns2pkmYJoNYbWNr4XKlBE8FijAD5euTFCwL5+bvSmJAGPvyWYA9nWGt/lPM2Q+Po++Ud+V2cUGB5XeYY5LpzFryBEZ6AUKgTAb/tbidH+pWSqPs3x0yowQ=; 7:atHChY5rMofRyMlU21FI2/m5ZvNHgqh1+12l+8AcTbfJ3cn55Zz757RUY4TitebSXJe0Yegcjtpi3OvTAEo+ioSa1BdpcwLg4+67VbRv2HhyRfz8qfHOpij2AQ1jnghA/vwiKqNMu4wfz2PKa4bQHA== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 2c9e3559-98a6-4c30-5afe-08d6496aeefc x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390060)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4891; x-ms-traffictypediagnostic: DB7PR05MB4891: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231406)(944501410)(52105112)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:DB7PR05MB4891; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4891; x-forefront-prvs: 085551F5A8 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(136003)(199004)(189003)(33656002)(6436002)(6246003)(55016002)(7736002)(256004)(305945005)(476003)(446003)(11346002)(14454004)(486006)(9686003)(53936002)(76176011)(74316002)(7696005)(105586002)(102836004)(6506007)(186003)(26005)(4326008)(99286004)(6636002)(71190400001)(106356001)(71200400001)(2900100001)(14444005)(86362001)(478600001)(25786009)(6116002)(3846002)(8676002)(8936002)(110136005)(81166006)(81156014)(66066001)(316002)(229853002)(2906002)(68736007)(5660300001)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4891; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: aelVTso+Ulu+o/t3zoYi+PkE/CygjdT4+yp5AGCoekAMeWqw2K8jsFFEWFna7p/JopfUNP/uTuURFeCoWy5TyCHi8Outba8EcywjceuxgfUUCLWssaQ9JqAYOcFG9/lAE6Vv2wWnVdBzJ1B/yufrHieRxMgvD2s0LHoMe1QpyFZh1GYAgoZNCPrXTs8DGInI1EDj+a0tosih9SHV45WdkQ6RYc3bR1v98p1YDIAbV4OvAId5uQ08/jyNrJ0DuRHZgpp94LGFylnuE6PihsZr4/GhI+VOt2Sqbo8aFX79C+/s8iuaA/cp+0rUl+MLG43pDPg99rnGxFUUFmSa8UFXW+sriXqcYCyF4jjgp5o4vqM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c9e3559-98a6-4c30-5afe-08d6496aeefc X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Nov 2018 13:21:34.3286 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4891 Subject: Re: [dpdk-dev] [PATCH 2/4] net/mlx5: fix Netlink communication routine 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: Tue, 13 Nov 2018 13:21:36 -0000 Monday, November 12, 2018 10:02 PM, Slava Ovsiienko: > Subject: [PATCH 2/4] net/mlx5: fix Netlink communication routine >=20 > While receiving the Netlink reply messages we should stop at DONE or ACK > message. The existing implementation stops at DONE message or if no > multiple message flag set ( NLM_F_MULTI). It prevents the single query > requests from working, these requests send the single reply message > without multi-message flag followed by ACK message. This patch fixes > receiving part of Netlink communication routine. >=20 > Fixes: 6e74990b3463 ("net/mlx5: update E-Switch VXLAN netlink routines") >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_flow_tcf.c | 58 +++++++++++++++++++++++++----- > ---------- > 1 file changed, 37 insertions(+), 21 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c > b/drivers/net/mlx5/mlx5_flow_tcf.c > index 5a38940..4d154b6 100644 > --- a/drivers/net/mlx5/mlx5_flow_tcf.c > +++ b/drivers/net/mlx5/mlx5_flow_tcf.c > @@ -3732,44 +3732,60 @@ struct pedit_parser { { > unsigned int portid =3D mnl_socket_get_portid(tcf->nl); > uint32_t seq =3D tcf->seq++; > - int err, ret; > + int ret, err =3D 0; >=20 > assert(tcf->nl); > assert(tcf->buf); > - if (!seq) > + if (!seq) { > /* seq 0 is reserved for kernel event-driven notifications. */ > seq =3D tcf->seq++; > + } > nlh->nlmsg_seq =3D seq; > nlh->nlmsg_flags |=3D NLM_F_ACK; > ret =3D mnl_socket_sendto(tcf->nl, nlh, nlh->nlmsg_len); > - err =3D (ret <=3D 0) ? errno : 0; > + if (ret <=3D 0) { > + /* Message send error occurres. */ > + rte_errno =3D errno; > + return -rte_errno; > + } > nlh =3D (struct nlmsghdr *)(tcf->buf); > /* > * The following loop postpones non-fatal errors until multipart > * messages are complete. > */ > - if (ret > 0) > - while (true) { > - ret =3D mnl_socket_recvfrom(tcf->nl, tcf->buf, > - tcf->buf_size); > + while (true) { This while(true) is a bit disturbing (I know it exists also before). Can't we bound it to some limit, e.g. is there any multiply of tcf->buf_siz= e that if we receive more than that it is for sure an error?=20 > + ret =3D mnl_socket_recvfrom(tcf->nl, tcf->buf, tcf->buf_size); > + if (ret < 0) { > + err =3D errno; > + /* > + * In case of overflow Will receive till > + * end of multipart message. We may lost part > + * of reply messages but mark and return an error. > + */ > + if (err !=3D ENOSPC || > + !(nlh->nlmsg_flags & NLM_F_MULTI) || > + nlh->nlmsg_type =3D=3D NLMSG_DONE) > + break; > + } else { > + ret =3D mnl_cb_run(nlh, ret, seq, portid, cb, arg); > + if (!ret) { > + /* > + * libmnl returns 0 if DONE or > + * success ACK message found. > + */ > + break; > + } > if (ret < 0) { > + /* > + * ACK message with error found > + * or some error occurred. > + */ > err =3D errno; > - if (err !=3D ENOSPC) > - break; > - } > - if (!err) { > - ret =3D mnl_cb_run(nlh, ret, seq, portid, > - cb, arg); > - if (ret < 0) { > - err =3D errno; > - break; > - } > - } > - /* Will receive till end of multipart message */ > - if (!(nlh->nlmsg_flags & NLM_F_MULTI) || > - nlh->nlmsg_type =3D=3D NLMSG_DONE) > break; > + } > + /* We should continue receiving. */ > } > + } > if (!err) > return 0; > rte_errno =3D err; > -- > 1.8.3.1