doc: add GRE option flow item to feature list
[dpdk.git] / examples / l3fwd-power / main.c
index 21c7956..20e5b59 100644 (file)
@@ -433,7 +433,7 @@ signal_exit_now(int sigtype)
 
 }
 
-/*  Freqency scale down timer callback */
+/*  Frequency scale down timer callback */
 static void
 power_timer_cb(__rte_unused struct rte_timer *tim,
                          __rte_unused void *arg)
@@ -505,7 +505,15 @@ is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len)
                return -1;
 
        /* 2. The IP checksum must be correct. */
-       /* this is checked in H/W */
+       /* if this is not checked in H/W, check it. */
+       if ((port_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_IPV4_CKSUM) == 0) {
+               uint16_t actual_cksum, expected_cksum;
+               actual_cksum = pkt->hdr_checksum;
+               pkt->hdr_checksum = 0;
+               expected_cksum = rte_ipv4_cksum(pkt);
+               if (actual_cksum != expected_cksum)
+                       return -2;
+       }
 
        /*
         * 3. The IP version number must be 4. If the version number is not 4
@@ -2350,7 +2358,7 @@ update_telemetry(__rte_unused struct rte_timer *tim,
        ret = rte_metrics_update_values(RTE_METRICS_GLOBAL, telstats_index,
                                        values, RTE_DIM(values));
        if (ret < 0)
-               RTE_LOG(WARNING, POWER, "failed to update metrcis\n");
+               RTE_LOG(WARNING, POWER, "failed to update metrics\n");
 }
 
 static int
@@ -2532,9 +2540,6 @@ main(int argc, char **argv)
        uint16_t portid;
        const char *ptr_strings[NUM_TELSTATS];
 
-       /* catch SIGINT and restore cpufreq governor to ondemand */
-       signal(SIGINT, signal_exit_now);
-
        /* init EAL */
        ret = rte_eal_init(argc, argv);
        if (ret < 0)
@@ -2542,6 +2547,9 @@ main(int argc, char **argv)
        argc -= ret;
        argv += ret;
 
+       /* catch SIGINT and restore cpufreq governor to ondemand */
+       signal(SIGINT, signal_exit_now);
+
        /* init RTE timer library to be used late */
        rte_timer_subsystem_init();
 
@@ -2652,6 +2660,11 @@ main(int argc, char **argv)
                                local_port_conf.rx_adv_conf.rss_conf.rss_hf);
                }
 
+               if (local_port_conf.rx_adv_conf.rss_conf.rss_hf == 0)
+                       local_port_conf.rxmode.mq_mode = RTE_ETH_MQ_RX_NONE;
+               local_port_conf.rxmode.offloads &= dev_info.rx_offload_capa;
+               port_conf.rxmode.offloads = local_port_conf.rxmode.offloads;
+
                ret = rte_eth_dev_configure(portid, nb_rx_queue,
                                        (uint16_t)n_tx_queue, &local_port_conf);
                if (ret < 0)