From patchwork Mon Nov 13 13:00:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 164467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1182911vqg; Mon, 13 Nov 2023 05:01:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSSkhNPfzqil++lxsLkI0kCHLNZpaWR5JSKsH//D2WgIsPkOJEsyYzaZB9GWyC4ffR3XIX X-Received: by 2002:a17:902:f80e:b0:1cc:501b:1d13 with SMTP id ix14-20020a170902f80e00b001cc501b1d13mr4010621plb.40.1699880512585; Mon, 13 Nov 2023 05:01:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699880512; cv=none; d=google.com; s=arc-20160816; b=IIeMYX3B0uen5yf+9NCReejgoJ6N7E6W0FZpxUgAFrEIpp6MOCh7Q90ghDSN+YJzLM RSZjM2H7aI9TDyfRvNJevAbhw6msgtjoEod5MSHUHXTfL2oicqLojE2XWjCrr9C29N7V 1kky/5HZBNgXYeC0pCA83rKqDexkxv+IreY7QDewyOLW6wypP2DUGJHXai5GntSsBlSL 9tX04oyFbpu9GCntcqEg/oZaIh/tWUXuqGsYZi5bXjP8/9DbmnwP/XsRwT2t7ZgLHRGi Dxzb2ivncy0s8YO/shaH9kxpXSQBsmTtob37thF7l/5N6vLrK2COJoADLEoHFiQTFixy bpxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1eyr2HPD23KD1LLUrHugt9+M3HlPepGULzVHZPxVl9M=; fh=X0kT1+hjUyC3dXa4KDNLFXU6BTNiUKwzU7Q+P/tRGs4=; b=ztrqqJpR98UVYu/cItcaMWwSDOkJaEJWjYT8bjLPbn703/I94BwuopQia68TVNbFu+ Gld1Mbh+W5fkQkpneNu6z+rk6ZzrHxYjzlOWcRfp2wGg9Ooi7iHq4507FvZIbDhWUoFS wtw2GNhWcwzXxoCrrF1lQezKcAPN/sJFxPoQDx0vCA9bsCad/Ljz/GYL63GOQT2cYk9e Fydh2dmZxpG7YlIuMEsscDhj/m27ONGqmraYxL1SZEsQaPbIv/plxkXfDr0Mw5eaBGgE uIjzXmDFeUe45/eWxyFX++uM5l/Nl6bv0XpSZGdHbqmJJgqnPhrTjh7rONa96fnx0L0H G6eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b8-20020a170902e94800b001c432da203asi5905927pll.270.2023.11.13.05.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 05:01:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BCD6B8098B0E; Mon, 13 Nov 2023 05:01:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbjKMNBM (ORCPT + 29 others); Mon, 13 Nov 2023 08:01:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231191AbjKMNAs (ORCPT ); Mon, 13 Nov 2023 08:00:48 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C624C172D; Mon, 13 Nov 2023 05:00:44 -0800 (PST) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4STTvD12YMzMmpm; Mon, 13 Nov 2023 20:56:08 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 13 Nov 2023 21:00:41 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Yisen Zhuang , Salil Mehta , Eric Dumazet Subject: [PATCH RFC 7/8] net: hns3: temp hack for hns3 to use dmabuf memory provider Date: Mon, 13 Nov 2023 21:00:39 +0800 Message-ID: <20231113130041.58124-8-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231113130041.58124-1-linyunsheng@huawei.com> References: <20231113130041.58124-1-linyunsheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 13 Nov 2023 05:01:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782453908380579649 X-GMAIL-MSGID: 1782453908380579649 Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 06117502001f..43454aa6a279 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3371,6 +3371,8 @@ static int hns3_alloc_buffer(struct hns3_enet_ring *ring, struct page *p; if (ring->page_pool) { + struct page_pool_iov *ppiov; + p = page_pool_dev_alloc_frag(ring->page_pool, &cb->page_offset, hns3_buf_size(ring)); @@ -3378,7 +3380,8 @@ static int hns3_alloc_buffer(struct hns3_enet_ring *ring, return -ENOMEM; cb->priv = p; - cb->buf = page_address(p); + ppiov = cb->priv; + cb->buf = page_address(ppiov->page); cb->dma = page_pool_get_dma_addr(p); cb->type = DESC_TYPE_PP_FRAG; cb->reuse_flag = 0; @@ -4940,7 +4943,7 @@ static void hns3_put_ring_config(struct hns3_nic_priv *priv) static void hns3_alloc_page_pool(struct hns3_enet_ring *ring) { struct page_pool_params pp_params = { - .flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV, + .flags = 0,//PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV, .order = hns3_page_order(ring), .pool_size = ring->desc_num * hns3_buf_size(ring) / (PAGE_SIZE << hns3_page_order(ring)), @@ -4949,6 +4952,8 @@ static void hns3_alloc_page_pool(struct hns3_enet_ring *ring) .dma_dir = DMA_FROM_DEVICE, .offset = 0, .max_len = PAGE_SIZE << hns3_page_order(ring), + .memory_provider = PP_MP_DMABUF_DEVMEM, + .mp_priv = &dmabuf_devmem_ops, }; ring->page_pool = page_pool_create(&pp_params);