enum item_spec_type type)
{
size_t size = 0;
- const void *item_spec =
+ const void *data =
type == ITEM_SPEC ? item->spec :
type == ITEM_LAST ? item->last :
type == ITEM_MASK ? item->mask :
NULL;
- if (!item_spec)
+ if (!item->spec || !data)
goto empty;
switch (item->type) {
+ union {
+ const struct rte_flow_item_raw *raw;
+ } spec;
+ union {
+ const struct rte_flow_item_raw *raw;
+ } last;
+ union {
+ const struct rte_flow_item_raw *raw;
+ } mask;
union {
const struct rte_flow_item_raw *raw;
} src;
size_t off;
case RTE_FLOW_ITEM_TYPE_RAW:
- src.raw = item_spec;
+ spec.raw = item->spec;
+ last.raw = item->last ? item->last : item->spec;
+ mask.raw = item->mask ? item->mask : &rte_flow_item_raw_mask;
+ src.raw = data;
dst.raw = buf;
off = RTE_ALIGN_CEIL(sizeof(struct rte_flow_item_raw),
sizeof(*src.raw->pattern));
- size = off + ((const struct rte_flow_item_raw *)item->spec)->
- length * sizeof(*src.raw->pattern);
+ if (type == ITEM_SPEC ||
+ (type == ITEM_MASK &&
+ ((spec.raw->length & mask.raw->length) >=
+ (last.raw->length & mask.raw->length))))
+ size = spec.raw->length & mask.raw->length;
+ else
+ size = last.raw->length & mask.raw->length;
+ size = off + size * sizeof(*src.raw->pattern);
if (dst.raw) {
memcpy(dst.raw, src.raw, sizeof(*src.raw));
dst.raw->pattern = memcpy((uint8_t *)dst.raw + off,
default:
size = flow_item[item->type].size;
if (buf)
- memcpy(buf, item_spec, size);
+ memcpy(buf, data, size);
break;
}
empty:
struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0];
uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0];
uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0];
+ uint16_t nb_rx_desc_tmp;
+ uint16_t nb_tx_desc_tmp;
+ struct rte_eth_rxq_info rx_qinfo;
+ struct rte_eth_txq_info tx_qinfo;
+ int32_t rc;
/* per port config */
printf(" port %d: RX queue number: %d Tx queue number: %d\n",
/* per rx queue config only for first queue to be less verbose */
for (qid = 0; qid < 1; qid++) {
+ rc = rte_eth_rx_queue_info_get(pid, qid, &rx_qinfo);
+ if (rc)
+ nb_rx_desc_tmp = nb_rx_desc[qid];
+ else
+ nb_rx_desc_tmp = rx_qinfo.nb_desc;
+
printf(" RX queue: %d\n", qid);
printf(" RX desc=%d - RX free threshold=%d\n",
- nb_rx_desc[qid], rx_conf[qid].rx_free_thresh);
+ nb_rx_desc_tmp, rx_conf[qid].rx_free_thresh);
printf(" RX threshold registers: pthresh=%d hthresh=%d "
" wthresh=%d\n",
rx_conf[qid].rx_thresh.pthresh,
/* per tx queue config only for first queue to be less verbose */
for (qid = 0; qid < 1; qid++) {
+ rc = rte_eth_tx_queue_info_get(pid, qid, &tx_qinfo);
+ if (rc)
+ nb_tx_desc_tmp = nb_tx_desc[qid];
+ else
+ nb_tx_desc_tmp = tx_qinfo.nb_desc;
+
printf(" TX queue: %d\n", qid);
printf(" TX desc=%d - TX free threshold=%d\n",
- nb_tx_desc[qid], tx_conf[qid].tx_free_thresh);
+ nb_tx_desc_tmp, tx_conf[qid].tx_free_thresh);
printf(" TX threshold registers: pthresh=%d hthresh=%d "
" wthresh=%d\n",
tx_conf[qid].tx_thresh.pthresh,