common/sfc_efx/base: refactor RSS table entry count name
[dpdk.git] / examples / vhost / main.c
index 58e12aa..590a77c 100644 (file)
@@ -107,7 +107,7 @@ static uint32_t burst_rx_retry_num = BURST_RX_RETRIES;
 static char *socket_files;
 static int nb_sockets;
 
-/* empty vmdq configuration structure. Filled in programatically */
+/* empty VMDq configuration structure. Filled in programmatically */
 static struct rte_eth_conf vmdq_conf_default = {
        .rxmode = {
                .mq_mode        = RTE_ETH_MQ_RX_VMDQ_ONLY,
@@ -115,7 +115,7 @@ static struct rte_eth_conf vmdq_conf_default = {
                /*
                 * VLAN strip is necessary for 1G NIC such as I350,
                 * this fixes bug of ipv4 forwarding in guest can't
-                * forward pakets from one virtio dev to another virtio dev.
+                * forward packets from one virtio dev to another virtio dev.
                 */
                .offloads = RTE_ETH_RX_OFFLOAD_VLAN_STRIP,
        },
@@ -195,7 +195,6 @@ struct vhost_bufftable *vhost_txbuff[RTE_MAX_LCORE * MAX_VHOST_DEVICE];
 
 #define MBUF_TABLE_DRAIN_TSC   ((rte_get_tsc_hz() + US_PER_S - 1) \
                                 / US_PER_S * BURST_TX_DRAIN_US)
-#define VLAN_HLEN       4
 
 static inline int
 open_dma(const char *value)
@@ -273,6 +272,13 @@ port_init(uint16_t port)
 
        tx_rings = (uint16_t)rte_lcore_count();
 
+       if (mergeable) {
+               if (dev_info.max_mtu != UINT16_MAX && dev_info.max_rx_pktlen > dev_info.max_mtu)
+                       vmdq_conf_default.rxmode.mtu = dev_info.max_mtu;
+               else
+                       vmdq_conf_default.rxmode.mtu = MAX_MTU;
+       }
+
        /* Get port configuration. */
        retval = get_eth_conf(&port_conf, num_devices);
        if (retval < 0)
@@ -457,7 +463,7 @@ us_vhost_usage(const char *prgname)
        "               --nb-devices ND\n"
        "               -p PORTMASK: Set mask for ports to be used by application\n"
        "               --vm2vm [0|1|2]: disable/software(default)/hardware vm2vm comms\n"
-       "               --rx-retry [0|1]: disable/enable(default) retries on rx. Enable retry if destintation queue is full\n"
+       "               --rx-retry [0|1]: disable/enable(default) retries on Rx. Enable retry if destination queue is full\n"
        "               --rx-retry-delay [0-N]: timeout(in usecond) between retries on RX. This makes effect only if retries on rx enabled\n"
        "               --rx-retry-num [0-N]: the number of retries on rx. This makes effect only if retries on rx enabled\n"
        "               --mergeable [0|1]: disable(default)/enable RX mergeable buffers\n"
@@ -631,8 +637,6 @@ us_vhost_parse_args(int argc, char **argv)
                                return -1;
                        }
                        mergeable = !!ret;
-                       if (ret)
-                               vmdq_conf_default.rxmode.mtu = MAX_MTU;
                        break;
 
                case OPT_STATS_NUM:
@@ -1010,7 +1014,7 @@ find_local_dest(struct vhost_dev *vdev, struct rte_mbuf *m,
         * by minus length of vlan tag, so need restore
         * the packet length by plus it.
         */
-       *offset  = VLAN_HLEN;
+       *offset  = RTE_VLAN_HLEN;
        *vlan_tag = vlan_tags[vdev->vid];
 
        RTE_LOG_DP(DEBUG, VHOST_DATA,
@@ -1285,7 +1289,7 @@ switch_worker(void *arg __rte_unused)
        struct vhost_dev *vdev;
        struct mbuf_table *tx_q;
 
-       RTE_LOG(INFO, VHOST_DATA, "Procesing on Core %u started\n", lcore_id);
+       RTE_LOG(INFO, VHOST_DATA, "Processing on Core %u started\n", lcore_id);
 
        tx_q = &lcore_tx_queue[lcore_id];
        for (i = 0; i < rte_lcore_count(); i++) {
@@ -1329,7 +1333,7 @@ switch_worker(void *arg __rte_unused)
 
 /*
  * Remove a device from the specific data core linked list and from the
- * main linked list. Synchonization  occurs through the use of the
+ * main linked list. Synchronization  occurs through the use of the
  * lcore dev_removal_flag. Device is made volatile here to avoid re-ordering
  * of dev->remove=1 which can cause an infinite loop in the rte_pause loop.
  */
@@ -1519,7 +1523,7 @@ vring_state_changed(int vid, uint16_t queue_id, int enable)
  * These callback allow devices to be added to the data core when configuration
  * has been fully complete.
  */
-static const struct vhost_device_ops virtio_net_device_ops =
+static const struct rte_vhost_device_ops virtio_net_device_ops =
 {
        .new_device =  new_device,
        .destroy_device = destroy_device,