• Alex Elder's avatar
    net: ipa: initialize ring indexes to 0 · 5fb859f7
    Alex Elder authored
    When a GSI channel is initially allocated, and after it has been
    reset, the hardware assumes its ring index is 0.  And although we
    do initialize channels this way, the comments in the IPA code don't
    really explain this.  For event rings, it doesn't matter what value
    we use initially, so using 0 is just fine.
    
    Add some information about the assumptions made by hardware above
    the definition of the gsi_ring structure in "gsi.h".
    
    Zero the index field for all rings (channel and event) when the ring
    is allocated.  As a result, that function initializes all fields in
    the structure.
    
    Stop zeroing the index the top of gsi_channel_program().  Initially
    we'll use the index value set when the channel ring was allocated.
    And we'll explicitly zero the index value in gsi_channel_reset()
    before programming the hardware, adding a comment explaining why
    it's required.
    
    For event rings, use the index initialized by gsi_ring_alloc()
    rather than 0 when ringing the doorbell in gsi_evt_ring_program().
    (It'll still be zero, but we won't assume that to be the case.)
    
    Use a local variable in gsi_evt_ring_program() that represents the
    address of the event ring's ring structure.
    Signed-off-by: default avatarAlex Elder <elder@linaro.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    5fb859f7
gsi.h 8.9 KB