Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5651859ima; Tue, 5 Feb 2019 15:58:36 -0800 (PST) X-Google-Smtp-Source: AHgI3IYO5A0de9MXhqRVKliRyikdjl1EV7OBYEXG8yK/M8RuLa8NweMCnMq/Qz/7/OcKcJIK/881 X-Received: by 2002:a17:902:a401:: with SMTP id p1mr7748687plq.79.1549411116335; Tue, 05 Feb 2019 15:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549411116; cv=none; d=google.com; s=arc-20160816; b=yywIlpBm5nWmBBTPhWlOn8RPod1xhmuYd2/Wq8JxaPebLWL1hlnvvc3yeyHVeofjQU UxYtbd6LvYTGlRrYwzYtNrOVH2GOoJx4Jf4ly2sq9WWQ+CBnXEVP01bSckItmuqa0mKd TRVuml2xor0p1q4YHFY/arNhtTZ5bkUAas2rSEYmek8Bk6MGEebsqjTZ3z5yqjwv/eaZ peuBMe4JR4+HsvC9MKIzkElKc3I2fpPBftYzBRo7rOuMGYLakDC6+PBA7C/no+V0c7CB XsiQyKFfdFnNDOXfm7k3INDtdMaWsfW6Mdz5SXxUYrLbUQbivEtcId32TuAzkcFhc4I/ +S/A== 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=7vuIGYN0KGvwnI1aHr46uRKC1r95J/r4Egh2ShHtxKY=; b=x+FoP7fZpwSYY1n2uTnW1YYL2LJAtRUwm7f5+PUkdoXMWcj/0SofX9wLF51Hip0yRD xr7XxCFPpZe+zzCuSD4GXQNvv9g8xvXagucTJ5eyFNYmia14fwAMgcu98cnyvC6YDZED oj6/p8ZebIO9eA3JKySIzqhNYEqHZe5X9RuwlPqxIJv6mTBaY0C+cAoH1hcTUrk/QK2E 19m5znJuqrOKNtzZXWYWpRWDyKDq1y1YCFH/423l3H5kJ+3y/cEkbheZwl+TUBttZVde YYPkFxWHJTeIHkEIJaUUYU4A9gvMp/Rdtk09WNdSBHNZ5RF+G7ejuvTnbnC+k25f8uLp DJoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M7O6g0aP; 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 k69si172961pga.176.2019.02.05.15.58.21; Tue, 05 Feb 2019 15:58:36 -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=M7O6g0aP; 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 S1728248AbfBEX5O (ORCPT + 99 others); Tue, 5 Feb 2019 18:57:14 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45807 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727662AbfBEXzr (ORCPT ); Tue, 5 Feb 2019 18:55:47 -0500 Received: by mail-pf1-f195.google.com with SMTP id j3so114980pfi.12; Tue, 05 Feb 2019 15:55:45 -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=7vuIGYN0KGvwnI1aHr46uRKC1r95J/r4Egh2ShHtxKY=; b=M7O6g0aPzEVLCQ7gQH+CN41jqE1QFLky9VxQezJ4CdRG2Vm+Q8D3TPLXXsjYrAZ1hX FHRkqXWtrLw7hpevv1QFXtrOTX+QMmLLS7T2i86/F8HEvbDOhnphE+GPOEQA6VESpF6N s5pTgZklYv1WOKCsNv6XFpnWaiXvGy671tQDLFKgA0ObYb0P0it6EmZvqS6wNnyZp3xy 4pU1B+tN1ZS0SmVFf64mTy9H1oNhF/4AfjnaV+C2xF2ULCLGe1PsWiy0LFeac4DXZhhg ra9o4lQF4s0GLaY/09eMBsUw3M64Z6DbW4yR1xcu+nB8ZiXkMbyJEKUSYTUt/m2RzBDi 1u8g== 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=7vuIGYN0KGvwnI1aHr46uRKC1r95J/r4Egh2ShHtxKY=; b=VrI1wJDZNgmkMxnyk3Q1mnY62aXB485HLf9vVVcSOZOmM5xJDt+9C04azuBiiN9NFv qUNHj1uKAFyWnHQLAXI+Lba13eAnzfw9vesL1MqIQfKdHdYe/UcLFEg0mrCrSe3kcn2B hrYR8yW0AJR5JCHejF7p/UVPL3FyF2J1npiflXBfRDFoX0ttn16gANByk+qtXkcbN2ES ctxd7ZIliCwoo7y7TcAm3mtNJcSE0AEVXPHwjnCZ+LPwpe+vkYIDg3F3mRpv4b5IDkUv gykZ24XN4f0mtL9El7+RzfhfGGs6drBXUb9po+Q2Lbx5+Hs2RMQC9n7GqZOVZYlTJe7T JViQ== X-Gm-Message-State: AHQUAubGn69bHU1hF2m4MRtu6oTIDUb4lZ0GqJcq6E6bs9rgX8dGSKtS UEVLNT2wjqpdVCQgEqAXl6gtSp5N X-Received: by 2002:a63:df50:: with SMTP id h16mr6994678pgj.421.1549410945179; Tue, 05 Feb 2019 15:55:45 -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.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 15:55:44 -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 03/12] liquidio: Implement ndo_get_port_parent_id() Date: Tue, 5 Feb 2019 15:53:17 -0800 Message-Id: <20190205235326.14600-4-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 Liquidio 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 --- .../net/ethernet/cavium/liquidio/lio_main.c | 22 ++++------------ .../net/ethernet/cavium/liquidio/lio_vf_rep.c | 25 ++++++------------- 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index 3d24133e5e49..e97e6754ee09 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "liquidio_common.h" #include "octeon_droq.h" #include "octeon_iq.h" @@ -3184,7 +3183,8 @@ static const struct devlink_ops liquidio_devlink_ops = { }; static int -lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr) +liquidio_get_port_parent_id(struct net_device *dev, + struct netdev_phys_item_id *ppid) { struct lio *lio = GET_LIO(dev); struct octeon_device *oct = lio->oct_dev; @@ -3192,24 +3192,12 @@ lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr) if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV) return -EOPNOTSUPP; - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: - attr->u.ppid.id_len = ETH_ALEN; - ether_addr_copy(attr->u.ppid.id, - (void *)&lio->linfo.hw_addr + 2); - break; - - default: - return -EOPNOTSUPP; - } + ppid->id_len = ETH_ALEN; + ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2); return 0; } -static const struct switchdev_ops lio_pf_switchdev_ops = { - .switchdev_port_attr_get = lio_pf_switchdev_attr_get, -}; - static int liquidio_get_vf_stats(struct net_device *netdev, int vfidx, struct ifla_vf_stats *vf_stats) { @@ -3259,6 +3247,7 @@ static const struct net_device_ops lionetdevops = { .ndo_set_vf_trust = liquidio_set_vf_trust, .ndo_set_vf_link_state = liquidio_set_vf_link_state, .ndo_get_vf_stats = liquidio_get_vf_stats, + .ndo_get_port_parent_id = liquidio_get_port_parent_id, }; /** \brief Entry point for the liquidio module @@ -3534,7 +3523,6 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) * netdev tasks. */ netdev->netdev_ops = &lionetdevops; - SWITCHDEV_SET_OPS(netdev, &lio_pf_switchdev_ops); retval = netif_set_real_num_rx_queues(netdev, num_oqueues); if (retval) { diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c index de61060721c4..f3f2e71431ac 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c @@ -25,7 +25,6 @@ #include "octeon_nic.h" #include "octeon_main.h" #include "octeon_network.h" -#include #include "lio_vf_rep.h" static int lio_vf_rep_open(struct net_device *ndev); @@ -38,6 +37,8 @@ static int lio_vf_rep_phys_port_name(struct net_device *dev, static void lio_vf_rep_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats64); static int lio_vf_rep_change_mtu(struct net_device *ndev, int new_mtu); +static int lio_vf_get_port_parent_id(struct net_device *dev, + struct netdev_phys_item_id *ppid); static const struct net_device_ops lio_vf_rep_ndev_ops = { .ndo_open = lio_vf_rep_open, @@ -47,6 +48,7 @@ static const struct net_device_ops lio_vf_rep_ndev_ops = { .ndo_get_phys_port_name = lio_vf_rep_phys_port_name, .ndo_get_stats64 = lio_vf_rep_get_stats64, .ndo_change_mtu = lio_vf_rep_change_mtu, + .ndo_get_port_parent_id = lio_vf_get_port_parent_id, }; static int @@ -443,31 +445,19 @@ lio_vf_rep_pkt_xmit(struct sk_buff *skb, struct net_device *ndev) return NETDEV_TX_OK; } -static int -lio_vf_rep_attr_get(struct net_device *dev, struct switchdev_attr *attr) +static int lio_vf_get_port_parent_id(struct net_device *dev, + struct netdev_phys_item_id *ppid) { struct lio_vf_rep_desc *vf_rep = netdev_priv(dev); struct net_device *parent_ndev = vf_rep->parent_ndev; struct lio *lio = GET_LIO(parent_ndev); - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: - attr->u.ppid.id_len = ETH_ALEN; - ether_addr_copy(attr->u.ppid.id, - (void *)&lio->linfo.hw_addr + 2); - break; - - default: - return -EOPNOTSUPP; - } + ppid->id_len = ETH_ALEN; + ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2); return 0; } -static const struct switchdev_ops lio_vf_rep_switchdev_ops = { - .switchdev_port_attr_get = lio_vf_rep_attr_get, -}; - static void lio_vf_rep_fetch_stats(struct work_struct *work) { @@ -524,7 +514,6 @@ lio_vf_rep_create(struct octeon_device *oct) ndev->min_mtu = LIO_MIN_MTU_SIZE; ndev->max_mtu = LIO_MAX_MTU_SIZE; ndev->netdev_ops = &lio_vf_rep_ndev_ops; - SWITCHDEV_SET_OPS(ndev, &lio_vf_rep_switchdev_ops); vf_rep = netdev_priv(ndev); memset(vf_rep, 0, sizeof(*vf_rep)); -- 2.17.1