From 43192222b329b3c984687235b0081c7fbfe484ba Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 24 Jul 2018 16:52:29 +0100 Subject: New upstream version 16.11.7 Change-Id: I1dbe85956ca329c829b0066d16b3f902c237fbd3 Signed-off-by: Luca Boccassi --- drivers/net/thunderx/base/nicvf_hw_defs.h | 5 ++++- drivers/net/thunderx/nicvf_ethdev.c | 15 +++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'drivers/net/thunderx') diff --git a/drivers/net/thunderx/base/nicvf_hw_defs.h b/drivers/net/thunderx/base/nicvf_hw_defs.h index 00dd2feb..256e8daf 100644 --- a/drivers/net/thunderx/base/nicvf_hw_defs.h +++ b/drivers/net/thunderx/base/nicvf_hw_defs.h @@ -197,7 +197,10 @@ /* Min/Max packet size */ #define NIC_HW_MIN_FRS (64) -#define NIC_HW_MAX_FRS (9200) /* 9216 max pkt including FCS */ +/* ETH_HLEN+ETH_FCS_LEN+2*VLAN_HLEN */ +#define NIC_HW_L2_OVERHEAD (26) +#define NIC_HW_MAX_MTU (9190) +#define NIC_HW_MAX_FRS (NIC_HW_MAX_MTU + NIC_HW_L2_OVERHEAD) #define NIC_HW_MAX_SEGS (12) /* Descriptor alignments */ diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index d229bdff..d0f0d52d 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -161,7 +161,7 @@ static int nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { struct nicvf *nic = nicvf_pmd_priv(dev); - uint32_t buffsz, frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t buffsz, frame_size = mtu + NIC_HW_L2_OVERHEAD; size_t i; PMD_INIT_FUNC_TRACE(); @@ -178,7 +178,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) * Refuse mtu that requires the support of scattered packets * when this feature has not been enabled before. */ - if (!dev->data->scattered_rx && + if (dev->data->dev_started && !dev->data->scattered_rx && (frame_size + 2 * VLAN_TAG_SIZE > buffsz)) return -EINVAL; @@ -192,11 +192,11 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) else dev->data->dev_conf.rxmode.jumbo_frame = 0; - if (nicvf_mbox_update_hw_max_frs(nic, frame_size)) + if (nicvf_mbox_update_hw_max_frs(nic, mtu)) return -EINVAL; - /* Update max frame size */ - dev->data->dev_conf.rxmode.max_rx_pkt_len = (uint32_t)frame_size; + /* Update max_rx_pkt_len */ + dev->data->dev_conf.rxmode.max_rx_pkt_len = mtu + ETHER_HDR_LEN; nic->mtu = mtu; for (i = 0; i < nic->sqs_count; i++) @@ -1338,7 +1338,7 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) PMD_INIT_FUNC_TRACE(); dev_info->min_rx_bufsize = ETHER_MIN_MTU; - dev_info->max_rx_pktlen = NIC_HW_MAX_FRS; + dev_info->max_rx_pktlen = NIC_HW_MAX_MTU + ETHER_HDR_LEN; dev_info->max_rx_queues = (uint16_t)MAX_RCV_QUEUES_PER_QS * (MAX_SQS_PER_VF + 1); dev_info->max_tx_queues = @@ -1658,8 +1658,7 @@ nicvf_dev_start(struct rte_eth_dev *dev) /* Setup MTU based on max_rx_pkt_len or default */ mtu = dev->data->dev_conf.rxmode.jumbo_frame ? dev->data->dev_conf.rxmode.max_rx_pkt_len - - ETHER_HDR_LEN - ETHER_CRC_LEN - : ETHER_MTU; + - ETHER_HDR_LEN : ETHER_MTU; if (nicvf_dev_set_mtu(dev, mtu)) { PMD_INIT_LOG(ERR, "Failed to set default mtu size"); -- cgit 1.2.3-korg