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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 39777C433E6 for ; Mon, 1 Feb 2021 12:42:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBD3864EA0 for ; Mon, 1 Feb 2021 12:42:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231567AbhBAMmS (ORCPT ); Mon, 1 Feb 2021 07:42:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231499AbhBAMmL (ORCPT ); Mon, 1 Feb 2021 07:42:11 -0500 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5F5BC061573 for ; Mon, 1 Feb 2021 04:41:30 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id 16so17172459ioz.5 for ; Mon, 01 Feb 2021 04:41:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Qj3gtsKwB6ap9M2JpuAICku9x3ifzgxPYufNViFQVLM=; b=OmVRENI8jA/oUqCZk8fnU5kScJTiNSUMGCNPBkb0GsKQNrmcq6eB3x+zNkcCm0xt0t 4AVhlb+19ulfQA7wPbog+J3rF08ejWNryPw9j13EWwZCFOq4QuN0EefUKbBV06lrIPta C02DKNdKpXHigwldaaObeswnEXhAB2/3VRZTLgkfmL3crgwAIMO5xOa9wU8PvwjNkUGT n5pM2yeMYR3xbv8GhOHk8m656PRaXN9jutVd+uqs04pa9lGa5wePOERyKkl3pyNjo0rR LBcCuqRCxrQhAk+AFJLYt3FRAbdh3alM421pb9UTNBQKIodBwTU447fWw03yWSrQgaV0 EonQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Qj3gtsKwB6ap9M2JpuAICku9x3ifzgxPYufNViFQVLM=; b=cALOBybhLAi0ZmGnTrUiPsw+Jhp+Z4SAM0F6Phez32wURZcJKDc03b4lQAkzAwqsoQ slj2JfgAo3+JIlIO8MHuEzPDwbUfg3WCVDugPK/PL476B39Nrgj6KJ2wqSbGejWTtXhJ kAOArxzmAOYW+a4C/5fp7VOTPzotoiesj/d5Mwd0zPHGCrgi/5aGwHP/0A32Gq6ithOV edQr+jRi6sMATET3wMRr12gPxFtEQtwEDFWOIbcxMcncLRXwOkAIdGoxEKaGlPTcWWkq cpNbd4uy46HH14K+F6D2DoN/FHb5C6yZzIVQPPEAeZfFXnRgf8GGQk3/XtvRvPZEdGMw 5msQ== X-Gm-Message-State: AOAM530tV8lqdYrijr0evRFfdUsK3mDd/C9Y+MSapbUAIfZ1UG6rTKHP KdaJX/96hPDO7Ywe2km5zvGsa+fV15Mb9330Dwo= X-Google-Smtp-Source: ABdhPJwKm9spYH2eJGF720clXit5QH6bJF8YQXKk7FF7Zmf18NkigjYhPHFhnbOQtX4mGgOqWQQDkFUN3KbfiGMdS5A= X-Received: by 2002:a05:6638:204b:: with SMTP id t11mr13918217jaj.87.1612183290368; Mon, 01 Feb 2021 04:41:30 -0800 (PST) MIME-Version: 1.0 References: <20210131074426.44154-1-haokexin@gmail.com> <20210131074426.44154-4-haokexin@gmail.com> In-Reply-To: <20210131074426.44154-4-haokexin@gmail.com> From: sundeep subbaraya Date: Mon, 1 Feb 2021 18:11:19 +0530 Message-ID: Subject: Re: [PATCH net-next v2 3/4] net: octeontx2: Use napi_alloc_frag_align() to avoid the memory waste To: Kevin Hao Cc: "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Tested-by: Subbaraya Sundeep Thanks, Sundeep On Sun, Jan 31, 2021 at 1:49 PM Kevin Hao wrote: > > The napi_alloc_frag_align() will guarantee that a correctly align > buffer address is returned. So use this function to simplify the buffer > alloc and avoid the unnecessary memory waste. > > Signed-off-by: Kevin Hao > --- > v2: No change. > > drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c > index 5ddedc3b754d..cbd68fa9f1d6 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c > @@ -488,11 +488,10 @@ dma_addr_t __otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool) > dma_addr_t iova; > u8 *buf; > > - buf = napi_alloc_frag(pool->rbsize + OTX2_ALIGN); > + buf = napi_alloc_frag_align(pool->rbsize, OTX2_ALIGN); > if (unlikely(!buf)) > return -ENOMEM; > > - buf = PTR_ALIGN(buf, OTX2_ALIGN); > iova = dma_map_single_attrs(pfvf->dev, buf, pool->rbsize, > DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); > if (unlikely(dma_mapping_error(pfvf->dev, iova))) { > -- > 2.29.2 >