From: Intel Date: Mon, 22 Jul 2013 22:00:00 +0000 (+0200) Subject: sched: add mtu parameter X-Git-Tag: spdx-start~11180 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a91c3cadb8c33804d4b5f194a47837f699fd9af0;p=dpdk.git sched: add mtu parameter Signed-off-by: Intel --- diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index 1654c73504..2647033713 100755 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -206,6 +206,7 @@ struct rte_sched_port_params port_params = { .name = "port_0", .socket = 0, /* computed */ .rate = 0, /* computed */ + .mtu = 6 + 6 + 4 + 4 + 2 + 1500, .frame_overhead = RTE_SCHED_FRAME_OVERHEAD_DEFAULT, .n_subports_per_port = 1, .n_pipes_per_subport = 4096, diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index a75b4b9c81..44b6f11ca0 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -231,6 +231,7 @@ struct rte_sched_port { uint32_t n_subports_per_port; uint32_t n_pipes_per_subport; uint32_t rate; + uint32_t mtu; uint32_t frame_overhead; uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; uint32_t n_pipe_profiles; @@ -324,14 +325,19 @@ rte_sched_port_check_params(struct rte_sched_port_params *params) return -4; } + /* mtu */ + if (params->mtu == 0) { + return -5; + } + /* n_subports_per_port: non-zero, power of 2 */ if ((params->n_subports_per_port == 0) || (!rte_is_power_of_2(params->n_subports_per_port))) { - return -5; + return -6; } /* n_pipes_per_subport: non-zero, power of 2 */ if ((params->n_pipes_per_subport == 0) || (!rte_is_power_of_2(params->n_pipes_per_subport))) { - return -6; + return -7; } /* qsize: non-zero, power of 2, no bigger than 32K (due to 16-bit read/write pointers) */ @@ -339,7 +345,7 @@ rte_sched_port_check_params(struct rte_sched_port_params *params) uint16_t qsize = params->qsize[i]; if ((qsize == 0) || (!rte_is_power_of_2(qsize))) { - return -7; + return -8; } } @@ -347,7 +353,7 @@ rte_sched_port_check_params(struct rte_sched_port_params *params) if ((params->pipe_profiles == NULL) || (params->n_pipe_profiles == 0) || (params->n_pipe_profiles > RTE_SCHED_PIPE_PROFILES_PER_PORT)) { - return -8; + return -9; } for (i = 0; i < params->n_pipe_profiles; i ++) { @@ -355,24 +361,24 @@ rte_sched_port_check_params(struct rte_sched_port_params *params) /* TB rate: non-zero, not greater than port rate */ if ((p->tb_rate == 0) || (p->tb_rate > params->rate)) { - return -9; + return -10; } /* TB size: non-zero */ if (p->tb_size == 0) { - return -10; + return -11; } /* TC rate: non-zero, less than pipe rate */ for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j ++) { if ((p->tc_rate[j] == 0) || (p->tc_rate[j] > p->tb_rate)) { - return -11; + return -12; } } /* TC period: non-zero */ if (p->tc_period == 0) { - return -12; + return -13; } #ifdef RTE_SCHED_SUBPORT_TC_OV @@ -387,7 +393,7 @@ rte_sched_port_check_params(struct rte_sched_port_params *params) /* Queue WRR weights: non-zero */ for (j = 0; j < RTE_SCHED_QUEUES_PER_PIPE; j ++) { if (p->wrr_weights[j] == 0) { - return -14; + return -15; } } } @@ -635,6 +641,7 @@ rte_sched_port_config(struct rte_sched_port_params *params) port->n_subports_per_port = params->n_subports_per_port; port->n_pipes_per_subport = params->n_pipes_per_subport; port->rate = params->rate; + port->mtu = params->mtu + params->frame_overhead; port->frame_overhead = params->frame_overhead; memcpy(port->qsize, params->qsize, sizeof(params->qsize)); port->n_pipe_profiles = params->n_pipe_profiles; diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h index 7b49248b59..3b25b749f4 100644 --- a/lib/librte_sched/rte_sched.h +++ b/lib/librte_sched/rte_sched.h @@ -184,6 +184,7 @@ struct rte_sched_port_params { const char *name; /**< Literal string to be associated to the current port scheduler instance */ int socket; /**< CPU socket ID where the memory for port scheduler should be allocated */ uint32_t rate; /**< Output port rate (measured in bytes per second) */ + uint32_t mtu; /**< Maximum Ethernet frame size (measured in bytes). Should not include the framing overhead. */ uint32_t frame_overhead; /**< Framing overhead per packet (measured in bytes) */ uint32_t n_subports_per_port; /**< Number of subports for the current port scheduler instance*/ uint32_t n_pipes_per_subport; /**< Number of pipes for each port scheduler subport */