doc: whitespace changes in licenses
[dpdk.git] / examples / vmdq_dcb / main.c
index edef160..67c6e88 100644 (file)
@@ -1,35 +1,34 @@
 /*-
  *   BSD LICENSE
  * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2013 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 
+ *   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 
+ *     * 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 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided with the 
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
  *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its 
- *       contributors may be used to endorse or promote products derived 
+ *     * 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 
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ *   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
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
  */
 
 #include <stdint.h>
@@ -74,9 +73,6 @@
 #include "main.h"
 
 /* basic constants used in application */
-#define SOCKET0 0
-#define SOCKET1 1
-
 #define NUM_QUEUES 128
 
 #define NUM_MBUFS 64*1024
@@ -122,7 +118,7 @@ static const struct rte_eth_txconf tx_conf_default = {
 /* empty vmdq+dcb configuration structure. Filled in programatically */
 static const struct rte_eth_conf vmdq_dcb_conf_default = {
        .rxmode = {
-               .mq_mode        = ETH_VMDQ_DCB,
+               .mq_mode        = ETH_MQ_RX_VMDQ_DCB,
                .split_hdr_size = 0,
                .header_split   = 0, /**< Header Split disabled */
                .hw_ip_checksum = 0, /**< IP checksum offload disabled */
@@ -130,7 +126,7 @@ static const struct rte_eth_conf vmdq_dcb_conf_default = {
                .jumbo_frame    = 0, /**< Jumbo Frame Support disabled */
        },
        .txmode = {
-               .mq_mode = ETH_DCB_NONE,
+               .mq_mode = ETH_MQ_TX_NONE,
        },
        .rx_adv_conf = {
                /*
@@ -211,7 +207,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 
        for (q = 0; q < rxRings; q ++) {
                retval = rte_eth_rx_queue_setup(port, q, rxRingSize,
-                                               SOCKET0, &rx_conf_default,
+                                               rte_eth_dev_socket_id(port), &rx_conf_default,
                                                mbuf_pool);
                if (retval < 0)
                        return retval;
@@ -219,7 +215,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 
        for (q = 0; q < txRings; q ++) {
                retval = rte_eth_tx_queue_setup(port, q, txRingSize,
-                                               SOCKET0, &tx_conf_default);
+                                               rte_eth_dev_socket_id(port), &tx_conf_default);
                if (retval < 0)
                        return retval;
        }
@@ -228,6 +224,14 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
        if (retval < 0)
                return retval;
 
+       struct ether_addr addr;
+       rte_eth_macaddr_get(port, &addr);
+       printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
+                       " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
+                       (unsigned)port,
+                       addr.addr_bytes[0], addr.addr_bytes[1], addr.addr_bytes[2],
+                       addr.addr_bytes[3], addr.addr_bytes[4], addr.addr_bytes[5]);
+
        return 0;
 }
 
@@ -388,7 +392,7 @@ MAIN(int argc, char *argv[])
                                       sizeof(struct rte_pktmbuf_pool_private),
                                       rte_pktmbuf_pool_init, NULL,
                                       rte_pktmbuf_init, NULL,
-                                      SOCKET0, 0);
+                                      rte_socket_id(), 0);
        if (mbuf_pool == NULL)
                rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");