From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6670B459D0; Wed, 18 Sep 2024 22:33:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 207B54026F; Wed, 18 Sep 2024 22:33:22 +0200 (CEST) Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by mails.dpdk.org (Postfix) with ESMTP id 9D0304003C for ; Wed, 18 Sep 2024 22:33:20 +0200 (CEST) Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2d89dacf002so297376a91.3 for ; Wed, 18 Sep 2024 13:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1726691600; x=1727296400; darn=dpdk.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Gtn4bVuY7yTxxk9C4a2FJxpb3ekO/Khe65BFTuVh6ao=; b=uDsaufI7WkRB2s3s83CrCsFi+CSRVLfwT3/HAwTk/ixBEwJzv8hm3yvmMgvIf1VLqv t0qc45hlKVZniEpmrzxzO78jzT6oW7tro7s1dGFhtAqkFEdF5PXEOmueS40dG0zBsWBv ApZr4779qyvNpMfBS65RgPGi9QDK60XsweQH4LEnSCCZxqlsRlHcd/b/VceFxLyBeNmP t9gz/NCEjyi8InFpRAqrZup+7geT/IrpAfbIjXK039RweXlxLh9ZyP6/xxYSl9cBgajA jeFTcX1uijnCnCn8G66PDiBv5acENDVgLEaE5SVVPCjPW5xff/oFFO13VolBOqk53uxj 36hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726691600; x=1727296400; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Gtn4bVuY7yTxxk9C4a2FJxpb3ekO/Khe65BFTuVh6ao=; b=NDYj6EAo1j2vpOZGYwh8vy4DULzikyZm02ei85enjNj1EVaj0Tfs1mLVtRqikHM8Hd diK2A3sc4svVEeL1s9onyIiHjq8rQBzlGMOq4/vEWdVHqonvcpv1pZmOlkIjeeT2MRCU 1n+Glvj6sTq6MDU455ZvfmAeIJm7ClJ+/afgrafYiZVOQ87lhUFFYtk7RcfmnVOAykuK GSKLZfE0NFvFQrpaALsK+ooiiLngot5IVwCzzzBwT+K+O9wvD5LpeEaycn1uPsa5qfyy QqcA17Ux0eMWqzySfVjaEz4YO2CwIRJP4PALChI/QJU1GR3eSK4Gz0hleZ//30XKWSpJ rkTg== X-Gm-Message-State: AOJu0Yw5xVlS/n+2HQ3pTDDiCbDd6eSxrzq2SwJFn6d3t/f0634OqubR VIJclic0a15yaDYsA8PMJU4G8iNVFS+AjrxTX8gduqVmezHfHSZoPckBOkt/1EwZYRmTJ9KDaBq hGJV/7FDvZQ== X-Google-Smtp-Source: AGHT+IFFO1Fd2RAkheohChDkbD9SSA78uzRmeAXlPtC1Hh4YSDHA9I+gtI74j0zzu7E44bc4bQggZBafjubOqQ== X-Received: from joshwash.sea.corp.google.com ([2620:15c:11c:202:964c:dc1a:d6ff:4592]) (user=joshwash job=sendgmr) by 2002:a17:90b:1901:b0:2da:c26e:e3ec with SMTP id 98e67ed59e1d1-2db9ff7b899mr48211a91.2.1726691599486; Wed, 18 Sep 2024 13:33:19 -0700 (PDT) Date: Wed, 18 Sep 2024 13:33:17 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.46.0.662.g92d0881bb0-goog Message-ID: <20240918203317.792867-1-joshwash@google.com> Subject: [PATCH] net/gve: add ptype parsing to DQ format From: Joshua Washington To: Jeroen de Borst , Rushil Gupta , Joshua Washington Cc: dev@dpdk.org, Ferruh Yigit Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Currently, the packet type is parsed as part of adding the checksum-related ol_flags for a received packet, but the parsed information is not added to the mbuf. This change adds the parsed ptypes to the mbuf and updates the RX checksum validation to rely on the mbuf instead of re-capturing the ptype from the descriptor. This helps with compatibility with programs which rely on the packet type value stored in the mbuf. Signed-off-by: Joshua Washington Reviewed-by: Rushil Gupta --- drivers/net/gve/gve_rx_dqo.c | 62 +++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/drivers/net/gve/gve_rx_dqo.c b/drivers/net/gve/gve_rx_dqo.c index 5efcce3312..d8e9eee4a8 100644 --- a/drivers/net/gve/gve_rx_dqo.c +++ b/drivers/net/gve/gve_rx_dqo.c @@ -6,6 +6,7 @@ #include "gve_ethdev.h" #include "base/gve_adminq.h" +#include "rte_mbuf_ptype.h" static inline void gve_rx_refill_dqo(struct gve_rx_queue *rxq) @@ -75,38 +76,63 @@ gve_rx_refill_dqo(struct gve_rx_queue *rxq) rxq->bufq_tail = next_avail; } -static inline uint16_t -gve_parse_csum_ol_flags(volatile struct gve_rx_compl_desc_dqo *rx_desc, - struct gve_priv *priv) { - uint64_t ol_flags = 0; - struct gve_ptype ptype = - priv->ptype_lut_dqo->ptypes[rx_desc->packet_type]; - +static inline void +gve_parse_csum_ol_flags(struct rte_mbuf *rx_mbuf, + volatile struct gve_rx_compl_desc_dqo *rx_desc) +{ if (!rx_desc->l3_l4_processed) - return ol_flags; + return; - if (ptype.l3_type == GVE_L3_TYPE_IPV4) { + if (rx_mbuf->packet_type & RTE_PTYPE_L3_IPV4) { if (rx_desc->csum_ip_err) - ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD; + rx_mbuf->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD; else - ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD; + rx_mbuf->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD; } if (rx_desc->csum_l4_err) { - ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD; - return ol_flags; + rx_mbuf->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD; + return; } + if (rx_mbuf->packet_type & RTE_PTYPE_L4_MASK) + rx_mbuf->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD; +} + +static inline void +gve_rx_set_mbuf_ptype(struct gve_priv *priv, struct rte_mbuf *rx_mbuf, + volatile struct gve_rx_compl_desc_dqo *rx_desc) +{ + struct gve_ptype ptype = + priv->ptype_lut_dqo->ptypes[rx_desc->packet_type]; + rx_mbuf->packet_type = 0; + + switch (ptype.l3_type) { + case GVE_L3_TYPE_IPV4: + rx_mbuf->packet_type |= RTE_PTYPE_L3_IPV4; + break; + case GVE_L3_TYPE_IPV6: + rx_mbuf->packet_type |= RTE_PTYPE_L3_IPV6; + break; + default: + break; + } + switch (ptype.l4_type) { case GVE_L4_TYPE_TCP: + rx_mbuf->packet_type |= RTE_PTYPE_L4_TCP; + break; case GVE_L4_TYPE_UDP: + rx_mbuf->packet_type |= RTE_PTYPE_L4_UDP; + break; case GVE_L4_TYPE_ICMP: + rx_mbuf->packet_type |= RTE_PTYPE_L4_ICMP; + break; case GVE_L4_TYPE_SCTP: - ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD; + rx_mbuf->packet_type |= RTE_PTYPE_L4_SCTP; break; default: break; } - return ol_flags; } uint16_t @@ -158,9 +184,9 @@ gve_rx_burst_dqo(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxm->pkt_len = pkt_len; rxm->data_len = pkt_len; rxm->port = rxq->port_id; - rxm->ol_flags = 0; - rxm->ol_flags |= RTE_MBUF_F_RX_RSS_HASH | - gve_parse_csum_ol_flags(rx_desc, rxq->hw); + gve_rx_set_mbuf_ptype(rxq->hw, rxm, rx_desc); + rxm->ol_flags = RTE_MBUF_F_RX_RSS_HASH; + gve_parse_csum_ol_flags(rxm, rx_desc); rxm->hash.rss = rte_le_to_cpu_32(rx_desc->hash); rx_pkts[nb_rx++] = rxm; -- 2.46.0.662.g92d0881bb0-goog