From: vanshika.shukla@nxp.com
To: dev@dpdk.org, Hemant Agrawal <hemant.agrawal@nxp.com>,
Sachin Saxena <sachin.saxena@nxp.com>,
Jun Yang <jun.yang@nxp.com>
Cc: stable@dpdk.org, Rohit Raj <rohit.raj@nxp.com>,
Vanshika Shukla <vanshika.shukla@nxp.com>
Subject: [v4 7/8] net/dpaa: restrict MTU config for shared intf
Date: Tue, 9 Jul 2024 15:35:04 +0530 [thread overview]
Message-ID: <20240709100505.2476972-8-vanshika.shukla@nxp.com> (raw)
In-Reply-To: <20240709100505.2476972-1-vanshika.shukla@nxp.com>
From: Rohit Raj <rohit.raj@nxp.com>
Since DPDK was able to configure mtu in VSP/Shared interface mode,
it was causing misconfiguration of the hw which further caused crashes.
This patch allow only kernel to config MTU in such cases
Fixes: e4abd4ff183c ("net/dpaa: support virtual storage profile")
Cc: jun.yang@nxp.com
Cc: stable@dpdk.org
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
drivers/net/dpaa/dpaa_ethdev.c | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 44bac67803..060b8c678f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -14,6 +14,7 @@
#include <pthread.h>
#include <sys/types.h>
#include <sys/syscall.h>
+#include <sys/ioctl.h>
#include <rte_string_fns.h>
#include <rte_byteorder.h>
@@ -165,9 +166,15 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN
+ VLAN_TAG_SIZE;
uint32_t buffsz = dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM;
+ struct fman_if *fif = dev->process_private;
PMD_INIT_FUNC_TRACE();
+ if (fif->is_shared_mac) {
+ DPAA_PMD_ERR("Cannot configure mtu from DPDK in VSP mode.");
+ return -ENOTSUP;
+ }
+
/*
* Refuse mtu that requires the support of scattered packets
* when this feature has not been enabled before.
@@ -206,7 +213,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
struct rte_intr_handle *intr_handle;
uint32_t max_rx_pktlen;
int speed, duplex;
- int ret, rx_status;
+ int ret, rx_status, socket_fd;
+ struct ifreq ifr;
PMD_INIT_FUNC_TRACE();
@@ -222,6 +230,26 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
dpaa_intf->name);
return -EHOSTDOWN;
}
+
+ socket_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+ if (socket_fd == -1) {
+ DPAA_PMD_ERR("Cannot open IF socket");
+ return -errno;
+ }
+
+ strncpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ - 1);
+
+ if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
+ DPAA_PMD_ERR("Cannot get interface mtu");
+ close(socket_fd);
+ return -errno;
+ }
+
+ close(socket_fd);
+ DPAA_PMD_INFO("Using kernel configured mtu size(%u)",
+ ifr.ifr_mtu);
+
+ eth_conf->rxmode.mtu = ifr.ifr_mtu;
}
/* Rx offloads which are enabled by default */
@@ -249,7 +277,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;
}
- fman_if_set_maxfrm(dev->process_private, max_rx_pktlen);
+ if (!fif->is_shared_mac)
+ fman_if_set_maxfrm(dev->process_private, max_rx_pktlen);
if (rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) {
DPAA_PMD_DEBUG("enabling scatter mode");
--
2.25.1
next prev parent reply other threads:[~2024-07-09 10:05 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
2024-07-03 11:16 ` [PATCH 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-03 11:16 ` [PATCH 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-03 11:16 ` [PATCH 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-03 11:16 ` [PATCH 4/8] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-03 11:16 ` [PATCH 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-03 11:16 ` [PATCH 6/8] bus/dpaa: remove unused code vanshika.shukla
2024-07-03 11:16 ` [PATCH 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
2024-07-03 11:16 ` [PATCH 8/8] mempool/dpaax: cache free optimization vanshika.shukla
2024-07-05 7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
2024-07-05 7:42 ` [v2 1/7] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-08 7:29 ` [v3 0/8] DPAA specific fixes vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-08 13:28 ` David Marchand
2024-07-08 7:29 ` [PATCH v3 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 4/8] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 6/8] bus/dpaa: remove unused code vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
2024-07-09 8:47 ` David Marchand
2024-07-08 7:29 ` [PATCH v3 8/8] mempool/dpaax: cache free optimization vanshika.shukla
2024-07-08 13:28 ` David Marchand
2024-07-09 10:04 ` [v4 0/8] DPAA specific fixes vanshika.shukla
2024-07-09 10:04 ` [v4 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-09 10:04 ` [v4 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-09 10:05 ` [v4 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-09 10:05 ` [v4 4/8] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-09 10:05 ` [v4 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-09 10:05 ` [v4 6/8] bus/dpaa: remove unused code vanshika.shukla
2024-07-09 10:05 ` vanshika.shukla [this message]
2024-07-09 10:05 ` [v4 8/8] mempool/dpaax: cache free optimization vanshika.shukla
2024-07-09 12:05 ` [v4 0/8] DPAA specific fixes David Marchand
2024-07-10 8:55 ` [v5 " vanshika.shukla
2024-07-10 8:55 ` [v5 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-10 8:55 ` [v5 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-10 8:55 ` [v5 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-10 8:55 ` [v5 4/8] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-10 8:55 ` [v5 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-10 8:55 ` [v5 6/8] bus/dpaa: remove unused code vanshika.shukla
2024-07-10 8:55 ` [v5 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
2024-07-10 8:55 ` [v5 8/8] mempool/dpaax: cache free optimization vanshika.shukla
2024-07-11 15:41 ` [v5 0/8] DPAA specific fixes David Marchand
2024-07-05 7:42 ` [v2 2/7] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-05 7:42 ` [v2 3/7] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-05 7:42 ` [v2 4/7] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-05 7:42 ` [v2 5/7] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-05 7:42 ` [v2 6/7] bus/dpaa: remove unused code vanshika.shukla
2024-07-05 7:42 ` [v2 7/7] net/dpaa: restrict MTU config for shared intf vanshika.shukla
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=20240709100505.2476972-8-vanshika.shukla@nxp.com \
--to=vanshika.shukla@nxp.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=jun.yang@nxp.com \
--cc=rohit.raj@nxp.com \
--cc=sachin.saxena@nxp.com \
--cc=stable@dpdk.org \
/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).