From: Pavel Belous <pavel.bel...@aquantia.com>

Add support for updating MTU value.

Signed-off-by: Igor Russkikh <igor.russk...@aquantia.com>
Signed-off-by: Pavel Belous <pavel.bel...@aquantia.com>
---
 doc/guides/nics/features/atlantic.ini |  1 +
 drivers/net/atlantic/atl_ethdev.c     | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/doc/guides/nics/features/atlantic.ini 
b/doc/guides/nics/features/atlantic.ini
index 1dd3ff87e512..dd44ed75aef4 100644
--- a/doc/guides/nics/features/atlantic.ini
+++ b/doc/guides/nics/features/atlantic.ini
@@ -8,6 +8,7 @@ Speed capabilities   = Y
 Link status          = Y
 Link status event    = Y
 Queue start/stop     = Y
+MTU update           = Y
 Jumbo frame          = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
diff --git a/drivers/net/atlantic/atl_ethdev.c 
b/drivers/net/atlantic/atl_ethdev.c
index 6cee14b2dcba..db2d798f28aa 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -48,6 +48,8 @@ static void atl_dev_info_get(struct rte_eth_dev *dev,
 
 static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
+static int atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
+
 /* Flow control */
 static int atl_flow_ctrl_get(struct rte_eth_dev *dev,
                               struct rte_eth_fc_conf *fc_conf);
@@ -219,6 +221,8 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
        .dev_infos_get        = atl_dev_info_get,
        .dev_supported_ptypes_get = atl_dev_supported_ptypes_get,
 
+       .mtu_set              = atl_dev_mtu_set,
+
        /* Queue Control */
        .rx_queue_start       = atl_rx_queue_start,
        .rx_queue_stop        = atl_rx_queue_stop,
@@ -1151,6 +1155,23 @@ atl_set_default_mac_addr(struct rte_eth_dev *dev, struct 
ether_addr *addr)
 }
 
 static int
+atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+       struct rte_eth_dev_info dev_info;
+       uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+
+       atl_dev_info_get(dev, &dev_info);
+
+       if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen))
+               return -EINVAL;
+
+       /* update max frame size */
+       dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+
+       return 0;
+}
+
+static int
 atl_dev_set_mc_addr_list(struct rte_eth_dev *dev,
                          struct ether_addr *mc_addr_set,
                          uint32_t nb_mc_addr)
-- 
2.7.4

Reply via email to