diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-03-19 16:59:34 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-03-19 17:00:01 +0100 |
commit | 4654eba8cbb3fcf48c6fc24fbaffa0623d9faea2 (patch) | |
tree | 0b3056c04bda1988a3705f315680224387d5a68b /drivers/s390/net/qeth_l3.h | |
parent | 09b9ddfaa18317f463085d602cf5f60a5fa88665 (diff) | |
parent | a6618f4aedb2b60932d766bd82ae7ce866e842aa (diff) |
Merge branch 'for-linus' into for-next
Back-merge of for-linus branch for applying the further UAC3 patches.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'drivers/s390/net/qeth_l3.h')
-rw-r--r-- | drivers/s390/net/qeth_l3.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/s390/net/qeth_l3.h b/drivers/s390/net/qeth_l3.h index bdd45f4dcace..498fe9af2cdb 100644 --- a/drivers/s390/net/qeth_l3.h +++ b/drivers/s390/net/qeth_l3.h @@ -40,8 +40,40 @@ struct qeth_ipaddr { unsigned int pfxlen; } a6; } u; - }; + +static inline bool qeth_l3_addr_match_ip(struct qeth_ipaddr *a1, + struct qeth_ipaddr *a2) +{ + if (a1->proto != a2->proto) + return false; + if (a1->proto == QETH_PROT_IPV6) + return ipv6_addr_equal(&a1->u.a6.addr, &a2->u.a6.addr); + return a1->u.a4.addr == a2->u.a4.addr; +} + +static inline bool qeth_l3_addr_match_all(struct qeth_ipaddr *a1, + struct qeth_ipaddr *a2) +{ + /* Assumes that the pair was obtained via qeth_l3_addr_find_by_ip(), + * so 'proto' and 'addr' match for sure. + * + * For ucast: + * - 'mac' is always 0. + * - 'mask'/'pfxlen' for RXIP/VIPA is always 0. For NORMAL, matching + * values are required to avoid mixups in takeover eligibility. + * + * For mcast, + * - 'mac' is mapped from the IP, and thus always matches. + * - 'mask'/'pfxlen' is always 0. + */ + if (a1->type != a2->type) + return false; + if (a1->proto == QETH_PROT_IPV6) + return a1->u.a6.pfxlen == a2->u.a6.pfxlen; + return a1->u.a4.mask == a2->u.a4.mask; +} + static inline u64 qeth_l3_ipaddr_hash(struct qeth_ipaddr *addr) { u64 ret = 0; |