Change the prefix flm_ to prefix nthw_flm_ to specify that these functions and part of the ntwh (Napatech Hardware).
Signed-off-by: Serhii Iliushyk <[email protected]> --- .../flow_api/profile_inline/flm_age_queue.c | 22 ++++---- .../flow_api/profile_inline/flm_age_queue.h | 20 +++---- .../flow_api/profile_inline/flm_lrn_queue.c | 12 ++-- .../flow_api/profile_inline/flm_lrn_queue.h | 12 ++-- .../profile_inline/flow_api_profile_inline.c | 55 ++++++++++--------- drivers/net/ntnic/ntnic_ethdev.c | 6 +- 6 files changed, 64 insertions(+), 63 deletions(-) diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c index c7522516d1..87c1a5a29e 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c @@ -13,22 +13,22 @@ static struct rte_ring *age_queue[MAX_EVT_AGE_QUEUES]; static RTE_ATOMIC(uint16_t) age_event[MAX_EVT_AGE_PORTS]; -__rte_always_inline int flm_age_event_get(uint8_t port) +__rte_always_inline int nthw_flm_age_event_get(uint8_t port) { return rte_atomic_load_explicit(&age_event[port], rte_memory_order_seq_cst); } -__rte_always_inline void flm_age_event_set(uint8_t port) +__rte_always_inline void nthw_flm_age_event_set(uint8_t port) { rte_atomic_store_explicit(&age_event[port], 1, rte_memory_order_seq_cst); } -__rte_always_inline void flm_age_event_clear(uint8_t port) +__rte_always_inline void nthw_flm_age_event_clear(uint8_t port) { rte_atomic_store_explicit(&age_event[port], 0, rte_memory_order_seq_cst); } -void flm_age_queue_free(uint8_t port, uint16_t caller_id) +void nthw_flm_age_queue_free(uint8_t port, uint16_t caller_id) { struct rte_ring *q = NULL; @@ -43,17 +43,17 @@ void flm_age_queue_free(uint8_t port, uint16_t caller_id) rte_ring_free(q); } -void flm_age_queue_free_all(void) +void nthw_flm_age_queue_free_all(void) { int i; int j; for (i = 0; i < MAX_EVT_AGE_PORTS; i++) for (j = 0; j < MAX_EVT_AGE_QUEUES; j++) - flm_age_queue_free(i, j); + nthw_flm_age_queue_free(i, j); } -struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count) +struct rte_ring *nthw_flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count) { char name[20]; struct rte_ring *q = NULL; @@ -112,7 +112,7 @@ struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned return q; } -void flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj) +void nthw_flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj) { int ret; @@ -125,7 +125,7 @@ void flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj) } } -int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj) +int nthw_flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj) { int ret; @@ -142,7 +142,7 @@ int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj) return -ENOENT; } -unsigned int flm_age_queue_count(uint16_t caller_id) +unsigned int nthw_flm_age_queue_count(uint16_t caller_id) { unsigned int ret = 0; @@ -152,7 +152,7 @@ unsigned int flm_age_queue_count(uint16_t caller_id) return ret; } -unsigned int flm_age_queue_get_size(uint16_t caller_id) +unsigned int nthw_flm_age_queue_get_size(uint16_t caller_id) { unsigned int ret = 0; diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h index 55c410ac86..babf73fd7f 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h @@ -28,15 +28,15 @@ struct flm_age_event_s { #define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s) -int flm_age_event_get(uint8_t port); -void flm_age_event_set(uint8_t port); -void flm_age_event_clear(uint8_t port); -void flm_age_queue_free(uint8_t port, uint16_t caller_id); -void flm_age_queue_free_all(void); -struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count); -void flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj); -int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj); -unsigned int flm_age_queue_count(uint16_t caller_id); -unsigned int flm_age_queue_get_size(uint16_t caller_id); +int nthw_flm_age_event_get(uint8_t port); +void nthw_flm_age_event_set(uint8_t port); +void nthw_flm_age_event_clear(uint8_t port); +void nthw_flm_age_queue_free(uint8_t port, uint16_t caller_id); +void nthw_flm_age_queue_free_all(void); +struct rte_ring *nthw_flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count); +void nthw_flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj); +int nthw_flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj); +unsigned int nthw_flm_age_queue_count(uint16_t caller_id); +unsigned int nthw_flm_age_queue_get_size(uint16_t caller_id); #endif /* _FLM_AGE_QUEUE_H_ */ diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c index f6cc09de9b..4f974a6e5b 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c @@ -16,7 +16,7 @@ #define ELEM_SIZE sizeof(struct flm_v25_lrn_data_s) -void *flm_lrn_queue_create(void) +void *nthw_flm_lrn_queue_create(void) { static_assert((ELEM_SIZE & ~(size_t)3) == ELEM_SIZE, "FLM LEARN struct size"); struct rte_ring *q = rte_ring_create_elem("RFQ", @@ -28,24 +28,24 @@ void *flm_lrn_queue_create(void) return q; } -void flm_lrn_queue_free(void *q) +void nthw_flm_lrn_queue_free(void *q) { rte_ring_free(q); } -uint32_t *flm_lrn_queue_get_write_buffer(void *q) +uint32_t *nthw_flm_lrn_queue_get_write_buffer(void *q) { struct rte_ring_zc_data zcd; unsigned int n = rte_ring_enqueue_zc_burst_elem_start(q, ELEM_SIZE, 1, &zcd, NULL); return (n == 0) ? NULL : zcd.ptr1; } -void flm_lrn_queue_release_write_buffer(void *q) +void nthw_flm_lrn_queue_release_write_buffer(void *q) { rte_ring_enqueue_zc_elem_finish(q, 1); } -read_record flm_lrn_queue_get_read_buffer(void *q) +read_record nthw_flm_lrn_queue_get_read_buffer(void *q) { struct rte_ring_zc_data zcd; read_record rr; @@ -62,7 +62,7 @@ read_record flm_lrn_queue_get_read_buffer(void *q) return rr; } -void flm_lrn_queue_release_read_buffer(void *q, uint32_t num) +void nthw_flm_lrn_queue_release_read_buffer(void *q, uint32_t num) { rte_ring_dequeue_zc_elem_finish(q, num); } diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h index 40558f4201..ee1e2a63eb 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h @@ -13,13 +13,13 @@ typedef struct read_record { uint32_t num; } read_record; -void *flm_lrn_queue_create(void); -void flm_lrn_queue_free(void *q); +void *nthw_flm_lrn_queue_create(void); +void nthw_flm_lrn_queue_free(void *q); -uint32_t *flm_lrn_queue_get_write_buffer(void *q); -void flm_lrn_queue_release_write_buffer(void *q); +uint32_t *nthw_flm_lrn_queue_get_write_buffer(void *q); +void nthw_flm_lrn_queue_release_write_buffer(void *q); -read_record flm_lrn_queue_get_read_buffer(void *q); -void flm_lrn_queue_release_read_buffer(void *q, uint32_t num); +read_record nthw_flm_lrn_queue_get_read_buffer(void *q); +void nthw_flm_lrn_queue_release_read_buffer(void *q, uint32_t num); #endif /* _FLM_LRN_QUEUE_H_ */ diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c index 32aae24499..1a78933b7f 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c @@ -194,13 +194,13 @@ static int flow_mtr_create_meter(struct flow_eth_dev *dev, learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); while (learn_record == NULL) { nt_os_wait_usec(1); learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); } struct flm_flow_mtr_handle_s *handle = dev->ndev->flm_mtr_handle; @@ -232,7 +232,7 @@ static int flow_mtr_create_meter(struct flow_eth_dev *dev, if (stats_mask) learn_record->vol_idx = 1; - flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); struct flm_mtr_stat_s *mtr_stat = handle->port_stats[caller_id]->stats; mtr_stat[mtr_id].buckets = buckets; @@ -252,13 +252,13 @@ static int flow_mtr_probe_meter(struct flow_eth_dev *dev, uint8_t caller_id, uin learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); while (learn_record == NULL) { nt_os_wait_usec(1); learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); } struct flm_flow_mtr_handle_s *handle = dev->ndev->flm_mtr_handle; @@ -277,7 +277,7 @@ static int flow_mtr_probe_meter(struct flow_eth_dev *dev, uint8_t caller_id, uin learn_record->id = flm_id; - flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); rte_spinlock_unlock(&dev->ndev->mtx); @@ -292,13 +292,13 @@ static int flow_mtr_destroy_meter(struct flow_eth_dev *dev, uint8_t caller_id, u learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); while (learn_record == NULL) { nt_os_wait_usec(1); learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); } struct flm_flow_mtr_handle_s *handle = dev->ndev->flm_mtr_handle; @@ -329,7 +329,7 @@ static int flow_mtr_destroy_meter(struct flow_eth_dev *dev, uint8_t caller_id, u ntnic_id_table_free_id(dev->ndev->id_table_handle, flm_id); - flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); rte_spinlock_unlock(&dev->ndev->mtx); @@ -345,13 +345,13 @@ static int flm_mtr_adjust_stats(struct flow_eth_dev *dev, uint8_t caller_id, uin learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); while (learn_record == NULL) { nt_os_wait_usec(1); learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); } struct flm_flow_mtr_handle_s *handle = dev->ndev->flm_mtr_handle; @@ -376,7 +376,7 @@ static int flm_mtr_adjust_stats(struct flow_eth_dev *dev, uint8_t caller_id, uin if (atomic_load(&mtr_stat->stats_mask)) learn_record->vol_idx = 1; - flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); rte_spinlock_unlock(&dev->ndev->mtx); @@ -385,19 +385,19 @@ static int flm_mtr_adjust_stats(struct flow_eth_dev *dev, uint8_t caller_id, uin static void flm_setup_queues(void) { - flm_lrn_queue_arr = flm_lrn_queue_create(); + flm_lrn_queue_arr = nthw_flm_lrn_queue_create(); RTE_ASSERT(flm_lrn_queue_arr != NULL); } static void flm_free_queues(void) { - flm_lrn_queue_free(flm_lrn_queue_arr); + nthw_flm_lrn_queue_free(flm_lrn_queue_arr); } static uint32_t flm_lrn_update(struct flow_eth_dev *dev, uint32_t *inf_word_cnt, uint32_t *sta_word_cnt) { - read_record r = flm_lrn_queue_get_read_buffer(flm_lrn_queue_arr); + read_record r = nthw_flm_lrn_queue_get_read_buffer(flm_lrn_queue_arr); uint32_t handled_records = 0; if (r.num) { @@ -405,7 +405,7 @@ static uint32_t flm_lrn_update(struct flow_eth_dev *dev, uint32_t *inf_word_cnt, r.num, &handled_records, inf_word_cnt, sta_word_cnt)) NT_LOG(ERR, FILTER, "Flow programming failed"); } - flm_lrn_queue_release_read_buffer(flm_lrn_queue_arr, handled_records); + nthw_flm_lrn_queue_release_read_buffer(flm_lrn_queue_arr, handled_records); return r.num; } @@ -481,10 +481,10 @@ static void flm_mtr_read_inf_records(struct flow_eth_dev *dev, uint32_t *data, u is_remote = is_remote_caller(caller_id, &port); - flm_age_queue_put(caller_id, &age_event); + nthw_flm_age_queue_put(caller_id, &age_event); /* age events are supported only for physical ports */ if (!is_remote) - flm_age_event_set(port); + nthw_flm_age_event_set(port); } break; @@ -973,13 +973,13 @@ static int flm_flow_programming(struct flow_handle *fh, uint32_t flm_op) learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); while (learn_record == NULL) { nt_os_wait_usec(1); learn_record = (struct flm_v25_lrn_data_s *) - flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_get_write_buffer(flm_lrn_queue_arr); } memset(learn_record, 0x0, sizeof(struct flm_v25_lrn_data_s)); @@ -1034,7 +1034,7 @@ static int flm_flow_programming(struct flow_handle *fh, uint32_t flm_op) learn_record->eor = 1; learn_record->scrub_prof = fh->flm_scrub_prof; - flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); + nthw_flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); return 0; } @@ -4575,7 +4575,7 @@ int nthw_flow_get_aged_flows_profile_inline(struct flow_eth_dev *dev, (void)dev; nthw_flow_nic_set_error(ERR_SUCCESS, error); - unsigned int queue_size = flm_age_queue_get_size(caller_id); + unsigned int queue_size = nthw_flm_age_queue_get_size(caller_id); if (queue_size == 0) { error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED; @@ -4583,7 +4583,7 @@ int nthw_flow_get_aged_flows_profile_inline(struct flow_eth_dev *dev, return -1; } - unsigned int queue_count = flm_age_queue_count(caller_id); + unsigned int queue_count = nthw_flm_age_queue_count(caller_id); if (context == NULL) return queue_count; @@ -4604,7 +4604,7 @@ int nthw_flow_get_aged_flows_profile_inline(struct flow_eth_dev *dev, for (idx = 0; idx < nb_contexts; ++idx) { struct flm_age_event_s obj; - int ret = flm_age_queue_get(caller_id, &obj); + int ret = nthw_flm_age_queue_get(caller_id, &obj); if (ret != 0) break; @@ -4843,12 +4843,13 @@ int nthw_flow_configure_profile_inline(struct flow_eth_dev *dev, uint8_t caller_ if (port_attr->nb_aging_objects > 0) { if (dev->nb_aging_objects > 0) { - flm_age_queue_free(dev->port_id, caller_id); + nthw_flm_age_queue_free(dev->port_id, caller_id); dev->nb_aging_objects = 0; } struct rte_ring *age_queue = - flm_age_queue_create(dev->port_id, caller_id, port_attr->nb_aging_objects); + nthw_flm_age_queue_create(dev->port_id, caller_id, + port_attr->nb_aging_objects); if (age_queue == NULL) { error->message = "Failed to allocate aging objects"; @@ -4898,7 +4899,7 @@ int nthw_flow_configure_profile_inline(struct flow_eth_dev *dev, uint8_t caller_ error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED; if (port_attr->nb_aging_objects > 0) { - flm_age_queue_free(dev->port_id, caller_id); + nthw_flm_age_queue_free(dev->port_id, caller_id); dev->nb_aging_objects = 0; } diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 6318a32e4b..c580684a84 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -1547,7 +1547,7 @@ drv_deinit(struct drv_s *p_drv) /* Free all remote flm event queues */ nthw_flm_inf_sta_queue_free_all(FLM_INFO_REMOTE); /* Free all aged flow event queues */ - flm_age_queue_free_all(); + nthw_flm_age_queue_free_all(); } /* stop adapter */ @@ -1981,7 +1981,7 @@ static int port_event_service(void *context) /* Note: RTE_FLOW_PORT_FLAG_STRICT_QUEUE flag is not supported so * event is always generated */ - int aged_event_count = flm_age_event_get(port_no); + int aged_event_count = nthw_flm_age_event_get(port_no); if (aged_event_count > 0 && eth_dev[port_no] && @@ -1990,7 +1990,7 @@ static int port_event_service(void *context) rte_eth_dev_callback_process(eth_dev[port_no], RTE_ETH_EVENT_FLOW_AGED, NULL); - flm_age_event_clear(port_no); + nthw_flm_age_event_clear(port_no); do_wait = false; } -- 2.45.0

