net/ngbe: support MTU set
Support updating port MTU. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
This commit is contained in:
parent
8b433d04ad
commit
07baabb6a5
@ -9,6 +9,7 @@ Link status = Y
|
||||
Link status event = Y
|
||||
Queue start/stop = Y
|
||||
Burst mode info = Y
|
||||
MTU update = Y
|
||||
Scattered Rx = Y
|
||||
TSO = Y
|
||||
VLAN filter = Y
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#define NGBE_LINK_UP_TIME 90 /* 9.0 Seconds */
|
||||
|
||||
#define NGBE_FRAME_SIZE_MAX (9728) /* Maximum frame size, +FCS */
|
||||
#define NGBE_FRAME_SIZE_DFT (1522) /* Default frame size, +FCS */
|
||||
#define NGBE_NUM_POOL (32)
|
||||
#define NGBE_MAX_QP (8)
|
||||
@ -319,6 +320,8 @@ struct ngbe_hw {
|
||||
u16 nb_rx_queues;
|
||||
u16 nb_tx_queues;
|
||||
|
||||
u32 mode;
|
||||
|
||||
u32 q_rx_regs[8 * 4];
|
||||
u32 q_tx_regs[8 * 4];
|
||||
bool offset_loaded;
|
||||
|
@ -2041,6 +2041,33 @@ ngbe_dev_interrupt_handler(void *param)
|
||||
ngbe_dev_interrupt_action(dev);
|
||||
}
|
||||
|
||||
static int
|
||||
ngbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
|
||||
{
|
||||
struct ngbe_hw *hw = ngbe_dev_hw(dev);
|
||||
uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 4;
|
||||
struct rte_eth_dev_data *dev_data = dev->data;
|
||||
|
||||
/* If device is started, refuse mtu that requires the support of
|
||||
* scattered packets when this feature has not been enabled before.
|
||||
*/
|
||||
if (dev_data->dev_started && !dev_data->scattered_rx &&
|
||||
(frame_size + 2 * NGBE_VLAN_TAG_SIZE >
|
||||
dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
|
||||
PMD_INIT_LOG(ERR, "Stop port first.");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (hw->mode)
|
||||
wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
|
||||
NGBE_FRAME_SIZE_MAX);
|
||||
else
|
||||
wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
|
||||
NGBE_FRMSZ_MAX(frame_size));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the IVAR registers, mapping interrupt causes to vectors
|
||||
* @param hw
|
||||
@ -2151,6 +2178,7 @@ static const struct eth_dev_ops ngbe_eth_dev_ops = {
|
||||
.xstats_get_names = ngbe_dev_xstats_get_names,
|
||||
.xstats_get_names_by_id = ngbe_dev_xstats_get_names_by_id,
|
||||
.dev_supported_ptypes_get = ngbe_dev_supported_ptypes_get,
|
||||
.mtu_set = ngbe_dev_mtu_set,
|
||||
.vlan_filter_set = ngbe_vlan_filter_set,
|
||||
.vlan_tpid_set = ngbe_vlan_tpid_set,
|
||||
.vlan_offload_set = ngbe_vlan_offload_set,
|
||||
|
Loading…
Reference in New Issue
Block a user