From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D26EC10F14 for ; Tue, 23 Apr 2019 12:58:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C585214AE for ; Tue, 23 Apr 2019 12:58:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="ifZNDBmf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727758AbfDWM6n (ORCPT ); Tue, 23 Apr 2019 08:58:43 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:43831 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726655AbfDWM6m (ORCPT ); Tue, 23 Apr 2019 08:58:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1556024321; x=1587560321; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=omKf50yJfaM9ROnZl36SUZT9tVt9P+X0hgXGX3CqreM=; b=ifZNDBmfXTjNay17aOus11FcPv2a72VzIro8WYnzDYrZoA3bgRrv4ZKh 3cVUFfs170hasM1g86JvodK+YEVu/+imy4uWWyBROg0r3aNFhzu9BIzmd M9iSF3c8aeWF8jan87vpCet7jP77eMaT1/oN+1iTWUz1QQIA0Zh4+vV5X c=; X-IronPort-AV: E=Sophos;i="5.60,385,1549929600"; d="scan'208";a="800912796" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2b-4ff6265a.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Apr 2019 12:54:22 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-4ff6265a.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x3NCrGir101854 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 23 Apr 2019 12:53:18 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 23 Apr 2019 12:53:18 +0000 Received: from [10.218.62.27] (10.43.160.48) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 23 Apr 2019 12:53:14 +0000 Subject: Re: [net-next 06/14] net/mlx5e: XDP, Inline small packets into the TX MPWQE in XDP xmit flow To: Saeed Mahameed , "David S. Miller" CC: , Jesper Dangaard Brouer , Jonathan Lemon , Shay Agroskin , "Tariq Toukan" References: <20190422223306.31568-1-saeedm@mellanox.com> <20190422223306.31568-7-saeedm@mellanox.com> From: Gal Pressman Message-ID: <0e2c517b-5ada-0fe6-5270-5afaceebe67f@amazon.com> Date: Tue, 23 Apr 2019 15:53:09 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190422223306.31568-7-saeedm@mellanox.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.43.160.48] X-ClientProxiedBy: EX13D11UWC004.ant.amazon.com (10.43.162.101) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 23-Apr-19 01:32, Saeed Mahameed wrote: > static inline void > -mlx5e_xdp_mpwqe_add_dseg(struct mlx5e_xdpsq *sq, dma_addr_t dma_addr, u16 dma_len) > +mlx5e_xdp_mpwqe_add_dseg(struct mlx5e_xdpsq *sq, struct mlx5e_xdp_info *xdpi, > + struct mlx5e_xdpsq_stats *stats) Passing stats as a function parameter is weird, why not remove and use sq->stats? > { > struct mlx5e_xdp_mpwqe *session = &sq->mpwqe; > + dma_addr_t dma_addr = xdpi->dma_addr; > + struct xdp_frame *xdpf = xdpi->xdpf; > struct mlx5_wqe_data_seg *dseg = > - (struct mlx5_wqe_data_seg *)session->wqe + session->ds_count++; > + (struct mlx5_wqe_data_seg *)session->wqe + session->ds_count; > + u16 dma_len = xdpf->len; > > + session->pkt_count++; > + > +#define MLX5E_XDP_INLINE_WQE_SZ_THRSD (256 - sizeof(struct mlx5_wqe_inline_seg)) > + > + if (session->inline_on && dma_len <= MLX5E_XDP_INLINE_WQE_SZ_THRSD) { > + struct mlx5_wqe_inline_seg *inline_dseg = > + (struct mlx5_wqe_inline_seg *)dseg; > + u16 ds_len = sizeof(*inline_dseg) + dma_len; > + u16 ds_cnt = DIV_ROUND_UP(ds_len, MLX5_SEND_WQE_DS); > + > + if (unlikely(session->ds_count + ds_cnt > session->max_ds_count)) { > + /* Not enough space for inline wqe, send with memory pointer */ > + session->complete = true; > + goto no_inline; > + } > + > + inline_dseg->byte_count = cpu_to_be32(dma_len | MLX5_INLINE_SEG); > + memcpy(inline_dseg->data, xdpf->data, dma_len); > + > + session->ds_count += ds_cnt; > + stats->inlnw++; > + return; > + } > + > +no_inline: > dseg->addr = cpu_to_be64(dma_addr); > dseg->byte_count = cpu_to_be32(dma_len); > dseg->lkey = sq->mkey_be; > + session->ds_count++; > }