net/enic: fix max MTU calculation
The maximum packet length (max_pkt_len) from the firmware does not include CRC, so do not subtract 4 when deriving the max MTU. This change effectively increases the max MTU by 4B. Apps often assume max MTU = max_rx_pkt_len - 14 (ethernet header), and attempt to set the MTU to that value (i.e. set MTU to max HW value). This change incidentally allows such apps to change MTU to max value successfully. Fixes: bb34ffb848a0 ("net/enic: determine max egress packet size and max MTU") Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com> Reviewed-by: John Daley <johndale@cisco.com>
This commit is contained in:
parent
e00a5eaab2
commit
c09eb93529
drivers/net/enic
@ -203,8 +203,8 @@ struct enic {
|
||||
/* Compute ethdev's max packet size from MTU */
|
||||
static inline uint32_t enic_mtu_to_max_rx_pktlen(uint32_t mtu)
|
||||
{
|
||||
/* ethdev max size includes eth and crc whereas NIC MTU does not */
|
||||
return mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
|
||||
/* ethdev max size includes eth whereas NIC MTU does not */
|
||||
return mtu + ETHER_HDR_LEN;
|
||||
}
|
||||
|
||||
/* Get the CQ index from a Start of Packet(SOP) RQ index */
|
||||
|
@ -61,10 +61,9 @@ int enic_get_vnic_config(struct enic *enic)
|
||||
* and will be 0 for legacy firmware and VICs
|
||||
*/
|
||||
if (c->max_pkt_size > ENIC_DEFAULT_RX_MAX_PKT_SIZE)
|
||||
enic->max_mtu = c->max_pkt_size - (ETHER_HDR_LEN + 4);
|
||||
enic->max_mtu = c->max_pkt_size - ETHER_HDR_LEN;
|
||||
else
|
||||
enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE
|
||||
- (ETHER_HDR_LEN + 4);
|
||||
enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE - ETHER_HDR_LEN;
|
||||
if (c->mtu == 0)
|
||||
c->mtu = 1500;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user