From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0042.outbound.protection.outlook.com [104.47.40.42]) by dpdk.org (Postfix) with ESMTP id 3F494BD2C for ; Thu, 2 Mar 2017 12:40:00 +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=6GvGPhXbD6GyC+cpBLJHuLMQxE8DCQhV4iPGaqR2Uwc=; b=Ta14J8+ACO6AvR5zob/JxthYhWx62zpnkNCbgDSiBYKAZo601imP+Lj1BdZMQlric2cfr70xbp6SsRiwM4xOYhU/fnlddxM/qQTpnrny0We5m4rSPuRozAIeYfWSLhK6B1I718s/CD2Unara0MSYUffKU8EB+z+278EKtx5D9Ik= 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 CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:39:55 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:44 +0530 Message-Id: <1488454371-3342-40-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-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: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: 257feec1-fa62-451b-f54b-08d46160db65 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:93AaUSfitEB5jCWpAUCRyzpEXCn8xVlvWqyg3O6B5oaXLLBdEKGGh0uRl+6QTJWPUzi/FOrmy9IHhEMH94i3sBavH6n2K5qq0R+ngrX9WnZiHsoPMneb3GdBp+MPt5pPOqAonGqryafqvXqioW+M/WoMouz4g39Elc99oY3hxtV228OngJk/z+wloJVurli2Wbp4u0gInTw14WyWlqfflyUP8j3RGWuTzsMdu81luhvox3W9aVl1t1kPtuVL5mTbSzw2m2rznwg9LEYNhXYPPw==; 25:jQLS99dE4NXKdH/TOIFju6IFZgtgXc/j6V3a8Kl7ubSKBVCGP0yp0TR3wpmRLKoPB/IX1HpNYAb0jIsC+9GYmFHxBjpNj4pmKrdJEfBjorZMJyg2Sz6icnDCoSJDFESwIkGYP2AdNhCWI/Ex/mTtiuSEzSMrdt+GHImiCZohDR/FYzaIudlT/KnG+J/8xzX/b3CD4EYHrbSqJexjQrrD7FfOqwoT3gc1wYQK5lvIW+d97IXAEsKrVR799mZ+k+IHoT/YhSmk7a59ss0cRNtSnMz3jsNAAXkrpQTXmkRXKuG86u28qXRHbNL7ouBCw7g2rSyq2Eg+r6+BIeSpVAsUBn5dzN+ri/44tAM96pV7NQDd630m6Xp7RHAgD3GtwpBrKfAn7yqJG/sWX1D7c0tdPk7PAr502kZBXC0EIu8BLIu5jwA49dXYzyfVWOmq+aBmrsIhzXiuX38fmXmQW7nGhw== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:zZsm/XyVRTAzdG/pxlX4iZVS5ogY41CDH4Lr86fhBVOAvk+ahB+rRW36/i6j7qPtjFppyUk2/fNo9FE7Y31T7XEbDC6Wq1KFPykj9dXkINSqxIpT8kVVi6A9jyhfWLtcdt8n9ZUYZ+GDalqZ0ZNo+xlAbR1MCQyx/Dkr9qYOM3MrFyratRZr+9I6lgA1Aa/jcdI/3k4HsMxIGNpn2EHG4dNlGCfRuCkPM3nQWpzxT8U=; 20:m+dKt7r6xi6vsPsFcK+IRjLDd3BsBhrOoqa8EQSwbOjXfWgVzJrDGfUDZGaXob7vhadDhq6x4CMnk2gth/95WN2et1uGshhAWLMrDn6tDtK9tw47j+QqzRCETESD9f9rojkTyVoqFucMMdgYBpjJfN2caDBSZNykObiSle92L8WLbfHrzq4oK3O4P/PE3jGoJl8dbYZL4qBIq50ou1YYsKXDMNGmRD0llyimKj1+Kx4/U8h9FDT2YwPXoQZ0LBlfP+/jGQxSt8wiQNNinD0IMiowwKtouNHlBOYWFgMP2EBB7h4ZFclZaj0O4Ziy+eqadB8GDTDO4klPrVMu+v/3YPomxvkdesVXfKItaurNHJwkCIHFxqeZsTnsT/FgoVc0FqWO2g6YNtLS68geYtuLlT3YWxWEj/McowdBbBNoyIpfkq44Nbqc2xkO1ISf8iBovkgj+qLOl2lZETBSVI85tVUJ4nKxWauuSh8Z2agSo/B5mhjV6kj6toctr9lUWzx07Dl98wnGPoRdGaiWGuEjUfwr1DNfBfgkhZo57hwt50j3hPBaAhpwM8Yfagl5cNuZtHNxDQaAN5fJ9gv7sgfE1Q+8lsbZLEvupXv2FUonJzo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:UswZypGH+Bt8YFoh9T8HmH4qhe620IIRtfY5vL/kLt7ctgn+7x+vzPdNn0ZP0+Ubj7gIkEj27E3eDPXZlX3m0R1R55gyHj8/obWAGrJe79f2zCjcZRZ4HYu4bivIgp+0IlzndWa0uIrnQuN7Z7RAezRIB9pYH1WboIWiukqKOwIjsca3vqAIFWmz+ktCwtwQKiGmEdef//OOonIY5DopL47YftvSnaDrnYg8fmDloFbgKDRXkFhUlHPtefw3TiBOXj/C0fv2nPf0a2Rgx0etrZmQ/iwnUnx0hB7jGZ/Hjznbc9NMeX2c1Gvvw/4KXpwCzZBLCFx4CqukZY5vglyLyHtYSX9Ayb2NIS6kY+wF70t05AFguN4q4f5/LqpQ6nUkUSfkVYibZDcRL9fcixnXj+LV60Hb7ilHAE+cNiU7HQQ9Fx1Vfv1jajtJyKUrsfj3Zj7+DojO4l2oiLnBAXNeZ35cbXAk6pSl/969tzb1IMackHUtpP+CCrfVEVebwkhfgYGXuQ0aID7Jf1R7kY83AjXso2z2w2FU/nEv3Qko4dE3fJ6CJyeuMcwb7++hvOwdBwyZKybDIkouX+ibXC/Htfd3ZspbtIwc2Jas/XPyJho= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2277; 23:pWegb217HUnZrTCZwR2OcwQkUyk+/GMO53HDKvPH0?= =?us-ascii?Q?IkcghKMwHz0THpKzcwekeIo+cHHqyQ3ejoKeonFeFU/1zSSS3F2c2Dgpvo88?= =?us-ascii?Q?SepFGQcD8TPoVPyxvG667zro/f3u7C7zoVYMjajAwdbAFpZvirW74CZ0xjz4?= =?us-ascii?Q?pPHX5ehPd84MTXe9p2DSCq3D9BUhFWJelD1Yj4mU4b3BZnOrTsDJu4qDGDGg?= =?us-ascii?Q?C8w4qICA2MvoOExH+Pg2iz6HQYmktbPhry/vH1p6RX4Kga1KbAEVLoyehOLU?= =?us-ascii?Q?+PulwYagxsab8eArkJshCZG7ArcLXB7KD4pS3jrR48yipuYNxP+VENM2JrEz?= =?us-ascii?Q?V14pQII4kuPdwqEcuMjA7BNRmUuXQ16UwCNnNEmDPv/Gta2yTqQuWrIn2cgh?= =?us-ascii?Q?MvI25M2jo9iHMOT0bnQPOHczR3KSX/WqfYkQtuhoYJmZb09IeIdGjeiUuLdE?= =?us-ascii?Q?yTHoI49GNr8v5Hc+RwmsO75rw3w98y6uZEWmrZ2KrW9GgvqmFg6anXfxKA5e?= =?us-ascii?Q?sHuf1ik/IKWM3kP+oujn+rB1kN0pEzZH4xfvuSbv7VdTXlSPQNt2aMgX2RLI?= =?us-ascii?Q?NTzVtV1jocPjlkUnxZES7gDZP81Ef0MtzlckoRYLql22yGk3M6n0wi3HZKMi?= =?us-ascii?Q?E30ThMQSAu6L5mx5DaFLOn2KIi0YJwqs77gUxvQ0ZLv4wcb5VaMw92HJo442?= =?us-ascii?Q?8OPyJuZObsVE9vxpH2VP+Zkv5TRi3rhgSArc7rGVHg91JcdEIDolgYcpvCta?= =?us-ascii?Q?IWUAyAXmvIUmCTnNzkPdGy4luUxM2jASaoFWv1LEL7/vbzD+LxrmfhBGRBzy?= =?us-ascii?Q?NiXZNmOWuxdaahtjNVEcEYJq2Y3iRM+68+QHUqSHymBZ/Zo5k8e/PwnYxkd7?= =?us-ascii?Q?tzZRRd6Bh2Zjj+9eSdL+X5nRnggAxvUqONCpHuuurfE4jLci1GEt62bRWvWR?= =?us-ascii?Q?sb6Pe8t54inh2mb3As1MerxAWR/GFv6UemCG+FWWbPVYfIs37vX+N17Is18L?= =?us-ascii?Q?DhmjL6Fr3ygIMhb3gozB7aE5mAtBQ4b/bJAQ1gtWD7OugeRfag5H0KyDvS/A?= =?us-ascii?Q?uKUukj8742U3PfayMyR7Ug6rLMy7Bk06ufJPMtJ4kpT/BJf+w=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:PW3eHFFv6OO/bZ5dTI1RMeWJoi1UTMbJSRa+yCwPyy2RDu9rWLXlupHOPxlTFnLlCvd7HR6ooaRm7A4kKFCSXFUAOrEnljOj6wHgEXbIJ461nYFbRwqRVwt0/nLw16nMLwKulFRTy6874wS9FcBgxGqV6VQyRaE4t7X5xoOi73AbW+kiyp3GBDneWK62T3S7OqmiMkvIhZhrqdiCoaCnoETuPpR6aGIhU3XALI2sg5AlWi5toBibONr9rMFLZIjrfMW1MfgNFkHWcxnpbsx7VAzvg3Zz/zhSUgVG6sVoHA7ytSevtDxYLM6U3OUTbg7O4Vj+sM3OoDfW2O6KKOrAZyJmF+sCVjisyOsWP9aJREeozI4cPGRbi2FdRj6hgH9i8ddNU796Gntr9NeqDAJ7dw==; 5:mzEMzWpieiRJjb07L8bB3mHWHjXppi9NgcACdLxablNZmXTWL1eIuzaFwFy2Tr140fZnKh0ozTwfddY8J5ONEpvQy1eH/nVn61bnNT8BFnAN4MXzNiZoJgt9JKwxGKwtVRZeVbHju17beEQMXX80OA==; 24:XY3y3+6NRJlU8waporK0X1Ms2i7Pq9eFGqHsRy88xHXhiCxPxlIzY1LmVkGetUE9N3GDNXpg8BlFPKg6sq/PIS6r++IPjqIHxmT1QNv4rDU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:U7sy46AFjf0VfjJ991PjfTd7EM+FQF3hd4O6e9vnFogV5oMwORpRCbxdU2CqvOk+uGMTvHfHCESbvFrrubPAX3FXdRiHIcwDwzeWSavFJWRC7Q7pHQEcg0X2WnyF87qZZo4aJ0dZFmNH+w2mdWbAoeCacFZ1sbNLJ4ZBtRmFzyRigd6jSToYdqYnoNHGULvJEQ4D9NGnwrS9t3RuIc7fZeuJkI8rnzj/E1f4toVFNxyb46Dj2hsQK7N/SJs817KCvA1Z7R6qavjIHhTgxn0ERWdAn7wkFShMoP4u9aUDn2MvQxwoZP8OCWOD2jo88SEKC4dz6uR1E4hqIAYZfRL8AA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:55.9541 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 39/46] net/liquidio: add API 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: Thu, 02 Mar 2017 11:40:01 -0000 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 --- 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 + 4 files changed, 202 insertions(+), 2 deletions(-) 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 27727e8..eb8e921 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) @@ -1213,6 +1400,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