Skip to content

Commit 8eac5da

Browse files
committed
octeon: fix buffer free in port stop
This patch fixes buffer free in port stop and updates input node to poll on started rx-queue. Type: fix JIRA: https://essjira.marvell.com/browse/IPBUSW-62952 Signed-off-by: Monendra Singh Kushwaha <[email protected]> Change-Id: Id6c78eaa0eea597c554074543f27a204cb9629aa Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/toolkits/vpp/+/147723 Reviewed-by: Nithin Kumar Dabilpuram <[email protected]> Tested-by: Nithin Kumar Dabilpuram <[email protected]> Klocwork: Nithin Kumar Dabilpuram <[email protected]> (cherry picked from commit 6d4d94470d0a7c5622d51611a01d7b0fb90de1aa) Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/toolkits/vpp/+/148020 Tested-by: sa_ip-sw-jenkins <[email protected]>
1 parent fe63a69 commit 8eac5da

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/plugins/dev_octeon/common.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#include <base/roc_api.h>
1313

1414
static_always_inline u32
15-
oct_aura_free_all_buffers (vlib_main_t *vm, u64 aura_handle, u16 hdr_off)
15+
oct_aura_free_all_buffers (vlib_main_t *vm, u64 aura_handle, u16 hdr_off,
16+
u32 num_buffers)
1617
{
1718
u32 n = 0;
1819
u64 iova;
@@ -22,6 +23,8 @@ oct_aura_free_all_buffers (vlib_main_t *vm, u64 aura_handle, u16 hdr_off)
2223
vlib_buffer_t *b = (void *) iova + hdr_off;
2324
vlib_buffer_free_one (vm, vlib_get_buffer_index (vm, b));
2425
n++;
26+
if (num_buffers && n == num_buffers)
27+
break;
2528
}
2629
return n;
2730
}

src/plugins/dev_octeon/port.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ oct_rxq_stop (vlib_main_t *vm, vnet_dev_rx_queue_t *rxq)
475475
if ((rrv = roc_nix_rq_ena_dis (&crq->rq, 0)))
476476
oct_roc_err (dev, rrv, "roc_nix_rq_ena_dis() failed");
477477

478-
n = oct_aura_free_all_buffers (vm, crq->aura_handle, crq->hdr_off);
478+
n =
479+
oct_aura_free_all_buffers (vm, crq->aura_handle, crq->hdr_off, crq->n_enq);
479480

480481
if (crq->n_enq - n > 0)
481482
log_err (dev, "%u buffers leaked on rx queue %u stop", crq->n_enq - n,
@@ -494,10 +495,7 @@ oct_txq_stop (vlib_main_t *vm, vnet_dev_tx_queue_t *txq)
494495
oct_npa_batch_alloc_cl128_t *cl;
495496
u32 n, off = ctq->hdr_off;
496497

497-
n = oct_aura_free_all_buffers (vm, ctq->aura_handle, off);
498-
ctq->n_enq -= n;
499-
500-
if (ctq->n_enq > 0 && ctq->ba_num_cl > 0)
498+
if (ctq->ba_num_cl > 0)
501499
for (n = ctq->ba_num_cl, cl = ctq->ba_buffer + ctq->ba_first_cl; n;
502500
cl++, n--)
503501
{
@@ -513,6 +511,9 @@ oct_txq_stop (vlib_main_t *vm, vnet_dev_tx_queue_t *txq)
513511
}
514512
}
515513

514+
n = oct_aura_free_all_buffers (vm, ctq->aura_handle, off, 0);
515+
ctq->n_enq -= n;
516+
516517
if (ctq->n_enq > 0)
517518
log_err (dev, "%u buffers leaked on tx queue %u stop", ctq->n_enq,
518519
txq->queue_id);
@@ -530,7 +531,6 @@ oct_port_start (vlib_main_t *vm, vnet_dev_port_t *port)
530531
oct_device_t *cd = vnet_dev_get_data (dev);
531532
oct_port_t *cp = vnet_dev_get_port_data (port);
532533
struct roc_nix *nix = cd->nix;
533-
struct roc_nix_eeprom_info eeprom_info = {};
534534
vnet_dev_rv_t rv;
535535
int rrv;
536536

@@ -569,11 +569,6 @@ oct_port_start (vlib_main_t *vm, vnet_dev_port_t *port)
569569

570570
vnet_dev_poll_port_add (vm, port, 0.5, oct_port_poll);
571571

572-
if (roc_nix_eeprom_info_get (nix, &eeprom_info) == 0)
573-
{
574-
log_debug (dev, "sff_id %u data %U", eeprom_info.sff_id, format_hexdump,
575-
eeprom_info.buf, sizeof (eeprom_info.buf));
576-
}
577572
done:
578573
if (rv != VNET_DEV_OK)
579574
oct_port_stop (vm, port);

src/plugins/dev_octeon/rx_node.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,10 @@ VNET_DEV_NODE_FN (oct_rx_node)
18831883
foreach_vnet_dev_rx_queue_runtime (rxq, node)
18841884
{
18851885
vnet_dev_port_t *port = rxq->port;
1886+
1887+
if (!rxq->started)
1888+
continue;
1889+
18861890
n_rx += oct_rx_node_inline (vm, node, frame, port, rxq, 0);
18871891
}
18881892

0 commit comments

Comments
 (0)