lkml.org 
[lkml]   [2018]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH net-next 8/9] net: hns3: fix the descriptor index when get rss type
    Date
    Driver gets rss information from the last descriptor of the packet.
    When driver handle the rss type, ring->next_to_clean indicates the
    first descriptor of next packet.

    This patch fix the descriptor index with "ring->next_to_clean - 1".

    Fixes: 232fc64b6e62 ("net: hns3: Add HW RSS hash information to RX skb")
    Signed-off-by: Peng Li <lipeng321@huawei.com>
    ---
    drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 9 ++++++++-
    1 file changed, 8 insertions(+), 1 deletion(-)

    diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
    index 624b8a7..d3b9aaf 100644
    --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
    +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
    @@ -2550,9 +2550,16 @@ static void hns3_set_gro_param(struct sk_buff *skb, u32 l234info,
    static void hns3_set_rx_skb_rss_type(struct hns3_enet_ring *ring,
    struct sk_buff *skb)
    {
    - struct hns3_desc *desc = &ring->desc[ring->next_to_clean];
    struct hnae3_handle *handle = ring->tqp->handle;
    enum pkt_hash_types rss_type;
    + struct hns3_desc *desc;
    + int last_bd;
    +
    + /* When driver handle the rss type, ring->next_to_clean indicates the
    + * first descriptor of next packet, need -1 here.
    + */
    + last_bd = (ring->next_to_clean - 1 + ring->desc_num) % ring->desc_num;
    + desc = &ring->desc[last_bd];

    if (le32_to_cpu(desc->rx.rss_hash))
    rss_type = handle->kinfo.rss_type;
    --
    1.9.1
    \
     
     \ /
      Last update: 2018-12-20 04:17    [W:3.249 / U:0.248 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site