{"id":809076,"url":"http://patchwork.ozlabs.org/api/1.0/patches/809076/?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":"<20170902152126.17286-2-jiri@resnulli.us>","date":"2017-09-02T15:21:06","name":"[net-next,01/21] mlxsw: reg: Update RITR to support loopback device","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"eddb70c2d2f47ad3ed622a677741be634ab58229","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/20170902152126.17286-2-jiri@resnulli.us/mbox/","series":[{"id":1159,"url":"http://patchwork.ozlabs.org/api/1.0/series/1159/?format=json","date":"2017-09-02T15:21:05","name":"mlxsw: Offloading GRE tunnels","version":1,"mbox":"http://patchwork.ozlabs.org/series/1159/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809076/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=\"xHovTpAu\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xl0Ff0ZmCz9sRY\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSun,  3 Sep 2017 01:21:42 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752723AbdIBPVe (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSat, 2 Sep 2017 11:21:34 -0400","from mail-wm0-f68.google.com ([74.125.82.68]:33320 \"EHLO\n\tmail-wm0-f68.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752712AbdIBPVc (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sat, 2 Sep 2017 11:21:32 -0400","by mail-wm0-f68.google.com with SMTP id 187so2416528wmn.0\n\tfor <netdev@vger.kernel.org>; Sat, 02 Sep 2017 08:21:32 -0700 (PDT)","from localhost (jirka.pirko.cz. [84.16.102.26])\n\tby smtp.gmail.com with ESMTPSA id\n\te5sm2508101wrc.62.2017.09.02.08.21.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSat, 02 Sep 2017 08:21:30 -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=R1DNXHa4C6ahOvke3DNWMPUKMGgy0Zq0XJ+1gJGeLUg=;\n\tb=xHovTpAuLVC3eGa4eg7Y6vksD+JuZ91hXB4EYg7abpDGBHTxvwtrTm5X+d6w1J3dsE\n\twQFMDddrPX1ftj4xUhHt0h3nAEmLaPdVaYJ3ar694DyGTCV2Quusk9z2lZnGTZksS9nm\n\t/o9XQiHx1VxsUry5hceD+YMVxHV1IzaB+jDuHFvoMON58XqNeKLt5VTvMjwhNhkDPfNw\n\tZN/EUztJp8X9XQB5cBi8jHbhxVKPVuFD6fw1cK2myFd4zvRcOXHFQszgTwkoGb+2s0tD\n\twvmDio3ATNvGjiB6BTX8onFCX7gwd7DOxAEsd4p3F/jv/yZ9NqBw6dR8UIi5ggjl9VEU\n\t5HvA==","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=R1DNXHa4C6ahOvke3DNWMPUKMGgy0Zq0XJ+1gJGeLUg=;\n\tb=QvVrNrh4C2RV5TfHOHUnBMBw+78zZ2KGwkJy6vQRb9T5poX0+jqkTAFq5mnJzISy83\n\tjtsUiASSuV+8OonzB/swkutDj2kx4iyCktelu8aEDHvbZD1E1gvvBvgmBCRWdBw8Cejh\n\ttHU0hFN1d93c4vNGZOmG6Ba4Xp8QjdI/7KzQRh2nO3lhde59+9J3I7t8WKFC7FQz6Sdn\n\t83kxNSHBSMjQjh1l0XewUrBdM2u7rGAmOJH1mKgVGuktPKLhVY5G5xV2Z/8vJBESziXp\n\t5LjPRxNm7xzdMxjaTI9RKVlW+BpcHKkg1vY54IeaKnBjMpMraZqqvUgbX0vJQ/6t2/CY\n\tzCvw==","X-Gm-Message-State":"AHPjjUg1q5TM8yg5Kd/HS4qP1ZdQi+p/rn5t48gy2paLjabJpTq8J1FJ\n\tuz0XvaNaccxuP7LTrgo=","X-Google-Smtp-Source":"ADKCNb7Phdp5oq/RTR4L4u65M1KxZvk3sQc1nO+vw7/vXUD9DM3QHuLSY5RIUrJFax5oUQY5548Y1A==","X-Received":"by 10.28.135.149 with SMTP id j143mr843981wmd.72.1504365691113; \n\tSat, 02 Sep 2017 08:21:31 -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 01/21] mlxsw: reg: Update RITR to support loopback\n\tdevice","Date":"Sat,  2 Sep 2017 17:21:06 +0200","Message-Id":"<20170902152126.17286-2-jiri@resnulli.us>","X-Mailer":"git-send-email 2.9.3","In-Reply-To":"<20170902152126.17286-1-jiri@resnulli.us>","References":"<20170902152126.17286-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\nUpdate the register so that loopback RIFs can be created and loopback\nproperties specified.\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 | 88 +++++++++++++++++++++++++++++++\n 1 file changed, 88 insertions(+)","diff":"diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h\nindex 11e290c..8736f8492 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h\n+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h\n@@ -3998,6 +3998,8 @@ enum mlxsw_reg_ritr_if_type {\n \tMLXSW_REG_RITR_FID_IF,\n \t/* Sub-port interface. */\n \tMLXSW_REG_RITR_SP_IF,\n+\t/* Loopback Interface. */\n+\tMLXSW_REG_RITR_LOOPBACK_IF,\n };\n \n /* reg_ritr_type\n@@ -4129,6 +4131,67 @@ MLXSW_ITEM32(reg, ritr, sp_if_system_port, 0x08, 0, 16);\n  */\n MLXSW_ITEM32(reg, ritr, sp_if_vid, 0x18, 0, 12);\n \n+/* Loopback Interface */\n+\n+enum mlxsw_reg_ritr_loopback_protocol {\n+\t/* IPinIP IPv4 underlay Unicast */\n+\tMLXSW_REG_RITR_LOOPBACK_PROTOCOL_IPIP_IPV4,\n+\t/* IPinIP IPv6 underlay Unicast */\n+\tMLXSW_REG_RITR_LOOPBACK_PROTOCOL_IPIP_IPV6,\n+};\n+\n+/* reg_ritr_loopback_protocol\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ritr, loopback_protocol, 0x08, 28, 4);\n+\n+enum mlxsw_reg_ritr_loopback_ipip_type {\n+\t/* Tunnel is IPinIP. */\n+\tMLXSW_REG_RITR_LOOPBACK_IPIP_TYPE_IP_IN_IP,\n+\t/* Tunnel is GRE, no key. */\n+\tMLXSW_REG_RITR_LOOPBACK_IPIP_TYPE_IP_IN_GRE_IN_IP,\n+\t/* Tunnel is GRE, with a key. */\n+\tMLXSW_REG_RITR_LOOPBACK_IPIP_TYPE_IP_IN_GRE_KEY_IN_IP,\n+};\n+\n+/* reg_ritr_loopback_ipip_type\n+ * Encapsulation type.\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ritr, loopback_ipip_type, 0x10, 24, 4);\n+\n+enum mlxsw_reg_ritr_loopback_ipip_options {\n+\t/* The key is defined by gre_key. */\n+\tMLXSW_REG_RITR_LOOPBACK_IPIP_OPTIONS_GRE_KEY_PRESET,\n+};\n+\n+/* reg_ritr_loopback_ipip_options\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ritr, loopback_ipip_options, 0x10, 20, 4);\n+\n+/* reg_ritr_loopback_ipip_uvr\n+ * Underlay Virtual Router ID.\n+ * Range is 0..cap_max_virtual_routers-1.\n+ * Reserved for Spectrum-2.\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ritr, loopback_ipip_uvr, 0x10, 0, 16);\n+\n+/* reg_ritr_loopback_ipip_usip*\n+ * Encapsulation Underlay source IP.\n+ * Access: RW\n+ */\n+MLXSW_ITEM_BUF(reg, ritr, loopback_ipip_usip6, 0x18, 16);\n+MLXSW_ITEM32(reg, ritr, loopback_ipip_usip4, 0x24, 0, 32);\n+\n+/* reg_ritr_loopback_ipip_gre_key\n+ * GRE Key.\n+ * Reserved when ipip_type is not IP_IN_GRE_KEY_IN_IP.\n+ * Access: RW\n+ */\n+MLXSW_ITEM32(reg, ritr, loopback_ipip_gre_key, 0x28, 0, 32);\n+\n /* Shared between ingress/egress */\n enum mlxsw_reg_ritr_counter_set_type {\n \t/* No Count. */\n@@ -4219,6 +4282,31 @@ static inline void mlxsw_reg_ritr_pack(char *payload, bool enable,\n \tmlxsw_reg_ritr_if_mac_memcpy_to(payload, mac);\n }\n \n+static inline void\n+mlxsw_reg_ritr_loopback_ipip_common_pack(char *payload,\n+\t\t\t    enum mlxsw_reg_ritr_loopback_ipip_type ipip_type,\n+\t\t\t    enum mlxsw_reg_ritr_loopback_ipip_options options,\n+\t\t\t    u16 uvr_id, u32 gre_key)\n+{\n+\tmlxsw_reg_ritr_loopback_ipip_type_set(payload, ipip_type);\n+\tmlxsw_reg_ritr_loopback_ipip_options_set(payload, options);\n+\tmlxsw_reg_ritr_loopback_ipip_uvr_set(payload, uvr_id);\n+\tmlxsw_reg_ritr_loopback_ipip_gre_key_set(payload, gre_key);\n+}\n+\n+static inline void\n+mlxsw_reg_ritr_loopback_ipip4_pack(char *payload,\n+\t\t\t    enum mlxsw_reg_ritr_loopback_ipip_type ipip_type,\n+\t\t\t    enum mlxsw_reg_ritr_loopback_ipip_options options,\n+\t\t\t    u16 uvr_id, u32 usip, u32 gre_key)\n+{\n+\tmlxsw_reg_ritr_loopback_protocol_set(payload,\n+\t\t\t\t    MLXSW_REG_RITR_LOOPBACK_PROTOCOL_IPIP_IPV4);\n+\tmlxsw_reg_ritr_loopback_ipip_common_pack(payload, ipip_type, options,\n+\t\t\t\t\t\t uvr_id, gre_key);\n+\tmlxsw_reg_ritr_loopback_ipip_usip4_set(payload, usip);\n+}\n+\n /* RATR - Router Adjacency Table Register\n  * --------------------------------------\n  * The RATR register is used to configure the Router Adjacency (next-hop)\n","prefixes":["net-next","01/21"]}