From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E67FC433DF for ; Tue, 26 May 2020 19:19:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 631C82053B for ; Tue, 26 May 2020 19:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590520770; bh=MQNO4uxBdI9JV0RIQyWryaMm2XR7e2VAk4Nob3P9YIQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=gYG8fc+XM2ROivoVlFkATvPIrgTAcjdJYf4J6YzK8mTkl8cL6CR+bgyjgX+R7D11N f5KhVQk7oxTOVFtvT9b2MmOZ6qQI8eTQoAAuYLOrGXG4ifweUsB+C8ZC9dNfyxMVlT R6/wn71Z4RQZtFzJoJo0ApCZxqwL/sLzDAq4jMgM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404439AbgEZTT3 (ORCPT ); Tue, 26 May 2020 15:19:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:52018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392425AbgEZTTX (ORCPT ); Tue, 26 May 2020 15:19:23 -0400 Received: from kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net (unknown [163.114.132.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 686A520776; Tue, 26 May 2020 19:19:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590520762; bh=MQNO4uxBdI9JV0RIQyWryaMm2XR7e2VAk4Nob3P9YIQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nDtYg/JJmx6d9kEUeZBZY/r4Gz/dPR1cIHNFBYez+q5UnxlyLLFDFUZ2WJWTHOS9W bG8a/2iDQItD/JVqDMsSQ24NnqHD2ijp9PknjbF44QIiRGzkIOzmHlJv6yHUldorJ/ qut32l7W+3WBlXes0pmtXuG5acgftT2MEjgA3Pis= Date: Tue, 26 May 2020 12:19:20 -0700 From: Jakub Kicinski To: Saeed Mahameed Cc: "David S. Miller" , netdev@vger.kernel.org, Eli Cohen , Roi Dayan , Eli Britstein Subject: Re: [net-next 07/10] net/mlx5e: Add support for hw encapsulation of MPLS over UDP Message-ID: <20200526121920.7f5836e6@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20200522235148.28987-8-saeedm@mellanox.com> References: <20200522235148.28987-1-saeedm@mellanox.com> <20200522235148.28987-8-saeedm@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, 22 May 2020 16:51:45 -0700 Saeed Mahameed wrote: > +static inline __be32 mpls_label_id_field(__be32 label, u8 tos, u8 ttl) > +{ > + u32 res; > + > + /* mpls label is 32 bits long and construction as follows: > + * 20 bits label > + * 3 bits tos > + * 1 bit bottom of stack. Since we support only one label, this bit is > + * always set. > + * 8 bits TTL > + */ > + res = be32_to_cpu(label) << 12 | 1 << 8 | (tos & 7) << 9 | ttl; > + return cpu_to_be32(res); > +} No static inlines in C source, please. Besides this belongs in the mpls header, it's a generic helper.