Skip to content

Commit 0dcc144

Browse files
baileyforrestdavem330
authored andcommitted
gve: DQO: Configure interrupts on device up
When interrupts are first enabled, we also set the ratelimits, which will be static for the entire usage of the device. Signed-off-by: Bailey Forrest <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Reviewed-by: Catherine Sullivan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9c1a59a commit 0dcc144

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

drivers/net/ethernet/google/gve/gve_dqo.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#define GVE_ITR_CLEAR_PBA_BIT_DQO BIT(1)
1414
#define GVE_ITR_NO_UPDATE_DQO (3 << 3)
1515

16+
#define GVE_ITR_INTERVAL_DQO_SHIFT 5
17+
#define GVE_ITR_INTERVAL_DQO_MASK ((1 << 12) - 1)
18+
1619
#define GVE_TX_IRQ_RATELIMIT_US_DQO 50
1720
#define GVE_RX_IRQ_RATELIMIT_US_DQO 20
1821

@@ -38,6 +41,22 @@ gve_tx_put_doorbell_dqo(const struct gve_priv *priv,
3841
iowrite32(val, &priv->db_bar2[index]);
3942
}
4043

44+
/* Builds register value to write to DQO IRQ doorbell to enable with specified
45+
* ratelimit.
46+
*/
47+
static inline u32 gve_set_itr_ratelimit_dqo(u32 ratelimit_us)
48+
{
49+
u32 result = GVE_ITR_ENABLE_BIT_DQO;
50+
51+
/* Interval has 2us granularity. */
52+
ratelimit_us >>= 1;
53+
54+
ratelimit_us &= GVE_ITR_INTERVAL_DQO_MASK;
55+
result |= (ratelimit_us << GVE_ITR_INTERVAL_DQO_SHIFT);
56+
57+
return result;
58+
}
59+
4160
static inline void
4261
gve_write_irq_doorbell_dqo(const struct gve_priv *priv,
4362
const struct gve_notify_block *block, u32 val)

drivers/net/ethernet/google/gve/gve_main.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,14 +1077,26 @@ static void gve_turnup(struct gve_priv *priv)
10771077
struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx];
10781078

10791079
napi_enable(&block->napi);
1080-
iowrite32be(0, gve_irq_doorbell(priv, block));
1080+
if (gve_is_gqi(priv)) {
1081+
iowrite32be(0, gve_irq_doorbell(priv, block));
1082+
} else {
1083+
u32 val = gve_set_itr_ratelimit_dqo(GVE_TX_IRQ_RATELIMIT_US_DQO);
1084+
1085+
gve_write_irq_doorbell_dqo(priv, block, val);
1086+
}
10811087
}
10821088
for (idx = 0; idx < priv->rx_cfg.num_queues; idx++) {
10831089
int ntfy_idx = gve_rx_idx_to_ntfy(priv, idx);
10841090
struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx];
10851091

10861092
napi_enable(&block->napi);
1087-
iowrite32be(0, gve_irq_doorbell(priv, block));
1093+
if (gve_is_gqi(priv)) {
1094+
iowrite32be(0, gve_irq_doorbell(priv, block));
1095+
} else {
1096+
u32 val = gve_set_itr_ratelimit_dqo(GVE_RX_IRQ_RATELIMIT_US_DQO);
1097+
1098+
gve_write_irq_doorbell_dqo(priv, block, val);
1099+
}
10881100
}
10891101

10901102
gve_set_napi_enabled(priv);

0 commit comments

Comments
 (0)