From patchwork Thu Feb 8 10:18:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 20100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp68755dyd; Thu, 8 Feb 2024 02:22:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUtXqyus4eDAWTkEoMMD/UuP8UUjZ+kHbJD/daEoJwOPrmECq9YOGCbrbwuWKv62cj9UMYBQCgt/p9hsXfSyWrqF6P2fg== X-Google-Smtp-Source: AGHT+IGSz+CDvki7cKX2zUuD1X4bJctU9/s3MlrNf9lrWfVwW0bfP5FjTDd8VO01jKm1qPdg7V+X X-Received: by 2002:a17:902:ecd1:b0:1d9:a414:e582 with SMTP id a17-20020a170902ecd100b001d9a414e582mr3536856plh.28.1707387763179; Thu, 08 Feb 2024 02:22:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707387763; cv=pass; d=google.com; s=arc-20160816; b=Tw/G/28meWMtTRSxBJMYMy7ki08DORf1Qv8hzaJXD6BLKDDCdiAZTyiPxNZnqNTFUx f7bEUQ9n3zAlxpVVbJXneKelt5Ab3a7NT7DSLWNgCz3IPAvbqvfMrDudOEUEQcwCHLZz KY106ic9uVGQJZ6Z7GEGPltuJO/t/G9E/HrDmd44DxwVEqgstOx/5OPRWLA6lKym/kb1 KO8plRa9mgg6IHeAibDRlh5BvDruQnjTz1cyPld+yPbzzbdWJNw2O+D3gIDHsrvEM/by ZIR+iOGIZLZWkSa38gGdB4nDM+DzlVO919s8ReTTA9ZDq6nhjjzwQQHm18E1LFpHrbse TrTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Q4kGmOXeSE3YSc9uti9XSX1GdBtx2l5z+ZGBjuldvmM=; fh=KfvNDLFUFB7G1XPS77KsHDFbuWo5/JXLpsf3StqAqf4=; b=ftzsFPhR+0pQtUdtUXZljvkK5Zyc5SNsVeo/eiJdCmMVdVNu/N/90f54uymURh+HjQ FX1EF1+CUWgJ/TFndBjO3kCVmQqtdedJIjriPF9KkXGEtqQPgIVOGvYqiGp+u3ZzIATX NVRhZFBbYCNYPu8SSxfJjjtAkqYuqYkBbqtSJMFFljtzW7RR5qOKlbwKBF6X0TUmWp55 0miAIfDkgNZxmRIfI/3Bcr5W5aZfnvwvhsuKrd8IQ8qoGOo521ru2kkq/hX0Pk5xDbAU Wdz0W0DnH+hU4yDFtSv5CvPjMLWQxDfK54OZNUbavy9jvGfhjulJEtSaw5nZO1qJASQZ A2vw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=kfyTY0kn; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-57835-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57835-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com X-Forwarded-Encrypted: i=2; AJvYcCVG1ol/kr6S2duQRKq3mkUyHGomJDokxkNQHT3yup+qAPNw43DT22X200V31hlmCN991yCuxQSsB5aQd2xL15l/S5VxKg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cn6-20020a056a020a8600b005d80a51e1c0si3829528pgb.851.2024.02.08.02.22.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 02:22:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57835-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=kfyTY0kn; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-57835-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57835-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1261B2830F4 for ; Thu, 8 Feb 2024 10:19:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 881396E2CD; Thu, 8 Feb 2024 10:19:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="kfyTY0kn" Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2A4A6E2CA; Thu, 8 Feb 2024 10:19:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707387547; cv=none; b=hO+iqTXU6NBXu0fq20XPVKJaD0S5XhDK2sXLVhIWx0TSzs5b/4+EzThreWMlRY6RNsXFHmL9UhoHvaPdnuxIpYlPucPJm+vgFRIqi04OvWQnoY/0Gk2ixUdFFcqDak4+34WPi9B+97tpnhB+QBv2nykKQjtD0eQIqhO1IrMm+pw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707387547; c=relaxed/simple; bh=IudSft82J5bh0vU6smrPXuwB3up+uxat83+QZVVUCSE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=t326ECo5lCn7TmtG8v5HgEHYr2QxxYDeKAXTRI1au77SNvkTMfB8es4s+WOHJvIbslwU7d+ujNpjnDsGXYPo0UOeld727u1BecG+SQrOCs7QnEqzZhW94mCanFB1WymryMi50ga/gv+veaPICbYHjYXaYs1yA+2AX6ccCtYP5Lw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=kfyTY0kn; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4184Gl8j001166; Thu, 8 Feb 2024 02:18:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=pfpt0220; bh=Q4kGmOXe SE3YSc9uti9XSX1GdBtx2l5z+ZGBjuldvmM=; b=kfyTY0knQW+sLSdyIsZLr6GW agt1LagYoqDuqUw0ViKs3123EJSk32I4rJ1U47rq2uWjYEI4QZhwZ8NiwSdsIZjN bHnST/aaJ3498jnc1oZkcl49zHuVxGL2Hz9Udp+wOUFx5z0TTwPbtyL83wvf2Y8U Pa1r10xUK1mP4E0yYH/syarQ1HaRBClQS1xn0bRwRYkLZnC5Z5NB87a+Ny4D/pNB g15lqeu/eP11dJG9EXtqYNVvKZWpPvpvG00FSOHu65N5HttnK01CIqE542UBo5rX nKNBxVYDeRiF/H0JyX9KrLPAVCGW7UZO5iKY6EtasMEBjBKipWAErvMa3XST8w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3w4qsq0wf4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 08 Feb 2024 02:18:48 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 8 Feb 2024 02:18:46 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 8 Feb 2024 02:18:46 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 136B83F7072; Thu, 8 Feb 2024 02:18:46 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , , , Subject: [PATCH net-next v7 0/8] add octeon_ep_vf driver Date: Thu, 8 Feb 2024 02:18:32 -0800 Message-ID: <20240208101841.3108103-1-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: gYjQGXERyoE6Y2nD4P611mI-VRFbosNR X-Proofpoint-GUID: gYjQGXERyoE6Y2nD4P611mI-VRFbosNR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-08_01,2024-02-07_01,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790325831091754803 X-GMAIL-MSGID: 1790325831091754803 This driver implements networking functionality of Marvell's Octeon PCI Endpoint NIC VF. This driver support following devices: * Network controller: Cavium, Inc. Device b203 * Network controller: Cavium, Inc. Device b403 * Network controller: Cavium, Inc. Device b103 * Network controller: Cavium, Inc. Device b903 * Network controller: Cavium, Inc. Device ba03 * Network controller: Cavium, Inc. Device bc03 * Network controller: Cavium, Inc. Device bd03 Changes: V7: - Separated octep_vf_get_if_stats from octep_vf_main.h to later patch in [1/8] - Moved introducing ndo_ops from [3/8] to [5/8] V6: https://lore.kernel.org/all/20240207065207.3092004-1-srasheed@marvell.com/ - Removed reuse of netif_tx_stop_all_queues, called implicitly in netif_tx_disable, when stopping netdev - Corrected error jump labels to have proper action-specific names in probe function - Removed singlethreaded workqueue implementation, since only tx timeout task is run. Run the same in the system workqueue - netdev_hold when tx_timeout happens to protect against free_netdev if race occurs between rmmod and a tx timeout. netdev_put the reference when timeout task ends to progress freeing netdev V5: https://lore.kernel.org/all/20240129050254.3047778-1-srasheed@marvell.com/ - Changed unchecked return types to void and removed unnecessary initializations in [2/8] patch. V4: https://lore.kernel.org/all/20240108124213.2966536-1-srasheed@marvell.com/ - Moved some stats from ethtool and added more to ndo_get_stats64 - Replaced code in IQ full check function to use helper from net/netdev_queues.h - Refactored code so that NETDEV_TX_BUSY is avoided V3: https://lore.kernel.org/all/20240105203823.2953604-1-srasheed@marvell.com/ - Removed UINT64_MAX, which is unused - Replaced masks and ULL declarations with GENMASK_ULL(), ULL() and other linux/bits.h macros, corrected declarations to conform to xmas tree format in patch [2/8] - Moved vfree and vzalloc null pointer casting corrections to patch [3/8], and corrected return values to follow standard kernel error codes in same - Set static budget of 64 for tx completion processing in NAPI - Replaces napi_complete and build_skb APIs to napi_complete_done and napi_build_skb APIs respectively - Replaced code with helper from net/netdev_queues.h to wake queues in TX completion processing - Removed duplicate reporting of TX/RX packets/bytes, which is already done during ndo_get_stats64 V2: https://lore.kernel.org/all/20231223134000.2906144-1-srasheed@marvell.com/ - Removed linux/version.h header file from inclusion in octep_vf_main.c - Corrected Makefile entry to include building octep_vf_mbox.c in [6/8] patch. - Removed redundant vzalloc pointer cast and vfree pointer check in [6/8] patch. V1: https://lore.kernel.org/all/20231221092844.2885872-1-srasheed@marvell.com/ Shinas Rasheed (8): octeon_ep_vf: Add driver framework and device initialization octeon_ep_vf: add hardware configuration APIs octeon_ep_vf: add VF-PF mailbox communication. octeon_ep_vf: add Tx/Rx ring resource setup and cleanup octeon_ep_vf: add support for ndo ops octeon_ep_vf: add Tx/Rx processing and interrupt support octeon_ep_vf: add ethtool support octeon_ep_vf: update MAINTAINERS .../device_drivers/ethernet/index.rst | 1 + .../ethernet/marvell/octeon_ep_vf.rst | 24 + MAINTAINERS | 9 + drivers/net/ethernet/marvell/Kconfig | 1 + drivers/net/ethernet/marvell/Makefile | 1 + .../net/ethernet/marvell/octeon_ep_vf/Kconfig | 19 + .../ethernet/marvell/octeon_ep_vf/Makefile | 10 + .../marvell/octeon_ep_vf/octep_vf_cn9k.c | 489 +++++++ .../marvell/octeon_ep_vf/octep_vf_cnxk.c | 500 +++++++ .../marvell/octeon_ep_vf/octep_vf_config.h | 160 +++ .../marvell/octeon_ep_vf/octep_vf_ethtool.c | 273 ++++ .../marvell/octeon_ep_vf/octep_vf_main.c | 1231 +++++++++++++++++ .../marvell/octeon_ep_vf/octep_vf_main.h | 334 +++++ .../marvell/octeon_ep_vf/octep_vf_mbox.c | 430 ++++++ .../marvell/octeon_ep_vf/octep_vf_mbox.h | 166 +++ .../marvell/octeon_ep_vf/octep_vf_regs_cn9k.h | 154 +++ .../marvell/octeon_ep_vf/octep_vf_regs_cnxk.h | 162 +++ .../marvell/octeon_ep_vf/octep_vf_rx.c | 510 +++++++ .../marvell/octeon_ep_vf/octep_vf_rx.h | 224 +++ .../marvell/octeon_ep_vf/octep_vf_tx.c | 330 +++++ .../marvell/octeon_ep_vf/octep_vf_tx.h | 276 ++++ 21 files changed, 5305 insertions(+) create mode 100644 Documentation/networking/device_drivers/ethernet/marvell/octeon_ep_vf.rst create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/Kconfig create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/Makefile create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cnxk.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_config.h create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_ethtool.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.h create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_mbox.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_mbox.h create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_regs_cn9k.h create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_regs_cnxk.h create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.h create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_tx.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_tx.h