From patchwork Wed Feb 6 17:45:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10799759 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 325591390 for ; Wed, 6 Feb 2019 17:47:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22F062CC51 for ; Wed, 6 Feb 2019 17:47:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 155602CF3D; Wed, 6 Feb 2019 17:47:13 +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 B21602CC51 for ; Wed, 6 Feb 2019 17:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728529AbfBFRrE (ORCPT ); Wed, 6 Feb 2019 12:47:04 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40875 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730619AbfBFRqS (ORCPT ); Wed, 6 Feb 2019 12:46:18 -0500 Received: by mail-pl1-f193.google.com with SMTP id u18so3413100plq.7; Wed, 06 Feb 2019 09:46:18 -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=unVY6jzXSwf6Z3BXuXwH1dAfhkC5gzzltRG8BJVomGo=; b=JUK7XrzuUcBq0D1LE7KfCL/jHkJVKOJn0MZvWp4rhf8JcrcbxJKHESlhKww02n5s4c fBfmuZwbNaS55nLzVfxEQ0o2cRbZkL/9ijQrrur455hXjDXVYjQCWPTgdjNhM1dEvr/5 n8XREN7oypSZDqD6a07lDt0rcPSfKpXtNm9NT44vC5uc8tELulpgRJLC1cJz0v8aD2Pi 9ENtn3f790UbcX1vxKB9KkKl2w4asYlqJtBERt3pWC7TU9WQkGWtVozohV87+nkgCf8X XS15xWbCg92WNdVo2u54E57V+SGvNdPGz4DWPl4amOpWZ7mszcJAE5lz3eerODKD6pEt vhLQ== 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=unVY6jzXSwf6Z3BXuXwH1dAfhkC5gzzltRG8BJVomGo=; b=bezTgliAXnPiZmeGf4mLNywa1kSzUa8cftyNnjuf9o713dBYOFQXrYJ/ECFaTTtf7+ rME/NJeTPZ13hpXlnajL56xJl+fzozd6wGUc7sPVrsvnQpjoR1pbcAyyaXnPYzHROsGJ j6JlG/uD0YP/nXi6dtkw7pCN08jyOVsZvYpSitMxX9ExtHlz+R5s3ZCdVk2uk1EN3oQK bInTTlb3DuSein5GWEDNzcqwHXExq/S878F6ggS5HS3r9uVxoyShoel5plVkfJN7isTC s2vqfr1s+zobw9Gmw6ELJ3UcQnOZm7pPZ8sMrij7EQXlxGiSlxBqNpeUBtBfwBtqkX46 5aVQ== X-Gm-Message-State: AHQUAuZ6g5SGUUAXmXivPBuLJkDD3YssZOO24q+cPQAoB4h172lbSrsW U4gnwbSw4RwoXBWb3UqiBwCMA0CG X-Google-Smtp-Source: AHgI3IZEqnr+VqB6BUoodBAOcFStZBE8DuO4OTSMItuppYiTAXoA0aIhs1T659nskY1SnWZM/KhkHw== X-Received: by 2002:a17:902:1101:: with SMTP id d1mr11816746pla.136.1549475177546; Wed, 06 Feb 2019 09:46:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Feb 2019 09:46:16 -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 08/12] rocker: Implement ndo_get_port_parent_id() Date: Wed, 6 Feb 2019 09:45:42 -0800 Message-Id: <20190206174546.23597-9-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 mlxsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid of switchdev_ops eventually, ease that migration by implementing a ndo_get_port_parent_id() function which returns what switchdev_port_attr_get() would do. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/ethernet/rocker/rocker_main.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 62a205eba9f7..596f44dbfae1 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2026,6 +2026,18 @@ static void rocker_port_neigh_destroy(struct net_device *dev, err); } +static int rocker_port_get_port_parent_id(struct net_device *dev, + struct netdev_phys_item_id *ppid) +{ + const struct rocker_port *rocker_port = netdev_priv(dev); + const struct rocker *rocker = rocker_port->rocker; + + ppid->id_len = sizeof(rocker->hw.id); + memcpy(&ppid->id, &rocker->hw.id, ppid->id_len); + + return 0; +} + static const struct net_device_ops rocker_port_netdev_ops = { .ndo_open = rocker_port_open, .ndo_stop = rocker_port_stop, @@ -2035,6 +2047,7 @@ static const struct net_device_ops rocker_port_netdev_ops = { .ndo_get_phys_port_name = rocker_port_get_phys_port_name, .ndo_change_proto_down = rocker_port_change_proto_down, .ndo_neigh_destroy = rocker_port_neigh_destroy, + .ndo_get_port_parent_id = rocker_port_get_port_parent_id, }; /******************** @@ -2049,10 +2062,6 @@ static int rocker_port_attr_get(struct net_device *dev, int err = 0; switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: - attr->u.ppid.id_len = sizeof(rocker->hw.id); - memcpy(&attr->u.ppid.id, &rocker->hw.id, attr->u.ppid.id_len); - break; case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: err = rocker_world_port_attr_bridge_flags_get(rocker_port, &attr->u.brport_flags);