[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5B8599B2-AE3C-4E03-8EDF-8F35894E9CC3@cumulusnetworks.com>
Date: Thu, 9 Jan 2014 14:16:57 -0800
From: Scott Feldman <sfeldma@...ulusnetworks.com>
To: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
Cc: David Miller <davem@...emloft.net>,
Greg Rose <gregory.v.rose@...el.com>,
Netdev <netdev@...r.kernel.org>, gospo@...hat.com,
sassmann@...hat.com, Mitch Williams <mitch.a.williams@...el.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>
Subject: Re: [net-next 05/15] i40e: add a comment on barrier and fix panic on reset
On Jan 9, 2014, at 4:52 AM, Jeff Kirsher <jeffrey.t.kirsher@...el.com> wrote:
> From: Greg Rose <gregory.v.rose@...el.com>
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index ea76134..5cdc67c 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -422,7 +422,7 @@ void i40e_vsi_reset_stats(struct i40e_vsi *vsi)
> memset(&vsi->net_stats_offsets, 0, sizeof(vsi->net_stats_offsets));
> memset(&vsi->eth_stats, 0, sizeof(vsi->eth_stats));
> memset(&vsi->eth_stats_offsets, 0, sizeof(vsi->eth_stats_offsets));
> - if (vsi->rx_rings)
> + if (vsi->rx_rings && vsi->rx_rings[0]) {
Any reason why just [0] is checked for !NULL here...
> for (i = 0; i < vsi->num_queue_pairs; i++) {
> memset(&vsi->rx_rings[i]->stats, 0 ,
> sizeof(vsi->rx_rings[i]->stats));
> @@ -433,6 +433,7 @@ void i40e_vsi_reset_stats(struct i40e_vsi *vsi)
> memset(&vsi->tx_rings[i]->tx_stats, 0,
> sizeof(vsi->tx_rings[i]->tx_stats));
> }
> + }
> vsi->stat_offsets_loaded = false;
> }
>
> @@ -2101,8 +2105,11 @@ static void i40e_vsi_free_rx_resources(struct i40e_vsi *vsi)
> {
> int i;
>
> + if (!vsi->rx_rings)
> + return;
> +
> for (i = 0; i < vsi->num_queue_pairs; i++)
> - if (vsi->rx_rings[i]->desc)
> + if (vsi->rx_rings[i] && vsi->rx_rings[i]->desc)
but here every [i] is checked for !NULL here?
> i40e_free_rx_resources(vsi->rx_rings[i]);
> }
>
If [0] check is sufficient to know if array members are allocated, maybe an wrapper func would help document intent:
static bool i40e_vsi_rings_allocated(struct i40e_ring *ring)
{
return (ring && ring[0]);
}
-scott
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists