0009-switchdev-use-new-switchdev-flags.patch 1.8 KB

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