From patchwork Wed Mar 1 14:02:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erez Shitrit X-Patchwork-Id: 9598443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6500B60453 for ; Wed, 1 Mar 2017 14:05:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 542F02855D for ; Wed, 1 Mar 2017 14:05:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 490F328563; Wed, 1 Mar 2017 14:05:03 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 5EAE128560 for ; Wed, 1 Mar 2017 14:05:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751073AbdCAOFB (ORCPT ); Wed, 1 Mar 2017 09:05:01 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:33474 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751334AbdCAOEf (ORCPT ); Wed, 1 Mar 2017 09:04:35 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from erezsh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 1 Mar 2017 16:02:49 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v21E2kkI028329; Wed, 1 Mar 2017 16:02:49 +0200 From: Erez Shitrit To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, valex@mellanox.com, leonro@mellanox.com, Erez Shitrit Subject: [RFC for accelerated IPoIB 12/26] net/mlx5e: Refactor attach_netdev API Date: Wed, 1 Mar 2017 16:02:20 +0200 Message-Id: <1488376954-8346-13-git-send-email-erezsh@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1488376954-8346-1-git-send-email-erezsh@mellanox.com> References: <1488376954-8346-1-git-send-email-erezsh@mellanox.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 Use priv object instead of netdev object, will give tha ability to use it for IB link. Signed-off-by: Erez Shitrit --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 8 ++++---- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index f3337ec4457f..e5c8badc38c7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -918,7 +918,7 @@ struct net_device *mlx5e_create_netdev(struct mlx5_core_dev *mdev, const struct mlx5e_profile *profile, void *ppriv); void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv); -int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev); +int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv); void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev); u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout); void mlx5e_add_vxlan_port(struct net_device *netdev, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index dd7d1d123d38..4e9a11b94025 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3994,14 +3994,14 @@ struct net_device *mlx5e_create_netdev(struct mlx5_core_dev *mdev, return NULL; } -int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev) +int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv) { const struct mlx5e_profile *profile; - struct mlx5e_priv *priv; + struct net_device *netdev; u16 max_mtu; int err; - priv = netdev_priv(netdev); + netdev = priv->netdev; profile = priv->profile; clear_bit(MLX5E_STATE_DESTROYING, &priv->state); @@ -4114,7 +4114,7 @@ static int mlx5e_attach(struct mlx5_core_dev *mdev, void *vpriv) if (err) return err; - err = mlx5e_attach_netdev(mdev, netdev); + err = mlx5e_attach_netdev(mdev, priv); if (err) { mlx5e_destroy_mdev_resources(mdev); return err; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 850378893b25..0aad28da1638 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -556,6 +556,7 @@ int mlx5e_vport_rep_load(struct mlx5_eswitch *esw, struct mlx5_eswitch_rep *rep) { struct net_device *netdev; + struct mlx5e_priv *priv; int err; netdev = mlx5e_create_netdev(esw->dev, &mlx5e_rep_profile, rep); @@ -567,7 +568,8 @@ int mlx5e_vport_rep_load(struct mlx5_eswitch *esw, rep->netdev = netdev; - err = mlx5e_attach_netdev(esw->dev, netdev); + priv = netdev_priv(netdev); + err = mlx5e_attach_netdev(esw->dev, priv); if (err) { pr_warn("Failed to attach representor netdev for vport %d\n", rep->vport);