X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Fconfig.c;h=3b921cfc6a0c2ed406931e4d8606956d9208e1ae;hb=ab67e837be9e49cb2afcafb741632ddd73c5cd49;hp=b07376af9a7dbc0ab45b7b16821e9cc73c074a8d;hpb=8f3c4176fc11ed10dac9384a33ca470f3ef52c6a;p=dpdk.git diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index b07376af9a..3b921cfc6a 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -577,7 +577,7 @@ port_offload_cap_display(portid_t port_id) } if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) { - printf("RX Outer IPv4 checksum: "); + printf("RX Outer IPv4 checksum: "); if (ports[port_id].dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) printf("on\n"); @@ -594,19 +594,37 @@ port_offload_cap_display(portid_t port_id) printf("off\n"); } - if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { - printf("VLAN insert: "); - if (ports[port_id].dev_conf.txmode.offloads & - DEV_TX_OFFLOAD_VLAN_INSERT) + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) { + printf("HW timestamp: "); + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TIMESTAMP) printf("on\n"); else printf("off\n"); } - if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) { - printf("HW timestamp: "); + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_KEEP_CRC) { + printf("Rx Keep CRC: "); if (ports[port_id].dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_TIMESTAMP) + DEV_RX_OFFLOAD_KEEP_CRC) + printf("on\n"); + else + printf("off\n"); + } + + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_SECURITY) { + printf("RX offload security: "); + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_SECURITY) + printf("on\n"); + else + printf("off\n"); + } + + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { + printf("VLAN insert: "); + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VLAN_INSERT) printf("on\n"); else printf("off\n"); @@ -1049,15 +1067,24 @@ flow_item_spec_copy(void *buf, const struct rte_flow_item *item, enum item_spec_type type) { size_t size = 0; - const void *item_spec = + const void *data = type == ITEM_SPEC ? item->spec : type == ITEM_LAST ? item->last : type == ITEM_MASK ? item->mask : NULL; - if (!item_spec) + if (!item->spec || !data) goto empty; switch (item->type) { + union { + const struct rte_flow_item_raw *raw; + } spec; + union { + const struct rte_flow_item_raw *raw; + } last; + union { + const struct rte_flow_item_raw *raw; + } mask; union { const struct rte_flow_item_raw *raw; } src; @@ -1067,12 +1094,21 @@ flow_item_spec_copy(void *buf, const struct rte_flow_item *item, size_t off; case RTE_FLOW_ITEM_TYPE_RAW: - src.raw = item_spec; + spec.raw = item->spec; + last.raw = item->last ? item->last : item->spec; + mask.raw = item->mask ? item->mask : &rte_flow_item_raw_mask; + src.raw = data; dst.raw = buf; off = RTE_ALIGN_CEIL(sizeof(struct rte_flow_item_raw), sizeof(*src.raw->pattern)); - size = off + ((const struct rte_flow_item_raw *)item->spec)-> - length * sizeof(*src.raw->pattern); + if (type == ITEM_SPEC || + (type == ITEM_MASK && + ((spec.raw->length & mask.raw->length) >= + (last.raw->length & mask.raw->length)))) + size = spec.raw->length & mask.raw->length; + else + size = last.raw->length & mask.raw->length; + size = off + size * sizeof(*src.raw->pattern); if (dst.raw) { memcpy(dst.raw, src.raw, sizeof(*src.raw)); dst.raw->pattern = memcpy((uint8_t *)dst.raw + off, @@ -1083,7 +1119,7 @@ flow_item_spec_copy(void *buf, const struct rte_flow_item *item, default: size = flow_item[item->type].size; if (buf) - memcpy(buf, item_spec, size); + memcpy(buf, data, size); break; } empty: @@ -1105,6 +1141,7 @@ static const struct { MK_FLOW_ACTION(END, 0), MK_FLOW_ACTION(VOID, 0), MK_FLOW_ACTION(PASSTHRU, 0), + MK_FLOW_ACTION(JUMP, 0), MK_FLOW_ACTION(MARK, sizeof(struct rte_flow_action_mark)), MK_FLOW_ACTION(FLAG, 0), MK_FLOW_ACTION(QUEUE, sizeof(struct rte_flow_action_queue)), @@ -1319,11 +1356,12 @@ port_flow_complain(struct rte_flow_error *error) errstr = "unknown type"; else errstr = errstrlist[error->type]; - printf("Caught error type %d (%s): %s%s\n", + printf("Caught error type %d (%s): %s%s: %s\n", error->type, errstr, error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ", error->cause), buf) : "", - error->message ? error->message : "(no stated reason)"); + error->message ? error->message : "(no stated reason)", + rte_strerror(err)); return -err; } @@ -1821,6 +1859,11 @@ rxtx_config_display(void) struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0]; uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0]; uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0]; + uint16_t nb_rx_desc_tmp; + uint16_t nb_tx_desc_tmp; + struct rte_eth_rxq_info rx_qinfo; + struct rte_eth_txq_info tx_qinfo; + int32_t rc; /* per port config */ printf(" port %d: RX queue number: %d Tx queue number: %d\n", @@ -1832,9 +1875,15 @@ rxtx_config_display(void) /* per rx queue config only for first queue to be less verbose */ for (qid = 0; qid < 1; qid++) { + rc = rte_eth_rx_queue_info_get(pid, qid, &rx_qinfo); + if (rc) + nb_rx_desc_tmp = nb_rx_desc[qid]; + else + nb_rx_desc_tmp = rx_qinfo.nb_desc; + printf(" RX queue: %d\n", qid); printf(" RX desc=%d - RX free threshold=%d\n", - nb_rx_desc[qid], rx_conf[qid].rx_free_thresh); + nb_rx_desc_tmp, rx_conf[qid].rx_free_thresh); printf(" RX threshold registers: pthresh=%d hthresh=%d " " wthresh=%d\n", rx_conf[qid].rx_thresh.pthresh, @@ -1846,9 +1895,15 @@ rxtx_config_display(void) /* per tx queue config only for first queue to be less verbose */ for (qid = 0; qid < 1; qid++) { + rc = rte_eth_tx_queue_info_get(pid, qid, &tx_qinfo); + if (rc) + nb_tx_desc_tmp = nb_tx_desc[qid]; + else + nb_tx_desc_tmp = tx_qinfo.nb_desc; + printf(" TX queue: %d\n", qid); printf(" TX desc=%d - TX free threshold=%d\n", - nb_tx_desc[qid], tx_conf[qid].tx_free_thresh); + nb_tx_desc_tmp, tx_conf[qid].tx_free_thresh); printf(" TX threshold registers: pthresh=%d hthresh=%d " " wthresh=%d\n", tx_conf[qid].tx_thresh.pthresh, @@ -2142,15 +2197,11 @@ rss_fwd_config_setup(void) fs->tx_queue = rxq; fs->peer_addr = fs->tx_port; fs->retry_enabled = retry_enabled; - rxq = (queueid_t) (rxq + 1); - if (rxq < nb_q) - continue; - /* - * rxq == nb_q - * Restart from RX queue 0 on next RX port - */ - rxq = 0; rxp++; + if (rxp < nb_fwd_ports) + continue; + rxp = 0; + rxq++; } } @@ -2297,6 +2348,55 @@ icmp_echo_config_setup(void) } } +#if defined RTE_LIBRTE_PMD_SOFTNIC +static void +softnic_fwd_config_setup(void) +{ + struct rte_port *port; + portid_t pid, softnic_portid; + queueid_t i; + uint8_t softnic_enable = 0; + + RTE_ETH_FOREACH_DEV(pid) { + port = &ports[pid]; + const char *driver = port->dev_info.driver_name; + + if (strcmp(driver, "net_softnic") == 0) { + softnic_portid = pid; + softnic_enable = 1; + break; + } + } + + if (softnic_enable == 0) { + printf("Softnic mode not configured(%s)!\n", __func__); + return; + } + + cur_fwd_config.nb_fwd_ports = 1; + cur_fwd_config.nb_fwd_streams = (streamid_t) nb_rxq; + + /* Re-initialize forwarding streams */ + init_fwd_streams(); + + /* + * In the softnic forwarding test, the number of forwarding cores + * is set to one and remaining are used for softnic packet processing. + */ + cur_fwd_config.nb_fwd_lcores = 1; + setup_fwd_config_of_each_lcore(&cur_fwd_config); + + for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) { + fwd_streams[i]->rx_port = softnic_portid; + fwd_streams[i]->rx_queue = i; + fwd_streams[i]->tx_port = softnic_portid; + fwd_streams[i]->tx_queue = i; + fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port; + fwd_streams[i]->retry_enabled = retry_enabled; + } +} +#endif + void fwd_config_setup(void) { @@ -2305,6 +2405,14 @@ fwd_config_setup(void) icmp_echo_config_setup(); return; } + +#if defined RTE_LIBRTE_PMD_SOFTNIC + if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) { + softnic_fwd_config_setup(); + return; + } +#endif + if ((nb_rxq > 1) && (nb_txq > 1)){ if (dcb_config) dcb_fwd_config_setup(); @@ -2315,6 +2423,23 @@ fwd_config_setup(void) simple_fwd_config_setup(); } +static const char * +mp_alloc_to_str(uint8_t mode) +{ + switch (mode) { + case MP_ALLOC_NATIVE: + return "native"; + case MP_ALLOC_ANON: + return "anon"; + case MP_ALLOC_XMEM: + return "xmem"; + case MP_ALLOC_XMEM_HUGE: + return "xmemhuge"; + default: + return "invalid"; + } +} + void pkt_fwd_config_display(struct fwd_config *cfg) { @@ -2323,12 +2448,12 @@ pkt_fwd_config_display(struct fwd_config *cfg) streamid_t sm_id; printf("%s packet forwarding%s - ports=%d - cores=%d - streams=%d - " - "NUMA support %s, MP over anonymous pages %s\n", + "NUMA support %s, MP allocation mode: %s\n", cfg->fwd_eng->fwd_mode_name, retry_enabled == 0 ? "" : " with retry", cfg->nb_fwd_ports, cfg->nb_fwd_lcores, cfg->nb_fwd_streams, numa_support == 1 ? "enabled" : "disabled", - mp_anon != 0 ? "enabled" : "disabled"); + mp_alloc_to_str(mp_alloc_type)); if (retry_enabled) printf("TX retry num: %u, delay between TX retries: %uus\n",