From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0082.outbound.protection.outlook.com [104.47.36.82]) by dpdk.org (Postfix) with ESMTP id 2F6F3FAD1 for ; Tue, 21 Feb 2017 10:30:21 +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=hrdJsf8QXHSXSYSg1zfscvXNOFNDMmNrFfIpQeQdHt4=; b=kostxIylg3JrCVWMntIbly6kOX1Atd6fdTpxUPRw+4jtAEQAJuaICJthVzeC03n6Z0xnEUy05RaRaGXG9yZ3YHJL1Gd5IeKt0Qwu6DCDwDWpqXXTpS+jUts9lh24acxl7Cb0KGOEi0AksfmuMo/PexwydB/ZCACRdo4J9asrNPo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:30:17 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:58 +0530 Message-Id: <1487669225-30091-44-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-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: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: 920f2e90-6085-4ff8-cda5-08d45a3c40df X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:vWxWvgOkJB1zEihPITsdHcrbsb76byX6rjmYhpqQ6+9NdWixaRIhdjtjg3Lz7uvhzqr/Dqr+5e6NDrL4ic6TQZix6RW2WLRS2LIQ9dMeE8pm0xQwqY5JkFeto9jgGvEmfc17cyAE5c+X9lHHRKw9ei9V663on2ptjF2HmcP0cvZvuBV/V10HxucuJq2mIQYoBOGB2NIdJl/MjixAO2axPbeuDFcprYFAGwHy9fsCNLIYQV93AsrIQjIrHnd7VJvub9wQzUiPGWXO/0jXriCT2w==; 25:V5NfLsM0MxypAKp8olh1BPVFyZBw2aIkbBYvk9YtkFDM+lEPiayl57huu/raQUQNtzIB2r0ZqiRKA/64igloJl6m4I7o0kKVUyqjzsSYXWg9uYHXW3QTxS82qZNxgXtWQeGeIEP+Q/jWbINSJ1+qCc7HDf6rET6geI5HNEiFNdeC/ly234ytfrRpr0h1fTVlDJEp/J1kiWIkMyPjC7HJnpw3174Av2MxM58guv3I47hH6QQnjjV+VYt+AfQqpybAw2ziWQ6NS5bm25FMUkdB4kuWBECrWQOqq9yezfkU3Uj4hene6PwdD0XtSi7h2ipNS3gnZvdC+rFj3o2lBPDAhuwqvt8R/ByYOQuMbHe0WOvFxeRQnMQB61SfN2A9n8oNR6jbZmI8Fo7W7bTCy0N3QjCk3Vy8WAnFT3+0aWnotU4rOQIWpA6e3XwYGQFNhVaALN9B6g6ghIUpAAxKb3rq3Q== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:s1gyusz+AWzKo1vyshS4luTBdp6kWveX2s7dXh9/E3Bt9j8iOKOQt9ZKDI+kKEYwh1OVkoCH1eHzjsojT7bghd3OCD1BPuk3zr7IQiaZQVEKakzQTHBnhBKvS4Rm12uSYXHYLh/A/7Kkz++iwFC8ynN2deTlzlEbGi9rGkphBwC8GXy7lJio0Q34UBz4QoUIQfYA+H8aIppAt2Rcvpp2edbmpwmzJgY4xjG/Wcu2aZI=; 20:hgwR6L1ldxf8OGF+QwIdrus/hIJ+YqFtMCYIrwwEXteHQZJHTDiW7qTlATFVUh+AGHegTCyHVWmgQUgBMhvaiBiFQ5DAJm73zrvZYpt+ApJlC1j954mrlAYmG7rHAc1eYdA//5RqjCTf+Nrw8RaDxDWPwAqmm92PFXykE/oC2zAqwJVhcYEHHLLvD9gM6W+VbgobCBtULfItI8qO/mvskANFppgcvkOLjBgtz+c9BPK1UjcTF1mHdShyfT9BWb1GeJ06425rF9aMJf4IPHcYv55FmxnPNp5goHPJsoNn8y9MUJwkbhl9rueIvjAwzSLVK8tJYhfUe09FQGVTn4zPdgtS59tzftr+6Vsd1nv4kfWt85SSgGMxp7T0QbI7YAqjRgLDk0Tu3VBLg/mtKQwilu/KZzuMdonR6zrmpeYKgP3YS6Rm/yZ4yBvm2rFNHrswEhCZ5QygnEFS1BYaX0nc4qSDZ/qqJoV5RACFFmZTy74RO9n7+ur43J+aBEXEsLnU9dD+fJ2A7yf1mRUZts2y6Vd5NmmjF5WeHluAVt2xr0cyvAcxwWisRrrCn4twEQW6YtsUA7kP3v+iLlbOcxy0AYux5Gl7raF0trQ6ipGlmy0= 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)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:vtfiVAQ43+YRc6zJdpi9nZJ+KS02ILY/2d5+HYu9/JHFn22auEY3Stjtg3Pn2j55su4I3nd/YFwlQI9QCAEsoXFo6Z4M8NStmIdO77YX/qv2SFmfyXXmCOQvQbpBJHisF5iqDiyyqgC2Ey0469vcENtNh7XBgQHLqMFis26V14CXUbNCbH3G/hk9os/8CGxtKuwTxhXnXRg3f5zW9kxNntn0mwbLuU8AQhoe50/StegpSfhkmmZUjr9KgZgr7KZSHVKRHiaBObispfvGM10yA0AQX9lI3iBbPPRn5VSkw6QhCQVxu1Vi4cN3AOfBCyeVNW2ML8rzvxfXl0/L+Cr/c8NfF7cHGBUw/IFpdcfW95rVz1bUU2coF54womZTxYO9fdlhwSGP2OnRolR0LFgycmuK5OtV9U/TUyTJBoeEcZIji6Rs/tGuwQIAOZgO7yq2eW5F2c48H+W5d73ZO2M3ogwglr9ymyjsUthwUUkiyFJFdRv1anIQfzISLGz9f5RK7rhdCFhCF2mkdf0bSX5aN+cBlM7IIJlrxPs3+rXVe5fOUuFXoTD4Nk/6DGk4uFEu6XkYO3GQnMAyumg7Jz8YYMnwkUOi8hRXlPdAaYT0dCE= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.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; SN1PR07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N4poVzIIdJXDrltHk3th7W3n2gq4nJRzEmHkpUVc0NpGsDa7IsayE/FDcHsPYvbZEBzHcLgRaklux/k1pI/4oDJhpzB5yBk49nnWgzMnmcW4T5ttsVibhw==; 24:vB3sA1WUowAeSfsTD8+CguJSmbQqCAp5FU7TjDSeZy16TbL/ojfNqbUO90E/MOGkGiP2SVg5ZUdztnwXfU91jh+OKUZ7jf0ghtVkg0iMA8s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:uKPrHfEQWiuwS3mfWBqwm++aZFiBs4smPbzqAIfGOl7Xov3AM7VrHJ5lAx3j4d3pX1Aw9iTCOXIqZ32SYct/QEXHjQEdHNrFofUE/abllQQ8YD/K7n/4ODb6yhiR5d7BtJ44iJhigolJmAHT9J4uU0msKXgqLdyrJ8ZIHqFX6IJX29UD9lLgGinbPTH+UCkY+J1wJiCw9ZG4RhsCQiSS7sOGRsMuzGxAQV0o+NF735PAkpeVRGt3SZ3M19a0PggZJNqXpjR1vRpv+xodlo48Rek3E7yirmyV1Y7pNGrVTQF8nfRxhtnp3gxnvgJ4y1fjdSFH3+xXmGCYyfy7Vxcqyw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:30:17.4497 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 43/50] 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: Tue, 21 Feb 2017 09:30:21 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula 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 54d554a..39a3b3d 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 cbe07f4..5f8f1c0 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. * @@ -1028,6 +1143,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); @@ -1156,6 +1339,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) @@ -1214,6 +1401,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 d26aa6f..9c587ef 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 e846d30..655042d 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