Commit f2ecfa06 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ocelot-felix-cleanups'



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: default avatarDavid S. Miller <davem@davemloft.net>
parents f9f52c34 162fbf6a
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -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);
@@ -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 */
@@ -1467,10 +1465,10 @@ 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;
@@ -1478,9 +1476,6 @@ static bool felix_check_xtr_pkt(struct ocelot *ocelot, unsigned int ptp_type)
	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;
@@ -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;
}
@@ -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;
	}
+5 −7
Original line number Diff line number Diff line
@@ -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,
@@ -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);
		}
	}