net/softnic: use POSIX network address conversion
[dpdk.git] / app / test-pmd / config.c
index 4d3953c..1668ae3 100644 (file)
 #include <rte_cycles.h>
 #include <rte_flow.h>
 #include <rte_errno.h>
-#ifdef RTE_LIBRTE_IXGBE_PMD
+#ifdef RTE_NET_IXGBE
 #include <rte_pmd_ixgbe.h>
 #endif
-#ifdef RTE_LIBRTE_I40E_PMD
+#ifdef RTE_NET_I40E
 #include <rte_pmd_i40e.h>
 #endif
-#ifdef RTE_LIBRTE_BNXT_PMD
+#ifdef RTE_NET_BNXT
 #include <rte_pmd_bnxt.h>
 #endif
 #include <rte_gro.h>
@@ -3456,9 +3456,9 @@ set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc)
                        printf("lcore %u not enabled\n", lcore_cpuid);
                        return -1;
                }
-               if (lcore_cpuid == rte_get_master_lcore()) {
+               if (lcore_cpuid == rte_get_main_lcore()) {
                        printf("lcore %u cannot be masked on for running "
-                              "packet forwarding, which is the master lcore "
+                              "packet forwarding, which is the main lcore "
                               "and reserved for command line parsing only\n",
                               lcore_cpuid);
                        return -1;
@@ -3774,6 +3774,94 @@ show_fec_capability(unsigned int num, struct rte_eth_fec_capa *speed_fec_capa)
        }
 }
 
+void
+show_rx_pkt_offsets(void)
+{
+       uint32_t i, n;
+
+       n = rx_pkt_nb_offs;
+       printf("Number of offsets: %u\n", n);
+       if (n) {
+               printf("Segment offsets: ");
+               for (i = 0; i != n - 1; i++)
+                       printf("%hu,", rx_pkt_seg_offsets[i]);
+               printf("%hu\n", rx_pkt_seg_lengths[i]);
+       }
+}
+
+void
+set_rx_pkt_offsets(unsigned int *seg_offsets, unsigned int nb_offs)
+{
+       unsigned int i;
+
+       if (nb_offs >= MAX_SEGS_BUFFER_SPLIT) {
+               printf("nb segments per RX packets=%u >= "
+                      "MAX_SEGS_BUFFER_SPLIT - ignored\n", nb_offs);
+               return;
+       }
+
+       /*
+        * No extra check here, the segment length will be checked by PMD
+        * in the extended queue setup.
+        */
+       for (i = 0; i < nb_offs; i++) {
+               if (seg_offsets[i] >= UINT16_MAX) {
+                       printf("offset[%u]=%u > UINT16_MAX - give up\n",
+                              i, seg_offsets[i]);
+                       return;
+               }
+       }
+
+       for (i = 0; i < nb_offs; i++)
+               rx_pkt_seg_offsets[i] = (uint16_t) seg_offsets[i];
+
+       rx_pkt_nb_offs = (uint8_t) nb_offs;
+}
+
+void
+show_rx_pkt_segments(void)
+{
+       uint32_t i, n;
+
+       n = rx_pkt_nb_segs;
+       printf("Number of segments: %u\n", n);
+       if (n) {
+               printf("Segment sizes: ");
+               for (i = 0; i != n - 1; i++)
+                       printf("%hu,", rx_pkt_seg_lengths[i]);
+               printf("%hu\n", rx_pkt_seg_lengths[i]);
+       }
+}
+
+void
+set_rx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)
+{
+       unsigned int i;
+
+       if (nb_segs >= MAX_SEGS_BUFFER_SPLIT) {
+               printf("nb segments per RX packets=%u >= "
+                      "MAX_SEGS_BUFFER_SPLIT - ignored\n", nb_segs);
+               return;
+       }
+
+       /*
+        * No extra check here, the segment length will be checked by PMD
+        * in the extended queue setup.
+        */
+       for (i = 0; i < nb_segs; i++) {
+               if (seg_lengths[i] >= UINT16_MAX) {
+                       printf("length[%u]=%u > UINT16_MAX - give up\n",
+                              i, seg_lengths[i]);
+                       return;
+               }
+       }
+
+       for (i = 0; i < nb_segs; i++)
+               rx_pkt_seg_lengths[i] = (uint16_t) seg_lengths[i];
+
+       rx_pkt_nb_segs = (uint8_t) nb_segs;
+}
+
 void
 show_tx_pkt_segments(void)
 {
@@ -3819,10 +3907,10 @@ nb_segs_is_invalid(unsigned int nb_segs)
 }
 
 void
-set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs)
+set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)
 {
        uint16_t tx_pkt_len;
-       unsigned i;
+       unsigned int i;
 
        if (nb_segs_is_invalid(nb_segs))
                return;
@@ -4673,14 +4761,14 @@ get_fdir_info(portid_t port_id, struct rte_eth_fdir_info *fdir_info,
                return 0;
        }
 
-#ifdef RTE_LIBRTE_I40E_PMD
+#ifdef RTE_NET_I40E
        if (ret == -ENOTSUP) {
                ret = rte_pmd_i40e_get_fdir_info(port_id, fdir_info);
                if (!ret)
                        ret = rte_pmd_i40e_get_fdir_stats(port_id, fdir_stat);
        }
 #endif
-#ifdef RTE_LIBRTE_IXGBE_PMD
+#ifdef RTE_NET_IXGBE
        if (ret == -ENOTSUP) {
                ret = rte_pmd_ixgbe_get_fdir_info(port_id, fdir_info);
                if (!ret)
@@ -4833,7 +4921,7 @@ fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg)
 void
 set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
 {
-#ifdef RTE_LIBRTE_IXGBE_PMD
+#ifdef RTE_NET_IXGBE
        int diag;
 
        if (is_rx)
@@ -4888,12 +4976,12 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
        RTE_SET_USED(rate);
        RTE_SET_USED(q_msk);
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
+#ifdef RTE_NET_IXGBE
        if (diag == -ENOTSUP)
                diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate,
                                                       q_msk);
 #endif
-#ifdef RTE_LIBRTE_BNXT_PMD
+#ifdef RTE_NET_BNXT
        if (diag == -ENOTSUP)
                diag = rte_pmd_bnxt_set_vf_rate_limit(port_id, vf, rate, q_msk);
 #endif
@@ -5189,7 +5277,7 @@ close_file(uint8_t *buf)
 void
 port_queue_region_info_display(portid_t port_id, void *buf)
 {
-#ifdef RTE_LIBRTE_I40E_PMD
+#ifdef RTE_NET_I40E
        uint16_t i, j;
        struct rte_pmd_i40e_queue_regions *info =
                (struct rte_pmd_i40e_queue_regions *)buf;