svn commit: r361527 - head/sys/dev/ena

Marcin Wojtas mw at FreeBSD.org
Tue May 26 16:00:32 UTC 2020


Author: mw
Date: Tue May 26 16:00:30 2020
New Revision: 361527
URL: https://svnweb.freebsd.org/changeset/base/361527

Log:
  Allow disabling meta caching for ENA Tx path
  
  Determined by a flag passed from the device. No metadata is set within
  ena_tx_csum when caching is disabled.
  
  Submitted by:  Maciej Bielski <mba at semihalf.com>
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_datapath.c

Modified: head/sys/dev/ena/ena.c
==============================================================================
--- head/sys/dev/ena/ena.c	Tue May 26 15:58:48 2020	(r361526)
+++ head/sys/dev/ena/ena.c	Tue May 26 16:00:30 2020	(r361527)
@@ -3519,6 +3519,11 @@ ena_attach(device_t pdev)
 		goto err_com_free;
 	}
 
+	if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV)
+		adapter->disable_meta_caching =
+		    !!(get_feat_ctx.llq.accel_mode.u.get.supported_flags &
+		    BIT(ENA_ADMIN_DISABLE_META_CACHING));
+
 	adapter->keep_alive_timestamp = getsbinuptime();
 
 	adapter->tx_offload_cap = get_feat_ctx.offload.tx;

Modified: head/sys/dev/ena/ena.h
==============================================================================
--- head/sys/dev/ena/ena.h	Tue May 26 15:58:48 2020	(r361526)
+++ head/sys/dev/ena/ena.h	Tue May 26 16:00:30 2020	(r361527)
@@ -461,6 +461,7 @@ struct ena_adapter {
 	sbintime_t missing_tx_timeout;
 	uint32_t missing_tx_max_queues;
 	uint32_t missing_tx_threshold;
+	bool disable_meta_caching;
 
 	/* Statistics */
 	struct ena_stats_dev dev_stats;

Modified: head/sys/dev/ena/ena_datapath.c
==============================================================================
--- head/sys/dev/ena/ena_datapath.c	Tue May 26 15:58:48 2020	(r361526)
+++ head/sys/dev/ena/ena_datapath.c	Tue May 26 16:00:30 2020	(r361527)
@@ -49,7 +49,7 @@ static struct mbuf* ena_rx_mbuf(struct ena_ring *, str
     struct ena_com_rx_ctx *, uint16_t *);
 static inline void ena_rx_checksum(struct ena_ring *, struct ena_com_rx_ctx *,
     struct mbuf *);
-static void	ena_tx_csum(struct ena_com_tx_ctx *, struct mbuf *);
+static void	ena_tx_csum(struct ena_com_tx_ctx *, struct mbuf *, bool);
 static int	ena_check_and_collapse_mbuf(struct ena_ring *tx_ring,
     struct mbuf **mbuf);
 static int	ena_xmit_mbuf(struct ena_ring *, struct mbuf **);
@@ -675,7 +675,8 @@ error:
 }
 
 static void
-ena_tx_csum(struct ena_com_tx_ctx *ena_tx_ctx, struct mbuf *mbuf)
+ena_tx_csum(struct ena_com_tx_ctx *ena_tx_ctx, struct mbuf *mbuf,
+    bool disable_meta_caching)
 {
 	struct ena_com_tx_meta *ena_meta;
 	struct ether_vlan_header *eh;
@@ -703,7 +704,12 @@ ena_tx_csum(struct ena_com_tx_ctx *ena_tx_ctx, struct 
 		offload = true;
 
 	if (!offload) {
-		ena_tx_ctx->meta_valid = 0;
+		if (disable_meta_caching) {
+			memset(ena_meta, 0, sizeof(*ena_meta));
+			ena_tx_ctx->meta_valid = 1;
+		} else {
+			ena_tx_ctx->meta_valid = 0;
+		}
 		return;
 	}
 
@@ -989,7 +995,7 @@ ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf **
 	ena_tx_ctx.header_len = header_len;
 
 	/* Set flags and meta data */
-	ena_tx_csum(&ena_tx_ctx, *mbuf);
+	ena_tx_csum(&ena_tx_ctx, *mbuf, adapter->disable_meta_caching);
 
 	if (tx_ring->acum_pkts == DB_THRESHOLD ||
 	    ena_com_is_doorbell_needed(tx_ring->ena_com_io_sq, &ena_tx_ctx)) {


More information about the svn-src-head mailing list