X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fip_pipeline%2Fcli.c;h=ec4acf0acadfee64ebed122c0166c5a528474122;hb=54a298e5f7f41c5883233dcd0f66fc57d7b351a2;hp=e7ad93e6ee3c7098d21c717c7b037eb2ed14c038;hpb=87b36dcd2b4a073824e16ad172fcfaa6f2af9790;p=dpdk.git diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index e7ad93e6ee..ec4acf0aca 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -245,22 +245,35 @@ static void print_link_info(struct link *link, char *out, size_t out_size) { struct rte_eth_stats stats; - struct ether_addr mac_addr; + 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" + "\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" @@ -274,7 +287,7 @@ print_link_info(struct link *link, char *out, size_t out_size) 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, @@ -377,7 +390,9 @@ cmd_swq(char **tokens, static const char cmd_tmgr_subport_profile_help[] = "tmgr subport profile\n" " \n" -" \n" +" " +" " +" \n" " \n"; static void @@ -386,36 +401,37 @@ 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 != 10) { + if (n_tokens != 19) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); 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[9]) != 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; @@ -425,10 +441,12 @@ cmd_tmgr_subport_profile(char **tokens, static const char cmd_tmgr_pipe_profile_help[] = "tmgr pipe profile\n" " \n" -" \n" +" " +" " +" \n" " \n" " \n" -" \n"; +" \n"; static void cmd_tmgr_pipe_profile(char **tokens, @@ -439,41 +457,39 @@ cmd_tmgr_pipe_profile(char **tokens, struct rte_sched_pipe_params p; int status, i; - if (n_tokens != 27) { + if (n_tokens != 24) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); 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[9]) != 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[10]) != 0) { + 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_QUEUES_PER_PIPE; i++) - if (parser_read_uint8(&p.wrr_weights[i], tokens[11 + i]) != 0) { + for (i = 0; i < RTE_SCHED_BE_QUEUES_PER_PIPE; i++) + if (parser_read_uint8(&p.wrr_weights[i], tokens[20 + i]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "wrr_weights"); return; } @@ -490,7 +506,6 @@ static const char cmd_tmgr_help[] = " rate \n" " spp \n" " pps \n" -" qsize \n" " fo \n" " mtu \n" " cpu \n"; @@ -504,9 +519,8 @@ cmd_tmgr(char **tokens, struct tmgr_port_params p; char *name; struct tmgr_port *tmgr_port; - int i; - if (n_tokens != 19) { + if (n_tokens != 14) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } @@ -518,7 +532,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; } @@ -534,7 +548,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; } @@ -543,43 +557,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[13], "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[14]) != 0) { + if (parser_read_uint32(&p.frame_overhead, tokens[9]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "frame_overhead"); return; } - if (strcmp(tokens[15], "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[16]) != 0) { + if (parser_read_uint32(&p.mtu, tokens[11]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "mtu"); return; } - if (strcmp(tokens[17], "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[18]) != 0) { + if (parser_read_uint32(&p.cpu_id, tokens[13]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "cpu_id"); return; } @@ -790,7 +793,8 @@ cmd_kni(char **tokens, static const char cmd_cryptodev_help[] = "cryptodev \n" " dev | dev_id \n" -" queue \n"; +" queue \n" +" max_sessions "; static void cmd_cryptodev(char **tokens, @@ -802,7 +806,7 @@ cmd_cryptodev(char **tokens, char *name; memset(¶ms, 0, sizeof(params)); - if (n_tokens != 7) { + if (n_tokens != 9) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } @@ -825,7 +829,7 @@ cmd_cryptodev(char **tokens, if (strcmp(tokens[4], "queue")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, - "4"); + "queue"); return; } @@ -841,6 +845,18 @@ cmd_cryptodev(char **tokens, return; } + if (strcmp(tokens[7], "max_sessions")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, + "max_sessions"); + return; + } + + if (parser_read_uint32(¶ms.session_pool_size, tokens[8]) < 0) { + snprintf(out, out_size, MSG_ARG_INVALID, + "queue_size"); + return; + } + if (cryptodev_create(name, ¶ms) == NULL) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; @@ -1022,7 +1038,7 @@ static const char cmd_table_action_profile_help[] = " tc \n" " stats none | pkts | bytes | both]\n" " [tm spp pps ]\n" -" [encap ether | vlan | qinq | mpls | pppoe |\n" +" [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe \n" " vxlan offset ipv4 | ipv6 vlan on | off]\n" " [nat src | dst\n" " proto udp | tcp]\n" @@ -1030,9 +1046,7 @@ static const char cmd_table_action_profile_help[] = " stats none | pkts]\n" " [stats pkts | bytes | both]\n" " [time]\n" -" [sym_crypto dev offset " -" mempool_create \n" -" mempool_init ]\n" +" [sym_crypto dev offset ]\n" " [tag]\n" " [decap]\n"; @@ -1290,7 +1304,10 @@ cmd_table_action_profile(char **tokens, p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN; n_extra_tokens = 5; - } else { + } else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0) + p.encap.encap_mask = + 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE; + else { snprintf(out, out_size, MSG_ARG_MISMATCH, "encap"); return; } @@ -1404,13 +1421,10 @@ cmd_table_action_profile(char **tokens, if ((t0 < n_tokens) && (strcmp(tokens[t0], "sym_crypto") == 0)) { struct cryptodev *cryptodev; - struct mempool *mempool; - if (n_tokens < t0 + 9 || + if (n_tokens < t0 + 5 || strcmp(tokens[t0 + 1], "dev") || - strcmp(tokens[t0 + 3], "offset") || - strcmp(tokens[t0 + 5], "mempool_create") || - strcmp(tokens[t0 + 7], "mempool_init")) { + strcmp(tokens[t0 + 3], "offset")) { snprintf(out, out_size, MSG_ARG_MISMATCH, "table action profile sym_crypto"); return; @@ -1432,25 +1446,12 @@ cmd_table_action_profile(char **tokens, return; } - mempool = mempool_find(tokens[t0 + 6]); - if (mempool == NULL) { - snprintf(out, out_size, MSG_ARG_INVALID, - "table action profile sym_crypto"); - return; - } - p.sym_crypto.mp_create = mempool->m; - - mempool = mempool_find(tokens[t0 + 8]); - if (mempool == NULL) { - snprintf(out, out_size, MSG_ARG_INVALID, - "table action profile sym_crypto"); - return; - } - p.sym_crypto.mp_init = mempool->m; + p.sym_crypto.mp_create = cryptodev->mp_create; + p.sym_crypto.mp_init = cryptodev->mp_init; p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO; - t0 += 9; + t0 += 5; } /* sym_crypto */ if ((t0 < n_tokens) && (strcmp(tokens[t0], "tag") == 0)) { @@ -2656,7 +2657,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; @@ -2666,7 +2667,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; @@ -2676,15 +2677,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, @@ -3090,6 +3091,7 @@ parse_match(char **tokens, * ether * | vlan * | qinq + * | qinq_pppoe * | mpls unicast | multicast * * label0