gve: Fix bug in gve_rx_alloc/free_ring

In gve_rx_free_ring, now that we are setting the pagecount high, rather
than just freeing the page with put_page we need to make sure we
subtract off the bias first.

In gve_rx_alloc_ring, we need to unfill the ring if the allocation fails
to properly cleanup.

In gve_prefill_buffers, if a page allocation failed we weren't cleaning
up properly. In addition to freeing the page we need to reduce the page
count so we should be using free_buffer. We should also be actually
iterating over the buffers that were successfully alloced not using the
local page and addr vars.

BUG=b/184636169,b/188096583
TEST=presubmit
RELEASE_NOTE=None
SOURCE=GVNIC

cos-patch: bug
Signed-off-by: Catherine Sullivan <csully@google.com>
Change-Id: Ic944a6f59ad522fb7fdd96a5e28d492bf855561a
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/14553
Reviewed-by: Roy Yang <royyang@google.com>
Tested-by: Roy Yang <royyang@google.com>
(cherry picked from commit fda41945bbd95964e876b1aad85a4a6103a83539)
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/16836
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
(cherry picked from commit c5758405d507a39977ff5de416f9149f555dcefb)
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/17910
Main-Branch-Verified: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
1 file changed