ethdev: rename DCB field in config structs
[dpdk.git] / app / test-pmd / testpmd.c
index 4bcece6..4c6aec6 100644 (file)
@@ -298,6 +298,9 @@ struct rte_fdir_conf fdir_conf = {
                },
                .src_port_mask = 0xFFFF,
                .dst_port_mask = 0xFFFF,
+               .mac_addr_byte_mask = 0xFF,
+               .tunnel_type_mask = 1,
+               .tunnel_id_mask = 0xFFFFFFFF,
        },
        .drop_queue = 127,
 };
@@ -313,6 +316,8 @@ struct queue_stats_mappings *rx_queue_stats_mappings = rx_queue_stats_mappings_a
 uint16_t nb_tx_queue_stats_mappings = 0;
 uint16_t nb_rx_queue_stats_mappings = 0;
 
+unsigned max_socket = 0;
+
 /* Forward function declarations */
 static void map_port_queue_stats_mapping_registers(uint8_t pi, struct rte_port *port);
 static void check_all_ports_link_status(uint32_t port_mask);
@@ -345,6 +350,7 @@ set_default_fwd_lcores_config(void)
 {
        unsigned int i;
        unsigned int nb_lc;
+       unsigned int sock_num;
 
        nb_lc = 0;
        for (i = 0; i < RTE_MAX_LCORE; i++) {
@@ -353,6 +359,12 @@ set_default_fwd_lcores_config(void)
                if (i == rte_get_master_lcore())
                        continue;
                fwd_lcores_cpuids[nb_lc++] = i;
+               sock_num = rte_lcore_to_socket_id(i) + 1;
+               if (sock_num > max_socket) {
+                       if (sock_num > RTE_MAX_NUMA_NODES)
+                               rte_exit(EXIT_FAILURE, "Total sockets greater than %u\n", RTE_MAX_NUMA_NODES);
+                       max_socket = sock_num;
+               }
        }
        nb_lcores = (lcoreid_t) nb_lc;
        nb_cfg_lcores = nb_lcores;
@@ -446,7 +458,7 @@ check_socket_id(const unsigned int socket_id)
 {
        static int warning_once = 0;
 
-       if (socket_id >= MAX_SOCKET) {
+       if (socket_id >= max_socket) {
                if (!warning_once && numa_support)
                        printf("Warning: NUMA should be configured manually by"
                               " using --port-numa-config and"
@@ -466,9 +478,9 @@ init_config(void)
        struct rte_mempool *mbp;
        unsigned int nb_mbuf_per_pool;
        lcoreid_t  lc_id;
-       uint8_t port_per_socket[MAX_SOCKET];
+       uint8_t port_per_socket[RTE_MAX_NUMA_NODES];
 
-       memset(port_per_socket,0,MAX_SOCKET);
+       memset(port_per_socket,0,RTE_MAX_NUMA_NODES);
        /* Configuration of logical cores. */
        fwd_lcores = rte_zmalloc("testpmd: fwd_lcores",
                                sizeof(struct fwd_lcore *) * nb_lcores,
@@ -545,7 +557,7 @@ init_config(void)
                if (param_total_num_mbufs)
                        nb_mbuf_per_pool = nb_mbuf_per_pool/nb_ports;
 
-               for (i = 0; i < MAX_SOCKET; i++) {
+               for (i = 0; i < max_socket; i++) {
                        nb_mbuf = (nb_mbuf_per_pool * RTE_MAX_ETHPORTS);
                        if (nb_mbuf)
                                mbuf_pool_create(mbuf_data_size,
@@ -1473,6 +1485,12 @@ close_port(portid_t pid)
                        continue;
 
                port = &ports[pi];
+               if (rte_atomic16_cmpset(&(port->port_status),
+                       RTE_PORT_CLOSED, RTE_PORT_CLOSED) == 1) {
+                       printf("Port %d is already closed\n", pi);
+                       continue;
+               }
+
                if (rte_atomic16_cmpset(&(port->port_status),
                        RTE_PORT_STOPPED, RTE_PORT_HANDLING) == 0) {
                        printf("Port %d is now not stopped\n", pi);
@@ -1860,8 +1878,8 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf)
                        vmdq_rx_conf.pool_map[i].pools = 1 << (i % vmdq_rx_conf.nb_queue_pools);
                }
                for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-                       vmdq_rx_conf.dcb_queue[i] = i;
-                       vmdq_tx_conf.dcb_queue[i] = i;
+                       vmdq_rx_conf.dcb_tc[i] = i;
+                       vmdq_tx_conf.dcb_tc[i] = i;
                }
 
                /*set DCB mode of RX and TX of multiple queues*/
@@ -1891,8 +1909,8 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf)
                tx_conf.nb_tcs = dcb_conf->num_tcs;
 
                for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++){
-                       rx_conf.dcb_queue[i] = i;
-                       tx_conf.dcb_queue[i] = i;
+                       rx_conf.dcb_tc[i] = i;
+                       tx_conf.dcb_tc[i] = i;
                }
                eth_conf->rxmode.mq_mode = ETH_MQ_RX_DCB;
                eth_conf->txmode.mq_mode = ETH_MQ_TX_DCB;