Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
dpdk: Add iova-mode to startup
[vpp.git]
/
src
/
plugins
/
dpdk
/
device
/
dpdk_priv.h
diff --git
a/src/plugins/dpdk/device/dpdk_priv.h
b/src/plugins/dpdk/device/dpdk_priv.h
index
dd40ff4
..
a86a1ab
100644
(file)
--- a/
src/plugins/dpdk/device/dpdk_priv.h
+++ b/
src/plugins/dpdk/device/dpdk_priv.h
@@
-13,9
+13,6
@@
* limitations under the License.
*/
* limitations under the License.
*/
-#define rte_mbuf_from_vlib_buffer(x) (((struct rte_mbuf *)x) - 1)
-#define vlib_buffer_from_rte_mbuf(x) ((vlib_buffer_t *)(x+1))
-
#define DPDK_NB_RX_DESC_DEFAULT 1024
#define DPDK_NB_TX_DESC_DEFAULT 1024
#define DPDK_NB_RX_DESC_VIRTIO 256
#define DPDK_NB_RX_DESC_DEFAULT 1024
#define DPDK_NB_TX_DESC_DEFAULT 1024
#define DPDK_NB_RX_DESC_VIRTIO 256
@@
-44,42
+41,45
@@
_(blacklist, b) \
_(mem-alloc-request, m) \
_(force-ranks, r)
_(mem-alloc-request, m) \
_(force-ranks, r)
-/* These args are prece
e
ded by "--" and followed by a single string */
+/* These args are preceded by "--" and followed by a single string */
#define foreach_eal_double_hyphen_arg \
_(huge-dir) \
_(proc-type) \
_(file-prefix) \
#define foreach_eal_double_hyphen_arg \
_(huge-dir) \
_(proc-type) \
_(file-prefix) \
-_(vdev)
+_(vdev) \
+_(log-level) \
+_(iova-mode)
static inline void
dpdk_get_xstats (dpdk_device_t * xd)
{
static inline void
dpdk_get_xstats (dpdk_device_t * xd)
{
- int len;
- if ((len = rte_eth_xstats_get (xd->device_index, NULL, 0)) > 0)
- {
- vec_validate (xd->xstats, len - 1);
- vec_validate (xd->last_cleared_xstats, len - 1);
+ int len, ret;
- len =
- rte_eth_xstats_get (xd->device_index, xd->xstats,
- vec_len (xd->xstats));
+ if (!(xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP))
+ return;
- ASSERT (vec_len (xd->xstats) == len);
- ASSERT (vec_len (xd->last_cleared_xstats) == len);
+ len = rte_eth_xstats_get (xd->port_id, NULL, 0);
+ if (len < 0)
+ return;
- _vec_len (xd->xstats) = len;
- _vec_len (xd->last_cleared_xstats) = len;
+ vec_validate (xd->xstats, len - 1);
+ ret = rte_eth_xstats_get (xd->port_id, xd->xstats, len);
+ if (ret < 0 || ret > len)
+ {
+ _vec_len (xd->xstats) = 0;
+ return;
}
}
-}
+ _vec_len (xd->xstats) = len;
+}
static inline void
dpdk_update_counters (dpdk_device_t * xd, f64 now)
{
vlib_simple_counter_main_t *cm;
vnet_main_t *vnm = vnet_get_main ();
static inline void
dpdk_update_counters (dpdk_device_t * xd, f64 now)
{
vlib_simple_counter_main_t *cm;
vnet_main_t *vnm = vnet_get_main ();
- u32
my_cpu = os_get_cpu_number
();
+ u32
thread_index = vlib_get_thread_index
();
u64 rxerrors, last_rxerrors;
/* only update counters for PMD interfaces */
u64 rxerrors, last_rxerrors;
/* only update counters for PMD interfaces */
@@
-87,8
+87,8
@@
dpdk_update_counters (dpdk_device_t * xd, f64 now)
return;
xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
return;
xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
- clib_memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
- rte_eth_stats_get (xd->
device_index
, &xd->stats);
+ clib_memcpy
_fast
(&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
+ rte_eth_stats_get (xd->
port_id
, &xd->stats);
/* maybe bump interface rx no buffer counter */
if (PREDICT_FALSE (xd->stats.rx_nombuf != xd->last_stats.rx_nombuf))
/* maybe bump interface rx no buffer counter */
if (PREDICT_FALSE (xd->stats.rx_nombuf != xd->last_stats.rx_nombuf))
@@
-96,7
+96,7
@@
dpdk_update_counters (dpdk_device_t * xd, f64 now)
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_NO_BUF);
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_NO_BUF);
- vlib_increment_simple_counter (cm,
my_cpu, xd->vlib_
sw_if_index,
+ vlib_increment_simple_counter (cm,
thread_index, xd->
sw_if_index,
xd->stats.rx_nombuf -
xd->last_stats.rx_nombuf);
}
xd->stats.rx_nombuf -
xd->last_stats.rx_nombuf);
}
@@
-107,7
+107,7
@@
dpdk_update_counters (dpdk_device_t * xd, f64 now)
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_MISS);
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_MISS);
- vlib_increment_simple_counter (cm,
my_cpu, xd->vlib_
sw_if_index,
+ vlib_increment_simple_counter (cm,
thread_index, xd->
sw_if_index,
xd->stats.imissed -
xd->last_stats.imissed);
}
xd->stats.imissed -
xd->last_stats.imissed);
}
@@
-119,7
+119,7
@@
dpdk_update_counters (dpdk_device_t * xd, f64 now)
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_ERROR);
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_ERROR);
- vlib_increment_simple_counter (cm,
my_cpu, xd->vlib_
sw_if_index,
+ vlib_increment_simple_counter (cm,
thread_index, xd->
sw_if_index,
rxerrors - last_rxerrors);
}
rxerrors - last_rxerrors);
}