X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_sched%2Frte_sched.c;h=9c9419d6808f3ace0ebc7f6e332babaa0cb5c2af;hb=55a3fb5f7c41ec1a1cfb094d7ec3914ea3502f7b;hp=91e16f8057e42af21f6798cc6d727b744163feb8;hpb=24208c31d0e543ab575d7075b0cc481231f9eabd;p=dpdk.git diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 91e16f8057..9c9419d680 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -184,6 +184,21 @@ enum grinder_state { e_GRINDER_READ_MBUF }; +/* + * Path through the scheduler hierarchy used by the scheduler enqueue + * operation to identify the destination queue for the current + * packet. Stored in the field pkt.hash.sched of struct rte_mbuf of + * each packet, typically written by the classification stage and read + * by scheduler enqueue. + */ +struct __rte_sched_port_hierarchy { + uint32_t queue:2; /**< Queue ID (0 .. 3) */ + uint32_t traffic_class:2; /**< Traffic class ID (0 .. 3)*/ + uint32_t pipe:20; /**< Pipe ID */ + uint32_t subport:6; /**< Subport ID */ + uint32_t color:2; /**< Color */ +}; + struct rte_sched_grinder { /* Pipe cache */ uint16_t pcache_qmask[RTE_SCHED_GRINDER_PCACHE_SIZE]; @@ -448,7 +463,8 @@ rte_sched_port_get_memory_footprint(struct rte_sched_port_params *params) status = rte_sched_port_check_params(params); if (status != 0) { - RTE_LOG(INFO, SCHED, "Port scheduler params check failed (%d)\n", status); + RTE_LOG(NOTICE, SCHED, + "Port scheduler params check failed (%d)\n", status); return 0; } @@ -494,7 +510,7 @@ rte_sched_port_log_pipe_profile(struct rte_sched_port *port, uint32_t i) { struct rte_sched_pipe_profile *p = port->pipe_profiles + i; - RTE_LOG(INFO, SCHED, "Low level config for pipe profile %u:\n" + RTE_LOG(DEBUG, SCHED, "Low level config for pipe profile %u:\n" " Token bucket: period = %u, credits per period = %u, size = %u\n" " Traffic classes: period = %u, credits per period = [%u, %u, %u, %u]\n" " Traffic class 3 oversubscription: weight = %hhu\n" @@ -688,7 +704,7 @@ rte_sched_port_config(struct rte_sched_port_params *params) bmp_mem_size = rte_bitmap_get_memory_footprint(n_queues_per_port); port->bmp = rte_bitmap_init(n_queues_per_port, port->bmp_array, bmp_mem_size); if (port->bmp == NULL) { - RTE_LOG(INFO, SCHED, "Bitmap init error\n"); + RTE_LOG(ERR, SCHED, "Bitmap init error\n"); return NULL; } for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i ++) { @@ -715,7 +731,7 @@ rte_sched_port_log_subport_config(struct rte_sched_port *port, uint32_t i) { struct rte_sched_subport *s = port->subport + i; - RTE_LOG(INFO, SCHED, "Low level config for subport %u:\n" + RTE_LOG(DEBUG, SCHED, "Low level config for subport %u:\n" " Token bucket: period = %u, credits per period = %u, size = %u\n" " Traffic classes: period = %u, credits per period = [%u, %u, %u, %u]\n" " Traffic class 3 oversubscription: wm min = %u, wm max = %u\n", @@ -857,7 +873,8 @@ rte_sched_pipe_config(struct rte_sched_port *port, s->tc_ov = s->tc_ov_rate > subport_tc3_rate; if (s->tc_ov != tc3_ov) { - RTE_LOG(INFO, SCHED, "Subport %u TC3 oversubscription is OFF (%.4lf >= %.4lf)\n", + RTE_LOG(DEBUG, SCHED, + "Subport %u TC3 oversubscription is OFF (%.4lf >= %.4lf)\n", subport_id, subport_tc3_rate, s->tc_ov_rate); } #endif @@ -896,7 +913,8 @@ rte_sched_pipe_config(struct rte_sched_port *port, s->tc_ov = s->tc_ov_rate > subport_tc3_rate; if (s->tc_ov != tc3_ov) { - RTE_LOG(INFO, SCHED, "Subport %u TC3 oversubscription is ON (%.4lf < %.4lf)\n", + RTE_LOG(DEBUG, SCHED, + "Subport %u TC3 oversubscription is ON (%.4lf < %.4lf)\n", subport_id, subport_tc3_rate, s->tc_ov_rate); } p->tc_ov_period_id = s->tc_ov_period_id; @@ -907,6 +925,45 @@ rte_sched_pipe_config(struct rte_sched_port *port, return 0; } +void +rte_sched_port_pkt_write(struct rte_mbuf *pkt, + uint32_t subport, uint32_t pipe, uint32_t traffic_class, + uint32_t queue, enum rte_meter_color color) +{ + struct __rte_sched_port_hierarchy *sched + = (struct __rte_sched_port_hierarchy *) &pkt->hash.sched; + + sched->color = (uint32_t) color; + sched->subport = subport; + sched->pipe = pipe; + sched->traffic_class = traffic_class; + sched->queue = queue; +} + +void +rte_sched_port_pkt_read_tree_path(const struct rte_mbuf *pkt, + uint32_t *subport, uint32_t *pipe, + uint32_t *traffic_class, uint32_t *queue) +{ + const struct __rte_sched_port_hierarchy *sched + = (const struct __rte_sched_port_hierarchy *) &pkt->hash.sched; + + *subport = sched->subport; + *pipe = sched->pipe; + *traffic_class = sched->traffic_class; + *queue = sched->queue; +} + + +enum rte_meter_color +rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt) +{ + const struct __rte_sched_port_hierarchy *sched + = (const struct __rte_sched_port_hierarchy *) &pkt->hash.sched; + + return (enum rte_meter_color) sched->color; +} + int rte_sched_subport_read_stats(struct rte_sched_port *port, uint32_t subport_id,