From patchwork Mon Nov 12 20:01:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 48009 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 13F094CB1; Mon, 12 Nov 2018 21:01:46 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80047.outbound.protection.outlook.com [40.107.8.47]) by dpdk.org (Postfix) with ESMTP id 0527A3256 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=Y5so+jpxdnGwaUywL1J/JbBlq60u7Rqs/fulAjTtPpI=; b=JV7OluhraEBRu6vGuBODUyvSXyRwd1OosQSA+rnusdv9wznhptOwg/tiKZHjR3l5LskwA/4wUNX+my0hkqbBbqzOapuDc44voT9Ux0UJO1sDz+nTPPIyiCerGUGUfI91JlnCTGnAKAuQWedbuQEQMY+3FDBTRdtp3Qdz7S4A2Wc= 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:39 +0000 From: Slava Ovsiienko To: Shahaf Shuler , Yongseok Koh CC: "dev@dpdk.org" , Slava Ovsiienko Thread-Topic: [PATCH 1/4] net/mlx5: prepare Netlink communication routine to fix Thread-Index: AQHUesKGMwi7PdEf40a/Lxl/2duO3w== Date: Mon, 12 Nov 2018 20:01:39 +0000 Message-ID: <1542052877-41512-2-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:ZsekJ/VxmVkrX+HITOoNWdbPe5twHfa/IYXDoeqIBUK7Dk4bYQefjDotCENF7qSeUgx8N3acyfV4YhylOSWM9q2wDnWchN0qIUgfIPVv2hp4Ihwwf/Ax+ngl12agaI/zgH5SdJkt24Ft8/MKkqAnW62Kl1aof6IguaCTD/uOY6Q9rhsUSRtF1gOkrZTXyAJqQ/OxAy6FgX2sKc1Ehh8HOuVO1VBYTmpqv0Ayut20tCi1XiM3iRIPnIzdw9w2AgCetyUaJhTFh5cSleNKoUy/35j7R4YE8f+9z67xSUo8VjEJPneoC4ij321zHmtxmGfUd793t8VJmHiXxW2lPYXiHof2laNb/xQTGHd+utn5yWJ4UhXYu/l3GMauP2RJuPohVClWgq4Rg7XFYtRJBHJoP05y+J+0OlL4WmDYWdm9lPqAbCIYRPoIvez4GrCKyVZVgWNWSc+wr3rx4NW/xrbofw==; 5:NJj4xNCEAIOLAhqK+tyOFny6y1HXQGLifNKWgMIZFo/5oVIks1T2TUvOmBMUnDl59DOsoI4g9jI9vunP+M5hvBne/I6W0GdGIwZYp+jmGWowIJWGJb+8HDepMlRcNYqlmTplZjCB05tS8SSqg9Cw8WV7MY51CX9AQTyj/WycBVA=; 7:veBW7qdPDKIkrNb/0JDJIZQ7f1S48aC5qhq0/LkXC+YSVxL1lqur4EsFLfCPd8Wb0fNwJQiVM4s5Wd8Fcz7LOL+1x+G05dVauwwIPk7XCBqsbFSVdK60WQBJuOGZSR1RcWNjffS3hvdppsuPLtxTRw== x-ms-office365-filtering-correlation-id: f84c761f-0398-4f7d-ef10-08d648d9a8c7 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: wMy69oUr3C6HsHB3zivQfx+Fv6HY3iI20+lOscUtD/8boObtbl7bLic45Q1sC1EHINWi/evWGaTDxiph9bAue1gtjYRYRM5oWKthmAOAH5wA52ibaK1NksNWajq45LncHzozIP9Cc2tIGHktBLDr1abL/SHUSAEfVcBHJafQfHXSbPrqw38ATs/rFU0YeTc5tyC595aOgyfpdmKU0KEi8GvfBsk/jfi+sEYhP+yFDZSshXfwFV1t1bd9POFf+te0gVFjSoe2fAARgI6U+hIzY0+BPHmAyN4N7x3Uogxknun0+0RwTHRgHiIXbFCJoS0gOw/gtCBm067T8pfi+b4VIQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f84c761f-0398-4f7d-ef10-08d648d9a8c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Nov 2018 20:01:39.8673 (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 1/4] net/mlx5: prepare Netlink communication routine to fix 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch removes the unused message length parameter, we do not send multiple commands in the single message anymore, message length can be taken from the prepared message header, so length parameter can be removed. Signed-off-by: Viacheslav Ovsiienko Acked-by: Shahaf Shuler --- drivers/net/mlx5/mlx5_flow_tcf.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 97d2a54..5a38940 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -3717,10 +3717,6 @@ struct pedit_parser { * @param nlh * Message to send. This function always raises the NLM_F_ACK flag before * sending. - * @param[in] msglen - * Message length. Message buffer may contain multiple commands and - * nlmsg_len field not always corresponds to actual message length. - * If 0 specified the nlmsg_len field in header is used as message length. * @param[in] cb * Callback handler for received message. * @param[in] arg @@ -3732,7 +3728,6 @@ struct pedit_parser { static int flow_tcf_nl_ack(struct mlx5_flow_tcf_context *tcf, struct nlmsghdr *nlh, - uint32_t msglen, mnl_cb_t cb, void *arg) { unsigned int portid = mnl_socket_get_portid(tcf->nl); @@ -3745,11 +3740,8 @@ struct pedit_parser { /* seq 0 is reserved for kernel event-driven notifications. */ seq = tcf->seq++; nlh->nlmsg_seq = seq; - if (!msglen) { - msglen = nlh->nlmsg_len; - nlh->nlmsg_flags |= NLM_F_ACK; - } - ret = mnl_socket_sendto(tcf->nl, nlh, msglen); + nlh->nlmsg_flags |= NLM_F_ACK; + ret = mnl_socket_sendto(tcf->nl, nlh, nlh->nlmsg_len); err = (ret <= 0) ? errno : 0; nlh = (struct nlmsghdr *)(tcf->buf); /* @@ -3886,7 +3878,7 @@ struct tcf_nlcb_context { nlh = (struct nlmsghdr *)&bc->msg[msg]; assert((bc->size - msg) >= nlh->nlmsg_len); msg += nlh->nlmsg_len; - rc = flow_tcf_nl_ack(tcf, nlh, 0, NULL, NULL); + rc = flow_tcf_nl_ack(tcf, nlh, NULL, NULL); if (rc) { DRV_LOG(WARNING, "netlink: cleanup error %d", rc); @@ -4019,7 +4011,7 @@ struct tcf_nlcb_context { ifa->ifa_family = AF_UNSPEC; ifa->ifa_index = ifindex; ifa->ifa_scope = RT_SCOPE_LINK; - ret = flow_tcf_nl_ack(tcf, nlh, 0, flow_tcf_collect_local_cb, &ctx); + ret = flow_tcf_nl_ack(tcf, nlh, flow_tcf_collect_local_cb, &ctx); if (ret) DRV_LOG(WARNING, "netlink: query device list error %d", ret); ret = flow_tcf_send_nlcmd(tcf, &ctx); @@ -4140,7 +4132,7 @@ struct tcf_nlcb_context { ndm->ndm_family = AF_UNSPEC; ndm->ndm_ifindex = ifindex; ndm->ndm_state = NUD_PERMANENT; - ret = flow_tcf_nl_ack(tcf, nlh, 0, flow_tcf_collect_neigh_cb, &ctx); + ret = flow_tcf_nl_ack(tcf, nlh, flow_tcf_collect_neigh_cb, &ctx); if (ret) DRV_LOG(WARNING, "netlink: query device list error %d", ret); ret = flow_tcf_send_nlcmd(tcf, &ctx); @@ -4269,7 +4261,7 @@ struct tcf_nlcb_context { nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; ifm = mnl_nlmsg_put_extra_header(nlh, sizeof(*ifm)); ifm->ifi_family = AF_UNSPEC; - ret = flow_tcf_nl_ack(tcf, nlh, 0, flow_tcf_collect_vxlan_cb, &ctx); + ret = flow_tcf_nl_ack(tcf, nlh, flow_tcf_collect_vxlan_cb, &ctx); if (ret) DRV_LOG(WARNING, "netlink: query device list error %d", ret); ret = flow_tcf_send_nlcmd(tcf, &ctx); @@ -4341,7 +4333,7 @@ struct tcf_nlcb_context { sizeof(encap->ipv6.dst), &encap->ipv6.dst); } - if (!flow_tcf_nl_ack(tcf, nlh, 0, NULL, NULL)) + if (!flow_tcf_nl_ack(tcf, nlh, NULL, NULL)) return 0; return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, @@ -4404,7 +4396,7 @@ struct tcf_nlcb_context { if (encap->mask & FLOW_TCF_ENCAP_ETH_DST) mnl_attr_put(nlh, NDA_LLADDR, sizeof(encap->eth.dst), &encap->eth.dst); - if (!flow_tcf_nl_ack(tcf, nlh, 0, NULL, NULL)) + if (!flow_tcf_nl_ack(tcf, nlh, NULL, NULL)) return 0; return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, @@ -4679,7 +4671,7 @@ struct tcf_nlcb_context { ifm->ifi_family = AF_UNSPEC; ifm->ifi_index = vtep->ifindex; assert(sizeof(buf) >= nlh->nlmsg_len); - ret = flow_tcf_nl_ack(tcf, nlh, 0, NULL, NULL); + ret = flow_tcf_nl_ack(tcf, nlh, NULL, NULL); if (ret) DRV_LOG(WARNING, "netlink: error deleting vxlan" " encap/decap ifindex %u", @@ -4769,7 +4761,7 @@ struct tcf_nlcb_context { mnl_attr_nest_end(nlh, na_vxlan); mnl_attr_nest_end(nlh, na_info); assert(sizeof(buf) >= nlh->nlmsg_len); - ret = flow_tcf_nl_ack(tcf, nlh, 0, NULL, NULL); + ret = flow_tcf_nl_ack(tcf, nlh, NULL, NULL); if (ret) { DRV_LOG(WARNING, "netlink: VTEP %s create failure (%d)", @@ -4811,7 +4803,7 @@ struct tcf_nlcb_context { ifm->ifi_index = vtep->ifindex; ifm->ifi_flags = IFF_UP; ifm->ifi_change = IFF_UP; - ret = flow_tcf_nl_ack(tcf, nlh, 0, NULL, NULL); + ret = flow_tcf_nl_ack(tcf, nlh, NULL, NULL); if (ret) { rte_flow_error_set(error, -errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, @@ -5120,7 +5112,7 @@ struct tcf_nlcb_context { *dev_flow->tcf.tunnel->ifindex_ptr = dev_flow->tcf.tunnel->vtep->ifindex; } - if (!flow_tcf_nl_ack(ctx, nlh, 0, NULL, NULL)) { + if (!flow_tcf_nl_ack(ctx, nlh, NULL, NULL)) { dev_flow->tcf.applied = 1; return 0; } @@ -5163,7 +5155,7 @@ struct tcf_nlcb_context { nlh = dev_flow->tcf.nlh; nlh->nlmsg_type = RTM_DELTFILTER; nlh->nlmsg_flags = NLM_F_REQUEST; - flow_tcf_nl_ack(ctx, nlh, 0, NULL, NULL); + flow_tcf_nl_ack(ctx, nlh, NULL, NULL); if (dev_flow->tcf.tunnel) { assert(dev_flow->tcf.tunnel->vtep); flow_tcf_vtep_release(ctx, @@ -5714,7 +5706,7 @@ struct tcf_nlcb_context { tcm->tcm_parent = TC_H_INGRESS; assert(sizeof(buf) >= nlh->nlmsg_len); /* Ignore errors when qdisc is already absent. */ - if (flow_tcf_nl_ack(ctx, nlh, 0, NULL, NULL) && + if (flow_tcf_nl_ack(ctx, nlh, NULL, NULL) && rte_errno != EINVAL && rte_errno != ENOENT) return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, @@ -5731,7 +5723,7 @@ struct tcf_nlcb_context { tcm->tcm_parent = TC_H_INGRESS; mnl_attr_put_strz_check(nlh, sizeof(buf), TCA_KIND, "ingress"); assert(sizeof(buf) >= nlh->nlmsg_len); - if (flow_tcf_nl_ack(ctx, nlh, 0, NULL, NULL)) + if (flow_tcf_nl_ack(ctx, nlh, NULL, NULL)) return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "netlink: failed to create ingress"