From patchwork Mon Apr 1 03:57:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Chebbi X-Patchwork-Id: 13612507 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 105A31362 for ; Mon, 1 Apr 2024 03:54:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943660; cv=none; b=VYZ7chmiAn0ntedUztS//fLdgfY8PjcDXeCsHerqMwG48SWgIZAvcyL/W45xjV4HWTkD7BFDpvDmqDkHpm2mMHV5awmQMM/saY9ytnQe8vJW53387stg84Q/HXcUm0yhN0YRr0tO225uM1+Kdx9wwmY184YtmIwA1wnWSxaYjDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943660; c=relaxed/simple; bh=Qe28pRCJxJls1ow+k4RxJQYhPV2gxMaS3RZ6ERpz9bo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=mzOkP382rn7FONWdZ8n41Wb6OTWJRHJvYzPxmSyLojFOi1ikOvEmHRn8xiMfmt750pdLLAcUKhcCLOeoC/oyywptJPNY0fslIG+B6I2eV5Ea/0yaQWeNSLWzq2bBFMVCCEcHB6Bjdn7qwFhBMRQfDshkKxcqe0XWzsCDlKTMwT0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=YiSteSqE; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="YiSteSqE" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6e6b729669bso3165359b3a.3 for ; Sun, 31 Mar 2024 20:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1711943658; x=1712548458; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=za7bKxM04aZAgzTrJxaAjWvgHPwQZblO+XhJYZ/nQdc=; b=YiSteSqEqdLvoIHzpFmS58HAZgoUCdi6/9/xh3K2W1a/28merwCPGW4HEQMdpgIa5x t2Iu/39Qojtg6cNLKd3NKHYshbe6PZ3K6gEcQbRNxxqMadwmpbI+ft5yWb2d6Iw2zBJS eOKZLDaCoidEnc+v6fooBZ3BdDVDDDGPnEv5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711943658; x=1712548458; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=za7bKxM04aZAgzTrJxaAjWvgHPwQZblO+XhJYZ/nQdc=; b=uWaJoT76sW4hMw2iyiewZ2Dry86IISnVYNnYOZEfH3g6QvX7XU57UUakVRH1oGwcg1 i3KGO2iuYZQxKNlY7mB+cfhoK4f+6nitZh3pXqMUl7jS4VK8tcxh7vv2l0abQaPlcRXA imwCeKeevtSh+NUk3gshfjnNz4JgFkJzNJYUlp6f0XYzoFY7gZEcpTJN7qEdcMQ2YlEa XuTJRmhMQgm/QNjhJ7EqczE4WPAXQACSnZgwVcaYJHI4W7fNK+kcy4NvA/sKTywwroPr UDY+KvpAjoc+7zi/w9YZF7+/KLV1VYLbtu6ySjrQG8RXxRHm/WVwUcm9+nW7G1E1DP7C 2q6w== X-Forwarded-Encrypted: i=1; AJvYcCXaBj8M234HPitlc/g/bSbOBnu0+BDesTqz/xu4CQWd2ZtIbdQBvzwrCpO006HApG7PkSU/oiFK62mov0oRo449+7toT/A8 X-Gm-Message-State: AOJu0YxW2bRgARV9uZVptjM36P6iGL6TMOJTFdRjWMMgVZGxd0AFaTZH G3yrOWJc12N1OwsYxO24t5Zmk9HzrQ9TfydWMs+7aKX7PRNS7A8HWrizxTfVTw== X-Google-Smtp-Source: AGHT+IGww6pSunneW72swmQS3zlzcYw+nQGdUM1BsWYStJCg38YP2A5zaUP0ymu9+RJn4HSsbWByYg== X-Received: by 2002:a05:6a00:a23:b0:6ea:f351:1df9 with SMTP id p35-20020a056a000a2300b006eaf3511df9mr8899073pfh.23.1711943658044; Sun, 31 Mar 2024 20:54:18 -0700 (PDT) Received: from PC-MID-R740.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id j26-20020a62b61a000000b006e73d1c0c0esm6860781pff.154.2024.03.31.20.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 20:54:17 -0700 (PDT) From: Pavan Chebbi To: michael.chan@broadcom.com Cc: davem@davemloft.net, edumazet@google.com, gospo@broadcom.com, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, Vikas Gupta , Somnath Kotur , Pavan Chebbi Subject: [PATCH net-next 1/7] bnxt_en: Add delay to handle Downstream Port Containment (DPC) AER Date: Sun, 31 Mar 2024 20:57:24 -0700 Message-Id: <20240401035730.306790-2-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240401035730.306790-1-pavan.chebbi@broadcom.com> References: <20240401035730.306790-1-pavan.chebbi@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Vikas Gupta In case of DPC, after issuing the hot reset, the kernel waits for 100ms for the device to complete the reset. However on some older chips, the firmware may take up to 1 second to complete the reset, only after which the driver can restart the card. Introduce delay of 900ms to handle this scenario on the older chipsets. Signed-off-by: Vikas Gupta Reviewed-by: Michael Chan Reviewed-by: Somnath Kotur Signed-off-by: Pavan Chebbi --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index b4db4b1aaffb..6e24a341ad28 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -15550,6 +15550,10 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) netdev_info(bp->dev, "PCI Slot Reset\n"); + if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS) && + test_bit(BNXT_STATE_PCI_CHANNEL_IO_FROZEN, &bp->state)) + msleep(900); + rtnl_lock(); if (pci_enable_device(pdev)) { From patchwork Mon Apr 1 03:57:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Chebbi X-Patchwork-Id: 13612508 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBB752900 for ; Mon, 1 Apr 2024 03:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943669; cv=none; b=sjE2Q/WHW+z3VSvydoheidUr5QNJeEFrZ1ZqM57fvg74M+JBamDpUsYR9jBcAh3G0WFIT37CQnneS36qSbIvcpeR5BTM3fMH8S4KCjKqsa/uEUJoatqJSsm2qm5koLKTBti8i88Lwkd9fkJ1ksxI4BhMxObJcnAGlTFV7mcOmMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943669; c=relaxed/simple; bh=rO2MpXEnA5lJ3PnVWjtu4Id7Bc2Nen4BUGpkbmuP2NU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=XlhN8Td3yQHl/EaHjLPd0gP5sVB9SaZfmnAipNgFgaXLxOFSeZ6ISHqQ9raLdr47vXmdKta+7qgbMN24YhVL5xQGzSLWxY6FmTmgF7Bceid3aCiHNGz1+Zpc7ZJ/q0C1wOuOVaQ/p81q2U2pXRiGU3Q1jiJQJzw6tAtUq9e2kgI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=evphzsQI; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="evphzsQI" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6e6b729669bso3165403b3a.3 for ; Sun, 31 Mar 2024 20:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1711943667; x=1712548467; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=xuE3VnBqMuSperiTqR8BuLLQZMQckOOFQZAiTAI55VA=; b=evphzsQIcrEnVK/KwIwlPJwkkc3oV4BtTrcHxUAD5RiB3JsO/hvbg+gmU8YWu92iIW DN81eru5TiUNDEQ0wIDwFfy2ATQ6AF9ukoP0IQc/q3oqRrW19n1jxCQRhrZSuPxra8m+ cPYH4NVD5PryEaNd1vNnjWgTRSmJ4KdaCS2dc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711943667; x=1712548467; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xuE3VnBqMuSperiTqR8BuLLQZMQckOOFQZAiTAI55VA=; b=Q6i6Tq8PIRV0x4EXtbvr5yykjI3GZe6MW/Z8pLO+GKt/swzpgstEwoCiqLZSKIJ/SU z0t0JZoIZdfTdujF/xyuXg/cCwTaguKtrm3D8mM2WtAzEZQ7+E59w478risIHclEHVUO pEikFXfFgLdy4JoS9vOUhABt30GAXSjcwkfDkSEvRaNgrNt6dg7cYMdc4ldJbJLBDgoH Pd1vSh+5hCFPbxBO6dPXxzvE9jjakq0UM9z74l/PDoyieD6BdPkQVNYeySICR+DtfqAN ifCt73H5uy9W5P6RV+kRO1wJD2566m6ECTfeDqHtKkB5FkHk90AFm1ht4KSkYU6kw3Yq DLVQ== X-Forwarded-Encrypted: i=1; AJvYcCU8cs8SfjWrDliP4rDX5HccNomoOPtSxFZU7SCdXPhbdn7fjijKto9kJSrtADvdQdJsH7G8oPw8Mi3AO7RPr+fhL6G3q0ag X-Gm-Message-State: AOJu0YwDirfX3MRA/x5wSmAzg1eoWdIVDcmGEJHg3VUZy1smzQsyyt1E XmE4HwVHeaYwijmRA/vKRDh67J5aFGBrs6OYbX9t37tRaC1Zyu+/sqwarc6FWQ== X-Google-Smtp-Source: AGHT+IHH8aO0K1LolGxAAojoERED0v6RiQ5ifv3y6EjgQbAIcvtjQn8GTZ8Iy7bfmr+pK9KQ6H3K8w== X-Received: by 2002:a05:6a00:a23:b0:6ea:f351:1df9 with SMTP id p35-20020a056a000a2300b006eaf3511df9mr8899372pfh.23.1711943666891; Sun, 31 Mar 2024 20:54:26 -0700 (PDT) Received: from PC-MID-R740.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id j26-20020a62b61a000000b006e73d1c0c0esm6860781pff.154.2024.03.31.20.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 20:54:26 -0700 (PDT) From: Pavan Chebbi To: michael.chan@broadcom.com Cc: davem@davemloft.net, edumazet@google.com, gospo@broadcom.com, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, Somnath Kotur , Pavan Chebbi Subject: [PATCH net-next 2/7] bnxt_en: Enable XPS by default on driver load Date: Sun, 31 Mar 2024 20:57:25 -0700 Message-Id: <20240401035730.306790-3-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240401035730.306790-1-pavan.chebbi@broadcom.com> References: <20240401035730.306790-1-pavan.chebbi@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Somnath Kotur Enable XPS on default during NIC open. The choice of Tx queue is based on the CPU executing the thread that submits the Tx request. The pool of Tx queues will be spread evenly across both device-attached NUMA nodes(local) and remote NUMA nodes. Signed-off-by: Somnath Kotur Reviewed-by: Michael Chan Signed-off-by: Pavan Chebbi --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 45 ++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 6e24a341ad28..54955f878b73 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -11804,6 +11804,45 @@ static void bnxt_cfg_usr_fltrs(struct bnxt *bp) bnxt_cfg_one_usr_fltr(bp, usr_fltr); } +static int bnxt_set_xps_mapping(struct bnxt *bp) +{ + int numa_node = dev_to_node(&bp->pdev->dev); + unsigned int q_idx, map_idx, cpu, i; + const struct cpumask *cpu_mask_ptr; + int nr_cpus = num_online_cpus(); + cpumask_t *q_map; + int rc = 0; + + q_map = kcalloc(bp->tx_nr_rings_per_tc, sizeof(*q_map), GFP_KERNEL); + if (!q_map) + return -ENOMEM; + + /* Create CPU mask for all TX queues across MQPRIO traffic classes. + * Each TC has the same number of TX queues. The nth TX queue for each + * TC will have the same CPU mask. + */ + for (i = 0; i < nr_cpus; i++) { + map_idx = i % bp->tx_nr_rings_per_tc; + cpu = cpumask_local_spread(i, numa_node); + cpu_mask_ptr = get_cpu_mask(cpu); + cpumask_or(&q_map[map_idx], &q_map[map_idx], cpu_mask_ptr); + } + + /* Register CPU mask for each TX queue excluding the ones marked for XDP */ + for (q_idx = 0; q_idx < bp->dev->real_num_tx_queues; q_idx++) { + map_idx = q_idx % bp->tx_nr_rings_per_tc; + rc = netif_set_xps_queue(bp->dev, &q_map[map_idx], q_idx); + if (rc) { + netdev_warn(bp->dev, "Error setting XPS for q:%d\n", q_idx); + break; + } + } + + kfree(q_map); + + return rc; +} + static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) { int rc = 0; @@ -11866,8 +11905,12 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) } } - if (irq_re_init) + if (irq_re_init) { udp_tunnel_nic_reset_ntf(bp->dev); + rc = bnxt_set_xps_mapping(bp); + if (rc) + netdev_warn(bp->dev, "failed to set xps mapping\n"); + } if (bp->tx_nr_rings_xdp < num_possible_cpus()) { if (!static_key_enabled(&bnxt_xdp_locking_key)) From patchwork Mon Apr 1 03:57:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Chebbi X-Patchwork-Id: 13612509 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26D4B1362 for ; Mon, 1 Apr 2024 03:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943679; cv=none; b=PlxYvl9V5NfsR+AllRba6VafKaG6e4RF3shvafDq8gmhwBCVS7BL2vkc/VABT86HJtmj+6j8VZmiZeG7FlPqyJTFNAD2z4ifFJdw7WvpykGCpSZ4yud7wou9IJCJWpYvkVOGsvYrJOQb/AYvhv43DOvj3VY74/GatdT6caKWauc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943679; c=relaxed/simple; bh=v6EgFqXGgCC2eRlc/QdcfmwL+zjGqo0icPD5UOdp9dM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=tv1F0Vm+tE7KCXYfN1+mwP9mrSw7z7m+OPbdRJ4GnODdND70wMEtyxVgKUr0ifcn8kKHEertN6HZmseWK2yGX/R2FHwBZmbz8NSjoxdi17SgtrMyPzRD5WLaQosC0bIEKAHXuMHvo4FlHVBg78kGnHpKlmgGUWPovBFxRKktbEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=KE6RAx+Z; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="KE6RAx+Z" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6eaf9565e6bso518260b3a.2 for ; Sun, 31 Mar 2024 20:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1711943677; x=1712548477; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=8BjqilM74GRRDq2ay7A4MQVHJmkqlbZ6Mx/kL5WjtGI=; b=KE6RAx+ZhngLa/kwOzNGFOjYB967cCDaEbsrHvA/Bb3VlDUtKzAcEz4TiuscNXg2WE VH88D1hRJfW3pe5FQWrcXr+Cj5GVZRrC6LE8ApbwZzQxanoFBu+ZWX3AFPgfjcYI6JiM Y11oGyKfI633blxqnWBWfFE5MNGpfur++GrJs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711943677; x=1712548477; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8BjqilM74GRRDq2ay7A4MQVHJmkqlbZ6Mx/kL5WjtGI=; b=efjDHaWCm3asRdLEE0i6A7EmuIaK6YGqjqGUw32iiScgaNuqi0SKLkdOT6CykxzRVl glvf9X79/eVvU6movm+8UuDu6JxbOhzTysAjjl7Apu25oS+pBrhpd+PinQPe1SeCZ/Pg /ps8rLz1o1AomXFyCl7rIAilO3F8N8fQBv1tXqvssa4wsf331e3VNudCHGsnXRMUN+SN W4RiwAzQqCnkgB7F+mmW2ezt7obA9BX+O7m4MhreAt8q1VJSppkurzBtk4uMsFVeX/9G u/Exei/mXZS/v5hXRAh7Te8bKdjMjcCu/WpKKpMekadjqPeQlTk7F++IJ8YWA1p+2POB 1z0w== X-Forwarded-Encrypted: i=1; AJvYcCUkW82fn5qpzW+7k4aeu9X/gabosXYXuNAhsXCx9Qh9saYcHMQLQGcqO+1Dpcn/F4KlM083wwswqr7Xo9jCsPjPmg4zM1ZP X-Gm-Message-State: AOJu0YzYbH06gGXZ/yOk4995XJGP1HF3ivT6ZPTtiplaQugQsfRSDj9Q eWgHkLEVYPmoQqqVSFg3uSa6E2WkN1wShyYxBZXsYErhOwLiXZ20muydCucZPQ== X-Google-Smtp-Source: AGHT+IGeFQJtFbQSwpFsIkTQL8dYqSt2k6eCY5RNDdJdZ2ulWR7hWoz/upvMYZsEM1PC5XXDmTO15g== X-Received: by 2002:a05:6a00:2196:b0:6ea:f7e2:49b8 with SMTP id h22-20020a056a00219600b006eaf7e249b8mr5026480pfi.3.1711943677301; Sun, 31 Mar 2024 20:54:37 -0700 (PDT) Received: from PC-MID-R740.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id j26-20020a62b61a000000b006e73d1c0c0esm6860781pff.154.2024.03.31.20.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 20:54:36 -0700 (PDT) From: Pavan Chebbi To: michael.chan@broadcom.com Cc: davem@davemloft.net, edumazet@google.com, gospo@broadcom.com, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, Somnath Kotur , Andy Gospodarek , Pavan Chebbi Subject: [PATCH net-next 3/7] bnxt_en: Allocate page pool per numa node Date: Sun, 31 Mar 2024 20:57:26 -0700 Message-Id: <20240401035730.306790-4-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240401035730.306790-1-pavan.chebbi@broadcom.com> References: <20240401035730.306790-1-pavan.chebbi@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Somnath Kotur Driver's Page Pool allocation code looks at the node local to the PCIe device to determine where to allocate memory. In scenarios where the core count per NUMA node is low (< default rings) it makes sense to exhaust page pool allocations on Node 0 first and then moving on to allocating page pools for the remaining rings from Node 1. With this patch, and the following configuration on the NIC $ ethtool -L ens1f0np0 combined 16 (core count/node = 12, first 12 rings on node#0, last 4 rings node#1) and traffic redirected to a ring on node#1 , we see a performance improvement of ~20% Signed-off-by: Somnath Kotur Reviewed-by: Andy Gospodarek Reviewed-by: Michael Chan Signed-off-by: Pavan Chebbi --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 54955f878b73..42b5825b0664 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -3559,14 +3559,15 @@ static void bnxt_free_rx_rings(struct bnxt *bp) } static int bnxt_alloc_rx_page_pool(struct bnxt *bp, - struct bnxt_rx_ring_info *rxr) + struct bnxt_rx_ring_info *rxr, + int numa_node) { struct page_pool_params pp = { 0 }; pp.pool_size = bp->rx_agg_ring_size; if (BNXT_RX_PAGE_MODE(bp)) pp.pool_size += bp->rx_ring_size; - pp.nid = dev_to_node(&bp->pdev->dev); + pp.nid = numa_node; pp.napi = &rxr->bnapi->napi; pp.netdev = bp->dev; pp.dev = &bp->pdev->dev; @@ -3586,7 +3587,8 @@ static int bnxt_alloc_rx_page_pool(struct bnxt *bp, static int bnxt_alloc_rx_rings(struct bnxt *bp) { - int i, rc = 0, agg_rings = 0; + int numa_node = dev_to_node(&bp->pdev->dev); + int i, rc = 0, agg_rings = 0, cpu; if (!bp->rx_ring) return -ENOMEM; @@ -3597,10 +3599,15 @@ static int bnxt_alloc_rx_rings(struct bnxt *bp) for (i = 0; i < bp->rx_nr_rings; i++) { struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i]; struct bnxt_ring_struct *ring; + int cpu_node; ring = &rxr->rx_ring_struct; - rc = bnxt_alloc_rx_page_pool(bp, rxr); + cpu = cpumask_local_spread(i, numa_node); + cpu_node = cpu_to_node(cpu); + netdev_dbg(bp->dev, "Allocating page pool for rx_ring[%d] on numa_node: %d\n", + i, cpu_node); + rc = bnxt_alloc_rx_page_pool(bp, rxr, cpu_node); if (rc) return rc; From patchwork Mon Apr 1 03:57:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Chebbi X-Patchwork-Id: 13612510 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76FAC53A6 for ; Mon, 1 Apr 2024 03:54:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943691; cv=none; b=FKfCv3UqqH5jZtQCup7NkdwRZ3A3MndPyJrzNQi25d52tptNbRxFJQzdWjgCJlH4TXV5R00QpjYoe2sb7G99EadXbDes4eFud/BLWpvK7msGYxczpfWbvhunceehb1W1vBI+zcEYnm0cE2lzQS12zSIyt+gJ9qKOB9CBWMqvg0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943691; c=relaxed/simple; bh=gygywHWOhfFDWFucooLoyMYx5/f91MMdBm0DrEf38SY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=HjAhEEk/zy1E59HwBXqsZLO1MYX45AY6jSRDRK3RNPePGi77av5DsYorNTCpSOyehH+CFYq3GsxQZLov3GhKgY+pdVnFdMuJwI59ir2v0o0CjDOJsyXZfB6rR+8R2quXOkU7ALYL1G2mll1GltHc7OH2Nor5oeXrVJBKBo+iHek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=KpANk7QG; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="KpANk7QG" Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-222c0572eedso2176319fac.3 for ; Sun, 31 Mar 2024 20:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1711943688; x=1712548488; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=qW0pvJZPDNoJUzve9qmLsh+FgglALEf7XB6C6JBFDsU=; b=KpANk7QGQWSSmrW5DORF+gmJ6EbVm6snnAIEu8szFXN6EG3rBqUaFRl+0Xxc3kO9G9 Iwb+GEvp8s+rYA94HjipSIG5yATmS15N/ODIQH7ugREDwr0strZUWVSDTP2DI4LuCtQS QRebCoe7JbbcXOlh4I+QiAe6DbUGIrqyEoGJo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711943688; x=1712548488; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qW0pvJZPDNoJUzve9qmLsh+FgglALEf7XB6C6JBFDsU=; b=DX8o5RvSxbuYwGzVn1jYt5tNsJ7mehT9cQSkql03XnAMsly5ge9QEq76u+1kZMyIsK pbRdrPT09B5BDMF1JfgYmhXMaU49nR4apz1DrBElVRXtmFgWk4sp4F9JPjB2oth/X0gy d/6EDnNUBXvjgJDmey/HcGOFmpw7oNZVkdl5VCkJvS+o3sVtrmJn1Nqq/c8WXs4cWZU6 0cT2XW7Ax6seZEjH3LJfVnqJXQKmOdPziYjdnaZDyv+D3ltdAexZTKZnhk3M/vovzCuU t9hblzJZF2rDCWfpTOsTH0fstFKl7D6RMKbk7b+se9mMceuOWDQBX2EYt89yjfLfWAv6 gdPA== X-Forwarded-Encrypted: i=1; AJvYcCW1YUH+O0FPX0OOwuYRi+wpyeoM/UgT7d1uG9UkAth9cNsgrWa2ovtZfAWZASiTcEJVuW/cE8I8QHA7jVhyoQAuobniNEqZ X-Gm-Message-State: AOJu0YxVuiwAIb7vS3q62N+zjYK1//G+NjXUVkiJZzCwXUod5RybsoTx KQKCs9HwC0Ndnr0kwjEvX6m5H7qlSD7LHB4+o9K3J4gu/tEn0U6T8YH4ZmlN4w== X-Google-Smtp-Source: AGHT+IEE2BevOt4MTuxGTl8bpgXXyPH7MB7lPQ3+urrWCBuSZCWE9gND1HjynN6uhzJh30IrKsdbMQ== X-Received: by 2002:a05:6871:788d:b0:220:be2c:6083 with SMTP id oz13-20020a056871788d00b00220be2c6083mr10071624oac.49.1711943688426; Sun, 31 Mar 2024 20:54:48 -0700 (PDT) Received: from PC-MID-R740.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id j26-20020a62b61a000000b006e73d1c0c0esm6860781pff.154.2024.03.31.20.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 20:54:47 -0700 (PDT) From: Pavan Chebbi To: michael.chan@broadcom.com Cc: davem@davemloft.net, edumazet@google.com, gospo@broadcom.com, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, Somnath Kotur , Andy Gospodarek , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Pavan Chebbi Subject: [PATCH net-next 4/7] bnxt_en: Change bnxt_rx_xdp function prototype Date: Sun, 31 Mar 2024 20:57:27 -0700 Message-Id: <20240401035730.306790-5-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240401035730.306790-1-pavan.chebbi@broadcom.com> References: <20240401035730.306790-1-pavan.chebbi@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Somnath Kotur Change bnxt_rx_xdp() to take a pointer to xdp instead of stack variable. This is in prepartion for the XDP metadata patch change where the BPF program can change the value of the xdp.meta_data. Signed-off-by: Somnath Kotur Reviewed-by: Andy Gospodarek Reviewed-by: Michael Chan Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Jesper Dangaard Brouer Cc: John Fastabend Signed-off-by: Pavan Chebbi --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 28 +++++++++---------- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 42b5825b0664..7dda4cd76715 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2104,7 +2104,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, } if (xdp_active) { - if (bnxt_rx_xdp(bp, rxr, cons, xdp, data, &data_ptr, &len, event)) { + if (bnxt_rx_xdp(bp, rxr, cons, &xdp, data, &data_ptr, &len, event)) { rc = 1; goto next_rx; } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 4079538bc310..6b904b4f4d34 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -222,7 +222,7 @@ void bnxt_xdp_buff_frags_free(struct bnxt_rx_ring_info *rxr, * false - packet should be passed to the stack. */ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, - struct xdp_buff xdp, struct page *page, u8 **data_ptr, + struct xdp_buff *xdp, struct page *page, u8 **data_ptr, unsigned int *len, u8 *event) { struct bpf_prog *xdp_prog = READ_ONCE(rxr->xdp_prog); @@ -244,9 +244,9 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, txr = rxr->bnapi->tx_ring[0]; /* BNXT_RX_PAGE_MODE(bp) when XDP enabled */ - orig_data = xdp.data; + orig_data = xdp->data; - act = bpf_prog_run_xdp(xdp_prog, &xdp); + act = bpf_prog_run_xdp(xdp_prog, xdp); tx_avail = bnxt_tx_avail(bp, txr); /* If the tx ring is not full, we must not update the rx producer yet @@ -255,10 +255,10 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, if (tx_avail != bp->tx_ring_size) *event &= ~BNXT_RX_EVENT; - *len = xdp.data_end - xdp.data; - if (orig_data != xdp.data) { - offset = xdp.data - xdp.data_hard_start; - *data_ptr = xdp.data_hard_start + offset; + *len = xdp->data_end - xdp->data; + if (orig_data != xdp->data) { + offset = xdp->data - xdp->data_hard_start; + *data_ptr = xdp->data_hard_start + offset; } switch (act) { @@ -270,8 +270,8 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, mapping = rx_buf->mapping - bp->rx_dma_offset; *event &= BNXT_TX_CMP_EVENT; - if (unlikely(xdp_buff_has_frags(&xdp))) { - struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(&xdp); + if (unlikely(xdp_buff_has_frags(xdp))) { + struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp); tx_needed += sinfo->nr_frags; *event = BNXT_AGG_EVENT; @@ -279,7 +279,7 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, if (tx_avail < tx_needed) { trace_xdp_exception(bp->dev, xdp_prog, act); - bnxt_xdp_buff_frags_free(rxr, &xdp); + bnxt_xdp_buff_frags_free(rxr, xdp); bnxt_reuse_rx_data(rxr, cons, page); return true; } @@ -289,7 +289,7 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, *event |= BNXT_TX_EVENT; __bnxt_xmit_xdp(bp, txr, mapping + offset, *len, - NEXT_RX(rxr->rx_prod), &xdp); + NEXT_RX(rxr->rx_prod), xdp); bnxt_reuse_rx_data(rxr, cons, page); return true; case XDP_REDIRECT: @@ -306,12 +306,12 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, /* if we are unable to allocate a new buffer, abort and reuse */ if (bnxt_alloc_rx_data(bp, rxr, rxr->rx_prod, GFP_ATOMIC)) { trace_xdp_exception(bp->dev, xdp_prog, act); - bnxt_xdp_buff_frags_free(rxr, &xdp); + bnxt_xdp_buff_frags_free(rxr, xdp); bnxt_reuse_rx_data(rxr, cons, page); return true; } - if (xdp_do_redirect(bp->dev, &xdp, xdp_prog)) { + if (xdp_do_redirect(bp->dev, xdp, xdp_prog)) { trace_xdp_exception(bp->dev, xdp_prog, act); page_pool_recycle_direct(rxr->page_pool, page); return true; @@ -326,7 +326,7 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, trace_xdp_exception(bp->dev, xdp_prog, act); fallthrough; case XDP_DROP: - bnxt_xdp_buff_frags_free(rxr, &xdp); + bnxt_xdp_buff_frags_free(rxr, xdp); bnxt_reuse_rx_data(rxr, cons, page); break; } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h index 5e412c5655ba..0122782400b8 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h @@ -18,7 +18,7 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, struct xdp_buff *xdp); void bnxt_tx_int_xdp(struct bnxt *bp, struct bnxt_napi *bnapi, int budget); bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, - struct xdp_buff xdp, struct page *page, u8 **data_ptr, + struct xdp_buff *xdp, struct page *page, u8 **data_ptr, unsigned int *len, u8 *event); int bnxt_xdp(struct net_device *dev, struct netdev_bpf *xdp); int bnxt_xdp_xmit(struct net_device *dev, int num_frames, From patchwork Mon Apr 1 03:57:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Chebbi X-Patchwork-Id: 13612511 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE8178495 for ; Mon, 1 Apr 2024 03:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943696; cv=none; b=SrnJr0U7IG/xs3mq39yfGZeqpeMlFFpRStWi0seMjrYk+g2xIXejoEPEak12ZfGE8myjRFX+cqxAR12yp8xRY8UysJe/wrIO3odBKbQmE/n7OYG9yeyqSzXDNiz3n6FGE/SMe4w2T+f5u9CPWVtKDI9u59KmSgxi5gFVUAkbCH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943696; c=relaxed/simple; bh=tfQvJubytWLf9Ir6N7h6RFpZWcwbBqzXG2L9H0MfRFM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Nq0pOkmGA3p9sbDAaC0BjzX3X1rtKObUtaxR2XlHPySzr/lo3o5R8oY1zDZRYWwSCDH2byxAbIemDmouIKagTtFrW1reds4fEZzrOb5O8wdEtnJrskwfACcs7eO0+8Jrh2inO7ziooyngZgnyYH1/Je1SzupP4eve7Xxfzx69Sg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=gEW/Wucq; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="gEW/Wucq" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6e6f69e850bso4126693b3a.0 for ; Sun, 31 Mar 2024 20:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1711943694; x=1712548494; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=uypmKG72zh7U1cPnFQmXQqt/IU0mVzKjci1R1LjjDwo=; b=gEW/WucqQ5Bq4ABLHs79+wAgWw4DELWEBCRMB98+/EipH/wmrQ1S/z7YNM8APK27f/ ewiKn/dmnUlapoMWPpAK/VG9MNMBd+hC3um1md4slob2jd8ee0UxRafZEF/i8qcnZEIu FC+DSaapsFRWG1YcjvAB7e9EpHhjnG/foEMj0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711943694; x=1712548494; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uypmKG72zh7U1cPnFQmXQqt/IU0mVzKjci1R1LjjDwo=; b=ZaGMPDaN6WySCdOjcy694gk3x+eH1chdJ/FselMwI5nJ4G7721uKwZCVS/b57BxapG 3TqA3EKgX07X9apDk9NjZHY4B9Sw/1V1dVO/nvRlQpqGyxjmRt2KY+m1gD46er7zsiNV mlATKF601UqtSZelJFeCV5w34sElCWIqtCdGb9TNaZ0pktDhFnp4GxQ2/58xGDyuPOz2 badiNBqhkH6an+qFQQ72sakbzN0Mp3hbazR9gvppoz/4KWtVOz0zVYoykBv+FPaPgElA R0mvWvlkXs7buYtgOQdaV50HXuLMbRCGNz8h2KyJXqdDISF9XCK7mL28ZLg6lK2mVfNH upWw== X-Forwarded-Encrypted: i=1; AJvYcCWKA3g0tIqB/tf0AQMnmTKvQfUZw8xHuH293JwsyGubOjmuTYJoOSzmBH9T49H8SW5sV0erqeSoBRY3XL320aEnxBnjqx2r X-Gm-Message-State: AOJu0YzqN5HbNc0caJfMWJjA1xzJVQwdvrjuRYENmnAPESLDulcLFBKt Ty4kK/HT/Ec4zcg+j6jyMmBQf1SoQGQ0G5t50hGSEgO135J4fPX77ebkw3oZ3Q== X-Google-Smtp-Source: AGHT+IGrmCmCc39bLwkGm81kCtIy4qoDlo3y55UyQNogGYecD7m/KewzCflIxZ8+dZqx8S1S8Hu7tQ== X-Received: by 2002:a05:6a00:14ca:b0:6e6:9942:fd97 with SMTP id w10-20020a056a0014ca00b006e69942fd97mr10467515pfu.15.1711943693822; Sun, 31 Mar 2024 20:54:53 -0700 (PDT) Received: from PC-MID-R740.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id j26-20020a62b61a000000b006e73d1c0c0esm6860781pff.154.2024.03.31.20.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 20:54:53 -0700 (PDT) From: Pavan Chebbi To: michael.chan@broadcom.com Cc: davem@davemloft.net, edumazet@google.com, gospo@broadcom.com, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, Somnath Kotur , Pavan Chebbi , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend Subject: [PATCH net-next 5/7] bnxt_en: Add XDP Metadata support Date: Sun, 31 Mar 2024 20:57:28 -0700 Message-Id: <20240401035730.306790-6-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240401035730.306790-1-pavan.chebbi@broadcom.com> References: <20240401035730.306790-1-pavan.chebbi@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Somnath Kotur - Change the last arg to xdp_prepare_buff to true from false. - Ensure that when XDP_PASS is returned the xdp->data_meta area is copied to the skb->data area. Account for the meta data size on skb allocation and do a pull after to move it to the "reserved" zone. Signed-off-by: Somnath Kotur Reviewed-by: Michael Chan Reviewed-by: Pavan Chebbi Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Jesper Dangaard Brouer Cc: John Fastabend Signed-off-by: Pavan Chebbi --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 44 +++++++++++++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 2 +- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 7dda4cd76715..1494b550299a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1296,9 +1296,9 @@ static int bnxt_agg_bufs_valid(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, return RX_AGG_CMP_VALID(agg, *raw_cons); } -static inline struct sk_buff *bnxt_copy_skb(struct bnxt_napi *bnapi, u8 *data, - unsigned int len, - dma_addr_t mapping) +static inline struct sk_buff *bnxt_copy_data(struct bnxt_napi *bnapi, u8 *data, + unsigned int len, + dma_addr_t mapping) { struct bnxt *bp = bnapi->bp; struct pci_dev *pdev = bp->pdev; @@ -1318,6 +1318,39 @@ static inline struct sk_buff *bnxt_copy_skb(struct bnxt_napi *bnapi, u8 *data, bp->rx_dir); skb_put(skb, len); + + return skb; +} + +static inline struct sk_buff *bnxt_copy_skb(struct bnxt_napi *bnapi, u8 *data, + unsigned int len, + dma_addr_t mapping) +{ + return bnxt_copy_data(bnapi, data, len, mapping); +} + +static inline struct sk_buff *bnxt_copy_xdp(struct bnxt_napi *bnapi, + struct xdp_buff *xdp, + unsigned int len, + dma_addr_t mapping) +{ + unsigned int metasize = 0; + u8 *data = xdp->data; + struct sk_buff *skb; + + len = xdp->data_end - xdp->data_meta; + metasize = xdp->data - xdp->data_meta; + data = xdp->data_meta; + + skb = bnxt_copy_data(bnapi, data, len, mapping); + if (!skb) + return skb; + + if (metasize) { + skb_metadata_set(skb, metasize); + __skb_pull(skb, metasize); + } + return skb; } @@ -2111,7 +2144,10 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, } if (len <= bp->rx_copy_thresh) { - skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr); + if (!xdp_active) + skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr); + else + skb = bnxt_copy_xdp(bnapi, &xdp, len, dma_addr); bnxt_reuse_rx_data(rxr, cons, data); if (!skb) { if (agg_bufs) { diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 6b904b4f4d34..345681d5007e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -197,7 +197,7 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, dma_sync_single_for_cpu(&pdev->dev, mapping + offset, len, bp->rx_dir); xdp_init_buff(xdp, buflen, &rxr->xdp_rxq); - xdp_prepare_buff(xdp, data_ptr - offset, offset, len, false); + xdp_prepare_buff(xdp, data_ptr - offset, offset, len, true); } void bnxt_xdp_buff_frags_free(struct bnxt_rx_ring_info *rxr, From patchwork Mon Apr 1 03:57:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Chebbi X-Patchwork-Id: 13612512 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6553A53BE for ; Mon, 1 Apr 2024 03:54:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943701; cv=none; b=lXjjNaapNhC0sI5CCaionL0bStIoOQScgCjSfmlLqUMopKZE4ZAn7azyyJpL8m5D/8TNePAF6cagMdDhUAFrmC68sKlrjQ6ZrRWwvMFizMm46h3DmMxfswN0xVokPFK613vypUcKM4qdFgtiz5LySbAh6FKboTZDRnlSwplzBVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943701; c=relaxed/simple; bh=yuiFM2kXpo3KIuGh/8JZNcZXC0j2EtiHR8B8svau268=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=gyef+prf/UeqhElkbZYqI1WAgyCIDStgWh74V7oUxReu+Y0eJj0yr/YEyqn7WciX5vZU/oeoeE+59Dj747nilDahFitGLAW6ecnuw5g+RZE3KczoBRv4pgZJ+mLRs7uUtoAxBlXpQfP2NO/coodbbQ4r3ZnsfRSoEIQCp5/Wlak= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=OzQW6x8T; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="OzQW6x8T" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6eaf1a3e917so1226767b3a.2 for ; Sun, 31 Mar 2024 20:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1711943699; x=1712548499; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=wyMmvTt2whW0Vx2QjmPEeehtScXqjOulYZX6iAemH2M=; b=OzQW6x8T1aZk0eF1u2QeeKjPElyW29YtRpJY5lVjMsKNYiXpAQiSolKNuSZnhhVPnE YtN0cBn2bZN4FHIaQAOz+74dU+S7d89J9k33boN3m0FFE60HlAte/MJw3EQbI+L6+rIt T+mDWlTLnLK2UWWwPpce+n8JKiXycuHTYcH7w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711943699; x=1712548499; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wyMmvTt2whW0Vx2QjmPEeehtScXqjOulYZX6iAemH2M=; b=qDRcUZvToFqi8V/B+e2TiNQjYBIkN8f8LskT4J8NBukklCInYNGiM1qND6KCkAyqMC gCTEx9BNXPGfVnTNyn02lMMcz4SqG+UDfUYaoxKmN0IkAINM+Bfc+J8gaZiG4z5RcSc+ a589vQ7ntsJwCyGJoc1Nyyanf9HGTDjRv/XnBrygJL+ToyJtPdjf70qm+RF9bZYcIwto BQT3tkSN49o6GfzcPUW5gaiwpZBDWsaYRlwUZ8+NRfrb6bHdq2bScDeWn4icVjhJaqso AeMWIn3nMVX5DV/GmL4ykTLchg+jWr8CNn1RIputOdKKbgvGEebkF4qvBwIQ8WvzyeKI zxOA== X-Forwarded-Encrypted: i=1; AJvYcCWAQdM3AL4ukVCq8nC9V6pv/9kiRrilnSlwhE6/bOyTpTdH/E9L6pa4s9bjKYU54GSlgCKVsDSbLAaM6aEBvux1mNU+kqp4 X-Gm-Message-State: AOJu0Yw2vmaBJHx3eaU9ij+aCtBVJKsAMbiypiPnDo5u6jLTbkc9WlES uVRbWZ2Tggvdp7iO4LWamvTyG1xzopn1jBHGGwan04A7VyLvBZcxn9redh4DyA== X-Google-Smtp-Source: AGHT+IHUGPhGIVZeZUWyFI/+yfzxUqUYK9fbpbJY0dOJTz6pSmW4JJ+RTsVYuhhx5U86Lr+LiZOoPw== X-Received: by 2002:a05:6a00:4fc8:b0:6e7:82f2:efeb with SMTP id le8-20020a056a004fc800b006e782f2efebmr7883585pfb.22.1711943698428; Sun, 31 Mar 2024 20:54:58 -0700 (PDT) Received: from PC-MID-R740.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id j26-20020a62b61a000000b006e73d1c0c0esm6860781pff.154.2024.03.31.20.54.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 20:54:57 -0700 (PDT) From: Pavan Chebbi To: michael.chan@broadcom.com Cc: davem@davemloft.net, edumazet@google.com, gospo@broadcom.com, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, Pavan Chebbi Subject: [PATCH net-next 6/7] bnxt_en: Update firmware interface to 1.10.3.39 Date: Sun, 31 Mar 2024 20:57:29 -0700 Message-Id: <20240401035730.306790-7-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240401035730.306790-1-pavan.chebbi@broadcom.com> References: <20240401035730.306790-1-pavan.chebbi@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org This updated interface supports backing store APIs to configure host FW trace buffers, updates transceivers ID types, updates to TrueFlow features and other changes for the basic L2 features. Signed-off-by: Pavan Chebbi Reviewed-by: Michael Chan X-Patchwork-Id: 13612513 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E723B5382 for ; Mon, 1 Apr 2024 03:55:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943706; cv=none; b=eDLjO0LZOypmxlvsngpWTCR+V76eaOOPQRiH0Kp07vGyLFH+d0W4ywyZY3CNtkBBhaKub3mxLm4sElzBgvJgsdtz/A1wtUXAESuxeT6COgHTDF5x3k/ltOC8j2DQeKXYmRruP04i98VWwqo5hprkNAnfrpRnTAZkUiPTGif9V1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711943706; c=relaxed/simple; bh=Sw0+7BLxyfE/cxFpUiyXsg+I3/tE2uw/nrEBopyVHY0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=jtW+FfdCiQN+9WMHb6qofdmMtbU1Lk+8ylfYiE6A8Bc/MwqZ4cIFbX9vl4dT4mud9t2hgIgxahEQkEgUrvUmKBKi5shgZ9JhU93qLcQMPy1JBRyfmx44O/R1VAynScUpwrRdu1ZSd5k08UP2w4XOLO4Uw0NAf0REmd/NKaXR8bo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Ksr9vbM4; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Ksr9vbM4" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3c3e2e18db7so2458464b6e.0 for ; Sun, 31 Mar 2024 20:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1711943704; x=1712548504; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=UImoD6jWbwESHi15bSVpmYLawqoHbLGC4bQ9Z6wY4go=; b=Ksr9vbM4fKNS+3M34fWUK7fQuGRQC4ZMBhR8vfqbvqPzOsKETggorr6D6gZy4ZvIe8 QVZKyIQadvPlFbeXKuRFHOrkAazmx8eLl/JCZVeEIn0huHHqtcU7TXLPhvSHW34or5X1 5jPcVwwmlzeOOK0T50aNitncxfo5xJFbGED3o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711943704; x=1712548504; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UImoD6jWbwESHi15bSVpmYLawqoHbLGC4bQ9Z6wY4go=; b=WOIc+X+oxYT/PXJ70FM5xgIps1AwH31WFGwTt7Zg7Uw3Dt41zn3Y3zY1IDAeq+KNxo YhMwLAkTzehbWmkBwIw6MTxS0tXNBIP3M3rACUnfJSrqBHhgvKPZohjB4hp5BPM/mYVi 7jk/snU86LZf7fLcrzi5JQ6r3QNmLzHwkVl93ea2mOULfL/lK4/VdooRv15/pDQy9EJb sIi4pTBwvrTFZ3SU5trxMhzFo7bHrxGoGXQx1Rh4wGDT2FqdwVF37OuPgYZleWYOTLTA OklYqvsTlTmHQwPZKuF4qQBJpHfkEDEV8sM5lj+DbZsdkYWlJmWj2qkcLvPtReaK8Dqe RMJQ== X-Forwarded-Encrypted: i=1; AJvYcCXzQYzks5PxZfIhIqrOhPldnAdeU3EgPkOgeX+7PrSyav8obQTxuAjDK+BocummTFcfkzE+11RGHScOQPpIzDSeDWzdy2yU X-Gm-Message-State: AOJu0YzXzzflQl8ag7WxzP5RkUKkngU/ImQx3yqP1nMwxJvQyh1F+VpI HIziJK+pJgMBPRn1wg2IUmXCnKICMvYAzHzGdSobnsqyw2JX/giqiH454P0cLQ== X-Google-Smtp-Source: AGHT+IHSFBLxqKfwBYFhWQUcPLu79xM0tEg3agHZiy5LI1aOxWfQi37HgZXaOSegYnMxUKSZxpp62g== X-Received: by 2002:a05:6808:3a0c:b0:3c3:d731:ae51 with SMTP id gr12-20020a0568083a0c00b003c3d731ae51mr15293684oib.29.1711943703486; Sun, 31 Mar 2024 20:55:03 -0700 (PDT) Received: from PC-MID-R740.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id j26-20020a62b61a000000b006e73d1c0c0esm6860781pff.154.2024.03.31.20.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 20:55:02 -0700 (PDT) From: Pavan Chebbi To: michael.chan@broadcom.com Cc: davem@davemloft.net, edumazet@google.com, gospo@broadcom.com, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, Sreekanth Reddy , Kalesh AP , Somnath Kotur , Pavan Chebbi Subject: [PATCH net-next 7/7] bnxt_en: Add warning message about disallowed speed change Date: Sun, 31 Mar 2024 20:57:30 -0700 Message-Id: <20240401035730.306790-8-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240401035730.306790-1-pavan.chebbi@broadcom.com> References: <20240401035730.306790-1-pavan.chebbi@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Sreekanth Reddy Some chips may not allow changing default speed when dual rate transceivers modules are used. Firmware on those chips will indicate the same to the driver. Add a warning message when speed change is not supported because a dual rate transceiver is detected by the NIC. Signed-off-by: Sreekanth Reddy Reviewed-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Michael Chan Signed-off-by: Pavan Chebbi --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 1494b550299a..e64c681e2be8 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2525,6 +2525,11 @@ static bool bnxt_event_error_report(struct bnxt *bp, u32 data1, u32 data2) } return false; } + case ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_DUAL_DATA_RATE_NOT_SUPPORTED: + netdev_warn(bp->dev, + "Speed change not supported with dual rate transceivers on this board\n" + ); + break; default: netdev_err(bp->dev, "FW reported unknown error type %u\n", err_type);