From patchwork Mon Mar 13 18:31:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erez Shitrit X-Patchwork-Id: 9621777 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 C741A60244 for ; Mon, 13 Mar 2017 18:33:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE1E828494 for ; Mon, 13 Mar 2017 18:33:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2FDB28503; Mon, 13 Mar 2017 18:33:30 +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 4A56F28494 for ; Mon, 13 Mar 2017 18:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753968AbdCMSd2 (ORCPT ); Mon, 13 Mar 2017 14:33:28 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:49861 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753262AbdCMScU (ORCPT ); Mon, 13 Mar 2017 14:32:20 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from erezsh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 13 Mar 2017 20:31:55 +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 v2DIVrvc021688; Mon, 13 Mar 2017 20:31:55 +0200 From: Erez Shitrit To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org, valex@mellanox.com, leonro@mellanox.com, saedm@mellanox.com, erezsh@dev.mellanox.co.il, Erez Shitrit Subject: [RFC v1 for accelerated IPoIB 22/25] net/mlx5e: New function pointer for build_rx_skb is Date: Mon, 13 Mar 2017 20:31:33 +0200 Message-Id: <1489429896-10781-23-git-send-email-erezsh@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1489429896-10781-1-git-send-email-erezsh@mellanox.com> References: <1489429896-10781-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 In order to have the ability to support IB link with the same base code. Signed-off-by: Erez Shitrit --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 ++++++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++++ drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 10 +++++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index b6758d0b93a5..84de1ca11524 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -298,6 +298,11 @@ typedef int (*mlx5e_fp_alloc_wqe)(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, typedef void (*mlx5e_fp_dealloc_wqe)(struct mlx5e_rq *rq, u16 ix); +typedef void (*mlx5e_fp_build_rx_skb)(struct mlx5_cqe64 *cqe, + u32 cqe_bcnt, + struct mlx5e_rq *rq, + struct sk_buff *skb); + struct mlx5e_dma_info { struct page *page; dma_addr_t addr; @@ -367,6 +372,7 @@ struct mlx5e_rq { mlx5e_fp_handle_rx_cqe handle_rx_cqe; mlx5e_fp_alloc_wqe alloc_wqe; mlx5e_fp_dealloc_wqe dealloc_wqe; + mlx5e_fp_build_rx_skb build_rx_skb; unsigned long state; int ix; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 24efc8ccc075..4dc8b21d011d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -493,6 +493,12 @@ static int mlx5e_create_rq_umr_mkey(struct mlx5e_rq *rq) return mlx5e_create_umr_mkey(priv, num_mtts, PAGE_SHIFT, &rq->umr_mkey); } +/* forward declaration */ +inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, + u32 cqe_bcnt, + struct mlx5e_rq *rq, + struct sk_buff *skb); + static int mlx5e_create_rq(struct mlx5e_channel *c, struct mlx5e_rq_param *param, struct mlx5e_rq *rq) @@ -538,6 +544,7 @@ static int mlx5e_create_rq(struct mlx5e_channel *c, if (rq->xdp_prog) rq->buff.map_dir = DMA_BIDIRECTIONAL; + rq->build_rx_skb = mlx5e_build_rx_skb; switch (priv->params.rq_wq_type) { case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: if (mlx5e_is_vf_vport_rep(priv)) { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index ad08e64fee1a..98546b3395df 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -590,10 +590,10 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, rq->stats.csum_none++; } -static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, - u32 cqe_bcnt, - struct mlx5e_rq *rq, - struct sk_buff *skb) +inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, + u32 cqe_bcnt, + struct mlx5e_rq *rq, + struct sk_buff *skb) { struct net_device *netdev = rq->netdev; struct mlx5e_tstamp *tstamp = rq->tstamp; @@ -632,7 +632,7 @@ static inline void mlx5e_complete_rx_cqe(struct mlx5e_rq *rq, { rq->stats.packets++; rq->stats.bytes += cqe_bcnt; - mlx5e_build_rx_skb(cqe, cqe_bcnt, rq, skb); + rq->build_rx_skb(cqe, cqe_bcnt, rq, skb); } static inline void mlx5e_xmit_xdp_doorbell(struct mlx5e_sq *sq)