From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: Felix Marti <felix@chelsio.com>,
Kumar Sanghvi <kumaras@chelsio.com>,
Nirranjan Kirubaharan <nirranjan@chelsio.com>
Subject: [dpdk-dev] [PATCH v2 5/6] cxgbe: Allow apps to change mtu
Date: Thu, 8 Oct 2015 19:16:09 +0530 [thread overview]
Message-ID: <19ddc7ec8c1dccaee20806ec840c242f0ba38a1e.1444303884.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1444303884.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1444303884.git.rahul.lakkireddy@chelsio.com>
Add a mtu_set() eth_dev_ops to allow DPDK apps to modify device mtu.
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
v2:
- No change
drivers/net/cxgbe/cxgbe_ethdev.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 6d7b29c..a8e057b 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -225,6 +225,34 @@ static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
return 0;
}
+static int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
+{
+ struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+ struct adapter *adapter = pi->adapter;
+ struct rte_eth_dev_info dev_info;
+ int err;
+ uint16_t new_mtu = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+
+ cxgbe_dev_info_get(eth_dev, &dev_info);
+
+ /* Must accommodate at least ETHER_MIN_MTU */
+ if ((new_mtu < ETHER_MIN_MTU) || (new_mtu > dev_info.max_rx_pktlen))
+ return -EINVAL;
+
+ /* set to jumbo mode if needed */
+ if (new_mtu > ETHER_MAX_LEN)
+ eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
+ else
+ eth_dev->data->dev_conf.rxmode.jumbo_frame = 0;
+
+ err = t4_set_rxmode(adapter, adapter->mbox, pi->viid, new_mtu, -1, -1,
+ -1, -1, true);
+ if (!err)
+ eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_mtu;
+
+ return err;
+}
+
static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
uint16_t tx_queue_id);
static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
@@ -724,6 +752,7 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
.dev_configure = cxgbe_dev_configure,
.dev_infos_get = cxgbe_dev_info_get,
.link_update = cxgbe_dev_link_update,
+ .mtu_set = cxgbe_dev_mtu_set,
.tx_queue_setup = cxgbe_dev_tx_queue_setup,
.tx_queue_start = cxgbe_dev_tx_queue_start,
.tx_queue_stop = cxgbe_dev_tx_queue_stop,
--
2.5.3
next prev parent reply other threads:[~2015-10-08 13:46 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 ` [dpdk-dev] [PATCH 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 3/6] cxgbe: Update tx path to transmit " 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 ` Rahul Lakkireddy [this message]
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=19ddc7ec8c1dccaee20806ec840c242f0ba38a1e.1444303884.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).