The "exclude_qbv" bit in designcfg_debug1 register varies between MACB/GEM
IP revisions, making direct register probing unreliable for
feature detection. A capability-based approach provides consistent
QBV support identification across the IP family
Platform support:
- Enable MACB_CAPS_QBV for Xilinx Versal platform configuration
- Foundation for QBV feature detection in TAPRIO implementation
Signed-off-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
---
drivers/net/ethernet/cadence/macb.h | 1 +
drivers/net/ethernet/cadence/macb_main.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index ef3995564c5c..4e8d5dcc814e 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -782,6 +782,7 @@
#define MACB_CAPS_MIIONRGMII 0x00000200
#define MACB_CAPS_NEED_TSUCLK 0x00000400
#define MACB_CAPS_QUEUE_DISABLE 0x00000800
+#define MACB_CAPS_QBV 0x00001000
#define MACB_CAPS_PCS 0x01000000
#define MACB_CAPS_HIGH_SPEED 0x02000000
#define MACB_CAPS_CLK_HW_CHG 0x04000000
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index cc33491930e3..98e56697661c 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4601,6 +4601,10 @@ static int macb_init(struct platform_device *pdev)
dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
if (bp->caps & MACB_CAPS_SG_DISABLED)
dev->hw_features &= ~NETIF_F_SG;
+ /* Enable HW_TC if hardware supports QBV */
+ if (bp->caps & MACB_CAPS_QBV)
+ dev->hw_features |= NETIF_F_HW_TC;
+
dev->features = dev->hw_features;
/* Check RX Flow Filters support.
@@ -5345,7 +5349,7 @@ static const struct macb_config sama7g5_emac_config = {
static const struct macb_config versal_config = {
.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO |
MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | MACB_CAPS_NEED_TSUCLK |
- MACB_CAPS_QUEUE_DISABLE,
+ MACB_CAPS_QUEUE_DISABLE, MACB_CAPS_QBV,
.dma_burst_length = 16,
.clk_init = macb_clk_init,
.init = init_reset_optional,
--
2.34.1
Hi Vineeth, kernel test robot noticed the following build warnings: [auto build test WARNING on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Vineeth-Karumanchi/net-macb-Define-ENST-hardware-registers-for-time-aware-scheduling/20250722-234618 base: net-next/main patch link: https://lore.kernel.org/r/20250722154111.1871292-7-vineeth.karumanchi%40amd.com patch subject: [PATCH net-next 6/6] net: macb: Add MACB_CAPS_QBV capability flag for IEEE 802.1Qbv support config: parisc-randconfig-r131-20250724 (https://download.01.org/0day-ci/archive/20250724/202507240825.lVN6sSiB-lkp@intel.com/config) compiler: hppa-linux-gcc (GCC) 14.3.0 reproduce: (https://download.01.org/0day-ci/archive/20250724/202507240825.lVN6sSiB-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202507240825.lVN6sSiB-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) drivers/net/ethernet/cadence/macb_main.c:282:16: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] bottom @@ got restricted __le32 [usertype] @@ drivers/net/ethernet/cadence/macb_main.c:282:16: sparse: expected unsigned int [usertype] bottom drivers/net/ethernet/cadence/macb_main.c:282:16: sparse: got restricted __le32 [usertype] drivers/net/ethernet/cadence/macb_main.c:284:13: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] top @@ got restricted __le16 [usertype] @@ drivers/net/ethernet/cadence/macb_main.c:284:13: sparse: expected unsigned short [usertype] top drivers/net/ethernet/cadence/macb_main.c:284:13: sparse: got restricted __le16 [usertype] drivers/net/ethernet/cadence/macb_main.c:3645:39: sparse: sparse: restricted __be32 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3650:39: sparse: sparse: restricted __be32 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3655:40: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3655:69: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3680:20: sparse: sparse: restricted __be32 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3684:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [assigned] [usertype] w0 @@ got restricted __be32 [usertype] ip4src @@ drivers/net/ethernet/cadence/macb_main.c:3684:20: sparse: expected unsigned int [assigned] [usertype] w0 drivers/net/ethernet/cadence/macb_main.c:3684:20: sparse: got restricted __be32 [usertype] ip4src drivers/net/ethernet/cadence/macb_main.c:3694:20: sparse: sparse: restricted __be32 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3698:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [assigned] [usertype] w0 @@ got restricted __be32 [usertype] ip4dst @@ drivers/net/ethernet/cadence/macb_main.c:3698:20: sparse: expected unsigned int [assigned] [usertype] w0 drivers/net/ethernet/cadence/macb_main.c:3698:20: sparse: got restricted __be32 [usertype] ip4dst drivers/net/ethernet/cadence/macb_main.c:3708:21: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3708:50: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3714:30: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3715:30: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3722:36: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3723:38: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3726:38: sparse: sparse: restricted __be16 degrades to integer drivers/net/ethernet/cadence/macb_main.c:3762:9: sparse: sparse: cast from restricted __be32 drivers/net/ethernet/cadence/macb_main.c:3762:9: sparse: sparse: cast from restricted __be32 drivers/net/ethernet/cadence/macb_main.c:3816:25: sparse: sparse: cast from restricted __be32 drivers/net/ethernet/cadence/macb_main.c:3816:25: sparse: sparse: cast from restricted __be32 >> drivers/net/ethernet/cadence/macb_main.c:5352:42: sparse: sparse: Initializer entry defined twice drivers/net/ethernet/cadence/macb_main.c:5353:10: sparse: also defined here vim +5352 drivers/net/ethernet/cadence/macb_main.c 5348 5349 static const struct macb_config versal_config = { 5350 .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | 5351 MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | MACB_CAPS_NEED_TSUCLK | > 5352 MACB_CAPS_QUEUE_DISABLE, MACB_CAPS_QBV, 5353 .dma_burst_length = 16, 5354 .clk_init = macb_clk_init, 5355 .init = init_reset_optional, 5356 .jumbo_max_len = 10240, 5357 .usrio = &macb_default_usrio, 5358 }; 5359 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
On Tue, Jul 22, 2025 at 09:11:11PM +0530, Vineeth Karumanchi wrote: > The "exclude_qbv" bit in designcfg_debug1 register varies between MACB/GEM > IP revisions, making direct register probing unreliable for > feature detection. A capability-based approach provides consistent > QBV support identification across the IP family > > Platform support: > - Enable MACB_CAPS_QBV for Xilinx Versal platform configuration > - Foundation for QBV feature detection in TAPRIO implementation > > Signed-off-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com> ... > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c > index cc33491930e3..98e56697661c 100644 > --- a/drivers/net/ethernet/cadence/macb_main.c > +++ b/drivers/net/ethernet/cadence/macb_main.c > @@ -4601,6 +4601,10 @@ static int macb_init(struct platform_device *pdev) > dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM; > if (bp->caps & MACB_CAPS_SG_DISABLED) > dev->hw_features &= ~NETIF_F_SG; > + /* Enable HW_TC if hardware supports QBV */ > + if (bp->caps & MACB_CAPS_QBV) > + dev->hw_features |= NETIF_F_HW_TC; > + > dev->features = dev->hw_features; > > /* Check RX Flow Filters support. > @@ -5345,7 +5349,7 @@ static const struct macb_config sama7g5_emac_config = { > static const struct macb_config versal_config = { > .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | > MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | MACB_CAPS_NEED_TSUCLK | > - MACB_CAPS_QUEUE_DISABLE, > + MACB_CAPS_QUEUE_DISABLE, MACB_CAPS_QBV, Hi Vineeth, TL;DR: I think you mean MACB_CAPS_QUEUE_DISABLE | MACB_CAPS_QBV, ^^^ I assume that the intention here is to set the MACB_CAPS_QBV bit of .caps. However, because there is a comma rather than a pipe between it and MACB_CAPS_QUEUE_DISABLE the effect is to leave .caps as it was before, and set .dma_burst_length to MACB_CAPS_QBV. .dma_burst_length is then overwritten on the following line. Flagged by W=1 builds with Clang 20.1.8 and 15.1.0. Please build your patches with W=1 and try to avoid adding warnings it flags. Also, while we are here, it would be nice to fix up the line wrapping so the adjacent code is 80 columns wide or less, as is still preferred in Networking code. .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | MACB_CAPS_NEED_TSUCLK | MACB_CAPS_QUEUE_DISABLE | MACB_CAPS_QBV, > .dma_burst_length = 16, > .clk_init = macb_clk_init, > .init = init_reset_optional, > -- > 2.34.1 > >
Hi Simon, On 7/24/2025 12:35 AM, Simon Horman wrote: <...> >> @@ -5345,7 +5349,7 @@ static const struct macb_config sama7g5_emac_config = { >> static const struct macb_config versal_config = { >> .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | >> MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | MACB_CAPS_NEED_TSUCLK | >> - MACB_CAPS_QUEUE_DISABLE, >> + MACB_CAPS_QUEUE_DISABLE, MACB_CAPS_QBV, > Hi Vineeth, > > TL;DR: I think you mean > > MACB_CAPS_QUEUE_DISABLE | MACB_CAPS_QBV, > ^^^ > Yes, since there's no strict validation for the presence of NETIF_F_HW_TC, the tc add/replace command succeeded. I've submitted an RFC patch to enforce stricter checks for NETIF_F_HW_TC within dev->hw_features > I assume that the intention here is to set the MACB_CAPS_QBV bit of .caps. > However, because there is a comma rather than a pipe between > it and MACB_CAPS_QUEUE_DISABLE the effect is to leave .caps as > it was before, and set .dma_burst_length to MACB_CAPS_QBV. > .dma_burst_length is then overwritten on the following line. > > Flagged by W=1 builds with Clang 20.1.8 and 15.1.0. > > Please build your patches with W=1 and try to avoid adding warnings > it flags. > > Also, while we are here, it would be nice to fix up the line wrapping so > the adjacent code is 80 columns wide or less, as is still preferred in > Networking code. > > .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | > MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | > MACB_CAPS_NEED_TSUCLK | MACB_CAPS_QUEUE_DISABLE | > MACB_CAPS_QBV, > OK. Thanks, -- 🙏 vineeth
© 2016 - 2025 Red Hat, Inc.