From patchwork Wed Feb 6 09:32:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10798913 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 932EA13B4 for ; Wed, 6 Feb 2019 09:32:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81A7B2ABDC for ; Wed, 6 Feb 2019 09:32:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 761142ABDF; Wed, 6 Feb 2019 09:32:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AA322ABDC for ; Wed, 6 Feb 2019 09:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728277AbfBFJc0 (ORCPT ); Wed, 6 Feb 2019 04:32:26 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39436 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726715AbfBFJc0 (ORCPT ); Wed, 6 Feb 2019 04:32:26 -0500 Received: by mail-wr1-f67.google.com with SMTP id t27so6707979wra.6 for ; Wed, 06 Feb 2019 01:32:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OH5ECQP1uGTO8qMhBj2xtT7cU7PgdeTIQIJZwVW9ldM=; b=uM2T0snXE8cg/lHozQmDDzZ255Do983+W8mruD+FnWh4AOool2nTTcKqNPmJvHvHo6 xy8wBPkn4WKejYisEpYspJ7YNaO2b2RNyh/c3aZ5JOGwQSJ2+rY2R+SgNIPBCO2Ve3y6 FQ+Z9Z/Dpae9kCQUpNrKB9mYg4OZj1UyIwnN5pWTQZXxaDWRy/ZhNPkZ5mF7ogMMy4+1 1wAmhlg1LsVNVzJ2IhJZwhrdxf8B0tD76qbP6JS5la4jZme3Xw7axxsTXXm0oHiqAZZT l86OE+yMOukqnA9tfWdR8ihD/Al5UkVL62hXsc0pXst2rOjAPG4yAUPHw0/+zFS6R1YB QYmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OH5ECQP1uGTO8qMhBj2xtT7cU7PgdeTIQIJZwVW9ldM=; b=pM18AILtz8lEjKFbpyNYFapQz6xjFnxD3uNmcb6Zj7jjH0ZdrYYRocP2voUpTDzmke 7lwNbV8BmqVrEf1O+TWh2BV1l6tLe9liFzD2nHZpg5HdQFknzRF2gTodjiAf5jO9nyu2 sgxD2oHVXwdoiRA6pA5bkb2SKw55M4deYHX+75Vy4rBwYRJjDAnke68mu3IPwP/ivuzu +VLzpt8nxONynec/fttRkYZI/UOa+l2fZ1Ndj9sPSKOHopmQZcsIyIQ4fHUSpl0hBwlT c+uJ8ZdfvUJT8UFsFEavzDieb6ZH35OvWI4AayvO/K0qVxHGRRMYgVfYPCyDBDfPIf3D RNmw== X-Gm-Message-State: AHQUAubXcv0zcd1eQWoyB9AM3k3S8vBqNxCgGhaNywh8nWdOGBh3wTRa 0Doxq83u/7+nSH4ZJC5981zTtsxN X-Google-Smtp-Source: AHgI3IYCKg9wG0PfQ4vb37pIOXQ2OIT1l6K3Qcl2DXgeeK7sFJKnpgYbNUoA98S9TT6p+zagv+oXGw== X-Received: by 2002:a5d:4546:: with SMTP id p6mr6992164wrr.35.1549445544351; Wed, 06 Feb 2019 01:32:24 -0800 (PST) Received: from kheib-workstation.redhat.com ([192.116.94.216]) by smtp.gmail.com with ESMTPSA id z5sm1783556wmi.15.2019.02.06.01.32.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Feb 2019 01:32:23 -0800 (PST) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Yuval Shaia , Marcel Apfelbaum , Kamal Heib Subject: [PATCH rdma-core 2/3] verbs: Allow passing NULL vid for ibv_resolve_eth_l2_from_gid() Date: Wed, 6 Feb 2019 11:32:04 +0200 Message-Id: <20190206093205.7667-3-kamalheib1@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190206093205.7667-1-kamalheib1@gmail.com> References: <20190206093205.7667-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify callers for ibv_resolve_eth_l2_from_gid() by let them pass NULL vid, in case that they aren't interested in it. Signed-off-by: Kamal Heib --- libibverbs/verbs.c | 11 +++++++---- providers/mlx5/verbs.c | 4 +--- providers/vmw_pvrdma/verbs.c | 3 +-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c index 9cdc361b5610..188bccbaf860 100644 --- a/libibverbs/verbs.c +++ b/libibverbs/verbs.c @@ -1021,10 +1021,12 @@ int ibv_resolve_eth_l2_from_gid(struct ibv_context *context, if (process_get_neigh(&neigh_handler)) goto free_resources; - ret_vid = neigh_get_vlan_id_from_dev(&neigh_handler); + if (vid) { + ret_vid = neigh_get_vlan_id_from_dev(&neigh_handler); - if (ret_vid <= 0xfff) - neigh_set_vlan_id(&neigh_handler, ret_vid); + if (ret_vid <= 0xfff) + neigh_set_vlan_id(&neigh_handler, ret_vid); + } /* We are using only Ethernet here */ ether_len = neigh_get_ll(&neigh_handler, @@ -1034,7 +1036,8 @@ int ibv_resolve_eth_l2_from_gid(struct ibv_context *context, if (ether_len <= 0) goto free_resources; - *vid = ret_vid; + if (vid) + *vid = ret_vid; ret = 0; diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index 7a655a174f7b..930d6cd3cc2d 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -2454,10 +2454,8 @@ struct ibv_ah *mlx5_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) ah->kern_ah = true; memcpy(ah->av.rmac, resp.dmac, ETHERNET_LL_SIZE); } else { - uint16_t vid; - if (ibv_resolve_eth_l2_from_gid(pd->context, attr, - ah->av.rmac, &vid)) + ah->av.rmac, NULL)) goto err; } } diff --git a/providers/vmw_pvrdma/verbs.c b/providers/vmw_pvrdma/verbs.c index b9819390ba8d..e27952bff1bb 100644 --- a/providers/vmw_pvrdma/verbs.c +++ b/providers/vmw_pvrdma/verbs.c @@ -190,7 +190,6 @@ struct ibv_ah *pvrdma_create_ah(struct ibv_pd *pd, struct pvrdma_ah *ah; struct pvrdma_av *av; struct ibv_port_attr port_attr; - uint16_t vlan_id; if (!attr->is_global) return NULL; @@ -224,7 +223,7 @@ struct ibv_ah *pvrdma_create_ah(struct ibv_pd *pd, if (port_attr.port_cap_flags & IBV_PORT_IP_BASED_GIDS) { if (!ibv_resolve_eth_l2_from_gid(pd->context, attr, - av->dmac, &vlan_id)) + av->dmac, NULL)) return &ah->ibv_ah; } else { if (!set_mac_from_gid(&attr->grh.dgid, av->dmac))