DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [DPDK] net/ixgbe: fix missing Port Representor data-path callbacks
@ 2018-05-09 15:00 Remy Horton
  2018-05-11 10:49 ` Mohammad Abdul Awal
  0 siblings, 1 reply; 2+ messages in thread
From: Remy Horton @ 2018-05-09 15:00 UTC (permalink / raw)
  To: dev; +Cc: Konstantin Ananyev, Wenzhuo Lu, Ferruh Yigit

This patch adds Rx and Tx burst functions to the ixgbe
Port Representors, so that the implementation within
ixgbe PMD can be tested using applications such as
testpmd which require data-path functionality.

Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")

Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 drivers/net/ixgbe/ixgbe_vf_representor.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c
index 8f8af49..21c44d1 100644
--- a/drivers/net/ixgbe/ixgbe_vf_representor.c
+++ b/drivers/net/ixgbe/ixgbe_vf_representor.c
@@ -153,6 +153,25 @@ struct eth_dev_ops ixgbe_vf_representor_dev_ops = {
 	.mac_addr_set		= ixgbe_vf_representor_mac_addr_set,
 };
 
+static uint16_t
+ixgbe_vf_representor_rx_burst(__rte_unused void *rx_queue,
+	__rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts)
+{
+	return 0;
+}
+
+static uint16_t
+ixgbe_vf_representor_tx_burst(__rte_unused void *tx_queue,
+	struct rte_mbuf **tx_pkts,
+	uint16_t nb_pkts)
+{
+	uint16_t idx_pkt;
+
+	for (idx_pkt = 0; idx_pkt < nb_pkts; idx_pkt++)
+		rte_pktmbuf_free(tx_pkts[idx_pkt]);
+	return nb_pkts;
+}
+
 int
 ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)
 {
@@ -182,9 +201,11 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)
 	/* Set representor device ops */
 	ethdev->dev_ops = &ixgbe_vf_representor_dev_ops;
 
-	/* No data-path so no RX/TX functions */
-	ethdev->rx_pkt_burst = NULL;
-	ethdev->tx_pkt_burst = NULL;
+	/* No data-path, but need stub Rx/Tx functions to avoid crash
+	 * when testing with the likes of testpmd.
+	 */
+	ethdev->rx_pkt_burst = ixgbe_vf_representor_rx_burst;
+	ethdev->tx_pkt_burst = ixgbe_vf_representor_tx_burst;
 
 	/* Setting the number queues allocated to the VF */
 	ethdev->data->nb_rx_queues = IXGBE_VF_MAX_RX_QUEUES;
-- 
2.9.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [DPDK] net/ixgbe: fix missing Port Representor data-path callbacks
  2018-05-09 15:00 [dpdk-dev] [DPDK] net/ixgbe: fix missing Port Representor data-path callbacks Remy Horton
@ 2018-05-11 10:49 ` Mohammad Abdul Awal
  0 siblings, 0 replies; 2+ messages in thread
From: Mohammad Abdul Awal @ 2018-05-11 10:49 UTC (permalink / raw)
  To: Remy Horton, dev; +Cc: Konstantin Ananyev, Wenzhuo Lu, Ferruh Yigit



On 09/05/2018 16:00, Remy Horton wrote:
> This patch adds Rx and Tx burst functions to the ixgbe
> Port Representors, so that the implementation within
> ixgbe PMD can be tested using applications such as
> testpmd which require data-path functionality.
>
> Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")
>
> Signed-off-by: Remy Horton <remy.horton@intel.com>
> ---
>   drivers/net/ixgbe/ixgbe_vf_representor.c | 27 ++++++++++++++++++++++++---
>   1 file changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c
> index 8f8af49..21c44d1 100644
> --- a/drivers/net/ixgbe/ixgbe_vf_representor.c
> +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c
> @@ -153,6 +153,25 @@ struct eth_dev_ops ixgbe_vf_representor_dev_ops = {
>   	.mac_addr_set		= ixgbe_vf_representor_mac_addr_set,
>   };
>   
> +static uint16_t
> +ixgbe_vf_representor_rx_burst(__rte_unused void *rx_queue,
> +	__rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts)
> +{
> +	return 0;
> +}
> +
> +static uint16_t
> +ixgbe_vf_representor_tx_burst(__rte_unused void *tx_queue,
> +	struct rte_mbuf **tx_pkts,
> +	uint16_t nb_pkts)
> +{
> +	uint16_t idx_pkt;
> +
> +	for (idx_pkt = 0; idx_pkt < nb_pkts; idx_pkt++)
> +		rte_pktmbuf_free(tx_pkts[idx_pkt]);
We should not free them in the driver silently whereas the application 
will think that it has been sent successfully.
Please use the same rule for rx_burst, and return 0.
> +	return nb_pkts;
> +}
> +
>   int
>   ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)
>   {
> @@ -182,9 +201,11 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)
>   	/* Set representor device ops */
>   	ethdev->dev_ops = &ixgbe_vf_representor_dev_ops;
>   
> -	/* No data-path so no RX/TX functions */
> -	ethdev->rx_pkt_burst = NULL;
> -	ethdev->tx_pkt_burst = NULL;
> +	/* No data-path, but need stub Rx/Tx functions to avoid crash
> +	 * when testing with the likes of testpmd.
> +	 */
> +	ethdev->rx_pkt_burst = ixgbe_vf_representor_rx_burst;
> +	ethdev->tx_pkt_burst = ixgbe_vf_representor_tx_burst;
>   
>   	/* Setting the number queues allocated to the VF */
>   	ethdev->data->nb_rx_queues = IXGBE_VF_MAX_RX_QUEUES;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-11 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 15:00 [dpdk-dev] [DPDK] net/ixgbe: fix missing Port Representor data-path callbacks Remy Horton
2018-05-11 10:49 ` Mohammad Abdul Awal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).