[PATCH net-next v7 5/9] net: marvell: prestera: Add length macros for prestera_ip_addr

From: Yevhen Orlov
Date: Sat Oct 01 2022 - 05:35:36 EST


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@xxxxxxxxxxx>
Signed-off-by: Taras Chornyi <tchornyi@xxxxxxxxxxx>
Co-developed-by: Oleksandr Mazur <oleksandr.mazur@xxxxxxxxxxx>
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@xxxxxxxxxxx>
Signed-off-by: Yevhen Orlov <yevhen.orlov@xxxxxxxxxxx>
---
drivers/net/ethernet/marvell/prestera/prestera_router_hw.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router_hw.h b/drivers/net/ethernet/marvell/prestera/prestera_router_hw.h
index 43bad23f38ec..9ca97919c863 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_router_hw.h
+++ b/drivers/net/ethernet/marvell/prestera/prestera_router_hw.h
@@ -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 {
--
2.17.1