From 28deb0204bfb22ab0ac5bfaea9912cd33cb13bae Mon Sep 17 00:00:00 2001 From: Huawei Xie Date: Thu, 23 Oct 2014 11:21:13 +0200 Subject: [PATCH] examples/vhost: mergeable buffer option Mergeable feature doesn't work with latest mbuf change. Disabling IXGBE_INC_VECTOR is a temporary workaround. Signed-off-by: Huawei Xie Acked-by: Changchun Ouyang --- examples/vhost/main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 2ff38ab8a5..b2aa7031e1 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -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) -- 2.20.1