From patchwork Wed Feb 6 17:45:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10799753 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 A07E41390 for ; Wed, 6 Feb 2019 17:47:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9269F2CC51 for ; Wed, 6 Feb 2019 17:47:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 842612CF3D; Wed, 6 Feb 2019 17:47:01 +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 2567C2CC51 for ; Wed, 6 Feb 2019 17:47:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729122AbfBFRqo (ORCPT ); Wed, 6 Feb 2019 12:46:44 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39993 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730632AbfBFRqW (ORCPT ); Wed, 6 Feb 2019 12:46:22 -0500 Received: by mail-pf1-f193.google.com with SMTP id i12so3406853pfo.7; Wed, 06 Feb 2019 09:46:20 -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; bh=ArJyP52WUHjXEmWeKQMCdCvrHE5jBBDMmVZMHMTBbik=; b=kv3EmQBKIJRBUX3Frbcbe6KFkkmMEGxPkJQ6qWmZYdfjiTqynD3LGBH/9KLHL60owR UAhl3ayyTJOtT2LaiGQEyyDzK1MK9pLyTvBMpjI5/u+QirNI2MKuLmXUjRVWTn8p3QOE n7wACuqx4MKpzuuODLR20DDGp5BuFTHv1jlDAy+ImNGwkLvmOXQxSGsxeWk2ucIcSZrs CDHYin4crGq7xQVrR3F+yw0qlctUOHrqPVUyvL4drAFCJA00gN5DnbNWtZPG22bxnPRr N+H15YfpIcyBN599IOY3yOTcvThdS1zTIaFVnb46zyoPWbWvtxr1NjUrYnPB/xa2hiJX g+5Q== 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; bh=ArJyP52WUHjXEmWeKQMCdCvrHE5jBBDMmVZMHMTBbik=; b=eJ/T8h/4HV7T/hwwm4c0Ob7O+VwJsEn7oXDX4s75B3q3CemzHpjPrOPcxDVDu9I2Sb J1b9sWoeonXX9tcrVNYGklHIWVdy1mVTOqCNx2gDAfBBtLoD3kVlc2ux+O1jfNnkZXU5 gwmyLu3QELOkepWHC4ZRSWVnB1mUufnizpV1ms8WfCLbKJtra+KOHM5y8k4pWE3sdvhB 6ZIeyGgWikk0fbKpJHj5aswN4gC4xLH1cZyxlXqyQtgHjaOtVGHDLyF3/XPVeDAxtCBf woX6ft+7QMBnhTSVywwHI72DeZuxQrNaA1QaegiczCYMIai5I+Fh3CJnHiL10rPUrC+9 oeMQ== X-Gm-Message-State: AHQUAuZaY9FZgtZSE3Ychpnqrrqb8SrIaeC4hs13p59Bj/wY63efTeL4 IDFaqWcVMcvZINN8xtRpV1aPsNc6 X-Google-Smtp-Source: AHgI3IZwpAHiucfTIgaDWCi5SMXVYYBg98z3+aQaQCPIErVnsKSdPjpy0uDEQ23s/ojkHm2/n8TFmg== X-Received: by 2002:a65:40ca:: with SMTP id u10mr10712961pgp.321.1549475180057; Wed, 06 Feb 2019 09:46:20 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id 15sm10435313pfr.55.2019.02.06.09.46.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Feb 2019 09:46:18 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), linux-rdma@vger.kernel.org (open list:MELLANOX MLX5 core VPI driver), oss-drivers@netronome.com (open list:NETRONOME ETHERNET DRIVERS), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE) Subject: [PATCH net-next v4 09/12] netdevsim: Implement ndo_get_port_parent_id() Date: Wed, 6 Feb 2019 09:45:43 -0800 Message-Id: <20190206174546.23597-10-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com> References: <20190206174546.23597-1-f.fainelli@gmail.com> 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 netdevsim only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a great candidate to be converted to use the ndo_get_port_parent_id() NDO instead of implementing switchdev_port_attr_get(). Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/netdevsim/netdev.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 8d8e2b3f263e..75a50b59cb8f 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -22,7 +22,6 @@ #include #include #include -#include #include "netdevsim.h" @@ -148,26 +147,16 @@ static struct device_type nsim_dev_type = { .release = nsim_dev_release, }; -static int -nsim_port_attr_get(struct net_device *dev, struct switchdev_attr *attr) +static int nsim_get_port_parent_id(struct net_device *dev, + struct netdev_phys_item_id *ppid) { struct netdevsim *ns = netdev_priv(dev); - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: - attr->u.ppid.id_len = sizeof(ns->sdev->switch_id); - memcpy(&attr->u.ppid.id, &ns->sdev->switch_id, - attr->u.ppid.id_len); - return 0; - default: - return -EOPNOTSUPP; - } + ppid->id_len = sizeof(ns->sdev->switch_id); + memcpy(&ppid->id, &ns->sdev->switch_id, ppid->id_len); + return 0; } -static const struct switchdev_ops nsim_switchdev_ops = { - .switchdev_port_attr_get = nsim_port_attr_get, -}; - static int nsim_init(struct net_device *dev) { char sdev_ddir_name[10], sdev_link_name[32]; @@ -214,7 +203,6 @@ static int nsim_init(struct net_device *dev) goto err_bpf_uninit; SET_NETDEV_DEV(dev, &ns->dev); - SWITCHDEV_SET_OPS(dev, &nsim_switchdev_ops); err = nsim_devlink_setup(ns); if (err) @@ -493,6 +481,7 @@ static const struct net_device_ops nsim_netdev_ops = { .ndo_setup_tc = nsim_setup_tc, .ndo_set_features = nsim_set_features, .ndo_bpf = nsim_bpf, + .ndo_get_port_parent_id = nsim_get_port_parent_id, }; static void nsim_setup(struct net_device *dev)