All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Tristram.Ha@microchip.com
Cc: f.fainelli@gmail.com, pavel@ucw.cz, UNGLinuxDriver@microchip.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH RFC 5/6] net: dsa: microchip: Update tag_ksz.c to access switch driver
Date: Thu, 6 Dec 2018 21:41:07 +0100	[thread overview]
Message-ID: <20181206204107.GO18674@lunn.ch> (raw)
In-Reply-To: <SN1PR11MB04469EC6A485465166B3C00DECA90@SN1PR11MB0446.namprd11.prod.outlook.com>

> I did try to implement this way.  But the other switches do not have the same
> format even though the length is the same.  Then I need to change the following
> files for any new KSZ switch: include/linux/dsa.h, net/dsa/dsa.c, net/dsa/dsa_priv.h,
> and finally net/dsa/tag_ksz.c.

You can always add two different tag drivers. They don't have to share
code if it does not make sense.

> Even then it will not work if Microchip wants to add 1588 PTP
> capability to the switches.
> 
> For KSZ9477 the length of the tail tag changes when the PTP function
> is enabled.  Typically this function is either enabled or disabled
> all the time, but if users want to change that during normal
> operation to see how the switch behaves, the transmit function
> completely stops working correctly.

We should figure out how to support PTP. I think that is the main
issue here.

> Older driver implementation is to monitor that register change and adjust the length
> dynamically.
> 
> Another problem is the tail tag needs to include the timestamp for the 1-step
> Pdelay_Resp to have accurate turnaround time when that message is sent out by the
> switch.  This will require access to the main switch driver which will keep track of those
> PTP messages.
> 
> PTP handles transmit timestamp in skb_tx_timestamp, which is typically called after the
> frame is sent, so it is too late.  DSA calls dsa_skb_tx_timestamp before sending, but it
> only provides a clone to the driver that supports port_txstamp and so the switch driver
> may not be able to do anything.

The current design assumes the hardware will insert the PTP timestamp
into the frame using the clock inside the hardware. You then ask it
what timestamp it actually used. 

If i understand you correctly, in your case, software was to provide
the timestamp which then gets inserted into the frame. So you want to
provide this timestamp as late as possible, when the frame reaches the
head of the queue and is about to be sent out the master interface?

> In dsa_switch_rcv() the CPU receive function is called first before
> dsa_skb_defer_rx_timestamp().  That means the receive tail tag
> operation has to be done first to retrieve the receive timestamp so
> that it can be passed later.

What i think you can do is in your tag rx function you can directly
add the timestamp info to the skbuf. The dsa driver function
.port_txtstamp can then always return false.

Your tag function is going to need access to some driver state, but
you should be able to get at that, following pointers, and placing
some of the structures in global headers.

    Andrew

  reply	other threads:[~2018-12-06 20:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 23:34 [PATCH RFC 0/6] net: dsa: microchip: Modify KSZ9477 DSA driver to support different tail tag formats Tristram.Ha
2018-12-03 23:34 ` [PATCH RFC 1/6] net: dsa: microchip: Prepare PHY for proper advertisement Tristram.Ha
2018-12-05 17:40   ` Andrew Lunn
2018-12-06 20:31     ` Tristram.Ha
2018-12-03 23:34 ` [PATCH RFC 2/6] net: dsa: microchip: Add MIB counter reading support Tristram.Ha
2018-12-05 17:53   ` Andrew Lunn
2018-12-06 20:16     ` Tristram.Ha
2018-12-06 20:42       ` Andrew Lunn
2018-12-03 23:34 ` [PATCH RFC 3/6] net: dsa: microchip: Break ksz_priv.h into two files Tristram.Ha
2018-12-03 23:34 ` [PATCH RFC 4/6] net: dsa: microchip: Each switch driver has its own tail tagging operations Tristram.Ha
2018-12-03 23:34 ` [PATCH RFC 5/6] net: dsa: microchip: Update tag_ksz.c to access switch driver Tristram.Ha
2018-12-05 18:00   ` Andrew Lunn
2018-12-05 18:18     ` Andrew Lunn
2018-12-05 18:52       ` Florian Fainelli
2018-12-06 20:00         ` Tristram.Ha
2018-12-06 20:41           ` Andrew Lunn [this message]
2018-12-07  3:16           ` Richard Cochran
2018-12-09  9:17           ` Pavel Machek
2018-12-11 23:59             ` Tristram.Ha
2018-12-12  8:18               ` Andrew Lunn
2018-12-03 23:34 ` [PATCH RFC 6/6] net: dsa: microchip: Add switch offload forwarding support Tristram.Ha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181206204107.GO18674@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Tristram.Ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.