Skip to content

Commit

Permalink
net: dsa: sja1105: remove hwts_tx_en from tagger data
Browse files Browse the repository at this point in the history
This tagger property is in fact not used at all by the tagger, only by
the switch driver. Therefore it makes sense to be moved to
sja1105_private.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed Dec 12, 2021
1 parent d38049b commit 6f6770a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions drivers/net/dsa/sja1105/sja1105.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ struct sja1105_private {
bool fixed_link[SJA1105_MAX_NUM_PORTS];
unsigned long ucast_egress_floods;
unsigned long bcast_egress_floods;
unsigned long hwts_tx_en;
const struct sja1105_info *info;
size_t max_xfer_len;
struct spi_device *spidev;
Expand Down
9 changes: 4 additions & 5 deletions drivers/net/dsa/sja1105/sja1105_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ int sja1105_hwtstamp_set(struct dsa_switch *ds, int port, struct ifreq *ifr)

switch (config.tx_type) {
case HWTSTAMP_TX_OFF:
priv->ports[port].hwts_tx_en = false;
priv->hwts_tx_en &= ~BIT(port);
break;
case HWTSTAMP_TX_ON:
priv->ports[port].hwts_tx_en = true;
priv->hwts_tx_en |= BIT(port);
break;
default:
return -ERANGE;
Expand Down Expand Up @@ -140,7 +140,7 @@ int sja1105_hwtstamp_get(struct dsa_switch *ds, int port, struct ifreq *ifr)
struct hwtstamp_config config;

config.flags = 0;
if (priv->ports[port].hwts_tx_en)
if (priv->hwts_tx_en & BIT(port))
config.tx_type = HWTSTAMP_TX_ON;
else
config.tx_type = HWTSTAMP_TX_OFF;
Expand Down Expand Up @@ -486,10 +486,9 @@ void sja1110_txtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb)
void sja1105_port_txtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb)
{
struct sja1105_private *priv = ds->priv;
struct sja1105_port *sp = &priv->ports[port];
struct sk_buff *clone;

if (!sp->hwts_tx_en)
if (!(priv->hwts_tx_en & BIT(port)))
return;

clone = skb_clone_sk(skb);
Expand Down
1 change: 0 additions & 1 deletion include/linux/dsa/sja1105.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ struct sja1105_skb_cb {

struct sja1105_port {
struct sja1105_tagger_data *data;
bool hwts_tx_en;
};

/* Timestamps are in units of 8 ns clock ticks (equivalent to
Expand Down

0 comments on commit 6f6770a

Please sign in to comment.