net: e1000: add and make use of NUM_RX_DESC macro
PATCH 1/4 net: e1000: add and make use of NUM_RX_DESC macro
The call to DEFINE_ALIGN_BUFFER for the rx_desc array conained an icnonsistency as 16 receive descriptors were allocated when the remaining code would only use 8 of them.
--- drivers/net/e1000.c | 6 +++--- drivers/net/e1000.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/e1000.c +3 -3
@@ -60,7 +60,7 @@ tested on both gig copper and gig fiber boards* move these buffers and the tx/rx pointers to struct e1000_hw. */ DEFINE_ALIGN_BUFFER(struct e1000_tx_desc, tx_base, 16, E1000_BUFFER_ALIGN); -DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, 16, E1000_BUFFER_ALIGN); +DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, NUM_RX_DESC, E1000_BUFFER_ALIGN); DEFINE_ALIGN_BUFFER(unsigned char, packet, 4096, E1000_BUFFER_ALIGN);static int tx_tail;
@@ -5095,7 +5095,7 @@ fill_rx(struct e1000_hw *hw) rx_last = rx_tail; rd = rx_base + rx_tail; - rx_tail = (rx_tail +1 ) %8 ; + rx_tail = (rx_tail +1 ) %NUM_RX_DESC ;memset (rd,0 ,16 ); rd->buffer_addr =cpu_to_le64 (virt_to_phys (packet));
@@ -5272,7 +5272,7 @@ e1000_configure_rx(struct e1000_hw *hw)E1000_WRITE_REG (hw,RDBAL ,lower_32_bits (virt_to_phys (rx_base)));E1000_WRITE_REG (hw,RDBAH ,upper_32_bits (virt_to_phys (rx_base))); -E1000_WRITE_REG (hw,RDLEN ,128 ); +E1000_WRITE_REG (hw,RDLEN ,NUM_RX_DESC *sizeof (struct e1000_rx_desc ));/* Setup the HW Rx Head and Tail Descriptor Pointers */ E1000_WRITE_REG (hw,RDH ,0 );
drivers/net/e1000.h +2 -0
@@ -42,6 +42,8 @@ #define DEBUGOUT(fmt, args...) do { } while (0)#endif +#define NUM_RX_DESC 8 +/* I/O wrapper functions */ #define E1000_WRITE_REG (a, reg, value) \ writel((value), ((a)->hw_addr + E1000_##reg))
Signature · 1 line
2.39.2
PATCH 2/4 net: e1000: move all rx data structures to hw instance
Preparation for per driver instance allocated data structures.
--- drivers/net/e1000.c | 26 +++++++++++++++----------- drivers/net/e1000.h | 5 +++++ 2 files changed, 20 insertions(+), 11 deletions(-)
drivers/net/e1000.c +15 -11
@@ -61,10 +61,9 @@ tested on both gig copper and gig fiber boards*/ DEFINE_ALIGN_BUFFER(struct e1000_tx_desc, tx_base, 16, E1000_BUFFER_ALIGN); DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, NUM_RX_DESC, E1000_BUFFER_ALIGN); -DEFINE_ALIGN_BUFFER(unsigned char, packet, 4096, E1000_BUFFER_ALIGN); +DEFINE_ALIGN_BUFFER(unsigned char, _packet, 4096, E1000_BUFFER_ALIGN);static int tx_tail; -static int rx_tail, rx_last;static int num_cards;/* Number of E1000 devices seen so far */ static struct pci_device_id e1000_supported[] = {
@@ -5090,12 +5089,13 @@ e1000_sw_init(struct e1000_hw *hw)void fill_rx (struct e1000_hw *hw) { +unsigned char *packet = hw->rx_packet;struct e1000_rx_desc *rd;unsigned long flush_start, flush_end; - rx_last = rx_tail; - rd = rx_base + rx_tail; - rx_tail = (rx_tail +1 ) %NUM_RX_DESC ; + hw->rx_last = hw->rx_tail; + rd = hw->rx_base + hw->rx_tail; + hw->rx_tail = (hw->rx_tail +1 ) %NUM_RX_DESC ;memset (rd,0 ,16 ); rd->buffer_addr =cpu_to_le64 (virt_to_phys (packet));
@@ -5111,7 +5111,7 @@ fill_rx(struct e1000_hw *hw) flush_end = flush_start +roundup (sizeof (*rd),ARCH_DMA_MINALIGN );flush_dcache_range (flush_start, flush_end); -E1000_WRITE_REG (hw,RDT , rx_tail); +E1000_WRITE_REG (hw,RDT , hw->rx_tail); }/**
@@ -5248,7 +5248,7 @@ static void e1000_configure_rx(struct e1000_hw *hw) {unsigned long rctl, ctrl_ext; - rx_tail =0 ; + hw->rx_tail =0 ;/* make sure receives are disabled while setting up the descriptors */ rctl =E1000_READ_REG (hw,RCTL );
@@ -5269,8 +5269,8 @@ e1000_configure_rx(struct e1000_hw *hw)E1000_WRITE_FLUSH (hw); }/* Setup the Base and Length of the Rx Descriptor Ring */ -E1000_WRITE_REG (hw,RDBAL ,lower_32_bits (virt_to_phys (rx_base))); -E1000_WRITE_REG (hw,RDBAH ,upper_32_bits (virt_to_phys (rx_base))); +E1000_WRITE_REG (hw,RDBAL ,lower_32_bits (virt_to_phys (hw->rx_base))); +E1000_WRITE_REG (hw,RDBAH ,upper_32_bits (virt_to_phys (hw->rx_base)));E1000_WRITE_REG (hw,RDLEN ,NUM_RX_DESC *sizeof (struct e1000_rx_desc ));
@@ -5298,12 +5298,13 @@ POLL - Wait for a framestatic int _e1000_poll (struct e1000_hw *hw) { +unsigned char *packet = hw->rx_packet;struct e1000_rx_desc *rd;unsigned long inval_start, inval_end;uint32_t len;/* return true if there's an ethernet packet ready to read */ - rd = rx_base + rx_last; + rd = hw->rx_base + hw->rx_last;/* Re-load the descriptor from RAM. */ inval_start = ((unsigned long )rd) & ~(ARCH_DMA_MINALIGN -1 );
@@ -5469,6 +5470,9 @@ static int e1000_init_one(struct e1000_hw *hw, int cardnum,return -EPERM ; } + hw->rx_base = rx_base; + hw->rx_packet = _packet; +/* Are these variables needed? */ hw->fc = e1000_fc_default; hw->original_fc = e1000_fc_default;
@@ -5663,7 +5667,7 @@ static int e1000_eth_recv(struct udevice *dev, int flags, uchar **packetp) len =_e1000_poll (hw);if (len) - *packetp = packet; + *packetp = hw->rx_packet;return len ? len : -EAGAIN ; }
drivers/net/e1000.h +5 -0
@@ -1134,6 +1134,11 @@ struct e1000_hw {bool initialize_hw_bits_disable;e1000_smart_speed smart_speed;e1000_dsp_config dsp_config_state; + +struct e1000_rx_desc *rx_base; +unsigned char *rx_packet; +int rx_tail; +int rx_last; };#define E1000_EEPROM_SWDPIN0 0x0001/* SWDPIN 0 EEPROM Value */
Signature · 1 line
2.39.2
Re: [PATCH 2/4] net: e1000: move all rx data structures to hw instance
Hi all
Quoted 4 lines
Preparation for per driver instance allocated data structures.
Signed-off-by Christian Gmeiner <[email protected]>
gentle ping - what can I do better to get some feedback, RBs, etc faster? This experience is
quite frustrating and it happens for me from time to time for U-Boot patches :(
Patch 1 of this series got a RB few days ago and the others are still open.
Quoted 120 lines
--- drivers/net/e1000.c | 26 +++++++++++++++----------- drivers/net/e1000.h | 5 +++++ 2 files changed, 20 insertions(+), 11 deletions(-)drivers/net/e1000.c +15
-11@@ -61,10 +61,9 @@ tested on both gig copper and gig fiber boards*/ DEFINE_ALIGN_BUFFER(struct e1000_tx_desc, tx_base, 16, E1000_BUFFER_ALIGN); DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, NUM_RX_DESC, E1000_BUFFER_ALIGN); -DEFINE_ALIGN_BUFFER(unsigned char, packet, 4096, E1000_BUFFER_ALIGN); +DEFINE_ALIGN_BUFFER(unsigned char, _packet, 4096, E1000_BUFFER_ALIGN);static int tx_tail; -static int rx_tail, rx_last;static int num_cards;/* Number of E1000 devices seen so far */ static struct pci_device_id e1000_supported[] = {@@ -5090,12 +5089,13 @@ e1000_sw_init(struct e1000_hw *hw)void fill_rx (struct e1000_hw *hw) { +unsigned char *packet = hw->rx_packet;struct e1000_rx_desc *rd;unsigned long flush_start, flush_end; - rx_last = rx_tail; - rd = rx_base + rx_tail; - rx_tail = (rx_tail +1 ) %NUM_RX_DESC ; + hw->rx_last = hw->rx_tail; + rd = hw->rx_base + hw->rx_tail; + hw->rx_tail = (hw->rx_tail +1 ) %NUM_RX_DESC ;memset (rd,0 ,16 ); rd->buffer_addr =cpu_to_le64 (virt_to_phys (packet));@@ -5111,7 +5111,7 @@ fill_rx(struct e1000_hw *hw) flush_end = flush_start +roundup (sizeof (*rd),ARCH_DMA_MINALIGN );flush_dcache_range (flush_start, flush_end); -E1000_WRITE_REG (hw,RDT , rx_tail); +E1000_WRITE_REG (hw,RDT , hw->rx_tail); }/** @@ -5248,7 +5248,7 @@ static void e1000_configure_rx(struct e1000_hw *hw) {unsigned long rctl, ctrl_ext; - rx_tail =0 ; + hw->rx_tail =0 ;/* make sure receives are disabled while setting up the descriptors */ rctl =E1000_READ_REG (hw,RCTL );@@ -5269,8 +5269,8 @@ e1000_configure_rx(struct e1000_hw *hw)E1000_WRITE_FLUSH (hw); }/* Setup the Base and Length of the Rx Descriptor Ring */ -E1000_WRITE_REG (hw,RDBAL ,lower_32_bits (virt_to_phys (rx_base))); -E1000_WRITE_REG (hw,RDBAH ,upper_32_bits (virt_to_phys (rx_base))); +E1000_WRITE_REG (hw,RDBAL ,lower_32_bits (virt_to_phys (hw->rx_base))); +E1000_WRITE_REG (hw,RDBAH ,upper_32_bits (virt_to_phys (hw->rx_base)));E1000_WRITE_REG (hw,RDLEN ,NUM_RX_DESC *sizeof (struct e1000_rx_desc ));@@ -5298,12 +5298,13 @@ POLL - Wait for a framestatic int _e1000_poll (struct e1000_hw *hw) { +unsigned char *packet = hw->rx_packet;struct e1000_rx_desc *rd;unsigned long inval_start, inval_end;uint32_t len;/* return true if there's an ethernet packet ready to read */ - rd = rx_base + rx_last; + rd = hw->rx_base + hw->rx_last;/* Re-load the descriptor from RAM. */ inval_start = ((unsigned long )rd) & ~(ARCH_DMA_MINALIGN -1 );@@ -5469,6 +5470,9 @@ static int e1000_init_one(struct e1000_hw *hw, int cardnum,return -EPERM ; } + hw->rx_base = rx_base; + hw->rx_packet = _packet; +/* Are these variables needed? */ hw->fc = e1000_fc_default; hw->original_fc = e1000_fc_default;@@ -5663,7 +5667,7 @@ static int e1000_eth_recv(struct udevice *dev, int flags, uchar **packetp) len =_e1000_poll (hw);if (len) - *packetp = packet; + *packetp = hw->rx_packet;return len ? len : -EAGAIN ; }drivers/net/e1000.h +5
-1@@ -1134,6 +1134,11 @@ struct e1000_hw {bool initialize_hw_bits_disable;e1000_smart_speed smart_speed;e1000_dsp_config dsp_config_state; + +struct e1000_rx_desc *rx_base; +unsigned char *rx_packet; +int rx_tail; +int rx_last; };#define E1000_EEPROM_SWDPIN0 0x0001/* SWDPIN 0 EEPROM Value */ --2.39.2
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy
Re: [PATCH 2/4] net: e1000: move all rx data structures to hw instance
Quoted 5 lines · Christian Gmeiner
Hi all
Quoted 3 lines
Preparation for per driver instance allocated data structures.
Quoted 7 lines
Quoted 1 line
Signed-off-by Christian Gmeiner <[email protected]>gentle ping - what can I do better to get some feedback, RBs, etc faster? This experience is
quite frustrating and it happens for me from time to time for U-Boot patches :(Patch 1 of this series got a RB few days ago and the others are still open.
Unfortunately there's a number of areas where we just don't have a lot of maintainers. Now that v2023.04 is out I expect to be picking up assorted patches that look right, soon. Sorry for the delay.
Signature · 1 line
Tom
Re: [PATCH 2/4] net: e1000: move all rx data structures to hw instance
Quoted 13 lines · Christian Gmeiner
Quoted 11 lines
Hi all
Quoted 4 lines
Preparation for per driver instance allocated data structures.
Signed-off-by Christian Gmeiner <[email protected]>gentle ping - what can I do better to get some feedback, RBs, etc faster? This experience is
quite frustrating and it happens for me from time to time for U-Boot patches :(
Quoted 7 lines
Quoted 1 line
Patch 1 of this series got a RB few days ago and the others are still open.
Unfortunately there's a number of areas where we just don't have a lot of maintainers. Now that v2023.04 is out I expect to be picking up assorted patches that look right, soon. Sorry for the delay.
Thanks for your reasoning. Out of this I started to review some k3 patches :)
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy
PATCH 3/4 net: e1000: dynamically allocate rx data buffers per instance
In reply to Christian Gmeiner--- drivers/net/e1000.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/net/e1000.c +17 -8
@@ -54,14 +54,11 @@ tested on both gig copper and gig fiber boards#define E1000_BUFFER_ALIGN 128/* -* TODO([email protected]): Even with driver model we share these buffers. -* Concurrent receiving on multiple active Ethernet devices will not work. -* Normally U-Boot does not support this anyway. To fix it in this driver, -* move these buffers and the tx/rx pointers to struct e1000_hw. +* TODO([email protected]): Even with driver model we share tx buffer. +* To fix it in this driver, move these buffer and the tx pointers to +* struct e1000_hw. */ DEFINE_ALIGN_BUFFER(struct e1000_tx_desc, tx_base, 16, E1000_BUFFER_ALIGN); -DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, NUM_RX_DESC, E1000_BUFFER_ALIGN); -DEFINE_ALIGN_BUFFER(unsigned char, _packet, 4096, E1000_BUFFER_ALIGN);static int tx_tail;static int num_cards;/* Number of E1000 devices seen so far */
@@ -5442,6 +5439,12 @@ void e1000_get_bus_type(struct e1000_hw *hw) } } +static inline void * +e1000_alloc (size_t size) +{ +return memalign (E1000_BUFFER_ALIGN , size); +} +static int e1000_init_one (struct e1000_hw *hw,int cardnum,struct udevice *devno,unsigned char enetaddr[6 ]) {
@@ -5470,8 +5473,14 @@ static int e1000_init_one(struct e1000_hw *hw, int cardnum,return -EPERM ; } - hw->rx_base = rx_base; - hw->rx_packet = _packet; + hw->rx_base =e1000_alloc (NUM_RX_DESC *sizeof (struct e1000_rx_desc )); + hw->rx_packet =e1000_alloc (4096 ); + +if (!hw->rx_base || !hw->rx_packet) { +free (hw->rx_base); +free (hw->rx_packet); +return -ENOMEM ; + }/* Are these variables needed? */ hw->fc = e1000_fc_default;
Signature · 1 line
2.39.2
PATCH 4/4 net: e1000: make use of multiple rx packets
In reply to Christian GmeinerWhen facing a very busy network, the single rx packet buffer was oftentimes overwritten before a desired response packet (e.g. a Ping reply) could have been processed. This change improves resistance to this by utilising multiple buffers.
--- drivers/net/e1000.c | 30 ++++++++++++++++++++++-------- drivers/net/e1000.h | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-)
drivers/net/e1000.c +22 -8
@@ -5086,7 +5086,7 @@ e1000_sw_init(struct e1000_hw *hw)void fill_rx (struct e1000_hw *hw) { -unsigned char *packet = hw->rx_packet; +unsigned char *packet = hw->rx_packet[hw->rx_tail];struct e1000_rx_desc *rd;unsigned long flush_start, flush_end;
@@ -5284,6 +5284,9 @@ e1000_configure_rx(struct e1000_hw *hw)mdelay (20 ); } +for (int i =0 ; i <NUM_RX_DESC ; i++) +memset (&hw->rx_base[i],0 ,16 ); +E1000_WRITE_REG (hw,RCTL , rctl);fill_rx (hw);
@@ -5295,9 +5298,9 @@ POLL - Wait for a framestatic int _e1000_poll (struct e1000_hw *hw) { -unsigned char *packet = hw->rx_packet;struct e1000_rx_desc *rd;unsigned long inval_start, inval_end; +unsigned char *packet;uint32_t len;/* return true if there's an ethernet packet ready to read */
@@ -5310,6 +5313,9 @@ _e1000_poll(struct e1000_hw *hw)if (!(rd->status &E1000_RXD_STAT_DD ))return 0 ; + + packet = (unsigned char *)rd->buffer_addr; +/* DEBUGOUT("recv: packet len=%d\n", rd->length); */ /* Packet received, make sure the data are re-loaded from RAM. */ len =le16_to_cpu (rd->length);
@@ -5403,8 +5409,8 @@ _e1000_init(struct e1000_hw *hw, unsigned char enetaddr[6])return ret_val; }e1000_configure_tx (hw); -e1000_setup_rctl (hw);e1000_configure_rx (hw); +e1000_setup_rctl (hw);return 0 ; }
@@ -5474,12 +5480,14 @@ static int e1000_init_one(struct e1000_hw *hw, int cardnum, } hw->rx_base =e1000_alloc (NUM_RX_DESC *sizeof (struct e1000_rx_desc )); - hw->rx_packet =e1000_alloc (4096 ); -if (!hw->rx_base || !hw->rx_packet) { -free (hw->rx_base); -free (hw->rx_packet); +if (!hw->rx_base)return -ENOMEM ; + +for (int i =0 ; i <NUM_RX_DESC ; i++) { + hw->rx_packet[i] =e1000_alloc (4096 ); +if (!hw->rx_packet[i]) + goto out_alloc_fail; }/* Are these variables needed? */
@@ -5529,6 +5537,12 @@ static int e1000_init_one(struct e1000_hw *hw, int cardnum,#endif return 0 ; + +out_alloc_fail: +for (int i =0 ; i <NUM_RX_DESC ; i++) +free (hw->rx_packet[i]); + +return -ENOMEM ; }/* Put the name of a device in a string */
@@ -5676,7 +5690,7 @@ static int e1000_eth_recv(struct udevice *dev, int flags, uchar **packetp) len =_e1000_poll (hw);if (len) - *packetp = hw->rx_packet; + *packetp = hw->rx_packet[hw->rx_last];return len ? len : -EAGAIN ; }
drivers/net/e1000.h +1 -1
@@ -1136,7 +1136,7 @@ struct e1000_hw {e1000_dsp_config dsp_config_state;struct e1000_rx_desc *rx_base; -unsigned char *rx_packet; +unsigned char *rx_packet[NUM_RX_DESC ];int rx_tail;int rx_last; };
Signature · 1 line
2.39.2
Re: [PATCH 4/4] net: e1000: make use of multiple rx packets
Quoted 8 lines · Christian Gmeiner
When facing a very busy network, the single rx packet buffer was oftentimes overwritten before a desired response packet (e.g. a Ping reply) could have been processed. This change improves resistance to this by utilising multiple buffers.
Signed-off-by Christian Gmeiner <[email protected]>---
This results in:drivers/net/e1000.c:5317:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
5317 | packet = (unsigned char *)rd->buffer_addr;
| ^
On platforms such as qemu_arm.
Signature · 1 line
Tom
Quoted 7 lines
The call to
DEFINE_ALIGN_BUFFERfor therx_descarray conained an icnonsistency as 16 receive descriptors were allocated when the remaining code would only use 8 of them.Signed-off-by Christian Gmeiner <[email protected]>
gentle ping
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy
Quoted 11 lines
Quoted 8 lines
The call to
DEFINE_ALIGN_BUFFERfor therx_descarray conained an icnonsistency as 16 receive descriptors were allocated when the remaining code would only use 8 of them.Signed-off-by Christian Gmeiner <[email protected]>gentle ping
Adding some more people to CC - maybe this helps.
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy
Quoted 57 lines · Christian Gmeiner
The call to
DEFINE_ALIGN_BUFFERfor therx_descarray conained an icnonsistency as 16 receive descriptors were allocated when the remaining code would only use 8 of them.Signed-off-by Christian Gmeiner <[email protected]>--- drivers/net/e1000.c | 6 +++--- drivers/net/e1000.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)drivers/net/e1000.c +3
-3@@ -60,7 +60,7 @@ tested on both gig copper and gig fiber boards* move these buffers and the tx/rx pointers to struct e1000_hw. */ DEFINE_ALIGN_BUFFER(struct e1000_tx_desc, tx_base, 16, E1000_BUFFER_ALIGN); -DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, 16, E1000_BUFFER_ALIGN); +DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, NUM_RX_DESC, E1000_BUFFER_ALIGN); DEFINE_ALIGN_BUFFER(unsigned char, packet, 4096, E1000_BUFFER_ALIGN);static int tx_tail;@@ -5095,7 +5095,7 @@ fill_rx(struct e1000_hw *hw) rx_last = rx_tail; rd = rx_base + rx_tail; - rx_tail = (rx_tail +1 ) %8 ; + rx_tail = (rx_tail +1 ) %NUM_RX_DESC ;memset (rd,0 ,16 ); rd->buffer_addr =cpu_to_le64 (virt_to_phys (packet));@@ -5272,7 +5272,7 @@ e1000_configure_rx(struct e1000_hw *hw)E1000_WRITE_REG (hw,RDBAL ,lower_32_bits (virt_to_phys (rx_base)));E1000_WRITE_REG (hw,RDBAH ,upper_32_bits (virt_to_phys (rx_base))); -E1000_WRITE_REG (hw,RDLEN ,128 ); +E1000_WRITE_REG (hw,RDLEN ,NUM_RX_DESC *sizeof (struct e1000_rx_desc ));/* Setup the HW Rx Head and Tail Descriptor Pointers */ E1000_WRITE_REG (hw,RDH ,0 );drivers/net/e1000.h +2
-1@@ -42,6 +42,8 @@ #define DEBUGOUT(fmt, args...) do { } while (0)#endif +#define NUM_RX_DESC 8 +/* I/O wrapper functions */ #define E1000_WRITE_REG (a, reg, value) \ writel((value), ((a)->hw_addr + E1000_##reg)) --
Quoted 2 lines
2.39.2
Am Sa., 1. Apr. 2023 um 21:01 Uhr schrieb Ramon Fried <[email protected]>:
Quoted 54 lines
Quoted 51 lines · Christian Gmeiner
The call to
DEFINE_ALIGN_BUFFERfor therx_descarray conained an icnonsistency as 16 receive descriptors were allocated when the remaining code would only use 8 of them.Signed-off-by Christian Gmeiner <[email protected]>--- drivers/net/e1000.c | 6 +++--- drivers/net/e1000.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)drivers/net/e1000.c +3
-3@@ -60,7 +60,7 @@ tested on both gig copper and gig fiber boards* move these buffers and the tx/rx pointers to struct e1000_hw. */ DEFINE_ALIGN_BUFFER(struct e1000_tx_desc, tx_base, 16, E1000_BUFFER_ALIGN); -DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, 16, E1000_BUFFER_ALIGN); +DEFINE_ALIGN_BUFFER(struct e1000_rx_desc, rx_base, NUM_RX_DESC, E1000_BUFFER_ALIGN); DEFINE_ALIGN_BUFFER(unsigned char, packet, 4096, E1000_BUFFER_ALIGN);static int tx_tail;@@ -5095,7 +5095,7 @@ fill_rx(struct e1000_hw *hw) rx_last = rx_tail; rd = rx_base + rx_tail; - rx_tail = (rx_tail +1 ) %8 ; + rx_tail = (rx_tail +1 ) %NUM_RX_DESC ;memset (rd,0 ,16 ); rd->buffer_addr =cpu_to_le64 (virt_to_phys (packet));@@ -5272,7 +5272,7 @@ e1000_configure_rx(struct e1000_hw *hw)E1000_WRITE_REG (hw,RDBAL ,lower_32_bits (virt_to_phys (rx_base)));E1000_WRITE_REG (hw,RDBAH ,upper_32_bits (virt_to_phys (rx_base))); -E1000_WRITE_REG (hw,RDLEN ,128 ); +E1000_WRITE_REG (hw,RDLEN ,NUM_RX_DESC *sizeof (struct e1000_rx_desc ));/* Setup the HW Rx Head and Tail Descriptor Pointers */ E1000_WRITE_REG (hw,RDH ,0 );drivers/net/e1000.h +0
-0@@ -42,6 +42,8 @@ #define DEBUGOUT(fmt, args...) do { } while (0)#endif
Quoted 9 lines
Quoted 8 lines
drivers/net/e1000.h +2
-1+#define NUM_RX_DESC 8 +/* I/O wrapper functions */ #define E1000_WRITE_REG (a, reg, value) \ writel((value), ((a)->hw_addr + E1000_##reg)) --2.39.2
Reviewed-by Ramon Fried <[email protected]>
Who is responsible for this change and maybe the other 3 patches in this series make their way into master?
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy