The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] e1000: drop dead switch statements in configure_tx/rx
@ 2026-07-29  8:01 Seongjun Hong
  2026-07-29 10:07 ` Jagielski, Jedrzej
  0 siblings, 1 reply; 5+ messages in thread
From: Seongjun Hong @ 2026-07-29  8:01 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Seongjun Hong, intel-wired-lan, netdev, linux-kernel

remove unnecessary branch

Signed-off-by: Seongjun Hong <hsj0512@snu.ac.kr>
---
 drivers/net/ethernet/intel/e1000/e1000_main.c | 55 ++++++++-----------
 1 file changed, 22 insertions(+), 33 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 9b09eb144b81..5d67d61ebfee 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -1599,24 +1599,18 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
 	u32 ipgr1, ipgr2;
 
 	/* Setup the HW Tx Head and Tail descriptor pointers */
-
-	switch (adapter->num_tx_queues) {
-	case 1:
-	default:
-		tdba = adapter->tx_ring[0].dma;
-		tdlen = adapter->tx_ring[0].count *
-			sizeof(struct e1000_tx_desc);
-		ew32(TDLEN, tdlen);
-		ew32(TDBAH, (tdba >> 32));
-		ew32(TDBAL, (tdba & 0x00000000ffffffffULL));
-		ew32(TDT, 0);
-		ew32(TDH, 0);
-		adapter->tx_ring[0].tdh = ((hw->mac_type >= e1000_82543) ?
-					   E1000_TDH : E1000_82542_TDH);
-		adapter->tx_ring[0].tdt = ((hw->mac_type >= e1000_82543) ?
-					   E1000_TDT : E1000_82542_TDT);
-		break;
-	}
+	tdba = adapter->tx_ring[0].dma;
+	tdlen = adapter->tx_ring[0].count *
+		sizeof(struct e1000_tx_desc);
+	ew32(TDLEN, tdlen);
+	ew32(TDBAH, (tdba >> 32));
+	ew32(TDBAL, (tdba & 0x00000000ffffffffULL));
+	ew32(TDT, 0);
+	ew32(TDH, 0);
+	adapter->tx_ring[0].tdh = ((hw->mac_type >= e1000_82543) ?
+					E1000_TDH : E1000_82542_TDH);
+	adapter->tx_ring[0].tdt = ((hw->mac_type >= e1000_82543) ?
+					E1000_TDT : E1000_82542_TDT);
 
 	/* Set the default values for the Tx Inter Packet Gap timer */
 	if ((hw->media_type == e1000_media_type_fiber ||
@@ -1884,21 +1878,16 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
 	/* Setup the HW Rx Head and Tail Descriptor Pointers and
 	 * the Base and Length of the Rx Descriptor Ring
 	 */
-	switch (adapter->num_rx_queues) {
-	case 1:
-	default:
-		rdba = adapter->rx_ring[0].dma;
-		ew32(RDLEN, rdlen);
-		ew32(RDBAH, (rdba >> 32));
-		ew32(RDBAL, (rdba & 0x00000000ffffffffULL));
-		ew32(RDT, 0);
-		ew32(RDH, 0);
-		adapter->rx_ring[0].rdh = ((hw->mac_type >= e1000_82543) ?
-					   E1000_RDH : E1000_82542_RDH);
-		adapter->rx_ring[0].rdt = ((hw->mac_type >= e1000_82543) ?
-					   E1000_RDT : E1000_82542_RDT);
-		break;
-	}
+	rdba = adapter->rx_ring[0].dma;
+	ew32(RDLEN, rdlen);
+	ew32(RDBAH, (rdba >> 32));
+	ew32(RDBAL, (rdba & 0x00000000ffffffffULL));
+	ew32(RDT, 0);
+	ew32(RDH, 0);
+	adapter->rx_ring[0].rdh = ((hw->mac_type >= e1000_82543) ?
+					E1000_RDH : E1000_82542_RDH);
+	adapter->rx_ring[0].rdt = ((hw->mac_type >= e1000_82543) ?
+					E1000_RDT : E1000_82542_RDT);
 
 	/* Enable 82543 Receive Checksum Offload for TCP and UDP */
 	if (hw->mac_type >= e1000_82543) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] e1000: drop dead switch statements in configure_tx/rx
  2026-07-29  8:01 [PATCH] e1000: drop dead switch statements in configure_tx/rx Seongjun Hong
@ 2026-07-29 10:07 ` Jagielski, Jedrzej
  2026-07-29 14:51   ` ­홍성준
  2026-07-29 15:00   ` Andrew Lunn
  0 siblings, 2 replies; 5+ messages in thread
From: Jagielski, Jedrzej @ 2026-07-29 10:07 UTC (permalink / raw)
  To: Seongjun Hong, Nguyen, Anthony L, Kitszel, Przemyslaw,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org

From: Seongjun Hong <hsj0512@snu.ac.kr> 
Sent: Wednesday, July 29, 2026 10:01 AM

>remove unnecessary branch

Hi Seongjun

First of all commit msg definitely needs to be extended. At least
start with capital letter, finish with dot etc

Once sending to netdev please also point target tree in commit title;
net-next for this case.

I see the point, but as the code is quite old and its extensive development
period passed long time ago, i believe value of such cosmetic patches is
rather questionable.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] e1000: drop dead switch statements in configure_tx/rx
  2026-07-29 10:07 ` Jagielski, Jedrzej
@ 2026-07-29 14:51   ` ­홍성준
  2026-07-29 15:00   ` Andrew Lunn
  1 sibling, 0 replies; 5+ messages in thread
From: ­홍성준 @ 2026-07-29 14:51 UTC (permalink / raw)
  To: Jedrzej Jagielski
  Cc: Anthony L Nguyen, Przemyslaw Kitszel, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Abeni Paolo,
	intel-wired-lan, netdev, linux-kernel

Thanks, then let us keep the switch statements.

> On Jul 29, 2026, at 19:07, Jagielski, Jedrzej <jedrzej.jagielski@intel.com> wrote:
> 
> From: Seongjun Hong <hsj0512@snu.ac.kr>
> Sent: Wednesday, July 29, 2026 10:01 AM
> 
>> remove unnecessary branch
> 
> Hi Seongjun
> 
> First of all commit msg definitely needs to be extended. At least
> start with capital letter, finish with dot etc
> 
> Once sending to netdev please also point target tree in commit title;
> net-next for this case.
> 
> I see the point, but as the code is quite old and its extensive development
> period passed long time ago, i believe value of such cosmetic patches is
> rather questionable.
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] e1000: drop dead switch statements in configure_tx/rx
  2026-07-29 10:07 ` Jagielski, Jedrzej
  2026-07-29 14:51   ` ­홍성준
@ 2026-07-29 15:00   ` Andrew Lunn
  2026-07-30 21:08     ` Tony Nguyen
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2026-07-29 15:00 UTC (permalink / raw)
  To: Jagielski, Jedrzej
  Cc: Seongjun Hong, Nguyen, Anthony L, Kitszel, Przemyslaw,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org

> I see the point, but as the code is quite old and its extensive development
> period passed long time ago, i believe value of such cosmetic patches is
> rather questionable.

It might be worth looking at the history of this code and see why it
is this way. Sometimes odd code like this is actually a bug of some
sort, maybe a merge conflict resolution which want wrong.

      Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] e1000: drop dead switch statements in configure_tx/rx
  2026-07-29 15:00   ` Andrew Lunn
@ 2026-07-30 21:08     ` Tony Nguyen
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Nguyen @ 2026-07-30 21:08 UTC (permalink / raw)
  To: Andrew Lunn, Jagielski, Jedrzej
  Cc: Seongjun Hong, Kitszel, Przemyslaw, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org



On 7/29/2026 8:00 AM, Andrew Lunn wrote:
>> I see the point, but as the code is quite old and its extensive development
>> period passed long time ago, i believe value of such cosmetic patches is
>> rather questionable.
> 
> It might be worth looking at the history of this code and see why it
> is this way. Sometimes odd code like this is actually a bug of some
> sort, maybe a merge conflict resolution which want wrong.

Looks like this was introduced with 24025e4ecf88 ("e1000: implementation 
of the multi-queue feature") and the multiqueue portion was removed with
c1605eb37aa6 ("e1000: Remove Multiqueue code until we have support for 
MSI-X in our hardware"). I think it was intentional but probably an 
oversight that this only left one path after the multiqueue removal.

Thanks,
Tony

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-30 21:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29  8:01 [PATCH] e1000: drop dead switch statements in configure_tx/rx Seongjun Hong
2026-07-29 10:07 ` Jagielski, Jedrzej
2026-07-29 14:51   ` ­홍성준
2026-07-29 15:00   ` Andrew Lunn
2026-07-30 21:08     ` Tony Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox