net: marvell: prestera: Add length macros for prestera_ip_addr
authorYevhen Orlov <yevhen.orlov@plvision.eu>
Sat, 1 Oct 2022 09:34:13 +0000 (12:34 +0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 4 Oct 2022 00:14:53 +0000 (17:14 -0700)
Add macros to determine IP address length (internal driver types).
This will be used in next patches for nexthops logic.

Co-developed-by: Taras Chornyi <tchornyi@marvell.com>
Signed-off-by: Taras Chornyi <tchornyi@marvell.com>
Co-developed-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/prestera/prestera_router_hw.h

index 43bad23f38ecbdc7360345064878618521a55143..9ca97919c863893ed5f5cd82fd8960a4a7246405 100644 (file)
@@ -31,6 +31,8 @@ struct prestera_ip_addr {
                PRESTERA_IPV4 = 0,
                PRESTERA_IPV6
        } v;
+#define PRESTERA_IP_ADDR_PLEN(V) ((V) == PRESTERA_IPV4 ? 32 : \
+                                 /* (V) == PRESTERA_IPV6 ? */ 128 /* : 0 */)
 };
 
 struct prestera_nh_neigh_key {