From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0043.outbound.protection.outlook.com [104.47.36.43]) by dpdk.org (Postfix) with ESMTP id 7A97ED326 for ; Sat, 25 Mar 2017 07:28:55 +0100 (CET) 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=fhYDAJ2R/TV7voApEF2s8OvJuw+w97WvLd8dVpQLlUg=; b=dFwW/UqrFp4KlA/jZTdQdcVQk4amZ1uZt7edOWlHBP8GQ78D43ManCgJRuTraisGoxvJcKk8CtFhpPfMcIGahpCTCX0BJEt7TQ5kLrpvkOR5ZdIAFY71fB84wZxJLVOV0bG4JVEUGtmDEFgWMvLncWbOSeiENQokHOBfqpZz5nM= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Sat, 25 Mar 2017 06:28:51 +0000 From: Shijith Thotton To: Ferruh Yigit Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Sat, 25 Mar 2017 11:54:50 +0530 Message-Id: <1490423097-6797-40-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0117.INDPRD01.PROD.OUTLOOK.COM (10.174.208.33) To CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) X-MS-Office365-Filtering-Correlation-Id: 19e0079e-379b-468e-ee98-08d47348359f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:h8puhnKTS8MfOAELU6/bt8QiT+dlmqti2vqhsIGzFunhtinWarjcD+Bu2hjtzzNbCvc3+jUSd59izZb3a4VcEA77gHtWwkZ0/J31RlDPzJZzOjwtK+GYHHjUpobQF03bzJIQst+Yuyoa4uEAyrqJxSJ60iEJ/7YKV4rdU1T7vXXoimhMt0mYGG02nGfKwFfkgfj1HVVZjGQ9yXjpHwzuHUPVbsv4TIHqKasec6ZE44/dr797cxiqspTXHr09S0zHlQ1i/R2inAzQY/bE7ou1EQ==; 25:wlk2A6pvwgf/BGwrhKneGUY0MV86TlyqriSupKrOvCHfe6ESlIBEu99JCH5dOgT3O6EQ8LWVKPWzrJuTANkmQItbyh54Sw7rBJW74Ft8JZwuzzoPtQvTaSQvDcuqRavy4wjsHIkcW7l8x8XKRJheJirhf9+yH85/TMYLMYTWLDwZPl9J+dFJp0JXrKP4ux1ugaf6E2tK2m7rsj5WMm5G1Zgigx3F6oz9RZBVRH+NexbEBKPPUk0gj9HlCHXraGB6r2hMbGXLKz/9vRTYiUKa6pbfRvS3WD/RBa+3fpHVRNslRjN+2ctW3SFABMGXCgyCwycDuXXJtvQNR03evU4LlDIkB9fVWmQcy4InNlYIv4MNb2ZNQFRo7t1FPVaoyYizcMrB28709G+9k5P4lcaZFXwqk9BDBh72MMDVVIWAAjsuUs8KgYwybQbh6bda3W2LbSZwPC0yflEldxKCQi79Yg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:GXTWCvZFH9NpV10HsCTuuzjlq8G7s+BPXefMp8PumkcvC57zU/tsLnbGh6VvucKu22vwJ0i48WWTyqqvxV/tccbvtSKZiZO8TT4axeoRPRNDwdsNGbY/B2o0HymAtEb5sALl4N++d8PvKcMrisvOpAZlEuxQB0IIwNqbvvO+Ug98DaGJLyQG0N8+CGJMODXaR8oFnpZ4F9vxfHOHhv+0KGOmfHnhn7yPVu3XmhZ9ztFD4KaeVvq89lC4DR/Xaq7K; 20:gg4aEOXbiuEa7+C3SQemgD4eRixbJ4hL08cyeCF+TdwUpYAE9hkBq+ziwla+x8J5Z2zUkaWAg3NOH6TwXQr2NrXXJEtGwo96tZ4OnUoOUzRRPnqAKVRDjwy38muAKAYnk01LpbnI3DjcA/75fDrey2bHYv2A5ioA7liSCNPzXTPN2bld/d5ZE/Qj+ls05UyulzqHRvsuUhI4p2T0DsS+U3ciovTTygglsuzDjNZZjCnGCX8RXrV7TL1x0TqPp8UJu1787EfAAQPxa/nkPVyu6m46aIOez/UPW31m14/9BnUNCwHBRn5lKcWHrnYu57H72n/JJH6NTE/AoV+kVkVG/3GpLFCMnMJluXQPSxn6wVf1ggj8uDs5FyEGL0WCCg/8i2B78kQljKNjA1d6H3f9X0w5TH2JYS5zOPYQfAqWQ7b4hwq2UqUaZcumKkBkxWiP4xDJqkCDP5sR8GHHyn++nD+jnzHU2YSrRFM+9x4acfvPACu8TisZD30qwJEEwBk5jimvi5ZzSjnt/WG9rXPJkwn0zSf73U2FBpM40Fp0Q+QonxWLeL4sp5y5Q1hdy0v6X8X+Mi5F/sI9QHNbK3ZpVtvdFMtDds2KdoF2arXbDkQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123558025)(20161123555025)(6072148); SRVR:CY1PR07MB2280; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 4:wHzZfozPk4x+3TaJbV0zGe6hWchKIVtIKv51c6YXqAC9gmuvc5CGXRIMoxXn22ILPwo8uGoZxyol+/yrAS/XYVDqdgcoHhYKVx+2cb+/nOvbTGl8BHGtIODQjsgf86nSWfKRQYQ2PGOO5W3fIDlBkpHVFbxqeU1qba0C7D1mD7fmXdXAUkAO0utQusezdFPd0WpI4Yxcq9Rd+nbPRjMLO/d635NMZLlk78w20mlTOvrntXJqBqkFMxYUlq1aqt6CSESWohb2fEYZhZmJ90gvtDnRPQz3dtT6PfVQMju7PYbMoQyfJYHjNdhF11s7T9oBIYoGW8dz1cgH5jNG8jPwil9qC1TnzcFoFwCNn5fZl/kErQa/ENBSQjykZc4hXOlAdUkDZuZz3V6YPjcZuUSJ1H3P16dYsAwh0n+4LsyQkyz43JagJcKRGm3VMMcLnjhQo7qISgsD43jms2d4ojaAbx76OfKtCS4I3EvLsImuYtPGHGQOdSp//jE5YHUd0dligKntScqVZLvyzj8o7K/vAzdMGyiy69K2lBQyBxMS0ES4jPjMA4F1RkkP1hXPnNjs1Pj3UZgOyBWXUtaf/KltII0es1hoUOUZ64WYikxCA1c= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(42882006)(6916009)(50466002)(48376002)(47776003)(42186005)(53936002)(6512007)(68736007)(5009440100003)(54906002)(50226002)(38730400002)(6486002)(25786009)(305945005)(81166006)(7736002)(6116002)(3846002)(4326008)(8676002)(6506006)(189998001)(36756003)(50986999)(76176999)(33646002)(4720700003)(5660300001)(110136004)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2280; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2280; 23:fIbte7uNW6lg+kci5de9VQoaIkwFUZO+UgaiZ1TYP?= =?us-ascii?Q?IVYLwg+SSu9xMOiIwUQYSERatEeMLBJbltIU7WGugPXf1E3mrctYRbNP7NFT?= =?us-ascii?Q?bkrQYot/Cgaxukd5gVALLnbK9x+4x/DuMdClKBJgCfOk+cFLt3M67CdMne1W?= =?us-ascii?Q?cEltaRCAsMfnNiu8fNVob6EhDHDrEcccYrq1IrYZnvjNas8YUeVdiazA/jma?= =?us-ascii?Q?5PN2zbocXtaewNAthAqyA3y2g+V+k/LHCZxbocy8itP9vbJ1xDDRMRFniXv6?= =?us-ascii?Q?QPA52uRWwB7F0bzla42HjEl9nWf/RsxDZiqrQjqSF5e2KLkEsJi6TbYduG2u?= =?us-ascii?Q?Q0/kOGyiY3tLhmkbG7ZbQ8dID653R3FlCvvyBbBvwG0qsZd9orarzYjEaFj5?= =?us-ascii?Q?ZB93uO6m509AnZFyR/GbluiAjMJHOB016jEkH0IJh1x4c7QXBiqrDZuafHd5?= =?us-ascii?Q?KL2tzcuNyM6LY6lSKnqarc7A53jmrU2QagTUTtoYEG8SbS8rb0ndFqNQhsLR?= =?us-ascii?Q?fdZuI8TG2CJKQOqKUrD4rlSLsndT9gKz5EA/a1TJJd8NLNu8BonRC7F9tz2k?= =?us-ascii?Q?N93EoQRtyQYz1DIRT34o0fuUHs0gq+oojkryKjNkGq7dHBM43yRT8jBlA1X+?= =?us-ascii?Q?73ZP7ic3L2F6iuxmgBzhZsftmQw/0cqPE72FBcoM6njPfuvY95d8OQFmw8j3?= =?us-ascii?Q?Ix2czmJ/QOuqXwUwEZsG1EbsdZpTo6dp9fcOPm0MUyBmWgAFhjohQicYd2E/?= =?us-ascii?Q?Cm1NxSK0UqFtFewsXmS/8JHkcoI4pCyidiBONgA38LB9BXjqE4ua7XIet1vs?= =?us-ascii?Q?VGvObcUgX1afK408e5Bm/TDNW0ZstmNxrBe3JBXS/a0l2Zyg72fZCNUxuYRb?= =?us-ascii?Q?+9VpzDsdEFME1tTLBQoyNxt/pJGOS60NgXlG8rS/FQvEXR2ivAbw2MTmNTAH?= =?us-ascii?Q?sj6RmKd60Js00EJvfUwK6T7GY0Dndl40KwQhZGaRrwlSeusE20WOrP0fmAz4?= =?us-ascii?Q?sruX2BZpaLis7rwucQdOFvxWN3N9rspjxcQz/TIoyQl4TuHD/dVsJ+ErqMzM?= =?us-ascii?Q?eL/MkI=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:nCig5KudFUnz1VPSD1859cS+wIjA37V88eE7HkK1OoS1cSPEuwu/k/V656USqdLKH+Mw1n/t6D55EZPmUuzayS4ZXrQaU+XlMj5uLJLEECmlK0nsEufTfbsUyueHLWYI4JXHoQKlLlV8GD7HCTDrps7ayyU5QRxSr6Yo0fmoaH3uT5cHNTe87hnKZfeZYKlZlD+iunZkBT7IiQYWDix1G7nRdnf4LiQj/MVNQzAJlU5UKIC9bbATBpSAbc3qeddiV6IyTn5nw7oLra8nFdWM7ydXWgLdwEW4J6fc8UYGpJch13EgPiA7Tr2euIcv5Ct6DFks0UeUxq0XWQCyW6FCc/p08huKsxF2fxGFbjLGZIZcbtCuEf3CB2pxLvbL0D+XDEu+ejAH3lG93apAwtGgYQ==; 5:7gnrpHVimUvTxix6sipPfB3r5Flv/tflSFM6mfK8mX6lQ9lnXJYcbMPEouilxH5u4oXUVqhVmSq4SFVpWTqHYxE2yv3Rh6mKXyD/9b6GmW7BeG+4Ztpzs8S80Vdq9L8xn5e2Hnf8+aTjZ+zQmZLpLg==; 24:ySaJLFi1+s+O4SKoQmbKTJhRbf9v5hanA2DkswcC7TTUfekHuRR4Qhm7Tynagqw0Sv7SarNdj+gEUzFIJV1EaDvnNoPiqB0Klyfwzwqb9mY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:L3s1NWjjecVUF7WpJR1Xsgb2GTwqxhQEv6a3V9ImdUgehMYjlkUSkJOTAugecZzNypT438JBeEDlh3BUJpcSywXc+dg8iQ62lBXVIwX0FYzQiG3ntsyO0tBjoyWAZEMJDEXV9/FxLZYkCZTztvUTP3lxarwNPG2YJO5OvwNxkxu8QLahbFNte/wLb3ynuIJ+nAQcPL1afL6u5+Cjlz6jRG/8egWtcrnSIjW2hILdvsbyS7sapW3txJVYifh8BGgB0NTiUCGoTQiz4evCFR14+QS/AnGy1kRT3AE5xmaGLQCiG/VmJzZNkSNeIWNha+A8RpKYsjpKsFSJHdTLIpl60Q== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:28:51.6536 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 39/46] net/liquidio: add APIs to configure UDP tunnel port 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: Sat, 25 Mar 2017 06:28:56 -0000 Add APIs to configure VXLAN port and enable tunnel checksum. Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- doc/guides/nics/features/liquidio.ini | 2 + drivers/net/liquidio/base/lio_hw_defs.h | 8 ++ drivers/net/liquidio/lio_ethdev.c | 191 +++++++++++++++++++++++++++++++- drivers/net/liquidio/lio_rxtx.c | 4 +- drivers/net/liquidio/lio_rxtx.h | 1 + 5 files changed, 204 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/liquidio.ini b/doc/guides/nics/features/liquidio.ini index 11e5df3..2d6a49e 100644 --- a/doc/guides/nics/features/liquidio.ini +++ b/doc/guides/nics/features/liquidio.ini @@ -15,6 +15,8 @@ RSS reta update = Y CRC offload = Y L3 checksum offload = Y L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y Multiprocess aware = Y Linux UIO = Y Linux VFIO = Y diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h index 781e929..cc189ad 100644 --- a/drivers/net/liquidio/base/lio_hw_defs.h +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -133,6 +133,14 @@ enum octeon_tag_type { #define LIO_CMD_CHANGE_DEVFLAGS 0x3 #define LIO_CMD_RX_CTL 0x4 #define LIO_CMD_SET_RSS 0xD +#define LIO_CMD_TNL_RX_CSUM_CTL 0x10 +#define LIO_CMD_TNL_TX_CSUM_CTL 0x11 +#define LIO_CMD_VXLAN_PORT_CONFIG 0x19 + +#define LIO_CMD_VXLAN_PORT_ADD 0x0 +#define LIO_CMD_VXLAN_PORT_DEL 0x1 +#define LIO_CMD_RXCSUM_ENABLE 0x0 +#define LIO_CMD_TXCSUM_ENABLE 0x0 /* RX(packets coming from wire) Checksum verification flags */ /* TCP/UDP csum */ diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index ef4d794..3911864 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -136,7 +136,8 @@ DEV_RX_OFFLOAD_TCP_CKSUM); devinfo->tx_offload_capa = (DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM); + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM); devinfo->rx_desc_lim = lio_rx_desc_lim; devinfo->tx_desc_lim = lio_tx_desc_lim; @@ -440,6 +441,120 @@ } /** + * Add vxlan dest udp port for an interface. + * + * @param eth_dev + * Pointer to the structure rte_eth_dev + * @param udp_tnl + * udp tunnel conf + * + * @return + * On success return 0 + * On failure return -1 + */ +static int +lio_dev_udp_tunnel_add(struct rte_eth_dev *eth_dev, + struct rte_eth_udp_tunnel *udp_tnl) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + struct lio_dev_ctrl_cmd ctrl_cmd; + struct lio_ctrl_pkt ctrl_pkt; + + if (udp_tnl == NULL) + return -EINVAL; + + if (udp_tnl->prot_type != RTE_TUNNEL_TYPE_VXLAN) { + lio_dev_err(lio_dev, "Unsupported tunnel type\n"); + return -1; + } + + /* flush added to prevent cmd failure + * incase the queue is full + */ + lio_flush_iq(lio_dev, lio_dev->instr_queue[0]); + + memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt)); + memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd)); + + ctrl_cmd.eth_dev = eth_dev; + ctrl_cmd.cond = 0; + + ctrl_pkt.ncmd.s.cmd = LIO_CMD_VXLAN_PORT_CONFIG; + ctrl_pkt.ncmd.s.param1 = udp_tnl->udp_port; + ctrl_pkt.ncmd.s.more = LIO_CMD_VXLAN_PORT_ADD; + ctrl_pkt.ctrl_cmd = &ctrl_cmd; + + if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) { + lio_dev_err(lio_dev, "Failed to send VXLAN_PORT_ADD command\n"); + return -1; + } + + if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) { + lio_dev_err(lio_dev, "VXLAN_PORT_ADD command timed out\n"); + return -1; + } + + return 0; +} + +/** + * Remove vxlan dest udp port for an interface. + * + * @param eth_dev + * Pointer to the structure rte_eth_dev + * @param udp_tnl + * udp tunnel conf + * + * @return + * On success return 0 + * On failure return -1 + */ +static int +lio_dev_udp_tunnel_del(struct rte_eth_dev *eth_dev, + struct rte_eth_udp_tunnel *udp_tnl) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + struct lio_dev_ctrl_cmd ctrl_cmd; + struct lio_ctrl_pkt ctrl_pkt; + + if (udp_tnl == NULL) + return -EINVAL; + + if (udp_tnl->prot_type != RTE_TUNNEL_TYPE_VXLAN) { + lio_dev_err(lio_dev, "Unsupported tunnel type\n"); + return -1; + } + + /* flush added to prevent cmd failure + * incase the queue is full + */ + lio_flush_iq(lio_dev, lio_dev->instr_queue[0]); + + memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt)); + memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd)); + + ctrl_cmd.eth_dev = eth_dev; + ctrl_cmd.cond = 0; + + ctrl_pkt.ncmd.s.cmd = LIO_CMD_VXLAN_PORT_CONFIG; + ctrl_pkt.ncmd.s.param1 = udp_tnl->udp_port; + ctrl_pkt.ncmd.s.more = LIO_CMD_VXLAN_PORT_DEL; + ctrl_pkt.ctrl_cmd = &ctrl_cmd; + + if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) { + lio_dev_err(lio_dev, "Failed to send VXLAN_PORT_DEL command\n"); + return -1; + } + + if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) { + lio_dev_err(lio_dev, "VXLAN_PORT_DEL command timed out\n"); + return -1; + } + + return 0; +} + +/** * Atomically writes the link status information into global * structure rte_eth_dev. * @@ -1027,6 +1142,74 @@ return 0; } +/** + * Enable tunnel rx checksum verification from firmware. + */ +static void +lio_enable_hw_tunnel_rx_checksum(struct rte_eth_dev *eth_dev) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + struct lio_dev_ctrl_cmd ctrl_cmd; + struct lio_ctrl_pkt ctrl_pkt; + + /* flush added to prevent cmd failure + * incase the queue is full + */ + lio_flush_iq(lio_dev, lio_dev->instr_queue[0]); + + memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt)); + memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd)); + + ctrl_cmd.eth_dev = eth_dev; + ctrl_cmd.cond = 0; + + ctrl_pkt.ncmd.s.cmd = LIO_CMD_TNL_RX_CSUM_CTL; + ctrl_pkt.ncmd.s.param1 = LIO_CMD_RXCSUM_ENABLE; + ctrl_pkt.ctrl_cmd = &ctrl_cmd; + + if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) { + lio_dev_err(lio_dev, "Failed to send TNL_RX_CSUM command\n"); + return; + } + + if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) + lio_dev_err(lio_dev, "TNL_RX_CSUM command timed out\n"); +} + +/** + * Enable checksum calculation for inner packet in a tunnel. + */ +static void +lio_enable_hw_tunnel_tx_checksum(struct rte_eth_dev *eth_dev) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + struct lio_dev_ctrl_cmd ctrl_cmd; + struct lio_ctrl_pkt ctrl_pkt; + + /* flush added to prevent cmd failure + * incase the queue is full + */ + lio_flush_iq(lio_dev, lio_dev->instr_queue[0]); + + memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt)); + memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd)); + + ctrl_cmd.eth_dev = eth_dev; + ctrl_cmd.cond = 0; + + ctrl_pkt.ncmd.s.cmd = LIO_CMD_TNL_TX_CSUM_CTL; + ctrl_pkt.ncmd.s.param1 = LIO_CMD_TXCSUM_ENABLE; + ctrl_pkt.ctrl_cmd = &ctrl_cmd; + + if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) { + lio_dev_err(lio_dev, "Failed to send TNL_TX_CSUM command\n"); + return; + } + + if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) + lio_dev_err(lio_dev, "TNL_TX_CSUM command timed out\n"); +} + static int lio_dev_configure(struct rte_eth_dev *eth_dev) { struct lio_device *lio_dev = LIO_DEV(eth_dev); @@ -1155,6 +1338,10 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) /* Copy the permanent MAC address */ ether_addr_copy((struct ether_addr *)mac, ð_dev->data->mac_addrs[0]); + /* enable firmware checksum support for tunnel packets */ + lio_enable_hw_tunnel_rx_checksum(eth_dev); + lio_enable_hw_tunnel_tx_checksum(eth_dev); + lio_dev->glist_lock = rte_zmalloc(NULL, sizeof(*lio_dev->glist_lock) * num_iqueues, 0); if (lio_dev->glist_lock == NULL) @@ -1212,6 +1399,8 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) .reta_query = lio_dev_rss_reta_query, .rss_hash_conf_get = lio_dev_rss_hash_conf_get, .rss_hash_update = lio_dev_rss_hash_update, + .udp_tunnel_port_add = lio_dev_udp_tunnel_add, + .udp_tunnel_port_del = lio_dev_udp_tunnel_del, }; static void diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index c12960c..f105457 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -1704,7 +1704,9 @@ struct lio_soft_command * if (m->ol_flags & PKT_TX_IP_CKSUM) cmdsetup.s.ip_csum = 1; - if ((m->ol_flags & PKT_TX_TCP_CKSUM) || + if (m->ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdsetup.s.tnl_csum = 1; + else if ((m->ol_flags & PKT_TX_TCP_CKSUM) || (m->ol_flags & PKT_TX_UDP_CKSUM)) cmdsetup.s.transport_csum = 1; diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 95d0007..6835430 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -583,6 +583,7 @@ struct octeon_instr_rdp { packet_params.pkt_params32 = 0; packet_params.s.ip_csum = setup->s.ip_csum; packet_params.s.transport_csum = setup->s.transport_csum; + packet_params.s.tnl_csum = setup->s.tnl_csum; packet_params.s.tsflag = setup->s.timestamp; irh->ossp = packet_params.pkt_params32; -- 1.8.3.1