From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0041.outbound.protection.outlook.com [104.47.42.41]) by dpdk.org (Postfix) with ESMTP id D9AE41B73A for ; Tue, 24 Oct 2017 10:11:13 +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=rtzcztr2ROTsRb3mh6U5/92uBu6JfGpJ/FY5etQtD8o=; b=HmueIBl1H/jq6Xc/iwARcreIcB2kYFeplO9/GpsKMf6Ijc3s2K+H0kKT44+n4OXuahZM9/Vqu9jXMM65Mjn5spg0jBRgnF0r7GrcOn0gish6gddnjsd9TIgJPxi9oyX6lGd16xHRwgpmcmSLJlW7peusJBRe8XX25SJp8xmvuF0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT.caveonetworks.com (111.93.218.67) by CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) 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 08:11:09 +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 13:40:40 +0530 Message-Id: <1508832642-21984-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: BM1PR01CA0081.INDPRD01.PROD.OUTLOOK.COM (10.174.208.149) To CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63b32923-fa65-4119-c371-08d51ab6c9e1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627075)(201703031133081)(201702281549075)(2017052603199); SRVR:CY4PR07MB3461; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 3:ycJLQEO1pOuqTZsAplD6kowdSDknGOBCkSCjzU20vYK32/q2VphsTzGrvMFU5jwonEcd0V0xotRI/5uk2w04BsR31tNucF+dipf4RhLMaE9XDRPJteN9v4uPqTm0M0VkhrC/k73SqZNuNi9DyW8SfOdUtvjP7Y8821j4vlDklKEttYds0HyKp8muK3s9tHni/K8yfwoXuVzmDi8XHeXID0nbssPEuP0kKJtNll2MqbEiRBTre6IGaUOtt0VwBGtS; 25:dQG6OJ+aMqduUYABIzzzuEzDT+As+S3JFihWf/OeNVfDPbAdYN92Hsj3k2XqNet03aOW2UGv3iV8Asnv1Cf5K3FKe36PSdMKUhQCrdFTuqqQ/juAVWNEYbmtYekfaEN+CLuUSx+lMc2a5++j/WFnU6xSxW66Wxz8x52j1osjC4jkPiijZSYW34nn7iFIsqoOoQVOYAflutjSWsiAHdytCq5slywK3Lcf2OBf8A46tnqVL7S4aowwx5S8zubWYVqCyyjGbTNaGovzI7dlI+gqML+82vstN/PAB03umBzt8BwKx2U9oa8IQaUgJayIQhSlHKY5kx8ul0Gi8cP6nYmJlg==; 31:kuWT6f7pk/VzLYNS/rjPnSDPAICZsa9v9pkArrP8DIv9hhHWOaoqAz+m4N5wlAy6fXP2jOrXuGk5hZZhDy7o8+tAm/mk2E4kjKMUPPIbpZ76biFh0JfjMP/dDFD/npe64t142YD6KCbRsI6RUIWXTrP3EMZRCkINkB5EMTMQscqdJ0RhU4GGQGV/j7FilDB39w1sUK+XPXdBCKC3DgkskOtUZ38JOXeA4ZCYJfbEBo8= X-MS-TrafficTypeDiagnostic: CY4PR07MB3461: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 20:9eKN2icvEwCI/zUs8/VWYzFlMqzfCbb1CGZY9D0QNQ2QFxzjZXhgDPrxlY3/nO+K9C/YUWWp2XRofnnvt4IxIfNsGEjhignrqz5RAVDgGK7u7JPB+SUVW0KoLnxaTQdIZ6Z26TmE6pxa04tVoDU1XWuaaUgygzDXBp7jjkH6BVnC3/0/RuEAb9a/Id0/T2qXivxfiuHZBc5k12P17itgQZktsc7e9/pOECbvOdahItGOMB4Mt1oTjIKuavkqAemHuyEhdV0wp2llx7k0zYESSrXHPKiQrBZXAF1VZccDKQmsFlCMttAMfydgE9xsBC/W6Ou4N8jToPJyDXw1DP6eKhchVlzhYEIZ/u93s7EEiRFtIzp05m0xoTVkkz/DlcFba/lz+ZUI4jy/9IEZgTpdRxXU0ZFZIL0mW2RY++X1xAipzxi8kRsSVkF39RlO1Bggt4gEQ7aHVE9C8yeSu76/QTi9S9zXSHbKzyslF99YY/NL5LMuJhIE6aizRJVmqJk96fftJ5eRwBOV8L1yckjnhIlfcBejT0106zFBCUIevIhe553iUZMSiqMRu7qS+UYteklOLzhSfIkp+WUQrq1cBi+P2ct1yM0sTgm1vLqvvTk=; 4:Mr6o8u4RpzgmfWGJ44vp7xO3YX3UTa9DjarzNi/HFLa0ba0W2kBcu9qt90/Oui2bRgfBL0LT5VqKsnqYiJGf1vgG5FqBHEjHSTABDJKQCSyHKaKM1SnBBfseS7+xD4tP8ckvU7EFRuu5RxZbVNir79g8KofSN2s7L4AyD6rktjnuOLRxguo4fhvh4qaaoRO5sHYoXZWj6dv8DOVDkhv7sJ5FVf8ZrUebxVRjBzo25ZCtI+1XmULFgoNOtYFDSkcm 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)(5005006)(8121501046)(3002001)(10201501046)(93006095)(100000703101)(100105400095)(3231020)(6041248)(20161123562025)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR07MB3461; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR07MB3461; X-Forefront-PRVS: 047001DADA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(189002)(199003)(68736007)(106356001)(6116002)(53936002)(36756003)(478600001)(966005)(53376002)(48376002)(72206003)(50466002)(6512007)(107886003)(25786009)(6306002)(50986999)(6506006)(5009440100003)(105586002)(6486002)(53416004)(101416001)(2906002)(5660300001)(76176999)(6666003)(2950100002)(42882006)(81166006)(8936002)(6636002)(50226002)(1720100001)(16526018)(3846002)(8676002)(7736002)(5003940100001)(305945005)(189998001)(81156014)(4326008)(16586007)(66066001)(69596002)(316002)(97736004)(33646002)(47776003)(42262002)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3461; H:PBHAGAVATULA-LT.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; CY4PR07MB3461; 23:C0IA82HiYInhSgbfXV0oxxgW6yan8x352RdC9W+tU?= =?us-ascii?Q?I7OdbhBk6kHFaDkVDoM1kKMRKYCEPDsCuWjXpdIwSohbsPz2Im6t7jwD+3cY?= =?us-ascii?Q?Lj3kwTkBDFBuoPb11/IhLfpWLlvJOtnC7k68ucZWIWS3Vee2hVp+oxEE8c4V?= =?us-ascii?Q?9XBjC/uYXK9Bo5wDe6Rug8i/9NrabvJ0fjRCnart5Bn0Cefj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CZ3PSE8o7ZRMAYP6d286HsN6w/VVQNm/gFhIX+M9rUzMlEtV8QFrE4afM0VSZBxofCvJqW+kB7ccMao+DuVTfPzFfHK2qEzAplAFDkinkh8nac4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2017 08:11:09.7116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63b32923-fa65-4119-c371-08d51ab6c9e1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3461 Subject: [dpdk-dev] [PATCH v3 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 08:11:14 -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 --- 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). This series depends on http://dpdk.org/dev/patchwork/patch/30430 drivers/event/octeontx/Makefile | 1 + drivers/event/octeontx/ssovf_evdev.h | 1 + drivers/event/octeontx/ssovf_worker.h | 31 ++++++- 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, 246 insertions(+), 178 deletions(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 08fc167..7f7b9b3 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..57a3c12 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,10 @@ 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; + ev->u64 = get_work1 && ev->event_type == RTE_EVENT_TYPE_ETHDEV ? + (uint64_t)ssovf_octeontx_wqe_to_pkt(get_work1, + (ev->event >> 20) & 0xF) : 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