Message ID | 1513166759-13466-6-git-send-email-hemant.agrawal@nxp.com |
---|---|
State | Superseded |
Headers | show |
Series | DPAA PMD improvements | expand |
On 12/13/2017 12:05 PM, Hemant Agrawal wrote: > From: Ashish Jain <ashish.jain@nxp.com> > > 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> <...> > @@ -111,19 +111,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)) checkpatch complains about extra parentheses: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'mtu < ETHER_MIN_MTU' #42: FILE: drivers/net/dpaa/dpaa_ethdev.c:119: + if ((mtu < ETHER_MIN_MTU) || (frame_size > DPAA_MAX_RX_PKT_LEN)) CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'frame_size > DPAA_MAX_RX_PKT_LEN' #42: FILE: drivers/net/dpaa/dpaa_ethdev.c:119: + if ((mtu < ETHER_MIN_MTU) || (frame_size > DPAA_MAX_RX_PKT_LEN)) <...>
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 4ad9afc..adcc219 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -111,19 +111,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; } @@ -131,15 +133,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; } diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 3f06d63..ef726d3 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -71,6 +71,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