DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiaolong Ye <xiaolong.ye@intel.com>
To: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
	David Marchand <david.marchand@redhat.com>
Cc: Qi Zhang <qi.z.zhang@intel.com>,
	Karlsson Magnus <magnus.karlsson@intel.com>,
	Topel Bjorn <bjorn.topel@intel.com>,
	Xiaolong Ye <xiaolong.ye@intel.com>
Subject: [dpdk-dev] [PATCH v3 2/4] net/af_xdp: specify minimal and maximal MTU
Date: Wed, 17 Apr 2019 16:56:51 +0800	[thread overview]
Message-ID: <20190417085653.110559-3-xiaolong.ye@intel.com> (raw)
Message-ID: <20190417085651.x09jS3rxqv_OrTMvVc8qk632RnumVkxH9ZvR3e3r_1o@z> (raw)
In-Reply-To: <20190417085653.110559-1-xiaolong.ye@intel.com>

Since AF_XDP pmd doesn't support multi segment, we need to add a valid
check in eth_dev_mtu_set.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 5cc643ce2..8430921af 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -351,6 +351,9 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_rx_queues = 1;
 	dev_info->max_tx_queues = 1;
 
+	dev_info->min_mtu = ETHER_MIN_MTU;
+	dev_info->max_mtu = ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM;
+
 	dev_info->default_rxportconf.nb_queues = 1;
 	dev_info->default_txportconf.nb_queues = 1;
 	dev_info->default_rxportconf.ring_size = ETH_AF_XDP_DFLT_NUM_DESCS;
@@ -654,6 +657,15 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	int ret;
 	int s;
 
+	if (mtu > ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM ||
+			mtu < ETHER_MIN_MTU) {
+		AF_XDP_LOG(ERR, "Unsupported MTU of %d. "
+			"max mtu: %d, min mtu: %d", mtu,
+			ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM,
+			ETHER_MIN_MTU);
+		return -EINVAL;
+	}
+
 	s = socket(PF_INET, SOCK_DGRAM, 0);
 	if (s < 0)
 		return -EINVAL;
-- 
2.17.1


  parent reply	other threads:[~2019-04-17  9:02 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  8:21 [dpdk-dev] [PATCH] net/af_xdp: free mbuf when allocate Tx queue fails Xiaolong Ye
2019-04-09  8:21 ` Xiaolong Ye
2019-04-09  8:34 ` David Marchand
2019-04-09  8:34   ` David Marchand
2019-04-09 14:48   ` Ye Xiaolong
2019-04-09 14:48     ` Ye Xiaolong
2019-04-09 15:19 ` [dpdk-dev] [PATCH] net/af_xdp: enqueue buf ring " Xiaolong Ye
2019-04-09 15:19   ` Xiaolong Ye
2019-04-10  8:23   ` David Marchand
2019-04-10  8:23     ` David Marchand
2019-04-10 10:22     ` Ye Xiaolong
2019-04-10 10:22       ` Ye Xiaolong
2019-04-10 10:53   ` [dpdk-dev] [PATCH] net/af_xdp: submit valid count to Tx queue Xiaolong Ye
2019-04-10 10:53     ` Xiaolong Ye
2019-04-10 11:30     ` David Marchand
2019-04-10 11:30       ` David Marchand
2019-04-11  2:24       ` Ye Xiaolong
2019-04-11  2:24         ` Ye Xiaolong
2019-04-11  7:20         ` David Marchand
2019-04-11  7:20           ` David Marchand
2019-04-11  7:27           ` Ye Xiaolong
2019-04-11  7:27             ` Ye Xiaolong
2019-04-12 14:48           ` [dpdk-dev] [PATCH 1/2] net/af_xdp: enqueue buf ring when allocate Tx queue fails Xiaolong Ye
2019-04-12 14:48             ` Xiaolong Ye
2019-04-12 14:48             ` [dpdk-dev] [PATCH 2/2] net/af_xdp: make reserve/submit peek/release consistent Xiaolong Ye
2019-04-12 14:48               ` Xiaolong Ye
2019-04-15  8:19               ` David Marchand
2019-04-15  8:19                 ` David Marchand
2019-04-15 14:42                 ` Ye Xiaolong
2019-04-15 14:42                   ` Ye Xiaolong
2019-04-16 15:03           ` [dpdk-dev] [PATCH v2 0/2] some fixes Xiaolong Ye
2019-04-16 15:03             ` Xiaolong Ye
2019-04-16 15:03             ` [dpdk-dev] [PATCH v2 1/2] net/af_xdp: enqueue buf ring when allocate Tx queue fails Xiaolong Ye
2019-04-16 15:03               ` Xiaolong Ye
2019-04-17  7:45               ` David Marchand
2019-04-17  7:45                 ` David Marchand
2019-04-16 15:03             ` [dpdk-dev] [PATCH v2 2/2] net/af_xdp: make reserve/submit peek/release consistent Xiaolong Ye
2019-04-16 15:03               ` Xiaolong Ye
2019-04-17  7:45               ` David Marchand
2019-04-17  7:45                 ` David Marchand
2019-04-17  7:53                 ` Ye Xiaolong
2019-04-17  7:53                   ` Ye Xiaolong
2019-04-17  8:56           ` [dpdk-dev] [PATCH v3 0/4] some fixes for AF_XDP pmd Xiaolong Ye
2019-04-17  8:56             ` Xiaolong Ye
2019-04-17  8:56             ` [dpdk-dev] [PATCH v3 1/4] net/af_xdp: enqueue buf ring when allocate Tx queue fails Xiaolong Ye
2019-04-17  8:56               ` Xiaolong Ye
2019-04-17  9:15               ` David Marchand
2019-04-17  9:15                 ` David Marchand
2019-04-17 13:26                 ` Ye Xiaolong
2019-04-17 13:26                   ` Ye Xiaolong
2019-04-17  8:56             ` Xiaolong Ye [this message]
2019-04-17  8:56               ` [dpdk-dev] [PATCH v3 2/4] net/af_xdp: specify minimal and maximal MTU Xiaolong Ye
2019-04-17  9:38               ` David Marchand
2019-04-17  9:38                 ` David Marchand
2019-04-17 13:25                 ` Ye Xiaolong
2019-04-17 13:25                   ` Ye Xiaolong
2019-04-17  8:56             ` [dpdk-dev] [PATCH v3 3/4] net/af_xdp: make reserve/submit peek/release consistent Xiaolong Ye
2019-04-17  8:56               ` Xiaolong Ye
2019-04-17  9:25               ` David Marchand
2019-04-17  9:25                 ` David Marchand
2019-04-17  8:56             ` [dpdk-dev] [PATCH v3 4/4] net/af_xdp: fix typos in Rx function Xiaolong Ye
2019-04-17  8:56               ` Xiaolong Ye
2019-04-17  9:25               ` David Marchand
2019-04-17  9:25                 ` David Marchand
2019-04-17 13:49           ` [dpdk-dev] [PATCH v4 0/4] some fixes for AF_XDP pmd Xiaolong Ye
2019-04-17 13:49             ` Xiaolong Ye
2019-04-17 13:49             ` [dpdk-dev] [PATCH v4 1/4] net/af_xdp: enqueue buf ring when allocate Tx queue fails Xiaolong Ye
2019-04-17 13:49               ` Xiaolong Ye
2019-04-17 13:49             ` [dpdk-dev] [PATCH v4 2/4] net/af_xdp: specify minimal and maximal MTU Xiaolong Ye
2019-04-17 13:49               ` Xiaolong Ye
2019-04-17 13:49             ` [dpdk-dev] [PATCH v4 3/4] net/af_xdp: make reserve/submit peek/release consistent Xiaolong Ye
2019-04-17 13:49               ` Xiaolong Ye
2019-04-17 13:49             ` [dpdk-dev] [PATCH v4 4/4] net/af_xdp: fix typos in Rx function Xiaolong Ye
2019-04-17 13:49               ` Xiaolong Ye
2019-04-17 15:31               ` Rami Rosen
2019-04-17 15:31                 ` Rami Rosen
2019-04-17 14:02             ` [dpdk-dev] [PATCH v4 0/4] some fixes for AF_XDP pmd David Marchand
2019-04-17 14:02               ` David Marchand
2019-04-17 15:27               ` Ye Xiaolong
2019-04-17 15:27                 ` Ye Xiaolong
2019-04-17 16:38               ` Ferruh Yigit
2019-04-17 16:38                 ` Ferruh Yigit

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=20190417085653.110559-3-xiaolong.ye@intel.com \
    --to=xiaolong.ye@intel.com \
    --cc=bjorn.topel@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=qi.z.zhang@intel.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).