From patchwork Fri Jun 28 19:29:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13716548 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (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 79111770E2 for ; Fri, 28 Jun 2024 19:30:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719603030; cv=none; b=k0+wRwHxHGNTCtgNu0r15W7jw3E+17Vtni3F8fHoH6W8uYsOra4xqewxrf+I3Ojg0IXMfQ4JS7tZdX4dsguEoEyFhhsqrAucxT30ArGLpupweOcteEdg7sfJrg65CE1RkB6TYB68sIqCbX5lgq3KKpdwPrizXenPgcDp1WS7NqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719603030; c=relaxed/simple; bh=Is7sQcGKanawXqCRkF1Nv+C38jPPQrXORgFxDiUuAyM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c+hTHdwd3rggNyrM9nBnoZun0Otybj7o6IY7+kpJdxtEFZoAorneJ3T4fduzelSVxytgNOZDMUMrpq8M6YYc78C09EDpJoST4x1x4RI+0Fdo6G9WyFO4GpOVTVXGbPjdU2dJBUN7CgSggVx5bDJe8Fk8HlsAEH1B+jgkzpPIA+w= 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=e2bRQYbj; arc=none smtp.client-ip=209.85.215.175 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="e2bRQYbj" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-711b1512aeaso726097a12.3 for ; Fri, 28 Jun 2024 12:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1719603029; x=1720207829; 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=XNbommFMfe7X3MQeE9DXD4HNvqtFSOJ0OF2tgOB0cQM=; b=e2bRQYbjKLeF0QokIRnuM+H3Ji5ovupgFmfvXlmy5kCn4Nk2+AJiPCpiAeFfYB4hzJ KfF02HvsBMF34cpOcl3nwzWfLCdp50ALoTgcfFLbt0BB/FzteqhlCfEOJh/Xcl+nGx3q b3KQ+4bjAM6CGOg15NpuJZF1VtHsTabHcccj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719603029; x=1720207829; 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=XNbommFMfe7X3MQeE9DXD4HNvqtFSOJ0OF2tgOB0cQM=; b=Yi09zE0Sb/bqa6k9Pp82ei216RvC33YWzLS8DZFAmqSR7kQAVeZuIxFByUBvMIPmt3 OJciEGa5+mER/uajja4IMVYMecsqaUcSn47v/8lhyozvI5qC6yyL47hi1HOY4pxPflUD OQ56WhE/3JFMVqkGvGoZuUSAbZI/uDr54BlYcZKkQXu6OWWCrXIF6yMZ5rjj4lKc6NdQ HSbyhv8E0zNPO1X8ulNzNOZzPR465isso8GX/nXhfRkhEy2y/m750izpnQL0t6WRvSOx TEGer4KjqOxkK82vzlW/7I4tDE6Uh4u9wiUwUQaUBQEvqwM90Z19+DiutRbtNeDKJ46v Wnmg== X-Gm-Message-State: AOJu0YxpLjdda8wr30X3VGC13pdreOUOsj9f1SubDFkteZdt/AFPm3T+ U+hiwAHTAGZAtbctrcXVbSs3HDuBF2hp8DvtpBIAHUwfCErudg8hw9PQsR1xbg== X-Google-Smtp-Source: AGHT+IFPCSFt2mqNH04BXuHDNBsnPSC5XK+D71qQpuZx+hESCWRhPZfWM9aWpo+2YU/SzBCH/bu55A== X-Received: by 2002:a05:6a20:7b13:b0:1bd:2ba1:983b with SMTP id adf61e73a8af0-1bd2ba198e7mr9402930637.51.1719603028258; Fri, 28 Jun 2024 12:30:28 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c939cc9b04sm46707a91.0.2024.06.28.12.30.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2024 12:30:27 -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, horms@kernel.org, przemyslaw.kitszel@intel.com Subject: [PATCH net-next v2 02/10] bnxt_en: Add is_ts_pkt field to struct bnxt_sw_tx_bd Date: Fri, 28 Jun 2024 12:29:57 -0700 Message-ID: <20240628193006.225906-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240628193006.225906-1-michael.chan@broadcom.com> References: <20240628193006.225906-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 --- v2: Fix the unwind of txr->is_ts_pkt when bnxt_start_xmit() aborts. drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 ++++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 1bd0c5973252..af064dcc6142 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); @@ -758,6 +759,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) dev_kfree_skb_any(skb); tx_kick_pending: if (BNXT_TX_PTP_IS_SET(lflags)) { + txr->tx_buf_ring[txr->tx_prod].is_ts_pkt = 0; atomic64_inc(&bp->ptp_cfg->stats.ts_err); atomic_inc(&bp->ptp_cfg->tx_avail); } @@ -781,6 +783,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 +803,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 +819,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;