From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <david.marchand@6wind.com>
Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
 [74.125.82.181]) by dpdk.org (Postfix) with ESMTP id 43B53AFD5
 for <dev@dpdk.org>; Tue, 17 Jun 2014 20:09:33 +0200 (CEST)
Received: by mail-we0-f181.google.com with SMTP id q59so7471001wes.26
 for <dev@dpdk.org>; Tue, 17 Jun 2014 11:09:49 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references;
 bh=TUyCQBwRCGTyNIQyg83meD/ojHKXUs3neCM4GAFD21Q=;
 b=PT8t9CRVfbxk4yVdwU4w/EYNX0Um5UEL5tfkwYlE6xYLQ+khhyGcXYzzquXVF9pT/y
 uhKZFSWBl5F3YC0+qzPM40mEoKY64WYAdi/E1MO74LJDk4KIAN5F26N3wSlat9mupDbT
 GSCfwlagbZ23JA65o0YZaI/16UDfwOGSgc7Gg3W3AGQ6MXtAnxlFGbxrCpattVF8DUy3
 FqkO34ANAGXmLyJOl5xoOF8zu7P7GigvB3RfXsBF0MFyHktu7WndaImE2usbNTE+lm4Y
 LoT/1I2taA4npRUMfIjScpzBljHMOFBjgRB0e0Vt/LZ0E+y6VlRq5ARkxv0jhVFTx8xF
 jtPg==
X-Gm-Message-State: ALoCoQlQHCh1ze3KZ6gRUgcz3BSs9UHHUjkua3dovAp/xapeIXGafotcCmCX+9wPlhDw/gyxp0RX
X-Received: by 10.195.12.34 with SMTP id en2mr41141394wjd.13.1403028589524;
 Tue, 17 Jun 2014 11:09:49 -0700 (PDT)
Received: from alcyon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net.
 [82.239.227.177])
 by mx.google.com with ESMTPSA id ge17sm1711552wic.0.2014.06.17.11.09.48
 for <dev@dpdk.org>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 17 Jun 2014 11:09:48 -0700 (PDT)
From: David Marchand <david.marchand@6wind.com>
To: dev@dpdk.org
Date: Tue, 17 Jun 2014 20:09:29 +0200
Message-Id: <1403028572-24794-5-git-send-email-david.marchand@6wind.com>
X-Mailer: git-send-email 1.7.10.4
In-Reply-To: <1403028572-24794-1-git-send-email-david.marchand@6wind.com>
References: <1403028572-24794-1-git-send-email-david.marchand@6wind.com>
Subject: [dpdk-dev] [PATCH v3 4/7] ethdev: introduce enable_scatter rx mode
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jun 2014 18:09:33 -0000

We might want to be sure the scatter packets reception handler is selected in a
pmd. This makes it possible to then change mtu later, without the need of
restarting a port.
It is then the pmd duty to tell it enabled the scatter reception handler by
setting dev->data->scattered_rx to 1.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_ether/rte_ethdev.h     |    3 ++-
 lib/librte_pmd_e1000/em_rxtx.c    |    5 +++++
 lib/librte_pmd_e1000/igb_rxtx.c   |   10 ++++++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c |   10 ++++++++++
 4 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 581259d..2b98700 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -307,7 +307,8 @@ struct rte_eth_rxmode {
 		hw_vlan_strip    : 1, /**< VLAN strip enable. */
 		hw_vlan_extend   : 1, /**< Extended VLAN enable. */
 		jumbo_frame      : 1, /**< Jumbo Frame Receipt enable. */
-		hw_strip_crc     : 1; /**< Enable CRC stripping by hardware. */
+		hw_strip_crc     : 1, /**< Enable CRC stripping by hardware. */
+		enable_scatter   : 1; /**< Enable scatter packets rx handler */
 };
 
 /**
diff --git a/lib/librte_pmd_e1000/em_rxtx.c b/lib/librte_pmd_e1000/em_rxtx.c
index 1575e79..e5f1933 100644
--- a/lib/librte_pmd_e1000/em_rxtx.c
+++ b/lib/librte_pmd_e1000/em_rxtx.c
@@ -1714,6 +1714,11 @@ eth_em_rx_init(struct rte_eth_dev *dev)
 		}
 	}
 
+	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		dev->rx_pkt_burst = eth_em_recv_scattered_pkts;
+		dev->data->scattered_rx = 1;
+	}
+
 	/*
 	 * Setup the Checksum Register.
 	 * Receive Full-Packet Checksum Offload is mutually exclusive with RSS.
diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c
index 9f0310d..aea898c 100644
--- a/lib/librte_pmd_e1000/igb_rxtx.c
+++ b/lib/librte_pmd_e1000/igb_rxtx.c
@@ -2008,6 +2008,11 @@ eth_igb_rx_init(struct rte_eth_dev *dev)
 		E1000_WRITE_REG(hw, E1000_RXDCTL(rxq->reg_idx), rxdctl);
 	}
 
+	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
+		dev->data->scattered_rx = 1;
+	}
+
 	/*
 	 * Setup BSIZE field of RCTL register, if needed.
 	 * Buffer sizes >= 1024 are not [supposed to be] setup in the RCTL
@@ -2277,6 +2282,11 @@ eth_igbvf_rx_init(struct rte_eth_dev *dev)
 		E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl);
 	}
 
+	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
+		dev->data->scattered_rx = 1;
+	}
+
 	/*
 	 * Setup the HW Rx Head and Tail Descriptor Pointers.
 	 * This needs to be done after enable.
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index ca72e75..f487859 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3486,6 +3486,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 		}
 	}
 
+	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+		dev->data->scattered_rx = 1;
+	}
+
 	/*
 	 * Device configured with multiple RX queues.
 	 */
@@ -3961,6 +3966,11 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
 		}
 	}
 
+	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+		dev->data->scattered_rx = 1;
+	}
+
 	return 0;
 }
 
-- 
1.7.10.4