[07/19] net/ice: support MTU setting
Checks
Commit Message
Add ops link_update.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
drivers/net/ice/ice_ethdev.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
Comments
HI Wenzhou,
Following is a thought but not an issue. Can you please let me know your thought?
<snipped>
> +static int
> +ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
> + struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> + struct rte_eth_dev_data *dev_data = pf->dev_data;
> + uint32_t frame_size = mtu + ETHER_HDR_LEN
> + + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE;
> +
> + if (rte_eal_process_type() == RTE_PROC_SECONDARY)
> + return -E_RTE_SECONDARY;
> +
> + /* check if mtu is within the allowed range */
> + if ((mtu < ETHER_MIN_MTU) || (frame_size > ICE_FRAME_SIZE_MAX))
> + return -EINVAL;
> +
Should we set MTU > 1500 (Jumbo frame) if device is not configured to run with jumbo frame? If no, should we check the jumbo config is enabled for the current device?
> + /* mtu setting is forbidden if port is start */
> + if (dev_data->dev_started) {
> + PMD_DRV_LOG(ERR,
> + "port %d must be stopped before configuration",
> + dev_data->port_id);
> + return -EBUSY;
> + }
> +
> + if (frame_size > ETHER_MAX_LEN)
> + dev_data->dev_conf.rxmode.offloads |=
> + DEV_RX_OFFLOAD_JUMBO_FRAME;
> + else
> + dev_data->dev_conf.rxmode.offloads &=
> + ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> +
> + dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
> +
> + return 0;
> +}
> --
> 1.9.3
Hi, Vipin
Not sure understand your question.
We have no need to configure jumbo frame, because jumbo frame offload will be enable when mtu>1500.
Qiming
-----Original Message-----
From: Varghese, Vipin
Sent: Friday, November 23, 2018 5:58 PM
To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
Subject: RE: [dpdk-dev] [PATCH 07/19] net/ice: support MTU setting
HI Wenzhou,
Following is a thought but not an issue. Can you please let me know your thought?
<snipped>
> +static int
> +ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
> + struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> + struct rte_eth_dev_data *dev_data = pf->dev_data;
> + uint32_t frame_size = mtu + ETHER_HDR_LEN
> + + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE;
> +
> + if (rte_eal_process_type() == RTE_PROC_SECONDARY)
> + return -E_RTE_SECONDARY;
> +
> + /* check if mtu is within the allowed range */
> + if ((mtu < ETHER_MIN_MTU) || (frame_size > ICE_FRAME_SIZE_MAX))
> + return -EINVAL;
> +
Should we set MTU > 1500 (Jumbo frame) if device is not configured to run with jumbo frame? If no, should we check the jumbo config is enabled for the current device?
> + /* mtu setting is forbidden if port is start */
> + if (dev_data->dev_started) {
> + PMD_DRV_LOG(ERR,
> + "port %d must be stopped before configuration",
> + dev_data->port_id);
> + return -EBUSY;
> + }
> +
> + if (frame_size > ETHER_MAX_LEN)
> + dev_data->dev_conf.rxmode.offloads |=
> + DEV_RX_OFFLOAD_JUMBO_FRAME;
> + else
> + dev_data->dev_conf.rxmode.offloads &=
> + ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> +
> + dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
> +
> + return 0;
> +}
> --
> 1.9.3
Hi Qiming
> -----Original Message-----
> From: Yang, Qiming
> Sent: Monday, November 26, 2018 9:09 AM
> To: Varghese, Vipin <vipin.varghese@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>;
> Wu, Jingjing <jingjing.wu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH 07/19] net/ice: support MTU setting
>
> Hi, Vipin
> Not sure understand your question.
> We have no need to configure jumbo frame, because jumbo frame offload will be
> enable when mtu>1500.
Apologies if the question is not clear. Let me try to explain what I am trying to ask below
>
> Qiming
> -----Original Message-----
> From: Varghese, Vipin
> Sent: Friday, November 23, 2018 5:58 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH 07/19] net/ice: support MTU setting
>
> HI Wenzhou,
>
> Following is a thought but not an issue. Can you please let me know your
> thought?
>
> <snipped>
>
> > +static int
> > +ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
> > + struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> > + struct rte_eth_dev_data *dev_data = pf->dev_data;
> > + uint32_t frame_size = mtu + ETHER_HDR_LEN
> > + + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE;
> > +
> > + if (rte_eal_process_type() == RTE_PROC_SECONDARY)
> > + return -E_RTE_SECONDARY;
> > +
> > + /* check if mtu is within the allowed range */
> > + if ((mtu < ETHER_MIN_MTU) || (frame_size > ICE_FRAME_SIZE_MAX))
> > + return -EINVAL;
> > +
>
> Should we set MTU > 1500 (Jumbo frame) if device is not configured to run with
> jumbo frame? If no, should we check the jumbo config is enabled for the current
> device?
>
1. If by default JUMBO enabled for this device?
2. There is RX offload which is configured with value 'DEV_RX_OFFLOAD_JUMBO_FRAME'. Should this be enabled for supporting JUMBO frames?
3. There is per RX queue offload flag too 'DEV_RX_OFFLOAD_JUMBO_FRAME'. If port_conf is set for 'DEV_RX_OFFLOAD_JUMBO_FRAME' but disabled for specific RX queue 'DEV_RX_OFFLOAD_JUMBO_FRAME', what is the JUMBO setting for the device?
Hence do we need to check 'mtu_set' for whether actually device is configured for JUMBO processing or not?
> > + /* mtu setting is forbidden if port is start */
> > + if (dev_data->dev_started) {
> > + PMD_DRV_LOG(ERR,
> > + "port %d must be stopped before configuration",
> > + dev_data->port_id);
> > + return -EBUSY;
> > + }
> > +
> > + if (frame_size > ETHER_MAX_LEN)
> > + dev_data->dev_conf.rxmode.offloads |=
> > + DEV_RX_OFFLOAD_JUMBO_FRAME;
> > + else
> > + dev_data->dev_conf.rxmode.offloads &=
> > + ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> > +
> > + dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
> > +
> > + return 0;
> > +}
> > --
> > 1.9.3
@@ -23,6 +23,7 @@ static void ice_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int ice_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
+static int ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
static const struct rte_pci_id pci_id_ice_map[] = {
{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_BACKPLANE) },
@@ -48,6 +49,7 @@ static int ice_link_update(struct rte_eth_dev *dev,
.dev_infos_get = ice_dev_info_get,
.dev_supported_ptypes_get = ice_dev_supported_ptypes_get,
.link_update = ice_link_update,
+ .mtu_set = ice_mtu_set,
};
static void
@@ -1275,3 +1277,38 @@ static int ice_init_rss(struct ice_pf *pf)
return 0;
}
+
+static int
+ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct rte_eth_dev_data *dev_data = pf->dev_data;
+ uint32_t frame_size = mtu + ETHER_HDR_LEN
+ + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE;
+
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+ return -E_RTE_SECONDARY;
+
+ /* check if mtu is within the allowed range */
+ if ((mtu < ETHER_MIN_MTU) || (frame_size > ICE_FRAME_SIZE_MAX))
+ return -EINVAL;
+
+ /* mtu setting is forbidden if port is start */
+ if (dev_data->dev_started) {
+ PMD_DRV_LOG(ERR,
+ "port %d must be stopped before configuration",
+ dev_data->port_id);
+ return -EBUSY;
+ }
+
+ if (frame_size > ETHER_MAX_LEN)
+ dev_data->dev_conf.rxmode.offloads |=
+ DEV_RX_OFFLOAD_JUMBO_FRAME;
+ else
+ dev_data->dev_conf.rxmode.offloads &=
+ ~DEV_RX_OFFLOAD_JUMBO_FRAME;
+
+ dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+
+ return 0;
+}