Re: [PATCH net-next v4 08/10] net: phylink: Adjust advertisement based on rate adaptation
From: kernel test robot
Date: Thu Aug 18 2022 - 15:32:25 EST
Hi Sean,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Sean-Anderson/net-phy-Add-support-for-rate-adaptation/20220819-005121
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git e34cfee65ec891a319ce79797dda18083af33a76
config: arm-randconfig-r026-20220818 (https://download.01.org/0day-ci/archive/20220819/202208190347.I3rrGqW3-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/f4857d8d4f852b1cc3ae278785c209a7a0da0f67
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sean-Anderson/net-phy-Add-support-for-rate-adaptation/20220819-005121
git checkout f4857d8d4f852b1cc3ae278785c209a7a0da0f67
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/phy/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
>> drivers/net/phy/phylink.c:543:7: error: call to undeclared function 'phylink_cap_from_speed_duplex'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
phylink_cap_from_speed_duplex(max_speed, DUPLEX_FULL)) {
^
drivers/net/phy/phylink.c:559:7: error: call to undeclared function 'phylink_cap_from_speed_duplex'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
phylink_cap_from_speed_duplex(max_speed, DUPLEX_HALF)) {
^
2 errors generated.
vim +/phylink_cap_from_speed_duplex +543 drivers/net/phy/phylink.c
431
432 /**
433 * phylink_get_capabilities() - get capabilities for a given MAC
434 * @interface: phy interface mode defined by &typedef phy_interface_t
435 * @mac_capabilities: bitmask of MAC capabilities
436 * @rate_adaptation: type of rate adaptation being performed
437 *
438 * Get the MAC capabilities that are supported by the @interface mode and
439 * @mac_capabilities.
440 */
441 unsigned long phylink_get_capabilities(phy_interface_t interface,
442 unsigned long mac_capabilities,
443 int rate_adaptation)
444 {
445 int max_speed = phylink_interface_max_speed(interface);
446 unsigned long caps = MAC_SYM_PAUSE | MAC_ASYM_PAUSE;
447 unsigned long adapted_caps = 0;
448
449 switch (interface) {
450 case PHY_INTERFACE_MODE_USXGMII:
451 caps |= MAC_10000FD | MAC_5000FD | MAC_2500FD;
452 fallthrough;
453
454 case PHY_INTERFACE_MODE_RGMII_TXID:
455 case PHY_INTERFACE_MODE_RGMII_RXID:
456 case PHY_INTERFACE_MODE_RGMII_ID:
457 case PHY_INTERFACE_MODE_RGMII:
458 case PHY_INTERFACE_MODE_QSGMII:
459 case PHY_INTERFACE_MODE_SGMII:
460 case PHY_INTERFACE_MODE_GMII:
461 caps |= MAC_1000HD | MAC_1000FD;
462 fallthrough;
463
464 case PHY_INTERFACE_MODE_REVRMII:
465 case PHY_INTERFACE_MODE_RMII:
466 case PHY_INTERFACE_MODE_SMII:
467 case PHY_INTERFACE_MODE_REVMII:
468 case PHY_INTERFACE_MODE_MII:
469 caps |= MAC_10HD | MAC_10FD;
470 fallthrough;
471
472 case PHY_INTERFACE_MODE_100BASEX:
473 caps |= MAC_100HD | MAC_100FD;
474 break;
475
476 case PHY_INTERFACE_MODE_TBI:
477 case PHY_INTERFACE_MODE_MOCA:
478 case PHY_INTERFACE_MODE_RTBI:
479 case PHY_INTERFACE_MODE_1000BASEX:
480 caps |= MAC_1000HD;
481 fallthrough;
482 case PHY_INTERFACE_MODE_1000BASEKX:
483 case PHY_INTERFACE_MODE_TRGMII:
484 caps |= MAC_1000FD;
485 break;
486
487 case PHY_INTERFACE_MODE_2500BASEX:
488 caps |= MAC_2500FD;
489 break;
490
491 case PHY_INTERFACE_MODE_5GBASER:
492 caps |= MAC_5000FD;
493 break;
494
495 case PHY_INTERFACE_MODE_XGMII:
496 case PHY_INTERFACE_MODE_RXAUI:
497 case PHY_INTERFACE_MODE_XAUI:
498 case PHY_INTERFACE_MODE_10GBASER:
499 case PHY_INTERFACE_MODE_10GKR:
500 caps |= MAC_10000FD;
501 break;
502
503 case PHY_INTERFACE_MODE_25GBASER:
504 caps |= MAC_25000FD;
505 break;
506
507 case PHY_INTERFACE_MODE_XLGMII:
508 caps |= MAC_40000FD;
509 break;
510
511 case PHY_INTERFACE_MODE_INTERNAL:
512 caps |= ~0;
513 break;
514
515 case PHY_INTERFACE_MODE_NA:
516 case PHY_INTERFACE_MODE_MAX:
517 break;
518 }
519
520 switch (rate_adaptation) {
521 case RATE_ADAPT_OPEN_LOOP:
522 /* TODO */
523 fallthrough;
524 case RATE_ADAPT_NONE:
525 adapted_caps = 0;
526 break;
527 case RATE_ADAPT_PAUSE: {
528 /* The MAC must support asymmetric pause towards the local
529 * device for this. We could allow just symmetric pause, but
530 * then we might have to renegotiate if the link partner
531 * doesn't support pause. This is because there's no way to
532 * accept pause frames without transmitting them if we only
533 * support symmetric pause.
534 */
535 if (!(mac_capabilities & MAC_SYM_PAUSE) ||
536 !(mac_capabilities & MAC_ASYM_PAUSE))
537 break;
538
539 /* We can't adapt if the MAC doesn't support the interface's
540 * max speed at full duplex.
541 */
542 if (mac_capabilities &
> 543 phylink_cap_from_speed_duplex(max_speed, DUPLEX_FULL)) {
544 /* Although a duplex-adapting phy might exist, we
545 * conservatively remove these modes because the MAC
546 * will not be aware of the half-duplex nature of the
547 * link.
548 */
549 adapted_caps = GENMASK(__fls(caps), __fls(MAC_10HD));
550 adapted_caps &= ~(MAC_1000HD | MAC_100HD | MAC_10HD);
551 }
552 break;
553 }
554 case RATE_ADAPT_CRS:
555 /* The MAC must support half duplex at the interface's max
556 * speed.
557 */
558 if (mac_capabilities &
559 phylink_cap_from_speed_duplex(max_speed, DUPLEX_HALF)) {
560 adapted_caps = GENMASK(__fls(caps), __fls(MAC_10HD));
561 adapted_caps &= mac_capabilities;
562 }
563 break;
564 }
565
566 return (caps & mac_capabilities) | adapted_caps;
567 }
568 EXPORT_SYMBOL_GPL(phylink_get_capabilities);
569
--
0-DAY CI Kernel Test Service
https://01.org/lkp