doc: update DPAA2 net PMD guide
[dpdk.git] / app / test-pmd / config.c
index b0b340e..ee6644d 100644 (file)
@@ -36,7 +36,6 @@
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdarg.h>
 #include <stdint.h>
 #include <inttypes.h>
 
@@ -71,6 +70,7 @@
 #ifdef RTE_LIBRTE_BNXT_PMD
 #include <rte_pmd_bnxt.h>
 #endif
+#include <rte_gro.h>
 
 #include "testpmd.h"
 
@@ -946,6 +946,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. */
@@ -2414,6 +2415,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)
 {
@@ -3308,6 +3344,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)
 {