From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80089.outbound.protection.outlook.com [40.107.8.89]) by dpdk.org (Postfix) with ESMTP id 96CF04CA5 for ; Mon, 12 Nov 2018 21:01:41 +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=5P8PW36CvtoIgORzVqz61rxDlvLX79BqXVoqaaKB2f4=; b=w8dp5iOurGssssu1d+0mgeb3rTmzoNZA7lzWf0CwbzQuHzqWa6hfN8WLPxoLnBzk30Bf6WSpocI877SWhmL8ilAGJ0Jd4YXkcRfcJNYFB2EYN9MsWfH7t3ZTmnRct398d41I2xaXOFA0BoF5E+08G76PGWwe54qGpjiGtyEokSA= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.186.150) by AM4PR05MB3377.eurprd05.prod.outlook.com (10.171.187.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Mon, 12 Nov 2018 20:01:40 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::544b:a68d:e6a5:ba6e]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::544b:a68d:e6a5:ba6e%2]) with mapi id 15.20.1294.044; Mon, 12 Nov 2018 20:01:40 +0000 From: Slava Ovsiienko To: Shahaf Shuler , Yongseok Koh CC: "dev@dpdk.org" , Slava Ovsiienko Thread-Topic: [PATCH 2/4] net/mlx5: fix Netlink communication routine Thread-Index: AQHUesKGE1AKtqM02Uml+gaw0faa8Q== Date: Mon, 12 Nov 2018 20:01:40 +0000 Message-ID: <1542052877-41512-3-git-send-email-viacheslavo@mellanox.com> References: <1541225876-8817-2-git-send-email-viacheslavo@mellanox.com> <1542052877-41512-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1542052877-41512-1-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0161.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::29) To AM4PR05MB3265.eurprd05.prod.outlook.com (2603:10a6:205:4::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3377; 6:KHWGkUHwfp0Wy0kAbRJDiksK8gQrCxAQfBLO892j+CAnn0QWeI+6YIGU33rbriA881n9TQ7inDblR0nKKQpyrLmxlorE/fC5yyBBFhTkm/mTphlFwXdqTYPQm+tqLSwdhZ9pAufcdDpNLcyKsJHIODClfOdpPX49IxaC5og34oL/yuaC/wYlIgQxerEwwmtFJHKNtbMrqWo36B1Rt9gHxq82TaV/cL4QyHHAo7MjLn55e2aAu+yG69bsIGctDgKWg7dYsjABhErFEcpb78pemz3wGcBPrGFInNZDVzDtF9yy37gf+pTg9yO7HmM9nRHwSNgJ1Vt9ZmVq4JYpf2bdq6koFraSjT0gMC4CXxGI6xLCjk8TPilqr4nB0PsMYOoiTi5BiNvx/yhNNij6VCtEGwQXAsY0QxVgb1mvmDShYKJECQNZG/xfwHBg768xzTYU1xiM4J0iH31m0Jy8UT6lSA==; 5:5jOGlVxP1UEE0VaGg4Dtn7+7DGZkGVfgb/hBEEkmJ3YCfoVPa8h1mSoeYteTDDmsZsGmFRAtSWf/q2a/fvfDyyYL73RpBCTwZDsXJd48vZJeGKEINQmEPnk+JAf/eKw/w0FwxYJNioWJ+MNlZZ9juxPcXRIiL9pq5KGfy0fZVf8=; 7:uolDrbGkNOf16rospolSqgmo9wbJgmkFbdsDhdE0UoCjHya8AWsbpHilXV8x9IZKsxd0UKdHQfZZDohKM4USrp5cLaP1Ly2bfmnY8kL9GXF72g3nxTF2KWOLfzvtDA8BRlitXpiXyVGfzba2tEd/tQ== x-ms-office365-filtering-correlation-id: 0773cfda-9a25-4eea-e602-08d648d9a93c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390040)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3377; x-ms-traffictypediagnostic: AM4PR05MB3377: 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)(8121501046)(5005006)(10201501046)(3231382)(944501410)(52105112)(3002001)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3377; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3377; x-forefront-prvs: 0854128AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(376002)(396003)(39860400002)(189003)(199004)(71200400001)(86362001)(71190400001)(97736004)(6486002)(446003)(478600001)(256004)(6636002)(14444005)(486006)(36756003)(2616005)(110136005)(54906003)(105586002)(68736007)(85306007)(316002)(25786009)(99286004)(2906002)(14454004)(106356001)(8676002)(102836004)(81166006)(107886003)(81156014)(2900100001)(6116002)(3846002)(66066001)(305945005)(7736002)(386003)(186003)(6436002)(53936002)(76176011)(6512007)(8936002)(4326008)(11346002)(5660300001)(6506007)(52116002)(476003)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3377; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: CUB5T9TEEeH4i9kuyn49ExP0HvxAtzGfq6MMlg9Ylr/pM9U3SWaA1vEsFdBKFKF5wxCSjW2M3Oky/V5YGfzD4mbHtDPxoe73tvqIAVq/y0tRRkq65J1L63ptzyCv5IsVnC3Q1I2xYcs4NpR7M7yo2uxlTrXuZKcwVXo1zChbtWLeUJYyIDFOSr8qAzAbE2IlUsrY0plVqybR2fEJLyIHxDhAhFZSVcU5cdp0djsug0yvTFW16ZxOU2GQ0OwqIHVt0iz4z+NLGlcebHe/kI3jdhfjRL9p9ah6CixmG3y6z/Ux04gCDfuBzcn1NWSGkxtTh/V/L2daJEpKhjwA+CHhSbv4tXRp8tLso9vMulNB5Yo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0773cfda-9a25-4eea-e602-08d648d9a93c X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Nov 2018 20:01:40.6709 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3377 Subject: [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: Mon, 12 Nov 2018 20:01:41 -0000 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. Fixes: 6e74990b3463 ("net/mlx5: update E-Switch VXLAN netlink routines") Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_tcf.c | 58 +++++++++++++++++++++++++-----------= ---- 1 file changed, 37 insertions(+), 21 deletions(-) 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) { + 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; --=20 1.8.3.1