Skip to contentSkip to conversation

atl1c: optimize rx loop

PATCH In review Sieng Piaw Liew 2 participants 3 messages Mar 19, 2021 – Mar 22, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atl1c: optimize rx loop

Remove this trivial bit of inefficiency from the rx receive loop, results in increase of a few Mbps in iperf3. Tested on Intel Core2 platform.

---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +1 -3
index 3f65f2b370c5..b995f9a0479c 100644
@@ -1796,9 +1796,7 @@ static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter,
 	struct atl1c_recv_ret_status *rrs;
 	struct atl1c_buffer *buffer_info;
 
-	while (1) {
-		if (*work_done >= work_to_do)
-			break;
+	while (*work_done < work_to_do) {
 		rrs = ATL1C_RRD_DESC(rrd_ring, rrd_ring->next_to_clean);
 		if (likely(RRS_RXD_IS_VALID(rrs->word3))) {
 			rfd_num = (rrs->word0 >> RRS_RX_RFD_CNT_SHIFT) &
Signature · 1 line
2.17.1
#1 lore raw
Quoted 14 lines · Sieng Piaw Liew

Remove this trivial bit of inefficiency from the rx receive loop, results in increase of a few Mbps in iperf3. Tested on Intel Core2 platform.

---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +0 -0
index 3f65f2b370c5..b995f9a0479c 100644

drivers/net/ethernet/atheros/atl1c/atl1c_main.c static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, · line 1799

Quoted 7 lines
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +1 -3
@@ -1796,9 +1796,7 @@ static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter,
 	struct atl1c_recv_ret_status *rrs;
 	struct atl1c_buffer *buffer_info;
 
-	while (1) {
-		if (*work_done >= work_to_do)
-			break;
+	while (*work_done < work_to_do) {

It should not change anything, or only based on the compiler's optimization and should not result in a measurable difference because what it does is exactly the same. Have you really compared the compiled output code to explain the difference ? I strongly suspect you'll find no difference at all.

Thus for me it's certainly not an optimization, it could be qualified as a cleanup to improve code readability however.

Willy

#2 lore raw
Quoted 29 lines · Willy Tarreau
Quoted 14 lines · Sieng Piaw Liew

Remove this trivial bit of inefficiency from the rx receive loop, results in increase of a few Mbps in iperf3. Tested on Intel Core2 platform.

---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +0 -0
index 3f65f2b370c5..b995f9a0479c 100644

drivers/net/ethernet/atheros/atl1c/atl1c_main.c static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, · line 1799

Quoted 7 lines
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +1 -3
@@ -1796,9 +1796,7 @@ static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter,
 	struct atl1c_recv_ret_status *rrs;
 	struct atl1c_buffer *buffer_info;
 
-	while (1) {
-		if (*work_done >= work_to_do)
-			break;
+	while (*work_done < work_to_do) {

It should not change anything, or only based on the compiler's optimization and should not result in a measurable difference because what it does is exactly the same. Have you really compared the compiled output code to explain the difference ? I strongly suspect you'll find no difference at all.

Quoted 4 lines

Thus for me it's certainly not an optimization, it could be qualified as a cleanup to improve code readability however.

Willy

You're right. Objdump and diff showed no difference.

Regards,
Sieng Piaw