X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Fconfig.c;h=e0f08257f97d615bfc14a9ed58d22e02a6570655;hb=b40f8d782ba18e97ca4270823320dfe3242d8684;hp=10b98b1a4079339eb094e4f605af274199e59d6f;hpb=36735a932ca7eed41f86393f80cc8379fc74b6f5;p=dpdk.git diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 10b98b1a40..e0f08257f9 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -71,6 +71,7 @@ #ifdef RTE_LIBRTE_BNXT_PMD #include #endif +#include #include "testpmd.h" @@ -946,6 +947,7 @@ static const struct { MK_FLOW_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)), MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)), MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)), + MK_FLOW_ITEM(FUZZY, sizeof(struct rte_flow_item_fuzzy)), }; /** Compute storage space needed by item specification. */ @@ -1411,6 +1413,22 @@ port_flow_list(portid_t port_id, uint32_t n, const uint32_t group[n]) } } +/** Restrict ingress traffic to the defined flow rules. */ +int +port_flow_isolate(portid_t port_id, int set) +{ + struct rte_flow_error error; + + /* Poisoning to make sure PMDs update it in case of error. */ + memset(&error, 0x66, sizeof(error)); + if (rte_flow_isolate(port_id, set, &error)) + return port_flow_complain(&error); + printf("Ingress traffic on port %u is %s to the defined flow rules\n", + port_id, + set ? "now restricted" : "not restricted anymore"); + return 0; +} + /* * RX/TX ring descriptors display functions. */ @@ -2398,6 +2416,41 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) tx_pkt_nb_segs = (uint8_t) nb_segs; } +void +setup_gro(const char *mode, uint8_t port_id) +{ + if (!rte_eth_dev_is_valid_port(port_id)) { + printf("invalid port id %u\n", port_id); + return; + } + if (test_done == 0) { + printf("Before enable/disable GRO," + " please stop forwarding first\n"); + return; + } + if (strcmp(mode, "on") == 0) { + if (gro_ports[port_id].enable) { + printf("port %u has enabled GRO\n", port_id); + return; + } + gro_ports[port_id].enable = 1; + gro_ports[port_id].param.gro_types = RTE_GRO_TCP_IPV4; + + if (gro_ports[port_id].param.max_flow_num == 0) + gro_ports[port_id].param.max_flow_num = + GRO_DEFAULT_FLOW_NUM; + if (gro_ports[port_id].param.max_item_per_flow == 0) + gro_ports[port_id].param.max_item_per_flow = + GRO_DEFAULT_ITEM_NUM_PER_FLOW; + } else { + if (gro_ports[port_id].enable == 0) { + printf("port %u has disabled GRO\n", port_id); + return; + } + gro_ports[port_id].enable = 0; + } +} + char* list_pkt_forwarding_modes(void) { @@ -2984,10 +3037,10 @@ fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg) } -#ifdef RTE_LIBRTE_IXGBE_PMD void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on) { +#ifdef RTE_LIBRTE_IXGBE_PMD int diag; if (is_rx) @@ -2997,15 +3050,15 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on) if (diag == 0) return; - if(is_rx) - printf("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed " - "diag=%d\n", port_id, diag); - else - printf("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed " - "diag=%d\n", port_id, diag); - -} + printf("rte_pmd_ixgbe_set_vf_%s for port_id=%d failed diag=%d\n", + is_rx ? "rx" : "tx", port_id, diag); + return; #endif + printf("VF %s setting not supported for port %d\n", + is_rx ? "Rx" : "Tx", port_id); + RTE_SET_USED(vf); + RTE_SET_USED(on); +} int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate) @@ -3292,6 +3345,27 @@ open_ddp_package_file(const char *file_path, uint32_t *size) return buf; } +int +save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size) +{ + FILE *fh = fopen(file_path, "wb"); + + if (fh == NULL) { + printf("%s: Failed to open %s\n", __func__, file_path); + return -1; + } + + if (fwrite(buf, 1, size, fh) != size) { + fclose(fh); + printf("%s: File write operation failed\n", __func__); + return -1; + } + + fclose(fh); + + return 0; +} + int close_ddp_package_file(uint8_t *buf) {