From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 810A9A0559; Mon, 16 Mar 2020 16:30:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 67FFD1C0B8; Mon, 16 Mar 2020 16:30:09 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 8FEF51C0B1 for ; Mon, 16 Mar 2020 16:30:08 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02GFKjZ7029578 for ; Mon, 16 Mar 2020 08:30:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=pfpt0818; bh=2USWSVv4HXiL+XTOomay3XWUO5lHPYP/DkuvyUjf7zk=; b=vVKxlutLMyeDctCjtJuHLOIcV7ZijwB43+FVBLAqgLnCITgHS3vyV+A/ikpunsjlSb29 fNNs+Ryp/0NkoC/7IWWDUUE0xejc8UA0KZZgW/v8/oIdvG61qQhKKb/LOtVno3FPO1bS kB+dJMnCWpj5CldTZCHgJF0c5n3UmdCzCfxoCxfjlaLNYtjnT2rN9QeqC7Gvi/ClbWc0 QSTARLyqVKmcRI4D7dffeMEPSXnT8U8MrgRuMtswMwD5ilOGvylCevU5qZgfXHouHXqS Wf3ZVAufy3wtilZ0FlhLtheKQ1+m2KjWc2smCUNY7ZDR8+/uN4K2JJS/RsOSNnTdPwYG BA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2yrxsmf9ev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 16 Mar 2020 08:30:07 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Mar 2020 08:30:05 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Mar 2020 08:30:05 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.56) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 16 Mar 2020 08:30:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RJaShskRaPn7mPs1LiOUMkY/dsKx42GVSbXw1a1Ffur9BsxVCm76ES4F0U0kgrY1hhWMirNhMerxkBAyMvh1JOaljwTu33WPONPQV5UYu/CFUd77MAMA8T18EVREPNSnqnhshaXvDiiPYS3b0bUf32NJ2ijF/shDsJtzDtHe85KcQVrkETMJOaSc8bWGUQOZygyD7a01Uk/xZwpP1TY6jobaKejwvZdLp4rjrTixc0AS6DrS4nU6a+SAHg7Ky+33O8/+Ti7wI67WqRYsEt7jhACjP7PJ7+dlHq7JBQ4O2xkWl/kB/AXEsgus61dmBewfBoCUJfLDU3pfsJ6rg8bIkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2USWSVv4HXiL+XTOomay3XWUO5lHPYP/DkuvyUjf7zk=; b=CcNDRhdY4z6memyeVaQbPMocDF52NoslbOX2YUXJswDSKMJdFzuPe48Wdrdg0JgLM7F/LUYQ4BTFImWvEXPf0ropFx9j7v1JKy3wY3tFRTTyK74pd9yozKFfwgL6xf8gkDnyKI4F4do3euuSIM4LOmdHCs2yHrYgz5mwJjII9L/xhIg3VwhNCpwweuHFMPPO4HpxSmyhsAQB85Pt/alkEk+gtuEi5k2vOVDEK4sZzJdLksustui3t4AQ+XJo6KOUTbdgXwEDwEVga6TcsQe8fkDKhhsIdHWNld6UAfoPPmFoIGOHAh1FPdd2fFl5s2ZlCHsES9qsAvfcB8dDAGH1Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2USWSVv4HXiL+XTOomay3XWUO5lHPYP/DkuvyUjf7zk=; b=RrelKAmUGfYlXjBlxkNxVwgCjdBLXfMFW9JF9xJl9ZO3tHp0DDwxA8m2uO1ulUtyX1upmFh0ZkEmxWUhVgU4LzgHubGPUDyAFCdX14rAytYn6/JNplcl0S3+TZ5jZOWSMu1SVciuRcO0CPfc7AjBPrTfAHESDpenujo3Ezz+J34= Received: from MN2PR18MB2848.namprd18.prod.outlook.com (2603:10b6:208:38::19) by MN2PR18MB2640.namprd18.prod.outlook.com (2603:10b6:208:ad::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.18; Mon, 16 Mar 2020 15:30:03 +0000 Received: from MN2PR18MB2848.namprd18.prod.outlook.com ([fe80::f829:3e55:94f6:4efb]) by MN2PR18MB2848.namprd18.prod.outlook.com ([fe80::f829:3e55:94f6:4efb%5]) with mapi id 15.20.2814.021; Mon, 16 Mar 2020 15:30:03 +0000 From: Harman Kalra To: CC: , , Harman Kalra Date: Mon, 16 Mar 2020 20:59:13 +0530 Message-ID: <1584372553-28710-5-git-send-email-hkalra@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1584372553-28710-1-git-send-email-hkalra@marvell.com> References: <1584372553-28710-1-git-send-email-hkalra@marvell.com> Content-Type: text/plain X-ClientProxiedBy: BM1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::22) To MN2PR18MB2848.namprd18.prod.outlook.com (2603:10b6:208:38::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hkarlara-OptiPlex-3046.marvell.com (115.113.156.2) by BM1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2814.13 via Frontend Transport; Mon, 16 Mar 2020 15:30:01 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [115.113.156.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b846ffc9-e237-4a64-c595-08d7c9bee5ba X-MS-TrafficTypeDiagnostic: MN2PR18MB2640: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:826; X-Forefront-PRVS: 03449D5DD1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(366004)(396003)(39850400004)(376002)(346002)(199004)(34206002)(107886003)(4326008)(55236004)(7696005)(52116002)(66946007)(36756003)(66476007)(6666004)(66556008)(2616005)(30864003)(956004)(81166006)(6486002)(37006003)(478600001)(2906002)(86362001)(81156014)(16526019)(186003)(26005)(316002)(6636002)(5660300002)(8676002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2640; H:MN2PR18MB2848.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; Received-SPF: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dMMykh2V2ZlsCdM6d9dolL1MQnMzBK6MUB3nvbJXCo0ci2iBPJTGla3rYJrVfkjo/h1IoMd2q14fT6lyjMTOUex9/m/KsRrq5AgTpLNi4kV7reiejJl/PvTYYlea4KmejeHTG+d1OMuWHaRuHpoKPV8gF4Opnq2IIDwrvbB8LE++dH09MlT6XuRO7B2dbGIeGaIyAfpgfwXYc6mynTeOH/XOeZB8fCUP0+/YSk7iB8o0Tgw9YXSor9DBGwZG+rehLxQuWz645oz88Er1mzVX2AsRHrT9k/bjKNmxUI+W5JqM+vZ1fiSASTuJGr5JYJOehi5Ipk5IGYcdOQOyh2UExgfzhsasd5fbpHmn2NMqN9/fOnzUSigm1xTVVrs6w+W7GzKwc7/YSVIbjTXCHHLDQFZdTL4B3cLMdnNbuhNGsSqlZb2QxPY5wYe7ibkT1NdG X-MS-Exchange-AntiSpam-MessageData: Pi/4PvtBbTD7fitR6z3aY2utHZHwesPnYI54EcRlcPVrp6riTTroTFOBO5rN5+XvDabU2H3nXEQhHGqUskzfZ0tbLHKRLpaxFbsHS77gBVOybdBX+nf2fa1GXRDg6KhQunrz14wYbS5dsAAIvhYygg== X-MS-Exchange-CrossTenant-Network-Message-Id: b846ffc9-e237-4a64-c595-08d7c9bee5ba X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2020 15:30:03.2595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: smPYhme8kl312RaJHH+4DsaxqcbxqNsxaH32RZaa4UQwXQWPFB47cdC5nljORKGd7sn49J3FDT9HYPnQ2IIq8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2640 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-16_06:2020-03-12, 2020-03-16 signatures=0 Subject: [dpdk-dev] [PATCH 4/4] event/octeontx: support Rx Tx checksum offload 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adding support for rx checksum offload. In case of wrong checksum received (inner/outer l3/l4) it reports the corresponding layer which has bad checksum. It also adds rx burst function pointer hook for rx checksum offload to event PMD. Signed-off-by: Harman Kalra --- drivers/event/octeontx/ssovf_evdev.c | 1 + drivers/event/octeontx/ssovf_evdev.h | 2 + drivers/event/octeontx/ssovf_worker.c | 127 ++++++++++++++++++++++---- drivers/event/octeontx/ssovf_worker.h | 44 ++++++++- drivers/net/octeontx/octeontx_rxtx.h | 17 +++- 5 files changed, 168 insertions(+), 23 deletions(-) diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 5d074bcbc..1b1a5d939 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -272,6 +272,7 @@ ssovf_port_setup(struct rte_eventdev *dev, uint8_t port_id, reg_off |= 1 << 16; /* Wait */ ws->getwork = ws->base + reg_off; ws->port = port_id; + ws->lookup_mem = octeontx_fastpath_lookup_mem_get(); for (q = 0; q < edev->nb_event_queues; q++) { ws->grps[q] = ssovf_bar(OCTEONTX_SSO_GROUP, q, 2); diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 1f5066c9a..aa5acf246 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -157,6 +157,7 @@ struct ssows { uint8_t *getwork; uint8_t *grps[SSO_MAX_VHGRP]; uint8_t port; + void *lookup_mem; } __rte_cache_aligned; static inline struct ssovf_evdev * @@ -182,5 +183,6 @@ int ssovf_info(struct ssovf_info *info); void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar); int test_eventdev_octeontx(void); void ssovf_fastpath_fns_set(struct rte_eventdev *dev); +void *octeontx_fastpath_lookup_mem_get(void); #endif /* __SSOVF_EVDEV_H__ */ diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c index 093f6f000..47995ad9f 100644 --- a/drivers/event/octeontx/ssovf_worker.c +++ b/drivers/event/octeontx/ssovf_worker.c @@ -91,7 +91,7 @@ ssows_release_event(struct ssows *ws) ssows_swtag_untag(ws); } -#define R(name, f1, f0, flags) \ +#define R(name, f2, f1, f0, flags) \ static uint16_t __rte_noinline __hot \ ssows_deq_ ##name(void *port, struct rte_event *ev, uint64_t timeout_ticks) \ { \ @@ -238,7 +238,8 @@ ssows_flush_events(struct ssows *ws, uint8_t queue_id, ev.mbuf = ssovf_octeontx_wqe_to_pkt(get_work1, (ev.event >> 20) & 0x7F, OCCTX_RX_OFFLOAD_NONE | - OCCTX_RX_MULTI_SEG_F); + OCCTX_RX_MULTI_SEG_F, + ws->lookup_mem); else ev.u64 = get_work1; @@ -340,16 +341,16 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC dev->txa_enqueue = ssow_txa_enqueue [!!(edev->tx_offload_flags & OCCTX_TX_OFFLOAD_MBUF_NOFF_F)] - [0] - [0] + [!!(edev->tx_offload_flags & OCCTX_TX_OFFLOAD_OL3_OL4_CSUM_F)] + [!!(edev->tx_offload_flags & OCCTX_TX_OFFLOAD_L3_L4_CSUM_F)] [!!(edev->tx_offload_flags & OCCTX_TX_MULTI_SEG_F)]; dev->txa_enqueue_same_dest = dev->txa_enqueue; /* Assigning dequeue func pointers */ - const event_dequeue_t ssow_deq[2][2] = { -#define R(name, f1, f0, flags) \ - [f1][f0] = ssows_deq_ ##name, + const event_dequeue_t ssow_deq[2][2][2] = { +#define R(name, f2, f1, f0, flags) \ + [f2][f1][f0] = ssows_deq_ ##name, SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R @@ -357,11 +358,12 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC dev->dequeue = ssow_deq [!!(edev->rx_offload_flags & OCCTX_RX_VLAN_FLTR_F)] + [!!(edev->rx_offload_flags & OCCTX_RX_OFFLOAD_CSUM_F)] [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)]; - const event_dequeue_burst_t ssow_deq_burst[2][2] = { -#define R(name, f1, f0, flags) \ - [f1][f0] = ssows_deq_burst_ ##name, + const event_dequeue_burst_t ssow_deq_burst[2][2][2] = { +#define R(name, f2, f1, f0, flags) \ + [f2][f1][f0] = ssows_deq_burst_ ##name, SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R @@ -369,12 +371,13 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC dev->dequeue_burst = ssow_deq_burst [!!(edev->rx_offload_flags & OCCTX_RX_VLAN_FLTR_F)] + [!!(edev->rx_offload_flags & OCCTX_RX_OFFLOAD_CSUM_F)] [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)]; if (edev->is_timeout_deq) { - const event_dequeue_t ssow_deq_timeout[2][2] = { -#define R(name, f1, f0, flags) \ - [f1][f0] = ssows_deq_timeout_ ##name, + const event_dequeue_t ssow_deq_timeout[2][2][2] = { +#define R(name, f2, f1, f0, flags) \ + [f2][f1][f0] = ssows_deq_timeout_ ##name, SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R @@ -382,11 +385,12 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC dev->dequeue = ssow_deq_timeout [!!(edev->rx_offload_flags & OCCTX_RX_VLAN_FLTR_F)] + [!!(edev->rx_offload_flags & OCCTX_RX_OFFLOAD_CSUM_F)] [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)]; - const event_dequeue_burst_t ssow_deq_timeout_burst[2][2] = { -#define R(name, f1, f0, flags) \ - [f1][f0] = ssows_deq_timeout_burst_ ##name, + const event_dequeue_burst_t ssow_deq_timeout_burst[2][2][2] = { +#define R(name, f2, f1, f0, flags) \ + [f2][f1][f0] = ssows_deq_timeout_burst_ ##name, SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R @@ -394,6 +398,97 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC dev->dequeue_burst = ssow_deq_timeout_burst [!!(edev->rx_offload_flags & OCCTX_RX_VLAN_FLTR_F)] + [!!(edev->rx_offload_flags & OCCTX_RX_OFFLOAD_CSUM_F)] [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)]; } } + +static void +octeontx_create_rx_ol_flags_array(void *mem) +{ + uint16_t idx, errcode, errlev; + uint32_t val, *ol_flags; + + /* Skip ptype array memory */ + ol_flags = (uint32_t *)mem; + + for (idx = 0; idx < BIT(ERRCODE_ERRLEN_WIDTH); idx++) { + errcode = idx & 0xff; + errlev = (idx & 0x700) >> 8; + + val = PKT_RX_IP_CKSUM_UNKNOWN; + val |= PKT_RX_L4_CKSUM_UNKNOWN; + val |= PKT_RX_OUTER_L4_CKSUM_UNKNOWN; + + switch (errlev) { + case OCCTX_ERRLEV_RE: + if (errcode) { + val |= PKT_RX_IP_CKSUM_BAD; + val |= PKT_RX_L4_CKSUM_BAD; + } else { + val |= PKT_RX_IP_CKSUM_GOOD; + val |= PKT_RX_L4_CKSUM_GOOD; + } + break; + case OCCTX_ERRLEV_LC: + if (errcode == OCCTX_EC_IP4_CSUM) { + val |= PKT_RX_IP_CKSUM_BAD; + val |= PKT_RX_EIP_CKSUM_BAD; + } else { + val |= PKT_RX_IP_CKSUM_GOOD; + } + break; + case OCCTX_ERRLEV_LD: + /* Check if parsed packet is neither IPv4 or IPV6 */ + if (errcode == OCCTX_EC_IP4_NOT) + break; + val |= PKT_RX_IP_CKSUM_GOOD; + if (errcode == OCCTX_EC_L4_CSUM) + val |= PKT_RX_OUTER_L4_CKSUM_BAD; + else + val |= PKT_RX_L4_CKSUM_GOOD; + break; + case OCCTX_ERRLEV_LE: + if (errcode == OCCTX_EC_IP4_CSUM) + val |= PKT_RX_IP_CKSUM_BAD; + else + val |= PKT_RX_IP_CKSUM_GOOD; + break; + case OCCTX_ERRLEV_LF: + /* Check if parsed packet is neither IPv4 or IPV6 */ + if (errcode == OCCTX_EC_IP4_NOT) + break; + val |= PKT_RX_IP_CKSUM_GOOD; + if (errcode == OCCTX_EC_L4_CSUM) + val |= PKT_RX_L4_CKSUM_BAD; + else + val |= PKT_RX_L4_CKSUM_GOOD; + break; + } + + ol_flags[idx] = val; + } +} + +void * +octeontx_fastpath_lookup_mem_get(void) +{ + const char name[] = OCCTX_FASTPATH_LOOKUP_MEM; + const struct rte_memzone *mz; + void *mem; + + mz = rte_memzone_lookup(name); + if (mz != NULL) + return mz->addr; + + /* Request for the first time */ + mz = rte_memzone_reserve_aligned(name, LOOKUP_ARRAY_SZ, + SOCKET_ID_ANY, 0, OCCTX_ALIGN); + if (mz != NULL) { + mem = mz->addr; + /* Form the rx ol_flags based on errcode */ + octeontx_create_rx_ol_flags_array(mem); + return mem; + } + return NULL; +} diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h index e23bd057e..6b8be6e35 100644 --- a/drivers/event/octeontx/ssovf_worker.h +++ b/drivers/event/octeontx/ssovf_worker.h @@ -10,6 +10,34 @@ #include "ssovf_evdev.h" #include "octeontx_rxtx.h" +/* Alignment */ +#define OCCTX_ALIGN 128 + +/* Fastpath lookup */ +#define OCCTX_FASTPATH_LOOKUP_MEM "octeontx_fastpath_lookup_mem" + +/* WQE's ERRCODE + ERRLEV (11 bits) */ +#define ERRCODE_ERRLEN_WIDTH 11 +#define ERR_ARRAY_SZ ((BIT(ERRCODE_ERRLEN_WIDTH)) *\ + sizeof(uint32_t)) + +#define LOOKUP_ARRAY_SZ (ERR_ARRAY_SZ) + +#define OCCTX_EC_IP4_NOT 0x41 +#define OCCTX_EC_IP4_CSUM 0x42 +#define OCCTX_EC_L4_CSUM 0x62 + +enum OCCTX_ERRLEV_E { + OCCTX_ERRLEV_RE = 0, + OCCTX_ERRLEV_LA = 1, + OCCTX_ERRLEV_LB = 2, + OCCTX_ERRLEV_LC = 3, + OCCTX_ERRLEV_LD = 4, + OCCTX_ERRLEV_LE = 5, + OCCTX_ERRLEV_LF = 6, + OCCTX_ERRLEV_LG = 7, +}; + enum { SSO_SYNC_ORDERED, SSO_SYNC_ATOMIC, @@ -23,6 +51,14 @@ enum { /* SSO Operations */ +static __rte_always_inline uint32_t +ssovf_octeontx_rx_olflags_get(const void * const lookup_mem, const uint64_t in) +{ + const uint32_t * const ol_flags = (const uint32_t *)lookup_mem; + + return ol_flags[(in & 0x7ff)]; +} + static __rte_always_inline void ssovf_octeontx_wqe_xtract_mseg(octtx_wqe_t *wqe, struct rte_mbuf *mbuf) @@ -61,7 +97,7 @@ ssovf_octeontx_wqe_xtract_mseg(octtx_wqe_t *wqe, static __rte_always_inline struct rte_mbuf * ssovf_octeontx_wqe_to_pkt(uint64_t work, uint16_t port_info, - const uint16_t flag) + const uint16_t flag, const void *lookup_mem) { struct rte_mbuf *mbuf; octtx_wqe_t *wqe = (octtx_wqe_t *)(uintptr_t)work; @@ -75,6 +111,10 @@ ssovf_octeontx_wqe_to_pkt(uint64_t work, uint16_t port_info, mbuf->ol_flags = 0; mbuf->pkt_len = wqe->s.w1.len; + if (!!(flag & OCCTX_RX_OFFLOAD_CSUM_F)) + mbuf->ol_flags = ssovf_octeontx_rx_olflags_get(lookup_mem, + wqe->w[2]); + if (!!(flag & OCCTX_RX_MULTI_SEG_F)) { mbuf->nb_segs = wqe->s.w0.bufs; mbuf->data_len = wqe->s.w5.size; @@ -140,7 +180,7 @@ ssows_get_work(struct ssows *ws, struct rte_event *ev, const uint16_t flag) if (get_work1 && ev->event_type == RTE_EVENT_TYPE_ETHDEV) { ev->mbuf = ssovf_octeontx_wqe_to_pkt(get_work1, - (ev->event >> 20) & 0x7F, flag); + (ev->event >> 20) & 0x7F, flag, ws->lookup_mem); } else if (unlikely((get_work0 & 0xFFFFFFFF) == 0xFFFFFFFF)) { ssovf_octeontx_wqe_free(get_work1); return 0; diff --git a/drivers/net/octeontx/octeontx_rxtx.h b/drivers/net/octeontx/octeontx_rxtx.h index 515c4699a..6f850de96 100644 --- a/drivers/net/octeontx/octeontx_rxtx.h +++ b/drivers/net/octeontx/octeontx_rxtx.h @@ -490,12 +490,19 @@ T(noff_ol3ol4csum_l3l4csum_mseg, 1, 1, 1, 1, 14, \ /* RX offload macros */ #define VLAN_FLTR_F OCCTX_RX_VLAN_FLTR_F +#define CSUM_F OCCTX_RX_OFFLOAD_CSUM_F #define MULT_RX_F OCCTX_RX_MULTI_SEG_F -/* [VLAN_FLTR][MULTI_SEG] */ + +/* [VLAN_FLTR] [CSUM_F] [MULTI_SEG] */ #define OCCTX_RX_FASTPATH_MODES \ -R(no_offload, 0, 0, OCCTX_RX_OFFLOAD_NONE) \ -R(mseg, 0, 1, MULT_RX_F) \ -R(vlan, 1, 0, VLAN_FLTR_F) \ -R(vlan_mseg, 1, 1, VLAN_FLTR_F | MULT_RX_F) +R(no_offload, 0, 0, 0, OCCTX_RX_OFFLOAD_NONE) \ +R(mseg, 0, 0, 1, MULT_RX_F) \ +R(csum, 0, 1, 0, CSUM_F) \ +R(csum_mseg, 0, 1, 1, CSUM_F | MULT_RX_F) \ +R(vlan, 1, 0, 0, VLAN_FLTR_F) \ +R(vlan_mseg, 1, 0, 1, VLAN_FLTR_F | MULT_RX_F) \ +R(vlan_csum, 1, 1, 0, VLAN_FLTR_F | CSUM_F) \ +R(vlan_csum_mseg, 1, 1, 1, CSUM_F | VLAN_FLTR_F | \ + MULT_RX_F) #endif /* __OCTEONTX_RXTX_H__ */ -- 2.18.0