* [dpdk-dev] [PATCH v1] net/axgbe: add support for set MTU API
@ 2020-06-01 14:48 gnandiba
2020-06-04 5:22 ` Somalapuram, Amaranath
2020-06-08 9:08 ` Ferruh Yigit
0 siblings, 2 replies; 3+ messages in thread
From: gnandiba @ 2020-06-01 14:48 UTC (permalink / raw)
To: dev; +Cc: Amaranath.Somalapuram
From: gnandiba <gnandiba@amd.com>
This patch adds support for set_mtu API which can be used to change
the Maximum Transmission unit (MTU) from application.
Signed-off-by: gnandiba <gnandiba@amd.com>
---
drivers/net/axgbe/axgbe_ethdev.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 867058845..cdb1297f5 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -73,6 +73,7 @@ static void axgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
static void axgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);
const uint32_t *axgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
+static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
struct axgbe_xstats {
char name[RTE_ETH_XSTATS_NAME_SIZE];
@@ -214,6 +215,7 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
.dev_supported_ptypes_get = axgbe_dev_supported_ptypes_get,
.rx_descriptor_status = axgbe_dev_rx_descriptor_status,
.tx_descriptor_status = axgbe_dev_tx_descriptor_status,
+ .mtu_set = axgb_mtu_set,
};
static int axgbe_phy_reset(struct axgbe_port *pdata)
@@ -1254,7 +1256,35 @@ axgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev)
return ptypes;
return NULL;
}
-
+static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+ struct rte_eth_dev_info dev_info;
+ struct axgbe_port *pdata = dev->data->dev_private;
+ uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+ unsigned int val = 0;
+ axgbe_dev_info_get(dev, &dev_info);
+ /* check that mtu is within the allowed range */
+ if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen))
+ return -EINVAL;
+ /* mtu setting is forbidden if port is start */
+ if (dev->data->dev_started) {
+ PMD_DRV_LOG(ERR, "port %d must be stopped before configuration",
+ dev->data->port_id);
+ return -EBUSY;
+ }
+ if (frame_size > RTE_ETHER_MAX_LEN) {
+ dev->data->dev_conf.rxmode.offloads |=
+ DEV_RX_OFFLOAD_JUMBO_FRAME;
+ val = 1;
+ } else {
+ dev->data->dev_conf.rxmode.offloads &=
+ ~DEV_RX_OFFLOAD_JUMBO_FRAME;
+ val = 0;
+ }
+ AXGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val);
+ dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+ return 0;
+}
static void axgbe_get_all_hw_features(struct axgbe_port *pdata)
{
unsigned int mac_hfr0, mac_hfr1, mac_hfr2;
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add support for set MTU API
2020-06-01 14:48 [dpdk-dev] [PATCH v1] net/axgbe: add support for set MTU API gnandiba
@ 2020-06-04 5:22 ` Somalapuram, Amaranath
2020-06-08 9:08 ` Ferruh Yigit
1 sibling, 0 replies; 3+ messages in thread
From: Somalapuram, Amaranath @ 2020-06-04 5:22 UTC (permalink / raw)
To: Nandibasappa, Girish, dev; +Cc: Ferruh Yigit
[AMD Public Use]
Acked-by: Somalapuram Amaranath <asomalap@amd.com>
-----Original Message-----
From: Nandibasappa, Girish <Girish.Nandibasappa@amd.com>
Sent: Monday, June 1, 2020 8:19 PM
To: dev@dpdk.org
Cc: Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
Subject: [PATCH v1] net/axgbe: add support for set MTU API
From: gnandiba <gnandiba@amd.com>
This patch adds support for set_mtu API which can be used to change the Maximum Transmission unit (MTU) from application.
Signed-off-by: gnandiba <gnandiba@amd.com>
---
drivers/net/axgbe/axgbe_ethdev.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 867058845..cdb1297f5 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -73,6 +73,7 @@ static void axgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, static void axgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);
const uint32_t *axgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
+static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
struct axgbe_xstats {
char name[RTE_ETH_XSTATS_NAME_SIZE];
@@ -214,6 +215,7 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
.dev_supported_ptypes_get = axgbe_dev_supported_ptypes_get,
.rx_descriptor_status = axgbe_dev_rx_descriptor_status,
.tx_descriptor_status = axgbe_dev_tx_descriptor_status,
+.mtu_set= axgb_mtu_set,
};
static int axgbe_phy_reset(struct axgbe_port *pdata) @@ -1254,7 +1256,35 @@ axgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev)
return ptypes;
return NULL;
}
-
+static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
+struct rte_eth_dev_info dev_info;
+struct axgbe_port *pdata = dev->data->dev_private;
+uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+unsigned int val = 0;
+axgbe_dev_info_get(dev, &dev_info);
+/* check that mtu is within the allowed range */
+if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen))
+return -EINVAL;
+/* mtu setting is forbidden if port is start */
+if (dev->data->dev_started) {
+PMD_DRV_LOG(ERR, "port %d must be stopped before configuration",
+dev->data->port_id);
+return -EBUSY;
+}
+if (frame_size > RTE_ETHER_MAX_LEN) {
+dev->data->dev_conf.rxmode.offloads |=
+DEV_RX_OFFLOAD_JUMBO_FRAME;
+val = 1;
+} else {
+dev->data->dev_conf.rxmode.offloads &=
+~DEV_RX_OFFLOAD_JUMBO_FRAME;
+val = 0;
+}
+AXGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val);
+dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+return 0;
+}
static void axgbe_get_all_hw_features(struct axgbe_port *pdata) {
unsigned int mac_hfr0, mac_hfr1, mac_hfr2;
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add support for set MTU API
2020-06-01 14:48 [dpdk-dev] [PATCH v1] net/axgbe: add support for set MTU API gnandiba
2020-06-04 5:22 ` Somalapuram, Amaranath
@ 2020-06-08 9:08 ` Ferruh Yigit
1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2020-06-08 9:08 UTC (permalink / raw)
To: gnandiba, dev; +Cc: Amaranath.Somalapuram
On 6/1/2020 3:48 PM, gnandiba@amd.com wrote:
> From: gnandiba <gnandiba@amd.com>
>
> This patch adds support for set_mtu API which can be used to change
> the Maximum Transmission unit (MTU) from application.
>
> Signed-off-by: gnandiba <gnandiba@amd.com>
Please use "Name Surname <email>" format, for this time I am updating it as
following using identity from previous contribution:
"Signed-off-by: Girish Nandibasappa <girish.nandibasappa@amd.com>"
Applied to dpdk-next-net/master, thanks.
<...>
> @@ -1254,7 +1256,35 @@ axgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev)
> return ptypes;
> return NULL;
> }
> -
> +static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> +{
> + struct rte_eth_dev_info dev_info;
> + struct axgbe_port *pdata = dev->data->dev_private;
> + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> + unsigned int val = 0;
> + axgbe_dev_info_get(dev, &dev_info);
> + /* check that mtu is within the allowed range */
> + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen))
> + return -EINVAL;
Removed unnecessary parentheses while merging, please run
"./devtools/checkpatches.sh" before submitting the patch, which shows below
warning (also patchwork shows same warnings:
http://mails.dpdk.org/archives/test-report/2020-June/134309.html)
### net/axgbe: support setting MTU
CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'mtu <
RTE_ETHER_MIN_MTU'
#45: FILE: drivers/net/axgbe/axgbe_ethdev.c:1411:
+ if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen))
CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'frame_size >
dev_info.max_rx_pktlen'
#45: FILE: drivers/net/axgbe/axgbe_ethdev.c:1411:
+ if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-08 9:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 14:48 [dpdk-dev] [PATCH v1] net/axgbe: add support for set MTU API gnandiba
2020-06-04 5:22 ` Somalapuram, Amaranath
2020-06-08 9:08 ` Ferruh Yigit
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).