net/mvpp2: support traffic manager

Add traffic manager support.

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
This commit is contained in:
Tomasz Duszynski 2018-09-25 09:05:02 +02:00 committed by Ferruh Yigit
parent a1f83becf9
commit 429c394417
6 changed files with 1084 additions and 1 deletions

View File

@ -40,5 +40,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mrvl_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mrvl_qos.c
SRCS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mrvl_flow.c
SRCS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mrvl_mtr.c
SRCS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mrvl_tm.c
include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -20,7 +20,8 @@ sources = files(
'mrvl_ethdev.c',
'mrvl_flow.c',
'mrvl_qos.c',
'mrvl_mtr.c'
'mrvl_mtr.c',
'mrvl_tm.c'
)
deps += ['cfgfile', 'common_mvep']

View File

@ -25,6 +25,7 @@
#include "mrvl_qos.h"
#include "mrvl_flow.h"
#include "mrvl_mtr.h"
#include "mrvl_tm.h"
/* bitmask with reserved hifs */
#define MRVL_MUSDK_HIFS_RESERVED 0x0F
@ -331,6 +332,10 @@ mrvl_dev_configure(struct rte_eth_dev *dev)
priv->ppio_params.maintain_stats = 1;
priv->nb_rx_queues = dev->data->nb_rx_queues;
ret = mrvl_tm_init(dev);
if (ret < 0)
return ret;
if (dev->data->nb_rx_queues == 1 &&
dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) {
MRVL_LOG(WARNING, "Disabling hash for 1 rx queue");
@ -785,6 +790,7 @@ mrvl_dev_close(struct rte_eth_dev *dev)
}
mrvl_flush_bpool(dev);
mrvl_tm_deinit(dev);
if (priv->ppio) {
pp2_ppio_deinit(priv->ppio);
@ -1884,6 +1890,25 @@ mrvl_mtr_ops_get(struct rte_eth_dev *dev __rte_unused, void *ops)
return 0;
}
/**
* DPDK callback to get rte_tm callbacks.
*
* @param dev
* Pointer to the device structure.
* @param ops
* Pointer to pass the tm ops.
*
* @return
* Always 0.
*/
static int
mrvl_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *ops)
{
*(const void **)ops = &mrvl_tm_ops;
return 0;
}
static const struct eth_dev_ops mrvl_ops = {
.dev_configure = mrvl_dev_configure,
.dev_start = mrvl_dev_start,
@ -1922,6 +1947,7 @@ static const struct eth_dev_ops mrvl_ops = {
.rss_hash_conf_get = mrvl_rss_hash_conf_get,
.filter_ctrl = mrvl_eth_filter_ctrl,
.mtr_ops_get = mrvl_mtr_ops_get,
.tm_ops_get = mrvl_tm_ops_get,
};
/**

View File

@ -10,6 +10,7 @@
#include <rte_spinlock.h>
#include <rte_flow_driver.h>
#include <rte_mtr_driver.h>
#include <rte_tm_driver.h>
/*
* container_of is defined by both DPDK and MUSDK,
@ -134,6 +135,29 @@ struct mrvl_mtr {
struct pp2_cls_plcr *plcr;
};
struct mrvl_tm_shaper_profile {
LIST_ENTRY(mrvl_tm_shaper_profile) next;
uint32_t id;
int refcnt;
struct rte_tm_shaper_params params;
};
enum {
MRVL_NODE_PORT,
MRVL_NODE_QUEUE,
};
struct mrvl_tm_node {
LIST_ENTRY(mrvl_tm_node) next;
uint32_t id;
uint32_t type;
int refcnt;
struct mrvl_tm_node *parent;
struct mrvl_tm_shaper_profile *profile;
uint8_t weight;
uint64_t stats_mask;
};
struct mrvl_priv {
/* Hot fields, used in fast path. */
struct pp2_bpool *bpool; /**< BPool pointer */
@ -173,6 +197,10 @@ struct mrvl_priv {
LIST_HEAD(profiles, mrvl_mtr_profile) profiles;
LIST_HEAD(mtrs, mrvl_mtr) mtrs;
uint32_t used_plcrs;
LIST_HEAD(shaper_profiles, mrvl_tm_shaper_profile) shaper_profiles;
LIST_HEAD(nodes, mrvl_tm_node) nodes;
uint64_t rate_max;
};
/** Flow operations forward declaration. */
@ -181,6 +209,9 @@ extern const struct rte_flow_ops mrvl_flow_ops;
/** Meter operations forward declaration. */
extern const struct rte_mtr_ops mrvl_mtr_ops;
/** Traffic manager operations forward declaration. */
extern const struct rte_tm_ops mrvl_tm_ops;
/** Current log type. */
extern int mrvl_logtype;

1009
drivers/net/mvpp2/mrvl_tm.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018 Marvell International Ltd.
* Copyright(c) 2018 Semihalf.
* All rights reserved.
*/
#ifndef _MRVL_TM_H_
#define _MRVL_TM_H_
#include "mrvl_ethdev.h"
int mrvl_tm_init(struct rte_eth_dev *dev);
void mrvl_tm_deinit(struct rte_eth_dev *dev);
#endif /* _MRVL_TM_H_ */