[dpdk-dev,v2,1/6] ether: enhancement for VMDQ support
Commit Message
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
The change includes several parts:
1. Clear pool bitmap when trying to remove specific MAC.
2. Define RSS, DCB and VMDQ flags to combine rx_mq_mode.
3. Use 'struct' to replace 'union', which to expand the rx_adv_conf
arguments to better support RSS, DCB and VMDQ.
4. Fix bug in rte_eth_dev_config_restore function, which will restore
all MAC address to default pool.
5. Define additional 3 arguments for better VMDQ support.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
lib/librte_ether/rte_ethdev.c | 12 ++++++----
lib/librte_ether/rte_ethdev.h | 43 ++++++++++++++++++++++++++++++----------
2 files changed, 39 insertions(+), 16 deletions(-)
Comments
2014-10-16 18:07, Chen Jing D:
> /**
> + * Simple flags to indicate RX mq mode, which can be used independently or combined
> + * in enum rte_eth_rx_mq_mode definition.
> + */
> +#define ETH_MQ_RX_RSS_FLAG 0x1
> +#define ETH_MQ_RX_DCB_FLAG 0x2
> +#define ETH_MQ_RX_VMDQ_FLAG 0x4
The comment would be more useful by explaining that these flags are used
for rte_eth_conf.rxmode.mq_mode.
> + /**< None of DCB,RSS or VMDQ mode */
> + ETH_MQ_RX_NONE = 0,
> +
> + /**< For RX side, only RSS is on */
> + ETH_MQ_RX_RSS = ETH_MQ_RX_RSS_FLAG,
> + /**< For RX side,only DCB is on. */
> + ETH_MQ_RX_DCB = ETH_MQ_RX_DCB_FLAG,
> + /**< Both DCB and RSS enable */
> + ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG,
> +
> + /**< Only VMDQ, no RSS nor DCB */
> + ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG,
> + /**< RSS mode with VMDQ */
> + ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_VMDQ_FLAG,
> + /**< Use VMDQ+DCB to route traffic to queues */
> + ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG | ETH_MQ_RX_DCB_FLAG,
> + /**< Enable both VMDQ and DCB in VMDq */
> + ETH_MQ_RX_VMDQ_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG |
> + ETH_MQ_RX_VMDQ_FLAG,
Doxygen comments placed before should start with /** not /**<.
> + /** Specify the queue range belongs to VMDQ pools if VMDQ applicable. */
> + uint16_t vmdq_queue_base;
> + uint16_t vmdq_queue_num;
Please explain what mean the values in vmdq_queue_base and vmdq_queue_num.
Thanks
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, November 04, 2014 6:17 AM
> To: Chen, Jing D
> Cc: dev@dpdk.org; Ananyev, Konstantin
> Subject: Re: [PATCH v2 1/6] ether: enhancement for VMDQ support
>
> 2014-10-16 18:07, Chen Jing D:
> > /**
> > + * Simple flags to indicate RX mq mode, which can be used independently
> or combined
> > + * in enum rte_eth_rx_mq_mode definition.
> > + */
> > +#define ETH_MQ_RX_RSS_FLAG 0x1
> > +#define ETH_MQ_RX_DCB_FLAG 0x2
> > +#define ETH_MQ_RX_VMDQ_FLAG 0x4
>
> The comment would be more useful by explaining that these flags are used
> for rte_eth_conf.rxmode.mq_mode.
Yes, that's more straightforward.
>
> > + /**< None of DCB,RSS or VMDQ mode */
> > + ETH_MQ_RX_NONE = 0,
> > +
> > + /**< For RX side, only RSS is on */
> > + ETH_MQ_RX_RSS = ETH_MQ_RX_RSS_FLAG,
> > + /**< For RX side,only DCB is on. */
> > + ETH_MQ_RX_DCB = ETH_MQ_RX_DCB_FLAG,
> > + /**< Both DCB and RSS enable */
> > + ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG |
> ETH_MQ_RX_DCB_FLAG,
> > +
> > + /**< Only VMDQ, no RSS nor DCB */
> > + ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG,
> > + /**< RSS mode with VMDQ */
> > + ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG |
> ETH_MQ_RX_VMDQ_FLAG,
> > + /**< Use VMDQ+DCB to route traffic to queues */
> > + ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG |
> ETH_MQ_RX_DCB_FLAG,
> > + /**< Enable both VMDQ and DCB in VMDq */
> > + ETH_MQ_RX_VMDQ_DCB_RSS = ETH_MQ_RX_RSS_FLAG |
> ETH_MQ_RX_DCB_FLAG |
> > + ETH_MQ_RX_VMDQ_FLAG,
>
> Doxygen comments placed before should start with /** not /**<.
My mistake. Thanks for pointing it out.
>
> > + /** Specify the queue range belongs to VMDQ pools if VMDQ
> applicable. */
> > + uint16_t vmdq_queue_base;
> > + uint16_t vmdq_queue_num;
>
> Please explain what mean the values in vmdq_queue_base and
> vmdq_queue_num.
I thinks the name is self- explanatory, I also add some comments for them.
As previous max_rx/tx_queues indicates how many queues available, these
2 variables defines the queue ranges for VM usage.
What kind of explanations you needs me to add?
>
> Thanks
> --
> Thomas
2014-11-04 05:50, Chen, Jing D:
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > 2014-10-16 18:07, Chen Jing D:
> > > + /** Specify the queue range belongs to VMDQ pools if VMDQ
> > applicable. */
> > > + uint16_t vmdq_queue_base;
> > > + uint16_t vmdq_queue_num;
> >
> > Please explain what mean the values in vmdq_queue_base and
> > vmdq_queue_num.
>
> I thinks the name is self- explanatory, I also add some comments for them.
> As previous max_rx/tx_queues indicates how many queues available, these
> 2 variables defines the queue ranges for VM usage.
I understand clearly now.
> What kind of explanations you needs me to add?
You cannot put a doxygen comment which apply to 2 fields.
Try do describe precisely the meaning of each field.
Example: /**< first queue ID in the range for VMDQ pool */
and /**< size of the queue range for VMDQ pool */
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, November 04, 2014 4:54 PM
> To: Chen, Jing D
> Cc: dev@dpdk.org; Ananyev, Konstantin
> Subject: Re: [PATCH v2 1/6] ether: enhancement for VMDQ support
>
> 2014-11-04 05:50, Chen, Jing D:
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > > 2014-10-16 18:07, Chen Jing D:
> > > > + /** Specify the queue range belongs to VMDQ pools if VMDQ
> > > applicable. */
> > > > + uint16_t vmdq_queue_base;
> > > > + uint16_t vmdq_queue_num;
> > >
> > > Please explain what mean the values in vmdq_queue_base and
> > > vmdq_queue_num.
> >
> > I thinks the name is self- explanatory, I also add some comments for them.
> > As previous max_rx/tx_queues indicates how many queues available,
> these
> > 2 variables defines the queue ranges for VM usage.
>
> I understand clearly now.
>
> > What kind of explanations you needs me to add?
>
> You cannot put a doxygen comment which apply to 2 fields.
> Try do describe precisely the meaning of each field.
> Example: /**< first queue ID in the range for VMDQ pool */
> and /**< size of the queue range for VMDQ pool */
Thanks! Got you.
>
> --
> Thomas
@@ -771,7 +771,8 @@ rte_eth_dev_config_restore(uint8_t port_id)
continue;
/* add address to the hardware */
- if (*dev->dev_ops->mac_addr_add)
+ if (*dev->dev_ops->mac_addr_add &&
+ dev->data->mac_pool_sel[i] & (1ULL << pool))
(*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
else {
PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
@@ -1249,10 +1250,8 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
}
dev = &rte_eth_devices[port_id];
- /* Default device offload capabilities to zero */
- dev_info->rx_offload_capa = 0;
- dev_info->tx_offload_capa = 0;
- dev_info->if_index = 0;
+ /* Set all fields with zero */
+ memset(dev_info, 0, sizeof(*dev_info));
FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
dev_info->pci_dev = dev->pci_dev;
@@ -2022,6 +2021,9 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)
/* Update address in NIC data structure */
ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]);
+ /* reset pool bitmap */
+ dev->data->mac_pool_sel[index] = 0;
+
return 0;
}
@@ -252,20 +252,37 @@ struct rte_eth_thresh {
};
/**
+ * Simple flags to indicate RX mq mode, which can be used independently or combined
+ * in enum rte_eth_rx_mq_mode definition.
+ */
+#define ETH_MQ_RX_RSS_FLAG 0x1
+#define ETH_MQ_RX_DCB_FLAG 0x2
+#define ETH_MQ_RX_VMDQ_FLAG 0x4
+
+/**
* A set of values to identify what method is to be used to route
* packets to multiple queues.
*/
enum rte_eth_rx_mq_mode {
- ETH_MQ_RX_NONE = 0, /**< None of DCB,RSS or VMDQ mode */
-
- ETH_MQ_RX_RSS, /**< For RX side, only RSS is on */
- ETH_MQ_RX_DCB, /**< For RX side,only DCB is on. */
- ETH_MQ_RX_DCB_RSS, /**< Both DCB and RSS enable */
-
- ETH_MQ_RX_VMDQ_ONLY, /**< Only VMDQ, no RSS nor DCB */
- ETH_MQ_RX_VMDQ_RSS, /**< RSS mode with VMDQ */
- ETH_MQ_RX_VMDQ_DCB, /**< Use VMDQ+DCB to route traffic to queues */
- ETH_MQ_RX_VMDQ_DCB_RSS, /**< Enable both VMDQ and DCB in VMDq */
+ /**< None of DCB,RSS or VMDQ mode */
+ ETH_MQ_RX_NONE = 0,
+
+ /**< For RX side, only RSS is on */
+ ETH_MQ_RX_RSS = ETH_MQ_RX_RSS_FLAG,
+ /**< For RX side,only DCB is on. */
+ ETH_MQ_RX_DCB = ETH_MQ_RX_DCB_FLAG,
+ /**< Both DCB and RSS enable */
+ ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG,
+
+ /**< Only VMDQ, no RSS nor DCB */
+ ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG,
+ /**< RSS mode with VMDQ */
+ ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_VMDQ_FLAG,
+ /**< Use VMDQ+DCB to route traffic to queues */
+ ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG | ETH_MQ_RX_DCB_FLAG,
+ /**< Enable both VMDQ and DCB in VMDq */
+ ETH_MQ_RX_VMDQ_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG |
+ ETH_MQ_RX_VMDQ_FLAG,
};
/**
@@ -840,7 +857,7 @@ struct rte_eth_conf {
Read the datasheet of given ethernet controller
for details. The possible values of this field
are defined in implementation of each driver. */
- union {
+ struct {
struct rte_eth_rss_conf rss_conf; /**< Port RSS configuration */
struct rte_eth_vmdq_dcb_conf vmdq_dcb_conf;
/**< Port vmdq+dcb configuration. */
@@ -906,6 +923,10 @@ struct rte_eth_dev_info {
uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */
uint32_t rx_offload_capa; /**< Device RX offload capabilities. */
uint32_t tx_offload_capa; /**< Device TX offload capabilities. */
+ /** Specify the queue range belongs to VMDQ pools if VMDQ applicable. */
+ uint16_t vmdq_queue_base;
+ uint16_t vmdq_queue_num;
+ uint16_t vmdq_pool_base; /**< First ID of VMDQ pools. */
};
struct rte_eth_dev;