Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1673019imm; Sun, 23 Sep 2018 09:06:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV63yjdHYFWg5gKNAOhCbRh1kSu3DJcQyQSfIyOq3f/u+Bib2NdwJolYAHXlRZ7iNOo9l7m5c X-Received: by 2002:a63:a54f:: with SMTP id r15-v6mr6270333pgu.336.1537718803835; Sun, 23 Sep 2018 09:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537718803; cv=none; d=google.com; s=arc-20160816; b=ykU7Te1la7wxXhB/DYxazHH0/LhZOTfucL04o4CWhtFynbSiEDJxs/wrZzRle92NRV cuQa+yxj8rp3YIzyeBJghvij5k3SS5arF5Q929XAVdu+sQzDKP6P9+RjlhCaoET41pun mBxeSbM1/+c4RYUoBnhBcmdZzEYPFvjO2gkGX4i6Y+IDWRSKHN+MPW2GH4K6Yf8pNWe1 UF5NRNAEgNcXq7pvYJ8Ao5FXArQ7UtSnnh+2u3U2ypqKhLeLwpYeSc3nQShdkEDZ68+J nG5vuYFGnYRDD76Y6p6aRl2Wy8/9I3TewoI3BKGgqQ9UTRGS5OILwrGIFg8ED1s72GHT FwWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:openpgp:from:cc:references:to :subject; bh=TgTU0goy3hmpVTuOEcyEH0w/acD+AFS4fN4YMTGPmc4=; b=XnpjasaTUTHlI0xLlnBhr56wjAIwfIjk2/VlqWLjM11qDSkM1YGpItgwiW6q0mRoQi kmdsQZbMqINaYG92YMLQrzPXp6eHdxoILZny5PNcsLhKK42Loc0gGhipcBN1rF7yL5wu OeCJA4riwx1IXRTR9fiMaX2R71T22nEMIaklFy8e1aJWiw9TivVrR01riUC5BkqexwrR DP1y5IBdC+v7qmz3vmugm31Si8AIJI0Tnoa8lZcoAxZxDiq/yXO+CZFVgtj42Su8/zHG plkws1GdMIw3nyFyLDBIeXeD0xNBMgzW+4IJsmSa8IekyCI/h3RXsf+GxL/FNcbgMfXq AFjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2-v6si32624944plq.242.2018.09.23.09.06.27; Sun, 23 Sep 2018 09:06:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726420AbeIWWEL (ORCPT + 99 others); Sun, 23 Sep 2018 18:04:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:41384 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726094AbeIWWEL (ORCPT ); Sun, 23 Sep 2018 18:04:11 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DAE08AD68; Sun, 23 Sep 2018 16:06:10 +0000 (UTC) Subject: Re: [RFC 2/3 net] lorawan: Add macro and definition for LoRaWAN class modlue To: Jian-Hong Pan References: Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jiri Pirko , Marcel Holtmann , "David S. Miller" , Matthias Brugger , Janus Piwek , =?UTF-8?Q?Michael_R=c3=b6der?= , Dollar Chen , Ken Yu , =?UTF-8?Q?Konstantin_B=c3=b6hm?= , Jan Jongboom , Jon Ortego , "contact@snootlab.com" , Ben Whitten , Brian Ray , lora@globalsat.com.tw, Alexander Graf , =?UTF-8?Q?Michal_Kube=c4=8dek?= , Rob Herring , devicetree@vger.kernel.org, Steve deRosier , Mark Brown , linux-spi@vger.kernel.org, Pieter ROBYNS , Hasnain Virk , linux-wpan - ML , Stefan Schmidt , Daniele Comel , shess@hessware.de, Xue Liu , fomi From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Openpgp: preference=signencrypt Autocrypt: addr=afaerber@suse.de; prefer-encrypt=mutual; keydata= xsFNBE6W6ZQBEAC/BIukDnkVenIkK9O14UucicBIVvRB5WSMHC23msS+R2h915mW7/vXfn+V 0nrr5ECmEg/5OjujKf0x/uhJYrsxcp45nDyYCk+RYoOJmGzzUFya1GvT/c04coZ8VmgFUWGE vCfhHJro85dZUL99IoLP21VXEVlCPyIngSstikeuf14SY17LPTN1aIpGQDI2Qt8HHY1zOVWv iz53aiFLFeIVhQlBmOABH2Ifr2M9loRC9yOyGcE2GhlzgyHGlQxEVGFn/QptX6iYbtaTBTU0 c72rpmbe1Nec6hWuzSwu2uE8lF+HYcYi+22ml1XBHNMBeAdSEbSfDbwc///8QKtckUzbDvME S8j4KuqQhwvYkSg7dV9rs53WmjO2Wd4eygkC3tBhPM5s38/6CVGl3ABiWJs3kB08asUNy8Wk juusU/nRJbXDzxu1d+hv0d+s5NOBy/5+7Pa6HeyBnh1tUmCs5/f1D/cJnuzzYwAmZTHFUsfQ ygGBRRKpAVu0VxCFNPSYKW0ULi5eZV6bcj+NAhtafGsWcv8WPFXgVE8s2YU38D1VtlBvCo5/ 0MPtQORqAQ/Itag1EHHtnfuK3MBtA0fNxQbb2jha+/oMAi5hKpmB/zAlFoRtYHwjFPFldHfv Iljpe1S0rDASaF9NsQPfUBEm7dA5UUkyvvi00HZ3e7/uyBGb0QARAQABzSJBbmRyZWFzIEbD pHJiZXIgPGFmYWVyYmVyQHN1c2UuZGU+wsF7BBMBAgAlAhsDBgsJCAcDAgYVC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eb7WxOt5pSTVVqZkv7Q== Organization: SUSE Linux GmbH Message-ID: Date: Sun, 23 Sep 2018 18:06:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jian-Hong, Many thanks and sorry for the delay. This patch mostly looks good and should go in before its first uses, so I would like to queue it soon for my hardware-MAC module drivers - but some questions below. Also a typo in the subject, and we should probably prepend "net: " and I would personally not mention the module here as it's a userspace API. Am 23.08.18 um 19:15 schrieb Jian-Hong Pan: > This patch add the macro and definition for the implementation of > LoRaWAN protocol. I would fix up the grammar nits in my tree then. > > Signed-off-by: Jian-Hong Pan > --- > include/linux/socket.h | 5 ++++- > include/uapi/linux/if_arp.h | 1 + > include/uapi/linux/if_ether.h | 1 + > net/core/dev.c | 4 ++-- > security/selinux/hooks.c | 4 +++- > security/selinux/include/classmap.h | 4 +++- > 6 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/include/linux/socket.h b/include/linux/socket.h > index aa1e288b1659..e5c8381fd1aa 100644 > --- a/include/linux/socket.h > +++ b/include/linux/socket.h > @@ -209,8 +209,9 @@ struct ucred { > */ > #define AF_XDP 44 /* XDP sockets */ > #define AF_LORA 45 /* LoRa sockets */ > +#define AF_LORAWAN 46 /* LoRaWAN sockets */ > > -#define AF_MAX 46 /* For now.. */ > +#define AF_MAX 47 /* For now.. */ > > /* Protocol families, same as address families. */ > #define PF_UNSPEC AF_UNSPEC > @@ -261,6 +262,7 @@ struct ucred { > #define PF_SMC AF_SMC > #define PF_XDP AF_XDP > #define PF_LORA AF_LORA > +#define PF_LORAWAN AF_LORAWAN > #define PF_MAX AF_MAX > > /* Maximum queue length specifiable by listen. */ > @@ -343,6 +345,7 @@ struct ucred { > #define SOL_KCM 281 > #define SOL_TLS 282 > #define SOL_XDP 283 > +#define SOL_LORAWAN 284 > > /* IPX options */ > #define IPX_TYPE 1 > diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h > index 1ed7cb3f2129..2376f7839355 100644 > --- a/include/uapi/linux/if_arp.h > +++ b/include/uapi/linux/if_arp.h > @@ -99,6 +99,7 @@ > #define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ > #define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ > #define ARPHRD_LORA 827 /* LoRa */ > +#define ARPHRD_LORAWAN 828 /* LoRaWAN */ > > #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ > #define ARPHRD_NONE 0xFFFE /* zero header length */ > diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h > index 45644dcf5b39..b1ac70d4a377 100644 > --- a/include/uapi/linux/if_ether.h > +++ b/include/uapi/linux/if_ether.h > @@ -148,6 +148,7 @@ > * aggregation protocol > */ > #define ETH_P_LORA 0x00FA /* LoRa */ > +#define ETH_P_LORAWAN 0x00FB /* LoRaWAN */ > > /* > * This is an Ethernet frame header. > diff --git a/net/core/dev.c b/net/core/dev.c > index f68122f0ab02..b95ce79ec5a8 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -297,7 +297,7 @@ static const unsigned short netdev_lock_type[] = { > ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL, > ARPHRD_FCFABRIC, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM, > ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, ARPHRD_PHONET_PIPE, > - ARPHRD_IEEE802154, ARPHRD_VOID, ARPHRD_NONE}; > + ARPHRD_IEEE802154, ARPHRD_LORAWAN, ARPHRD_VOID, ARPHRD_NONE}; > > static const char *const netdev_lock_name[] = { > "_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25", > @@ -314,7 +314,7 @@ static const char *const netdev_lock_name[] = { > "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL", > "_xmit_FCFABRIC", "_xmit_IEEE80211", "_xmit_IEEE80211_PRISM", > "_xmit_IEEE80211_RADIOTAP", "_xmit_PHONET", "_xmit_PHONET_PIPE", > - "_xmit_IEEE802154", "_xmit_VOID", "_xmit_NONE"}; > + "_xmit_IEEE802154", "_xmit_LORAWAN", "_xmit_VOID", "_xmit_NONE"}; > > static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)]; > static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)]; All your new constants except SOL_LORAWAN are always next to a LoRa one, but not in these two arrays. I don't have such changes in my original LoRa patch - am I missing such an array extension for ARPHRD_LORA then, or what is the criteria for when to add this? Other changes look fine to me. Regards, Andreas > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index aaf520a689d8..0da3a1d69cb8 100644 > --- a/security/selinux/hooks.c > +++ b/security/selinux/hooks.c > @@ -1477,7 +1477,9 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc > return SECCLASS_XDP_SOCKET; > case PF_LORA: > return SECCLASS_LORA_SOCKET; > -#if PF_MAX > 46 > + case PF_LORAWAN: > + return SECCLASS_LORAWAN_SOCKET; > +#if PF_MAX > 47 > #error New address family defined, please update this function. > #endif > } > diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h > index 060d4bf8385e..fa0151fe6f32 100644 > --- a/security/selinux/include/classmap.h > +++ b/security/selinux/include/classmap.h > @@ -244,9 +244,11 @@ struct security_class_mapping secclass_map[] = { > { COMMON_SOCK_PERMS, NULL } }, > { "lora_socket", > { COMMON_SOCK_PERMS, NULL } }, > + { "lorawan_socket", > + { COMMON_SOCK_PERMS, NULL } }, > { NULL } > }; > > -#if PF_MAX > 46 > +#if PF_MAX > 47 > #error New address family defined, please update secclass_map. > #endif > -- SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg)