mbox series

[net-next,v3,0/6] Marvell PP2.2 PTP support

Message ID 20200908214727.GZ1551@shell.armlinux.org.uk
Headers show
Series Marvell PP2.2 PTP support | expand

Message

Russell King (Oracle) Sept. 8, 2020, 9:47 p.m. UTC
Hi,

This series adds PTP support for PP2.2 hardware to the mvpp2 driver.
Tested on the Macchiatobin eth1 port.

Note that on the Macchiatobin, eth0 uses a separate TAI block from
eth1, and there is no hardware synchronisation between the two.

 drivers/net/ethernet/marvell/Kconfig            |   6 +
 drivers/net/ethernet/marvell/mvpp2/Makefile     |   3 +-
 drivers/net/ethernet/marvell/mvpp2/mvpp2.h      | 196 +++++++++-
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 411 ++++++++++++++++++---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c  | 456 ++++++++++++++++++++++++
 5 files changed, 1022 insertions(+), 50 deletions(-)
 create mode 100644 drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c

v2: add Andrew's r-bs, squash patch 6 and patch 7.
v3: Address Richard's comments on patch 4.

Comments

Russell King (Oracle) Sept. 8, 2020, 11:50 p.m. UTC | #1
On Tue, Sep 08, 2020 at 04:40:52PM -0700, Richard Cochran wrote:
> On Tue, Sep 08, 2020 at 11:00:41PM +0100, Russell King wrote:
> 
> > @@ -2984,13 +2985,19 @@ static irqreturn_t mvpp2_isr(int irq, void *dev_id)
> >  
> >  static void mvpp2_isr_handle_ptp_queue(struct mvpp2_port *port, int nq)
> >  {
> > +	struct skb_shared_hwtstamps shhwtstamps;
> > +	struct mvpp2_hwtstamp_queue *queue;
> > +	struct sk_buff *skb;
> >  	void __iomem *ptp_q;
> > +	unsigned int id;
> >  	u32 r0, r1, r2;
> >  
> >  	ptp_q = port->priv->iface_base + MVPP22_PTP_BASE(port->gop_id);
> >  	if (nq)
> >  		ptp_q += MVPP22_PTP_TX_Q1_R0 - MVPP22_PTP_TX_Q0_R0;
> >  
> > +	queue = &port->tx_hwtstamp_queue[nq];
> > +
> >  	while (1) {
> >  		r0 = readl_relaxed(ptp_q + MVPP22_PTP_TX_Q0_R0) & 0xffff;
> >  		if (!r0)
> > @@ -2998,6 +3005,19 @@ static void mvpp2_isr_handle_ptp_queue(struct mvpp2_port *port, int nq)
> >  
> >  		r1 = readl_relaxed(ptp_q + MVPP22_PTP_TX_Q0_R1) & 0xffff;
> >  		r2 = readl_relaxed(ptp_q + MVPP22_PTP_TX_Q0_R2) & 0xffff;
> > +
> > +		id = (r0 >> 1) & 31;
> > +
> > +		skb = queue->skb[id];
> > +		queue->skb[id] = NULL;
> > +		if (skb) {
> > +			u32 ts = r2 << 19 | r1 << 3 | r0 >> 13;
> > +
> > +			netdev_info(port->dev, "tx stamp 0x%08x\n", ts);
> 
> This probably should be _debug instead.

It shouldn't be there; one of the problems of juggling patches between
trees is that things sometimes get fixed in one tree but not in the
"main" tree... will fix.  This also should've been combined with patch
6.

Anything else on any of the patches, so we don't have to continue doing
this one comment at a time?
Richard Cochran Sept. 11, 2020, 4:08 p.m. UTC | #2
On Wed, Sep 09, 2020 at 11:00:47AM -0700, Richard Cochran wrote:
> On Tue, Sep 08, 2020 at 11:00:41PM +0100, Russell King wrote:
> 
> > +static bool mvpp2_tx_hw_tstamp(struct mvpp2_port *port,
> > +			       struct mvpp2_tx_desc *tx_desc,
> > +			       struct sk_buff *skb)
> > +{
> > +	unsigned int mtype, type, i, offset;
> > +	struct mvpp2_hwtstamp_queue *queue;
> > +	struct ptp_header *hdr;
> > +	u64 ptpdesc;
> > +
> > +	if (port->priv->hw_version == MVPP21 ||
> > +	    port->tx_hwtstamp_type == HWTSTAMP_TX_OFF)
> > +		return false;
> > +
> > +	type = ptp_classify_raw(skb);
> > +	if (!type)
> > +		return false;
> > +
> > +	hdr = ptp_parse_header(skb, type);
> > +	if (!hdr)
> > +		return false;
> 
> At this point, the skb will be queued up to receive a transmit time
> stamp, and so it should be marked with:
> 
> 	skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;

Russell, since this series went in already, can you follow up with
a patch for this please?

Thanks,
Richard