Skip to content

Commit 12d42c5

Browse files
hkallweitdavem330
authored andcommitted
r8169: improve handling of CPCMD quirk mask
Both quirk masks are the same, so we can merge them. The quirk mask includes most bits so it's actually easier to define a mask with the bits to keep. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0ae0974 commit 12d42c5

File tree

1 file changed

+7
-28
lines changed
  • drivers/net/ethernet/realtek

1 file changed

+7
-28
lines changed

drivers/net/ethernet/realtek/r8169.c

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ enum rtl_rx_desc_bit {
690690
};
691691

692692
#define RsvdMask 0x3fffc000
693+
#define CPCMD_QUIRK_MASK (Normal_mode | RxVlan | RxChkSum | INTT_MASK)
693694

694695
struct TxDesc {
695696
__le32 opts1;
@@ -5643,22 +5644,11 @@ static void rtl_pcie_state_l2l3_enable(struct rtl8169_private *tp, bool enable)
56435644
RTL_W8(tp, Config3, data);
56445645
}
56455646

5646-
#define R8168_CPCMD_QUIRK_MASK (\
5647-
EnableBist | \
5648-
Mac_dbgo_oe | \
5649-
Force_half_dup | \
5650-
Force_rxflow_en | \
5651-
Force_txflow_en | \
5652-
Cxpl_dbg_sel | \
5653-
ASF | \
5654-
PktCntrDisable | \
5655-
Mac_dbgo_sel)
5656-
56575647
static void rtl_hw_start_8168bb(struct rtl8169_private *tp)
56585648
{
56595649
RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
56605650

5661-
tp->cp_cmd &= ~R8168_CPCMD_QUIRK_MASK;
5651+
tp->cp_cmd &= CPCMD_QUIRK_MASK;
56625652
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
56635653

56645654
if (tp->dev->mtu <= ETH_DATA_LEN) {
@@ -5687,7 +5677,7 @@ static void __rtl_hw_start_8168cp(struct rtl8169_private *tp)
56875677

56885678
rtl_disable_clock_request(tp);
56895679

5690-
tp->cp_cmd &= ~R8168_CPCMD_QUIRK_MASK;
5680+
tp->cp_cmd &= CPCMD_QUIRK_MASK;
56915681
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
56925682
}
56935683

@@ -5717,7 +5707,7 @@ static void rtl_hw_start_8168cp_2(struct rtl8169_private *tp)
57175707
if (tp->dev->mtu <= ETH_DATA_LEN)
57185708
rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
57195709

5720-
tp->cp_cmd &= ~R8168_CPCMD_QUIRK_MASK;
5710+
tp->cp_cmd &= CPCMD_QUIRK_MASK;
57215711
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
57225712
}
57235713

@@ -5735,7 +5725,7 @@ static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp)
57355725
if (tp->dev->mtu <= ETH_DATA_LEN)
57365726
rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
57375727

5738-
tp->cp_cmd &= ~R8168_CPCMD_QUIRK_MASK;
5728+
tp->cp_cmd &= CPCMD_QUIRK_MASK;
57395729
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
57405730
}
57415731

@@ -5793,7 +5783,7 @@ static void rtl_hw_start_8168d(struct rtl8169_private *tp)
57935783
if (tp->dev->mtu <= ETH_DATA_LEN)
57945784
rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
57955785

5796-
tp->cp_cmd &= ~R8168_CPCMD_QUIRK_MASK;
5786+
tp->cp_cmd &= CPCMD_QUIRK_MASK;
57975787
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
57985788
}
57995789

@@ -6394,17 +6384,6 @@ static void rtl_hw_start_8168(struct rtl8169_private *tp)
63946384
RTL_W16(tp, MultiIntr, RTL_R16(tp, MultiIntr) & 0xf000);
63956385
}
63966386

6397-
#define R810X_CPCMD_QUIRK_MASK (\
6398-
EnableBist | \
6399-
Mac_dbgo_oe | \
6400-
Force_half_dup | \
6401-
Force_rxflow_en | \
6402-
Force_txflow_en | \
6403-
Cxpl_dbg_sel | \
6404-
ASF | \
6405-
PktCntrDisable | \
6406-
Mac_dbgo_sel)
6407-
64086387
static void rtl_hw_start_8102e_1(struct rtl8169_private *tp)
64096388
{
64106389
static const struct ephy_info e_info_8102e_1[] = {
@@ -6544,7 +6523,7 @@ static void rtl_hw_start_8101(struct rtl8169_private *tp)
65446523

65456524
rtl_set_rx_max_size(tp);
65466525

6547-
tp->cp_cmd &= ~R810X_CPCMD_QUIRK_MASK;
6526+
tp->cp_cmd &= CPCMD_QUIRK_MASK;
65486527
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
65496528

65506529
rtl_set_rx_tx_desc_registers(tp);

0 commit comments

Comments
 (0)