net/octeon_ep: support device close and port kind
cover net/octeon_ep: support device close and port kind
This patch set adds device close functionality
and 2nd patch adds port kind functionality.
Sathesh Edara (2):
net/octeon_ep: support device close
net/octeon_ep: support port kind
drivers/net/octeon_ep/otx_ep_common.h | 1 + drivers/net/octeon_ep/otx_ep_ethdev.c | 65 +++++++++++++-------------- drivers/net/octeon_ep/otx_ep_rxtx.c | 16 +++---- 3 files changed, 39 insertions(+), 43 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/2 net/octeon_ep: support device close
Added dev close functionality in the ethdev ops
and moves input and output queue deletion
functionality into it from otx_epdev_exit()
routine.
Signed-off-by Sathesh Edara <[email protected]>
--- drivers/net/octeon_ep/otx_ep_ethdev.c | 63 ++++++++++++--------------- 1 file changed, 29 insertions(+), 34 deletions(-)
drivers/net/octeon_ep/otx_ep_ethdev.c +29 -34
@@ -395,6 +395,34 @@ otx_ep_dev_stats_get(struct rte_eth_dev *eth_dev,return 0 ; } +static int +otx_ep_dev_close (struct rte_eth_dev *eth_dev) +{ +struct otx_ep_device *otx_epvf =OTX_EP_DEV (eth_dev); +uint32_t num_queues, q_no; + + otx_epvf->fn_list.disable_io_queues (otx_epvf); + num_queues = otx_epvf->nb_rx_queues; +for (q_no =0 ; q_no < num_queues; q_no++) { +if (otx_ep_delete_oqs (otx_epvf, q_no)) { +otx_ep_err ("Failed to delete OQ:%d\n" , q_no); +return -EINVAL ; + } + } +otx_ep_dbg ("Num OQs:%d freed\n" , otx_epvf->nb_rx_queues); + + num_queues = otx_epvf->nb_tx_queues; +for (q_no =0 ; q_no < num_queues; q_no++) { +if (otx_ep_delete_iqs (otx_epvf, q_no)) { +otx_ep_err ("Failed to delete IQ:%d\n" , q_no); +return -EINVAL ; + } + } +otx_ep_dbg ("Num IQs:%d freed\n" , otx_epvf->nb_tx_queues); + +return 0 ; +} +static int otx_ep_dev_link_update (struct rte_eth_dev *eth_dev,int wait_to_complete) {
@@ -424,47 +452,14 @@ static const struct eth_dev_ops otx_ep_eth_dev_ops = { .stats_get = otx_ep_dev_stats_get, .stats_reset = otx_ep_dev_stats_reset, .link_update = otx_ep_dev_link_update, + .dev_close = otx_ep_dev_close, }; -static int -otx_epdev_exit (struct rte_eth_dev *eth_dev) -{ -struct otx_ep_device *otx_epvf; -uint32_t num_queues, q; - -otx_ep_info ("%s:\n" , __func__); - - otx_epvf =OTX_EP_DEV (eth_dev); - - otx_epvf->fn_list.disable_io_queues (otx_epvf); - - num_queues = otx_epvf->nb_rx_queues; -for (q =0 ; q < num_queues; q++) { -if (otx_ep_delete_oqs (otx_epvf, q)) { -otx_ep_err ("Failed to delete OQ:%d\n" , q); -return -EINVAL ; - } - } -otx_ep_info ("Num OQs:%d freed\n" , otx_epvf->nb_rx_queues); - - num_queues = otx_epvf->nb_tx_queues; -for (q =0 ; q < num_queues; q++) { -if (otx_ep_delete_iqs (otx_epvf, q)) { -otx_ep_err ("Failed to delete IQ:%d\n" , q); -return -EINVAL ; - } - } -otx_ep_dbg ("Num IQs:%d freed\n" , otx_epvf->nb_tx_queues); - -return 0 ; -} -static int otx_ep_eth_dev_uninit (struct rte_eth_dev *eth_dev) {if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; -otx_epdev_exit (eth_dev); eth_dev->dev_ops =NULL ; eth_dev->rx_pkt_burst =NULL ;
Signature · 1 line
2.31.1
PATCH 2/2 net/octeon_ep: support port kind
In reply to Sathesh EdaraAdded port kind functionality.
Signed-off-by Sathesh Edara <[email protected]>
--- drivers/net/octeon_ep/otx_ep_common.h | 1 + drivers/net/octeon_ep/otx_ep_ethdev.c | 2 +- drivers/net/octeon_ep/otx_ep_rxtx.c | 16 ++++++++-------- 3 files changed, 10 insertions(+), 9 deletions(-)
drivers/net/octeon_ep/otx_ep_common.h +1 -0
@@ -32,6 +32,7 @@#define OTX_EP_PCI_RING_ALIGN 65536#define SDP_PKIND 40#define SDP_OTX2_PKIND 57 +#define SDP_OTX2_PKIND_FS0 0#define ORDERED_TAG 0#define ATOMIC_TAG 1
drivers/net/octeon_ep/otx_ep_ethdev.c +1 -1
@@ -495,7 +495,7 @@ otx_ep_eth_dev_init(struct rte_eth_dev *eth_dev)otx_epdev_init (otx_epvf);if (pdev->id.device_id ==PCI_DEVID_CN9K_EP_NET_VF ) - otx_epvf->pkind =SDP_OTX2_PKIND ; + otx_epvf->pkind =SDP_OTX2_PKIND_FS0 ;else otx_epvf->pkind =SDP_PKIND ;otx_ep_info ("using pkind %d\n" , otx_epvf->pkind);
drivers/net/octeon_ep/otx_ep_rxtx.c +8 -8
@@ -17,7 +17,8 @@#include "otx_ep_rxtx.h" /* SDP_LENGTH_S specifies packet length and is of 8-byte size */ -#define INFO_SIZE 8 +#define OTX_EP_INFO_SIZE 8 +#define OTX_EP_FSZ_FS0 0#define DROQ_REFILL_THRESHOLD 16 static void
@@ -678,7 +679,7 @@ otx2_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) iqcmd2.irh.u64 =0 ;/* ih invars */ - iqcmd2.ih.s.fsz =OTX2_EP_FSZ ; + iqcmd2.ih.s.fsz =OTX_EP_FSZ_FS0 ; iqcmd2.ih.s.pkind = otx_ep->pkind;/* The SDK decided PKIND value */ /* irh invars */ iqcmd2.irh.s.opcode =OTX_EP_NW_PKT_OP ;
@@ -875,12 +876,11 @@ otx_ep_droq_read_packet(struct otx_ep_device *otx_ep, info->length =rte_bswap64 (info->length);/* Deduce the actual data size */ - total_pkt_len = info->length +INFO_SIZE ; + total_pkt_len = info->length +OTX_EP_INFO_SIZE ;if (total_pkt_len <= droq->buffer_size) { - info->length -=OTX_EP_RH_SIZE ; droq_pkt = droq->recv_buf_list[droq->read_idx];if (likely (droq_pkt !=NULL )) { - droq_pkt->data_off +=OTX_EP_DROQ_INFO_SIZE ; + droq_pkt->data_off +=OTX_EP_INFO_SIZE ;/* otx_ep_dbg("OQ: pkt_len[%ld], buffer_size %d\n", * (long)info->length, droq->buffer_size); */
@@ -917,11 +917,11 @@ otx_ep_droq_read_packet(struct otx_ep_device *otx_ep, droq_pkt->port = otx_ep->port_id;if (!pkt_len) { droq_pkt->data_off += -OTX_EP_DROQ_INFO_SIZE ; +OTX_EP_INFO_SIZE ; droq_pkt->pkt_len = - cpy_len -OTX_EP_DROQ_INFO_SIZE ; + cpy_len -OTX_EP_INFO_SIZE ; droq_pkt->data_len = - cpy_len -OTX_EP_DROQ_INFO_SIZE ; + cpy_len -OTX_EP_INFO_SIZE ; }else { droq_pkt->pkt_len = cpy_len; droq_pkt->data_len = cpy_len;
Signature · 1 line
2.31.1
Re: [PATCH v1 2/2] net/octeon_ep: support port kind
Quoted 4 lines · Sathesh Edara
Added port kind functionality.
Signed-off-by Sathesh Edara <[email protected]>
Series applied to dpdk-next-net-mrvl/for-next-net. Thanks
Quoted 87 lines
--- drivers/net/octeon_ep/otx_ep_common.h | 1 + drivers/net/octeon_ep/otx_ep_ethdev.c | 2 +- drivers/net/octeon_ep/otx_ep_rxtx.c | 16 ++++++++-------- 3 files changed, 10 insertions(+), 9 deletions(-)drivers/net/octeon_ep/otx_ep_common.h +1
-0@@ -32,6 +32,7 @@#define OTX_EP_PCI_RING_ALIGN 65536#define SDP_PKIND 40#define SDP_OTX2_PKIND 57 +#define SDP_OTX2_PKIND_FS0 0#define ORDERED_TAG 0#define ATOMIC_TAG 1drivers/net/octeon_ep/otx_ep_ethdev.c +1
-1@@ -495,7 +495,7 @@ otx_ep_eth_dev_init(struct rte_eth_dev *eth_dev)otx_epdev_init (otx_epvf);if (pdev->id.device_id ==PCI_DEVID_CN9K_EP_NET_VF ) - otx_epvf->pkind =SDP_OTX2_PKIND ; + otx_epvf->pkind =SDP_OTX2_PKIND_FS0 ;else otx_epvf->pkind =SDP_PKIND ;otx_ep_info ("using pkind %d\n" , otx_epvf->pkind);drivers/net/octeon_ep/otx_ep_rxtx.c +8
-9@@ -17,7 +17,8 @@#include "otx_ep_rxtx.h" /* SDP_LENGTH_S specifies packet length and is of 8-byte size */ -#define INFO_SIZE 8 +#define OTX_EP_INFO_SIZE 8 +#define OTX_EP_FSZ_FS0 0#define DROQ_REFILL_THRESHOLD 16 static void@@ -678,7 +679,7 @@ otx2_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) iqcmd2.irh.u64 =0 ;/* ih invars */ - iqcmd2.ih.s.fsz =OTX2_EP_FSZ ; + iqcmd2.ih.s.fsz =OTX_EP_FSZ_FS0 ; iqcmd2.ih.s.pkind = otx_ep->pkind;/* The SDK decided PKIND value */ /* irh invars */ iqcmd2.irh.s.opcode =OTX_EP_NW_PKT_OP ;@@ -875,12 +876,11 @@ otx_ep_droq_read_packet(struct otx_ep_device *otx_ep, info->length =rte_bswap64 (info->length);/* Deduce the actual data size */ - total_pkt_len = info->length +INFO_SIZE ; + total_pkt_len = info->length +OTX_EP_INFO_SIZE ;if (total_pkt_len <= droq->buffer_size) { - info->length -=OTX_EP_RH_SIZE ; droq_pkt = droq->recv_buf_list[droq->read_idx];if (likely (droq_pkt !=NULL )) { - droq_pkt->data_off +=OTX_EP_DROQ_INFO_SIZE ; + droq_pkt->data_off +=OTX_EP_INFO_SIZE ;/* otx_ep_dbg("OQ: pkt_len[%ld], buffer_size %d\n", * (long)info->length, droq->buffer_size); */ @@ -917,11 +917,11 @@ otx_ep_droq_read_packet(struct otx_ep_device *otx_ep, droq_pkt->port = otx_ep->port_id;if (!pkt_len) { droq_pkt->data_off += -OTX_EP_DROQ_INFO_SIZE ; +OTX_EP_INFO_SIZE ; droq_pkt->pkt_len = - cpy_len -OTX_EP_DROQ_INFO_SIZE ; + cpy_len -OTX_EP_INFO_SIZE ; droq_pkt->data_len = - cpy_len -OTX_EP_DROQ_INFO_SIZE ; + cpy_len -OTX_EP_INFO_SIZE ; }else { droq_pkt->pkt_len = cpy_len; droq_pkt->data_len = cpy_len; --2.31.1