net: dsa: sja1105: Add support for the AVB Parameters Table
This table is used to program the switch to emit "meta" follow-up Ethernet frames (which contain partial RX timestamps) after each link-local frame that was trapped to the CPU port through MAC filtering. This includes PTP frames. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
d3f9b90bf1
commit
24c01949e5
@@ -508,6 +508,39 @@ static int sja1105_init_l2_policing(struct sja1105_private *priv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sja1105_init_avb_params(struct sja1105_private *priv,
|
||||
bool on)
|
||||
{
|
||||
struct sja1105_avb_params_entry *avb;
|
||||
struct sja1105_table *table;
|
||||
|
||||
table = &priv->static_config.tables[BLK_IDX_AVB_PARAMS];
|
||||
|
||||
/* Discard previous AVB Parameters Table */
|
||||
if (table->entry_count) {
|
||||
kfree(table->entries);
|
||||
table->entry_count = 0;
|
||||
}
|
||||
|
||||
/* Configure the reception of meta frames only if requested */
|
||||
if (!on)
|
||||
return 0;
|
||||
|
||||
table->entries = kcalloc(SJA1105_MAX_AVB_PARAMS_COUNT,
|
||||
table->ops->unpacked_entry_size, GFP_KERNEL);
|
||||
if (!table->entries)
|
||||
return -ENOMEM;
|
||||
|
||||
table->entry_count = SJA1105_MAX_AVB_PARAMS_COUNT;
|
||||
|
||||
avb = table->entries;
|
||||
|
||||
avb->destmeta = SJA1105_META_DMAC;
|
||||
avb->srcmeta = SJA1105_META_SMAC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sja1105_static_config_load(struct sja1105_private *priv,
|
||||
struct sja1105_dt_port *ports)
|
||||
{
|
||||
@@ -546,6 +579,9 @@ static int sja1105_static_config_load(struct sja1105_private *priv,
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
rc = sja1105_init_general_params(priv);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
rc = sja1105_init_avb_params(priv, false);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
|
Reference in New Issue
Block a user