summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeremy Kerr <jk@codeconstruct.com.au>2022-02-18 07:25:53 +0300
committerJoel Stanley <joel@jms.id.au>2022-03-18 03:38:45 +0300
commit50126574fd6ab6dcaad87b2c0d0c32d74a4e3db2 (patch)
tree57a483f44f5beac21f8d0f36c1c4c7f532fbba29 /include
parentde095564ecb4b484458a67dc2756fb1e5ffd6e77 (diff)
downloadlinux-50126574fd6ab6dcaad87b2c0d0c32d74a4e3db2.tar.xz
mctp: replace mctp_address_ok with more fine-grained helpers
Currently, we have mctp_address_ok(), which checks if an EID is in the "valid" range of 8-254 inclusive. However, 0 and 255 may also be valid addresses, depending on context. 0 is the NULL EID, which may be set when physical addressing is used. 255 is valid as a destination address for broadcasts. This change renames mctp_address_ok to mctp_address_unicast, and adds similar helpers for broadcast and null EIDs, which will be used in an upcoming commit. OpenBMC-Staging-Count: 1 Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit cb196b725936f6b776ad1d073f66fbe92aa798fa) Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'include')
-rw-r--r--include/net/mctp.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/net/mctp.h b/include/net/mctp.h
index e80a4baf8379..d37268fe6825 100644
--- a/include/net/mctp.h
+++ b/include/net/mctp.h
@@ -40,11 +40,21 @@ struct mctp_hdr {
#define MCTP_INITIAL_DEFAULT_NET 1
-static inline bool mctp_address_ok(mctp_eid_t eid)
+static inline bool mctp_address_unicast(mctp_eid_t eid)
{
return eid >= 8 && eid < 255;
}
+static inline bool mctp_address_broadcast(mctp_eid_t eid)
+{
+ return eid == 255;
+}
+
+static inline bool mctp_address_null(mctp_eid_t eid)
+{
+ return eid == 0;
+}
+
static inline bool mctp_address_matches(mctp_eid_t match, mctp_eid_t eid)
{
return match == eid || match == MCTP_ADDR_ANY;