Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1398388

Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag

From Lino Sanfilippo <LinoSanfilippo@gmx.de>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag
Date 2016-05-10 20:40 +0200
Message-ID <rxkJA-8hw-9@gated-at.bofh.it> (permalink)
References (1 earlier) <rsyau-26F-9@gated-at.bofh.it> <rt1vR-2uF-29@gated-at.bofh.it> <rujK2-1Me-21@gated-at.bofh.it> <ruk3o-2eU-17@gated-at.bofh.it> <rwxpv-83R-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Elad,

On 08.05.2016 15:44, Elad Kanfi wrote:

>   
> After reviewing the code and your suggestion, it seems that we can do without the flag tx_packet_sent and therefor the first issue becomes irrelevant.
> The indication that a packet was sent is (tx_skb != NULL) , and the sequence will be:
> 
> CPU A:
> 1. tx_skb = skb
> 2. wmb() /* make sure tx_skb reaches the RAM before the HW is informed and the IRQ is fired */
> 3. nps_enet_reg_set(priv, NPS_ENET_REG_TX_CTL, tx_ctrl.value); /* send frame */
> 
> CPU B:
> 1. read tx_skb 
> 2. if( tx_skb != NULL ) handle tx_skb
> 3. tx_skb = NULL 
> 
> 

Ok, without the tx_packet_sent flag the code becomes simpler. But it
does not mean that we can toss the smp_rmb in the irq handler
completely. We still have to use a read barrier there to ensure that we
see the most recent value of tx_skb. E.g like this:

if (priv->tx_skb != NULL ) {
	smp_rmb()
	/ * handle tx_skb */
}

With both barriers in place the code should work as expected.

Regards,
Lino

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag David Miller <davem@davemloft.net> - 2016-04-28 23:20 +0200
  RE: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag Elad Kanfi <eladkan@mellanox.com> - 2016-05-02 13:00 +0200
    Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag Lino Sanfilippo <lsanfil@marvell.com> - 2016-05-02 13:20 +0200
      RE: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag Elad Kanfi <eladkan@mellanox.com> - 2016-05-08 16:00 +0200
        Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-05-10 20:40 +0200

csiph-web