From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Jacob Keller <jacob.e.keller@intel.com>,
Vadim Fedorenko <vadfed@meta.com>,
Jakub Kicinski <kuba@kernel.org>,
David Ahern <dsahern@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Alexander Duyck <alexanderduyck@fb.com>
Cc: netdev@vger.kernel.org, Richard Cochran <richardcochran@gmail.com>
Subject: Re: [PATCH net-next v3 3/5] eth: fbnic: add RX packets timestamping support
Date: Mon, 7 Oct 2024 11:26:25 +0100 [thread overview]
Message-ID: <d6d91341-e278-4d3f-967e-3c45f7323878@linux.dev> (raw)
In-Reply-To: <6015e3d3-e35b-4e6c-b6cf-3348e8b6d4f6@intel.com>
On 05/10/2024 00:18, Jacob Keller wrote:
>
>
> On 10/3/2024 5:39 AM, Vadim Fedorenko wrote:
>> Add callbacks to support timestamping configuration via ethtool.
>> Add processing of RX timestamps.
>>
>> Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
>> ---
>> +static int fbnic_hwtstamp_set(struct net_device *netdev,
>> + struct kernel_hwtstamp_config *config,
>> + struct netlink_ext_ack *extack)
>> +{
>> + struct fbnic_net *fbn = netdev_priv(netdev);
>> + int old_rx_filter;
>> +
>> + if (config->source != HWTSTAMP_SOURCE_NETDEV)
>> + return -EOPNOTSUPP;
>> +
>> + if (!kernel_hwtstamp_config_changed(config, &fbn->hwtstamp_config))
>> + return 0;
>> +
>> + /* Upscale the filters */
>> + switch (config->rx_filter) {
>> + case HWTSTAMP_FILTER_NONE:
>> + case HWTSTAMP_FILTER_ALL:
>> + case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
>> + case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
>> + case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
>> + case HWTSTAMP_FILTER_PTP_V2_EVENT:
>> + break;
>> + case HWTSTAMP_FILTER_NTP_ALL:
>> + config->rx_filter = HWTSTAMP_FILTER_ALL;
>> + break;
>> + case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
>> + case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
>> + config->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
>> + break;
>> + case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
>> + case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
>> + config->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
>> + break;
>> + case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
>> + case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
>> + config->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
>> + break;
>> + case HWTSTAMP_FILTER_PTP_V2_SYNC:
>> + case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
>> + config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
>> + break;
>> + default:
>> + return -ERANGE;
>> + }
>> +
>> + /* Configure */
>> + old_rx_filter = fbn->hwtstamp_config.rx_filter;
>> + memcpy(&fbn->hwtstamp_config, config, sizeof(*config));
>> +
>> + if (old_rx_filter != config->rx_filter && netif_running(fbn->netdev)) {
>> + fbnic_rss_reinit(fbn->fbd, fbn);
>> + fbnic_write_rules(fbn->fbd);
>> + }
>> +
>> + /* Save / report back filter configuration
>> + * Note that our filter configuration is inexact. Instead of
>> + * filtering for a specific UDP port or L2 Ethertype we are
>> + * filtering in all UDP or all non-IP packets for timestamping. So
>> + * if anything other than FILTER_ALL is requested we report
>> + * FILTER_SOME indicating that we will be timestamping a few
>> + * additional packets.
>> + */
>
> Is there any benefit to implementing anything other than
> HWTSTAMP_FILTER_ALL?
>
> Those are typically considered legacy with the primary reason being to
> support hardware which does not support timestamping all frames.
>
> I suppose if you have measurement that supporting them is valuable (i.e.
> because of performance impact on timestamping all frames?) it makes
> sense to support. But otherwise I'm not sure its worth the extra complexity.
>
> Upgrading the filtering modes to HWTSTAMP_FILTER_ALL is acceptable and
> is done by a few drivers.
Even though the hardware is able to timestamp TX packets at line rate,
we would like to avoid having 2x times more interrupts for the cases
when we don't need all packets to be timestamped. And as it mentioned
in the comment, we don't have very precise HW filters, but we would like
to avoid timestamping TCP packets when TCP is the most used one on the
host.
next prev parent reply other threads:[~2024-10-07 10:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-03 12:39 [PATCH net-next v3 0/5] eth: fbnic: add timestamping support Vadim Fedorenko
2024-10-03 12:39 ` [PATCH net-next v3 1/5] eth: fbnic: add software TX " Vadim Fedorenko
2024-10-04 22:55 ` Jacob Keller
2024-10-04 23:18 ` Jacob Keller
2024-10-07 9:56 ` Vadim Fedorenko
2024-10-07 23:52 ` Jacob Keller
2024-10-03 12:39 ` [PATCH net-next v3 2/5] eth: fbnic: add initial PHC support Vadim Fedorenko
2024-10-04 23:05 ` Jacob Keller
2024-10-07 13:07 ` Vadim Fedorenko
2024-10-07 23:09 ` Jakub Kicinski
2024-10-07 23:49 ` Jacob Keller
2024-10-08 1:16 ` Jakub Kicinski
2024-10-07 23:57 ` Jacob Keller
2024-10-03 12:39 ` [PATCH net-next v3 3/5] eth: fbnic: add RX packets timestamping support Vadim Fedorenko
2024-10-04 23:14 ` Jacob Keller
2024-10-08 16:47 ` Vadim Fedorenko
2024-10-08 17:01 ` Jacob Keller
2024-10-08 17:13 ` Vadim Fedorenko
2024-10-04 23:18 ` Jacob Keller
2024-10-07 10:26 ` Vadim Fedorenko [this message]
2024-10-07 23:51 ` Jacob Keller
2024-10-08 9:58 ` Vadim Fedorenko
2024-10-03 12:39 ` [PATCH net-next v3 4/5] eth: fbnic: add TX " Vadim Fedorenko
2024-10-03 12:39 ` [PATCH net-next v3 5/5] eth: fbnic: add ethtool timestamping statistics Vadim Fedorenko
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=d6d91341-e278-4d3f-967e-3c45f7323878@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=alexanderduyck@fb.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=vadfed@meta.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 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.