From patchwork Wed Jun 26 16:42:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13713186 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (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 CA5D118FDA0 for ; Wed, 26 Jun 2024 16:43:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719420218; cv=none; b=nu16apnPKqR8C6TuWZV3FHylwJ47ZsfzZzVdqtsjvObTAW3vjSSUrD+FVsECpxaVZBptdubG2zwEfxxVuj+QZk8v0q7drcKKD07lxKxR6DdWtePh1OjtiioiIVkqLtD7irpkMz5nhcHwBCePeWR89XD+yNyxS3Tj2ccRvDcX8J0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719420218; c=relaxed/simple; bh=4qCRiuAIxkS2KsFQMrIIu7MFiCn2R6NxwQ1lRtqrjgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=S5fvslBxOQD5oF9hxTmOzf81iEPDYggIJSso+FVCyubQwLGnlF38tE0ln9LVZv+wjvEIGcAMTcAJR2FZQqO2mFbytkrthvUqswlavLqglCCfFZvpSc3tvyNfsH1nOQPRy4xxfgYuE7GJBPFGlesoe7aw3YxkKl/SD+ISAIr5Fl0= 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=LglsErDo; arc=none smtp.client-ip=209.85.222.180 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="LglsErDo" Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-79c05313eb5so185054285a.1 for ; Wed, 26 Jun 2024 09:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1719420216; x=1720025016; 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=wylplTsl9+X29Ih842Wvjx/gfzneAFAm8hjfRQ0utlw=; b=LglsErDoAanONEQbYv0zPJOnjsUeTIVlvkmx0MYJ2UkOzb7OoP4sH5t6IFHMuYoWOO qRq0oNCvGgY+A+2P8bK/SlDP0JQkVqi5wbyCyc85C42TDV6S0PK3vlBZZRFuyloQlYyB fTVrDLjBPGAD57Dvjzb0GodDciqcaeNuscea0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719420216; x=1720025016; 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=wylplTsl9+X29Ih842Wvjx/gfzneAFAm8hjfRQ0utlw=; b=U3gfniPqWaFOy7fgzlyyjm+zGWYfMxqIKvp/AyaZSOiq3ZhpsfisD7uK0bHRnMCPbD kZoJRiHZrIr7tAJfNRAiogPqJ9azqPMcpj6UBmpEnSk4SGghs5vBqY9rL6fSFyXWxR35 J2UhavoHokYuKDZHYLGGY3UtxPSJbopM4wPg+Cu3jv3yq+jhWTcAVP1HuKh2Kquq+4wm tbPOTgRPTYg2BS65dAM2JQLpvGr7OCtcmzudVKvlQf/ji3DSAhCVoZoaXgQBzO21rv1G EYO0WAqHItvjvrze1S0VMtXO7m0oVk6ewqHo+aTC4jcHoNTNYDEgGYxaTeG2cJTxKB86 6n2w== X-Gm-Message-State: AOJu0YxBSNc+2SA8vzb9i3lgQUHKDDX/ZJzteQMfyN/HvyFFrpUCgkgR n/6Yi2vknPmGwbkwXB1Bn0sjSb4ztWuV2KrfcsOp+yCQmy6ynC53XOtS5gjXs3ULy+8020mmxe0 = X-Google-Smtp-Source: AGHT+IF5VGtN/eRx/odG3USVxYAzHvCDiqvy1qPNIPP8uD8XbNqBpei1LgPeD/MNSzRWDtPo8jcszg== X-Received: by 2002:a05:620a:2946:b0:79c:116a:b782 with SMTP id af79cd13be357-79d5a1123f9mr33025785a.74.1719420215087; Wed, 26 Jun 2024 09:43:35 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79d53c42aafsm53570485a.58.2024.06.26.09.43.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2024 09:43:34 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, richardcochran@gmail.com Subject: [PATCH net-next 02/10] bnxt_en: Add is_ts_pkt field to struct bnxt_sw_tx_bd Date: Wed, 26 Jun 2024 09:42:59 -0700 Message-ID: <20240626164307.219568-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240626164307.219568-1-michael.chan@broadcom.com> References: <20240626164307.219568-1-michael.chan@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 Remove the unused is_gso field and add the is_ts_pkt field to struct bnxt_sw_tx_bd. This field will mark the TX BD that has requested HW TX timestamp. The field needs to be cleared if the timestamp packet is later aborted. This field will be useful when processing the new TX timestamp completion from the hardware in the next patches. Reviewed-by: Pavan Chebbi Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 +++++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 1bd0c5973252..996d9fe80495 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -522,6 +522,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) if (vlan_tag_flags) ptp->tx_hdr_off += VLAN_HLEN; lflags |= cpu_to_le32(TX_BD_FLAGS_STAMP); + tx_buf->is_ts_pkt = 1; skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; } else { atomic_inc(&bp->ptp_cfg->tx_avail); @@ -612,9 +613,11 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) normal_tx: if (length < BNXT_MIN_PKT_SIZE) { pad = BNXT_MIN_PKT_SIZE - length; - if (skb_pad(skb, pad)) + if (skb_pad(skb, pad)) { /* SKB already freed. */ + tx_buf->is_ts_pkt = 0; goto tx_kick_pending; + } length = BNXT_MIN_PKT_SIZE; } @@ -741,6 +744,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) /* start back at beginning and unmap skb */ prod = txr->tx_prod; tx_buf = &txr->tx_buf_ring[RING_TX(bp, prod)]; + tx_buf->is_ts_pkt = 0; dma_unmap_single(&pdev->dev, dma_unmap_addr(tx_buf, mapping), skb_headlen(skb), DMA_TO_DEVICE); prod = NEXT_TX(prod); @@ -781,6 +785,7 @@ static void __bnxt_tx_int(struct bnxt *bp, struct bnxt_tx_ring_info *txr, while (RING_TX(bp, cons) != hw_cons) { struct bnxt_sw_tx_bd *tx_buf; struct sk_buff *skb; + bool is_ts_pkt; int j, last; tx_buf = &txr->tx_buf_ring[RING_TX(bp, cons)]; @@ -800,6 +805,8 @@ static void __bnxt_tx_int(struct bnxt *bp, struct bnxt_tx_ring_info *txr, tx_buf->is_push = 0; goto next_tx_int; } + is_ts_pkt = tx_buf->is_ts_pkt; + tx_buf->is_ts_pkt = 0; dma_unmap_single(&pdev->dev, dma_unmap_addr(tx_buf, mapping), skb_headlen(skb), DMA_TO_DEVICE); @@ -814,7 +821,7 @@ static void __bnxt_tx_int(struct bnxt *bp, struct bnxt_tx_ring_info *txr, skb_frag_size(&skb_shinfo(skb)->frags[j]), DMA_TO_DEVICE); } - if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) { + if (unlikely(is_ts_pkt)) { if (BNXT_CHIP_P5(bp)) { /* PTP worker takes ownership of the skb */ if (!bnxt_get_tx_ts_p5(bp, skb)) { diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index d3ad73d4c00a..00976e8a1e6a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -874,7 +874,7 @@ struct bnxt_sw_tx_bd { DEFINE_DMA_UNMAP_ADDR(mapping); DEFINE_DMA_UNMAP_LEN(len); struct page *page; - u8 is_gso; + u8 is_ts_pkt; u8 is_push; u8 action; unsigned short nr_frags;