Skip to content

Commit 5cff9d1

Browse files
Sean Andersonkuba-moo
authored andcommitted
net: xilinx: axienet: Add some symbolic constants for IRQ delay timer
Instead of using literals, add some symbolic constants for the IRQ delay timer calculation. Signed-off-by: Sean Anderson <[email protected]> Reviewed by: Shannon Nelson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a26892e commit 5cff9d1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

drivers/net/ethernet/xilinx/xilinx_axienet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
#define XAXIDMA_IRQ_ERROR_MASK 0x00004000 /* Error interrupt */
121121
#define XAXIDMA_IRQ_ALL_MASK 0x00007000 /* All interrupts */
122122

123+
/* Constant to convert delay counts to microseconds */
124+
#define XAXIDMA_DELAY_SCALE (125ULL * USEC_PER_SEC)
125+
123126
/* Default TX/RX Threshold and delay timer values for SGDMA mode */
124127
#define XAXIDMA_DFT_TX_THRESHOLD 24
125128
#define XAXIDMA_DFT_TX_USEC 50

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,8 @@ static u32 axienet_usec_to_timer(struct axienet_local *lp, u32 coalesce_usec)
238238

239239
/* 1 Timeout Interval = 125 * (clock period of SG clock) */
240240
result = DIV64_U64_ROUND_CLOSEST((u64)coalesce_usec * clk_rate,
241-
(u64)125000000);
242-
if (result > 255)
243-
result = 255;
244-
245-
return result;
241+
XAXIDMA_DELAY_SCALE);
242+
return min(result, FIELD_MAX(XAXIDMA_DELAY_MASK));
246243
}
247244

248245
/**

0 commit comments

Comments
 (0)