Skip to content

Commit

Permalink
Merge branch 'ocelot-felix-cleanups'
Browse files Browse the repository at this point in the history
Vladimir Oltean says:

====================
Cleanups for ocelot/felix drivers

This patch set is an assorted collection of minor cleanups brought to
the felix DSA driver and ocelot switch library.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Mar 4, 2022
2 parents f9f52c3 + 162fbf6 commit f2ecfa0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
17 changes: 8 additions & 9 deletions drivers/net/dsa/ocelot/felix.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ static void felix_8021q_cpu_port_init(struct ocelot *ocelot, int port)
mutex_lock(&ocelot->fwd_domain_lock);

ocelot_port_set_dsa_8021q_cpu(ocelot, port);
ocelot->npi = -1;

/* Overwrite PGID_CPU with the non-tagging port */
ocelot_write_rix(ocelot, BIT(port), ANA_PGID_PGID, PGID_CPU);
Expand All @@ -384,7 +383,6 @@ static void felix_8021q_cpu_port_deinit(struct ocelot *ocelot, int port)
{
mutex_lock(&ocelot->fwd_domain_lock);

ocelot->ports[port]->is_dsa_8021q_cpu = false;
ocelot_port_unset_dsa_8021q_cpu(ocelot, port);

/* Restore PGID_CPU */
Expand Down Expand Up @@ -1467,20 +1465,17 @@ static int felix_hwtstamp_set(struct dsa_switch *ds, int port,
return felix_update_trapping_destinations(ds, using_tag_8021q);
}

static bool felix_check_xtr_pkt(struct ocelot *ocelot, unsigned int ptp_type)
static bool felix_check_xtr_pkt(struct ocelot *ocelot)
{
struct felix *felix = ocelot_to_felix(ocelot);
int err, grp = 0;
int err = 0, grp = 0;

if (felix->tag_proto != DSA_TAG_PROTO_OCELOT_8021Q)
return false;

if (!felix->info->quirk_no_xtr_irq)
return false;

if (ptp_type == PTP_CLASS_NONE)
return false;

while (ocelot_read(ocelot, QS_XTR_DATA_PRESENT) & BIT(grp)) {
struct sk_buff *skb;
unsigned int type;
Expand Down Expand Up @@ -1510,8 +1505,12 @@ static bool felix_check_xtr_pkt(struct ocelot *ocelot, unsigned int ptp_type)
}

out:
if (err < 0)
if (err < 0) {
dev_err_ratelimited(ocelot->dev,
"Error during packet extraction: %pe\n",
ERR_PTR(err));
ocelot_drain_cpu_queue(ocelot, 0);
}

return true;
}
Expand All @@ -1531,7 +1530,7 @@ static bool felix_rxtstamp(struct dsa_switch *ds, int port,
* MMIO in the CPU port module, and inject that into the stack from
* ocelot_xtr_poll().
*/
if (felix_check_xtr_pkt(ocelot, type)) {
if (felix_check_xtr_pkt(ocelot)) {
kfree_skb(skb);
return true;
}
Expand Down
12 changes: 5 additions & 7 deletions drivers/net/ethernet/mscc/ocelot_vcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,9 @@ static void is2_entry_set(struct ocelot *ocelot, int ix,
val = proto.value[0];
msk = proto.mask[0];
type = IS2_TYPE_IP_UDP_TCP;
if (msk == 0xff && (val == 6 || val == 17)) {
if (msk == 0xff && (val == IPPROTO_TCP || val == IPPROTO_UDP)) {
/* UDP/TCP protocol match */
tcp = (val == 6 ?
tcp = (val == IPPROTO_TCP ?
OCELOT_VCAP_BIT_1 : OCELOT_VCAP_BIT_0);
vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_TCP, tcp);
vcap_key_l4_port_set(vcap, &data,
Expand Down Expand Up @@ -1195,18 +1195,16 @@ static void ocelot_vcap_block_remove_filter(struct ocelot *ocelot,
struct ocelot_vcap_block *block,
struct ocelot_vcap_filter *filter)
{
struct ocelot_vcap_filter *tmp;
struct list_head *pos, *q;
struct ocelot_vcap_filter *tmp, *n;

list_for_each_safe(pos, q, &block->rules) {
tmp = list_entry(pos, struct ocelot_vcap_filter, list);
list_for_each_entry_safe(tmp, n, &block->rules, list) {
if (ocelot_vcap_filter_equal(filter, tmp)) {
if (tmp->block_id == VCAP_IS2 &&
tmp->action.police_ena)
ocelot_vcap_policer_del(ocelot,
tmp->action.pol_ix);

list_del(pos);
list_del(&tmp->list);
kfree(tmp);
}
}
Expand Down

0 comments on commit f2ecfa0

Please sign in to comment.