net/octeontx: support event Rx adapter

Add functions to modify and delete qos responsible for mapping eth queues
to event queues used for configuring event Rx adapter.
The mbox functions have been moved from octeontx_pkivf.c to
octeontx_pkivf.h to allow event_octeontx to access them.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
This commit is contained in:
Pavan Nikhilesh 2017-10-24 18:30:35 +05:30 committed by Jerin Jacob
parent 49ccbfb634
commit d0d6549860
8 changed files with 250 additions and 178 deletions

View File

@ -39,6 +39,7 @@ LIB = librte_pmd_octeontx_ssovf.a
CFLAGS += $(WERROR_FLAGS) CFLAGS += $(WERROR_FLAGS)
CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/
CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/
LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx

View File

@ -38,6 +38,7 @@
#include <rte_io.h> #include <rte_io.h>
#include <octeontx_mbox.h> #include <octeontx_mbox.h>
#include <octeontx_ethdev.h>
#define EVENTDEV_NAME_OCTEONTX_PMD event_octeontx #define EVENTDEV_NAME_OCTEONTX_PMD event_octeontx

View File

@ -34,9 +34,11 @@
#include <rte_common.h> #include <rte_common.h>
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include "ssovf_evdev.h"
#include <octeontx_mbox.h> #include <octeontx_mbox.h>
#include "ssovf_evdev.h"
#include "octeontx_rxtx.h"
enum { enum {
SSO_SYNC_ORDERED, SSO_SYNC_ORDERED,
SSO_SYNC_ATOMIC, SSO_SYNC_ATOMIC,
@ -50,6 +52,28 @@ enum {
/* SSO Operations */ /* SSO Operations */
static __rte_always_inline struct rte_mbuf *
ssovf_octeontx_wqe_to_pkt(uint64_t work, uint16_t port_id)
{
struct rte_mbuf *mbuf;
octtx_wqe_t *wqe = (octtx_wqe_t *)(uintptr_t)work;
rte_prefetch_non_temporal(wqe);
/* Get mbuf from wqe */
mbuf = (struct rte_mbuf *)((uintptr_t)wqe -
OCTTX_PACKET_WQE_SKIP);
mbuf->packet_type =
ptype_table[wqe->s.w2.lcty][wqe->s.w2.lety][wqe->s.w2.lfty];
mbuf->data_off = RTE_PTR_DIFF(wqe->s.w3.addr, mbuf->buf_addr);
mbuf->pkt_len = wqe->s.w1.len;
mbuf->data_len = mbuf->pkt_len;
mbuf->nb_segs = 1;
mbuf->ol_flags = 0;
mbuf->port = port_id;
rte_mbuf_refcnt_set(mbuf, 1);
return mbuf;
}
static __rte_always_inline uint16_t static __rte_always_inline uint16_t
ssows_get_work(struct ssows *ws, struct rte_event *ev) ssows_get_work(struct ssows *ws, struct rte_event *ev)
{ {
@ -62,9 +86,14 @@ ssows_get_work(struct ssows *ws, struct rte_event *ev)
ws->cur_tt = sched_type_queue & 0x3; ws->cur_tt = sched_type_queue & 0x3;
ws->cur_grp = sched_type_queue >> 2; ws->cur_grp = sched_type_queue >> 2;
sched_type_queue = sched_type_queue << 38; sched_type_queue = sched_type_queue << 38;
ev->event = sched_type_queue | (get_work0 & 0xffffffff); ev->event = sched_type_queue | (get_work0 & 0xffffffff);
if (get_work1 && ev->event_type == RTE_EVENT_TYPE_ETHDEV) {
ev->mbuf = ssovf_octeontx_wqe_to_pkt(get_work1,
(ev->event >> 20) & 0xF);
} else {
ev->u64 = get_work1; ev->u64 = get_work1;
}
return !!get_work1; return !!get_work1;
} }

View File

@ -111,71 +111,6 @@ octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg)
return res; return res;
} }
int
octeontx_pki_port_close(int port)
{
struct octeontx_mbox_hdr hdr;
int res;
mbox_pki_port_t ptype;
int len = sizeof(mbox_pki_port_t);
memset(&ptype, 0, len);
ptype.port_type = OCTTX_PORT_TYPE_NET;
hdr.coproc = OCTEONTX_PKI_COPROC;
hdr.msg = MBOX_PKI_PORT_CLOSE;
hdr.vfid = port;
res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0);
if (res < 0)
return -EACCES;
return res;
}
int
octeontx_pki_port_start(int port)
{
struct octeontx_mbox_hdr hdr;
int res;
mbox_pki_port_t ptype;
int len = sizeof(mbox_pki_port_t);
memset(&ptype, 0, len);
ptype.port_type = OCTTX_PORT_TYPE_NET;
hdr.coproc = OCTEONTX_PKI_COPROC;
hdr.msg = MBOX_PKI_PORT_START;
hdr.vfid = port;
res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0);
if (res < 0)
return -EACCES;
return res;
}
int
octeontx_pki_port_stop(int port)
{
struct octeontx_mbox_hdr hdr;
int res;
mbox_pki_port_t ptype;
int len = sizeof(mbox_pki_port_t);
memset(&ptype, 0, len);
ptype.port_type = OCTTX_PORT_TYPE_NET;
hdr.coproc = OCTEONTX_PKI_COPROC;
hdr.msg = MBOX_PKI_PORT_STOP;
hdr.vfid = port;
res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0);
if (res < 0)
return -EACCES;
return res;
}
int int
octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg) octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg)

View File

@ -240,10 +240,18 @@ typedef struct mbox_pki_port_modify_qos_entry {
uint8_t f_gaura:1; uint8_t f_gaura:1;
uint8_t f_grptag_ok:1; uint8_t f_grptag_ok:1;
uint8_t f_grptag_bad:1; uint8_t f_grptag_bad:1;
uint8_t f_tag_type:1;
} mmask; } mmask;
uint8_t tag_type;
struct mbox_pki_qos_entry qos_entry; struct mbox_pki_qos_entry qos_entry;
} mbox_pki_mod_qos_t; } mbox_pki_mod_qos_t;
/* pki flow/style enable qos */
typedef struct mbox_pki_port_delete_qos_entry {
uint8_t port_type;
uint16_t index;
} mbox_pki_del_qos_t;
/* PKI maximum constants */ /* PKI maximum constants */
#define PKI_VF_MAX (1) #define PKI_VF_MAX (1)
#define PKI_MAX_PKTLEN (32768) #define PKI_MAX_PKTLEN (32768)
@ -406,6 +414,12 @@ typedef struct pki_port_create_qos {
struct pki_qos_entry qos_entry[PKO_MAX_QOS_ENTRY]; struct pki_qos_entry qos_entry[PKO_MAX_QOS_ENTRY];
} pki_qos_cfg_t; } pki_qos_cfg_t;
/* pki flow/style enable qos */
typedef struct pki_port_delete_qos_entry {
uint8_t port_type;
uint16_t index;
} pki_del_qos_t;
/* pki flow/style enable qos */ /* pki flow/style enable qos */
typedef struct pki_port_modify_qos_entry { typedef struct pki_port_modify_qos_entry {
uint8_t port_type; uint8_t port_type;
@ -415,17 +429,125 @@ typedef struct pki_port_modify_qos_entry {
uint8_t f_grp_ok:1; uint8_t f_grp_ok:1;
uint8_t f_grp_bad:1; uint8_t f_grp_bad:1;
uint8_t f_gaura:1; uint8_t f_gaura:1;
uint8_t f_grptag_ok:1;
uint8_t f_grptag_bad:1;
uint8_t f_tag_type:1;
} mmask; } mmask;
uint8_t tag_type;
struct pki_qos_entry qos_entry; struct pki_qos_entry qos_entry;
} pki_mod_qos_t; } pki_mod_qos_t;
static inline int
octeontx_pki_port_modify_qos(int port, pki_mod_qos_t *qos_cfg)
{
struct octeontx_mbox_hdr hdr;
int res;
mbox_pki_mod_qos_t q_cfg = *(mbox_pki_mod_qos_t *)qos_cfg;
int len = sizeof(mbox_pki_mod_qos_t);
hdr.coproc = OCTEONTX_PKI_COPROC;
hdr.msg = MBOX_PKI_PORT_MODIFY_QOS;
hdr.vfid = port;
res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0);
if (res < 0)
return -EACCES;
return res;
}
static inline int
octeontx_pki_port_delete_qos(int port, pki_del_qos_t *qos_cfg)
{
struct octeontx_mbox_hdr hdr;
int res;
mbox_pki_del_qos_t q_cfg = *(mbox_pki_del_qos_t *)qos_cfg;
int len = sizeof(mbox_pki_del_qos_t);
hdr.coproc = OCTEONTX_PKI_COPROC;
hdr.msg = MBOX_PKI_PORT_DELETE_QOS;
hdr.vfid = port;
res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0);
if (res < 0)
return -EACCES;
return res;
}
static inline int
octeontx_pki_port_close(int port)
{
struct octeontx_mbox_hdr hdr;
int res;
mbox_pki_port_t ptype;
int len = sizeof(mbox_pki_port_t);
memset(&ptype, 0, len);
ptype.port_type = OCTTX_PORT_TYPE_NET;
hdr.coproc = OCTEONTX_PKI_COPROC;
hdr.msg = MBOX_PKI_PORT_CLOSE;
hdr.vfid = port;
res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0);
if (res < 0)
return -EACCES;
return res;
}
static inline int
octeontx_pki_port_start(int port)
{
struct octeontx_mbox_hdr hdr;
int res;
mbox_pki_port_t ptype;
int len = sizeof(mbox_pki_port_t);
memset(&ptype, 0, len);
ptype.port_type = OCTTX_PORT_TYPE_NET;
hdr.coproc = OCTEONTX_PKI_COPROC;
hdr.msg = MBOX_PKI_PORT_START;
hdr.vfid = port;
res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0);
if (res < 0)
return -EACCES;
return res;
}
static inline int
octeontx_pki_port_stop(int port)
{
struct octeontx_mbox_hdr hdr;
int res;
mbox_pki_port_t ptype;
int len = sizeof(mbox_pki_port_t);
memset(&ptype, 0, len);
ptype.port_type = OCTTX_PORT_TYPE_NET;
hdr.coproc = OCTEONTX_PKI_COPROC;
hdr.msg = MBOX_PKI_PORT_STOP;
hdr.vfid = port;
res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0);
if (res < 0)
return -EACCES;
return res;
}
int octeontx_pki_port_open(int port); int octeontx_pki_port_open(int port);
int octeontx_pki_port_hash_config(int port, pki_hash_cfg_t *hash_cfg); int octeontx_pki_port_hash_config(int port, pki_hash_cfg_t *hash_cfg);
int octeontx_pki_port_pktbuf_config(int port, pki_pktbuf_cfg_t *buf_cfg); int octeontx_pki_port_pktbuf_config(int port, pki_pktbuf_cfg_t *buf_cfg);
int octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg); int octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg);
int octeontx_pki_port_close(int port); int octeontx_pki_port_close(int port);
int octeontx_pki_port_start(int port);
int octeontx_pki_port_stop(int port);
int octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg); int octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg);
#endif /* __OCTEONTX_PKI_H__ */ #endif /* __OCTEONTX_PKI_H__ */

View File

@ -930,6 +930,7 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
pki_hash.tag_slc = 1; pki_hash.tag_slc = 1;
pki_hash.tag_dlf = 1; pki_hash.tag_dlf = 1;
pki_hash.tag_slf = 1; pki_hash.tag_slf = 1;
pki_hash.tag_prt = 1;
octeontx_pki_port_hash_config(port, &pki_hash); octeontx_pki_port_hash_config(port, &pki_hash);
} }
@ -941,7 +942,7 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
pki_qos.qpg_qos = PKI_QPG_QOS_NONE; pki_qos.qpg_qos = PKI_QPG_QOS_NONE;
pki_qos.num_entry = 1; pki_qos.num_entry = 1;
pki_qos.drop_policy = 0; pki_qos.drop_policy = 0;
pki_qos.tag_type = 2L; pki_qos.tag_type = 0L;
pki_qos.qos_entry[0].port_add = 0; pki_qos.qos_entry[0].port_add = 0;
pki_qos.qos_entry[0].gaura = gaura; pki_qos.qos_entry[0].gaura = gaura;
pki_qos.qos_entry[0].ggrp_ok = ev_queues; pki_qos.qos_entry[0].ggrp_ok = ev_queues;

View File

@ -47,94 +47,6 @@
#include "octeontx_rxtx.h" #include "octeontx_rxtx.h"
#include "octeontx_logs.h" #include "octeontx_logs.h"
/* Packet type table */
#define PTYPE_SIZE OCCTX_PKI_LTYPE_LAST
static const uint32_t __rte_cache_aligned
ptype_table[PTYPE_SIZE][PTYPE_SIZE][PTYPE_SIZE] = {
[LC_NONE][LE_NONE][LF_NONE] = RTE_PTYPE_UNKNOWN,
[LC_NONE][LE_NONE][LF_IPSEC_ESP] = RTE_PTYPE_UNKNOWN,
[LC_NONE][LE_NONE][LF_IPFRAG] = RTE_PTYPE_L4_FRAG,
[LC_NONE][LE_NONE][LF_IPCOMP] = RTE_PTYPE_UNKNOWN,
[LC_NONE][LE_NONE][LF_TCP] = RTE_PTYPE_L4_TCP,
[LC_NONE][LE_NONE][LF_UDP] = RTE_PTYPE_L4_UDP,
[LC_NONE][LE_NONE][LF_GRE] = RTE_PTYPE_TUNNEL_GRE,
[LC_NONE][LE_NONE][LF_UDP_GENEVE] = RTE_PTYPE_TUNNEL_GENEVE,
[LC_NONE][LE_NONE][LF_UDP_VXLAN] = RTE_PTYPE_TUNNEL_VXLAN,
[LC_NONE][LE_NONE][LF_NVGRE] = RTE_PTYPE_TUNNEL_NVGRE,
[LC_IPV4][LE_NONE][LF_NONE] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_UNKNOWN,
[LC_IPV4][LE_NONE][LF_IPSEC_ESP] =
RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L3_IPV4,
[LC_IPV4][LE_NONE][LF_IPFRAG] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_FRAG,
[LC_IPV4][LE_NONE][LF_IPCOMP] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_UNKNOWN,
[LC_IPV4][LE_NONE][LF_TCP] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP,
[LC_IPV4][LE_NONE][LF_UDP] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP,
[LC_IPV4][LE_NONE][LF_GRE] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_GRE,
[LC_IPV4][LE_NONE][LF_UDP_GENEVE] =
RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_GENEVE,
[LC_IPV4][LE_NONE][LF_UDP_VXLAN] =
RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_VXLAN,
[LC_IPV4][LE_NONE][LF_NVGRE] =
RTE_PTYPE_L3_IPV4 | RTE_PTYPE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YPE_L3_IPV6_EXT | RTE_PTYPE_TUNNEL_VXLAN,
[LC_IPV6_OPT][LE_NONE][LF_NVGRE] =
RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_TUNNEL_NVGRE,
};
static __rte_always_inline uint16_t __hot static __rte_always_inline uint16_t __hot
__octeontx_xmit_pkts(void *lmtline_va, void *ioreg_va, int64_t *fc_status_va, __octeontx_xmit_pkts(void *lmtline_va, void *ioreg_va, int64_t *fc_status_va,
@ -195,10 +107,8 @@ octeontx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
uint16_t __hot uint16_t __hot
octeontx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) octeontx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{ {
struct rte_mbuf *mbuf;
struct octeontx_rxq *rxq; struct octeontx_rxq *rxq;
struct rte_event ev; struct rte_event ev;
octtx_wqe_t *wqe;
size_t count; size_t count;
uint16_t valid_event; uint16_t valid_event;
@ -210,23 +120,7 @@ octeontx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
1, 0); 1, 0);
if (!valid_event) if (!valid_event)
break; break;
rx_pkts[count++] = ev.mbuf;
wqe = (octtx_wqe_t *)(uintptr_t)ev.u64;
rte_prefetch_non_temporal(wqe);
/* Get mbuf from wqe */
mbuf = (struct rte_mbuf *)((uintptr_t)wqe -
OCTTX_PACKET_WQE_SKIP);
mbuf->packet_type =
ptype_table[wqe->s.w2.lcty][wqe->s.w2.lety][wqe->s.w2.lfty];
mbuf->data_off = RTE_PTR_DIFF(wqe->s.w3.addr, mbuf->buf_addr);
mbuf->pkt_len = wqe->s.w1.len;
mbuf->data_len = mbuf->pkt_len;
mbuf->nb_segs = 1;
mbuf->ol_flags = 0;
mbuf->port = rxq->port_id;
rte_mbuf_refcnt_set(mbuf, 1);
rx_pkts[count++] = mbuf;
} }
return count; /* return number of pkts received */ return count; /* return number of pkts received */

View File

@ -39,6 +39,95 @@
#define __hot __attribute__((hot)) #define __hot __attribute__((hot))
#endif #endif
/* Packet type table */
#define PTYPE_SIZE OCCTX_PKI_LTYPE_LAST
static const uint32_t __rte_cache_aligned
ptype_table[PTYPE_SIZE][PTYPE_SIZE][PTYPE_SIZE] = {
[LC_NONE][LE_NONE][LF_NONE] = RTE_PTYPE_UNKNOWN,
[LC_NONE][LE_NONE][LF_IPSEC_ESP] = RTE_PTYPE_UNKNOWN,
[LC_NONE][LE_NONE][LF_IPFRAG] = RTE_PTYPE_L4_FRAG,
[LC_NONE][LE_NONE][LF_IPCOMP] = RTE_PTYPE_UNKNOWN,
[LC_NONE][LE_NONE][LF_TCP] = RTE_PTYPE_L4_TCP,
[LC_NONE][LE_NONE][LF_UDP] = RTE_PTYPE_L4_UDP,
[LC_NONE][LE_NONE][LF_GRE] = RTE_PTYPE_TUNNEL_GRE,
[LC_NONE][LE_NONE][LF_UDP_GENEVE] = RTE_PTYPE_TUNNEL_GENEVE,
[LC_NONE][LE_NONE][LF_UDP_VXLAN] = RTE_PTYPE_TUNNEL_VXLAN,
[LC_NONE][LE_NONE][LF_NVGRE] = RTE_PTYPE_TUNNEL_NVGRE,
[LC_IPV4][LE_NONE][LF_NONE] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_UNKNOWN,
[LC_IPV4][LE_NONE][LF_IPSEC_ESP] =
RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L3_IPV4,
[LC_IPV4][LE_NONE][LF_IPFRAG] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_FRAG,
[LC_IPV4][LE_NONE][LF_IPCOMP] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_UNKNOWN,
[LC_IPV4][LE_NONE][LF_TCP] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP,
[LC_IPV4][LE_NONE][LF_UDP] = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP,
[LC_IPV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_IPV6_OPT][LE_NONE][LF_UDP] =
RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L4_UDP,
[LC_IPV6_OPT][LE_NONE][LF_GRE] =
RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_TUNNEL_GRE,
[LC_IPV6_OPT][LE_NONE][LF_UDP_GENEVE] =
RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_TUNNEL_GENEVE,
[LC_IPV6_OPT][LE_NONE][LF_UDP_VXLAN] =
RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_TUNNEL_VXLAN,
[LC_IPV6_OPT][LE_NONE][LF_NVGRE] =
RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_TUNNEL_NVGRE,
};
uint16_t uint16_t
octeontx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); octeontx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);