DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: Kumar Sanghvi <kumaras@chelsio.com>,
	Felix Marti <felix@chelsio.com>,
	Nirranjan Kirubaharan <nirranjan@chelsio.com>
Subject: [dpdk-dev] [PATCH 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames
Date: Fri,  2 Oct 2015 16:46:51 +0530	[thread overview]
Message-ID: <90e2e170809a7bb6abb1cd6ff395d8710134e0f1.1443704150.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1443704150.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1443704150.git.rahul.lakkireddy@chelsio.com>

Increase max_rx_pktlen to accommodate jumbo frame size. Perform sanity
checks and enable jumbo mode in rx queue setup. Set link mtu based on
max_rx_pktlen.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 drivers/net/cxgbe/cxgbe.h        |  3 +++
 drivers/net/cxgbe/cxgbe_ethdev.c | 23 +++++++++++++++++++++--
 drivers/net/cxgbe/cxgbe_main.c   |  3 ++-
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h
index 97c37d2..adc0d92 100644
--- a/drivers/net/cxgbe/cxgbe.h
+++ b/drivers/net/cxgbe/cxgbe.h
@@ -43,6 +43,9 @@
 #define CXGBE_DEFAULT_TX_DESC_SIZE    1024 /* Default TX ring size */
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
+#define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU /* min buf size */
+#define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */
+
 int cxgbe_probe(struct adapter *adapter);
 int cxgbe_up(struct adapter *adap);
 int cxgbe_down(struct port_info *pi);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 478051a..6d7b29c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -141,8 +141,8 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	struct adapter *adapter = pi->adapter;
 	int max_queues = adapter->sge.max_ethqsets / adapter->params.nports;
 
-	device_info->min_rx_bufsize = 68; /* XXX: Smallest pkt size */
-	device_info->max_rx_pktlen = 1500; /* XXX: For now we support mtu */
+	device_info->min_rx_bufsize = CXGBE_MIN_RX_BUFSIZE;
+	device_info->max_rx_pktlen = CXGBE_MAX_RX_PKTLEN;
 	device_info->max_rx_queues = max_queues;
 	device_info->max_tx_queues = max_queues;
 	device_info->max_mac_addrs = 1;
@@ -498,6 +498,8 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	int err = 0;
 	int msi_idx = 0;
 	unsigned int temp_nb_desc;
+	struct rte_eth_dev_info dev_info;
+	unsigned int pkt_len = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 
 	RTE_SET_USED(rx_conf);
 
@@ -505,6 +507,17 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 		  __func__, eth_dev->data->nb_rx_queues, queue_idx, nb_desc,
 		  socket_id, mp);
 
+	cxgbe_dev_info_get(eth_dev, &dev_info);
+
+	/* Must accommodate at least ETHER_MIN_MTU */
+	if ((pkt_len < dev_info.min_rx_bufsize) ||
+	    (pkt_len > dev_info.max_rx_pktlen)) {
+		dev_err(adap, "%s: max pkt len must be > %d and <= %d\n",
+			__func__, dev_info.min_rx_bufsize,
+			dev_info.max_rx_pktlen);
+		return -EINVAL;
+	}
+
 	/*  Free up the existing queue  */
 	if (eth_dev->data->rx_queues[queue_idx]) {
 		cxgbe_dev_rx_queue_release(eth_dev->data->rx_queues[queue_idx]);
@@ -534,6 +547,12 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	if ((&rxq->fl) != NULL)
 		rxq->fl.size = temp_nb_desc;
 
+	/* Set to jumbo mode if necessary */
+	if (pkt_len > ETHER_MAX_LEN)
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
+	else
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 0;
+
 	err = t4_sge_alloc_rxq(adapter, &rxq->rspq, false, eth_dev, msi_idx,
 			       &rxq->fl, t4_ethrx_handler,
 			       t4_get_mps_bg_map(adapter, pi->tx_chan), mp,
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 316b87d..aff23d0 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -855,12 +855,13 @@ int link_start(struct port_info *pi)
 {
 	struct adapter *adapter = pi->adapter;
 	int ret;
+	unsigned int mtu = pi->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 
 	/*
 	 * We do not set address filters and promiscuity here, the stack does
 	 * that step explicitly.
 	 */
-	ret = t4_set_rxmode(adapter, adapter->mbox, pi->viid, 1500, -1, -1,
+	ret = t4_set_rxmode(adapter, adapter->mbox, pi->viid, mtu, -1, -1,
 			    -1, 1, true);
 	if (ret == 0) {
 		ret = t4_change_mac(adapter, adapter->mbox, pi->viid,
-- 
2.5.3

  parent reply	other threads:[~2015-10-02 11:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
2015-10-02 21:48   ` Aaron Conole
2015-10-05 10:06     ` Rahul Lakkireddy
2015-10-05 11:46       ` Ananyev, Konstantin
2015-10-05 12:42         ` Rahul Lakkireddy
2015-10-05 14:09           ` Ananyev, Konstantin
2015-10-05 15:07             ` Rahul Lakkireddy
2015-10-07 15:27               ` Rahul Lakkireddy
2015-10-02 11:16 ` Rahul Lakkireddy [this message]
2015-10-02 11:16 ` [dpdk-dev] [PATCH 3/6] cxgbe: Update tx path to transmit jumbo frames Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 4/6] cxgbe: Update rx path to receive " Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 5/6] cxgbe: Allow apps to change mtu Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 6/6] doc: Update cxgbe documentation and release notes Rahul Lakkireddy
2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 3/6] cxgbe: Update tx path to transmit " Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 4/6] cxgbe: Update rx path to receive " Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 5/6] cxgbe: Allow apps to change mtu Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 6/6] doc: Update cxgbe documentation and release notes Rahul Lakkireddy
2015-10-20 16:51   ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Thomas Monjalon
2015-10-21  6:14     ` Rahul Lakkireddy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90e2e170809a7bb6abb1cd6ff395d8710134e0f1.1443704150.git.rahul.lakkireddy@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=dev@dpdk.org \
    --cc=felix@chelsio.com \
    --cc=kumaras@chelsio.com \
    --cc=nirranjan@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).