{"id":809171,"url":"http://patchwork.ozlabs.org/api/1.0/patches/809171/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20170902214929.2890-3-jiri@resnulli.us>","date":"2017-09-02T21:49:10","name":"[net-next,v2,02/21] mlxsw: reg: Update RATR to support IP-in-IP tunnels","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"99779fbf14c9cd5c60d18e42cef8b15937c736ea","submitter":{"id":15321,"url":"http://patchwork.ozlabs.org/api/1.0/people/15321/?format=json","name":"Jiri Pirko","email":"jiri@resnulli.us"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.0/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170902214929.2890-3-jiri@resnulli.us/mbox/","series":[{"id":1180,"url":"http://patchwork.ozlabs.org/api/1.0/series/1180/?format=json","date":"2017-09-02T21:49:08","name":"mlxsw: Offloading GRE tunnels","version":2,"mbox":"http://patchwork.ozlabs.org/series/1180/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809171/checks/","tags":{},"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=resnulli-us.20150623.gappssmtp.com\n\theader.i=@resnulli-us.20150623.gappssmtp.com\n\theader.b=\"cDdX8Whj\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xl8v200fjz9s8J\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSun,  3 Sep 2017 07:51:09 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752802AbdIBVtm (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSat, 2 Sep 2017 17:49:42 -0400","from mail-wr0-f194.google.com ([209.85.128.194]:37536 \"EHLO\n\tmail-wr0-f194.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752761AbdIBVth (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sat, 2 Sep 2017 17:49:37 -0400","by mail-wr0-f194.google.com with SMTP id y15so1122992wrc.4\n\tfor <netdev@vger.kernel.org>; Sat, 02 Sep 2017 14:49:36 -0700 (PDT)","from localhost (jirka.pirko.cz. [84.16.102.26])\n\tby smtp.gmail.com with ESMTPSA id\n\tb72sm2950229wmd.0.2017.09.02.14.49.34\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSat, 02 Sep 2017 14:49:34 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=resnulli-us.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=B0NzQdEISYlXkq1ZZNSBqH09ESr75qC10REHuytVqe0=;\n\tb=cDdX8Whj8C6Rhi6Eje3LelOSxyM8i/JvdbeycNZw8z0b5Xyjs+53eTwQTxiFWJ4OJ2\n\tt9TUUjR8s71A9dMfmgYa1nTXgMLM27u7R2QN+uSqEnUDCQgwCc6Rrbe+TYb1wB9ROBIA\n\tgl2SDdwMXOQUDwy6uLPXFkJG8pkawAVhqbHEMPVh/+oabRO8GUdTOQXTTlrEwnZS30pf\n\tDyXf/EifHnapA2nVQDuDQowZEP6dliIm9MbcYfjF5/cBChrEdsMU4s4aA7V/oY9xLknv\n\tiV/CJV+/OetWGg7Db5g6s5yWRp0Jrhy5Xz+V8by9OcMiTOlrOClCGjQ7b6RqTNbMfI1L\n\tMWjA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=B0NzQdEISYlXkq1ZZNSBqH09ESr75qC10REHuytVqe0=;\n\tb=eT6Dqe8OgclQdZRfBfm44r5YWDZJQLh7bLbxl1gFFa7BzzyPO62hPkg8TGSSTipZDR\n\tcmOQiNFnvaUCVUAv6n10kws4omi2UhAJoLJ8c1WlAYOlo4UrrO4nrE1OwYHDGI+ssLNO\n\tBOXcO0GKkHe6gBJ6CURVSBufHTWn/YAF0pgiMUKs8Roy7jtUuGULzfJySaQQ1Fsn84IW\n\tizX/tmUOUWaj3BDx29paHVFgNsaSHaYfCheKoWb1IENsf2sEaD4maG0G0pzDmve+UmbT\n\tRUQyzWndL7Tzy1dmrck6QSxeo0JBQrC/oKEQa+c9ZpfBXktlhc+HwcnaZkAu4+j65x1W\n\tMBcg==","X-Gm-Message-State":"AHPjjUggF2RhATczjmzXny6Lg2JhT1lMPMAg6sGPyEis0G/kxiGCo/IV\n\tnkqEVGcQEQJ+xr8jb9s=","X-Google-Smtp-Source":"ADKCNb5Zs1RaEYY64TWyUqh4m7Zx5T6f42B0/Eeu7kXHVXh1ttQkO3OeV8FZqhv5O2oK3is+tD8Wcw==","X-Received":"by 10.223.161.82 with SMTP id r18mr4198668wrr.235.1504388975597; \n\tSat, 02 Sep 2017 14:49:35 -0700 (PDT)","From":"Jiri Pirko <jiri@resnulli.us>","To":"netdev@vger.kernel.org","Cc":"davem@davemloft.net, petrm@mellanox.com, idosch@mellanox.com,\n\tmlxsw@mellanox.com","Subject":"[patch net-next v2 02/21] mlxsw: reg: Update RATR to support\n\tIP-in-IP tunnels","Date":"Sat,  2 Sep 2017 23:49:10 +0200","Message-Id":"<20170902214929.2890-3-jiri@resnulli.us>","X-Mailer":"git-send-email 2.9.3","In-Reply-To":"<20170902214929.2890-1-jiri@resnulli.us>","References":"<20170902214929.2890-1-jiri@resnulli.us>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: Petr Machata <petrm@mellanox.com>\n\nSo far, adjacencies have always been of type Ethernet (with value of 0),\nand thus there was no need to explicitly support RATR type. However to\nsupport IP-in-IP adjacencies, this type and a suite of IP-in-IP-specific\nattributes need to be added.\n\nSigned-off-by: Petr Machata <petrm@mellanox.com>\nReviewed-by: Ido Schimmel <idosch@mellanox.com>\nSigned-off-by: Jiri Pirko <jiri@mellanox.com>\n---\n drivers/net/ethernet/mellanox/mlxsw/reg.h | 66 +++++++++++++++++++++++++++++++\n 1 file changed, 66 insertions(+)","diff":"diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h\nindex 8736f8492..6a7757f 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h\n+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h\n@@ -4362,6 +4362,38 @@ MLXSW_ITEM32(reg, ratr, v, 0x00, 24, 1);\n  */\n MLXSW_ITEM32(reg, ratr, a, 0x00, 16, 1);\n \n+enum mlxsw_reg_ratr_type {\n+\t/* Ethernet */\n+\tMLXSW_REG_RATR_TYPE_ETHERNET,\n+\t/* IPoIB Unicast without GRH.\n+\t * Reserved for Spectrum.\n+\t */\n+\tMLXSW_REG_RATR_TYPE_IPOIB_UC,\n+\t/* IPoIB Unicast with GRH. Supported only in table 0 (Ethernet unicast\n+\t * adjacency).\n+\t * Reserved for Spectrum.\n+\t */\n+\tMLXSW_REG_RATR_TYPE_IPOIB_UC_W_GRH,\n+\t/* IPoIB Multicast.\n+\t * Reserved for Spectrum.\n+\t */\n+\tMLXSW_REG_RATR_TYPE_IPOIB_MC,\n+\t/* MPLS.\n+\t * Reserved for SwitchX/-2.\n+\t */\n+\tMLXSW_REG_RATR_TYPE_MPLS,\n+\t/* IPinIP Encap.\n+\t * Reserved for SwitchX/-2.\n+\t */\n+\tMLXSW_REG_RATR_TYPE_IPIP,\n+};\n+\n+/* reg_ratr_type\n+ * Adjacency entry type.\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ratr, type, 0x04, 28, 4);\n+\n /* reg_ratr_adjacency_index_low\n  * Bits 15:0 of index into the adjacency table.\n  * For SwitchX and SwitchX-2, the adjacency table is linear and\n@@ -4416,6 +4448,34 @@ MLXSW_ITEM32(reg, ratr, trap_id, 0x0C, 0, 8);\n  */\n MLXSW_ITEM_BUF(reg, ratr, eth_destination_mac, 0x12, 6);\n \n+enum mlxsw_reg_ratr_ipip_type {\n+\t/* IPv4, address set by mlxsw_reg_ratr_ipip_ipv4_udip. */\n+\tMLXSW_REG_RATR_IPIP_TYPE_IPV4,\n+\t/* IPv6, address set by mlxsw_reg_ratr_ipip_ipv6_ptr. */\n+\tMLXSW_REG_RATR_IPIP_TYPE_IPV6,\n+};\n+\n+/* reg_ratr_ipip_type\n+ * Underlay destination ip type.\n+ * Note: the type field must match the protocol of the router interface.\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ratr, ipip_type, 0x10, 16, 4);\n+\n+/* reg_ratr_ipip_ipv4_udip\n+ * Underlay ipv4 dip.\n+ * Reserved when ipip_type is IPv6.\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ratr, ipip_ipv4_udip, 0x18, 0, 32);\n+\n+/* reg_ratr_ipip_ipv6_ptr\n+ * Pointer to IPv6 underlay destination ip address.\n+ * For Spectrum: Pointer to KVD linear space.\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ratr, ipip_ipv6_ptr, 0x1C, 0, 24);\n+\n static inline void\n mlxsw_reg_ratr_pack(char *payload,\n \t\t    enum mlxsw_reg_ratr_op op, bool valid,\n@@ -4435,6 +4495,12 @@ static inline void mlxsw_reg_ratr_eth_entry_pack(char *payload,\n \tmlxsw_reg_ratr_eth_destination_mac_memcpy_to(payload, dest_mac);\n }\n \n+static inline void mlxsw_reg_ratr_ipip4_entry_pack(char *payload, u32 ipv4_udip)\n+{\n+\tmlxsw_reg_ratr_ipip_type_set(payload, MLXSW_REG_RATR_IPIP_TYPE_IPV4);\n+\tmlxsw_reg_ratr_ipip_ipv4_udip_set(payload, ipv4_udip);\n+}\n+\n /* RICNT - Router Interface Counter Register\n  * -----------------------------------------\n  * The RICNT register retrieves per port performance counters\n","prefixes":["net-next","v2","02/21"]}