Skip to contentSkip to conversation

net/txgbe: duplicate legs of if statement

DPDK/ethdev Bug 1581 [email protected] 1 participant 1 message Nov 15, 2024

lore
Share & tools
lore
#0 lore raw

https://bugs.dpdk.org/show_bug.cgi?id=1581

            Bug ID: 1581
           Summary: net/txgbe: duplicate legs of if statement
           Product: DPDK
           Version: 24.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: major
          Priority: Normal
         Component: ethdev
          Assignee: [email protected]
          Reporter: [email protected]

Target Milestone: ---

This bug is reported here:
https://pvs-studio.com/en/blog/posts/cpp/1183/

V523 The 'then' statement is equivalent to the 'else' statement. bnx2x.c 1633

static s32 txgbe_read_phy_if(struct txgbe_hw *hw)
{
....

  if (!hw->phy.phy_semaphore_mask) {
    if (hw->bus.lan_id)
      hw->phy.phy_semaphore_mask = TXGBE_MNGSEM_SWPHY;
    else
      hw->phy.phy_semaphore_mask = TXGBE_MNGSEM_SWPHY;

}
return 0;
}

Looking at the Linux kernel driver this mask looks messed up. In Linux driver possible values are

ethernet/wangxun/libwx/wx_type.h:#define WX_MNG_SWFW_SYNC_SW_MB BIT(2)
ethernet/wangxun/libwx/wx_type.h:#define WX_MNG_SWFW_SYNC_SW_FLASH BIT(3)

But in DPDK it is always using a different value.

#define TXGBE_MNGSEM_SWPHY MS(0, 0x1)

Looks like with wrong mask the SW/FW sync never works!

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.