net: bcmgenet: Fix unmapping of fragments in bcmgenet_xmit()
authorDoug Berger <opendmb@gmail.com>
Fri, 14 Jul 2017 23:12:09 +0000 (16:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 Jul 2017 04:29:08 +0000 (21:29 -0700)
commit876dbadd53a7102e2a84afc84ea2bd3ee6dc5636
tree6fd687f2decee36acbf7cec8e62318133dda91c8
parentea6c3077678f969577e0f75aecda9478c3840912
net: bcmgenet: Fix unmapping of fragments in bcmgenet_xmit()

In case we fail to map a single fragment, we would be leaving the
transmit ring populated with stale entries.

This commit introduces the helper function bcmgenet_put_txcb()
which takes care of rewinding the per-ring write pointer back to
where we left.

It also consolidates the functionality of bcmgenet_xmit_single()
and bcmgenet_xmit_frag() into the bcmgenet_xmit() function to
make the unmapping of control blocks cleaner.

Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Doug Berger <opendmb@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c