提交 7e8572b6 编写于 作者: V Vladimir Oltean 提交者: sanglipeng

net: enetc: cache accesses to &priv->si->hw

stable inclusion
from stable-v5.10.157
commit de4dd4f9b3f648e07a2c3cc7115b655e02ac3672
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7MU59

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=de4dd4f9b3f648e07a2c3cc7115b655e02ac3672

--------------------------------

[ Upstream commit 715bf261 ]

The &priv->si->hw construct dereferences 2 pointers and makes lines
longer than they need to be, in turn making the code harder to read.

Replace &priv->si->hw accesses with a "hw" variable when there are 2 or
more accesses within a function that dereference this. This includes
loops, since &priv->si->hw is a loop invariant.
Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
Stable-dep-of: 290b5fe0 ("net: enetc: preserve TX ring priority across reconfiguration")
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 a2658f35
...@@ -1272,13 +1272,14 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring) ...@@ -1272,13 +1272,14 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring)
static void enetc_setup_bdrs(struct enetc_ndev_priv *priv) static void enetc_setup_bdrs(struct enetc_ndev_priv *priv)
{ {
struct enetc_hw *hw = &priv->si->hw;
int i; int i;
for (i = 0; i < priv->num_tx_rings; i++) for (i = 0; i < priv->num_tx_rings; i++)
enetc_setup_txbdr(&priv->si->hw, priv->tx_ring[i]); enetc_setup_txbdr(hw, priv->tx_ring[i]);
for (i = 0; i < priv->num_rx_rings; i++) for (i = 0; i < priv->num_rx_rings; i++)
enetc_setup_rxbdr(&priv->si->hw, priv->rx_ring[i]); enetc_setup_rxbdr(hw, priv->rx_ring[i]);
} }
static void enetc_clear_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring) static void enetc_clear_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring)
...@@ -1311,13 +1312,14 @@ static void enetc_clear_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring) ...@@ -1311,13 +1312,14 @@ static void enetc_clear_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring)
static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) static void enetc_clear_bdrs(struct enetc_ndev_priv *priv)
{ {
struct enetc_hw *hw = &priv->si->hw;
int i; int i;
for (i = 0; i < priv->num_tx_rings; i++) for (i = 0; i < priv->num_tx_rings; i++)
enetc_clear_txbdr(&priv->si->hw, priv->tx_ring[i]); enetc_clear_txbdr(hw, priv->tx_ring[i]);
for (i = 0; i < priv->num_rx_rings; i++) for (i = 0; i < priv->num_rx_rings; i++)
enetc_clear_rxbdr(&priv->si->hw, priv->rx_ring[i]); enetc_clear_rxbdr(hw, priv->rx_ring[i]);
udelay(1); udelay(1);
} }
...@@ -1325,13 +1327,13 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) ...@@ -1325,13 +1327,13 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv)
static int enetc_setup_irqs(struct enetc_ndev_priv *priv) static int enetc_setup_irqs(struct enetc_ndev_priv *priv)
{ {
struct pci_dev *pdev = priv->si->pdev; struct pci_dev *pdev = priv->si->pdev;
struct enetc_hw *hw = &priv->si->hw;
int i, j, err; int i, j, err;
for (i = 0; i < priv->bdr_int_num; i++) { for (i = 0; i < priv->bdr_int_num; i++) {
int irq = pci_irq_vector(pdev, ENETC_BDR_INT_BASE_IDX + i); int irq = pci_irq_vector(pdev, ENETC_BDR_INT_BASE_IDX + i);
struct enetc_int_vector *v = priv->int_vector[i]; struct enetc_int_vector *v = priv->int_vector[i];
int entry = ENETC_BDR_INT_BASE_IDX + i; int entry = ENETC_BDR_INT_BASE_IDX + i;
struct enetc_hw *hw = &priv->si->hw;
snprintf(v->name, sizeof(v->name), "%s-rxtx%d", snprintf(v->name, sizeof(v->name), "%s-rxtx%d",
priv->ndev->name, i); priv->ndev->name, i);
...@@ -1419,13 +1421,14 @@ static void enetc_setup_interrupts(struct enetc_ndev_priv *priv) ...@@ -1419,13 +1421,14 @@ static void enetc_setup_interrupts(struct enetc_ndev_priv *priv)
static void enetc_clear_interrupts(struct enetc_ndev_priv *priv) static void enetc_clear_interrupts(struct enetc_ndev_priv *priv)
{ {
struct enetc_hw *hw = &priv->si->hw;
int i; int i;
for (i = 0; i < priv->num_tx_rings; i++) for (i = 0; i < priv->num_tx_rings; i++)
enetc_txbdr_wr(&priv->si->hw, i, ENETC_TBIER, 0); enetc_txbdr_wr(hw, i, ENETC_TBIER, 0);
for (i = 0; i < priv->num_rx_rings; i++) for (i = 0; i < priv->num_rx_rings; i++)
enetc_rxbdr_wr(&priv->si->hw, i, ENETC_RBIER, 0); enetc_rxbdr_wr(hw, i, ENETC_RBIER, 0);
} }
static int enetc_phylink_connect(struct net_device *ndev) static int enetc_phylink_connect(struct net_device *ndev)
...@@ -1565,6 +1568,7 @@ static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) ...@@ -1565,6 +1568,7 @@ static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
{ {
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct tc_mqprio_qopt *mqprio = type_data; struct tc_mqprio_qopt *mqprio = type_data;
struct enetc_hw *hw = &priv->si->hw;
struct enetc_bdr *tx_ring; struct enetc_bdr *tx_ring;
u8 num_tc; u8 num_tc;
int i; int i;
...@@ -1579,7 +1583,7 @@ static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) ...@@ -1579,7 +1583,7 @@ static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
/* Reset all ring priorities to 0 */ /* Reset all ring priorities to 0 */
for (i = 0; i < priv->num_tx_rings; i++) { for (i = 0; i < priv->num_tx_rings; i++) {
tx_ring = priv->tx_ring[i]; tx_ring = priv->tx_ring[i];
enetc_set_bdr_prio(&priv->si->hw, tx_ring->index, 0); enetc_set_bdr_prio(hw, tx_ring->index, 0);
} }
return 0; return 0;
...@@ -1598,7 +1602,7 @@ static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) ...@@ -1598,7 +1602,7 @@ static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
*/ */
for (i = 0; i < num_tc; i++) { for (i = 0; i < num_tc; i++) {
tx_ring = priv->tx_ring[i]; tx_ring = priv->tx_ring[i];
enetc_set_bdr_prio(&priv->si->hw, tx_ring->index, i); enetc_set_bdr_prio(hw, tx_ring->index, i);
} }
/* Reset the number of netdev queues based on the TC count */ /* Reset the number of netdev queues based on the TC count */
...@@ -1679,19 +1683,21 @@ static int enetc_set_rss(struct net_device *ndev, int en) ...@@ -1679,19 +1683,21 @@ static int enetc_set_rss(struct net_device *ndev, int en)
static void enetc_enable_rxvlan(struct net_device *ndev, bool en) static void enetc_enable_rxvlan(struct net_device *ndev, bool en)
{ {
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_hw *hw = &priv->si->hw;
int i; int i;
for (i = 0; i < priv->num_rx_rings; i++) for (i = 0; i < priv->num_rx_rings; i++)
enetc_bdr_enable_rxvlan(&priv->si->hw, i, en); enetc_bdr_enable_rxvlan(hw, i, en);
} }
static void enetc_enable_txvlan(struct net_device *ndev, bool en) static void enetc_enable_txvlan(struct net_device *ndev, bool en)
{ {
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_hw *hw = &priv->si->hw;
int i; int i;
for (i = 0; i < priv->num_tx_rings; i++) for (i = 0; i < priv->num_tx_rings; i++)
enetc_bdr_enable_txvlan(&priv->si->hw, i, en); enetc_bdr_enable_txvlan(hw, i, en);
} }
void enetc_set_features(struct net_device *ndev, netdev_features_t features) void enetc_set_features(struct net_device *ndev, netdev_features_t features)
......
...@@ -338,19 +338,20 @@ int enetc_set_psfp(struct net_device *ndev, bool en); ...@@ -338,19 +338,20 @@ int enetc_set_psfp(struct net_device *ndev, bool en);
static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv) static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv)
{ {
struct enetc_hw *hw = &priv->si->hw;
u32 reg; u32 reg;
reg = enetc_port_rd(&priv->si->hw, ENETC_PSIDCAPR); reg = enetc_port_rd(hw, ENETC_PSIDCAPR);
priv->psfp_cap.max_streamid = reg & ENETC_PSIDCAPR_MSK; priv->psfp_cap.max_streamid = reg & ENETC_PSIDCAPR_MSK;
/* Port stream filter capability */ /* Port stream filter capability */
reg = enetc_port_rd(&priv->si->hw, ENETC_PSFCAPR); reg = enetc_port_rd(hw, ENETC_PSFCAPR);
priv->psfp_cap.max_psfp_filter = reg & ENETC_PSFCAPR_MSK; priv->psfp_cap.max_psfp_filter = reg & ENETC_PSFCAPR_MSK;
/* Port stream gate capability */ /* Port stream gate capability */
reg = enetc_port_rd(&priv->si->hw, ENETC_PSGCAPR); reg = enetc_port_rd(hw, ENETC_PSGCAPR);
priv->psfp_cap.max_psfp_gate = (reg & ENETC_PSGCAPR_SGIT_MSK); priv->psfp_cap.max_psfp_gate = (reg & ENETC_PSGCAPR_SGIT_MSK);
priv->psfp_cap.max_psfp_gatelist = (reg & ENETC_PSGCAPR_GCL_MSK) >> 16; priv->psfp_cap.max_psfp_gatelist = (reg & ENETC_PSGCAPR_GCL_MSK) >> 16;
/* Port flow meter capability */ /* Port flow meter capability */
reg = enetc_port_rd(&priv->si->hw, ENETC_PFMCAPR); reg = enetc_port_rd(hw, ENETC_PFMCAPR);
priv->psfp_cap.max_psfp_meter = reg & ENETC_PFMCAPR_MSK; priv->psfp_cap.max_psfp_meter = reg & ENETC_PFMCAPR_MSK;
} }
......
...@@ -17,8 +17,9 @@ static u16 enetc_get_max_gcl_len(struct enetc_hw *hw) ...@@ -17,8 +17,9 @@ static u16 enetc_get_max_gcl_len(struct enetc_hw *hw)
void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed) void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed)
{ {
struct enetc_hw *hw = &priv->si->hw;
u32 old_speed = priv->speed; u32 old_speed = priv->speed;
u32 pspeed; u32 pspeed, tmp;
if (speed == old_speed) if (speed == old_speed)
return; return;
...@@ -39,16 +40,15 @@ void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed) ...@@ -39,16 +40,15 @@ void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed)
} }
priv->speed = speed; priv->speed = speed;
enetc_port_wr(&priv->si->hw, ENETC_PMR, tmp = enetc_port_rd(hw, ENETC_PMR);
(enetc_port_rd(&priv->si->hw, ENETC_PMR) enetc_port_wr(hw, ENETC_PMR, (tmp & ~ENETC_PMR_PSPEED_MASK) | pspeed);
& (~ENETC_PMR_PSPEED_MASK))
| pspeed);
} }
static int enetc_setup_taprio(struct net_device *ndev, static int enetc_setup_taprio(struct net_device *ndev,
struct tc_taprio_qopt_offload *admin_conf) struct tc_taprio_qopt_offload *admin_conf)
{ {
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_hw *hw = &priv->si->hw;
struct enetc_cbd cbd = {.cmd = 0}; struct enetc_cbd cbd = {.cmd = 0};
struct tgs_gcl_conf *gcl_config; struct tgs_gcl_conf *gcl_config;
struct tgs_gcl_data *gcl_data; struct tgs_gcl_data *gcl_data;
...@@ -60,15 +60,13 @@ static int enetc_setup_taprio(struct net_device *ndev, ...@@ -60,15 +60,13 @@ static int enetc_setup_taprio(struct net_device *ndev,
int err; int err;
int i; int i;
if (admin_conf->num_entries > enetc_get_max_gcl_len(&priv->si->hw)) if (admin_conf->num_entries > enetc_get_max_gcl_len(hw))
return -EINVAL; return -EINVAL;
gcl_len = admin_conf->num_entries; gcl_len = admin_conf->num_entries;
tge = enetc_rd(&priv->si->hw, ENETC_QBV_PTGCR_OFFSET); tge = enetc_rd(hw, ENETC_QBV_PTGCR_OFFSET);
if (!admin_conf->enable) { if (!admin_conf->enable) {
enetc_wr(&priv->si->hw, enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge & ~ENETC_QBV_TGE);
ENETC_QBV_PTGCR_OFFSET,
tge & (~ENETC_QBV_TGE));
priv->active_offloads &= ~ENETC_F_QBV; priv->active_offloads &= ~ENETC_F_QBV;
...@@ -126,14 +124,11 @@ static int enetc_setup_taprio(struct net_device *ndev, ...@@ -126,14 +124,11 @@ static int enetc_setup_taprio(struct net_device *ndev,
cbd.cls = BDCR_CMD_PORT_GCL; cbd.cls = BDCR_CMD_PORT_GCL;
cbd.status_flags = 0; cbd.status_flags = 0;
enetc_wr(&priv->si->hw, ENETC_QBV_PTGCR_OFFSET, enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge | ENETC_QBV_TGE);
tge | ENETC_QBV_TGE);
err = enetc_send_cmd(priv->si, &cbd); err = enetc_send_cmd(priv->si, &cbd);
if (err) if (err)
enetc_wr(&priv->si->hw, enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge & ~ENETC_QBV_TGE);
ENETC_QBV_PTGCR_OFFSET,
tge & (~ENETC_QBV_TGE));
dma_unmap_single(&priv->si->pdev->dev, dma, data_size, DMA_TO_DEVICE); dma_unmap_single(&priv->si->pdev->dev, dma, data_size, DMA_TO_DEVICE);
kfree(gcl_data); kfree(gcl_data);
...@@ -148,6 +143,7 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data) ...@@ -148,6 +143,7 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)
{ {
struct tc_taprio_qopt_offload *taprio = type_data; struct tc_taprio_qopt_offload *taprio = type_data;
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_hw *hw = &priv->si->hw;
int err; int err;
int i; int i;
...@@ -157,16 +153,14 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data) ...@@ -157,16 +153,14 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)
return -EBUSY; return -EBUSY;
for (i = 0; i < priv->num_tx_rings; i++) for (i = 0; i < priv->num_tx_rings; i++)
enetc_set_bdr_prio(&priv->si->hw, enetc_set_bdr_prio(hw, priv->tx_ring[i]->index,
priv->tx_ring[i]->index,
taprio->enable ? i : 0); taprio->enable ? i : 0);
err = enetc_setup_taprio(ndev, taprio); err = enetc_setup_taprio(ndev, taprio);
if (err) if (err)
for (i = 0; i < priv->num_tx_rings; i++) for (i = 0; i < priv->num_tx_rings; i++)
enetc_set_bdr_prio(&priv->si->hw, enetc_set_bdr_prio(hw, priv->tx_ring[i]->index,
priv->tx_ring[i]->index,
taprio->enable ? 0 : i); taprio->enable ? 0 : i);
return err; return err;
...@@ -188,7 +182,7 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) ...@@ -188,7 +182,7 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data)
struct tc_cbs_qopt_offload *cbs = type_data; struct tc_cbs_qopt_offload *cbs = type_data;
u32 port_transmit_rate = priv->speed; u32 port_transmit_rate = priv->speed;
u8 tc_nums = netdev_get_num_tc(ndev); u8 tc_nums = netdev_get_num_tc(ndev);
struct enetc_si *si = priv->si; struct enetc_hw *hw = &priv->si->hw;
u32 hi_credit_bit, hi_credit_reg; u32 hi_credit_bit, hi_credit_reg;
u32 max_interference_size; u32 max_interference_size;
u32 port_frame_max_size; u32 port_frame_max_size;
...@@ -209,15 +203,15 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) ...@@ -209,15 +203,15 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data)
* lower than this TC have been disabled. * lower than this TC have been disabled.
*/ */
if (tc == prio_top && if (tc == prio_top &&
enetc_get_cbs_enable(&si->hw, prio_next)) { enetc_get_cbs_enable(hw, prio_next)) {
dev_err(&ndev->dev, dev_err(&ndev->dev,
"Disable TC%d before disable TC%d\n", "Disable TC%d before disable TC%d\n",
prio_next, tc); prio_next, tc);
return -EINVAL; return -EINVAL;
} }
enetc_port_wr(&si->hw, ENETC_PTCCBSR1(tc), 0); enetc_port_wr(hw, ENETC_PTCCBSR1(tc), 0);
enetc_port_wr(&si->hw, ENETC_PTCCBSR0(tc), 0); enetc_port_wr(hw, ENETC_PTCCBSR0(tc), 0);
return 0; return 0;
} }
...@@ -234,13 +228,13 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) ...@@ -234,13 +228,13 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data)
* higher than this TC have been enabled. * higher than this TC have been enabled.
*/ */
if (tc == prio_next) { if (tc == prio_next) {
if (!enetc_get_cbs_enable(&si->hw, prio_top)) { if (!enetc_get_cbs_enable(hw, prio_top)) {
dev_err(&ndev->dev, dev_err(&ndev->dev,
"Enable TC%d first before enable TC%d\n", "Enable TC%d first before enable TC%d\n",
prio_top, prio_next); prio_top, prio_next);
return -EINVAL; return -EINVAL;
} }
bw_sum += enetc_get_cbs_bw(&si->hw, prio_top); bw_sum += enetc_get_cbs_bw(hw, prio_top);
} }
if (bw_sum + bw >= 100) { if (bw_sum + bw >= 100) {
...@@ -249,7 +243,7 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) ...@@ -249,7 +243,7 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data)
return -EINVAL; return -EINVAL;
} }
enetc_port_rd(&si->hw, ENETC_PTCMSDUR(tc)); enetc_port_rd(hw, ENETC_PTCMSDUR(tc));
/* For top prio TC, the max_interfrence_size is maxSizedFrame. /* For top prio TC, the max_interfrence_size is maxSizedFrame.
* *
...@@ -269,8 +263,8 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) ...@@ -269,8 +263,8 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data)
u32 m0, ma, r0, ra; u32 m0, ma, r0, ra;
m0 = port_frame_max_size * 8; m0 = port_frame_max_size * 8;
ma = enetc_port_rd(&si->hw, ENETC_PTCMSDUR(prio_top)) * 8; ma = enetc_port_rd(hw, ENETC_PTCMSDUR(prio_top)) * 8;
ra = enetc_get_cbs_bw(&si->hw, prio_top) * ra = enetc_get_cbs_bw(hw, prio_top) *
port_transmit_rate * 10000ULL; port_transmit_rate * 10000ULL;
r0 = port_transmit_rate * 1000000ULL; r0 = port_transmit_rate * 1000000ULL;
max_interference_size = m0 + ma + max_interference_size = m0 + ma +
...@@ -290,10 +284,10 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) ...@@ -290,10 +284,10 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data)
hi_credit_reg = (u32)div_u64((ENETC_CLK * 100ULL) * hi_credit_bit, hi_credit_reg = (u32)div_u64((ENETC_CLK * 100ULL) * hi_credit_bit,
port_transmit_rate * 1000000ULL); port_transmit_rate * 1000000ULL);
enetc_port_wr(&si->hw, ENETC_PTCCBSR1(tc), hi_credit_reg); enetc_port_wr(hw, ENETC_PTCCBSR1(tc), hi_credit_reg);
/* Set bw register and enable this traffic class */ /* Set bw register and enable this traffic class */
enetc_port_wr(&si->hw, ENETC_PTCCBSR0(tc), bw | ENETC_CBSE); enetc_port_wr(hw, ENETC_PTCCBSR0(tc), bw | ENETC_CBSE);
return 0; return 0;
} }
...@@ -303,6 +297,7 @@ int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data) ...@@ -303,6 +297,7 @@ int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data)
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct tc_etf_qopt_offload *qopt = type_data; struct tc_etf_qopt_offload *qopt = type_data;
u8 tc_nums = netdev_get_num_tc(ndev); u8 tc_nums = netdev_get_num_tc(ndev);
struct enetc_hw *hw = &priv->si->hw;
int tc; int tc;
if (!tc_nums) if (!tc_nums)
...@@ -318,12 +313,11 @@ int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data) ...@@ -318,12 +313,11 @@ int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data)
return -EBUSY; return -EBUSY;
/* TSD and Qbv are mutually exclusive in hardware */ /* TSD and Qbv are mutually exclusive in hardware */
if (enetc_rd(&priv->si->hw, ENETC_QBV_PTGCR_OFFSET) & ENETC_QBV_TGE) if (enetc_rd(hw, ENETC_QBV_PTGCR_OFFSET) & ENETC_QBV_TGE)
return -EBUSY; return -EBUSY;
priv->tx_ring[tc]->tsd_enable = qopt->enable; priv->tx_ring[tc]->tsd_enable = qopt->enable;
enetc_port_wr(&priv->si->hw, ENETC_PTCTSDR(tc), enetc_port_wr(hw, ENETC_PTCTSDR(tc), qopt->enable ? ENETC_TSDE : 0);
qopt->enable ? ENETC_TSDE : 0);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册