mbuf: remove the rte_pktmbuf structure
[dpdk.git] / examples / l3fwd-power / main.c
index 3255900..a9d5c80 100644 (file)
@@ -1,13 +1,13 @@
 /*-
  *   BSD LICENSE
- * 
- *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
  *   All rights reserved.
- * 
+ *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
  *   are met:
- * 
+ *
  *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
  *     * Redistributions in binary form must reproduce the above copyright
@@ -17,7 +17,7 @@
  *     * Neither the name of Intel Corporation nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
- * 
+ *
  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -235,6 +235,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) /
 
 static struct rte_eth_conf port_conf = {
        .rxmode = {
+               .mq_mode        = ETH_MQ_RX_RSS,
                .max_rx_pkt_len = ETHER_MAX_LEN,
                .split_hdr_size = 0,
                .header_split   = 0, /**< Header Split disabled */
@@ -246,7 +247,7 @@ static struct rte_eth_conf port_conf = {
        .rx_adv_conf = {
                .rss_conf = {
                        .rss_key = NULL,
-                       .rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6,
+                       .rss_hf = ETH_RSS_IP,
                },
        },
        .txmode = {
@@ -395,7 +396,7 @@ struct lcore_stats {
        uint64_t nb_rx_processed;
        /* total iterations looped recently */
        uint64_t nb_iteration_looped;
-       uint32_t padding[9]; 
+       uint32_t padding[9];
 } __rte_cache_aligned;
 
 static struct lcore_conf lcore_conf[RTE_MAX_LCORE] __rte_cache_aligned;
@@ -442,7 +443,7 @@ power_timer_cb(__attribute__((unused)) struct rte_timer *tim,
        /* accumulate total execution time in us when callback is invoked */
        sleep_time_ratio = (float)(stats[lcore_id].sleep_time) /
                                        (float)SCALING_PERIOD;
-               
+
        /**
         * check whether need to scale down frequency a step if it sleep a lot.
         */
@@ -686,7 +687,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid,
 
 #ifdef DO_RFC_1812_CHECKS
                /* Check to make sure the packet is valid (RFC1812) */
-               if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+               if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
                        rte_pktmbuf_free(m);
                        return;
                }
@@ -815,7 +816,7 @@ main_loop(__attribute__((unused)) void *dummy)
        struct lcore_conf *qconf;
        struct lcore_rx_queue *rx_queue;
        enum freq_scale_hint_t lcore_scaleup_hint;
-       
+
        uint32_t lcore_rx_idle_count = 0;
        uint32_t lcore_idle_hint = 0;
 
@@ -948,8 +949,8 @@ main_loop(__attribute__((unused)) void *dummy)
                                                lcore_scaleup_hint)
                                        lcore_scaleup_hint =
                                                rx_queue->freq_up_hint;
-                       }       
-               
+                       }
+
                        if (lcore_scaleup_hint == FREQ_HIGHEST)
                                rte_power_freq_max(lcore_id);
                        else if (lcore_scaleup_hint == FREQ_HIGHER)
@@ -1148,7 +1149,7 @@ parse_config(const char *q_arg)
                if(size >= sizeof(s))
                        return -1;
 
-               rte_snprintf(s, sizeof(s), "%.*s", size, p);
+               snprintf(s, sizeof(s), "%.*s", size, p);
                if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') !=
                                                                _NUM_FLD)
                        return -1;
@@ -1228,7 +1229,7 @@ parse_args(int argc, char **argv)
                                printf("numa is disabled \n");
                                numa_on = 0;
                        }
-                       
+
                        if (!strncmp(lgopts[option_index].name,
                                        "enable-jumbo", 12)) {
                                struct option lenopts =
@@ -1237,7 +1238,7 @@ parse_args(int argc, char **argv)
 
                                printf("jumbo frame is enabled \n");
                                port_conf.rxmode.jumbo_frame = 1;
-       
+
                                /**
                                 * if no max-pkt-len set, use the default value
                                 * ETHER_MAX_LEN
@@ -1258,7 +1259,7 @@ parse_args(int argc, char **argv)
                                        "max packet length to %u\n",
                                (unsigned int)port_conf.rxmode.max_rx_pkt_len);
                        }
-                       
+
                        break;
 
                default:
@@ -1314,7 +1315,7 @@ setup_hash(int socketid)
        char s[64];
 
        /* create ipv4 hash */
-       rte_snprintf(s, sizeof(s), "ipv4_l3fwd_hash_%d", socketid);
+       snprintf(s, sizeof(s), "ipv4_l3fwd_hash_%d", socketid);
        ipv4_l3fwd_hash_params.name = s;
        ipv4_l3fwd_hash_params.socket_id = socketid;
        ipv4_l3fwd_lookup_struct[socketid] =
@@ -1324,7 +1325,7 @@ setup_hash(int socketid)
                                "socket %d\n", socketid);
 
        /* create ipv6 hash */
-       rte_snprintf(s, sizeof(s), "ipv6_l3fwd_hash_%d", socketid);
+       snprintf(s, sizeof(s), "ipv6_l3fwd_hash_%d", socketid);
        ipv6_l3fwd_hash_params.name = s;
        ipv6_l3fwd_hash_params.socket_id = socketid;
        ipv6_l3fwd_lookup_struct[socketid] =
@@ -1371,7 +1372,7 @@ setup_lpm(int socketid)
        char s[64];
 
        /* create the LPM table */
-       rte_snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid);
+       snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid);
        ipv4_l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid,
                                IPV4_L3FWD_LPM_MAX_RULES, 0);
        if (ipv4_l3fwd_lookup_struct[socketid] == NULL)
@@ -1422,7 +1423,7 @@ init_mem(unsigned nb_mbuf)
                                                lcore_id, NB_SOCKETS);
                }
                if (pktmbuf_pool[socketid] == NULL) {
-                       rte_snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
+                       snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
                        pktmbuf_pool[socketid] =
                                rte_mempool_create(s, nb_mbuf,
                                        MBUF_SIZE, MEMPOOL_CACHE_SIZE,
@@ -1546,10 +1547,6 @@ MAIN(int argc, char **argv)
                rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
 
 
-       /* init driver(s) */
-       if (rte_pmd_init_all() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
        if (rte_eal_pci_probe() < 0)
                rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");