i40evf: fix crash when changing ring sizes
authorMitch Williams <mitch.a.williams@intel.com>
Thu, 24 Apr 2014 06:41:37 +0000 (06:41 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 5 Jun 2014 09:13:01 +0000 (02:13 -0700)
commitd732a18445071fea4e062c3d66e2fc21f1bd1290
treec8b273d1907855ccdb7e4351151acf075bf5c49f
parent337eb08e5ad0c3e7929d1f1745165af412e7d6eb
i40evf: fix crash when changing ring sizes

i40evf_set_ringparam was broken in several ways. First, it only changed
the size of the first ring, and second, changing the ring size would
often result in a panic because it would change the count before
deallocating resources, causing the driver to either free nonexistent
buffers, or leak leftover buffers.

Fix this by storing the descriptor count in the adapter structure, and
updating the count for each ring each time we allocate them. This
ensures that we always free the right size ring, and always end up with
the requested count when the device is (re)opened.

Change-ID: I298396cd3d452ba8509d9f2d33a93f25868a9a55
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40evf/i40evf.h
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
drivers/net/ethernet/intel/i40evf/i40evf_main.c