Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions drivers/net/ethernet/wangxun/txgbe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ txgbe-objs := txgbe_main.o \
txgbe_phy.o \
txgbe_ethtool.o \
txgbe_bp.o \
txgbe_dcb_nl.o \
txgbe_dcb.o \
txgbe_debugfs.o \
txgbe_fcoe.o \
txgbe_mbx.o \
txgbe_mtd.o \
txgbe_e56.o \
Expand All @@ -29,9 +26,7 @@ txgbe-objs := txgbe_main.o \
txgbe_pcierr.o \
txgbe_e56_bp.o

KERNELDIR ?= /lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
$(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.
txgbe-$(CONFIG_SYSFS) += txgbe_sysfs.o
txgbe-$(CONFIG_DEBUG_FS) += txgbe_debugfs.o
Comment on lines +31 to +32
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.
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.
9 changes: 3 additions & 6 deletions drivers/net/ethernet/wangxun/txgbe/txgbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,9 @@ struct txgbe_cb {
/* ESX txgbe CIM IOCTL definition */
void txgbe_sysfs_exit(struct txgbe_adapter *adapter);
int txgbe_sysfs_init(struct txgbe_adapter *adapter);

#if IS_ENABLED(CONFIG_DCB)
extern struct dcbnl_rtnl_ops dcbnl_ops;
#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);
Comment on lines +1046 to 1049
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.
Expand Down Expand Up @@ -1125,7 +1126,7 @@ void txgbe_free_fcoe_ddp_resources(struct txgbe_adapter *adapter);
int txgbe_fcoe_enable(struct net_device *netdev);
int txgbe_fcoe_disable(struct net_device *netdev);
#endif /* CONFIG_FCOE */
#if IS_ENABLED(CONFIG_DCB)
#if IS_ENABLED(CONFIG_FCOE)
u8 txgbe_fcoe_getapp(struct net_device *netdev);
u8 txgbe_fcoe_get_tc(struct txgbe_adapter *adapter);
int txgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
Expand All @@ -1145,10 +1146,6 @@ static inline struct netdev_queue *txring_txq(const struct txgbe_ring *ring)
return netdev_get_tx_queue(ring->netdev, ring->queue_index);
}

#if IS_ENABLED(CONFIG_DCB)
s32 txgbe_dcb_hw_ets(struct txgbe_hw *hw, struct ieee_ets *ets, int max_frame);
#endif /* CONFIG_DCB */

int txgbe_wol_supported(struct txgbe_adapter *adapter);
int txgbe_get_settings(struct net_device *netdev,
struct ethtool_cmd *ecmd);
Expand Down
33 changes: 33 additions & 0 deletions drivers/net/ethernet/wangxun/txgbe/txgbe_dcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,39 @@ s32 txgbe_dcb_config_pfc(struct txgbe_hw *hw, u8 pfc_en, u8 *map)
return ret;
}

s32 txgbe_dcb_hw_ets(struct txgbe_hw *hw, struct ieee_ets *ets, int max_frame)
{
__u16 refill[IEEE_8021QAZ_MAX_TCS], max[IEEE_8021QAZ_MAX_TCS];
__u8 prio_type[IEEE_8021QAZ_MAX_TCS];
int i;

/* naively give each TC a bwg to map onto CEE hardware */
__u8 bwg_id[IEEE_8021QAZ_MAX_TCS] = {0, 1, 2, 3, 4, 5, 6, 7};

/* Map TSA onto CEE prio type */
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
switch (ets->tc_tsa[i]) {
case IEEE_8021QAZ_TSA_STRICT:
prio_type[i] = 2;
break;
case IEEE_8021QAZ_TSA_ETS:
prio_type[i] = 0;
break;
default:
/* Hardware only supports priority strict or
* ETS transmission selection algorithms if
* we receive some other value from dcbnl
* throw an error
*/
return -EINVAL;
}
}

txgbe_dcb_calculate_tc_credits(ets->tc_tx_bw, refill, max, max_frame);
return txgbe_dcb_hw_config(hw, refill, max,
bwg_id, prio_type, ets->prio_tc);
}

s32 txgbe_dcb_hw_config(struct txgbe_hw *hw, u16 *refill, u16 *max,
u8 *bwg_id, u8 *tsa, u8 *map)
{
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/ethernet/wangxun/txgbe/txgbe_dcb.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifndef _TXGBE_DCB_H_
#define _TXGBE_DCB_H_

#include <linux/dcbnl.h>
#include "txgbe_type.h"

/* DCB defines */
Expand Down Expand Up @@ -181,7 +182,7 @@ void txgbe_dcb_unpack_map_cee(struct txgbe_dcb_config *cfg, int direction,
s32 txgbe_dcb_config_tc_stats(struct txgbe_hw __always_unused *hw,
struct txgbe_dcb_config __always_unused *dcb_config);
u8 txgbe_dcb_get_tc_from_up(struct txgbe_dcb_config *cfg, int direction, u8 up);

s32 txgbe_dcb_hw_ets(struct txgbe_hw *hw, struct ieee_ets *ets, int max_frame);
/* DCB initialization */
s32 txgbe_dcb_config(struct txgbe_hw *hw,
struct txgbe_dcb_config *dcb_config);
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/wangxun/txgbe/txgbe_fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,10 @@ int txgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
*/
u8 txgbe_fcoe_get_tc(struct txgbe_adapter *adapter)
{
#if IS_ENABLED(CONFIG_DCB)
return netdev_get_prio_tc_map(adapter->netdev, adapter->fcoe.up);
#else
return 0;
#endif /* CONFIG_DCB */
}
#endif /* CONFIG_FCOE */
9 changes: 8 additions & 1 deletion drivers/net/ethernet/wangxun/txgbe/txgbe_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "txgbe.h"
#include "txgbe_sriov.h"

#if IS_ENABLED(CONFIG_DCB)
/**
* txgbe_cache_ring_dcb_vmdq - Descriptor ring to register mapping for VMDq
* @adapter: board private structure to initialize
Expand Down Expand Up @@ -147,6 +148,7 @@ static bool txgbe_cache_ring_dcb(struct txgbe_adapter *adapter)

return true;
}
#endif /* CONFIG_DCB */

/**
* txgbe_cache_ring_vmdq - Descriptor ring to register mapping for VMDq
Expand Down Expand Up @@ -248,12 +250,13 @@ static bool txgbe_cache_ring_rss(struct txgbe_adapter *adapter)
**/
static void txgbe_cache_ring_register(struct txgbe_adapter *adapter)
{
#if IS_ENABLED(CONFIG_DCB)
if (txgbe_cache_ring_dcb_vmdq(adapter))
return;

if (txgbe_cache_ring_dcb(adapter))
return;

#endif /* CONFIG_DCB */
if (txgbe_cache_ring_vmdq(adapter))
return;

Expand All @@ -267,6 +270,7 @@ static void txgbe_cache_ring_register(struct txgbe_adapter *adapter)
#define TXGBE_RSS_2Q_MASK 0x1
#define TXGBE_RSS_DISABLED_MASK 0x0

#if IS_ENABLED(CONFIG_DCB)
/**
* txgbe_set_dcb_vmdq_queues: Allocate queues for VMDq devices w/ DCB
* @adapter: board private structure to initialize
Expand Down Expand Up @@ -441,6 +445,7 @@ static bool txgbe_set_dcb_queues(struct txgbe_adapter *adapter)

return true;
}
#endif /* CONFIG_DCB */

static u16 txgbe_xdp_queues(struct txgbe_adapter *adapter)
{
Expand Down Expand Up @@ -642,11 +647,13 @@ static void txgbe_set_num_queues(struct txgbe_adapter *adapter)
adapter->num_rx_pools = adapter->num_rx_queues;
adapter->num_rx_queues_per_pool = 1;

#if IS_ENABLED(CONFIG_DCB)
if (txgbe_set_dcb_vmdq_queues(adapter))
return;

if (txgbe_set_dcb_queues(adapter))
return;
#endif /* CONFIG_DCB */

if (txgbe_set_vmdq_queues(adapter))
return;
Expand Down
46 changes: 10 additions & 36 deletions drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4528,39 +4528,6 @@ static void txgbe_napi_disable_all(struct txgbe_adapter *adapter)
}
}

s32 txgbe_dcb_hw_ets(struct txgbe_hw *hw, struct ieee_ets *ets, int max_frame)
{
__u16 refill[IEEE_8021QAZ_MAX_TCS], max[IEEE_8021QAZ_MAX_TCS];
__u8 prio_type[IEEE_8021QAZ_MAX_TCS];
int i;

/* naively give each TC a bwg to map onto CEE hardware */
__u8 bwg_id[IEEE_8021QAZ_MAX_TCS] = {0, 1, 2, 3, 4, 5, 6, 7};

/* Map TSA onto CEE prio type */
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
switch (ets->tc_tsa[i]) {
case IEEE_8021QAZ_TSA_STRICT:
prio_type[i] = 2;
break;
case IEEE_8021QAZ_TSA_ETS:
prio_type[i] = 0;
break;
default:
/* Hardware only supports priority strict or
* ETS transmission selection algorithms if
* we receive some other value from dcbnl
* throw an error
*/
return -EINVAL;
}
}

txgbe_dcb_calculate_tc_credits(ets->tc_tx_bw, refill, max, max_frame);
return txgbe_dcb_hw_config(hw, refill, max,
bwg_id, prio_type, ets->prio_tc);
}

void txgbe_clear_vxlan_port(struct txgbe_adapter *adapter)
{
if (!(adapter->flags & TXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE))
Expand All @@ -4586,6 +4553,7 @@ static inline unsigned long txgbe_tso_features(void)
return features;
}

#if IS_ENABLED(CONFIG_DCB)
static void txgbe_configure_dcb(struct txgbe_adapter *adapter)
{
struct txgbe_hw *hw = &adapter->hw;
Expand Down Expand Up @@ -4637,6 +4605,7 @@ static void txgbe_configure_dcb(struct txgbe_adapter *adapter)
/* write msb to all 8 TCs in one write */
wr32(hw, TXGBE_RDB_RSS_TC, msb * 0x11111111);
}
#endif /* CONFIG_DCB */

static void txgbe_configure_lli(struct txgbe_adapter *adapter)
{
Expand Down Expand Up @@ -4967,8 +4936,9 @@ static void txgbe_configure(struct txgbe_adapter *adapter)
struct txgbe_hw *hw = &adapter->hw;

txgbe_configure_pb(adapter);
#if IS_ENABLED(CONFIG_DCB)
txgbe_configure_dcb(adapter);

#endif
/* We must restore virtualization before VLANs or else
* the VLVF registers will not be populated
*/
Expand Down Expand Up @@ -7120,8 +7090,8 @@ static void txgbe_watchdog_update_link(struct txgbe_adapter *adapter)

static void txgbe_update_default_up(struct txgbe_adapter *adapter)
{
#if IS_ENABLED(CONFIG_DCB)
u8 up = 0;

struct net_device *netdev = adapter->netdev;
struct dcb_app app = {
.selector = DCB_APP_IDTYPE_ETHTYPE,
Expand All @@ -7134,6 +7104,7 @@ static void txgbe_update_default_up(struct txgbe_adapter *adapter)
#else
adapter->default_up = up;
#endif
#endif
}

/**
Expand Down Expand Up @@ -9787,6 +9758,7 @@ static int txgbe_siocdevprivate(struct net_device *netdev, struct ifreq *ifr,
return txgbe_ioctl(netdev, ifr, cmd);
}

#if IS_ENABLED(CONFIG_DCB)
/* txgbe_validate_rtr - verify 802.1Qp to Rx packet buffer mapping is valid.
* @adapter: pointer to txgbe_adapter
* @tc: number of traffic classes currently enabled
Expand Down Expand Up @@ -9839,6 +9811,7 @@ static void txgbe_set_prio_tc_map(struct txgbe_adapter *adapter)
netdev_set_prio_tc_map(dev, prio, tc);
}
}
#endif /* CONFIG_DCB */

/**
* txgbe_setup_tc - routine to configure net_device for multiple traffic
Expand Down Expand Up @@ -9879,6 +9852,7 @@ int txgbe_setup_tc(struct net_device *dev, u8 tc)

txgbe_clear_interrupt_scheme(adapter);

#if IS_ENABLED(CONFIG_DCB)
if (tc) {
netdev_set_num_tc(dev, tc);
txgbe_set_prio_tc_map(adapter);
Expand All @@ -9895,7 +9869,7 @@ int txgbe_setup_tc(struct net_device *dev, u8 tc)
}

txgbe_validate_rtr(adapter, tc);

#endif
txgbe_init_interrupt_scheme(adapter);
if (netif_running(dev))
txgbe_open(dev);
Expand Down
Loading