diff options
| author | Elad Raz <eladr@mellanox.com> | 2016-04-21 06:52:43 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-04-24 14:23:32 -0400 |
| commit | 7ceb2afbd6aee4643056b47156baad6841db8e78 (patch) | |
| tree | 036274876d95f82a6f64d2fb35409987522951e3 /net/switchdev | |
| parent | f75cfbaddeef943aed479b80415c3dcc63ff4247 (diff) | |
switchdev: Adding complete operation to deferred switchdev ops
When using switchdev deferred operation (SWITCHDEV_F_DEFER), the operation
is executed in different context and the application doesn't have any way
to get the operation real status.
Adding a completion callback fixes that. This patch adds fields to
switchdev_attr and switchdev_obj "complete_priv" field which is used by
the "complete" callback.
Application can set a complete function which will be called once the
operation executed.
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/switchdev')
| -rw-r--r-- | net/switchdev/switchdev.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 2b9b98f1c2ff..b7e01d88bdc5 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
| @@ -305,6 +305,8 @@ static void switchdev_port_attr_set_deferred(struct net_device *dev, | |||
| 305 | if (err && err != -EOPNOTSUPP) | 305 | if (err && err != -EOPNOTSUPP) |
| 306 | netdev_err(dev, "failed (err=%d) to set attribute (id=%d)\n", | 306 | netdev_err(dev, "failed (err=%d) to set attribute (id=%d)\n", |
| 307 | err, attr->id); | 307 | err, attr->id); |
| 308 | if (attr->complete) | ||
| 309 | attr->complete(dev, err, attr->complete_priv); | ||
| 308 | } | 310 | } |
| 309 | 311 | ||
| 310 | static int switchdev_port_attr_set_defer(struct net_device *dev, | 312 | static int switchdev_port_attr_set_defer(struct net_device *dev, |
| @@ -434,6 +436,8 @@ static void switchdev_port_obj_add_deferred(struct net_device *dev, | |||
| 434 | if (err && err != -EOPNOTSUPP) | 436 | if (err && err != -EOPNOTSUPP) |
| 435 | netdev_err(dev, "failed (err=%d) to add object (id=%d)\n", | 437 | netdev_err(dev, "failed (err=%d) to add object (id=%d)\n", |
| 436 | err, obj->id); | 438 | err, obj->id); |
| 439 | if (obj->complete) | ||
| 440 | obj->complete(dev, err, obj->complete_priv); | ||
| 437 | } | 441 | } |
| 438 | 442 | ||
| 439 | static int switchdev_port_obj_add_defer(struct net_device *dev, | 443 | static int switchdev_port_obj_add_defer(struct net_device *dev, |
| @@ -502,6 +506,8 @@ static void switchdev_port_obj_del_deferred(struct net_device *dev, | |||
| 502 | if (err && err != -EOPNOTSUPP) | 506 | if (err && err != -EOPNOTSUPP) |
| 503 | netdev_err(dev, "failed (err=%d) to del object (id=%d)\n", | 507 | netdev_err(dev, "failed (err=%d) to del object (id=%d)\n", |
| 504 | err, obj->id); | 508 | err, obj->id); |
| 509 | if (obj->complete) | ||
| 510 | obj->complete(dev, err, obj->complete_priv); | ||
| 505 | } | 511 | } |
| 506 | 512 | ||
| 507 | static int switchdev_port_obj_del_defer(struct net_device *dev, | 513 | static int switchdev_port_obj_del_defer(struct net_device *dev, |
