net/atlantic: implement MTU configuration
authorPavel Belous <pavel.belous@aquantia.com>
Fri, 12 Oct 2018 11:09:45 +0000 (11:09 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 18 Oct 2018 08:24:39 +0000 (10:24 +0200)
Add support for updating MTU value.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
doc/guides/nics/features/atlantic.ini
drivers/net/atlantic/atl_ethdev.c

index 1dd3ff8..dd44ed7 100644 (file)
@@ -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
index 6cee14b..db2d798 100644 (file)
@@ -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,
@@ -1150,6 +1154,23 @@ atl_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)
        return 0;
 }
 
+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,