net/dpaa: set the correct frame size in device MTU
Setting correct frame size in dpaa_dev_mtu_set api call. Also setting correct max frame size in hardware in dev_configure for jumbo frames Signed-off-by: Ashish Jain <ashish.jain@nxp.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
parent
3b59b73dea
commit
9658ac3a4e
@ -85,19 +85,21 @@ static int
|
||||
dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
|
||||
{
|
||||
struct dpaa_if *dpaa_intf = dev->data->dev_private;
|
||||
uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN
|
||||
+ VLAN_TAG_SIZE;
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
|
||||
if (mtu < ETHER_MIN_MTU)
|
||||
if (mtu < ETHER_MIN_MTU || frame_size > DPAA_MAX_RX_PKT_LEN)
|
||||
return -EINVAL;
|
||||
if (mtu > ETHER_MAX_LEN)
|
||||
if (frame_size > ETHER_MAX_LEN)
|
||||
dev->data->dev_conf.rxmode.jumbo_frame = 1;
|
||||
else
|
||||
dev->data->dev_conf.rxmode.jumbo_frame = 0;
|
||||
|
||||
dev->data->dev_conf.rxmode.max_rx_pkt_len = mtu;
|
||||
dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
|
||||
|
||||
fman_if_set_maxfrm(dpaa_intf->fif, mtu);
|
||||
fman_if_set_maxfrm(dpaa_intf->fif, frame_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -105,15 +107,19 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
|
||||
static int
|
||||
dpaa_eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
|
||||
{
|
||||
struct dpaa_if *dpaa_intf = dev->data->dev_private;
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
|
||||
if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
|
||||
if (dev->data->dev_conf.rxmode.max_rx_pkt_len <=
|
||||
DPAA_MAX_RX_PKT_LEN)
|
||||
return dpaa_mtu_set(dev,
|
||||
DPAA_MAX_RX_PKT_LEN) {
|
||||
fman_if_set_maxfrm(dpaa_intf->fif,
|
||||
dev->data->dev_conf.rxmode.max_rx_pkt_len);
|
||||
else
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,6 +45,10 @@
|
||||
/*Maximum number of slots available in TX ring*/
|
||||
#define MAX_TX_RING_SLOTS 8
|
||||
|
||||
#ifndef VLAN_TAG_SIZE
|
||||
#define VLAN_TAG_SIZE 4 /** < Vlan Header Length */
|
||||
#endif
|
||||
|
||||
/* PCD frame queues */
|
||||
#define DPAA_PCD_FQID_START 0x400
|
||||
#define DPAA_PCD_FQID_MULTIPLIER 0x100
|
||||
|
Loading…
Reference in New Issue
Block a user