git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ethdev: increase port id range
[dpdk.git]
/
examples
/
quota_watermark
/
qw
/
main.c
diff --git
a/examples/quota_watermark/qw/main.c
b/examples/quota_watermark/qw/main.c
index
2dcddea
..
e5ecdb1
100644
(file)
--- a/
examples/quota_watermark/qw/main.c
+++ b/
examples/quota_watermark/qw/main.c
@@
-67,6
+67,7
@@
struct ether_fc_frame {
int *quota;
unsigned int *low_watermark;
int *quota;
unsigned int *low_watermark;
+unsigned int *high_watermark;
uint8_t port_pairs[RTE_MAX_ETHPORTS];
uint8_t port_pairs[RTE_MAX_ETHPORTS];
@@
-154,10
+155,11
@@
receive_stage(__attribute__((unused)) void *args)
{
int i, ret;
{
int i, ret;
- uint
8
_t port_id;
+ uint
16
_t port_id;
uint16_t nb_rx_pkts;
unsigned int lcore_id;
uint16_t nb_rx_pkts;
unsigned int lcore_id;
+ unsigned int free;
struct rte_mbuf *pkts[MAX_PKT_QUOTA];
struct rte_ring *ring;
struct rte_mbuf *pkts[MAX_PKT_QUOTA];
struct rte_ring *ring;
@@
-189,13
+191,13
@@
receive_stage(__attribute__((unused)) void *args)
nb_rx_pkts = rte_eth_rx_burst(port_id, 0, pkts,
(uint16_t) *quota);
ret = rte_ring_enqueue_bulk(ring, (void *) pkts,
nb_rx_pkts = rte_eth_rx_burst(port_id, 0, pkts,
(uint16_t) *quota);
ret = rte_ring_enqueue_bulk(ring, (void *) pkts,
- nb_rx_pkts);
- if (
ret == -EDQUOT
) {
+ nb_rx_pkts
, &free
);
+ if (
RING_SIZE - free > *high_watermark
) {
ring_state[port_id] = RING_OVERLOADED;
send_pause_frame(port_id, 1337);
}
ring_state[port_id] = RING_OVERLOADED;
send_pause_frame(port_id, 1337);
}
-
else if (ret == -ENOBUFS
) {
+
if (ret == 0
) {
/*
* Return mbufs to the pool,
/*
* Return mbufs to the pool,
@@
-214,9
+216,10
@@
pipeline_stage(__attribute__((unused)) void *args)
int i, ret;
int nb_dq_pkts;
int i, ret;
int nb_dq_pkts;
- uint
8
_t port_id;
+ uint
16
_t port_id;
unsigned int lcore_id, previous_lcore_id;
unsigned int lcore_id, previous_lcore_id;
+ unsigned int free;
void *pkts[MAX_PKT_QUOTA];
struct rte_ring *rx, *tx;
void *pkts[MAX_PKT_QUOTA];
struct rte_ring *rx, *tx;
@@
-253,11
+256,12
@@
pipeline_stage(__attribute__((unused)) void *args)
continue;
/* Enqueue them on tx */
continue;
/* Enqueue them on tx */
- ret = rte_ring_enqueue_bulk(tx, pkts, nb_dq_pkts);
- if (ret == -EDQUOT)
+ ret = rte_ring_enqueue_bulk(tx, pkts,
+ nb_dq_pkts, &free);
+ if (RING_SIZE - free > *high_watermark)
ring_state[port_id] = RING_OVERLOADED;
ring_state[port_id] = RING_OVERLOADED;
-
else if (ret == -ENOBUFS
) {
+
if (ret == 0
) {
/*
* Return mbufs to the pool,
/*
* Return mbufs to the pool,
@@
-275,8
+279,8
@@
send_stage(__attribute__((unused)) void *args)
{
uint16_t nb_dq_pkts;
{
uint16_t nb_dq_pkts;
- uint
8
_t port_id;
- uint
8
_t dest_port_id;
+ uint
16
_t port_id;
+ uint
16
_t dest_port_id;
unsigned int lcore_id, previous_lcore_id;
unsigned int lcore_id, previous_lcore_id;
@@
-320,9
+324,9
@@
main(int argc, char **argv)
int ret;
unsigned int lcore_id, master_lcore_id, last_lcore_id;
int ret;
unsigned int lcore_id, master_lcore_id, last_lcore_id;
- uint
8
_t port_id;
+ uint
16
_t port_id;
- rte_
set_log
_level(RTE_LOG_INFO);
+ rte_
log_set_global
_level(RTE_LOG_INFO);
ret = rte_eal_init(argc, argv);
if (ret < 0)
ret = rte_eal_init(argc, argv);
if (ret < 0)