Skip to content

Conversation

@melooop
Copy link

@melooop melooop commented Jan 4, 2026

wangxun inclusion
category: bugfix

fix set CONFIG_DCB=N, related txgbe dcb module compile error.

Summary by Sourcery

Fix txgbe driver build and runtime behavior when optional features like DCB and FCoE are disabled by tightening configuration guards and modularizing feature-specific code.

Bug Fixes:

  • Resolve txgbe driver compilation errors when CONFIG_DCB is disabled by wrapping DCB-dependent code and declarations in appropriate CONFIG_DCB conditionals and moving ETS handling into the DCB module.

Enhancements:

  • Refine txgbe driver feature modularity so that DCB, FCoE, sysfs, and debugfs components are built and used only when their corresponding kernel config options are enabled.

wangxun inclusion
category: bugfix

fix set CONFIG_DCB=N, related txgbe dcb module compile error.

Signed-off-by: Duanqiang Wen <[email protected]>
@sourcery-ai
Copy link

sourcery-ai bot commented Jan 4, 2026

Reviewer's Guide

Makes the txgbe driver build and runtime behavior correctly conditional on CONFIG_DCB, FCoE, sysfs, and debugfs so that the driver compiles and runs correctly when DCB is disabled, while relocating DCB-specific helpers into the DCB module and tightening the Makefile object selection.

Class diagram for DCB and FCoE related txgbe components after fixes

classDiagram

  class txgbe_adapter {
  }

  class txgbe_main_c {
    +void txgbe_configure(txgbe_adapter adapter)
    +void txgbe_setup_tc(net_device dev, u8 tc)
    +void txgbe_update_default_up(txgbe_adapter adapter)
    +void txgbe_configure_dcb(txgbe_adapter adapter)
  }

  class txgbe_lib_c {
    +void txgbe_cache_ring_register(txgbe_adapter adapter)
    +bool txgbe_cache_ring_dcb_vmdq(txgbe_adapter adapter)
    +bool txgbe_cache_ring_dcb(txgbe_adapter adapter)
    +bool txgbe_set_dcb_vmdq_queues(txgbe_adapter adapter)
    +bool txgbe_set_dcb_queues(txgbe_adapter adapter)
    +void txgbe_set_num_queues(txgbe_adapter adapter)
  }

  class txgbe_dcb_c {
    +s32 txgbe_dcb_config_pfc(txgbe_hw hw, u8 pfc_en, u8 map)
    +s32 txgbe_dcb_hw_config(txgbe_hw hw, u16 refill, u16 max, u8 bwg_id, u8 tsa, u8 map)
    +s32 txgbe_dcb_hw_ets(txgbe_hw hw, ieee_ets ets, int max_frame)
  }

  class txgbe_dcb_h {
    +s32 txgbe_dcb_config_pfc(txgbe_hw hw, u8 pfc_en, u8 map)
    +s32 txgbe_dcb_hw_config(txgbe_hw hw, u16 refill, u16 max, u8 bwg_id, u8 tsa, u8 map)
    +s32 txgbe_dcb_hw_ets(txgbe_hw hw, ieee_ets ets, int max_frame)
  }

  class txgbe_fcoe_c {
    +int txgbe_fcoe_enable(net_device netdev)
    +int txgbe_fcoe_disable(net_device netdev)
    +int txgbe_fcoe_ddp_tx(txgbe_adapter adapter)
    +u8 txgbe_fcoe_getapp(net_device netdev)
    +u8 txgbe_fcoe_get_tc(txgbe_adapter adapter)
    +int txgbe_fcoe_get_wwn(net_device netdev, u64 wwn, int type)
  }

  class txgbe_h {
    +extern dcbnl_rtnl_ops dcbnl_ops
    +int txgbe_copy_dcb_cfg(txgbe_adapter adapter, int tc_max)
    +u8 txgbe_dcb_txq_to_tc(txgbe_adapter adapter, u8 index)
    +void txgbe_sysfs_exit(txgbe_adapter adapter)
    +int txgbe_sysfs_init(txgbe_adapter adapter)
  }

  txgbe_main_c --> txgbe_adapter
  txgbe_lib_c --> txgbe_adapter
  txgbe_dcb_c --> txgbe_adapter
  txgbe_fcoe_c --> txgbe_adapter

  txgbe_dcb_c ..> txgbe_dcb_h : implements
  txgbe_main_c ..> txgbe_h : uses
  txgbe_lib_c ..> txgbe_h : uses
  txgbe_fcoe_c ..> txgbe_h : uses

  note for txgbe_main_c "txgbe_configure_dcb, txgbe_update_default_up and DCB parts of txgbe_setup_tc are compiled only when CONFIG_DCB is enabled"
  note for txgbe_lib_c "DCB queue and ring helpers are compiled only when CONFIG_DCB is enabled; otherwise txgbe_cache_ring_register and txgbe_set_num_queues fall back to non DCB paths"
  note for txgbe_dcb_c "txgbe_dcb_hw_ets was moved here from txgbe_main.c and is always built only when CONFIG_DCB selects this object"
  note for txgbe_fcoe_c "txgbe_fcoe_get_tc returns a DCB based traffic class when CONFIG_DCB is enabled, or 0 when DCB is disabled"
Loading

File-Level Changes

Change Details Files
Guard DCB-dependent runtime logic in the core txgbe driver so it is omitted when CONFIG_DCB is disabled.
  • Wrap txgbe_configure_dcb and its callers in CONFIG_DCB conditionals so DCB configuration is only compiled when enabled
  • Guard default user-priority update logic and priority/TC mapping helpers behind CONFIG_DCB so they are not referenced without DCB
  • Conditionally execute DCB-related traffic-class setup in txgbe_setup_tc only when DCB is enabled, falling back to basic interrupt/queue setup otherwise
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
Move the ETS hardware helper into the DCB module and adjust DCB/FCoE header usage and conditionals.
  • Relocate txgbe_dcb_hw_ets implementation from the core driver into txgbe_dcb.c and declare it in txgbe_dcb.h
  • Include linux/dcbnl.h in the DCB header to provide ieee_ets and related types
  • Restrict exposure of dcbnl_rtnl_ops to DCB-enabled builds and fix the FCoE helper prototypes to be conditioned on CONFIG_FCOE instead of CONFIG_DCB
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
drivers/net/ethernet/wangxun/txgbe/txgbe_dcb.c
drivers/net/ethernet/wangxun/txgbe/txgbe_dcb.h
drivers/net/ethernet/wangxun/txgbe/txgbe.h
Make queue layout and DCB/VMDq cache/set helpers optional based on CONFIG_DCB.
  • Wrap DCB-specific ring caching helpers and DCB/VMDq queue allocation helpers in CONFIG_DCB conditionals so they are only built when DCB is enabled
  • Guard the DCB/VMDq branches in txgbe_set_num_queues and txgbe_cache_ring_register so they are skipped entirely when DCB is disabled
drivers/net/ethernet/wangxun/txgbe/txgbe_lib.c
Decouple FCoE traffic-class lookup from DCB when DCB is disabled.
  • Make txgbe_fcoe_get_tc return the netdev priority-to-TC map when DCB is enabled and fall back to TC 0 when DCB is disabled, ensuring a safe default when DCB is off
drivers/net/ethernet/wangxun/txgbe/txgbe_fcoe.c
Tighten txgbe Makefile object selection to follow Kconfig options for DCB, FCoE, sysfs, and debugfs and drop out-of-tree build rules.
  • Remove always-built DCB, FCoE, sysfs, and debugfs objects from the base txgbe-objs list and instead use Kconfig-driven txgbe-$(CONFIG_*) object lists
  • Delete local KERNELDIR-based out-of-tree build and clean targets to rely on standard kernel build infrastructure
drivers/net/ethernet/wangxun/txgbe/Makefile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link

Hi @melooop. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@melooop melooop changed the title deepin: net: txgbe: fix CONFIG_DCB=N compile error [Deepin-Kernel-SIG] [linux 6.18-y] [Wangxun]deepin: net: txgbe: fix CONFIG_DCB=N compile error Jan 4, 2026
@opsiff opsiff merged commit b4eeabf into deepin-community:linux-6.6.y Jan 4, 2026
11 of 12 checks passed
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: opsiff

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes compilation errors that occur when CONFIG_DCB is disabled in the txgbe network driver. The changes properly guard DCB-specific code with CONFIG_DCB conditionals and relocate the txgbe_dcb_hw_ets function from the main module to the DCB module where it belongs.

Key changes:

  • Move txgbe_dcb_hw_ets function from txgbe_main.c to txgbe_dcb.c and update header declarations
  • Add CONFIG_DCB guards around DCB-dependent code in main, lib, and FCoE modules
  • Update Makefile to conditionally compile DCB, FCoE, sysfs, and debugfs modules based on their respective config options

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c Removed txgbe_dcb_hw_ets function and wrapped DCB-specific functions with CONFIG_DCB guards
drivers/net/ethernet/wangxun/txgbe/txgbe_lib.c Added CONFIG_DCB guards around DCB queue configuration functions
drivers/net/ethernet/wangxun/txgbe/txgbe_fcoe.c Added CONFIG_DCB guard for netdev_get_prio_tc_map call in txgbe_fcoe_get_tc
drivers/net/ethernet/wangxun/txgbe/txgbe_dcb.h Added function declaration for txgbe_dcb_hw_ets and linux/dcbnl.h include
drivers/net/ethernet/wangxun/txgbe/txgbe_dcb.c Added txgbe_dcb_hw_ets function implementation (moved from main.c)
drivers/net/ethernet/wangxun/txgbe/txgbe.h Removed duplicate function declaration, fixed CONFIG_FCOE guard (was incorrectly CONFIG_DCB), and added guard for dcbnl_ops
drivers/net/ethernet/wangxun/txgbe/Makefile Changed to conditional compilation for DCB, FCoE, sysfs, and debugfs modules

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1046 to 1049
#endif /* CONFIG_DCB */
int txgbe_copy_dcb_cfg(struct txgbe_adapter *adapter, int tc_max);

u8 txgbe_dcb_txq_to_tc(struct txgbe_adapter *adapter, u8 index);
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions txgbe_copy_dcb_cfg and txgbe_dcb_txq_to_tc at lines 1047 and 1049 are DCB-related but are not protected by CONFIG_DCB guards. These declarations should be wrapped with #if IS_ENABLED(CONFIG_DCB) to prevent compilation errors when CONFIG_DCB is disabled, as their implementations are likely in DCB-specific source files.

Suggested change
#endif /* CONFIG_DCB */
int txgbe_copy_dcb_cfg(struct txgbe_adapter *adapter, int tc_max);
u8 txgbe_dcb_txq_to_tc(struct txgbe_adapter *adapter, u8 index);
int txgbe_copy_dcb_cfg(struct txgbe_adapter *adapter, int tc_max);
u8 txgbe_dcb_txq_to_tc(struct txgbe_adapter *adapter, u8 index);
#endif /* CONFIG_DCB */

Copilot uses AI. Check for mistakes.
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
rm -rf *.${MANSECTION}.gz *.ko
txgbe-$(CONFIG_DCB) += txgbe_dcb_nl.o txgbe_dcb.o
txgbe-$(CONFIG_FCOE:m=y) += txgbe_fcoe.o
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax for conditional object compilation in Makefiles should use the CONFIG variable directly without the :m=y suffix. The correct syntax for CONFIG_FCOE should be:
txgbe-$(CONFIG_FCOE) += txgbe_fcoe.o

The :m=y suffix is not standard kbuild syntax and may cause build issues.

Suggested change
txgbe-$(CONFIG_FCOE:m=y) += txgbe_fcoe.o
txgbe-$(CONFIG_FCOE) += txgbe_fcoe.o

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +32
txgbe-$(CONFIG_SYSFS) += txgbe_sysfs.o
txgbe-$(CONFIG_DEBUG_FS) += txgbe_debugfs.o
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The txgbe_sysfs.o object is already included in the main txgbe-objs list at line 21, and now it's being conditionally added again at line 31. This will cause duplicate object files in the build when CONFIG_SYSFS is enabled. Remove either the unconditional inclusion at line 21 or the conditional inclusion at line 31.

Suggested change
txgbe-$(CONFIG_SYSFS) += txgbe_sysfs.o
txgbe-$(CONFIG_DEBUG_FS) += txgbe_debugfs.o
txgbe-$(CONFIG_DEBUG_FS) += txgbe_debugfs.o

Copilot uses AI. Check for mistakes.
txgbe-$(CONFIG_DCB) += txgbe_dcb_nl.o txgbe_dcb.o
txgbe-$(CONFIG_FCOE:m=y) += txgbe_fcoe.o
txgbe-$(CONFIG_SYSFS) += txgbe_sysfs.o
txgbe-$(CONFIG_DEBUG_FS) += txgbe_debugfs.o
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The txgbe_debugfs.o object is already included in the main txgbe-objs list at line 14, and now it's being conditionally added again at line 32. This will cause duplicate object files in the build when CONFIG_DEBUG_FS is enabled. Remove either the unconditional inclusion at line 14 or the conditional inclusion at line 32.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants