Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5651832ima; Tue, 5 Feb 2019 15:58:34 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibo9SsIldDpdRQOWt67VcqqbPEsHWuOGh5tJRXAQuTRR+x9DphwhuZWCoofEFoqtRmmRWOS X-Received: by 2002:a17:902:6e0f:: with SMTP id u15mr7628200plk.175.1549411114133; Tue, 05 Feb 2019 15:58:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549411114; cv=none; d=google.com; s=arc-20160816; b=G0C8Vi0ooEwBJWuD+T9BZaQw4qMq+XeoR5VIeAzrqPoQGWG725KJ2gseo3jK0k6Bm5 MtCauV2K0PQat8vPBkrEHOleCLDKRUKNUP0+2FlHfdxiZ544O7E8IYAXJNGnNLTv2kX/ gj5uMqZF+MSi9eXRvK85h/6iQR/62WjEmtng09986c5LUUYh/LEb3+SJ8yIxvj/VOdiq IVHqTfowsC9vx2Jcvp3lXx3D65LswG5TMDscw7N/4HMjP2lMAmWt7NnKAiEgJwyn2RN7 VU3IAurs3JQ828hWWNWC9zLqfWVCb3w0I0ip24BtwZeIZrzwDDm6khVDuseyxwamsw9/ 7fTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=5/2lkSN34z8RTeIIaRZasc8AXz7Kch8Ha5gpyZNhmKs=; b=RaM+cew3+u2eJk8jtuJatfM4U1wrxVtD6mis1Bjv1PNCPHWyOh5lTzWUZRo8RUD4JY gENgjyGFphK4e1tcqOYzosGC4hN0mSFHBZ6LPgUFJ1ABbMyiR3Gi56w4NQF0cCNEZlnx orLo31+Hr2qDNSbjxV4ImpidrHnm0ge1oFvkee0sBNlSo2Dfsi1LlODgZJeAtIP6PG36 6MMsoze7moEdYCP7mWQ/J0QCVQc6e58zCEIxSAaKfahO+TgT2i2jmrxEWDYFFGB24ECB EIcOPr0B1KWveH1l4YUj2Njs/mPEfu/yBwhEY78sodZ+Yl0Oukujv8C1eQjBrz+6dXwS aSIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CRZgnA2c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i64si4312025pge.361.2019.02.05.15.58.18; Tue, 05 Feb 2019 15:58:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CRZgnA2c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728791AbfBEXz6 (ORCPT + 99 others); Tue, 5 Feb 2019 18:55:58 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37411 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728652AbfBEXz4 (ORCPT ); Tue, 5 Feb 2019 18:55:56 -0500 Received: by mail-pg1-f195.google.com with SMTP id c25so2120650pgb.4; Tue, 05 Feb 2019 15:55:55 -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=5/2lkSN34z8RTeIIaRZasc8AXz7Kch8Ha5gpyZNhmKs=; b=CRZgnA2c7WGtqDHrKYNT0aWeK/ZBMGRHKPz44It+blD2Ax4DaOIEfk0ohanXWkX8SE iXq39pn7IzTayRf0DMS+zxSzyRNiwdfjYAoOSH1gQ4G5D8ML+xNVGhKzyexBvPutt+Nn wCg2ZeGjx9L05hwZh8odMyqMxKhif4A1tr4vr+NIDvBmMqX8UTiMN8R354MzSavjS/Hh qx4RiSyxfMx8vGf5JEzx6vjn/tw0KPn/7DkmrA8MA9IM1nHCGeA07M0D+0IJIzgsMPGC BvQDzpRUQptobYzlOwsH4ZppYQiCgmvaO/nnBJ/mxZ34RbIgZhDyzGQaMV+017Y9s98M PrLA== 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=5/2lkSN34z8RTeIIaRZasc8AXz7Kch8Ha5gpyZNhmKs=; b=F+OO8NGWwOzlxh0HyQkxNRNCGce6qNYqbcLwESgQIUNSID7NI1gcNsofLWuv7Aq0Na kkpOZmAl8NRKBGPbkUJRhSiE2juzaJh3AyPZ031BgB4dFdH2ZPlpXo0lEmdfGtWyAfzy H1WC286LWrnY96luSBrWiv7FuFlFwM2HmWRzlXCchSZ2tRHEtudIOgDJDbsyM642b5Ac pDhRen+AqLG3HBTxp5QxWoj60takWRcN9Nx5Vn8UvP2GoXkCx/TqTUfvWhvKhs8I3Wcq 6PJyavOB4eC+w/2uKA0OgxMWK3p3bSN+BU7sbKobtBIKl7wLxWHHUhPE40o0cRLX3Fkc 92rw== X-Gm-Message-State: AHQUAuYVp95RZLzqaHxFoDrZVVDwfkfHmXza6d0Fpn4MSlBr9St8WEAw 3Y5V4RfmHGYZ2k+x2OQgHSmkMGZ8 X-Received: by 2002:a63:960a:: with SMTP id c10mr6938245pge.106.1549410955072; Tue, 05 Feb 2019 15:55:55 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id v184sm6770197pfb.182.2019.02.05.15.55.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 15:55:54 -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 v3 09/12] netdevsim: Implement ndo_get_port_parent_id() Date: Tue, 5 Feb 2019 15:53:23 -0800 Message-Id: <20190205235326.14600-10-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190205235326.14600-1-f.fainelli@gmail.com> References: <20190205235326.14600-1-f.fainelli@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). 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) -- 2.17.1