Re: [PATCH v1 net-next] net: phy: mchp: Add 1588 support for LAN8814 Quad PHY

From: kernel test robot
Date: Mon Dec 14 2020 - 10:30:26 EST


Hi Divya,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url: https://github.com/0day-ci/linux/commits/Divya-Koppera/net-phy-mchp-Add-1588-support-for-LAN8814-Quad-PHY/20201214-205209
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 13458ffe0a953e17587f172a8e5059c243e6850a
config: microblaze-randconfig-r006-20201214 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/d3b83e2903ca90bd2652d828d0e33f0d5559757a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Divya-Koppera/net-phy-mchp-Add-1588-support-for-LAN8814-Quad-PHY/20201214-205209
git checkout d3b83e2903ca90bd2652d828d0e33f0d5559757a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/net/phy/micrel.c: In function 'lan8814_dequeue_skb':
>> drivers/net/phy/micrel.c:429:11: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
429 | int len, rc;
| ^~
drivers/net/phy/micrel.c: At top level:
>> drivers/net/phy/micrel.c:492:13: warning: no previous prototype for 'lan8814_handle_ptp_interrupt' [-Wmissing-prototypes]
492 | irqreturn_t lan8814_handle_ptp_interrupt(struct phy_device *phydev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/phy/micrel.c:507:13: warning: no previous prototype for 'lan8814_handle_interrupt' [-Wmissing-prototypes]
507 | irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c: In function 'lan8814_ptp_clock_step':
>> drivers/net/phy/micrel.c:1911:8: warning: variable 'adjustment_value_lo' set but not used [-Wunused-but-set-variable]
1911 | u16 adjustment_value_lo, adjustment_value_hi;
| ^~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c:1926:8: warning: variable 'adjustment_value_lo' set but not used [-Wunused-but-set-variable]
1926 | u16 adjustment_value_lo, adjustment_value_hi;
| ^~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c: In function 'lan8814_txtstamp':
>> drivers/net/phy/micrel.c:1750:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
1750 | if (is_sync(skb, type)) {
| ^
drivers/net/phy/micrel.c:1754:2: note: here
1754 | case HWTSTAMP_TX_ON:
| ^~~~

vim +/rc +429 drivers/net/phy/micrel.c

421
422 static void lan8814_dequeue_skb(struct lan8814_ptp *ptp)
423 {
424 struct lan8814_priv *priv = container_of(ptp, struct lan8814_priv, ptp);
425 struct phy_device *phydev = priv->phydev;
426 struct skb_shared_hwtstamps shhwtstamps;
427 struct sk_buff *skb;
428 u8 skb_sig[16];
> 429 int len, rc;
430 u32 reg, cnt;
431 u32 seconds, nsec, seq_id;
432
433 reg = lan8814_read_page_reg(phydev, 5, PTP_CAP_INFO);
434 cnt = PTP_CAP_INFO_TX_TS_CNT_GET_(reg);
435
436 /* FIFO is Empty*/
437 if (cnt == 0)
438 return;
439
440 len = skb_queue_len(&ptp->tx_queue);
441 if (len < 1)
442 return;
443
444 while (len--) {
445 skb = __skb_dequeue(&ptp->tx_queue);
446 if (!skb)
447 return;
448
449 /* Can't get the signature of the packet, won't ever
450 * be able to have one so let's dequeue the packet.
451 */
452 if (get_sig(skb, skb_sig) < 0) {
453 kfree_skb(skb);
454 continue;
455 }
456
457 lan8814_ptp_tx_ts_get(phydev, &seconds, &nsec, &seq_id);
458
459 rc = memcmp(skb_sig, &seq_id, sizeof(skb_sig));
460
461 /* Check if we found the signature we were looking for. */
462 if (memcmp(skb_sig, &seq_id, sizeof(skb_sig))) {
463 memset(&shhwtstamps, 0, sizeof(shhwtstamps));
464 shhwtstamps.hwtstamp = ktime_set(seconds, nsec);
465 skb_complete_tx_timestamp(skb, &shhwtstamps);
466
467 return;
468 }
469
470 /* Valid signature but does not match the one of the
471 * packet in the FIFO right now, reschedule it for later
472 * packets.
473 */
474 __skb_queue_tail(&ptp->tx_queue, skb);
475 }
476 }
477
478 static void lan8814_get_tx_ts(struct lan8814_ptp *ptp)
479 {
480 u32 reg;
481 struct lan8814_priv *priv = container_of(ptp, struct lan8814_priv, ptp);
482 struct phy_device *phydev = priv->phydev;
483
484 do {
485 lan8814_dequeue_skb(ptp);
486
487 /* If other timestamps are available in the FIFO, process them. */
488 reg = lan8814_read_page_reg(phydev, 5, PTP_CAP_INFO);
489 } while (PTP_CAP_INFO_TX_TS_CNT_GET_(reg) > 1);
490 }
491
> 492 irqreturn_t lan8814_handle_ptp_interrupt(struct phy_device *phydev)
493 {
494 struct lan8814_priv *lan8814 = phydev->priv;
495 int rc;
496
497 rc = lan8814_read_page_reg(phydev, 5, PTP_TSU_INT_STS);
498
499 if (!(rc & PTP_TSU_INT_STS_PTP_TX_TS_EN))
500 return IRQ_NONE;
501
502 lan8814_get_tx_ts(&lan8814->ptp);
503
504 return IRQ_HANDLED;
505 }
506
> 507 irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
508 {
509 int irq_status;
510
511 irq_status = lan8814_read_page_reg(phydev, 4, LAN8814_INTR_STS_REG);
512 if (irq_status < 0)
513 return IRQ_NONE;
514
515 if (irq_status & LAN8814_INTR_STS_REG_1588_TSU0)
516 return lan8814_handle_ptp_interrupt(phydev);
517
518 irq_status = phy_read(phydev, LAN8814_INTS);
519 if (irq_status < 0)
520 return IRQ_NONE;
521
522 if (irq_status & LAN8814_INTS_ALL)
523 phy_mac_interrupt(phydev);
524
525 return IRQ_HANDLED;
526 }
527

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip