ethdev: remove old offload API
[dpdk.git] / examples / qos_meter / main.c
index dc651f6..ca0e9e8 100644 (file)
@@ -56,7 +56,6 @@ static struct rte_eth_conf port_conf = {
                .mq_mode        = ETH_MQ_RX_RSS,
                .max_rx_pkt_len = ETHER_MAX_LEN,
                .split_hdr_size = 0,
-               .ignore_offload_bitfield = 1,
                .offloads = (DEV_RX_OFFLOAD_CHECKSUM |
                             DEV_RX_OFFLOAD_CRC_STRIP),
        },
@@ -71,8 +70,8 @@ static struct rte_eth_conf port_conf = {
        },
 };
 
-#define NIC_RX_QUEUE_DESC               128
-#define NIC_TX_QUEUE_DESC               512
+#define NIC_RX_QUEUE_DESC               1024
+#define NIC_TX_QUEUE_DESC               1024
 
 #define NIC_RX_QUEUE                    0
 #define NIC_TX_QUEUE                    0
@@ -90,14 +89,23 @@ static uint16_t port_tx;
 static struct rte_mbuf *pkts_rx[PKT_RX_BURST_MAX];
 struct rte_eth_dev_tx_buffer *tx_buffer;
 
-struct rte_meter_srtcm_params app_srtcm_params[] = {
-       {.cir = 1000000 * 46,  .cbs = 2048, .ebs = 2048},
+struct rte_meter_srtcm_params app_srtcm_params = {
+       .cir = 1000000 * 46,
+       .cbs = 2048,
+       .ebs = 2048
 };
 
-struct rte_meter_trtcm_params app_trtcm_params[] = {
-       {.cir = 1000000 * 46,  .pir = 1500000 * 46,  .cbs = 2048, .pbs = 2048},
+struct rte_meter_srtcm_profile app_srtcm_profile;
+
+struct rte_meter_trtcm_params app_trtcm_params = {
+       .cir = 1000000 * 46,
+       .pir = 1500000 * 46,
+       .cbs = 2048,
+       .pbs = 2048
 };
 
+struct rte_meter_trtcm_profile app_trtcm_profile;
+
 #define APP_FLOWS_MAX  256
 
 FLOW_METER app_flows[APP_FLOWS_MAX];
@@ -105,12 +113,21 @@ FLOW_METER app_flows[APP_FLOWS_MAX];
 static int
 app_configure_flow_table(void)
 {
-       uint32_t i, j;
+       uint32_t i;
        int ret;
 
-       for (i = 0, j = 0; i < APP_FLOWS_MAX;
-                       i ++, j = (j + 1) % RTE_DIM(PARAMS)) {
-               ret = FUNC_CONFIG(&app_flows[i], &PARAMS[j]);
+       ret = rte_meter_srtcm_profile_config(&app_srtcm_profile,
+               &app_srtcm_params);
+       if (ret)
+               return ret;
+
+       ret = rte_meter_trtcm_profile_config(&app_trtcm_profile,
+               &app_trtcm_params);
+       if (ret)
+               return ret;
+
+       for (i = 0; i < APP_FLOWS_MAX; i++) {
+               ret = FUNC_CONFIG(&app_flows[i], &PROFILE);
                if (ret)
                        return ret;
        }
@@ -135,7 +152,10 @@ app_pkt_handle(struct rte_mbuf *pkt, uint64_t time)
        enum policer_action action;
 
        /* color input is not used for blind modes */
-       output_color = (uint8_t) FUNC_METER(&app_flows[flow_id], time, pkt_len,
+       output_color = (uint8_t) FUNC_METER(&app_flows[flow_id],
+               &PROFILE,
+               time,
+               pkt_len,
                (enum rte_meter_color) input_color);
 
        /* Apply policing and set the output color */
@@ -330,7 +350,6 @@ main(int argc, char **argv)
                rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_rx, ret);
 
        txq_conf = dev_info.default_txconf;
-       txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE;
        txq_conf.offloads = conf.txmode.offloads;
        ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, nb_txd,
                                rte_eth_dev_socket_id(port_rx),
@@ -362,7 +381,6 @@ main(int argc, char **argv)
                rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_tx, ret);
 
        txq_conf = dev_info.default_txconf;
-       txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE;
        txq_conf.offloads = conf.txmode.offloads;
        ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, nb_txd,
                                rte_eth_dev_socket_id(port_tx),