Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp897440ima; Wed, 6 Feb 2019 10:05:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IbqK2Y/K1Q7D7V4togcFF/W4pIu+1vs0AHOkvqfZcPGz4xd6riGB4o4BqJ2BCaK38AkCS2p X-Received: by 2002:a62:9305:: with SMTP id b5mr11594103pfe.10.1549476354869; Wed, 06 Feb 2019 10:05:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549476354; cv=none; d=google.com; s=arc-20160816; b=o+pGuBg+amFiIBwW18j0wOdj6XK2LPZojsq5L4J/DtxgnmiydSr5IJzZeJz20lMnKf bWkLxxuVmEuvbZatdiPhgKwAhGgT5eniVMhpNfxq1mgmIuVJmO4rcohfPzXgEuw3XQlE HP5G/I3KPNjAR6oT78g/AtR237QEK7HqhBOhdQPNql4pEYWRa8fxskytkXuM3mXuv+TE ryJ2fFHtSichw7PhiFqHk2BNBoF2lzY46HgwPTdAYa8FuRTIY0wkb2xEb/sJKzluPEVc 5I2D1dgJkIjdMUrZcIvZ/qwySEdLYkoHf8ZzLpjZ2WGwpkW7IkF1p9O2glatg0yt7cMJ EIdQ== 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=mhwNk0tBSM8DL50RUnTC1M175vtFlNe1q6p5eJedKWI=; b=q8YwaKXWSjO/sU7zSblRHbl7vApWfJJAlJcSDn2827A1VTlTiaSJZF+F+Ye6RMApMS iWSNHtesTcB5HGMtrDqqaLWSg/3A+/xBGxQ1HuYV31mdMUKExls1zpmTSJ+Mwfm03MK5 zPtjwZQuGbCMHINJwYhwQlena/Lis9mT0zq9AsW6nvOSKBqRkea3J2nYx3FPD7b7xEob cXM/HOL6Se2i0TUeG5nXqMldBmTuCKEo/sIoF78Wr7mJ1cW/9igseAIXvxlLA3mEYfFA /xIknQgAXaWKAobawsW9krbTeIvt35y+1yDwByjkzu1qEV1d838fc4Y0oHyiRH1o8+/V dGDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sHOVUExv; 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 go4si6452093plb.69.2019.02.06.10.05.32; Wed, 06 Feb 2019 10:05:54 -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=sHOVUExv; 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 S1730602AbfBFRqR (ORCPT + 99 others); Wed, 6 Feb 2019 12:46:17 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34993 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730546AbfBFRqM (ORCPT ); Wed, 6 Feb 2019 12:46:12 -0500 Received: by mail-pl1-f194.google.com with SMTP id p8so3421250plo.2; Wed, 06 Feb 2019 09:46:11 -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=mhwNk0tBSM8DL50RUnTC1M175vtFlNe1q6p5eJedKWI=; b=sHOVUExv8Hukilb9ZMpYmglLI3HMzxN3F0tOJESwrK/Mvs0vB48FWLEuSZ+6MH0uGq z75JS2esZnS4YoAPMezaZyXw5GbGKM3s2l+akUxd6oKpCp+34Jk/Yf+AoaE2spqsaX7+ QeAzxWCFk9qAPMA+GRAyxAgNmJMx6Yn/OfQInkdNJkZc1YLExXhXupKinxLRk3bOL/XK PkzUe+eKS4jfNSOte1amE+v0kXXtc35qVADBOTTdwKWcIDBzID+N+aQQb+PhvhdaAK0/ XS9EK7jkDyQ2W8VP19Vd4OZ7vrUJJTUAD+uyDyAN46k7aXiJcXT5S7c+yksvA9ZQAfKr /b4Q== 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=mhwNk0tBSM8DL50RUnTC1M175vtFlNe1q6p5eJedKWI=; b=YN4qTkZYngmoPB/AVZeKIikBs+p3wl8/2+3ReU0DpbWkk4f0fo7Jylv6Q3UAE6QXx/ zWat2gHdgCJALBiMTK/szQvtMSTQqNaAJ9HfLnOGv78WPMID0mWSD+Q3W4ztC/eCByGE ste+RTk+OuZReWtBpqBtpHhzF+zGWFBexEaINc0R+iW/XcLCjfcZWESkSdbv9AmEZWIW 3LRGbwFMToZj7C15dXrg2kk1FgCmk1Bag7Z42KsO7dPITqVMjc0Ur3BFJ6t77xhufu36 +Y4dEOeCfbTkot3AYDFbUwWCJxkjz6FCAM52I5WS90dcwB89E5qJbins9a9hAVLLxAhK O04A== X-Gm-Message-State: AHQUAuZ7RJH43PcbMOgpyLoqlgR+GrIcd/Wz8mfNRXsLRx+VRMdMf0dX hqh1fvT+OhNr1iFwqUwge+Q0bTU8 X-Received: by 2002:a17:902:296a:: with SMTP id g97mr11956712plb.317.1549475171014; Wed, 06 Feb 2019 09:46:11 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Feb 2019 09:46:09 -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 04/12] net/mlx5e: Implement ndo_get_port_parent_id() Date: Wed, 6 Feb 2019 09:45:38 -0800 Message-Id: <20190206174546.23597-5-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mlx5e 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(). Since mlx5e makes use of switchdev_port_parent_id() convert it to use netdev_port_same_parent_id(). Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- .../ethernet/mellanox/mlx5/core/en/tc_tun.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 31 +++++++------------ .../net/ethernet/mellanox/mlx5/core/en_tc.c | 5 ++- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c index 046948ead152..19dc4a963b90 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c @@ -25,7 +25,7 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv, /* if the egress device isn't on the same HW e-switch or * it's a LAG device, use the uplink */ - if (!switchdev_port_same_parent_id(priv->netdev, dev) || + if (!netdev_port_same_parent_id(priv->netdev, dev) || dst_is_lag_dev) { *route_dev = uplink_dev; *out_dev = *route_dev; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 5d2e0c2f6624..0b1988b330f3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -381,7 +381,8 @@ static const struct ethtool_ops mlx5e_uplink_rep_ethtool_ops = { .set_pauseparam = mlx5e_uplink_rep_set_pauseparam, }; -static int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr) +static int mlx5e_rep_get_port_parent_id(struct net_device *dev, + struct netdev_phys_item_id *ppid) { struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; @@ -398,20 +399,14 @@ static int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr) uplink_priv = netdev_priv(uplink_dev); } - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: - attr->u.ppid.id_len = ETH_ALEN; - if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) { - ether_addr_copy(attr->u.ppid.id, uplink_upper->dev_addr); - } else { - struct mlx5e_rep_priv *rpriv = priv->ppriv; - struct mlx5_eswitch_rep *rep = rpriv->rep; + ppid->id_len = ETH_ALEN; + if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) { + ether_addr_copy(ppid->id, uplink_upper->dev_addr); + } else { + struct mlx5e_rep_priv *rpriv = priv->ppriv; + struct mlx5_eswitch_rep *rep = rpriv->rep; - ether_addr_copy(attr->u.ppid.id, rep->hw_id); - } - break; - default: - return -EOPNOTSUPP; + ether_addr_copy(ppid->id, rep->hw_id); } return 0; @@ -1284,10 +1279,6 @@ static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan return 0; } -static const struct switchdev_ops mlx5e_rep_switchdev_ops = { - .switchdev_port_attr_get = mlx5e_attr_get, -}; - static const struct net_device_ops mlx5e_netdev_ops_vf_rep = { .ndo_open = mlx5e_vf_rep_open, .ndo_stop = mlx5e_vf_rep_close, @@ -1298,6 +1289,7 @@ static const struct net_device_ops mlx5e_netdev_ops_vf_rep = { .ndo_has_offload_stats = mlx5e_rep_has_offload_stats, .ndo_get_offload_stats = mlx5e_rep_get_offload_stats, .ndo_change_mtu = mlx5e_vf_rep_change_mtu, + .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id, }; static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { @@ -1319,6 +1311,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { .ndo_get_vf_config = mlx5e_get_vf_config, .ndo_get_vf_stats = mlx5e_get_vf_stats, .ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan, + .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id, }; bool mlx5e_eswitch_rep(struct net_device *netdev) @@ -1393,8 +1386,6 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev) netdev->watchdog_timeo = 15 * HZ; - netdev->switchdev_ops = &mlx5e_rep_switchdev_ops; - netdev->features |= NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL; netdev->hw_features |= NETIF_F_HW_TC; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 74159d39dd66..098b28feba0c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -2569,8 +2568,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | MLX5_FLOW_CONTEXT_ACTION_COUNT; - if (switchdev_port_same_parent_id(priv->netdev, - out_dev) || + if (netdev_port_same_parent_id(priv->netdev, + out_dev) || is_merged_eswitch_dev(priv, out_dev)) { struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct net_device *uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH); -- 2.17.1