From patchwork Tue Nov 22 21:44:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 2075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2454651wrr; Tue, 22 Nov 2022 13:50:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf68pwv6wWHS+szwYC2yjNt8Om4wnFNty9/zQsdRNjlysGHWrYvYQxCexrtObsKWeC+Il6/W X-Received: by 2002:a17:906:844:b0:78c:2c03:804c with SMTP id f4-20020a170906084400b0078c2c03804cmr8427944ejd.107.1669153810502; Tue, 22 Nov 2022 13:50:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669153810; cv=none; d=google.com; s=arc-20160816; b=zvdIfX4YWO1VcpP3q1bilfdq2ZUSQePrk2MdkZxu63dacjs/qrR7hoPh5sYNd2V8rx vlPbXzXYkMfelH54tsDETkJve+fqlS5wNuFRrU8xkFgG3IWda1W26wyDoOEr4YMhEdcg s6oIeRWkzngMIVxdlnNop+iI75ZWbHf1JYUi2uMvO945LsO4/iR65s+ULwjyM+Oe/XF/ MGh1kE0NKTuSfRFxMOidT8u3NfjCpkWa9Bxv3qEOIjtZ/ntd0kfroypbLx6GsnFwh1g6 JaWaq+SqR0Z/OveqNpWZH/BMKr6S/FUs8qII7If1iKyLmlf6ml0M0j7MMM0aVsT5ylWL FxXA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=7h1uSIk6zujefXWKKIcM3ygxTPXVta8Y+AJy5lGg6Uk=; b=epDqQdAnkeQAw3DDxxPLroBdXVaEMCZcNzr/qSl876jMOOA2ndjOnAP0m2gIgvzd5r TG34yDxkaZ4bkwJIZLlojXAEneN5qPprWVmY/zyeecezXEhXfkzNL54/j0w7HOulhOmn cwJ+wDyEGoQZB4VLmKWOK3gNlAwDc5eos97t3dThwSSrzur58Eq5u7Bnto79EqjDHZrT 5RKN9bPNnfWuR+N0wWCX/l7AmuHMtutTljZXPv/tpvuqo6F4rHWxQbHRrXl4fAZaq9C9 QLDt0cl59SdHh2bBo34ZzX6VLhV/hbcdNqHnW8PNm1rMqJw01ZD/ukfFwZm4U9qpELq/ 95/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=KC9tI+yl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd9-20020a1709069b8900b007a1b49ca799si13479183ejc.385.2022.11.22.13.49.45; Tue, 22 Nov 2022 13:50:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=KC9tI+yl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235076AbiKVVkE (ORCPT + 99 others); Tue, 22 Nov 2022 16:40:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232572AbiKVVkD (ORCPT ); Tue, 22 Nov 2022 16:40:03 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FB45C5B72; Tue, 22 Nov 2022 13:39:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669153199; x=1700689199; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SObOV4ZVsIhR7Pxn0ehVi6XI7f+9C+SzUdrriWqtbxU=; b=KC9tI+yl4ON/W8dci5vDn4ChTJLw1w0PG2cUZwYhhDL/36B+vyTmES8m lkLnQ8d5IRZCIRDfYhK8OjMH04S69i1KVwwQtRQsxGVGC6vRVtHwWY+aY FhLvJXmQgiywl3nx2txTYTjduJHuVJphwzTS3OL5nEqGGWpvVr23ZNQPC J2Xb4seTt3XqO16fYl3N9ubdeCoR6dayK8OseHtqru71Mdb+uHDTvvZb0 Tyz/vkeKcLfW2iR+cP2LDJAmnbP0lzGkcfbM6/Qf+S7xVYzTVEgnAGUJ+ 9etWcM9XFXsRL2zHi/IY/k3UCwah6HbbY7Q6prPsWAQIbhKTpqCyF3nyM w==; X-IronPort-AV: E=Sophos;i="5.96,185,1665471600"; d="scan'208";a="190137418" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Nov 2022 14:39:59 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 22 Nov 2022 14:39:54 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 22 Nov 2022 14:39:51 -0700 From: Horatiu Vultur To: , , CC: , , , , , , , , , , Horatiu Vultur Subject: [PATCH net-next v4 0/7] net: lan966x: Extend xdp support Date: Tue, 22 Nov 2022 22:44:06 +0100 Message-ID: <20221122214413.3446006-1-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_SPF_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750234626087270022?= X-GMAIL-MSGID: =?utf-8?q?1750234626087270022?= Extend the current support of XDP in lan966x with the action XDP_TX and XDP_REDIRECT. The first patches just prepare the things such that it would be easier to add XDP_TX and XDP_REDIRECT actions. Like adding XDP_PACKET_HEADROOM, introduce helper functions, use the correct dma_dir for the page pool The last 2 patches introduce the XDP actions XDP_TX and XDP_REDIRECT. v3->v4: - use napi_consume_skb instead of dev_kfree_skb_any - arrange members in struct lan966x_tx_dcb_buf not to have holes - fix when xdp program is added the check for determining if page pool needs to be recreated was wrong - change type for len in lan966x_tx_dcb_buf to u32 v2->v3: - make sure to update rxq memory model - update the page pool direction if there is any xdp program - in case of action XDP_TX give back to reuse the page - in case of action XDP_REDIRECT, remap the frame and make sure to unmap it when is transmitted. v1->v2: - use skb_reserve of using skb_put and skb_pull - make sure that data_len doesn't include XDP_PACKET_HEADROOM Horatiu Vultur (7): net: lan966x: Add XDP_PACKET_HEADROOM net: lan966x: Introduce helper functions net: lan966x: Add len field to lan966x_tx_dcb_buf net: lan966x: Update rxq memory model net: lan966x: Update dma_dir of page_pool_params net: lan966x: Add support for XDP_TX net: lan966x: Add support for XDP_REDIRECT .../ethernet/microchip/lan966x/lan966x_fdma.c | 265 +++++++++++++++--- .../ethernet/microchip/lan966x/lan966x_main.c | 5 +- .../ethernet/microchip/lan966x/lan966x_main.h | 25 +- .../ethernet/microchip/lan966x/lan966x_xdp.c | 70 ++++- 4 files changed, 314 insertions(+), 51 deletions(-)