Skip to content

Commit 3b44d4c

Browse files
Andre GuedesJeff Kirsher
authored andcommitted
igc: Remove UDP filter setup in PTP code
As implemented in igc_ethtool_get_ts_info(), igc only supports HWTSTAMP_ FILTER_ALL so any HWTSTAMP_FILTER_* option the user may set falls back to HWTSTAMP_FILTER_ALL. HWTSTAMP_FILTER_ALL is implemented via Rx Time Sync Control (TSYNCRXCTL) configuration which timestamps all incoming packets. Configuring a UDP filter, in addition to TSYNCRXCTL, doesn't add much so this patch removes that code. It also takes this opportunity to remove some non-applicable comments. Signed-off-by: Andre Guedes <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 1801f8d commit 3b44d4c

File tree

1 file changed

+1
-50
lines changed

1 file changed

+1
-50
lines changed

drivers/net/ethernet/intel/igc/igc_ptp.c

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -244,27 +244,14 @@ static void igc_ptp_enable_tstamp_all_rxqueues(struct igc_adapter *adapter,
244244
* @adapter: networking device structure
245245
* @config: hwtstamp configuration
246246
*
247-
* Outgoing time stamping can be enabled and disabled. Play nice and
248-
* disable it when requested, although it shouldn't case any overhead
249-
* when no packet needs it. At most one packet in the queue may be
250-
* marked for time stamping, otherwise it would be impossible to tell
251-
* for sure to which packet the hardware time stamp belongs.
252-
*
253-
* Incoming time stamping has to be configured via the hardware
254-
* filters. Not all combinations are supported, in particular event
255-
* type has to be specified. Matching the kind of event packet is
256-
* not supported, with the exception of "all V2 events regardless of
257-
* level 2 or 4".
258-
*
247+
* Return: 0 in case of success, negative errno code otherwise.
259248
*/
260249
static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter,
261250
struct hwtstamp_config *config)
262251
{
263252
u32 tsync_tx_ctl = IGC_TSYNCTXCTL_ENABLED;
264253
u32 tsync_rx_ctl = IGC_TSYNCRXCTL_ENABLED;
265254
struct igc_hw *hw = &adapter->hw;
266-
u32 tsync_rx_cfg = 0;
267-
bool is_l4 = false;
268255
u32 regval;
269256

270257
/* reserved for future extensions */
@@ -285,15 +272,7 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter,
285272
tsync_rx_ctl = 0;
286273
break;
287274
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
288-
tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_L4_V1;
289-
tsync_rx_cfg = IGC_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE;
290-
is_l4 = true;
291-
break;
292275
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
293-
tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_L4_V1;
294-
tsync_rx_cfg = IGC_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE;
295-
is_l4 = true;
296-
break;
297276
case HWTSTAMP_FILTER_PTP_V2_EVENT:
298277
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
299278
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
@@ -303,32 +282,22 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter,
303282
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
304283
case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
305284
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
306-
tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_EVENT_V2;
307-
config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
308-
is_l4 = true;
309-
break;
310285
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
311286
case HWTSTAMP_FILTER_NTP_ALL:
312287
case HWTSTAMP_FILTER_ALL:
313288
tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_ALL;
314289
config->rx_filter = HWTSTAMP_FILTER_ALL;
315290
break;
316-
/* fall through */
317291
default:
318292
config->rx_filter = HWTSTAMP_FILTER_NONE;
319293
return -ERANGE;
320294
}
321295

322-
/* Per-packet timestamping only works if all packets are
323-
* timestamped, so enable timestamping in all packets as long
324-
* as one Rx filter was configured.
325-
*/
326296
if (tsync_rx_ctl) {
327297
tsync_rx_ctl = IGC_TSYNCRXCTL_ENABLED;
328298
tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_ALL;
329299
tsync_rx_ctl |= IGC_TSYNCRXCTL_RXSYNSIG;
330300
config->rx_filter = HWTSTAMP_FILTER_ALL;
331-
is_l4 = true;
332301

333302
if (hw->mac.type == igc_i225) {
334303
regval = rd32(IGC_RXPBS);
@@ -359,24 +328,6 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter,
359328
regval |= tsync_rx_ctl;
360329
wr32(IGC_TSYNCRXCTL, regval);
361330

362-
/* define which PTP packets are time stamped */
363-
wr32(IGC_TSYNCRXCFG, tsync_rx_cfg);
364-
365-
/* L4 Queue Filter[3]: filter by destination port and protocol */
366-
if (is_l4) {
367-
u32 ftqf = (IPPROTO_UDP /* UDP */
368-
| IGC_FTQF_VF_BP /* VF not compared */
369-
| IGC_FTQF_1588_TIME_STAMP /* Enable Timestamp */
370-
| IGC_FTQF_MASK); /* mask all inputs */
371-
ftqf &= ~IGC_FTQF_MASK_PROTO_BP; /* enable protocol check */
372-
373-
wr32(IGC_IMIR(3), htons(PTP_EV_PORT));
374-
wr32(IGC_IMIREXT(3),
375-
(IGC_IMIREXT_SIZE_BP | IGC_IMIREXT_CTRL_BP));
376-
wr32(IGC_FTQF(3), ftqf);
377-
} else {
378-
wr32(IGC_FTQF(3), IGC_FTQF_MASK);
379-
}
380331
wrfl();
381332

382333
/* clear TX time stamp registers, just to be sure */

0 commit comments

Comments
 (0)