Message ID | 20130328031932.GC2176@order.stressinduktion.org |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
Please don't revise following code: rx_page->read_offset += (((u32)((prrs->word1 >> RRS_PKT_SIZE_SHIFT) & RRS_PKT_SIZE_MASK) + sizeof(struct atl1e_recv_ret_status) + 31) & 0xFFFFFFE0); Here 32bytes alignment is no matter with Page alignment. Thanks Xiong > -----Original Message----- > From: Hannes Frederic Sowa [mailto:hannes@stressinduktion.org] > Sent: Thursday, March 28, 2013 11:20 AM > To: Huang, Xiong > Cc: Sven Hartge; netdev@vger.kernel.org > Subject: Re: Atheros Communications Inc. AR8121/AR8113/AR8114 Gigabit or > Fast Ethernet (rev b0) 1.0.0.7 md5/sha1 corrupted using NFS and samba > (updated) Version 2 > > On Thu, Mar 28, 2013 at 01:17:53AM +0000, Huang, Xiong wrote: > > > > > > We will try to go with RXQ_CTRL_PBA_ALIGN_256 in REG_RXQ_CTRL next. > > > Just have to check the ring resources are initialized correctly. > > > > > > Thanks, > > > > > > ALIGN_256 require the RXF page 256 byte alignment, you should also revise > the memory allocation function. > > Could you have a look at the following diff? It does not work either. Perhaps > something is wrong in the calculations (but there are no seq number > mismatches). > > diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c > b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c > index e1f1b2a..5264810 100644 > --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c > +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c > @@ -697,7 +697,7 @@ static void atl1e_cal_ring_size(struct atl1e_adapter > *adapter, u32 *ring_size) > sizeof(struct atl1e_tpd_desc) + 7 > /* tx ring, qword align */ > + adapter->rx_ring.real_page_size * > AT_PAGE_NUM_PER_QUEUE * > - adapter->num_rx_queues + 31 > + adapter->num_rx_queues + 255 > /* rx ring, 32 bytes align */ > + (1 + AT_PAGE_NUM_PER_QUEUE * adapter- > >num_rx_queues) * > sizeof(u32) + 3)); > @@ -714,7 +714,7 @@ static void atl1e_init_ring_resources(struct > atl1e_adapter *adapter) > + adapter->hw.max_frame_size > + ETH_HLEN + VLAN_HLEN > + ETH_FCS_LEN; > - rx_ring->real_page_size = roundup(rx_ring->real_page_size, 32); > + rx_ring->real_page_size = roundup(rx_ring->real_page_size, 256); > atl1e_cal_ring_size(adapter, &adapter->ring_size); > > adapter->ring_vir_addr = NULL; > @@ -825,7 +825,7 @@ static int atl1e_setup_ring_resources(struct > atl1e_adapter *adapter) > > /* Init RXF-Pages */ > offset += (sizeof(struct atl1e_tpd_desc) * tx_ring->count); > - offset = roundup(offset, 32); > + offset = roundup(offset, 256); > > for (i = 0; i < adapter->num_rx_queues; i++) { > for (j = 0; j < AT_PAGE_NUM_PER_QUEUE; j++) { @@ -1003,7 > +1003,7 @@ static inline void atl1e_configure_rx(struct atl1e_adapter > *adapter) > rxq_ctrl_data |= > (RXQ_CTRL_HASH_ENABLE | > RXQ_CTRL_RSS_MODE_MQUESINT); > > - rxq_ctrl_data |= RXQ_CTRL_IPV6_XSUM_VERIFY_EN | > RXQ_CTRL_PBA_ALIGN_32 | > + rxq_ctrl_data |= RXQ_CTRL_IPV6_XSUM_VERIFY_EN | > RXQ_CTRL_PBA_ALIGN_256 > +| > RXQ_CTRL_CUT_THRU_EN | RXQ_CTRL_EN; > > AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data); @@ -1444,8 > +1444,8 @@ skip_pkt: > rx_page->read_offset += > (((u32)((prrs->word1 >> > RRS_PKT_SIZE_SHIFT) & > RRS_PKT_SIZE_MASK) + > - sizeof(struct atl1e_recv_ret_status) + 31) & > - 0xFFFFFFE0); > + sizeof(struct atl1e_recv_ret_status) + 255) & > + 0xFFFFFF00); > > if (rx_page->read_offset >= rx_ring->page_size) { > /* mark this page clean */
On Thu, Mar 28, 2013 at 03:25:29AM +0000, Huang, Xiong wrote: > Please don't revise following code: > > rx_page->read_offset += > (((u32)((prrs->word1 >> RRS_PKT_SIZE_SHIFT) & > RRS_PKT_SIZE_MASK) + > sizeof(struct atl1e_recv_ret_status) + 31) & > 0xFFFFFFE0); > > Here 32bytes alignment is no matter with Page alignment. If I revert this change I get sequence errors: [ 781.449864] ATL1E 0000:04:00.0: irq 45 for MSI/MSI-X [ 781.454634] IPv6: ADDRCONF(NETDEV_UP): p33p1: link is not ready [ 782.893744] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> [ 782.893797] IPv6: ADDRCONF(NETDEV_CHANGE): p33p1: link becomes ready [ 783.194443] ATL1E 0000:04:00.0 p33p1: rx sequence number error (rx=0) (expect=1) [ 783.204497] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> [ 783.225336] ATL1E 0000:04:00.0 p33p1: rx sequence number error (rx=0) (expect=1) [ 783.236636] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> [ 783.462652] ATL1E 0000:04:00.0 p33p1: rx sequence number error (rx=0) (expect=1) [ 783.472530] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> [ 784.038976] ATL1E 0000:04:00.0 p33p1: rx sequence number error (rx=0) (expect=1) [ 784.047354] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> ... -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Dump every packet length & read_offset value, compare them. > -----Original Message----- > From: Hannes Frederic Sowa [mailto:hannes@stressinduktion.org] > Sent: Thursday, March 28, 2013 11:30 AM > To: Huang, Xiong > Cc: Sven Hartge; netdev@vger.kernel.org > Subject: Re: Atheros Communications Inc. AR8121/AR8113/AR8114 Gigabit or > Fast Ethernet (rev b0) 1.0.0.7 md5/sha1 corrupted using NFS and samba > (updated) Version 2 > > On Thu, Mar 28, 2013 at 03:25:29AM +0000, Huang, Xiong wrote: > > Please don't revise following code: > > > > rx_page->read_offset += > > (((u32)((prrs->word1 >> > RRS_PKT_SIZE_SHIFT) & > > RRS_PKT_SIZE_MASK) + > > sizeof(struct atl1e_recv_ret_status) + 31) & > > 0xFFFFFFE0); > > > > Here 32bytes alignment is no matter with Page alignment. > > If I revert this change I get sequence errors: > > [ 781.449864] ATL1E 0000:04:00.0: irq 45 for MSI/MSI-X [ 781.454634] IPv6: > ADDRCONF(NETDEV_UP): p33p1: link is not ready [ 782.893744] ATL1E > 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> [ 782.893797] IPv6: > ADDRCONF(NETDEV_CHANGE): p33p1: link becomes ready [ 783.194443] > ATL1E 0000:04:00.0 p33p1: rx sequence number error (rx=0) (expect=1) > [ 783.204497] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> > [ 783.225336] ATL1E 0000:04:00.0 p33p1: rx sequence number error (rx=0) > (expect=1) [ 783.236636] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps > Full Duplex> [ 783.462652] ATL1E 0000:04:00.0 p33p1: rx sequence number > error (rx=0) (expect=1) [ 783.472530] ATL1E 0000:04:00.0 p33p1: NIC Link is > Up <100 Mbps Full Duplex> [ 784.038976] ATL1E 0000:04:00.0 p33p1: rx > sequence number error (rx=0) (expect=1) [ 784.047354] ATL1E 0000:04:00.0 > p33p1: NIC Link is Up <100 Mbps Full Duplex> ...
Sorry, my fault, your code is right. > -----Original Message----- > From: Hannes Frederic Sowa [mailto:hannes@stressinduktion.org] > Sent: Thursday, March 28, 2013 11:30 AM > To: Huang, Xiong > Cc: Sven Hartge; netdev@vger.kernel.org > Subject: Re: Atheros Communications Inc. AR8121/AR8113/AR8114 Gigabit or > Fast Ethernet (rev b0) 1.0.0.7 md5/sha1 corrupted using NFS and samba > (updated) Version 2 > > On Thu, Mar 28, 2013 at 03:25:29AM +0000, Huang, Xiong wrote: > > Please don't revise following code: > > > > rx_page->read_offset += > > (((u32)((prrs->word1 >> > RRS_PKT_SIZE_SHIFT) & > > RRS_PKT_SIZE_MASK) + > > sizeof(struct atl1e_recv_ret_status) + 31) & > > 0xFFFFFFE0); > > > > Here 32bytes alignment is no matter with Page alignment. > > If I revert this change I get sequence errors: > > [ 781.449864] ATL1E 0000:04:00.0: irq 45 for MSI/MSI-X [ 781.454634] IPv6: > ADDRCONF(NETDEV_UP): p33p1: link is not ready [ 782.893744] ATL1E > 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> [ 782.893797] IPv6: > ADDRCONF(NETDEV_CHANGE): p33p1: link becomes ready [ 783.194443] > ATL1E 0000:04:00.0 p33p1: rx sequence number error (rx=0) (expect=1) > [ 783.204497] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps Full Duplex> > [ 783.225336] ATL1E 0000:04:00.0 p33p1: rx sequence number error (rx=0) > (expect=1) [ 783.236636] ATL1E 0000:04:00.0 p33p1: NIC Link is Up <100 Mbps > Full Duplex> [ 783.462652] ATL1E 0000:04:00.0 p33p1: rx sequence number > error (rx=0) (expect=1) [ 783.472530] ATL1E 0000:04:00.0 p33p1: NIC Link is > Up <100 Mbps Full Duplex> [ 784.038976] ATL1E 0000:04:00.0 p33p1: rx > sequence number error (rx=0) (expect=1) [ 784.047354] ATL1E 0000:04:00.0 > p33p1: NIC Link is Up <100 Mbps Full Duplex> ...
On Thu, Mar 28, 2013 at 03:39:33AM +0000, Huang, Xiong wrote:
> Dump every packet length & read_offset value, compare them.
I think we have it! :)
If we disable msi as it is done in the windows driver, everything works as
expected. Do you have any clue why this could be the case? Otherwise I would
send a patch to disable msi by default.
Thanks for your help,
Hannes
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
> > On Thu, Mar 28, 2013 at 03:39:33AM +0000, Huang, Xiong wrote: > > Dump every packet length & read_offset value, compare them. > > I think we have it! :) > > If we disable msi as it is done in the windows driver, everything works as > expected. Do you have any clue why this could be the case? Otherwise I > would send a patch to disable msi by default. > Windows doesn't deliberately disable MSI, it just simply use INTx style since this chip hasn't MSIX capability :) I think it's a safe solution to disable its MSI. Thank you for all the test ! -Xiong
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index e1f1b2a..5264810 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -697,7 +697,7 @@ static void atl1e_cal_ring_size(struct atl1e_adapter *adapter, u32 *ring_size) sizeof(struct atl1e_tpd_desc) + 7 /* tx ring, qword align */ + adapter->rx_ring.real_page_size * AT_PAGE_NUM_PER_QUEUE * - adapter->num_rx_queues + 31 + adapter->num_rx_queues + 255 /* rx ring, 32 bytes align */ + (1 + AT_PAGE_NUM_PER_QUEUE * adapter->num_rx_queues) * sizeof(u32) + 3)); @@ -714,7 +714,7 @@ static void atl1e_init_ring_resources(struct atl1e_adapter *adapter) + adapter->hw.max_frame_size + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; - rx_ring->real_page_size = roundup(rx_ring->real_page_size, 32); + rx_ring->real_page_size = roundup(rx_ring->real_page_size, 256); atl1e_cal_ring_size(adapter, &adapter->ring_size); adapter->ring_vir_addr = NULL; @@ -825,7 +825,7 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter) /* Init RXF-Pages */ offset += (sizeof(struct atl1e_tpd_desc) * tx_ring->count); - offset = roundup(offset, 32); + offset = roundup(offset, 256); for (i = 0; i < adapter->num_rx_queues; i++) { for (j = 0; j < AT_PAGE_NUM_PER_QUEUE; j++) { @@ -1003,7 +1003,7 @@ static inline void atl1e_configure_rx(struct atl1e_adapter *adapter) rxq_ctrl_data |= (RXQ_CTRL_HASH_ENABLE | RXQ_CTRL_RSS_MODE_MQUESINT); - rxq_ctrl_data |= RXQ_CTRL_IPV6_XSUM_VERIFY_EN | RXQ_CTRL_PBA_ALIGN_32 | + rxq_ctrl_data |= RXQ_CTRL_IPV6_XSUM_VERIFY_EN | RXQ_CTRL_PBA_ALIGN_256 | RXQ_CTRL_CUT_THRU_EN | RXQ_CTRL_EN; AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data); @@ -1444,8 +1444,8 @@ skip_pkt: rx_page->read_offset += (((u32)((prrs->word1 >> RRS_PKT_SIZE_SHIFT) & RRS_PKT_SIZE_MASK) + - sizeof(struct atl1e_recv_ret_status) + 31) & - 0xFFFFFFE0); + sizeof(struct atl1e_recv_ret_status) + 255) & + 0xFFFFFF00); if (rx_page->read_offset >= rx_ring->page_size) { /* mark this page clean */