Commit df6a2067 authored by Simon Horman's avatar Simon Horman Committed by David S. Miller

rocker: make rocker_port_internal_vlan_id_{get, put}() non-transactional

The motivation for this is that rocker_port_internal_vlan_id_{get,put} appear
to only partially implement the transaction model: memory allocation
and freeing is transactional, but hash and bitmap manipulation is not.

The latter could be fixed, however, as it is not currently exercised
due to trans always being SWITCHDEV_TRANS_NONE it seems cleaner
to make rocker_port_internal_vlan_id_get non-transactional.

This problem was introduced by c4f20321 ("rocker: support
prepare-commit transaction model").

Found by inspection.
I do not believe that this change should have any run-time effect.
Acked-by: default avatarScott Feldman <sfeldma@gmail.com>
Acked-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 550ecc92
...@@ -3853,7 +3853,6 @@ rocker_internal_vlan_tbl_find(struct rocker *rocker, int ifindex) ...@@ -3853,7 +3853,6 @@ rocker_internal_vlan_tbl_find(struct rocker *rocker, int ifindex)
} }
static __be16 rocker_port_internal_vlan_id_get(struct rocker_port *rocker_port, static __be16 rocker_port_internal_vlan_id_get(struct rocker_port *rocker_port,
enum switchdev_trans trans,
int ifindex) int ifindex)
{ {
struct rocker *rocker = rocker_port->rocker; struct rocker *rocker = rocker_port->rocker;
...@@ -3862,7 +3861,7 @@ static __be16 rocker_port_internal_vlan_id_get(struct rocker_port *rocker_port, ...@@ -3862,7 +3861,7 @@ static __be16 rocker_port_internal_vlan_id_get(struct rocker_port *rocker_port,
unsigned long lock_flags; unsigned long lock_flags;
int i; int i;
entry = rocker_port_kzalloc(rocker_port, trans, sizeof(*entry)); entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (!entry) if (!entry)
return 0; return 0;
...@@ -3872,7 +3871,7 @@ static __be16 rocker_port_internal_vlan_id_get(struct rocker_port *rocker_port, ...@@ -3872,7 +3871,7 @@ static __be16 rocker_port_internal_vlan_id_get(struct rocker_port *rocker_port,
found = rocker_internal_vlan_tbl_find(rocker, ifindex); found = rocker_internal_vlan_tbl_find(rocker, ifindex);
if (found) { if (found) {
rocker_port_kfree(rocker_port, trans, entry); kfree(entry);
goto found; goto found;
} }
...@@ -3896,7 +3895,6 @@ static __be16 rocker_port_internal_vlan_id_get(struct rocker_port *rocker_port, ...@@ -3896,7 +3895,6 @@ static __be16 rocker_port_internal_vlan_id_get(struct rocker_port *rocker_port,
} }
static void rocker_port_internal_vlan_id_put(struct rocker_port *rocker_port, static void rocker_port_internal_vlan_id_put(struct rocker_port *rocker_port,
enum switchdev_trans trans,
int ifindex) int ifindex)
{ {
struct rocker *rocker = rocker_port->rocker; struct rocker *rocker = rocker_port->rocker;
...@@ -3918,7 +3916,7 @@ static void rocker_port_internal_vlan_id_put(struct rocker_port *rocker_port, ...@@ -3918,7 +3916,7 @@ static void rocker_port_internal_vlan_id_put(struct rocker_port *rocker_port,
bit = ntohs(found->vlan_id) - ROCKER_INTERNAL_VLAN_ID_BASE; bit = ntohs(found->vlan_id) - ROCKER_INTERNAL_VLAN_ID_BASE;
clear_bit(bit, rocker->internal_vlan_bitmap); clear_bit(bit, rocker->internal_vlan_bitmap);
hash_del(&found->entry); hash_del(&found->entry);
rocker_port_kfree(rocker_port, trans, found); kfree(found);
} }
not_found: not_found:
...@@ -4904,9 +4902,7 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number) ...@@ -4904,9 +4902,7 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
rocker_port_set_learning(rocker_port, SWITCHDEV_TRANS_NONE); rocker_port_set_learning(rocker_port, SWITCHDEV_TRANS_NONE);
rocker_port->internal_vlan_id = rocker_port->internal_vlan_id =
rocker_port_internal_vlan_id_get(rocker_port, rocker_port_internal_vlan_id_get(rocker_port, dev->ifindex);
SWITCHDEV_TRANS_NONE,
dev->ifindex);
err = rocker_port_ig_tbl(rocker_port, SWITCHDEV_TRANS_NONE, 0); err = rocker_port_ig_tbl(rocker_port, SWITCHDEV_TRANS_NONE, 0);
if (err) { if (err) {
dev_err(&pdev->dev, "install ig port table failed\n"); dev_err(&pdev->dev, "install ig port table failed\n");
...@@ -5154,7 +5150,7 @@ static int rocker_port_bridge_join(struct rocker_port *rocker_port, ...@@ -5154,7 +5150,7 @@ static int rocker_port_bridge_join(struct rocker_port *rocker_port,
{ {
int err; int err;
rocker_port_internal_vlan_id_put(rocker_port, SWITCHDEV_TRANS_NONE, rocker_port_internal_vlan_id_put(rocker_port,
rocker_port->dev->ifindex); rocker_port->dev->ifindex);
rocker_port->bridge_dev = bridge; rocker_port->bridge_dev = bridge;
...@@ -5165,9 +5161,7 @@ static int rocker_port_bridge_join(struct rocker_port *rocker_port, ...@@ -5165,9 +5161,7 @@ static int rocker_port_bridge_join(struct rocker_port *rocker_port,
if (err) if (err)
return err; return err;
rocker_port->internal_vlan_id = rocker_port->internal_vlan_id =
rocker_port_internal_vlan_id_get(rocker_port, rocker_port_internal_vlan_id_get(rocker_port, bridge->ifindex);
SWITCHDEV_TRANS_NONE,
bridge->ifindex);
return rocker_port_vlan(rocker_port, SWITCHDEV_TRANS_NONE, 0, 0); return rocker_port_vlan(rocker_port, SWITCHDEV_TRANS_NONE, 0, 0);
} }
...@@ -5175,7 +5169,7 @@ static int rocker_port_bridge_leave(struct rocker_port *rocker_port) ...@@ -5175,7 +5169,7 @@ static int rocker_port_bridge_leave(struct rocker_port *rocker_port)
{ {
int err; int err;
rocker_port_internal_vlan_id_put(rocker_port, SWITCHDEV_TRANS_NONE, rocker_port_internal_vlan_id_put(rocker_port,
rocker_port->bridge_dev->ifindex); rocker_port->bridge_dev->ifindex);
rocker_port->bridge_dev = NULL; rocker_port->bridge_dev = NULL;
...@@ -5187,7 +5181,6 @@ static int rocker_port_bridge_leave(struct rocker_port *rocker_port) ...@@ -5187,7 +5181,6 @@ static int rocker_port_bridge_leave(struct rocker_port *rocker_port)
return err; return err;
rocker_port->internal_vlan_id = rocker_port->internal_vlan_id =
rocker_port_internal_vlan_id_get(rocker_port, rocker_port_internal_vlan_id_get(rocker_port,
SWITCHDEV_TRANS_NONE,
rocker_port->dev->ifindex); rocker_port->dev->ifindex);
err = rocker_port_vlan(rocker_port, SWITCHDEV_TRANS_NONE, 0, 0); err = rocker_port_vlan(rocker_port, SWITCHDEV_TRANS_NONE, 0, 0);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment