From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0060.outbound.protection.outlook.com [104.47.32.60]) by dpdk.org (Postfix) with ESMTP id 6DFB91B7DC for ; Tue, 24 Oct 2017 15:01:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wveGH6EwGcCKA/6PZVIjXjEmF0UvFoafe4VxsP53xo4=; b=DZ36ZvPDIvY9i9ZI9S1rG1BPxrro4Btf0cGWJK0SmPBkKFXyv1klM9IglKseSiL4h8rClGiukZ01bcJ6U+2OcDADISb4j25x9flj8L92+0GSNgW4K70DLtbOauaOw81bPJYzfjBAYi/bXZnookROqqMLqSEoAu3fuZCONPCo+s0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT.caveonetworks.com (111.93.218.67) by BN6PR07MB3457.namprd07.prod.outlook.com (10.161.153.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Tue, 24 Oct 2017 13:01:02 +0000 From: Pavan Nikhilesh To: nikhil.rao@intel.com, jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com Cc: dev@dpdk.org, Pavan Bhagavatula Date: Tue, 24 Oct 2017 18:30:35 +0530 Message-Id: <1508850037-16394-1-git-send-email-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508316342-17781-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1508316342-17781-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0084.INDPRD01.PROD.OUTLOOK.COM (10.174.56.24) To BN6PR07MB3457.namprd07.prod.outlook.com (10.161.153.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: acffc471-6c3f-4491-173b-08d51adf48fe X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627075)(201703031133081)(201702281549075)(2017052603199); SRVR:BN6PR07MB3457; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3457; 3:P2RsfRcHox65ToX9BNmCWbg66xtNTv2euEYzB6HPWGZA6uu4xYVHkSu+o0JwkUuFMCjYVYf/nhHLIwh0juO7UVSVtpD0XsPhS3rUdtUsUeFAusFa/NOrPBZKY0s2VsK53IhcSNLAYz0s2Z5NClq4TxY+QxjAkrzp6KbK230k+z6a6X8iDpAGKKAT4Z8nrGdFuhtnfIYGzm0z9PoJpgke91etCdGTG3ZDABa0e0z4cnQsvS+L2eYUQIP9JnWWG3kB; 25:glyLErxYvBay/C+NadAqQKw5IG4itBFpWNQyFomd04ZSHtz0QBkVWJzigzmyP7btOGB6R5zutJTx9TUWIE0AAAay6hrfDwI/MrIivVXpTUQlM9XMIvO9LEQz29hOS+8sD+Ol1W/Ou2e6gPFZfkI2X9Q1UGp+UjP/DUvKXS/ePmBEmnSCQpr0RH5YznQPDS4bhjIAjAJlAvbqrM9czgI9sfW4SIApT1FKnRtpZ+PAqTcY1N1HmRR+SrGvc7PTIEmLD0cscurlQmLlzFufcOrY7K+u+qqDuCjPT+KnxRj8vK3OMHes55yOkK5v8beLXa76rvO3n0vf3GxMzwpW5xesOg==; 31:VeT5tMFf5BsjDrP0/qpD21BOBw+1VDDA+1rp9Zvihtklag7wS2VpCCdNnrgL2wpeqkpMzDI6jC/lxtciNj73gycWyr3E0dIsGGlh0wLwFYlvSjBcHhKJQpzRo9VN+7zx5wwpi7BKhHDDB9WZDibO4Pqj4Wl+H5vSCWLR36tpra2Z8yUCZLqXxHnjPm90LL3093bp9QrAwBxPpCMvtsYqi0s3R7tl9YBqqEanoKPQQJw= X-MS-TrafficTypeDiagnostic: BN6PR07MB3457: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3457; 20:N+bNdSJdRmxruYv1izOcT1+BXy+TCe/2ea2f/QrpC1bXdLhXFYHe3OORs53AMjexcTNPP32/yTiB+XVEm7YvKDorGASl9v+WFE3YWPdWEJNGmyZPIPAJ6DBVWSaBL5m6lH2ZKfRQJ4La/VbwDg0rTDzhETJk7ab+eTbzn6FnOaM/w9EBW0eu9HqgjcJKO1208dbFOzVO+xZtvhqUE28+0/6WYZ42e/cqLaOZWRxlIBIugMpr5d1ok7E7jueJr7WOA3HZzFHBBuaM63/m/CwgroSHCWJE3rxGAthUeSij6FfSD+6jnQWpPfGE1VzWmgQFJDGEWJYZlTzx+tHPQVjpI3Y+eFuIV0UvtsDjHbDX8p/6SUJAFWJCZXR+Fz5WSZLasVWhRT+FQ7lOVLhpXlFr+l8qzicSahs0bymatcDdgFjn0kitWwq2uuR3zdKYw0Dj2tdHMtrQxqLjBn9cl9bEKKhFY8Hg0vPl8OKjPnf7huowsHbugqv77uAvX8TVvC+pRx5s+XL0dvSG3NyGIL0pvmlkMblJzrCfF84mwNMhQ6mQ3yEwm38cRMqTv8UMh7b5qn1id/H3v3O03fCmWKDrR49ayPgCqus44tt8EEtyVQY=; 4:TaPFc9Mav3Ml0QbMLCMQ9KrY7DxP792qlooHE74X+rR4safq84AGM2DOG/TWp9z+FCIyTOp2pF0g4aZbqPbVkmMkvNiY8Qp1/VoRfT58e6wNFdELmqi4NsG4CMltAP0eBtFaTs+BU/q1Bz7i/Qzlblss0tB6HPIrFUyCumKKWYp05RBerRK5zi4sChKW7smYQnBkRo2HiCke39VFqw0sWFApC0VmjUZdKMI6KVd8tsIwntluc4WDocZwCjHy5nnx X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(100000703101)(100105400095)(3231020)(3002001)(10201501046)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3457; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3457; X-Forefront-PRVS: 047001DADA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(199003)(189002)(81166006)(36756003)(6636002)(16586007)(5009440100003)(6486002)(97736004)(5003940100001)(6506006)(316002)(50226002)(101416001)(69596002)(66066001)(8676002)(50986999)(33646002)(2950100002)(478600001)(42882006)(72206003)(81156014)(6666003)(47776003)(53416004)(8936002)(107886003)(76176999)(68736007)(105586002)(3846002)(48376002)(53936002)(6116002)(106356001)(2906002)(7736002)(5660300001)(189998001)(50466002)(4326008)(6512007)(305945005)(16526018)(25786009)(42262002)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3457; H:PBHAGAVATULA-LT.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB3457; 23:pag6eo/PM00wa5NXz1dcI0NjJn4ugOayi5/1SbGUv?= =?us-ascii?Q?IWSFbXd2AqEU5vxkS1Yep02y1w6l8esF3XK7RXLkJoWkJTaQztxmjiqx2Q47?= =?us-ascii?Q?VjWiRhPyZRN8qlkcp/5fd5XHZP8heHpOK61RqSyyEqrZIQHHUTxruNYW5mZR?= =?us-ascii?Q?a+Ma0qb9rHQS510beo5NPR/cBFR38wGoE4oY2txdetXesCeT7q66UVaEn9Vl?= =?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/Y3IUAD8/1Dg3LEL0LNIuMEy4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2017 13:01:02.9621 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: acffc471-6c3f-4491-173b-08d51adf48fe X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3457 Subject: [dpdk-dev] [PATCH v4 1/3] net/octeontx: add support for event Rx adapter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 13:01:07 -0000 From: Pavan Bhagavatula 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 --- v4 changes: - fix 32bit compilation issue v3 changes: - move mbuf conversion from 2/3 to 1/3 - fix 32bit compilation error - fix documentation formatting v2 changes: - Improve conditional statement readability (Nikhil). drivers/event/octeontx/Makefile | 1 + drivers/event/octeontx/ssovf_evdev.h | 1 + drivers/event/octeontx/ssovf_worker.h | 35 +++++++- drivers/net/octeontx/base/octeontx_pkivf.c | 65 --------------- drivers/net/octeontx/base/octeontx_pkivf.h | 126 ++++++++++++++++++++++++++++- drivers/net/octeontx/octeontx_ethdev.c | 3 +- drivers/net/octeontx/octeontx_rxtx.c | 108 +------------------------ drivers/net/octeontx/octeontx_rxtx.h | 89 ++++++++++++++++++++ 8 files changed, 250 insertions(+), 178 deletions(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 50434a3..a9b7ccd 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -39,6 +39,7 @@ LIB = librte_pmd_octeontx_ssovf.a CFLAGS += $(WERROR_FLAGS) CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ +CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 933c5a3..bbce492 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -38,6 +38,7 @@ #include #include +#include #define EVENTDEV_NAME_OCTEONTX_PMD event_octeontx diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h index 8dc1264..bf76ac8 100644 --- a/drivers/event/octeontx/ssovf_worker.h +++ b/drivers/event/octeontx/ssovf_worker.h @@ -34,9 +34,11 @@ #include #include -#include "ssovf_evdev.h" #include +#include "ssovf_evdev.h" +#include "octeontx_rxtx.h" + enum { SSO_SYNC_ORDERED, SSO_SYNC_ATOMIC, @@ -50,6 +52,28 @@ enum { /* 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 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_grp = sched_type_queue >> 2; sched_type_queue = sched_type_queue << 38; - ev->event = sched_type_queue | (get_work0 & 0xffffffff); - ev->u64 = get_work1; + 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; + } + return !!get_work1; } diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c index afae6a3..f9e4053 100644 --- a/drivers/net/octeontx/base/octeontx_pkivf.c +++ b/drivers/net/octeontx/base/octeontx_pkivf.c @@ -111,71 +111,6 @@ octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg) 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 octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg) diff --git a/drivers/net/octeontx/base/octeontx_pkivf.h b/drivers/net/octeontx/base/octeontx_pkivf.h index 7cf8332..004dedc 100644 --- a/drivers/net/octeontx/base/octeontx_pkivf.h +++ b/drivers/net/octeontx/base/octeontx_pkivf.h @@ -240,10 +240,18 @@ typedef struct mbox_pki_port_modify_qos_entry { uint8_t f_gaura:1; uint8_t f_grptag_ok:1; uint8_t f_grptag_bad:1; + uint8_t f_tag_type:1; } mmask; + uint8_t tag_type; struct mbox_pki_qos_entry qos_entry; } 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 */ #define PKI_VF_MAX (1) #define PKI_MAX_PKTLEN (32768) @@ -407,6 +415,12 @@ typedef struct pki_port_create_qos { } 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 */ typedef struct pki_port_modify_qos_entry { uint8_t port_type; uint16_t index; @@ -415,17 +429,125 @@ typedef struct pki_port_modify_qos_entry { uint8_t f_grp_ok:1; uint8_t f_grp_bad: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; + uint8_t tag_type; struct pki_qos_entry qos_entry; } 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_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_create_qos(int port, pki_qos_cfg_t *qos_cfg); 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); #endif /* __OCTEONTX_PKI_H__ */ diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 82e38c2..86de5d1 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -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_dlf = 1; pki_hash.tag_slf = 1; + pki_hash.tag_prt = 1; 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.num_entry = 1; 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].gaura = gaura; pki_qos.qos_entry[0].ggrp_ok = ev_queues; diff --git a/drivers/net/octeontx/octeontx_rxtx.c b/drivers/net/octeontx/octeontx_rxtx.c index 0b15833..2b58423 100644 --- a/drivers/net/octeontx/octeontx_rxtx.c +++ b/drivers/net/octeontx/octeontx_rxtx.c @@ -47,94 +47,6 @@ #include "octeontx_rxtx.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_TUNNEL_NVGRE, - - [LC_IPV4_OPT][LE_NONE][LF_NONE] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_UNKNOWN, - [LC_IPV4_OPT][LE_NONE][LF_IPSEC_ESP] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L3_IPV4, - [LC_IPV4_OPT][LE_NONE][LF_IPFRAG] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_FRAG, - [LC_IPV4_OPT][LE_NONE][LF_IPCOMP] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_UNKNOWN, - [LC_IPV4_OPT][LE_NONE][LF_TCP] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_TCP, - [LC_IPV4_OPT][LE_NONE][LF_UDP] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_UDP, - [LC_IPV4_OPT][LE_NONE][LF_GRE] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_GRE, - [LC_IPV4_OPT][LE_NONE][LF_UDP_GENEVE] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_GENEVE, - [LC_IPV4_OPT][LE_NONE][LF_UDP_VXLAN] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_VXLAN, - [LC_IPV4_OPT][LE_NONE][LF_NVGRE] = - RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_NVGRE, - - [LC_IPV6][LE_NONE][LF_NONE] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_UNKNOWN, - [LC_IPV6][LE_NONE][LF_IPSEC_ESP] = - RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L3_IPV4, - [LC_IPV6][LE_NONE][LF_IPFRAG] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_FRAG, - [LC_IPV6][LE_NONE][LF_IPCOMP] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_UNKNOWN, - [LC_IPV6][LE_NONE][LF_TCP] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP, - [LC_IPV6][LE_NONE][LF_UDP] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP, - [LC_IPV6][LE_NONE][LF_GRE] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_GRE, - [LC_IPV6][LE_NONE][LF_UDP_GENEVE] = - RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_GENEVE, - [LC_IPV6][LE_NONE][LF_UDP_VXLAN] = - RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_VXLAN, - [LC_IPV6][LE_NONE][LF_NVGRE] = - RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_NVGRE, - [LC_IPV6_OPT][LE_NONE][LF_NONE] = - RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_UNKNOWN, - [LC_IPV6_OPT][LE_NONE][LF_IPSEC_ESP] = - RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L3_IPV4, - [LC_IPV6_OPT][LE_NONE][LF_IPFRAG] = - RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L4_FRAG, - [LC_IPV6_OPT][LE_NONE][LF_IPCOMP] = - RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_UNKNOWN, - [LC_IPV6_OPT][LE_NONE][LF_TCP] = - RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L4_TCP, - [LC_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, - -}; static __rte_always_inline uint16_t __hot __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 octeontx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - struct rte_mbuf *mbuf; struct octeontx_rxq *rxq; struct rte_event ev; - octtx_wqe_t *wqe; size_t count; 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); if (!valid_event) break; - - 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; + rx_pkts[count++] = ev.mbuf; } return count; /* return number of pkts received */ diff --git a/drivers/net/octeontx/octeontx_rxtx.h b/drivers/net/octeontx/octeontx_rxtx.h index 1f91532..382ff2b 100644 --- a/drivers/net/octeontx/octeontx_rxtx.h +++ b/drivers/net/octeontx/octeontx_rxtx.h @@ -39,6 +39,95 @@ #define __hot __attribute__((hot)) #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_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_TUNNEL_NVGRE, + + [LC_IPV4_OPT][LE_NONE][LF_NONE] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_UNKNOWN, + [LC_IPV4_OPT][LE_NONE][LF_IPSEC_ESP] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L3_IPV4, + [LC_IPV4_OPT][LE_NONE][LF_IPFRAG] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_FRAG, + [LC_IPV4_OPT][LE_NONE][LF_IPCOMP] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_UNKNOWN, + [LC_IPV4_OPT][LE_NONE][LF_TCP] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_TCP, + [LC_IPV4_OPT][LE_NONE][LF_UDP] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_UDP, + [LC_IPV4_OPT][LE_NONE][LF_GRE] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_GRE, + [LC_IPV4_OPT][LE_NONE][LF_UDP_GENEVE] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_GENEVE, + [LC_IPV4_OPT][LE_NONE][LF_UDP_VXLAN] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_VXLAN, + [LC_IPV4_OPT][LE_NONE][LF_NVGRE] = + RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_NVGRE, + + [LC_IPV6][LE_NONE][LF_NONE] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_UNKNOWN, + [LC_IPV6][LE_NONE][LF_IPSEC_ESP] = + RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L3_IPV4, + [LC_IPV6][LE_NONE][LF_IPFRAG] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_FRAG, + [LC_IPV6][LE_NONE][LF_IPCOMP] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_UNKNOWN, + [LC_IPV6][LE_NONE][LF_TCP] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP, + [LC_IPV6][LE_NONE][LF_UDP] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP, + [LC_IPV6][LE_NONE][LF_GRE] = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_GRE, + [LC_IPV6][LE_NONE][LF_UDP_GENEVE] = + RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_GENEVE, + [LC_IPV6][LE_NONE][LF_UDP_VXLAN] = + RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_VXLAN, + [LC_IPV6][LE_NONE][LF_NVGRE] = + RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_NVGRE, + [LC_IPV6_OPT][LE_NONE][LF_NONE] = + RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_UNKNOWN, + [LC_IPV6_OPT][LE_NONE][LF_IPSEC_ESP] = + RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L3_IPV4, + [LC_IPV6_OPT][LE_NONE][LF_IPFRAG] = + RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L4_FRAG, + [LC_IPV6_OPT][LE_NONE][LF_IPCOMP] = + RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_UNKNOWN, + [LC_IPV6_OPT][LE_NONE][LF_TCP] = + RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L4_TCP, + [LC_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 octeontx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); -- 2.7.4