#include "main.h"
-#define MAX_QUEUES 256
+#define MAX_QUEUES 512
/* the maximum number of external ports supported */
#define MAX_SUP_PORTS 1
/* The max pool number from dev_info will be used to validate the pool number specified in cmd line */
rte_eth_dev_info_get (port, &dev_info);
+ if (dev_info.max_rx_queues > MAX_QUEUES) {
+ rte_exit(EXIT_FAILURE,
+ "please define MAX_QUEUES no less than %u in %s\n",
+ dev_info.max_rx_queues, __FILE__);
+ }
+
rxconf = &dev_info.default_rxconf;
txconf = &dev_info.default_txconf;
rxconf->rx_drop_en = 1;
+ /* Enable vlan offload */
+ txconf->txq_flags &= ~ETH_TXQ_FLAGS_NOVLANOFFL;
+
/*
* Zero copy defers queue RX/TX start to the time when guest
* finishes its startup and packet buffers from that guest are
return;
}
- if (vm2vm_mode == VM2VM_HARDWARE) {
- if (find_local_dest(dev, m, &offset, &vlan_tag) != 0 ||
- offset > rte_pktmbuf_tailroom(m)) {
+ if (unlikely(vm2vm_mode == VM2VM_HARDWARE)) {
+ if (unlikely(find_local_dest(dev, m, &offset, &vlan_tag) != 0)) {
rte_pktmbuf_free(m);
return;
}
m->ol_flags = PKT_TX_VLAN_PKT;
- m->data_len += offset;
- m->pkt_len += offset;
+ /*
+ * Find the right seg to adjust the data len when offset is
+ * bigger than tail room size.
+ */
+ if (unlikely(vm2vm_mode == VM2VM_HARDWARE)) {
+ if (likely(offset <= rte_pktmbuf_tailroom(m)))
+ m->data_len += offset;
+ else {
+ struct rte_mbuf *seg = m;
+
+ while ((seg->next != NULL) &&
+ (offset > rte_pktmbuf_tailroom(seg)))
+ seg = seg->next;
+
+ seg->data_len += offset;
+ }
+ m->pkt_len += offset;
+ }
m->vlan_tci = vlan_tag;