net: dsa: use ds->num_ports when possible