net/atlantic: implement MTU configuration

Add support for updating MTU value.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
This commit is contained in:
Pavel Belous 2018-10-12 11:09:45 +00:00 committed by Ferruh Yigit
parent 275d21b554
commit 4c4340ff30
2 changed files with 22 additions and 0 deletions

View 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

View 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,