From patchwork Tue Feb 5 23:53:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10798689 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 14F0B746 for ; Tue, 5 Feb 2019 23:56:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0644B2AC7F for ; Tue, 5 Feb 2019 23:56:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF2E12B21C; Tue, 5 Feb 2019 23:56:52 +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 96AAC2AC7F for ; Tue, 5 Feb 2019 23:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728352AbfBEXzw (ORCPT ); Tue, 5 Feb 2019 18:55:52 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33621 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728315AbfBEXzv (ORCPT ); Tue, 5 Feb 2019 18:55:51 -0500 Received: by mail-pl1-f196.google.com with SMTP id z23so2276363plo.0; Tue, 05 Feb 2019 15:55:50 -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=RNI+XdPhvdY1OjXcP7pgSSgHAFM8lKWzobqUPPNGsDM=; b=XxKsW2tYBDWt1KqZFOfr9sxzCsiU2/h83p8XGxW2ixfxvP+GywHk6XCDwLV55DOecK XsFp2f2dl+hNMLrpXtkE5TTr9Az8KoId/ujtO6Hj+IejX6WBh7fnQOmPiRsku++TY/Kz S6xfnipw83IGvodd3ht/jFzbEaKd3rxgrQixKrlsrA55k0V9VmQdakICWem+zjXRoEJt iOVxrbDCgZzoe0Akd/kD3rMfsSDhuk9xYhVnaJ/UTTXrhQoeqchK+ziDvBv6TIV+s5/A gI+9q6FS1+ddQa45UI3D/I9hPf9kUEl/WMH2k1I3tVIR5R1jrsZX4jN29xqHbzQ4L6+G HLxA== 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=RNI+XdPhvdY1OjXcP7pgSSgHAFM8lKWzobqUPPNGsDM=; b=aeQ9OP6i4Pu/R50QzmAKEuXdeln8CZpxqBzs5OjI+tH5fIZtBo0jK4bNPtMyiPwJPH CLCDjZfqUh84vNgzhzcorgUxi3IyhLezzFufgifXpzRoSEYJjh85q9vGO/Zegsn0R5F2 FNRke8bWHsdt9SI/9uPsrMoHIIm0gFFkyxyCnstWm29M/dRJbK88KGoPidEjRr1XtGgm tyylKpNkM8WVJWyn8KCo9yMsoY2tSdPrUNa/2k9W0LtORLEaJh5b3YYC/YL5s/lVJH6h OdglQ4W1E0WwfDXmuu4noKdcJofhvO3JDl6uybrtHT/i8eLPjqvI3mXrZZGjokhNmXok XekQ== X-Gm-Message-State: AHQUAubg0D2Deegl52ai7dodHD9MhN/v+Qwled5vBm0HS/sVVsP0e199 74V23PSggULjSD7Jbt5xcnNU4BYW X-Google-Smtp-Source: AHgI3Ib/e8F0w6fnGkfWz9Pt0u+wz9JA1h6FkZvlkETiZlyUctLoMckwrQBOKDSf+X13MuascrLDKA== X-Received: by 2002:a17:902:e78e:: with SMTP id cp14mr7709062plb.4.1549410950116; Tue, 05 Feb 2019 15:55:50 -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.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 15:55:49 -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 06/12] mscc: ocelot: Implement ndo_get_port_parent_id() Date: Tue, 5 Feb 2019 15:53:20 -0800 Message-Id: <20190205235326.14600-7-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-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ocelot only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID as a valid switchdev attribute getter, convert it to use ndo_get_port_parent_id() and get rid of the switchdev_ops::switchdev_port_attr_get altogether. Signed-off-by: Florian Fainelli Acked-by: Jiri Pirko --- drivers/net/ethernet/mscc/ocelot.c | 33 ++++++++++++------------------ 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index c6a575eb0ff5..195306d05bcd 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -916,6 +916,18 @@ static int ocelot_set_features(struct net_device *dev, return 0; } +static int ocelot_get_port_parent_id(struct net_device *dev, + struct netdev_phys_item_id *ppid) +{ + struct ocelot_port *ocelot_port = netdev_priv(dev); + struct ocelot *ocelot = ocelot_port->ocelot; + + ppid->id_len = sizeof(ocelot->base_mac); + memcpy(&ppid->id, &ocelot->base_mac, ppid->id_len); + + return 0; +} + static const struct net_device_ops ocelot_port_netdev_ops = { .ndo_open = ocelot_port_open, .ndo_stop = ocelot_port_stop, @@ -930,6 +942,7 @@ static const struct net_device_ops ocelot_port_netdev_ops = { .ndo_vlan_rx_add_vid = ocelot_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = ocelot_vlan_rx_kill_vid, .ndo_set_features = ocelot_set_features, + .ndo_get_port_parent_id = ocelot_get_port_parent_id, }; static void ocelot_get_strings(struct net_device *netdev, u32 sset, u8 *data) @@ -1013,25 +1026,6 @@ static const struct ethtool_ops ocelot_ethtool_ops = { .set_link_ksettings = phy_ethtool_set_link_ksettings, }; -static int ocelot_port_attr_get(struct net_device *dev, - struct switchdev_attr *attr) -{ - struct ocelot_port *ocelot_port = netdev_priv(dev); - struct ocelot *ocelot = ocelot_port->ocelot; - - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: - attr->u.ppid.id_len = sizeof(ocelot->base_mac); - memcpy(&attr->u.ppid.id, &ocelot->base_mac, - attr->u.ppid.id_len); - break; - default: - return -EOPNOTSUPP; - } - - return 0; -} - static int ocelot_port_attr_stp_state_set(struct ocelot_port *ocelot_port, struct switchdev_trans *trans, u8 state) @@ -1331,7 +1325,6 @@ static int ocelot_port_obj_del(struct net_device *dev, } static const struct switchdev_ops ocelot_port_switchdev_ops = { - .switchdev_port_attr_get = ocelot_port_attr_get, .switchdev_port_attr_set = ocelot_port_attr_set, };