X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fip_pipeline%2Fcli.c;h=c918f30e06f3417827be1242f71274b0e01c6fb7;hb=3cc977704be6d4db3655da5afb2e87f114cd42d3;hp=f4c2be8b8da5e9eaf59cca154400d272aab36e9b;hpb=3f2eaa4ce95d566f0002af013856a74b8c5bbc75;p=dpdk.git diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index f4c2be8b8d..c918f30e06 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -248,19 +248,32 @@ print_link_info(struct link *link, char *out, size_t out_size) struct rte_ether_addr mac_addr; struct rte_eth_link eth_link; uint16_t mtu; + int ret; memset(&stats, 0, sizeof(stats)); rte_eth_stats_get(link->port_id, &stats); - rte_eth_macaddr_get(link->port_id, &mac_addr); - rte_eth_link_get(link->port_id, ð_link); + ret = rte_eth_macaddr_get(link->port_id, &mac_addr); + if (ret != 0) { + snprintf(out, out_size, "\n%s: MAC address get failed: %s", + link->name, rte_strerror(-ret)); + return; + } + + ret = rte_eth_link_get(link->port_id, ð_link); + if (ret < 0) { + snprintf(out, out_size, "\n%s: link get failed: %s", + link->name, rte_strerror(-ret)); + return; + } + rte_eth_dev_get_mtu(link->port_id, &mtu); snprintf(out, out_size, "\n" "%s: flags=<%s> mtu %u\n" - "\tether %02X:%02X:%02X:%02X:%02X:%02X rxqueues %u txqueues %u\n" - "\tport# %u speed %u Mbps\n" + "\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n" + "\tport# %u speed %s\n" "\tRX packets %" PRIu64" bytes %" PRIu64"\n" "\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n" "\tTX packets %" PRIu64" bytes %" PRIu64"\n" @@ -268,13 +281,11 @@ print_link_info(struct link *link, char *out, size_t out_size) link->name, eth_link.link_status == 0 ? "DOWN" : "UP", mtu, - mac_addr.addr_bytes[0], mac_addr.addr_bytes[1], - mac_addr.addr_bytes[2], mac_addr.addr_bytes[3], - mac_addr.addr_bytes[4], mac_addr.addr_bytes[5], + RTE_ETHER_ADDR_BYTES(&mac_addr), link->n_rxq, link->n_txq, link->port_id, - eth_link.link_speed, + rte_eth_link_speed_to_str(eth_link.link_speed), stats.ipackets, stats.ibytes, stats.ierrors, @@ -388,7 +399,7 @@ cmd_tmgr_subport_profile(char **tokens, char *out, size_t out_size) { - struct rte_sched_subport_params p; + struct rte_sched_subport_profile_params subport_profile; int status, i; if (n_tokens != 19) { @@ -396,28 +407,29 @@ cmd_tmgr_subport_profile(char **tokens, return; } - if (parser_read_uint32(&p.tb_rate, tokens[3]) != 0) { + if (parser_read_uint64(&subport_profile.tb_rate, tokens[3]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tb_rate"); return; } - if (parser_read_uint32(&p.tb_size, tokens[4]) != 0) { + if (parser_read_uint64(&subport_profile.tb_size, tokens[4]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tb_size"); return; } for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - if (parser_read_uint32(&p.tc_rate[i], tokens[5 + i]) != 0) { + if (parser_read_uint64(&subport_profile.tc_rate[i], + tokens[5 + i]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_rate"); return; } - if (parser_read_uint32(&p.tc_period, tokens[18]) != 0) { + if (parser_read_uint64(&subport_profile.tc_period, tokens[18]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_period"); return; } - status = tmgr_subport_profile_add(&p); + status = tmgr_subport_profile_add(&subport_profile); if (status != 0) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; @@ -448,33 +460,31 @@ cmd_tmgr_pipe_profile(char **tokens, return; } - if (parser_read_uint32(&p.tb_rate, tokens[3]) != 0) { + if (parser_read_uint64(&p.tb_rate, tokens[3]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tb_rate"); return; } - if (parser_read_uint32(&p.tb_size, tokens[4]) != 0) { + if (parser_read_uint64(&p.tb_size, tokens[4]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tb_size"); return; } for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - if (parser_read_uint32(&p.tc_rate[i], tokens[5 + i]) != 0) { + if (parser_read_uint64(&p.tc_rate[i], tokens[5 + i]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_rate"); return; } - if (parser_read_uint32(&p.tc_period, tokens[18]) != 0) { + if (parser_read_uint64(&p.tc_period, tokens[18]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_period"); return; } -#ifdef RTE_SCHED_SUBPORT_TC_OV if (parser_read_uint8(&p.tc_ov_weight, tokens[19]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_ov_weight"); return; } -#endif for (i = 0; i < RTE_SCHED_BE_QUEUES_PER_PIPE; i++) if (parser_read_uint8(&p.wrr_weights[i], tokens[20 + i]) != 0) { @@ -494,10 +504,6 @@ static const char cmd_tmgr_help[] = " rate \n" " spp \n" " pps \n" -" qsize " -" " -" " -" \n" " fo \n" " mtu \n" " cpu \n"; @@ -511,9 +517,8 @@ cmd_tmgr(char **tokens, struct tmgr_port_params p; char *name; struct tmgr_port *tmgr_port; - int i; - if (n_tokens != 28) { + if (n_tokens != 14) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } @@ -525,7 +530,7 @@ cmd_tmgr(char **tokens, return; } - if (parser_read_uint32(&p.rate, tokens[3]) != 0) { + if (parser_read_uint64(&p.rate, tokens[3]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "rate"); return; } @@ -541,7 +546,7 @@ cmd_tmgr(char **tokens, } if (strcmp(tokens[6], "pps") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pps"); + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "spp"); return; } @@ -550,43 +555,32 @@ cmd_tmgr(char **tokens, return; } - if (strcmp(tokens[8], "qsize") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "qsize"); - return; - } - - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - if (parser_read_uint16(&p.qsize[i], tokens[9 + i]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "qsize"); - return; - } - - if (strcmp(tokens[22], "fo") != 0) { + if (strcmp(tokens[8], "fo") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "fo"); return; } - if (parser_read_uint32(&p.frame_overhead, tokens[23]) != 0) { + if (parser_read_uint32(&p.frame_overhead, tokens[9]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "frame_overhead"); return; } - if (strcmp(tokens[24], "mtu") != 0) { + if (strcmp(tokens[10], "mtu") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "mtu"); return; } - if (parser_read_uint32(&p.mtu, tokens[25]) != 0) { + if (parser_read_uint32(&p.mtu, tokens[11]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "mtu"); return; } - if (strcmp(tokens[26], "cpu") != 0) { + if (strcmp(tokens[12], "cpu") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cpu"); return; } - if (parser_read_uint32(&p.cpu_id, tokens[27]) != 0) { + if (parser_read_uint32(&p.cpu_id, tokens[13]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "cpu_id"); return; } @@ -2661,7 +2655,7 @@ struct pkt_key_qinq { uint16_t svlan; uint16_t ethertype_cvlan; uint16_t cvlan; -} __attribute__((__packed__)); +} __rte_packed; struct pkt_key_ipv4_5tuple { uint8_t time_to_live; @@ -2671,7 +2665,7 @@ struct pkt_key_ipv4_5tuple { uint32_t da; uint16_t sp; uint16_t dp; -} __attribute__((__packed__)); +} __rte_packed; struct pkt_key_ipv6_5tuple { uint16_t payload_length; @@ -2681,15 +2675,15 @@ struct pkt_key_ipv6_5tuple { uint8_t da[16]; uint16_t sp; uint16_t dp; -} __attribute__((__packed__)); +} __rte_packed; struct pkt_key_ipv4_addr { uint32_t addr; -} __attribute__((__packed__)); +} __rte_packed; struct pkt_key_ipv6_addr { uint8_t addr[16]; -} __attribute__((__packed__)); +} __rte_packed; static uint32_t parse_match(char **tokens, @@ -3779,10 +3773,8 @@ parse_free_sym_crypto_param_data(struct rte_table_action_sym_crypto_params *p) switch (xform[i]->type) { case RTE_CRYPTO_SYM_XFORM_CIPHER: - if (p->cipher_auth.cipher_iv.val) - free(p->cipher_auth.cipher_iv.val); - if (p->cipher_auth.cipher_iv_update.val) - free(p->cipher_auth.cipher_iv_update.val); + free(p->cipher_auth.cipher_iv.val); + free(p->cipher_auth.cipher_iv_update.val); break; case RTE_CRYPTO_SYM_XFORM_AUTH: if (p->cipher_auth.auth_iv.val) @@ -3791,10 +3783,8 @@ parse_free_sym_crypto_param_data(struct rte_table_action_sym_crypto_params *p) free(p->cipher_auth.cipher_iv_update.val); break; case RTE_CRYPTO_SYM_XFORM_AEAD: - if (p->aead.iv.val) - free(p->aead.iv.val); - if (p->aead.aad.val) - free(p->aead.aad.val); + free(p->aead.iv.val); + free(p->aead.aad.val); break; default: continue; @@ -4780,10 +4770,7 @@ cmd_pipeline_table_rule_delete_default(char **tokens, static void ether_addr_show(FILE *f, struct rte_ether_addr *addr) { - fprintf(f, "%02x:%02x:%02x:%02x:%02x:%02x", - (uint32_t)addr->addr_bytes[0], (uint32_t)addr->addr_bytes[1], - (uint32_t)addr->addr_bytes[2], (uint32_t)addr->addr_bytes[3], - (uint32_t)addr->addr_bytes[4], (uint32_t)addr->addr_bytes[5]); + fprintf(f, RTE_ETHER_ADDR_PRT_FMT, RTE_ETHER_ADDR_BYTES(addr)); } static void