drivers/net/ethernet/intel/igc/igc_ptp.c:397:17: sparse: sparse: incorrect type in argument 1 (different base types)
From: kbuild test robot
Date: Sat May 30 2020 - 15:08:13 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 86852175b016f0c6873dcbc24b93d12b7b246612
commit: 81b055205e8ba2d400c8fa5845ba540a4a880a3a igc: Add support for RX timestamping
date: 5 months ago
config: i386-randconfig-s002-20200531 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-243-gc100a7ab-dirty
git checkout 81b055205e8ba2d400c8fa5845ba540a4a880a3a
# save the attached .config to linux build tree
make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/intel/igc/igc_ptp.c:397:17: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restricted __be16 [usertype] @@
drivers/net/ethernet/intel/igc/igc_ptp.c:397:17: sparse: expected unsigned int val
drivers/net/ethernet/intel/igc/igc_ptp.c:397:17: sparse: got restricted __be16 [usertype]
drivers/net/ethernet/intel/igc/igc_ptp.c:415:6: sparse: sparse: symbol 'igc_ptp_tx_hang' was not declared. Should it be static?
drivers/net/ethernet/intel/igc/igc_ptp.c:445:6: sparse: sparse: symbol 'igc_ptp_tx_work' was not declared. Should it be static?
drivers/net/ethernet/intel/igc/igc_ptp.c:549:6: sparse: sparse: symbol 'igc_ptp_suspend' was not declared. Should it be static?
vim +397 drivers/net/ethernet/intel/igc/igc_ptp.c
281
282 /**
283 * igc_ptp_set_timestamp_mode - setup hardware for timestamping
284 * @adapter: networking device structure
285 * @config: hwtstamp configuration
286 *
287 * Incoming time stamping has to be configured via the hardware
288 * filters. Not all combinations are supported, in particular event
289 * type has to be specified. Matching the kind of event packet is
290 * not supported, with the exception of "all V2 events regardless of
291 * level 2 or 4".
292 *
293 */
294 static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter,
295 struct hwtstamp_config *config)
296 {
297 u32 tsync_rx_ctl = IGC_TSYNCRXCTL_ENABLED;
298 struct igc_hw *hw = &adapter->hw;
299 u32 tsync_rx_cfg = 0;
300 bool is_l4 = false;
301 bool is_l2 = false;
302 u32 regval;
303
304 /* reserved for future extensions */
305 if (config->flags)
306 return -EINVAL;
307
308 switch (config->rx_filter) {
309 case HWTSTAMP_FILTER_NONE:
310 tsync_rx_ctl = 0;
311 break;
312 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
313 tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_L4_V1;
314 tsync_rx_cfg = IGC_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE;
315 is_l4 = true;
316 break;
317 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
318 tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_L4_V1;
319 tsync_rx_cfg = IGC_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE;
320 is_l4 = true;
321 break;
322 case HWTSTAMP_FILTER_PTP_V2_EVENT:
323 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
324 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
325 case HWTSTAMP_FILTER_PTP_V2_SYNC:
326 case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
327 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
328 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
329 case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
330 case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
331 tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_EVENT_V2;
332 config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
333 is_l2 = true;
334 is_l4 = true;
335 break;
336 case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
337 case HWTSTAMP_FILTER_NTP_ALL:
338 case HWTSTAMP_FILTER_ALL:
339 tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_ALL;
340 config->rx_filter = HWTSTAMP_FILTER_ALL;
341 break;
342 /* fall through */
343 default:
344 config->rx_filter = HWTSTAMP_FILTER_NONE;
345 return -ERANGE;
346 }
347
348 /* Per-packet timestamping only works if all packets are
349 * timestamped, so enable timestamping in all packets as long
350 * as one Rx filter was configured.
351 */
352 if (tsync_rx_ctl) {
353 tsync_rx_ctl = IGC_TSYNCRXCTL_ENABLED;
354 tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_ALL;
355 config->rx_filter = HWTSTAMP_FILTER_ALL;
356 is_l2 = true;
357 is_l4 = true;
358
359 if (hw->mac.type == igc_i225) {
360 regval = rd32(IGC_RXPBS);
361 regval |= IGC_RXPBS_CFG_TS_EN;
362 wr32(IGC_RXPBS, regval);
363
364 /* FIXME: For now, only support retrieving RX
365 * timestamps from timer 0
366 */
367 igc_ptp_enable_tstamp_all_rxqueues(adapter, 0);
368 }
369 }
370
371 /* enable/disable RX */
372 regval = rd32(IGC_TSYNCRXCTL);
373 regval &= ~(IGC_TSYNCRXCTL_ENABLED | IGC_TSYNCRXCTL_TYPE_MASK);
374 regval |= tsync_rx_ctl;
375 wr32(IGC_TSYNCRXCTL, regval);
376
377 /* define which PTP packets are time stamped */
378 wr32(IGC_TSYNCRXCFG, tsync_rx_cfg);
379
380 /* define ethertype filter for timestamped packets */
381 if (is_l2)
382 wr32(IGC_ETQF(3),
383 (IGC_ETQF_FILTER_ENABLE | /* enable filter */
384 IGC_ETQF_1588 | /* enable timestamping */
385 ETH_P_1588)); /* 1588 eth protocol type */
386 else
387 wr32(IGC_ETQF(3), 0);
388
389 /* L4 Queue Filter[3]: filter by destination port and protocol */
390 if (is_l4) {
391 u32 ftqf = (IPPROTO_UDP /* UDP */
392 | IGC_FTQF_VF_BP /* VF not compared */
393 | IGC_FTQF_1588_TIME_STAMP /* Enable Timestamp */
394 | IGC_FTQF_MASK); /* mask all inputs */
395 ftqf &= ~IGC_FTQF_MASK_PROTO_BP; /* enable protocol check */
396
> 397 wr32(IGC_IMIR(3), htons(PTP_EV_PORT));
398 wr32(IGC_IMIREXT(3),
399 (IGC_IMIREXT_SIZE_BP | IGC_IMIREXT_CTRL_BP));
400 wr32(IGC_FTQF(3), ftqf);
401 } else {
402 wr32(IGC_FTQF(3), IGC_FTQF_MASK);
403 }
404 wrfl();
405
406 /* clear TX/RX time stamp registers, just to be sure */
407 regval = rd32(IGC_TXSTMPL);
408 regval = rd32(IGC_TXSTMPH);
409 regval = rd32(IGC_RXSTMPL);
410 regval = rd32(IGC_RXSTMPH);
411
412 return 0;
413 }
414
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip