From patchwork Thu Jan 16 16:38:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13941966 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2069.outbound.protection.outlook.com [40.107.243.69]) (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 08A2122C9FB for ; Thu, 16 Jan 2025 16:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045570; cv=fail; b=fIhLjGAfLcZYYoJ9FowFf6B9hFG6odwfa7loRhigdyZtV+d7Bz4m3BqGnsU9SzwXJxn/FUHQku0a3bD36dUYhGeN5CFoovlfBtQjdmvaZ+VMH+HJvpbi/VpIw/IXLEYPtnVPS9g88WRPn9QoS2R0pK0cnB17FhDtZUs10TmFhTc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045570; c=relaxed/simple; bh=rmnuuN+7O7+kHtJnBgvz9vIKdQw/P8UIOKyTuVSxjGk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pEFExpiRq2/94rfzer7BnA3lZiAU4qGsLiGtDfhFsTegWHhGn3XAt5Yfp33bc4sHwVeqRXsYBfh+/fRiUNYWctEYy7CxkD803E3mN6tbMfKanjlIhCZVsnN65TVwaUL8uDy1+NKvEfNv/Vpj7jp3c+ONnYKW2LjQYUxs6k+E+n4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=WpQXK9VE; arc=fail smtp.client-ip=40.107.243.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="WpQXK9VE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NsPNoGDFOBVDo80/DAFkqQ4aarCw7282nJ0UUzdTtSG9/NGDMJG9GKkQBEMhd0MpuX/IiUsmt5BHAu5A1doJRoBmyHGqinyAYN5FvFCiYGKUxWUvUH2OE3SkGVz/2FqiXQmASLC5diEHrabKBFGvDzO6s7HRN3kaCdj0+GEeyazdruByd93Udkn39Z4T+fFkLbpE8Xo4Ih4SSx7wVzPOtbvB6hbBPlC9v9i0RIO/ZP9StKj6Mpmxe0N78BWd204krkZrRYkl6T11f1dt3XYhkomRlc82G//9MV/EJuMWEu1VNdfoinwOc2ZJracgLvgnTy6Fdq/6V2qOyEBUk1wd+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2bqggJNhszsBoFjpfC3eZGxfa/rQOmbHWIF2qrttebU=; b=kTbCc/7UGwWykw5pdzpBnYSWo2RCvXZO0I80cXn/kiwihI6ynTs1/tUExEtchiJjGDDzhaubY4ymz3XZc2rsDckvmT8P3ZFiPyu0REJr3ZdbC5jIQvV4MGw04fnNT3QvBCgKYgulnRl/dUQHaa0kUT5dZGLYAu+TKMPxShvjtNbpl+EdsQ6hcpCUsaFagTbsc8pscBYP1CizelHumuWBR/jUp703+iG+Z3sqCkBdhvQKy16cRWNvxcwbALh1pa7M3GuYZnKA2IwGOWZ2IguLYsyasz3YhxCKleWMXKxtBd7P24PS9zKS6IhxW2QdzQn4DSY+5ecYH2Lp1MSyas0ApA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2bqggJNhszsBoFjpfC3eZGxfa/rQOmbHWIF2qrttebU=; b=WpQXK9VE0bk1+e8yr8Ur99BNCxEXA+C7KMya7D5byFj+p+0Rj2LSqFwssiK4+iuA8M6tBgkG15ZgG+yfFs6gQ+j7xB5IErNE+bBtAjQrFCQNLJvyrI1ruz3Zwcw8pHibt62zpYT46ox6yuVMJuu78bJOMiMniIuYaEOnKmCfovm0E891ylcO+/oVU1Oq/tF6kThtG+lftEXV9Jk+Vs52areZAeWwQbFR3Ln966yM3UAtXfNCxAcK3Inq81bJnoBsvU5McjzL4za5FJtB9ucRyNiZCc285YqbIQrjiZHvpnzqtUt2U+oz0OovixgqVoKZPVb37H1rBRFkmnowbRJBrQ== Received: from BL6PEPF00016416.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:4) by IA1PR12MB9061.namprd12.prod.outlook.com (2603:10b6:208:3ab::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.17; Thu, 16 Jan 2025 16:39:23 +0000 Received: from BN3PEPF0000B070.namprd21.prod.outlook.com (2a01:111:f403:c803::1) by BL6PEPF00016416.outlook.office365.com (2603:1036:903:4::a) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Thu, 16 Jan 2025 16:39:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN3PEPF0000B070.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.0 via Frontend Transport; Thu, 16 Jan 2025 16:39:22 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:03 -0800 Received: from fedora.mtl.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:38:59 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , CC: Richard Cochran , Ido Schimmel , Petr Machata , , Amit Cohen Subject: [PATCH net-next 1/5] mlxsw: Add mlxsw_txhdr_info structure Date: Thu, 16 Jan 2025 17:38:14 +0100 Message-ID: <93aed1961f046f79f46869bab37a3faa5027751d.1737044384.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B070:EE_|IA1PR12MB9061:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ca562c7-bb5e-4909-88c8-08dd364c5531 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: zCv5Hkgr0DfGF8xYhPPQiAjRsY8jl8t8IxpPguBpurHO6yGkivIUeLlLzSjptJAes7VFzCjJO121RHnLBuItUjddktC+cp8/eFv8mxf7RrS4zO50X6eJ08k+J9GyXAu57bUFXCxEuC3axC2Vp67L2eP/SmVl01bRCbUFU2ieTxjMtLVXtKj1dT24a3YMIKmFvye+VPE8tfYRVPQG5Ijtsd0MMMCaWkNyx9/786kio7LhJbrmUNIh4/6r7/1uh0y4EzjWy6LpwCQsfCV6pGz/QquJgSB/DGHfjbrIL5DMaHA8tg39NZDYX6jJxrqCPK96NxCFNcDaJKQdzPkaNCT1lb8SPrubbgbWbZuSApIqWKIff605/TolFTibor7qHESKfEnptl7BjC+0UUoUnye+Tiod9xi0mI8HesH6FAvEPWU/m/yn17dcfef+eO/T2BZCZZUYNMnF6xC3qkRnNy/WD551WMCmijA5Ws+2ZLucZmqTvVHbcroHinO7RqczKdPrYC24mxwP26h+1b5McGRdzH1b2QqXBrazF4K1ANc/EpyDErLT/BWiydVZoe9h1V0yVPO/nHRmJkdsvOJjWTSOvnzu/6hop/dtmJKoFHNH+53Tq2ZjL7wKSrad2pT+QLcPDXbGk8AT4h3YHQM8NYvwyyeW8tTSNdjnNr3Y7Lpbb7wf1shGhiIdQ8loMwB+UODZ1XTl8uqJykaQZ252pdZ3lPG5NbhM4mI9yXTeXmn+y/pVBVdag4IF6qfvxnPskXmoV29OEOSxYPLzHgvEppZIEyD92Oy0oZ2cXGpoGl/VYQaHACvxbHzD4/OYsA9GPN/HHTH1K8IA2ATmmGesoR9cnpxDy+GCHGxr5drpADPz7E4jAfcoUQBJhVjfW8en2SAsraCcENZ3+fUWSb+vdjksd8klIcLIV01RhD97xhUsGuwKW+Tc8rvfGXWHl+wnVAWWZ4xKkQotb8g1puJA8k++Vd9psMbFkD/hS4qPu61vOTOzNsjnxIHxlVIAnX+o6z/d3XHn3kZVE9ztv3pHKgMie/emzKI8xgSTfbehrnz6juWMvCIbZf4jw4+R8n/UJNgu92kH4AA5IbH+P0vEzl6oW7YKEWWeZuqePY4tNAMzzI4KhDHNpC4RG7VI+DqmS63b6pCucU3oHMD1drfLUtWLox/gVpfMdQ8gmO9DGBucNXjdYFV7x9+XX80Eye3rWsiWNV5JLgxdKnRkZFQC80kU1pgpz8qVTqaGwX+BEOQbvko6KbKz9HrgE+hro2gJH736k8jobkWRsrNL8yXhb2R5+tkWsjO6SqtjkdpH66utx1UTSJGBOu/uxs4nwLV6dRVxN1ZBDuc5yKWJVTpUGFOUdWdjZ7mAUuZjEs6VkDFJDLXXzjIp39dlO8t25Lb/Sj/3BPGP2yGN4Anau1TeO2pcU0xeF2hTZ3cQlQ/JYSiYZyvplVxITyfmUYBgkcXZQPse3v9jUVeApIwfe5JIFqFPi2+tMD7GvoC4EtZFexIB07s= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 16:39:22.9171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ca562c7-bb5e-4909-88c8-08dd364c5531 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B070.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB9061 X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen mlxsw_tx_info structure is used to store information that is needed to process Tx completions when Tx time stamps are requested. A next patch will move Tx header handling from spectrum.c to pci.c. For that, some additional fields which are related to Tx should be passed to pci driver. As preparation, create an extended structure, called mlxsw_txhdr_info, and store mlxsw_tx_info inside. The new fields should not be added to mlxsw_tx_info structure as it is stored in the SKB control block which is of limited size. The next patch will extend the new structure with some fields which are needed in order to construct Tx header. Signed-off-by: Amit Cohen Reviewed-by: Ido Schimmel Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/core.c | 14 +++++++------- drivers/net/ethernet/mellanox/mlxsw/core.h | 8 ++++++-- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/pci.c | 6 +++--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 12 ++++++------ 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index 4a79c0d7e7ad..a3c032da4b4b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -677,7 +677,7 @@ struct mlxsw_reg_trans { struct list_head bulk_list; struct mlxsw_core *core; struct sk_buff *tx_skb; - struct mlxsw_tx_info tx_info; + struct mlxsw_txhdr_info txhdr_info; struct delayed_work timeout_dw; unsigned int retries; u64 tid; @@ -742,7 +742,7 @@ static int mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core, skb->len - mlxsw_core->driver->txhdr_len); atomic_set(&trans->active, 1); - err = mlxsw_core_skb_transmit(mlxsw_core, skb, &trans->tx_info); + err = mlxsw_core_skb_transmit(mlxsw_core, skb, &trans->txhdr_info); if (err) { dev_kfree_skb(skb); return err; @@ -984,8 +984,8 @@ static int mlxsw_emad_reg_access(struct mlxsw_core *mlxsw_core, list_add_tail(&trans->bulk_list, bulk_list); trans->core = mlxsw_core; trans->tx_skb = skb; - trans->tx_info.local_port = MLXSW_PORT_CPU_PORT; - trans->tx_info.is_emad = true; + trans->txhdr_info.tx_info.local_port = MLXSW_PORT_CPU_PORT; + trans->txhdr_info.tx_info.is_emad = true; INIT_DELAYED_WORK(&trans->timeout_dw, mlxsw_emad_trans_timeout_work); trans->tid = tid; init_completion(&trans->completion); @@ -995,7 +995,7 @@ static int mlxsw_emad_reg_access(struct mlxsw_core *mlxsw_core, trans->type = type; mlxsw_emad_construct(mlxsw_core, skb, reg, payload, type, trans->tid); - mlxsw_core->driver->txhdr_construct(skb, &trans->tx_info); + mlxsw_core->driver->txhdr_construct(skb, &trans->txhdr_info.tx_info); spin_lock_bh(&mlxsw_core->emad.trans_list_lock); list_add_tail_rcu(&trans->list, &mlxsw_core->emad.trans_list); @@ -2330,10 +2330,10 @@ bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core, EXPORT_SYMBOL(mlxsw_core_skb_transmit_busy); int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) + const struct mlxsw_txhdr_info *txhdr_info) { return mlxsw_core->bus->skb_transmit(mlxsw_core->bus_priv, skb, - tx_info); + txhdr_info); } EXPORT_SYMBOL(mlxsw_core_skb_transmit); diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h index 24c3ff6fcf71..cd33ceb2154b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core.h @@ -72,6 +72,10 @@ struct mlxsw_tx_info { bool is_emad; }; +struct mlxsw_txhdr_info { + struct mlxsw_tx_info tx_info; +}; + struct mlxsw_rx_md_info { struct napi_struct *napi; u32 cookie_index; @@ -95,7 +99,7 @@ struct mlxsw_rx_md_info { bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core, const struct mlxsw_tx_info *tx_info); int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info); + const struct mlxsw_txhdr_info *txhdr_info); void mlxsw_core_ptp_transmitted(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, u16 local_port); @@ -487,7 +491,7 @@ struct mlxsw_bus { bool (*skb_transmit_busy)(void *bus_priv, const struct mlxsw_tx_info *tx_info); int (*skb_transmit)(void *bus_priv, struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info); + const struct mlxsw_txhdr_info *txhdr_info); int (*cmd_exec)(void *bus_priv, u16 opcode, u8 opcode_mod, u32 in_mod, bool out_mbox_direct, char *in_mbox, size_t in_mbox_size, diff --git a/drivers/net/ethernet/mellanox/mlxsw/i2c.c b/drivers/net/ethernet/mellanox/mlxsw/i2c.c index 1e150ce1c73a..f9f565c1036d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/i2c.c +++ b/drivers/net/ethernet/mellanox/mlxsw/i2c.c @@ -516,7 +516,7 @@ static bool mlxsw_i2c_skb_transmit_busy(void *bus_priv, } static int mlxsw_i2c_skb_transmit(void *bus_priv, struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) + const struct mlxsw_txhdr_info *txhdr_info) { return 0; } diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c index 0863dca2fc0b..e8e0a06cd4e0 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -2122,7 +2122,7 @@ static bool mlxsw_pci_skb_transmit_busy(void *bus_priv, } static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) + const struct mlxsw_txhdr_info *txhdr_info) { struct mlxsw_pci *mlxsw_pci = bus_priv; struct mlxsw_pci_queue *q; @@ -2137,7 +2137,7 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb, return err; } - q = mlxsw_pci_sdq_pick(mlxsw_pci, tx_info); + q = mlxsw_pci_sdq_pick(mlxsw_pci, &txhdr_info->tx_info); spin_lock_bh(&q->lock); elem_info = mlxsw_pci_queue_elem_info_producer_get(q); if (!elem_info) { @@ -2145,7 +2145,7 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb, err = -EAGAIN; goto unlock; } - mlxsw_skb_cb(skb)->tx_info = *tx_info; + mlxsw_skb_cb(skb)->tx_info = txhdr_info->tx_info; elem_info->sdq.skb = skb; wqe = elem_info->elem; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index aa71993daf28..3bd6230307aa 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -721,16 +721,16 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; struct mlxsw_sp_port_pcpu_stats *pcpu_stats; - const struct mlxsw_tx_info tx_info = { - .local_port = mlxsw_sp_port->local_port, - .is_emad = false, + const struct mlxsw_txhdr_info txhdr_info = { + .tx_info.local_port = mlxsw_sp_port->local_port, + .tx_info.is_emad = false, }; u64 len; int err; memset(skb->cb, 0, sizeof(struct mlxsw_skb_cb)); - if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &tx_info)) + if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &txhdr_info.tx_info)) return NETDEV_TX_BUSY; if (eth_skb_pad(skb)) { @@ -739,7 +739,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, } err = mlxsw_sp_txhdr_handle(mlxsw_sp->core, mlxsw_sp_port, skb, - &tx_info); + &txhdr_info.tx_info); if (err) return NETDEV_TX_OK; @@ -751,7 +751,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, /* Due to a race we might fail here because of a full queue. In that * unlikely case we simply drop the packet. */ - err = mlxsw_core_skb_transmit(mlxsw_sp->core, skb, &tx_info); + err = mlxsw_core_skb_transmit(mlxsw_sp->core, skb, &txhdr_info); if (!err) { pcpu_stats = this_cpu_ptr(mlxsw_sp_port->pcpu_stats); From patchwork Thu Jan 16 16:38:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13941968 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) (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 90EBA22CBFA for ; Thu, 16 Jan 2025 16:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045575; cv=fail; b=C/O5ssZsOScdjIS8G6kDdhWFn+reSdTsApHO7NxO6l/aGcWv6kWUzCfdCMJoRq7qifkHoAo9Lsf6WwGER6yasCtTZgT/0OUw7dBYu37lDNMTTTVMrUuBNrNw+DbDFNJXoDl3uVX2fHGiaid8cZ7uNPQH/3J8Kclx+qMWbeGKzAg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045575; c=relaxed/simple; bh=FIuWgcJOhqhTlanmzp7pP303irSU0JkuPDbiAY8wk+s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RPB9v7IiJLgDkB9TlyClf5xwq+3nZvQucnbwSMxZgSfZVniyO2i+zhfVj1NNghLBk3868HvzNc5+aCipGpLb4nundCakbXJLQ0dIygsohLQUCSSfF0lWYPwHlwLAMJpLTgw6oBLPCUUFx/ynjYr6zODqMEdPetVLoRbm1v1MNY4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=qlxmhChs; arc=fail smtp.client-ip=40.107.92.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="qlxmhChs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wktZEmYL2UMK//QAbBEnjCrpDVO9bUevlg2WO28D808YjO2WA+aTi0E3qQky5q3mgolSwniQ4aUw0sJyfbIJ0PgxUgVpeqRbdDwjVfFdNwPsUXEHr96lS27W6wrZMaiYD+CeXZM95BXZs1251Hy69gjuFkJsn9GQrgzQVv5rP0rTnfcAAF5ppZ+41hGTu2E5vw/6sSHQeEtP0oqEbSr1dyR56XNvl+s78f0XsxOVg116N58qJScmYeTq0b5ieDT588EPUndPnuLORgMtI2CpJfK7kJ70gXCSDSjSrhX3GS/DapffnKIQjLVWTFX6efKZE1442wvzVKjEEroq1YZpBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CmHP++FsWELmohWdO0E1JwEffKtPDOOq1QJObM/0ntI=; b=BNda3gGs2M/yAE7f9r4c9DPt2/LugI+dkz1A64tBgh/fs+QBKiVLpYe26IJTxZAn/NrKMEM1clDDBgX533WKK67wT9zgUKj/A1nynCWOVx9JNBE/HmVMGRZ0eglYGdNzItH7f4kRcuqC3ignstQyktb4QK4cV6AoFg4E7u+Jmalgl0ejyWb5ja5V5mQTkb4rLPCTsc+Zjcg9lm3V/qeuYL0oEo7YSP+HpuQ8nTtg/WJVc08mssjIQCVbt1CDh8gHyDPvQtK/6/HlfJIdLdjM1kan0igNk2IKRstnmiw9WgzYkySW2dpvz8rffwJeJxAzS3fQyVN2AaGrkvcMzfnkEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CmHP++FsWELmohWdO0E1JwEffKtPDOOq1QJObM/0ntI=; b=qlxmhChsCc7/yd1Zyzr7tgwbx9CCPByvHU8FqAAX5EXUcr73THWjZVRRZ8jgbcURq4fWZ7JXa33uMGe4iIdaZ//5CnSXUpjqn8PPIqVdLQGWzRiDoZgwxTrRYye4EzLlHzGZ9cGjk7DlLy1f95r7TelONEabWkdOUV9avlpWUIUzHHNSresGgAH92W6jyoaAJiO8Ow0QAhyz0n/++CLN2xhVFK/+01XEbXWcYFu6GCxI2NaDtcp4I6lT6PQkd/MOkdEqQ2jWP5Ow93A+VCzIQwjliYpWNyMu8G3h3z4+jia0jv9JeHNsWt6xlB9aJIjGrG2R/alUFRLgq5uL8Hmjwg== Received: from BL6PEPF00016414.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:c) by PH8PR12MB7135.namprd12.prod.outlook.com (2603:10b6:510:22c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.17; Thu, 16 Jan 2025 16:39:28 +0000 Received: from BN3PEPF0000B070.namprd21.prod.outlook.com (2a01:111:f403:c803::1) by BL6PEPF00016414.outlook.office365.com (2603:1036:903:4::a) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.13 via Frontend Transport; Thu, 16 Jan 2025 16:39:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN3PEPF0000B070.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.0 via Frontend Transport; Thu, 16 Jan 2025 16:39:28 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:08 -0800 Received: from fedora.mtl.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:03 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , CC: Richard Cochran , Ido Schimmel , Petr Machata , , Amit Cohen Subject: [PATCH net-next 2/5] mlxsw: Initialize txhdr_info according to PTP operations Date: Thu, 16 Jan 2025 17:38:15 +0100 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B070:EE_|PH8PR12MB7135:EE_ X-MS-Office365-Filtering-Correlation-Id: 5be9cb0f-582e-4b74-e9a8-08dd364c587f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: 4yl0u1tQub1bWyEVfHvhHtmHN1d4jwO7GHfQ1SZtJ0k4VXdOe9UKs4ZwqdjGO9uGGcWiwdjBf0FxbXnPHVl9hYNH7fiL6e9j1XFCR1+9cG6Rasz40x346E9cmOg5xk/Pezx/VEVDtN4ZbO4Ip9T/eqIZ7q5AlkBYqdT+U2Na7EU19G98gVbk3CPmuFsG4LImu5VWGTUMDyLy9gaZGDT8hEyV66jrtcTMRQ8QuyVVLhSfxPZUB8GnCLj4qmdCXTswbW0L1c+8RP/mNmBFwLLNW4gLAeJMANhTdLBMCQJ+dcEIwCOYBKGmSi6hujQO2EpLQCHHdNTcLfYO4jihA+18GWPx6bT6ICKgwK2235zlDJAFfSkn/5MblO3oNHrEvIznibowExUlIXtI3eFDhtyrEkJibT625wXtS4JATt+m9u0vq6P20l3Kauh3r4/g3fPoRoEN0tqsbDM/lArqChcoqbFVd53Nxj2f9yCYoXCmsW1Q5wt7yC0zhjdo7BxEur/z7Rsy6yausxWd6FRidNqI01pfgMGx6Sm51MPGC3iRVNjxnOnttKxzItfDLau9B6MSQQnJ4SaKL7xte3J5QLCDUOd1R3gbwZNSfFjudrdusNZL5uIcITqgFzCvdEQ9l1QoMpYd9NcWVbF3xnoqhqMr15nhWEevt7QZdmJ/CMbQT0EPrPm/rlXJkgBgR6MmuPiRPgKeA7nkwfqIUuR8iyWKNBSwVWDf8QJXWQOufx4BHa08TRgkNWnu0u6iQU4+AD4aKg0FuiD3mjx1Op+cemphrH06Ox6kMeMXQvRmXyon2gD7kAVYsAHH2Ot/Kpa66ih9zaausujyrcTy9W6tum17YdIKXehs0LjdGaAuez59Ko6POVlU4isHsiMA9XYSwPNRu0PKXi3quIr01xCPIpTfQaEHx28wZBCCzY+Mppy1uubyBePH94ox+LjCg40PmpIhjiQl5CPblvV/6/eHWqmVC6GV/UR5QH6iLeTzM4PeIrnmYYQrapyj1d4NT9iAKX0PYZIv6XH1nN+mRmKl3aa1cyx055ubBXt9f7E483KWfTbDvbYmKahlRJjAGWDKx2io9omBnGD2+eDCJvF2apCwMvdXHg9MBRVffmRTQWuNWbRTCHd2P/JGxh8WWZ15B0q1CTVzynr1kqB4ZbHoSWF3SkzXN+Nrysc9+ncq298+jC8mlh6FxxWO4nSx/5LdGCwO/xh6Bo4MdDWRYqBnmVBwgjLXkDprERa9s90+yiLOV+QkjcbDSJoaV5i3X3EIvgsIlAmchQyl2DMgidY5x8zJ6eigLYPIbgUr3vOkEO8mLu2koiJvCRBCTlU2Do5eRyrIQtq2IXXTsa2x2ou2tNJ7xVWT1cHyltnvBIC8YSy/Sel64RaB5+h/LNzovXZmUZ2ZENnDnANpkSqdEd+B3jWxspyBX4id/zc7AfkolFPnVu0ai3ezi19C5G6c/BIfGrZiOTSUKWkfmuId5ESW/M1iKA== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 16:39:28.4639 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5be9cb0f-582e-4b74-e9a8-08dd364c587f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B070.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7135 X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen A next patch will construct Tx header as part of pci.c. The switch driver (mlxsw_spectrum.ko) should encapsulate all the differences between the different ASICs and the bus driver (mlxsw_pci.ko) should remain unaware. As preparation, add the relevant info as part of mlxsw_txhdr_info structure, so later bus driver will merely construct the Tx header based on information passed from the switch driver. Most of the packets are transmitted as control packets, but PTP packets in Spectrum-2 and Spectrum-3 should be handled differently. The driver transmits them as data packets, and the default VLAN tag (4095) is added if the packet is not already tagged. Extend PTP operations to store a boolean which indicates whether packets should be transmitted as data packets. Set it for Spectrum-2 and Spectrum-3 only. Extend mlxsw_txhdr_info to store fields which will be used later to construct Tx header. Initialize such fields according to the new boolean which is stored in PTP operations. Note that for now, mlxsw_txhdr_info structure is initialized, but not used, a next patch will use it. Signed-off-by: Amit Cohen Reviewed-by: Ido Schimmel Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/core.h | 2 ++ .../net/ethernet/mellanox/mlxsw/spectrum.c | 32 ++++++++++++++++++- .../net/ethernet/mellanox/mlxsw/spectrum.h | 1 + .../ethernet/mellanox/mlxsw/spectrum_ptp.c | 4 +++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h index cd33ceb2154b..38d1b507348f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core.h @@ -74,6 +74,8 @@ struct mlxsw_tx_info { struct mlxsw_txhdr_info { struct mlxsw_tx_info tx_info; + bool data; + u16 max_fid; /* Used for PTP packets which are sent as data. */ }; struct mlxsw_rx_md_info { diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 3bd6230307aa..061a3bb81c72 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -299,6 +299,33 @@ static bool mlxsw_sp_skb_requires_ts(struct sk_buff *skb) return !!ptp_parse_header(skb, type); } +static void mlxsw_sp_txhdr_info_data_init(struct mlxsw_core *mlxsw_core, + struct sk_buff *skb, + struct mlxsw_txhdr_info *txhdr_info) +{ + /* Resource validation was done as part of PTP init. */ + u16 max_fid = MLXSW_CORE_RES_GET(mlxsw_core, FID); + + txhdr_info->data = true; + txhdr_info->max_fid = max_fid; +} + +static void +mlxsw_sp_txhdr_preparations(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb, + struct mlxsw_txhdr_info *txhdr_info) +{ + if (likely(!mlxsw_sp_skb_requires_ts(skb))) + return; + + if (!mlxsw_sp->ptp_ops->tx_as_data) + return; + + /* Special handling for PTP events that require a time stamp and cannot + * be transmitted as regular control packets. + */ + mlxsw_sp_txhdr_info_data_init(mlxsw_sp->core, skb, txhdr_info); +} + static int mlxsw_sp_txhdr_handle(struct mlxsw_core *mlxsw_core, struct mlxsw_sp_port *mlxsw_sp_port, struct sk_buff *skb, @@ -721,7 +748,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; struct mlxsw_sp_port_pcpu_stats *pcpu_stats; - const struct mlxsw_txhdr_info txhdr_info = { + struct mlxsw_txhdr_info txhdr_info = { .tx_info.local_port = mlxsw_sp_port->local_port, .tx_info.is_emad = false, }; @@ -738,6 +765,8 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, return NETDEV_TX_OK; } + mlxsw_sp_txhdr_preparations(mlxsw_sp, skb, &txhdr_info); + err = mlxsw_sp_txhdr_handle(mlxsw_sp->core, mlxsw_sp_port, skb, &txhdr_info.tx_info); if (err) @@ -2812,6 +2841,7 @@ static const struct mlxsw_sp_ptp_ops mlxsw_sp2_ptp_ops = { .get_stats_strings = mlxsw_sp2_get_stats_strings, .get_stats = mlxsw_sp2_get_stats, .txhdr_construct = mlxsw_sp2_ptp_txhdr_construct, + .tx_as_data = true, }; static const struct mlxsw_sp_ptp_ops mlxsw_sp4_ptp_ops = { diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index 8d3c61287696..27ccd99ae801 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -247,6 +247,7 @@ struct mlxsw_sp_ptp_ops { struct mlxsw_sp_port *mlxsw_sp_port, struct sk_buff *skb, const struct mlxsw_tx_info *tx_info); + bool tx_as_data; }; struct mlxsw_sp_fid_core_ops { diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c index d94081c7658e..c5a7aae14262 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c @@ -1353,6 +1353,10 @@ struct mlxsw_sp_ptp_state *mlxsw_sp2_ptp_init(struct mlxsw_sp *mlxsw_sp) struct mlxsw_sp2_ptp_state *ptp_state; int err; + /* Max FID will be used in data path, check validity as part of init. */ + if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, FID)) + return ERR_PTR(-EIO); + ptp_state = kzalloc(sizeof(*ptp_state), GFP_KERNEL); if (!ptp_state) return ERR_PTR(-ENOMEM); From patchwork Thu Jan 16 16:38:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13941967 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) (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 C05D222CA0E for ; Thu, 16 Jan 2025 16:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045571; cv=fail; b=gCAO0hgDn9v97brN7K/ZB513E3bNFT5tdoymH1QsFEXOYDmXfXf6VSsptffDa+9TtxRK4tJf89z+i5XV8L/b5yEKJUALhQ/vfegAXO5b/D79gbadueIbBCjyJVZLBxaekz2W3cTmAicO0/NJQu9GaSn618mzVJUPD+c0Kf9LHp4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045571; c=relaxed/simple; bh=YsE16EGs6nZBbual3ZfiB3w7M/J4y2lP3twJwzMpPfA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pwjrx0JIj+YM/zz8NiSpVCSGALirWthZIA26MMLhwivMFeMp8z4rlfxYgQOvlYIJ9HFDwPGXbN1U1/LR3rJkjncpLlOryds9NOf26A8dGdlr6zYDv+iucGtsGEWH7rs5ZntXJIEWtg/85BE1CDbwAu6UcXCey+6IBqsRfyBfzzs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=rKAdNyN/; arc=fail smtp.client-ip=40.107.223.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="rKAdNyN/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tjfkX0WZ+59EALWOJH4xQs6Lwn08YHKfPSzYIG1y+APE1lMdwJArRLQpxSrFjWqQNCMXh7vubINyExGqYUd+dRVIlyeq1YMsNWB/X6H/l0qFRi8GDC7kB7GxLpCNz1Otb+smQX89ZJ9aifNAItGxX19paTY6Z2iz+LDpwJ3IY8edmvtjdr4rPkq3fXDt7KB+lmFSqmxulX0FIiEVrxxi9A4aBzQqeBBF7K3XLCiZUjMyYzFO8cI2XN+pPpNiQUqRJtjwbXg+nlUE7fodaWIePk0/jzMxEAbvQTzPbEAgalbDaz+NPn6yVFv9VcSLB2dyyi7kWbmNksu1TM+3TPtsaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LdRPFsoAQCXTfGjmZK3b2BhhLoleScSWL/h7EKMQRmA=; b=iMnm+QxJ6lOCeuKhqKo+O/7FakFIH42SGi71qdL1RrU47ZR5s5dqmAA/jge8Q5i3AW3WHKcOHdCo4M2Hl8tnA+ajGrgBfm2KSj6YsTBsOKI4C71Sr6Ndkrqur19vdAOAexgfeBOucvyKUwWNBAo39F+CIz4jIJGhiqCE6dli7hDybFRS0fmUY8WqC0RgMLblE0MiSu8YD0XMJiCeejsrIFOgsE8c8LCtlbwzak32GSweHyuVsPYd4vtbaFMoFw0zWOrdhl3zUEvt3gB6qI5XhO5Fe/UjUwBpZwt4jzt0fRe562/mmiOYczRBnnK7g+Lxhdk45Cifza0YG7jR9DNtlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LdRPFsoAQCXTfGjmZK3b2BhhLoleScSWL/h7EKMQRmA=; b=rKAdNyN/5kDrX4ZFcxCNaoKcvEV0S0oQLKrEbDyYWZbl8/DZGlDFkFSUPtyP6paxT/0BXzApLjNdjIMQcV/MRtGjST+R/4L8fxnxYvExGu0K2GwRrxaX+zeph5yGcOj21Tio+4Osi8Z+A/Ozst1pRYb+pWZsWbAtecJCxEc5wT7iWqSWnW3Qpdmw3oIQ3hjC6XomC/l4sdPjh8YbU8wqQg2gX2fhIzWtP3gyO6VgqZMKY+8DoMxxczNESnNFs1r5GUQKPBlhYv7kiCn5ASn83ZhUvDuPVeWJjnc+kaDIKvoLLD/mGWhMk2d/5PlaanSmXXLNpKOdJ77bPmBl3eXjdw== Received: from SN1PR12CA0083.namprd12.prod.outlook.com (2603:10b6:802:21::18) by MN2PR12MB4141.namprd12.prod.outlook.com (2603:10b6:208:1d5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.14; Thu, 16 Jan 2025 16:39:26 +0000 Received: from SN1PEPF000397AF.namprd05.prod.outlook.com (2603:10b6:802:21:cafe::47) by SN1PR12CA0083.outlook.office365.com (2603:10b6:802:21::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.14 via Frontend Transport; Thu, 16 Jan 2025 16:39:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF000397AF.mail.protection.outlook.com (10.167.248.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.11 via Frontend Transport; Thu, 16 Jan 2025 16:39:26 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:13 -0800 Received: from fedora.mtl.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:08 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , CC: Richard Cochran , Ido Schimmel , Petr Machata , , Amit Cohen Subject: [PATCH net-next 3/5] mlxsw: Define Tx header fields in txheader.h Date: Thu, 16 Jan 2025 17:38:16 +0100 Message-ID: <2250b5cb3998ab4850fc8251c3a0f5926d32e194.1737044384.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397AF:EE_|MN2PR12MB4141:EE_ X-MS-Office365-Filtering-Correlation-Id: 17ec0895-9cba-4a4f-cefa-08dd364c571a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: 8pXjOSuQnWrfZrlac2mS2CrKAtjoF4BSe+4UJx5shUzjBtwBltNx7AQK/2tz8225L5b8kk+4gV1CKlQuIhvp1Na4zgq/eO82DN3lE3q8Srjr27IqyXTVklXWFeVYcxiVHd/scNVoHsIauDFC6/kTMfetKiqk1h5QpuWPq7JtgGG3Wu8zXoCcbHVQB3i6OMWs7oCb7ftYP7Erl4A0r0+Z8bH7ro9L+qc9oP9NnOToE7Cns8v3a4Nkb3q6HS5DmwSB95wHzapJk1RV4RtIiBhztICmd68xESqTtmVyycgBKYbibUPi2BnjcuJ8/6/dkCsxmHqPIPmfYqFXpmgeg3ptS7udZQYNJa3/JVhS0Th3aBUxA9yhOfzO6wW9GsaL/ahzOccje3LzxkU6G7Kq4YjGFHKWIcbID86bQQ2WuIMlMubE0Uh/9k2zz2M9ppY1w0Tym7CTGUSg0/puJLHAGUtq2cgV2X2czBZSSrW4SQsapLKPr1HVylph0yPQ3PXtaU8I9Tn6nWmWPBwbRUJqBAM848DN3EcblTUMOYEQeHcLsTClWphMFk4Igetx/SYQy0Jz12GnzbsJJrqLsJxOgpBgNieA5g7yxShIOnIHmx/j5Kz0YXG6xIK39rCZakJKbELB6Qg8c+dGJOiQEpubW2QV2gdwFwRbofggAmXg5sGRejytGVWs1P5Z9P46zw5dhGHo5u2TWD3ap8nlFFY+2hi3vEuWu9cUc8PNpjFFzcbWMC1a2drHiSOPh+yKsXAhbXL6A94lLLRDjEOZDZEhEn1mkFGZNz6EtV/S5CXa+oKzkRpy86B9P3V9vUBhnuFHj7VSIaF15Zx1afd600TTxYkAmo7oy2dUnxtjoPFQPYHHDj2WDI60EwLU/wj10JzLdk/ePbW8NvFcSB+S8gA1lx9kHZ5UNvE7K5QuyiL0PKO7hzHsPyESFEzmcKup775xuRYgH/YMIFa08Edep+dOPSpfB08uOTA2efNHjOFCFvm4YcLSDJuS7i5vLPf/lKORy5g54RUTRdreLkOjbd/EnhS3HVSKLn6eVVW6xXjiFask4B3l3ojixGtYdazIf3HSsBMMcChdrrHHPydQHsfxg4snyRtbhe/xIeNmXh/IZDSGpJNthsTBhoy3DA35luLyr9fnw56uK/ezL4slIelR/h1hjEaOGAlbF3xpgnB9ijg9Q37Uyma9/fS6nqWXujjnhRwQ8rvILtYVBnJGDCzdd2r1Z7/aMYmrxEwowwpQTavtiKoKNQ1teiHcFXmgmGaAYAVNFxhxdV2Xi/rsi6JDcdX0BLGGAhMQ0IdJNSjoVKsgPiGjHlDp95VrMwN2b/EtzPt9zd4C5YpQokr5bVRviuc3W6YIesP8A7hl9ERGK4pkgDN2w8UZUs6leFRU6s163Ju0x/y3Qnvfz9Hrx5VUbda+ZfTICAUOWLBqN3Z2jiRYejOLkiD7zIefIpIpWGuntMGuC2PTWUwi3zliYd5Dv8DObWp9yVLgkuPin+3Ete9WMZY= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 16:39:26.1705 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17ec0895-9cba-4a4f-cefa-08dd364c571a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000397AF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4141 X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen The next patch will move Tx header constructing to pci.c. As preparation, move the definitions of Tx header fields from spectrum.c to txheader.h, so pci.c will include this header and can access the fields. Remove 'etclass' which is not used. Signed-off-by: Amit Cohen Reviewed-by: Ido Schimmel Signed-off-by: Petr Machata --- .../net/ethernet/mellanox/mlxsw/spectrum.c | 68 ------------------- .../net/ethernet/mellanox/mlxsw/txheader.h | 63 +++++++++++++++++ 2 files changed, 63 insertions(+), 68 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 061a3bb81c72..4e4d1d366d6c 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -107,74 +107,6 @@ static const unsigned char mlxsw_sp2_mac_mask[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00 }; -/* tx_hdr_version - * Tx header version. - * Must be set to 1. - */ -MLXSW_ITEM32(tx, hdr, version, 0x00, 28, 4); - -/* tx_hdr_ctl - * Packet control type. - * 0 - Ethernet control (e.g. EMADs, LACP) - * 1 - Ethernet data - */ -MLXSW_ITEM32(tx, hdr, ctl, 0x00, 26, 2); - -/* tx_hdr_proto - * Packet protocol type. Must be set to 1 (Ethernet). - */ -MLXSW_ITEM32(tx, hdr, proto, 0x00, 21, 3); - -/* tx_hdr_rx_is_router - * Packet is sent from the router. Valid for data packets only. - */ -MLXSW_ITEM32(tx, hdr, rx_is_router, 0x00, 19, 1); - -/* tx_hdr_fid_valid - * Indicates if the 'fid' field is valid and should be used for - * forwarding lookup. Valid for data packets only. - */ -MLXSW_ITEM32(tx, hdr, fid_valid, 0x00, 16, 1); - -/* tx_hdr_swid - * Switch partition ID. Must be set to 0. - */ -MLXSW_ITEM32(tx, hdr, swid, 0x00, 12, 3); - -/* tx_hdr_control_tclass - * Indicates if the packet should use the control TClass and not one - * of the data TClasses. - */ -MLXSW_ITEM32(tx, hdr, control_tclass, 0x00, 6, 1); - -/* tx_hdr_etclass - * Egress TClass to be used on the egress device on the egress port. - */ -MLXSW_ITEM32(tx, hdr, etclass, 0x00, 0, 4); - -/* tx_hdr_port_mid - * Destination local port for unicast packets. - * Destination multicast ID for multicast packets. - * - * Control packets are directed to a specific egress port, while data - * packets are transmitted through the CPU port (0) into the switch partition, - * where forwarding rules are applied. - */ -MLXSW_ITEM32(tx, hdr, port_mid, 0x04, 16, 16); - -/* tx_hdr_fid - * Forwarding ID used for L2 forwarding lookup. Valid only if 'fid_valid' is - * set, otherwise calculated based on the packet's VID using VID to FID mapping. - * Valid for data packets only. - */ -MLXSW_ITEM32(tx, hdr, fid, 0x08, 16, 16); - -/* tx_hdr_type - * 0 - Data packets - * 6 - Control packets - */ -MLXSW_ITEM32(tx, hdr, type, 0x0C, 0, 4); - int mlxsw_sp_flow_counter_get(struct mlxsw_sp *mlxsw_sp, unsigned int counter_index, bool clear, u64 *packets, u64 *bytes) diff --git a/drivers/net/ethernet/mellanox/mlxsw/txheader.h b/drivers/net/ethernet/mellanox/mlxsw/txheader.h index da51dd9d5e44..e78cba5821b6 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/txheader.h +++ b/drivers/net/ethernet/mellanox/mlxsw/txheader.h @@ -4,6 +4,69 @@ #ifndef _MLXSW_TXHEADER_H #define _MLXSW_TXHEADER_H +/* tx_hdr_version + * Tx header version. + * Must be set to 1. + */ +MLXSW_ITEM32(tx, hdr, version, 0x00, 28, 4); + +/* tx_hdr_ctl + * Packet control type. + * 0 - Ethernet control (e.g. EMADs, LACP) + * 1 - Ethernet data + */ +MLXSW_ITEM32(tx, hdr, ctl, 0x00, 26, 2); + +/* tx_hdr_proto + * Packet protocol type. Must be set to 1 (Ethernet). + */ +MLXSW_ITEM32(tx, hdr, proto, 0x00, 21, 3); + +/* tx_hdr_rx_is_router + * Packet is sent from the router. Valid for data packets only. + */ +MLXSW_ITEM32(tx, hdr, rx_is_router, 0x00, 19, 1); + +/* tx_hdr_fid_valid + * Indicates if the 'fid' field is valid and should be used for + * forwarding lookup. Valid for data packets only. + */ +MLXSW_ITEM32(tx, hdr, fid_valid, 0x00, 16, 1); + +/* tx_hdr_swid + * Switch partition ID. Must be set to 0. + */ +MLXSW_ITEM32(tx, hdr, swid, 0x00, 12, 3); + +/* tx_hdr_control_tclass + * Indicates if the packet should use the control TClass and not one + * of the data TClasses. + */ +MLXSW_ITEM32(tx, hdr, control_tclass, 0x00, 6, 1); + +/* tx_hdr_port_mid + * Destination local port for unicast packets. + * Destination multicast ID for multicast packets. + * + * Control packets are directed to a specific egress port, while data + * packets are transmitted through the CPU port (0) into the switch partition, + * where forwarding rules are applied. + */ +MLXSW_ITEM32(tx, hdr, port_mid, 0x04, 16, 16); + +/* tx_hdr_fid + * Forwarding ID used for L2 forwarding lookup. Valid only if 'fid_valid' is + * set, otherwise calculated based on the packet's VID using VID to FID mapping. + * Valid for data packets only. + */ +MLXSW_ITEM32(tx, hdr, fid, 0x08, 16, 16); + +/* tx_hdr_type + * 0 - Data packets + * 6 - Control packets + */ +MLXSW_ITEM32(tx, hdr, type, 0x0C, 0, 4); + #define MLXSW_TXHDR_LEN 0x10 #define MLXSW_TXHDR_VERSION_0 0 #define MLXSW_TXHDR_VERSION_1 1 From patchwork Thu Jan 16 16:38:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13941969 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2061.outbound.protection.outlook.com [40.107.237.61]) (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 7066422D4C0 for ; Thu, 16 Jan 2025 16:39:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045584; cv=fail; b=m4wdp6CGTCTGDEtKwI4FTJnenJvIYk38LVuI4XhYbTZLUnbi++Q66Ws17cqkLBYiXWrIXaouCK9MIIGeYH5EOKvNJTMb+XjhYFxb8MByZuSEjHDlmsIDO5ZxfYocFw+GBqnaEeag2vFK55acEA1xFIv0JLxk+BSRwRUbmjXRtd4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045584; c=relaxed/simple; bh=AnEpKqpSF6mzdjIQWPGDKQC5aUhE9uAYD6mWLYudkRo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XhrnkPLNQIB2E5+67NLtZeV0JAsyunkhSYrWPynwd1/eJ56bvFX8jXfp6xCcfGKOPgG5LN3TlypdU7gBgzOssczynWQWfIGcTDN09qDOPrQz2KB4Jdie7v5q3Djkm4BWANqFBJjakS3Haa7GYW59KYFG+Bqmpffc6ivK7zCri90= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=nH8csihK; arc=fail smtp.client-ip=40.107.237.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="nH8csihK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b8vrhE29eEDbxTDxGnrUmFVgCecMJ3vZpLpJXwiG3h442+CDno0QSG/vY/pgk+V83W1SU5Su3bz0a07fuQtaEJRewo71FYp4PQkBt7tYktYirSyYorkAxUNwwHnCfnYUR7kk0P0ks9TT2qgy5H1huqulVRYQGuisUGezgUQ31XtPE1caE7GAv9TqI7mCjCXHDV8Zj6GmftgeMsKp52fmIe5++6ci41swbGn/Fhkd2e+lc3SZndfvFXvZq/O7BaHlc1Q20NS+D+SEW65q+Tyq/Sn1qYxhn1WgJrzUr2ZzMZoPwkOVXl4bIlPibJrqgKL4PAUmEJDRv65/GpMzlto3iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w+ObXwRZCkU/VBwi/o7yYoiCz/Rag5RD5aBdVEJBfxs=; b=RqJwA4TDKokMBtt86Esx6zVg6xl6or2HdUTgq/NetvY3RMWfxYOyAhuCG1PzzfsvNmptIzLndLMC8kGliPj4F1xd6HkFykqsjaWmLp+thspgFasig/wSZE8gUq46IURRiMFSlGZms9X4hExBLWsic6zQ1kXIII/3PXNexikGPVXj4QbGAf5bj+ykWVm/Te05JfsYKbROkN8izcSXMAwrUI/mVDfmBwTLb8gGuUoZipQ+oyDhS9JBc+6UyFHWfp4ESzieBsDtZhUaE6NEtI7/1r0GUTLal7LPNVu81eGyj46Rf8jtfzc78NAzTwmgOcF0drM7nWOSCNlcR/G4Rlc+2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w+ObXwRZCkU/VBwi/o7yYoiCz/Rag5RD5aBdVEJBfxs=; b=nH8csihK0b21T+0hRRg6WQoiMTvH/5iFdLWoSgNdPRimRQkUMqtomcBMgpbx6+fmkd+/h+sGZu281RYcUs8TSE5yE5+hpX97vdvfRclXMDJolEENwvOx6hR4PEilxmJZgCQ9hk12nNfXKT2ELmpohQ/YNDx05r3zyWlOe0WrbjlBBi98R650jWFli0cshgVgZspvoFuWRybXKI9x2KxvhZwXDeTk6ERLL9A2tybzWDzI91mrLjJOj6JMkk5mX8GYV5oxAhpFIQUMaSlowfFOh6rxiLc47R04OszFGynhdfG0HyMT2KqmTDcDQKxd6V4OLIew5HXwLB/lL2c668A3IA== Received: from PH1PEPF000132F4.NAMP220.PROD.OUTLOOK.COM (2603:10b6:518:1::39) by MW3PR12MB4492.namprd12.prod.outlook.com (2603:10b6:303:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.14; Thu, 16 Jan 2025 16:39:36 +0000 Received: from SN1PEPF000397B0.namprd05.prod.outlook.com (2a01:111:f403:f90f::3) by PH1PEPF000132F4.outlook.office365.com (2603:1036:903:47::3) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.13 via Frontend Transport; Thu, 16 Jan 2025 16:39:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF000397B0.mail.protection.outlook.com (10.167.248.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.11 via Frontend Transport; Thu, 16 Jan 2025 16:39:34 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:18 -0800 Received: from fedora.mtl.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:13 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , CC: Richard Cochran , Ido Schimmel , Petr Machata , , Amit Cohen Subject: [PATCH net-next 4/5] mlxsw: Move Tx header handling to PCI driver Date: Thu, 16 Jan 2025 17:38:17 +0100 Message-ID: <293a81e6f7d59a8ec9f9592edb7745536649ff11.1737044384.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397B0:EE_|MW3PR12MB4492:EE_ X-MS-Office365-Filtering-Correlation-Id: 2208d631-dc69-404c-9d85-08dd364c5c51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: ydIuezjxedgqmecyLClmtrCwYk2oBFlDuERdeLDmrnbyyLWM7dS5mVKoep6xAnrbvTXv+0Wqc+jMmwKTOKvFpdJnSnCG3JLFeBBVIzF9qnhyJRKmCE46dcbajJRU4lBR7xJhxedr84Bp7dRepP8SRbjAjvt8O96AfEzrPDwwcc2NeTHG7G7R2BbJxy3AZu9kcgKR2YoaovsPkbyadjpffhKMzHGux9VsYN/HKVjFR3FIOeXRhOAKSOFf76vkDXI6ioXEjOXyyOCISpySFCCwYbr/naZiunwnLC4oTQhcweoESci6DGhhhz2mMZkuRGmzFpT3aGawpn5kjftrE409MG4cJdX2dZMTeq6Ub7X5JMlKigpmmfBZOMR3dgnmZFdAsLr4erq/9fXuFD3o3TWWiGzwVs/hRYAORRs7kuUFPA2mi0R0xesOOusSrYXynF10hixic6zkLMawqUs1B4hDlBKBkQFjJc7rLnjUIUODkQp0t1yL3cFgJMJEe09Z7d0/EkU2/eDk69cCaf912zvy5oKQu04qmBFZqg+voJwxsZisVZxZbcLhUDkAttSpA7qDQvCass3JmJsQTP7g5HZEPEGmxvNsqB/t6EL5PCzV0kqUO55G9QYr2j0gNwzequ5iKMooDu1cVIQJP+Buk2zv9coK2e5Hsizb5VR4Kag6pV6UpPzNWaVdgAcwzE28v/Fdq6M4lQhC0T4VOPdUaRejHbQH8BefX2NhacEkQJxDdqtkLFg58UWXLjB6mwU7MewV/2+GKtWZGbkljgTs75uSj5OXmrkstmwZQv+XJv0f6OcOT/r8sil6589Wa5IR8Vpurx8xouvZF51IYJpdnOQOyc36ZFYbiT67QkWZhCbaqH1PyFEEHCqDePHHDHKbBkKqM45XzpV9AYqLWnEzBWlhxeK7Um5+40APojvP1TETeX6hMlQTRrrvrWEBozeiJ5NWTLNpwpg5FNO44Do0L0kT0eMYX0cngwnRA/wAIczqHZybk+vMobEb+t5dOE/mzid3omXRSW2qLL2Z72QjoGzhWBurepQrI7mHb+86o34UxHhKfXpEV3ahygG/+8orSImFrz/Qw3f7UfIZmjWaTgtqHnuz8uAr8RtEPh/kiHseu3l8+bE8h2d+jZXjF7pRd2trr7agfC6CmndHDyrtFfvUgDFgrSQ8kGJV51LGUhepe1cl+0Z/nMTkIgl2qiaAFjl1sNvUGoSClHKBH1S4aMvuukOncJ2qQGcwQw9Q2hPa3L7DCVw1Utpdb9iIFde4bAPTCUl5XA4PS8hMV9fXJFXk7xvdzsTHVifaYlJfkG2xPyRyTNanPCYk1wh7sgrL7TKK1ckcns17hOO1znUxyU1tHyZq85d6t6YtY4fQihFWKeBUPEbGKzYT4yj/vKeJdrqKQ6dZb/OR2xJ7VAa09gHYds1phyOuG3Wta4tN2XoYXFqFqRJFw9xXuydWUmxqyQ2tSIlBm+pTGe049zhZc2WZ0Q== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 16:39:34.9339 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2208d631-dc69-404c-9d85-08dd364c5c51 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000397B0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4492 X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen Tx header should be added to all packets transmitted from the CPU to Spectrum ASICs. Historically, handling this header was added as a driver function, as Tx header is different between Spectrum and Switch-X. See SwitchX implementation in commit 31557f0f9755 ("mlxsw: Introduce Mellanox SwitchX-2 ASIC support"). From May 2021, there is no support for SwitchX-2 ASIC, and all the relevant code was removed. For now, there is no justification to handle Tx header as part of spectrum.c, we can handle this as part of PCI, in skb_transmit(). A future patch set will add support for XDP in mlxsw driver, to support XDP_TX and XDP_REDIRECT actions, Tx header should be added before transmitting the packet. As preparation for this, move Tx header handling to PCI driver, so then XDP code will not have to call API from spectrum.c. This also improves the code as now Tx header is pushed just before transmitting, so it is not done from many flows which might miss something. Note that for PTP, we should configure Tx header differently, use the fields from mlxsw_txhdr_info to configure the packets correctly in PCI driver. Handle VLAN tagging in switch driver, verify that packet which should be transmitted as data is tagged, otherwise, tag it. Remove the calls for thxdr_construct() functions, as now this is done as part of skb_transmit(). Signed-off-by: Amit Cohen Reviewed-by: Ido Schimmel Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/core.c | 6 +- drivers/net/ethernet/mellanox/mlxsw/core.h | 2 - drivers/net/ethernet/mellanox/mlxsw/pci.c | 38 ++++++ .../net/ethernet/mellanox/mlxsw/spectrum.c | 121 ++++-------------- .../net/ethernet/mellanox/mlxsw/spectrum.h | 10 -- .../ethernet/mellanox/mlxsw/spectrum_ptp.c | 40 ------ .../ethernet/mellanox/mlxsw/spectrum_ptp.h | 28 ---- 7 files changed, 65 insertions(+), 180 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index a3c032da4b4b..39888678a2bd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -737,9 +737,8 @@ static int mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core, if (!skb) return -ENOMEM; - trace_devlink_hwmsg(priv_to_devlink(mlxsw_core), false, 0, - skb->data + mlxsw_core->driver->txhdr_len, - skb->len - mlxsw_core->driver->txhdr_len); + trace_devlink_hwmsg(priv_to_devlink(mlxsw_core), false, 0, skb->data, + skb->len); atomic_set(&trans->active, 1); err = mlxsw_core_skb_transmit(mlxsw_core, skb, &trans->txhdr_info); @@ -995,7 +994,6 @@ static int mlxsw_emad_reg_access(struct mlxsw_core *mlxsw_core, trans->type = type; mlxsw_emad_construct(mlxsw_core, skb, reg, payload, type, trans->tid); - mlxsw_core->driver->txhdr_construct(skb, &trans->txhdr_info.tx_info); spin_lock_bh(&mlxsw_core->emad.trans_list_lock); list_add_tail_rcu(&trans->list, &mlxsw_core->emad.trans_list); diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h index 38d1b507348f..d842af24465d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core.h @@ -432,8 +432,6 @@ struct mlxsw_driver { int (*trap_policer_counter_get)(struct mlxsw_core *mlxsw_core, const struct devlink_trap_policer *policer, u64 *p_drops); - void (*txhdr_construct)(struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info); int (*resources_register)(struct mlxsw_core *mlxsw_core); int (*kvd_sizes_get)(struct mlxsw_core *mlxsw_core, const struct mlxsw_config_profile *profile, diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c index e8e0a06cd4e0..5b44c931b660 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -21,6 +21,7 @@ #include "cmd.h" #include "port.h" #include "resources.h" +#include "txheader.h" #define mlxsw_pci_write32(mlxsw_pci, reg, val) \ iowrite32be(val, (mlxsw_pci)->hw_addr + (MLXSW_PCI_ ## reg)) @@ -2095,6 +2096,39 @@ static void mlxsw_pci_fini(void *bus_priv) mlxsw_pci_free_irq_vectors(mlxsw_pci); } +static int mlxsw_pci_txhdr_construct(struct sk_buff *skb, + const struct mlxsw_txhdr_info *txhdr_info) +{ + const struct mlxsw_tx_info tx_info = txhdr_info->tx_info; + char *txhdr; + + if (skb_cow_head(skb, MLXSW_TXHDR_LEN)) + return -ENOMEM; + + txhdr = skb_push(skb, MLXSW_TXHDR_LEN); + memset(txhdr, 0, MLXSW_TXHDR_LEN); + + mlxsw_tx_hdr_version_set(txhdr, MLXSW_TXHDR_VERSION_1); + mlxsw_tx_hdr_proto_set(txhdr, MLXSW_TXHDR_PROTO_ETH); + mlxsw_tx_hdr_swid_set(txhdr, 0); + + if (unlikely(txhdr_info->data)) { + u16 fid = txhdr_info->max_fid + tx_info.local_port - 1; + + mlxsw_tx_hdr_rx_is_router_set(txhdr, true); + mlxsw_tx_hdr_fid_valid_set(txhdr, true); + mlxsw_tx_hdr_fid_set(txhdr, fid); + mlxsw_tx_hdr_type_set(txhdr, MLXSW_TXHDR_TYPE_DATA); + } else { + mlxsw_tx_hdr_ctl_set(txhdr, MLXSW_TXHDR_ETH_CTL); + mlxsw_tx_hdr_control_tclass_set(txhdr, 1); + mlxsw_tx_hdr_port_mid_set(txhdr, tx_info.local_port); + mlxsw_tx_hdr_type_set(txhdr, MLXSW_TXHDR_TYPE_CONTROL); + } + + return 0; +} + static struct mlxsw_pci_queue * mlxsw_pci_sdq_pick(struct mlxsw_pci *mlxsw_pci, const struct mlxsw_tx_info *tx_info) @@ -2131,6 +2165,10 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb, int i; int err; + err = mlxsw_pci_txhdr_construct(skb, txhdr_info); + if (err) + return err; + if (skb_shinfo(skb)->nr_frags > MLXSW_PCI_WQE_SG_ENTRIES - 1) { err = skb_linearize(skb); if (err) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 4e4d1d366d6c..d2886a8db83d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -165,61 +165,6 @@ void mlxsw_sp_flow_counter_free(struct mlxsw_sp *mlxsw_sp, counter_index); } -void mlxsw_sp_txhdr_construct(struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) -{ - char *txhdr = skb_push(skb, MLXSW_TXHDR_LEN); - - memset(txhdr, 0, MLXSW_TXHDR_LEN); - - mlxsw_tx_hdr_version_set(txhdr, MLXSW_TXHDR_VERSION_1); - mlxsw_tx_hdr_ctl_set(txhdr, MLXSW_TXHDR_ETH_CTL); - mlxsw_tx_hdr_proto_set(txhdr, MLXSW_TXHDR_PROTO_ETH); - mlxsw_tx_hdr_swid_set(txhdr, 0); - mlxsw_tx_hdr_control_tclass_set(txhdr, 1); - mlxsw_tx_hdr_port_mid_set(txhdr, tx_info->local_port); - mlxsw_tx_hdr_type_set(txhdr, MLXSW_TXHDR_TYPE_CONTROL); -} - -int -mlxsw_sp_txhdr_ptp_data_construct(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) -{ - char *txhdr; - u16 max_fid; - int err; - - if (skb_cow_head(skb, MLXSW_TXHDR_LEN)) { - err = -ENOMEM; - goto err_skb_cow_head; - } - - if (!MLXSW_CORE_RES_VALID(mlxsw_core, FID)) { - err = -EIO; - goto err_res_valid; - } - max_fid = MLXSW_CORE_RES_GET(mlxsw_core, FID); - - txhdr = skb_push(skb, MLXSW_TXHDR_LEN); - memset(txhdr, 0, MLXSW_TXHDR_LEN); - - mlxsw_tx_hdr_version_set(txhdr, MLXSW_TXHDR_VERSION_1); - mlxsw_tx_hdr_proto_set(txhdr, MLXSW_TXHDR_PROTO_ETH); - mlxsw_tx_hdr_rx_is_router_set(txhdr, true); - mlxsw_tx_hdr_fid_valid_set(txhdr, true); - mlxsw_tx_hdr_fid_set(txhdr, max_fid + tx_info->local_port - 1); - mlxsw_tx_hdr_type_set(txhdr, MLXSW_TXHDR_TYPE_DATA); - return 0; - -err_res_valid: -err_skb_cow_head: - this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); - dev_kfree_skb_any(skb); - return err; -} - static bool mlxsw_sp_skb_requires_ts(struct sk_buff *skb) { unsigned int type; @@ -242,46 +187,38 @@ static void mlxsw_sp_txhdr_info_data_init(struct mlxsw_core *mlxsw_core, txhdr_info->max_fid = max_fid; } -static void +static struct sk_buff * +mlxsw_sp_vlan_tag_push(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb) +{ + /* In some Spectrum ASICs, in order for PTP event packets to have their + * correction field correctly set on the egress port they must be + * transmitted as data packets. Such packets ingress the ASIC via the + * CPU port and must have a VLAN tag, as the CPU port is not configured + * with a PVID. Push the default VLAN (4095), which is configured as + * egress untagged on all the ports. + */ + if (skb_vlan_tagged(skb)) + return skb; + + return vlan_insert_tag_set_proto(skb, htons(ETH_P_8021Q), + MLXSW_SP_DEFAULT_VID); +} + +static struct sk_buff * mlxsw_sp_txhdr_preparations(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb, struct mlxsw_txhdr_info *txhdr_info) { if (likely(!mlxsw_sp_skb_requires_ts(skb))) - return; + return skb; if (!mlxsw_sp->ptp_ops->tx_as_data) - return; + return skb; /* Special handling for PTP events that require a time stamp and cannot * be transmitted as regular control packets. */ mlxsw_sp_txhdr_info_data_init(mlxsw_sp->core, skb, txhdr_info); -} - -static int mlxsw_sp_txhdr_handle(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) -{ - struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); - - /* In Spectrum-2 and Spectrum-3, PTP events that require a time stamp - * need special handling and cannot be transmitted as regular control - * packets. - */ - if (unlikely(mlxsw_sp_skb_requires_ts(skb))) - return mlxsw_sp->ptp_ops->txhdr_construct(mlxsw_core, - mlxsw_sp_port, skb, - tx_info); - - if (skb_cow_head(skb, MLXSW_TXHDR_LEN)) { - this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); - dev_kfree_skb_any(skb); - return -ENOMEM; - } - - mlxsw_sp_txhdr_construct(skb, tx_info); - return 0; + return mlxsw_sp_vlan_tag_push(mlxsw_sp, skb); } enum mlxsw_reg_spms_state mlxsw_sp_stp_spms_state(u8 state) @@ -697,12 +634,11 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, return NETDEV_TX_OK; } - mlxsw_sp_txhdr_preparations(mlxsw_sp, skb, &txhdr_info); - - err = mlxsw_sp_txhdr_handle(mlxsw_sp->core, mlxsw_sp_port, skb, - &txhdr_info.tx_info); - if (err) + skb = mlxsw_sp_txhdr_preparations(mlxsw_sp, skb, &txhdr_info); + if (!skb) { + this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); return NETDEV_TX_OK; + } /* TX header is consumed by HW on the way so we shouldn't count its * bytes as being sent. @@ -2753,7 +2689,6 @@ static const struct mlxsw_sp_ptp_ops mlxsw_sp1_ptp_ops = { .get_stats_count = mlxsw_sp1_get_stats_count, .get_stats_strings = mlxsw_sp1_get_stats_strings, .get_stats = mlxsw_sp1_get_stats, - .txhdr_construct = mlxsw_sp_ptp_txhdr_construct, }; static const struct mlxsw_sp_ptp_ops mlxsw_sp2_ptp_ops = { @@ -2772,7 +2707,6 @@ static const struct mlxsw_sp_ptp_ops mlxsw_sp2_ptp_ops = { .get_stats_count = mlxsw_sp2_get_stats_count, .get_stats_strings = mlxsw_sp2_get_stats_strings, .get_stats = mlxsw_sp2_get_stats, - .txhdr_construct = mlxsw_sp2_ptp_txhdr_construct, .tx_as_data = true, }; @@ -2792,7 +2726,6 @@ static const struct mlxsw_sp_ptp_ops mlxsw_sp4_ptp_ops = { .get_stats_count = mlxsw_sp2_get_stats_count, .get_stats_strings = mlxsw_sp2_get_stats_strings, .get_stats = mlxsw_sp2_get_stats, - .txhdr_construct = mlxsw_sp_ptp_txhdr_construct, }; struct mlxsw_sp_sample_trigger_node { @@ -3954,7 +3887,6 @@ static struct mlxsw_driver mlxsw_sp1_driver = { .trap_policer_fini = mlxsw_sp_trap_policer_fini, .trap_policer_set = mlxsw_sp_trap_policer_set, .trap_policer_counter_get = mlxsw_sp_trap_policer_counter_get, - .txhdr_construct = mlxsw_sp_txhdr_construct, .resources_register = mlxsw_sp1_resources_register, .kvd_sizes_get = mlxsw_sp_kvd_sizes_get, .ptp_transmitted = mlxsw_sp_ptp_transmitted, @@ -3992,7 +3924,6 @@ static struct mlxsw_driver mlxsw_sp2_driver = { .trap_policer_fini = mlxsw_sp_trap_policer_fini, .trap_policer_set = mlxsw_sp_trap_policer_set, .trap_policer_counter_get = mlxsw_sp_trap_policer_counter_get, - .txhdr_construct = mlxsw_sp_txhdr_construct, .resources_register = mlxsw_sp2_resources_register, .ptp_transmitted = mlxsw_sp_ptp_transmitted, .txhdr_len = MLXSW_TXHDR_LEN, @@ -4029,7 +3960,6 @@ static struct mlxsw_driver mlxsw_sp3_driver = { .trap_policer_fini = mlxsw_sp_trap_policer_fini, .trap_policer_set = mlxsw_sp_trap_policer_set, .trap_policer_counter_get = mlxsw_sp_trap_policer_counter_get, - .txhdr_construct = mlxsw_sp_txhdr_construct, .resources_register = mlxsw_sp2_resources_register, .ptp_transmitted = mlxsw_sp_ptp_transmitted, .txhdr_len = MLXSW_TXHDR_LEN, @@ -4064,7 +3994,6 @@ static struct mlxsw_driver mlxsw_sp4_driver = { .trap_policer_fini = mlxsw_sp_trap_policer_fini, .trap_policer_set = mlxsw_sp_trap_policer_set, .trap_policer_counter_get = mlxsw_sp_trap_policer_counter_get, - .txhdr_construct = mlxsw_sp_txhdr_construct, .resources_register = mlxsw_sp2_resources_register, .ptp_transmitted = mlxsw_sp_ptp_transmitted, .txhdr_len = MLXSW_TXHDR_LEN, diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index 27ccd99ae801..b10f80fc651b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -243,10 +243,6 @@ struct mlxsw_sp_ptp_ops { void (*get_stats_strings)(u8 **p); void (*get_stats)(struct mlxsw_sp_port *mlxsw_sp_port, u64 *data, int data_index); - int (*txhdr_construct)(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info); bool tx_as_data; }; @@ -712,12 +708,6 @@ int mlxsw_sp_flow_counter_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int *p_counter_index); void mlxsw_sp_flow_counter_free(struct mlxsw_sp *mlxsw_sp, unsigned int counter_index); -void mlxsw_sp_txhdr_construct(struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info); -int mlxsw_sp_txhdr_ptp_data_construct(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info); bool mlxsw_sp_port_dev_check(const struct net_device *dev); struct mlxsw_sp *mlxsw_sp_lower_get(struct net_device *dev); struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find(struct net_device *dev); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c index c5a7aae14262..ca8b9d18fbb9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c @@ -1683,43 +1683,3 @@ int mlxsw_sp2_ptp_get_ts_info(struct mlxsw_sp *mlxsw_sp, return 0; } - -int mlxsw_sp_ptp_txhdr_construct(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) -{ - if (skb_cow_head(skb, MLXSW_TXHDR_LEN)) { - this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); - dev_kfree_skb_any(skb); - return -ENOMEM; - } - - mlxsw_sp_txhdr_construct(skb, tx_info); - return 0; -} - -int mlxsw_sp2_ptp_txhdr_construct(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) -{ - /* In Spectrum-2 and Spectrum-3, in order for PTP event packets to have - * their correction field correctly set on the egress port they must be - * transmitted as data packets. Such packets ingress the ASIC via the - * CPU port and must have a VLAN tag, as the CPU port is not configured - * with a PVID. Push the default VLAN (4095), which is configured as - * egress untagged on all the ports. - */ - if (!skb_vlan_tagged(skb)) { - skb = vlan_insert_tag_set_proto(skb, htons(ETH_P_8021Q), - MLXSW_SP_DEFAULT_VID); - if (!skb) { - this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); - return -ENOMEM; - } - } - - return mlxsw_sp_txhdr_ptp_data_construct(mlxsw_core, mlxsw_sp_port, skb, - tx_info); -} diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h index c8aa1452fbb9..102db9060135 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h @@ -49,11 +49,6 @@ void mlxsw_sp1_get_stats_strings(u8 **p); void mlxsw_sp1_get_stats(struct mlxsw_sp_port *mlxsw_sp_port, u64 *data, int data_index); -int mlxsw_sp_ptp_txhdr_construct(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info); - struct mlxsw_sp_ptp_clock * mlxsw_sp2_ptp_clock_init(struct mlxsw_sp *mlxsw_sp, struct device *dev); @@ -78,11 +73,6 @@ int mlxsw_sp2_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, int mlxsw_sp2_ptp_get_ts_info(struct mlxsw_sp *mlxsw_sp, struct kernel_ethtool_ts_info *info); -int mlxsw_sp2_ptp_txhdr_construct(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info); - #else static inline struct mlxsw_sp_ptp_clock * @@ -157,15 +147,6 @@ static inline void mlxsw_sp1_get_stats(struct mlxsw_sp_port *mlxsw_sp_port, { } -static inline int -mlxsw_sp_ptp_txhdr_construct(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) -{ - return -EOPNOTSUPP; -} - static inline struct mlxsw_sp_ptp_clock * mlxsw_sp2_ptp_clock_init(struct mlxsw_sp *mlxsw_sp, struct device *dev) { @@ -211,15 +192,6 @@ mlxsw_sp2_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, { return -EOPNOTSUPP; } - -static inline int -mlxsw_sp2_ptp_txhdr_construct(struct mlxsw_core *mlxsw_core, - struct mlxsw_sp_port *mlxsw_sp_port, - struct sk_buff *skb, - const struct mlxsw_tx_info *tx_info) -{ - return -EOPNOTSUPP; -} #endif static inline void mlxsw_sp2_ptp_shaper_work(struct work_struct *work) From patchwork Thu Jan 16 16:38:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13941970 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2058.outbound.protection.outlook.com [40.107.93.58]) (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 1AE1F22D4D8 for ; Thu, 16 Jan 2025 16:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045587; cv=fail; b=i9A+ZQn8CGrm4sTNpyoubwopuMKjODdTNYL076w7W4HyDpMHnQCPBTd45mgTFnYLK6pCNHhkr2lE0u9fXUMx+ZQO7ivqB+gHBkBOaITqP1vk5YSA5owcB5S5QdFtVZ/s2x7LFfCHwSl4n8/yzvMyzGHeG4Ke8edLUA2Mtd4GC9o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737045587; c=relaxed/simple; bh=UsYTviFx1cYksipEIaNz2JxCeG8mYyyov3glXRkvie8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oZbzEdge0bTSnRjHam62lOfRVbxqaMsT+sP8lMRGmzX9MieDfFOA7tgU78Mv7PYqjUVNcztptuBNj4w20G2j8TfxrTY+8Xq9pnmjYIWat5mBF71Wtn1KBPz44BEeQKtKpAmIqNLRV21QP2KkxTbm4IytwxaR/vyL4b414zfxjrA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=so//WlJE; arc=fail smtp.client-ip=40.107.93.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="so//WlJE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U6AE7+PV5eZgusnVw1aZuzZf95CxzbnrNWx/57GIAYghCQJHUv6M8Rfpl+rkvJJJOTip6aQ/LYMzPhFeDoQZOVbUXTUcSZWoo4m6JBDKadG6Ri5SftL2o2oKMzx8zM8jyw719oY0zLwyRjoGfBXcB5DsS4eVxtMndhS2mqjKRV6FSL8MRkLgalxblSHgwtYwEKfsME+PrqqqUu48AVPfulbwIhMUNAzi9lXAafB8/d3Mlh8vBEmMTUsIjTu+Rh0kJQMtu8GrlLwIkfUptceDvhN4GlQijmux1PeGC7KU5iYWL1nBDLM2JmlWWm7DKbInibYCqFQJIZUlgbYMsOdlVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qGQvpw9g0ylfS6tS44FsLdMXFHcXlk9o9a9I66cd8IU=; b=C8k4z+IsVk4hzre/04FePWj8wOom99KotPhy2QWfhtWW+p++FsSAai3pT2E5twlphwGbdlO5PoE0l8jSNfHOPImfp7mltA568VH9rtEAZ4kdGcvmJRK7apCsjkm33ZK762tlygaYN5FiQjzpoJbyPh0wxTZFN+IjY2zJXUYhOQeszjpbteWJMAOsZT6I2UfQRVNYlh3enuLcqZ0yrWBl30VLc9onPjCrtBGZdbzh9bJvZd7ds8j60jou+DKJ39j6MC9THbF+PcSsxwRpXRwh3oX1JABX8+BnFRXLrvzVqb1BZHieLgH9ca/4kFbNnMKsW4hGHuJzYtK4k2mred2/yA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qGQvpw9g0ylfS6tS44FsLdMXFHcXlk9o9a9I66cd8IU=; b=so//WlJEhpKNfqE4IPsO91KZ+blxm8Li/DQiNucXZgSk4MgOysBDiDHNnkUZf7D32xaGnRu+Qf+ovEcQ1ysJ9GVw9VPu7Az0DZGglP4JvkCZi2AAPsHeAfcUOagZn7CCJtiggWSDGB+cDWaWjlVhYP+7of5Z7mVo1Ja0qLaFcmmyH8ViVUHljZDd4mpxWoyaNQs+33hffLoswn7APJOqOfEJPts5XOBqpZy0otp6MPnfV2bFxHutw+PoYm0OOCNu42ujkRmQIz5jydlXxmZdDZ4ikf88B2qfPZkN66Jx9J/HpDUOFvu4klp/utonlPnfEuLlhVAKJApZY/OxTao+mA== Received: from DM6PR18CA0008.namprd18.prod.outlook.com (2603:10b6:5:15b::21) by MW4PR12MB5602.namprd12.prod.outlook.com (2603:10b6:303:169::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.13; Thu, 16 Jan 2025 16:39:40 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:5:15b:cafe::6) by DM6PR18CA0008.outlook.office365.com (2603:10b6:5:15b::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.13 via Frontend Transport; Thu, 16 Jan 2025 16:39:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000EE33.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.11 via Frontend Transport; Thu, 16 Jan 2025 16:39:39 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:23 -0800 Received: from fedora.mtl.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 16 Jan 2025 08:39:18 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , CC: Richard Cochran , Ido Schimmel , Petr Machata , , Amit Cohen Subject: [PATCH net-next 5/5] mlxsw: Do not store Tx header length as driver parameter Date: Thu, 16 Jan 2025 17:38:18 +0100 Message-ID: <1fb7b3f007de4d311e559c8a954b673d0895d5e9.1737044384.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE33:EE_|MW4PR12MB5602:EE_ X-MS-Office365-Filtering-Correlation-Id: fb6de60c-427b-4c20-1974-08dd364c5f0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: NNKUDpn09GnnKNLX4BJnNALQe040zvPA/MPDtuV0rRO7y1oO/GI+a3Focbb9FEiWE6ExqWHdBfpUs2Q7/E7ZolPSlROaaq8ldT5VJoBBdlTFuf3cC+72idfb5l7+rw4XqwaG9z1vkhlthwxKK8hvXRNSIt0ZoLJcXlr/SFEtu+BkDrHHMCQ0KIwHBS2mw5ENvMSFp4P+O/grnoB+JM2GhE0DZGpn6rl5OywtSkB6suq7vE+zV3xOoNLndO7do6rp5uyhJ0d/Mdq0seFiMCukKZ0sEwPc3O2RRpGWmEEM68yQlaKCw0OkEHpJinZZ1kLCqo8Af/HXiGaFxMuxY9dQ9NTz5WUKQ+3A97u5sCc/fqeVNXUCPGH7I46m6e7KyUqqHun3eqMvCNXnBE7Jorp36zvQjjVIQFDMribYCggz0SZWX5aTQTPkC6jX0+ojP1IOwe7/3yj5uEGfwyuQX+MHwFyLPKqPxDfzrfLzxAY5R3jBGjHqnH2npSjJ6bQ5GrumpiBt1cSMLobnH9okNYR2oX7UamHm8eRjFrXSX1GEkYDDUrFmg6qG0gTf9iJKEGmhrVJYvYJwEmL8SLKlnJZ1g5B58mYPkMBZIioWjnoU5xqekw+uAyHiAxFI1AayHVgT5u6OIukWAeapzJFfvGY6Qp13FDmwToaYxcsquU/sb8Ykmrb3HUCFSVN+b3fZskn4O1kTUSOp74DfWpZlY0Itlxfpux9gCgP/Lhn5Vhup1XnBLGGXdc0X6fRRD8Xw2STd3rQk3gT4j1vPzcyGKFJe4TfRMR50SvS2KGFv0BrumHd/kL7ZEbdk1+d8ACN1ndTDusc09N6Bdpkv1DTy+BZz1lGQvYmPIx/b5ETytTYiwaTNz9A6t8QUm+PAmbWAthLxTC08jof1KVyD9OL+TQDFnIWwWAdTv+jSfABF71qN2ikmWw4NvioOkiMiWk+VZRz+dZ8Es2lc/vh3guO42Ooro/F+UxUUfeEhvByH/glGG6SuBwzBVwuC5HTmlyhUdRpYfvA7CyE4PXwjheZdnBB2ZLrQWIJswzYrkrm6V1cnw3rSLRl+Xa87SEhFdYicr6e0PMxuhDhUxGFpY2OHjG41YbH2g05Kljsck0xZtyYIb5tckCI0fkUbD7ClzB368STJ+UB7WXyYdObokPTtwb2CVgqGRNAMgqv0hOzaKnhdAiU/J0HOHaxaIam6cQc4wB2oXJJLTLLqhdSJjwE2a6fLgsXL50/sr4UAq1uypIZrwmPygsAqvB7kEQ37v6ZqRdM5x3f9PXCX/1ZS1xEgzEsI/tI17Wtwkp0a16QxSFI4ZtLa5/uizWaJ0KZlU5zN9XL3hNM3GmK7ZDatb3dP0A67aYQBaUT6eeKaVRrRT4Cl4pfrdeiiSUoTQYQQ5FqSw7bcKPHUKzHE5sBE05Nuz+ZDCV0MiTyRNDiS1o5UScmHQ7CGvBbS5dp+3eUx4UZTHVZuMZYrYbGeTLRPZ7onm5iI1w== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 16:39:39.5558 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb6de60c-427b-4c20-1974-08dd364c5f0e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE33.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5602 X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen Tx header handling was moved to PCI code, as there is no several drivers which configure Tx header differently. Tx header length is stored as driver parameter, this is not really necessary as it always stores the same value. Remove this field and use the macro MLXSW_TXHDR_LEN explicitly. Signed-off-by: Amit Cohen Reviewed-by: Ido Schimmel Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/core.c | 3 ++- drivers/net/ethernet/mellanox/mlxsw/core.h | 1 - drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index 39888678a2bd..2bb2b77351bd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -35,6 +35,7 @@ #include "reg.h" #include "resources.h" #include "../mlxfw/mlxfw.h" +#include "txheader.h" static LIST_HEAD(mlxsw_core_driver_list); static DEFINE_SPINLOCK(mlxsw_core_driver_list_lock); @@ -943,7 +944,7 @@ static struct sk_buff *mlxsw_emad_alloc(const struct mlxsw_core *mlxsw_core, emad_len = (reg_len + sizeof(u32) + MLXSW_EMAD_ETH_HDR_LEN + (MLXSW_EMAD_OP_TLV_LEN + MLXSW_EMAD_END_TLV_LEN) * - sizeof(u32) + mlxsw_core->driver->txhdr_len); + sizeof(u32) + MLXSW_TXHDR_LEN); if (mlxsw_core->emad.enable_string_tlv) emad_len += MLXSW_EMAD_STRING_TLV_LEN * sizeof(u32); if (mlxsw_core->emad.enable_latency_tlv) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h index d842af24465d..1a871397a6df 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core.h @@ -444,7 +444,6 @@ struct mlxsw_driver { void (*ptp_transmitted)(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, u16 local_port); - u8 txhdr_len; const struct mlxsw_config_profile *profile; bool sdq_supports_cqe_v2; }; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index d2886a8db83d..d714311fd884 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3890,7 +3890,6 @@ static struct mlxsw_driver mlxsw_sp1_driver = { .resources_register = mlxsw_sp1_resources_register, .kvd_sizes_get = mlxsw_sp_kvd_sizes_get, .ptp_transmitted = mlxsw_sp_ptp_transmitted, - .txhdr_len = MLXSW_TXHDR_LEN, .profile = &mlxsw_sp1_config_profile, .sdq_supports_cqe_v2 = false, }; @@ -3926,7 +3925,6 @@ static struct mlxsw_driver mlxsw_sp2_driver = { .trap_policer_counter_get = mlxsw_sp_trap_policer_counter_get, .resources_register = mlxsw_sp2_resources_register, .ptp_transmitted = mlxsw_sp_ptp_transmitted, - .txhdr_len = MLXSW_TXHDR_LEN, .profile = &mlxsw_sp2_config_profile, .sdq_supports_cqe_v2 = true, }; @@ -3962,7 +3960,6 @@ static struct mlxsw_driver mlxsw_sp3_driver = { .trap_policer_counter_get = mlxsw_sp_trap_policer_counter_get, .resources_register = mlxsw_sp2_resources_register, .ptp_transmitted = mlxsw_sp_ptp_transmitted, - .txhdr_len = MLXSW_TXHDR_LEN, .profile = &mlxsw_sp2_config_profile, .sdq_supports_cqe_v2 = true, }; @@ -3996,7 +3993,6 @@ static struct mlxsw_driver mlxsw_sp4_driver = { .trap_policer_counter_get = mlxsw_sp_trap_policer_counter_get, .resources_register = mlxsw_sp2_resources_register, .ptp_transmitted = mlxsw_sp_ptp_transmitted, - .txhdr_len = MLXSW_TXHDR_LEN, .profile = &mlxsw_sp4_config_profile, .sdq_supports_cqe_v2 = true, };