From: <VishvambarPanth.S@microchip.com>
To: <jacob.e.keller@intel.com>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>
Cc: <pabeni@redhat.com>, <richardcochran@gmail.com>,
<edumazet@google.com>, <davem@davemloft.net>,
<UNGLinuxDriver@microchip.com>, <Bryan.Whitehead@microchip.com>,
<kuba@kernel.org>
Subject: Re: [PATCH net-next] net: microchip: lan743x: improve throughput with rx timestamp config
Date: Thu, 5 Oct 2023 10:58:37 +0000 [thread overview]
Message-ID: <6e596bc99585020112f02fb9d46081e129ceda8e.camel@microchip.com> (raw)
In-Reply-To: <daf48f7c-e3e4-a23a-0422-a98c409ff0eb@intel.com>
On Tue, 2023-09-26 at 16:48 -0700, Jacob Keller wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> On 9/26/2023 8:56 AM, Vishvambar Panth S wrote:
> > Currently all RX frames are timestamped which results in a
> > performance
> > penalty when timestamping is not needed. The default is now being
> > changed to not timestamp any Rx frames (HWTSTAMP_FILTER_NONE), but
> > support has been added to allow changing the desired RX
> > timestamping
> > mode (HWTSTAMP_FILTER_ALL - which was the previous setting,
> > HWTSTAMP_FILTER_PTP_V2_EVENT, HWTSTAMP_FILTER_PTP_V2_SYNC and
> > HWTSTAMP_FILTER_PTP_V2_DELAY_REQ are the supported options) using
> > SIOCSHWTSTAMP. All settings were tested using the hwstamp_ctl
> > application.
> > It is also noted that ptp4l, when started, preconfigures the device
> > to
> > timestamp using HWTSTAMP_FILTER_PTP_V2_EVENT, so this driver
> > continues
> > to work properly "out of the box".
> >
> > Test setup: x64 PC with LAN7430 ---> x64 PC as partner
> >
>
> I don't think I would bother to support
> HWTSTAMP_FILTER_PTP_V2_DELAY_REQ
> or HWTSTAMP_FILTER_PTP_V2_SYNC as these are pretty historic and only
> useful for hardware which can't do HWTSTAMP_FILTER_PTP_V2_EVENT.
>
Hi Jacob,
Thanks for the comments. Just added these filters, as the HW supports
these individually. Since HW also supports
HWTSTAMP_FILTER_PTP_V2_EVENT, will drop the support for
individual HWTSTAMP_FILTER_PTP_V2_SYNC and
HWTSTAMP_FILTER_PTP_V2_DELAY_REQ cases in v2 patch.
> > iperf3 with - Timestamp all incoming packets:
> > - - - - - - - - - - - - - - - - - - - - - - - - -
> > [ ID] Interval Transfer Bitrate Retr
> > [ 5] 0.00-5.05 sec 517 MBytes 859 Mbits/sec 0 sender
> > [ 5] 0.00-5.00 sec 515 MBytes 864 Mbits/sec
> > receiver
> >
> > iperf Done.
> >
> > iperf3 with - Timestamp only PTP packets:
> > - - - - - - - - - - - - - - - - - - - - - - - - -
> > [ ID] Interval Transfer Bitrate Retr
> > [ 5] 0.00-5.04 sec 563 MBytes 937 Mbits/sec 0 sender
> > [ 5] 0.00-5.00 sec 561 MBytes 941 Mbits/sec
> > receiver
> >
> >
>
> Pretty significant cost here for the timestamping all frames. Makes
> sense to leave the default to NONE unless requested.
Thanks for the comment, will maintain as is.
>
> Please find the earlier conversation at the link below
> > Link:
> > https://lore.kernel.org/all/20230731125418.75140-1-vishvambarpanth.s@microchip.com/
> >
> > Signed-off-by: Vishvambar Panth S <vishvambarpanth.s@microchip.com>
> > ---
> > .../net/ethernet/microchip/lan743x_ethtool.c | 5 +-
> > drivers/net/ethernet/microchip/lan743x_main.c | 58
> > ++++++++++++++++++-
> > drivers/net/ethernet/microchip/lan743x_main.h | 8 +++
> > drivers/net/ethernet/microchip/lan743x_ptp.c | 9 +++
> > 4 files changed, 78 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c
> > b/drivers/net/ethernet/microchip/lan743x_ethtool.c
> > index 2db5949b4c7e..855844df5ea1 100644
> > --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
> > +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
> > @@ -1047,7 +1047,10 @@ static int
> > lan743x_ethtool_get_ts_info(struct net_device *netdev,
> > BIT(HWTSTAMP_TX_ON) |
> > BIT(HWTSTAMP_TX_ONESTEP_SYNC);
> > ts_info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) |
> > - BIT(HWTSTAMP_FILTER_ALL);
> > + BIT(HWTSTAMP_FILTER_ALL) |
> > + BIT(HWTSTAMP_FILTER_PTP_V2_EVENT) |
> > + BIT(HWTSTAMP_FILTER_PTP_V2_SYNC) |
> > + BIT(HWTSTAMP_FILTER_PTP_V2_DELAY_REQ);
> > return 0;
> > }
> >
> > diff --git a/drivers/net/ethernet/microchip/lan743x_main.c
> > b/drivers/net/ethernet/microchip/lan743x_main.c
> > index f940895b14e8..0389bc7cf603 100644
> > --- a/drivers/net/ethernet/microchip/lan743x_main.c
> > +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> > @@ -1870,6 +1870,63 @@ static int lan743x_tx_get_avail_desc(struct
> > lan743x_tx *tx)
> > return last_head - last_tail - 1;
> > }
> >
> > +int lan743x_rx_set_tstamp_mode(struct lan743x_adapter *adapter,
> > + int rx_filter)
> > +{
> > + int channel_number;
> > + int index;
> > + u32 data;
> > +
> > + switch (rx_filter) {
> > + case HWTSTAMP_FILTER_PTP_V2_SYNC:
> > + data = lan743x_csr_read(adapter,
> > PTP_RX_TS_CFG);
> > + data &= ~PTP_RX_TS_CFG_EVENT_MSGS_;
> > + data |= PTP_RX_TS_CFG_SYNC_MSG_;
> > + lan743x_csr_write(adapter, PTP_RX_TS_CFG,
> > data);
> > + break;
> > + case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
> > + data = lan743x_csr_read(adapter,
> > PTP_RX_TS_CFG);
> > + data &= ~PTP_RX_TS_CFG_EVENT_MSGS_;
> > + data |= PTP_RX_TS_CFG_DELAY_REQ_MSG_;
> > + lan743x_csr_write(adapter, PTP_RX_TS_CFG,
> > data);
> > + break;
> > + case HWTSTAMP_FILTER_PTP_V2_EVENT:
> > + data = lan743x_csr_read(adapter,
> > PTP_RX_TS_CFG);
> > + data |= PTP_RX_TS_CFG_EVENT_MSGS_;
> > + lan743x_csr_write(adapter, PTP_RX_TS_CFG,
> > data);
> > + break;
> > + case HWTSTAMP_FILTER_NONE:
> > + case HWTSTAMP_FILTER_ALL:
> > + break;
>
> At first this break was a bit confusing to me, since nothing is set
> here.
The idea was that in the NONE and ALL case, there need not be any
modification in this register. But will adapt to a more readable
implementation in v2 patch.
>
> > + default:
> > + netif_warn(adapter, drv, adapter->netdev,
> > + "rx timestamp = %d is not
> > supported\n",
> > + rx_filter);
> > + return -EINVAL;
> > + }
> > +
> > + for (index = 0; index < LAN743X_USED_RX_CHANNELS; index++) {
> > + channel_number = adapter->rx[index].channel_number;
> > + data = lan743x_csr_read(adapter,
> > RX_CFG_B(channel_number));
> > + if (rx_filter == HWTSTAMP_FILTER_NONE) {
> > + data &= ~(RX_CFG_B_TS_ALL_RX_ |
> > + RX_CFG_B_TS_DESCR_EN_);
> > + } else if (rx_filter == HWTSTAMP_FILTER_ALL) {
> > + data |= RX_CFG_B_TS_ALL_RX_;
> > + } else {
> > + /* enable storing timestamping in extension
> > descriptor
> > + * instead of timestamping all the packets
> > + */
> > + data &= ~RX_CFG_B_TS_ALL_RX_;
> > + data |= RX_CFG_B_TS_DESCR_EN_;
> > + }
>
> I might have made the decision of what to program in the switch case
> above and then done the write here with "data &= ~MASK; data |=
> setting"
> rather than having two separate decision points.
Sure, will try and adapt to this.
>
> > + lan743x_csr_write(adapter, RX_CFG_B(channel_number),
> > + data);
> > + }
> > +
> > + return 0;
> > +}
> > +
>
> Rest of the code seems fine, and the implementation looks ok.
>
> I'd suggest dropping the not so useful timestamp filters for only
> sync
> or only delay request, keeping only V2_EVENT, but either way:
Thanks, will drop the not so useful filters and submit a v2 patch with
required changes.
>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
next prev parent reply other threads:[~2023-10-05 16:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 15:56 [PATCH net-next] net: microchip: lan743x: improve throughput with rx timestamp config Vishvambar Panth S
2023-09-26 23:48 ` Jacob Keller
2023-10-05 10:58 ` VishvambarPanth.S [this message]
2023-10-04 18:00 ` Jakub Kicinski
2023-10-05 11:02 ` VishvambarPanth.S
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=6e596bc99585020112f02fb9d46081e129ceda8e.camel@microchip.com \
--to=vishvambarpanth.s@microchip.com \
--cc=Bryan.Whitehead@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox