examples/vhost: mergeable buffer option
authorHuawei Xie <huawei.xie@intel.com>
Thu, 23 Oct 2014 09:21:13 +0000 (11:21 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 23 Oct 2014 11:07:36 +0000 (13:07 +0200)
Mergeable feature doesn't work with latest mbuf change.
Disabling IXGBE_INC_VECTOR is a temporary workaround.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
examples/vhost/main.c

index 2ff38ab..b2aa703 100644 (file)
@@ -99,7 +99,6 @@
 #define TX_WTHRESH 0  /* Default values of TX write-back threshold reg. */
 
 #define MAX_PKT_BURST 32               /* Max burst size for RX/TX */
-#define MAX_MRG_PKT_BURST 16   /* Max burst for merge buffers. Set to 1 due to performance issue. */
 #define BURST_TX_DRAIN_US 100  /* TX drain every ~100us */
 
 #define BURST_RX_WAIT_US 15    /* Defines how long we wait between retries on RX */
@@ -174,6 +173,7 @@ uint32_t num_devices = 0;
  * disabled on default.
  */
 static uint32_t zero_copy;
+static int mergeable;
 
 /* number of descriptors to apply*/
 static uint32_t num_rx_descriptor = RTE_TEST_RX_DESC_DEFAULT_ZCP;
@@ -218,9 +218,6 @@ static uint32_t burst_rx_retry_num = BURST_RX_RETRIES;
 static char dev_basename[MAX_BASENAME_SZ] = "vhost-net";
 
 
-/* This can be set by the user so it is made available here. */
-extern uint64_t VHOST_FEATURES;
-
 /* Default configuration for rx and tx thresholds etc. */
 static struct rte_eth_rxconf rx_conf_default = {
        .rx_thresh = {
@@ -673,11 +670,11 @@ us_vhost_parse_args(int argc, char **argv)
                                        us_vhost_usage(prgname);
                                        return -1;
                                } else {
+                                       mergeable = !!ret;
                                        if (ret) {
                                                vmdq_conf_default.rxmode.jumbo_frame = 1;
                                                vmdq_conf_default.rxmode.max_rx_pkt_len
                                                        = JUMBO_FRAME_MAX_SIZE;
-                                               VHOST_FEATURES = (1ULL << VIRTIO_NET_F_MRG_RXBUF);
                                        }
                                }
                        }
@@ -2876,6 +2873,13 @@ MAIN(int argc, char *argv[])
        ret = us_vhost_parse_args(argc, argv);
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "Invalid argument\n");
+#ifdef RTE_IXGBE_INC_VECTOR
+       if (mergeable == 1) {
+               rte_exit(EXIT_FAILURE,
+                       "sorry, mergeable feature doesn't work with vec sg recv, " \
+                       "please disable it in cfg as a workaround\n");
+       }
+#endif
 
        for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
                if (rte_lcore_is_enabled(lcore_id))
@@ -3040,6 +3044,9 @@ MAIN(int argc, char *argv[])
                                lcore_id);
        }
 
+       if (mergeable == 0)
+               rte_vhost_feature_disable(1ULL << VIRTIO_NET_F_MRG_RXBUF);
+
        /* Register CUSE device to handle IOCTLs. */
        ret = rte_vhost_driver_register((char *)&dev_basename);
        if (ret != 0)