kernel: qca-ssdk: update to 12.4.5.r1
[openwrt/staging/nbd.git] / package / kernel / qca-nss-dp / patches / 0009-switchdev-use-new-switchdev-flags.patch
1 From f95868d54301c0f54e968ec9d978c9caa02ee425 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Fri, 18 Mar 2022 18:24:18 +0100
4 Subject: [PATCH] switchdev: use new switchdev flags
5
6 Since kernel 5.12 switched utilizes a new way of setting the flags by
7 using a dedicated structure with flags and mask.
8
9 So fix using kernels 5.12 and later.
10
11 Signed-off-by: Robert Marko <robimarko@gmail.com>
12 ---
13 include/nss_dp_dev.h | 7 +++++++
14 nss_dp_switchdev.c | 2 +-
15 2 files changed, 8 insertions(+), 1 deletion(-)
16
17 --- a/include/nss_dp_dev.h
18 +++ b/include/nss_dp_dev.h
19 @@ -24,6 +24,9 @@
20 #include <linux/platform_device.h>
21 #include <linux/phy.h>
22 #include <linux/version.h>
23 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
24 +#include <net/switchdev.h>
25 +#endif
26
27 #include "nss_dp_api_if.h"
28 #include "nss_dp_hal_if.h"
29 @@ -126,7 +129,11 @@ struct nss_dp_dev {
30 /* switchdev related attributes */
31 #ifdef CONFIG_NET_SWITCHDEV
32 u8 stp_state; /* STP state of this physical port */
33 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
34 unsigned long brport_flags; /* bridge port flags */
35 +#else
36 + struct switchdev_brport_flags brport_flags; /* bridge port flags */
37 +#endif
38 #endif
39 uint32_t rx_page_mode; /* page mode for Rx processing */
40 uint32_t rx_jumbo_mru; /* Jumbo mru value for Rx processing */
41 --- a/nss_dp_switchdev.c
42 +++ b/nss_dp_switchdev.c
43 @@ -296,7 +296,7 @@ static int nss_dp_port_attr_set(struct n
44 switch (attr->id) {
45 case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
46 dp_priv->brport_flags = attr->u.brport_flags;
47 - netdev_dbg(dev, "set brport_flags %lu\n", attr->u.brport_flags);
48 + netdev_dbg(dev, "set brport_flags %lu\n", attr->u.brport_flags.val);
49 return 0;
50 case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
51 return nss_dp_stp_state_set(dp_priv, attr->u.stp_state);