Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: microchip: sparx5: fix deletion of existing DSCP mappings

Fix deletion of existing DSCP mappings in the APP table.

Adding and deleting DSCP entries are replicated per-port, since the
mapping table is global for all ports in the chip. Whenever a mapping
for a DSCP value already exists, the old mapping is deleted first.
However, it is only deleted for the specified port. Fix this by calling
sparx5_dcb_ieee_delapp() instead of dcb_ieee_delapp() as it ought to be.

Reproduce:

// Map and remap DSCP value 63
$ dcb app add dev eth0 dscp-prio 63:1
$ dcb app add dev eth0 dscp-prio 63:2

$ dcb app show dev eth0 dscp-prio
dscp-prio 63:2

$ dcb app show dev eth1 dscp-prio
dscp-prio 63:1 63:2 <-- 63:1 should not be there

Fixes: 8dcf69a64118 ("net: microchip: sparx5: add support for offloading dscp table")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Daniel Machon and committed by
David S. Miller
cdd28833 ea9dd2e5

+16 -16
+16 -16
drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
··· 249 249 return 0; 250 250 } 251 251 252 + static int sparx5_dcb_ieee_delapp(struct net_device *dev, struct dcb_app *app) 253 + { 254 + int err; 255 + 256 + if (app->selector == IEEE_8021QAZ_APP_SEL_DSCP) 257 + err = sparx5_dcb_ieee_dscp_setdel(dev, app, dcb_ieee_delapp); 258 + else 259 + err = dcb_ieee_delapp(dev, app); 260 + 261 + if (err < 0) 262 + return err; 263 + 264 + return sparx5_dcb_app_update(dev); 265 + } 266 + 252 267 static int sparx5_dcb_ieee_setapp(struct net_device *dev, struct dcb_app *app) 253 268 { 254 269 struct dcb_app app_itr; ··· 279 264 if (prio) { 280 265 app_itr = *app; 281 266 app_itr.priority = prio; 282 - dcb_ieee_delapp(dev, &app_itr); 267 + sparx5_dcb_ieee_delapp(dev, &app_itr); 283 268 } 284 269 285 270 if (app->selector == IEEE_8021QAZ_APP_SEL_DSCP) ··· 294 279 295 280 out: 296 281 return err; 297 - } 298 - 299 - static int sparx5_dcb_ieee_delapp(struct net_device *dev, struct dcb_app *app) 300 - { 301 - int err; 302 - 303 - if (app->selector == IEEE_8021QAZ_APP_SEL_DSCP) 304 - err = sparx5_dcb_ieee_dscp_setdel(dev, app, dcb_ieee_delapp); 305 - else 306 - err = dcb_ieee_delapp(dev, app); 307 - 308 - if (err < 0) 309 - return err; 310 - 311 - return sparx5_dcb_app_update(dev); 312 282 } 313 283 314 284 static int sparx5_dcb_setapptrust(struct net_device *dev, u8 *selectors,