From c9afdcdd2642485a6476906be9da2e811090fc7a Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 18 Mar 2022 18:06:03 +0100
Subject: [PATCH] switchdev: remove the transaction structure

Since 5.12 there is no transaction structure anymore, so drop it for
5.12 and newer.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 nss_dp_switchdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/nss_dp_switchdev.c
+++ b/nss_dp_switchdev.c
@@ -279,13 +279,19 @@ void nss_dp_switchdev_setup(struct net_d
  *	Sets attributes
  */
 static int nss_dp_port_attr_set(struct net_device *dev,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
 				const struct switchdev_attr *attr,
 				struct switchdev_trans *trans)
+#else
+				const struct switchdev_attr *attr)
+#endif
 {
 	struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(dev);
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
 	if (switchdev_trans_ph_prepare(trans))
 		return 0;
+#endif
 
 	switch (attr->id) {
 	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
@@ -309,8 +315,12 @@ static int nss_dp_switchdev_port_attr_se
 {
 	int err;
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
 	err = nss_dp_port_attr_set(netdev, port_attr_info->attr,
 				   port_attr_info->trans);
+#else
+	err = nss_dp_port_attr_set(netdev, port_attr_info->attr);
+#endif
 
 	port_attr_info->handled = true;
 	return notifier_from_errno(err);
