aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalasubramanian Manoharan <bala.manoharan@linaro.org>2016-06-28 17:35:54 +0530
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-08-01 14:57:30 +0300
commita560c609e78716421e782aa388805937d177ef0e (patch)
treed721714b8d08a2c5a43556815aa85f0ffc2965fa
parent524987a32f9873e59ce265ffba6e831e756a2441 (diff)
downloadodp-dpdk-a560c609e78716421e782aa388805937d177ef0e.tar.gz
api: traffic_mngr: Add pktio interface to odp_tm_egress_t struct
Replaces pktio interface as input to TM system instead of odp_pktout_queue_t.This creates an 1 to 1 mapping between a TM system and pktio interface. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--include/odp/api/spec/traffic_mngr.h8
-rw-r--r--platform/linux-generic/include/odp_traffic_mngr_internal.h2
-rw-r--r--platform/linux-generic/odp_traffic_mngr.c8
-rw-r--r--test/validation/traffic_mngr/traffic_mngr.c8
4 files changed, 19 insertions, 7 deletions
diff --git a/include/odp/api/spec/traffic_mngr.h b/include/odp/api/spec/traffic_mngr.h
index 83b89e71..c9e6f8fa 100644
--- a/include/odp/api/spec/traffic_mngr.h
+++ b/include/odp/api/spec/traffic_mngr.h
@@ -270,6 +270,12 @@ typedef struct {
* have their fan_in only from tm_queues. */
uint8_t max_levels;
+ /** egress_fcn_supported indicates whether the tm system supports
+ * egress function. It is an optional feature used to receive the
+ * packet from the tm system and its performance might be limited.
+ */
+ odp_bool_t egress_fcn_supported;
+
/** tm_queue_shaper_supported indicates that the tm_queues support
* proper TM shaping. Note that TM Shaping is NOT the same thing as
* Ingress Metering/Policing as specified by RFC 2697 (A Single Rate
@@ -467,7 +473,7 @@ typedef struct {
odp_tm_egress_kind_t egress_kind; /**< Union discriminator */
union {
- odp_pktout_queue_t pktout;
+ odp_pktio_t pktio;
odp_tm_egress_fcn_t egress_fcn;
};
} odp_tm_egress_t;
diff --git a/platform/linux-generic/include/odp_traffic_mngr_internal.h b/platform/linux-generic/include/odp_traffic_mngr_internal.h
index 15451ac8..e4bc5cec 100644
--- a/platform/linux-generic/include/odp_traffic_mngr_internal.h
+++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h
@@ -380,7 +380,7 @@ typedef struct {
tm_queue_info_t priority_info[ODP_TM_MAX_PRIORITIES];
tm_random_data_t tm_random_data;
-
+ odp_pktout_queue_t pktout;
uint64_t current_time;
uint8_t tm_idx;
uint8_t first_enq;
diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c
index 7a8b6479..e668bf95 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -2108,7 +2108,7 @@ static void tm_send_pkt(tm_system_t *tm_system, uint32_t max_sends)
tm_system->egress_pkt_desc = EMPTY_PKT_DESC;
if (tm_system->egress.egress_kind == ODP_TM_EGRESS_PKT_IO)
- odp_pktout_send(tm_system->egress.pktout, &odp_pkt, 1);
+ odp_pktout_send(tm_system->pktout, &odp_pkt, 1);
else if (tm_system->egress.egress_kind == ODP_TM_EGRESS_FN)
tm_system->egress.egress_fcn(odp_pkt);
else
@@ -2426,6 +2426,7 @@ int odp_tm_capabilities(odp_tm_capabilities_t capabilities[] ODP_UNUSED,
cap_ptr->max_tm_queues = ODP_TM_MAX_TM_QUEUES;
cap_ptr->max_levels = ODP_TM_MAX_LEVELS;
cap_ptr->tm_queue_shaper_supported = true;
+ cap_ptr->egress_fcn_supported = true;
cap_ptr->tm_queue_wred_supported = true;
cap_ptr->tm_queue_dual_slope_supported = true;
cap_ptr->vlan_marking_supported = true;
@@ -2607,6 +2608,7 @@ odp_tm_t odp_tm_create(const char *name,
tm_system_t *tm_system;
odp_bool_t create_fail;
odp_tm_t odp_tm;
+ odp_pktout_queue_t pktout;
uint32_t malloc_len, max_num_queues, max_queued_pkts, max_timers;
uint32_t max_tm_queues, max_sorted_lists;
int rc;
@@ -2627,6 +2629,10 @@ odp_tm_t odp_tm_create(const char *name,
return ODP_TM_INVALID;
}
+ if (odp_pktout_queue(egress->pktio, &pktout, 1) != 1)
+ return ODP_TM_INVALID;
+
+ tm_system->pktout = pktout;
tm_system->name_tbl_id = name_tbl_id;
max_tm_queues = requirements->max_tm_queues;
memcpy(&tm_system->egress, egress, sizeof(odp_tm_egress_t));
diff --git a/test/validation/traffic_mngr/traffic_mngr.c b/test/validation/traffic_mngr/traffic_mngr.c
index 1c4e90bf..b8578003 100644
--- a/test/validation/traffic_mngr/traffic_mngr.c
+++ b/test/validation/traffic_mngr/traffic_mngr.c
@@ -323,7 +323,7 @@ static odp_pktio_t pktios[MAX_NUM_IFACES];
static odp_pktin_queue_t pktins[MAX_NUM_IFACES];
static odp_pktout_queue_t pktouts[MAX_NUM_IFACES];
static odp_pktin_queue_t rcv_pktin;
-static odp_pktout_queue_t xmt_pktout;
+static odp_pktio_t xmt_pktio;
static odph_ethaddr_t src_mac;
static odph_ethaddr_t dst_mac;
@@ -543,7 +543,7 @@ static int open_pktios(void)
}
if (2 <= num_ifaces) {
- xmt_pktout = pktouts[0];
+ xmt_pktio = pktios[0];
rcv_pktin = pktins[1];
ret = odp_pktio_start(pktios[1]);
if (ret != 0) {
@@ -551,7 +551,7 @@ static int open_pktios(void)
return -1;
}
} else {
- xmt_pktout = pktouts[0];
+ xmt_pktio = pktios[0];
rcv_pktin = pktins[0];
}
@@ -1627,7 +1627,7 @@ static int create_tm_system(void)
}
egress.egress_kind = ODP_TM_EGRESS_PKT_IO;
- egress.pktout = xmt_pktout;
+ egress.pktio = xmt_pktio;
snprintf(tm_name, sizeof(tm_name), "TM_system_%u", num_odp_tm_systems);
odp_tm = odp_tm_create(tm_name, &requirements, &egress);