Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] igb: count Rx FIFO errors correctly
From: David Miller @ 2010-03-24  6:20 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, mitch.a.williams
In-Reply-To: <20100324043437.32036.44229.stgit@localhost.localdomain>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 23 Mar 2010 21:34:38 -0700

> From: Mitch Williams <mitch.a.williams@intel.com>
> 
> Don't aggregate rx_no_buffer_count into rx_fifo_errors. RNBC counts
> packets that get queued temporarily in the adapter's FIFO. These
> packets are not dropped and are not errors. The correct counter
> is rx_missed_errors (MPC).
> 
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply

* Re: [PATCH] igb: do not modify tx_queue_len on link speed change
From: David Miller @ 2010-03-24  6:20 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, emil.s.tantilov
In-Reply-To: <20100324043456.32036.21219.stgit@localhost.localdomain>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 23 Mar 2010 21:34:57 -0700

> From: Emil Tantilov <emil.s.tantilov@intel.com>
> 
> Previously the driver tweaked txqueuelen to avoid false Tx hang reports seen at half duplex.
> This had the effect of overriding user set values on link change/reset. Testing shows that
> adjusting only the timeout factor is sufficient to prevent Tx hang reports at half duplex.
> 
> Based on e1000e patch by Franco Fichtner <franco@lastsummer.de>
> 
> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply

* Re: [PATCH] igb: only use vlan_gro_receive if vlans are registered
From: David Miller @ 2010-03-24  6:21 UTC (permalink / raw)
  To: eric.dumazet; +Cc: jeffrey.t.kirsher, netdev, gospo, alexander.h.duyck
In-Reply-To: <1269409837.2915.48.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 24 Mar 2010 06:50:37 +0100

> Le mardi 23 mars 2010 à 21:35 -0700, Jeff Kirsher a écrit :
>> From: Alexander Duyck <alexander.h.duyck@intel.com>
>> 
>> This change makes it so that vlan_gro_receive is only used if vlans have been
>> registered to the adapter structure.  Previously we were just sending all vlan
>> tagged frames in via this function but this results in a null pointer
>> dereference when vlans are not registered.
>> 
> 
> This patch fixes bugzilla entry 15582

I've added a note about this to the commit message.

>> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> ---
...
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks everyone.

^ permalink raw reply

* Re: [PATCH v2 1/2] vlan: adds vlan_dev_select_queue
From: David Miller @ 2010-03-24  6:30 UTC (permalink / raw)
  To: eric.dumazet; +Cc: jeffrey.t.kirsher, netdev, gospo, vasu.dev
In-Reply-To: <1269410022.2915.49.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 24 Mar 2010 06:53:42 +0100

> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Eric are you now OK with patch #2 in this series as well?

Thanks!

^ permalink raw reply

* Re: net-next: 2.6.34-rc1 regression: panic when running diagnostic on interface with IPv6
From: David Miller @ 2010-03-24  6:33 UTC (permalink / raw)
  To: emil.s.tantilov; +Cc: netdev, shemminger
In-Reply-To: <EA929A9653AAE14F841771FB1DE5A1365FE4ADAB2A@rrsmsx501.amr.corp.intel.com>

From: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
Date: Tue, 23 Mar 2010 12:28:08 -0600

> Bisecting points to this patch:
> http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=84e8b803f1e16f3a2b8b80f80a63fa2f2f8a9be6
> 
> And I confirmed that the issue goes away after reverting it.
> 
> Steps to reproduce:
> 1. Load the driver and configure IPv6 address.
> 2. Run ethtool diag:
> ethtool -t eth0
> 
> 3. If this doesn't brake it try again, or just do ifdown/up. Other operations on the interface will eventually panic the system:

Stephen please fix this, thanks.

^ permalink raw reply

* Re: inet6_ifa_finish_destroy() blurt
From: David Miller @ 2010-03-24  6:33 UTC (permalink / raw)
  To: akpm; +Cc: netdev, shemminger
In-Reply-To: <20100323153520.3869ec5d.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-foundation.org>
Date: Tue, 23 Mar 2010 15:35:20 -0700

> 
> Got this during boot using today's linux-next.  The
> WARN_ON(!hlist_unhashed(&ifp->addr_lst)) triggered. 
> 
> c2e21293c054817c42eb5fa9c613d2ad51954136 ("ipv6: convert addrconf list
> to hlist") added it.

Stephen please look into this.

Thank you.

^ permalink raw reply

* [PATCH] skbuff: remove unused dma_head & dma_maps fields
From: Jeff Kirsher @ 2010-03-24  6:40 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Alexander Duyck, Jeff Kirsher

From: Alexander Duyck <alexander.h.duyck@intel.com>

The dma map fields in the skb_shared_info structure no longer has any users
and can be dropped since it is making the skb_shared_info unecessarily larger.

Running slabtop show that we were using 4K slabs for the skb->head on x86_64 w/
an allocation size of 1522.  It turns out that the dma_head and dma_maps array
made skb_shared large enough that we had crossed over the 2k boundary with
standard frames and as such we were using 4k blocks of memory for all skbs.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 include/linux/skbuff.h |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 03f816a..124f90c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -190,9 +190,6 @@ struct skb_shared_info {
 	atomic_t	dataref;
 	unsigned short	nr_frags;
 	unsigned short	gso_size;
-#ifdef CONFIG_HAS_DMA
-	dma_addr_t	dma_head;
-#endif
 	/* Warning: this field is not always filled in (UFO)! */
 	unsigned short	gso_segs;
 	unsigned short  gso_type;
@@ -201,9 +198,6 @@ struct skb_shared_info {
 	struct sk_buff	*frag_list;
 	struct skb_shared_hwtstamps hwtstamps;
 	skb_frag_t	frags[MAX_SKB_FRAGS];
-#ifdef CONFIG_HAS_DMA
-	dma_addr_t	dma_maps[MAX_SKB_FRAGS];
-#endif
 	/* Intermediate layers must ensure that destructor_arg
 	 * remains valid until skb destructor */
 	void *		destructor_arg;


^ permalink raw reply related

* Re: [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues
From: Eric Dumazet @ 2010-03-24  6:44 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: davem, netdev, gospo, Vasu Dev
In-Reply-To: <20100324004204.31609.55285.stgit@localhost.localdomain>

Le mardi 23 mars 2010 à 17:42 -0700, Jeff Kirsher a écrit :
> From: Vasu Dev <vasu.dev@intel.com>
> 
> Updates real_num_tx_queues in case underlying real device
> has changed real_num_tx_queues.
> 
> -v2
>  As per Eric Dumazet<eric.dumazet@gmail.com> comment:-
>    -- adds BUG_ON to catch case of real_num_tx_queues exceeding num_tx_queues.
>    -- created this self contained patch to just update real_num_tx_queues.
> 
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> 

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Thanks Jeff  and Vasu :)

>  net/8021q/vlan.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
> index 4535122..db783d7 100644
> --- a/net/8021q/vlan.c
> +++ b/net/8021q/vlan.c
> @@ -378,6 +378,8 @@ static void vlan_transfer_features(struct net_device *dev,
>  #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
>  	vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;
>  #endif
> +	vlandev->real_num_tx_queues = dev->real_num_tx_queues;
> +	BUG_ON(vlandev->real_num_tx_queues > vlandev->num_tx_queues);
>  
>  	if (old_features != vlandev->features)
>  		netdev_features_change(vlandev);
> 



^ permalink raw reply

* Re: [PATCH v2 1/2] vlan: adds vlan_dev_select_queue
From: Eric Dumazet @ 2010-03-24  6:45 UTC (permalink / raw)
  To: David Miller; +Cc: jeffrey.t.kirsher, netdev, gospo, vasu.dev
In-Reply-To: <20100323.233042.267394656.davem@davemloft.net>

Le mardi 23 mars 2010 à 23:30 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 24 Mar 2010 06:53:42 +0100
> 
> > Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> Eric are you now OK with patch #2 in this series as well?
> 

Absolutely, I feel better after a breakfirst :)

Thanks



^ permalink raw reply

* Re: [PATCH] skbuff: remove unused dma_head & dma_maps fields
From: Eric Dumazet @ 2010-03-24  6:48 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: davem, netdev, gospo, Alexander Duyck
In-Reply-To: <20100324064049.32298.87859.stgit@localhost.localdomain>

Le mardi 23 mars 2010 à 23:40 -0700, Jeff Kirsher a écrit :
> From: Alexander Duyck <alexander.h.duyck@intel.com>
> 
> The dma map fields in the skb_shared_info structure no longer has any users
> and can be dropped since it is making the skb_shared_info unecessarily larger.
> 
> Running slabtop show that we were using 4K slabs for the skb->head on x86_64 w/
> an allocation size of 1522.  It turns out that the dma_head and dma_maps array
> made skb_shared large enough that we had crossed over the 2k boundary with
> standard frames and as such we were using 4k blocks of memory for all skbs.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> 

Thanks a lot for doing this cleanup !

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>




^ permalink raw reply

* Re: [PATCH] netlink: use the appropriate namespace pid
From: Alexey Dobriyan @ 2010-03-24  7:58 UTC (permalink / raw)
  To: David Miller; +Cc: thomas.goff, netdev, adobriyan
In-Reply-To: <20100321.213022.22037430.davem@davemloft.net>

On Mon, Mar 22, 2010 at 6:30 AM, David Miller <davem@davemloft.net> wrote:
> From: Tom Goff <thomas.goff@boeing.com>
> Date: Fri, 19 Mar 2010 18:38:50 -0700
>
>> This was included in OpenVZ kernels but wasn't integrated upstream.
>>>From git://git.openvz.org/pub/linux-2.6.24-openvz:
>>
>>       commit 5c69402f18adf7276352e051ece2cf31feefab02
>>       Author: Alexey Dobriyan <adobriyan@openvz.org>
>>       Date:   Mon Dec 24 14:37:45 2007 +0300
>>
>>           netlink: fixup ->tgid to work in multiple PID namespaces
>>
>> Signed-off-by: Tom Goff <thomas.goff@boeing.com>
>
> Well, at least CC: the person whose patches your pushing
> around, maybe they had a reason to not include it?  The
> openvz guys have been extremely good about submitting
> their stuff so they deserve the benefit of the doubt.
>
> Alexey, can you review Tom's namespace patches in this
> set?

ACK tgid patch, should have sent it myself long ago.

^ permalink raw reply

* why not use the tcp_set_state() in inet_csk_listen_start()?
From: 杨硕 @ 2010-03-24  8:13 UTC (permalink / raw)
  To: netdev

why use "sk->sk_state = TCP_LISTEN" rather than "tcp_set_state(sk, TCP_LISTEN)"?

TIA :)

int inet_csk_listen_start(struct sock *sk, const int nr_table_entries)
{
	struct inet_sock *inet = inet_sk(sk);
	struct inet_connection_sock *icsk = inet_csk(sk);
	int rc = reqsk_queue_alloc(&icsk->icsk_accept_queue, nr_table_entries);

	if (rc != 0)
		return rc;

	sk->sk_max_ack_backlog = 0;
	sk->sk_ack_backlog = 0;
	inet_csk_delack_init(sk);

	/* There is race window here: we announce ourselves listening,
	 * but this transition is still not validated by get_port().
	 * It is OK, because this socket enters to hash table only
	 * after validation is complete.
	 */
	sk->sk_state = TCP_LISTEN;
	if (!sk->sk_prot->get_port(sk, inet->num)) {
		inet->sport = htons(inet->num);

		sk_dst_reset(sk);
		sk->sk_prot->hash(sk);

		return 0;
	}

	sk->sk_state = TCP_CLOSE;
	__reqsk_queue_destroy(&icsk->icsk_accept_queue);
	return -EADDRINUSE;
}

^ permalink raw reply

* Re: [PATCH] netlink: use the appropriate namespace pid
From: Alexey Dobriyan @ 2010-03-24  8:19 UTC (permalink / raw)
  To: David Miller; +Cc: thomas.goff, netdev, adobriyan
In-Reply-To: <b6fcc0a1003240058i524c95eere17c1349d14267b1@mail.gmail.com>

>> Alexey, can you review Tom's namespace patches in this
>> set?

re netns sched patch:

* in psched_open() PDE(inode)->data isn't needed because
  it isn't used -- just pass NULL.
* drop useless trailing return; in psched_net_exit() :^)
* sch_mirred.c still won't work in netns

^ permalink raw reply

* [PATCH 1/2] ixgbe: convert to use netdev_for_each_mc_addr
From: Jeff Kirsher @ 2010-03-24  8:58 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Jiri Pirko, Jeff Kirsher

From: Jiri Pirko <jpirko@redhat.com>

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/ixgbe/ixgbe_common.c |   16 +++++++---------
 drivers/net/ixgbe/ixgbe_common.h |    5 ++---
 drivers/net/ixgbe/ixgbe_main.c   |   24 ++----------------------
 drivers/net/ixgbe/ixgbe_type.h   |    3 +--
 4 files changed, 12 insertions(+), 36 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index eb49020..4d1c3a4 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -1484,26 +1484,24 @@ static void ixgbe_set_mta(struct ixgbe_hw *hw, u8 *mc_addr)
 /**
  *  ixgbe_update_mc_addr_list_generic - Updates MAC list of multicast addresses
  *  @hw: pointer to hardware structure
- *  @mc_addr_list: the list of new multicast addresses
- *  @mc_addr_count: number of addresses
- *  @next: iterator function to walk the multicast address list
+ *  @netdev: pointer to net device structure
  *
  *  The given list replaces any existing list. Clears the MC addrs from receive
  *  address registers and the multicast table. Uses unused receive address
  *  registers for the first multicast addresses, and hashes the rest into the
  *  multicast table.
  **/
-s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
-                                      u32 mc_addr_count, ixgbe_mc_addr_itr next)
+s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw,
+				      struct net_device *netdev)
 {
+	struct dev_addr_list *dmi;
 	u32 i;
-	u32 vmdq;
 
 	/*
 	 * Set the new number of MC addresses that we are being requested to
 	 * use.
 	 */
-	hw->addr_ctrl.num_mc_addrs = mc_addr_count;
+	hw->addr_ctrl.num_mc_addrs = netdev_mc_count(netdev);
 	hw->addr_ctrl.mta_in_use = 0;
 
 	/* Clear the MTA */
@@ -1512,9 +1510,9 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
 		IXGBE_WRITE_REG(hw, IXGBE_MTA(i), 0);
 
 	/* Add the new addresses */
-	for (i = 0; i < mc_addr_count; i++) {
+	netdev_for_each_mc_addr(dmi, netdev) {
 		hw_dbg(hw, " Adding the multicast addresses:\n");
-		ixgbe_set_mta(hw, next(hw, &mc_addr_list, &vmdq));
+		ixgbe_set_mta(hw, dmi->dmi_addr);
 	}
 
 	/* Enable mta */
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index 13606d4..264eef5 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -56,9 +56,8 @@ s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
                           u32 enable_addr);
 s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index);
 s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw);
-s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
-                                      u32 mc_addr_count,
-                                      ixgbe_mc_addr_itr func);
+s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw,
+				      struct net_device *netdev);
 s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
 				      struct net_device *netdev);
 s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw);
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index d75c46f..90565d8 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2537,21 +2537,6 @@ static void ixgbe_restore_vlan(struct ixgbe_adapter *adapter)
 	}
 }
 
-static u8 *ixgbe_addr_list_itr(struct ixgbe_hw *hw, u8 **mc_addr_ptr, u32 *vmdq)
-{
-	struct dev_mc_list *mc_ptr;
-	u8 *addr = *mc_addr_ptr;
-	*vmdq = 0;
-
-	mc_ptr = container_of(addr, struct dev_mc_list, dmi_addr[0]);
-	if (mc_ptr->next)
-		*mc_addr_ptr = mc_ptr->next->dmi_addr;
-	else
-		*mc_addr_ptr = NULL;
-
-	return addr;
-}
-
 /**
  * ixgbe_set_rx_mode - Unicast, Multicast and Promiscuous mode set
  * @netdev: network interface device structure
@@ -2566,8 +2551,6 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
 	struct ixgbe_adapter *adapter = netdev_priv(netdev);
 	struct ixgbe_hw *hw = &adapter->hw;
 	u32 fctrl, vlnctrl;
-	u8 *addr_list = NULL;
-	int addr_count = 0;
 
 	/* Check for Promiscuous and All Multicast modes */
 
@@ -2596,11 +2579,8 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
 	hw->mac.ops.update_uc_addr_list(hw, netdev);
 
 	/* reprogram multicast list */
-	addr_count = netdev_mc_count(netdev);
-	if (addr_count)
-		addr_list = netdev->mc_list->dmi_addr;
-	hw->mac.ops.update_mc_addr_list(hw, addr_list, addr_count,
-	                                ixgbe_addr_list_itr);
+	hw->mac.ops.update_mc_addr_list(hw, netdev);
+
 	if (adapter->num_vfs)
 		ixgbe_restore_vf_multicasts(adapter);
 }
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 0ed5ab3..c574d0a 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -2416,8 +2416,7 @@ struct ixgbe_mac_operations {
 	s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32);
 	s32 (*init_rx_addrs)(struct ixgbe_hw *);
 	s32 (*update_uc_addr_list)(struct ixgbe_hw *, struct net_device *);
-	s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32,
-	                           ixgbe_mc_addr_itr);
+	s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *);
 	s32 (*enable_mc)(struct ixgbe_hw *);
 	s32 (*disable_mc)(struct ixgbe_hw *);
 	s32 (*clear_vfta)(struct ixgbe_hw *);


^ permalink raw reply related

* [PATCH 2/2] ixgbevf: convert to use netdev_for_each_mc_addr
From: Jeff Kirsher @ 2010-03-24  8:58 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Jiri Pirko, Jeff Kirsher
In-Reply-To: <20100324085733.32706.70587.stgit@localhost.localdomain>

From: Jiri Pirko <jpirko@redhat.com>

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/ixgbevf/ixgbevf_main.c |   24 +-----------------------
 drivers/net/ixgbevf/vf.c           |   24 ++++++++++++------------
 drivers/net/ixgbevf/vf.h           |    4 ++--
 3 files changed, 15 insertions(+), 37 deletions(-)

diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
index d6cbd94..9aaebd3 100644
--- a/drivers/net/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ixgbevf/ixgbevf_main.c
@@ -1495,22 +1495,6 @@ static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter)
 	}
 }
 
-static u8 *ixgbevf_addr_list_itr(struct ixgbe_hw *hw, u8 **mc_addr_ptr,
-				 u32 *vmdq)
-{
-	struct dev_mc_list *mc_ptr;
-	u8 *addr = *mc_addr_ptr;
-	*vmdq = 0;
-
-	mc_ptr = container_of(addr, struct dev_mc_list, dmi_addr[0]);
-	if (mc_ptr->next)
-		*mc_addr_ptr = mc_ptr->next->dmi_addr;
-	else
-		*mc_addr_ptr = NULL;
-
-	return addr;
-}
-
 /**
  * ixgbevf_set_rx_mode - Multicast set
  * @netdev: network interface device structure
@@ -1523,16 +1507,10 @@ static void ixgbevf_set_rx_mode(struct net_device *netdev)
 {
 	struct ixgbevf_adapter *adapter = netdev_priv(netdev);
 	struct ixgbe_hw *hw = &adapter->hw;
-	u8 *addr_list = NULL;
-	int addr_count = 0;
 
 	/* reprogram multicast list */
-	addr_count = netdev_mc_count(netdev);
-	if (addr_count)
-		addr_list = netdev->mc_list->dmi_addr;
 	if (hw->mac.ops.update_mc_addr_list)
-		hw->mac.ops.update_mc_addr_list(hw, addr_list, addr_count,
-						ixgbevf_addr_list_itr);
+		hw->mac.ops.update_mc_addr_list(hw, netdev);
 }
 
 static void ixgbevf_napi_enable_all(struct ixgbevf_adapter *adapter)
diff --git a/drivers/net/ixgbevf/vf.c b/drivers/net/ixgbevf/vf.c
index 4b5dec0..f457c52 100644
--- a/drivers/net/ixgbevf/vf.c
+++ b/drivers/net/ixgbevf/vf.c
@@ -252,22 +252,18 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
 /**
  *  ixgbevf_update_mc_addr_list_vf - Update Multicast addresses
  *  @hw: pointer to the HW structure
- *  @mc_addr_list: array of multicast addresses to program
- *  @mc_addr_count: number of multicast addresses to program
- *  @next: caller supplied function to return next address in list
+ *  @netdev: pointer to net device structure
  *
  *  Updates the Multicast Table Array.
  **/
-static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
-					u32 mc_addr_count,
-					ixgbe_mc_addr_itr next)
+static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
+					  struct net_device *netdev)
 {
+	struct dev_addr_list *dmi;
 	struct ixgbe_mbx_info *mbx = &hw->mbx;
 	u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
 	u16 *vector_list = (u16 *)&msgbuf[1];
-	u32 vector;
 	u32 cnt, i;
-	u32 vmdq;
 
 	/* Each entry in the list uses 1 16 bit word.  We have 30
 	 * 16 bit words available in our HW msg buffer (minus 1 for the
@@ -278,13 +274,17 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
 	 * addresses except for in large enterprise network environments.
 	 */
 
-	cnt = (mc_addr_count > 30) ? 30 : mc_addr_count;
+	cnt = netdev_mc_count(netdev);
+	if (cnt > 30)
+		cnt = 30;
 	msgbuf[0] = IXGBE_VF_SET_MULTICAST;
 	msgbuf[0] |= cnt << IXGBE_VT_MSGINFO_SHIFT;
 
-	for (i = 0; i < cnt; i++) {
-		vector = ixgbevf_mta_vector(hw, next(hw, &mc_addr_list, &vmdq));
-		vector_list[i] = vector;
+	i = 0;
+	netdev_for_each_mc_addr(dmi, netdev) {
+		if (i == cnt)
+			break;
+		vector_list[i++] = ixgbevf_mta_vector(hw, dmi->dmi_addr);
 	}
 
 	mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE);
diff --git a/drivers/net/ixgbevf/vf.h b/drivers/net/ixgbevf/vf.h
index 1f31b05..94b750b 100644
--- a/drivers/net/ixgbevf/vf.h
+++ b/drivers/net/ixgbevf/vf.h
@@ -32,6 +32,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/if_ether.h>
+#include <linux/netdevice.h>
 
 #include "defines.h"
 #include "regs.h"
@@ -62,8 +63,7 @@ struct ixgbe_mac_operations {
 	/* RAR, Multicast, VLAN */
 	s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32);
 	s32 (*init_rx_addrs)(struct ixgbe_hw *);
-	s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32,
-				   ixgbe_mc_addr_itr);
+	s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *);
 	s32 (*enable_mc)(struct ixgbe_hw *);
 	s32 (*disable_mc)(struct ixgbe_hw *);
 	s32 (*clear_vfta)(struct ixgbe_hw *);


^ permalink raw reply related

* Re: why not use the tcp_set_state() in inet_csk_listen_start()?
From: Eric Dumazet @ 2010-03-24  9:02 UTC (permalink / raw)
  To: 杨硕; +Cc: netdev
In-Reply-To: <ffe582101003240113i15c48ff2g850bb209c825b11c@mail.gmail.com>

Le mercredi 24 mars 2010 à 16:13 +0800, 杨硕 a écrit :
> why use "sk->sk_state = TCP_LISTEN" rather than "tcp_set_state(sk, TCP_LISTEN)"?
> 
> TIA :)
> 
> int inet_csk_listen_start(struct sock *sk, const int nr_table_entries)
> {
> 	struct inet_sock *inet = inet_sk(sk);
> 	struct inet_connection_sock *icsk = inet_csk(sk);
> 	int rc = reqsk_queue_alloc(&icsk->icsk_accept_queue, nr_table_entries);
> 
> 	if (rc != 0)
> 		return rc;
> 
> 	sk->sk_max_ack_backlog = 0;
> 	sk->sk_ack_backlog = 0;
> 	inet_csk_delack_init(sk);
> 
> 	/* There is race window here: we announce ourselves listening,
> 	 * but this transition is still not validated by get_port().
> 	 * It is OK, because this socket enters to hash table only
> 	 * after validation is complete.
> 	 */
> 	sk->sk_state = TCP_LISTEN;

Because its not necessary ?

tcp_set_state() takes care of particular state transitions.

In case of inet_csk_listen_start(), old state is TCP_CLOSE, so there is
nothing special to do in tcp_set_state().




^ permalink raw reply

* [patch] af_key: return error if pfkey_xfrm_policy2msg_prep() fails
From: Dan Carpenter @ 2010-03-24 11:47 UTC (permalink / raw)
  To: netdev
  Cc: Jamal Hadi Salim, David S. Miller, Eric Dumazet,
	Stephen Hemminger, Alexey Dobriyan, kernel-janitors

The original code saved the error value but just returned 0 in the end.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 3687078..344145f 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2129,10 +2129,9 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
 	int err;
 
 	out_skb = pfkey_xfrm_policy2msg_prep(xp);
-	if (IS_ERR(out_skb)) {
-		err = PTR_ERR(out_skb);
-		goto out;
-	}
+	if (IS_ERR(out_skb))
+		return PTR_ERR(out_skb);
+
 	err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
 	if (err < 0)
 		return err;
@@ -2148,7 +2147,6 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
 	out_hdr->sadb_msg_seq = c->seq;
 	out_hdr->sadb_msg_pid = c->pid;
 	pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xp_net(xp));
-out:
 	return 0;
 
 }

^ permalink raw reply related

* [patch] llc: cleanup: remove dead code from llc_init()
From: Dan Carpenter @ 2010-03-24 11:55 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: David S. Miller, Octavian Purdila, netdev, kernel-janitors

We don't need "dev" any more after:
	a5a04819c5740cb1aa217af2cc8f5ef26f33d744
	[LLC]: station source mac address

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c
index 78167e8..2bb0ddf 100644
--- a/net/llc/llc_core.c
+++ b/net/llc/llc_core.c
@@ -144,12 +144,6 @@ static struct packet_type llc_tr_packet_type __read_mostly = {
 
 static int __init llc_init(void)
 {
-	struct net_device *dev;
-
-	dev = first_net_device(&init_net);
-	if (dev != NULL)
-		dev = next_net_device(dev);
-
 	dev_add_pack(&llc_packet_type);
 	dev_add_pack(&llc_tr_packet_type);
 	return 0;

^ permalink raw reply related

* [patch] wimax: remove unneeded variable
From: Dan Carpenter @ 2010-03-24 11:56 UTC (permalink / raw)
  To: netdev
  Cc: André Goddard Rosa, David S. Miller, Alexey Dobriyan,
	Jiri Kosina, kernel-janitors

We never actually use "dev" so I removed it.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/wimax/op-reset.c b/net/wimax/op-reset.c
index 4dc82a5..68bedf3 100644
--- a/net/wimax/op-reset.c
+++ b/net/wimax/op-reset.c
@@ -110,7 +110,6 @@ int wimax_gnl_doit_reset(struct sk_buff *skb, struct genl_info *info)
 {
 	int result, ifindex;
 	struct wimax_dev *wimax_dev;
-	struct device *dev;
 
 	d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
 	result = -ENODEV;
@@ -123,7 +122,6 @@ int wimax_gnl_doit_reset(struct sk_buff *skb, struct genl_info *info)
 	wimax_dev = wimax_dev_get_by_genl_info(info, ifindex);
 	if (wimax_dev == NULL)
 		goto error_no_wimax_dev;
-	dev = wimax_dev_to_dev(wimax_dev);
 	/* Execute the operation and send the result back to user space */
 	result = wimax_reset(wimax_dev);
 	dev_put(wimax_dev->net_dev);
diff --git a/net/wimax/op-state-get.c b/net/wimax/op-state-get.c
index 11ad335..aff8776 100644
--- a/net/wimax/op-state-get.c
+++ b/net/wimax/op-state-get.c
@@ -53,7 +53,6 @@ int wimax_gnl_doit_state_get(struct sk_buff *skb, struct genl_info *info)
 {
 	int result, ifindex;
 	struct wimax_dev *wimax_dev;
-	struct device *dev;
 
 	d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
 	result = -ENODEV;
@@ -66,7 +65,6 @@ int wimax_gnl_doit_state_get(struct sk_buff *skb, struct genl_info *info)
 	wimax_dev = wimax_dev_get_by_genl_info(info, ifindex);
 	if (wimax_dev == NULL)
 		goto error_no_wimax_dev;
-	dev = wimax_dev_to_dev(wimax_dev);
 	/* Execute the operation and send the result back to user space */
 	result = wimax_state_get(wimax_dev);
 	dev_put(wimax_dev->net_dev);

^ permalink raw reply related

* [patch] mac80211: remove unneed variable from ieee80211_tx_pending()
From: Dan Carpenter @ 2010-03-24 11:56 UTC (permalink / raw)
  To: Johannes Berg
  Cc: John W. Linville, David S. Miller, Luis R. Rodriguez, Kalle Valo,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

We don't need "sdata" any more after:
	d84f323477260e773d5317ad7cbe50f76115cb47
	mac80211: remove dev_hold/put calls

Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index cbe53ed..08e1f17 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2010,14 +2010,12 @@ void ieee80211_tx_pending(unsigned long data)
 		while (!skb_queue_empty(&local->pending[i])) {
 			struct sk_buff *skb = __skb_dequeue(&local->pending[i]);
 			struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-			struct ieee80211_sub_if_data *sdata;
 
 			if (WARN_ON(!info->control.vif)) {
 				kfree_skb(skb);
 				continue;
 			}
 
-			sdata = vif_to_sdata(info->control.vif);
 			spin_unlock_irqrestore(&local->queue_stop_reason_lock,
 						flags);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [patch] rds: cleanup: remove unneeded variable
From: Dan Carpenter @ 2010-03-24 11:57 UTC (permalink / raw)
  To: Andy Grover
  Cc: David S. Miller, Stephen Hemminger, Alexey Dobriyan, Eric Paris,
	rds-devel, netdev, kernel-janitors

We never use "sk" so this patch removes it.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index 853c52b..9abc825 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -446,7 +446,6 @@ static void rds_sock_inc_info(struct socket *sock, unsigned int len,
 			      struct rds_info_lengths *lens)
 {
 	struct rds_sock *rs;
-	struct sock *sk;
 	struct rds_incoming *inc;
 	unsigned long flags;
 	unsigned int total = 0;
@@ -456,7 +455,6 @@ static void rds_sock_inc_info(struct socket *sock, unsigned int len,
 	spin_lock_irqsave(&rds_sock_lock, flags);
 
 	list_for_each_entry(rs, &rds_sock_list, rs_item) {
-		sk = rds_rs_to_sk(rs);
 		read_lock(&rs->rs_recv_lock);
 
 		/* XXX too lazy to maintain counts.. */

^ permalink raw reply related

* [iproute2]  tc pedit   modify  ethhdr ?
From: Xiaofei Wu @ 2010-03-24 12:31 UTC (permalink / raw)
  To: stephen.hemminger; +Cc: hadi, linux netdev

Hi all,

I want to modify  a packet's   h_dest and h_source in  structethhdr { } .

in   tc / m_pedit.c
------

36 explain(void)
37 {
38         fprintf(stderr, "Usage: ... pedit munge <MUNGE>\n");
39         fprintf(stderr,
40                 "Where: MUNGE := <RAW>|<LAYERED>\n"
41                 "\t<RAW>:= <OFFSETC>[ATC]<CMD>\n "
42                 "\t\tOFFSETC:= offset <offval> <u8|u16|u32>\n "
43                 "\t\tATC:= at <atval> offmask <maskval> shift <shiftval>\n "
44                 "\t\tNOTE: offval is byte offset, must be multiple of 4\n "
45                 "\t\tNOTE: maskval is a 32 bit hex number\n "
46                 "\t\tNOTE: shiftval is a is a shift value\n "
47                 "\t\tCMD:= clear | invert | set <setval>| retain\n "
48                 "\t<LAYERED>:= ip <ipdata> | ip6 <ip6data> \n "
49                 " \t\t| udp <udpdata> | tcp <tcpdata> | icmp <icmpdata> \n"
50                 "For Example usage look at the examples directory\n");
51 
52 }
------

OFFSETC:= offset <offval> <u8|u16|u32>
NOTE: offval is byte offset, must be multiple of 4

but the size of ethhdr is 14 bytes, 14 is not multiple of 4 .
How to use 'tc ... pedit ...'  modify  a packet's   h_dest and h_source 
of ethhdr ?
Use ' ... pedit munge offset -14 u16 set 0x0090 munge offset -12 u32 set 0x9600030a ... '   or 
use ' ... pedit munge offset -16 u32 ... munge offset -12  ... '  ?


--
Wu


      


^ permalink raw reply

* [PATCH 3/8] netxen: validate unified romimage
From: Amit Kumar Salecha @ 2010-03-24 13:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, Rajesh K Borundia
In-Reply-To: <1269437363-2606-1-git-send-email-amit.salecha@qlogic.com>

From: Rajesh K Borundia <rajesh.borundia@qlogic.com>

Signed-off-by: Rajesh K Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>

o Validate all sections of unified romimage, before accessing them,
  to avoid seg fault.
o fix __le32 usage, use only where appropriate.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/netxen/netxen_nic.h      |    1 -
 drivers/net/netxen/netxen_nic_init.c |  163 ++++++++++++++++++++++++++++++----
 2 files changed, 145 insertions(+), 19 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 144d2e8..33ae5e1 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -420,7 +420,6 @@ struct status_desc {
 } __attribute__ ((aligned(16)));
 
 /* UNIFIED ROMIMAGE *************************/
-#define NX_UNI_FW_MIN_SIZE		0xc8000
 #define NX_UNI_DIR_SECT_PRODUCT_TBL	0x0
 #define NX_UNI_DIR_SECT_BOOTLD		0x6
 #define NX_UNI_DIR_SECT_FW		0x7
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 1c63610..80a99a0 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -602,7 +602,7 @@ static struct uni_table_desc *nx_get_table_desc(const u8 *unirom, int section)
 
 	for (i = 0; i < entries; i++) {
 
-		__le32 offs = cpu_to_le32(directory->findex) +
+		u32 offs = cpu_to_le32(directory->findex) +
 				(i * cpu_to_le32(directory->entry_size));
 		__le32 tab_type = cpu_to_le32(*((u32 *)&unirom[offs] + 8));
 
@@ -613,27 +613,129 @@ static struct uni_table_desc *nx_get_table_desc(const u8 *unirom, int section)
 	return NULL;
 }
 
+#define	QLCNIC_FILEHEADER_SIZE	(14 * 4)
+
 static int
-nx_set_product_offs(struct netxen_adapter *adapter)
-{
-	struct uni_table_desc *ptab_descr;
+netxen_nic_validate_header(struct netxen_adapter *adapter)
+ {
 	const u8 *unirom = adapter->fw->data;
-	uint32_t i;
+	struct uni_table_desc *directory = (struct uni_table_desc *) &unirom[0];
+	u32 fw_file_size = adapter->fw->size;
+	u32 tab_size;
 	__le32 entries;
+	__le32 entry_size;
+
+	if (fw_file_size < QLCNIC_FILEHEADER_SIZE)
+		return -EINVAL;
+
+	entries = cpu_to_le32(directory->num_entries);
+	entry_size = cpu_to_le32(directory->entry_size);
+	tab_size = cpu_to_le32(directory->findex) + (entries * entry_size);
+
+	if (fw_file_size < tab_size)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int
+netxen_nic_validate_bootld(struct netxen_adapter *adapter)
+{
+	struct uni_table_desc *tab_desc;
+	struct uni_data_desc *descr;
+	const u8 *unirom = adapter->fw->data;
+	__le32 idx = cpu_to_le32(*((int *)&unirom[adapter->file_prd_off] +
+				NX_UNI_BOOTLD_IDX_OFF));
+	u32 offs;
+	u32 tab_size;
+	u32 data_size;
+
+	tab_desc = nx_get_table_desc(unirom, NX_UNI_DIR_SECT_BOOTLD);
+
+	if (!tab_desc)
+		return -EINVAL;
 
+	tab_size = cpu_to_le32(tab_desc->findex) +
+			(cpu_to_le32(tab_desc->entry_size) * (idx + 1));
+
+	if (adapter->fw->size < tab_size)
+		return -EINVAL;
+
+	offs = cpu_to_le32(tab_desc->findex) +
+		(cpu_to_le32(tab_desc->entry_size) * (idx));
+	descr = (struct uni_data_desc *)&unirom[offs];
+
+	data_size = cpu_to_le32(descr->findex) + cpu_to_le32(descr->size);
+
+	if (adapter->fw->size < data_size)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int
+netxen_nic_validate_fw(struct netxen_adapter *adapter)
+{
+	struct uni_table_desc *tab_desc;
+	struct uni_data_desc *descr;
+	const u8 *unirom = adapter->fw->data;
+	__le32 idx = cpu_to_le32(*((int *)&unirom[adapter->file_prd_off] +
+				NX_UNI_FIRMWARE_IDX_OFF));
+	u32 offs;
+	u32 tab_size;
+	u32 data_size;
+
+	tab_desc = nx_get_table_desc(unirom, NX_UNI_DIR_SECT_FW);
+
+	if (!tab_desc)
+		return -EINVAL;
+
+	tab_size = cpu_to_le32(tab_desc->findex) +
+			(cpu_to_le32(tab_desc->entry_size) * (idx + 1));
+
+	if (adapter->fw->size < tab_size)
+		return -EINVAL;
+
+	offs = cpu_to_le32(tab_desc->findex) +
+		(cpu_to_le32(tab_desc->entry_size) * (idx));
+	descr = (struct uni_data_desc *)&unirom[offs];
+	data_size = cpu_to_le32(descr->findex) + cpu_to_le32(descr->size);
+
+	if (adapter->fw->size < data_size)
+		return -EINVAL;
+
+	return 0;
+}
+
+
+static int
+netxen_nic_validate_product_offs(struct netxen_adapter *adapter)
+{
+	struct uni_table_desc *ptab_descr;
+	const u8 *unirom = adapter->fw->data;
 	int mn_present = (NX_IS_REVISION_P2(adapter->ahw.revision_id)) ?
 			1 : netxen_p3_has_mn(adapter);
+	__le32 entries;
+	__le32 entry_size;
+	u32 tab_size;
+	u32 i;
 
 	ptab_descr = nx_get_table_desc(unirom, NX_UNI_DIR_SECT_PRODUCT_TBL);
-	if (ptab_descr == NULL)
-		return -1;
+	if (!ptab_descr)
+		return -EINVAL;
 
 	entries = cpu_to_le32(ptab_descr->num_entries);
+	entry_size = cpu_to_le32(ptab_descr->entry_size);
+	tab_size = cpu_to_le32(ptab_descr->findex) + (entries * entry_size);
+
+	if (adapter->fw->size < tab_size)
+		return -EINVAL;
 
 nomn:
 	for (i = 0; i < entries; i++) {
 
-		__le32 flags, file_chiprev, offs;
+		__le32 flags, file_chiprev;
+		u32 offs;
 		u8 chiprev = adapter->ahw.revision_id;
 		uint32_t flagbit;
 
@@ -657,9 +759,38 @@ nomn:
 		goto nomn;
 	}
 
-	return -1;
+	return -EINVAL;
 }
 
+static int
+netxen_nic_validate_unified_romimage(struct netxen_adapter *adapter)
+{
+	if (netxen_nic_validate_header(adapter)) {
+		dev_err(&adapter->pdev->dev,
+				"unified image: header validation failed\n");
+		return -EINVAL;
+	}
+
+	if (netxen_nic_validate_product_offs(adapter)) {
+		dev_err(&adapter->pdev->dev,
+				"unified image: product validation failed\n");
+		return -EINVAL;
+	}
+
+	if (netxen_nic_validate_bootld(adapter)) {
+		dev_err(&adapter->pdev->dev,
+				"unified image: bootld validation failed\n");
+		return -EINVAL;
+	}
+
+	if (netxen_nic_validate_fw(adapter)) {
+		dev_err(&adapter->pdev->dev,
+				"unified image: firmware validation failed\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
 
 static struct uni_data_desc *nx_get_data_desc(struct netxen_adapter *adapter,
 			u32 section, u32 idx_offset)
@@ -668,7 +799,7 @@ static struct uni_data_desc *nx_get_data_desc(struct netxen_adapter *adapter,
 	int idx = cpu_to_le32(*((int *)&unirom[adapter->file_prd_off] +
 								idx_offset));
 	struct uni_table_desc *tab_desc;
-	__le32 offs;
+	u32 offs;
 
 	tab_desc = nx_get_table_desc(unirom, section);
 
@@ -933,27 +1064,23 @@ static int
 netxen_validate_firmware(struct netxen_adapter *adapter)
 {
 	__le32 val;
-	u32 ver, min_ver, bios, min_size;
+	u32 ver, min_ver, bios;
 	struct pci_dev *pdev = adapter->pdev;
 	const struct firmware *fw = adapter->fw;
 	u8 fw_type = adapter->fw_type;
 
 	if (fw_type == NX_UNIFIED_ROMIMAGE) {
-		if (nx_set_product_offs(adapter))
+		if (netxen_nic_validate_unified_romimage(adapter))
 			return -EINVAL;
-
-		min_size = NX_UNI_FW_MIN_SIZE;
 	} else {
 		val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_MAGIC_OFFSET]);
 		if ((__force u32)val != NETXEN_BDINFO_MAGIC)
 			return -EINVAL;
 
-		min_size = NX_FW_MIN_SIZE;
+		if (fw->size < NX_FW_MIN_SIZE)
+			return -EINVAL;
 	}
 
-	if (fw->size < min_size)
-		return -EINVAL;
-
 	val = nx_get_fw_version(adapter);
 
 	if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
-- 
1.6.0.2


^ permalink raw reply related

* [PATCH 0/8]netxen: Validate and fix fw load
From: Amit Kumar Salecha @ 2010-03-24 13:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman

Hi,
  Series of 8 patches to validate and fix fw load from file and
  minor bug fixes.
 
-Amit Salecha 

^ permalink raw reply

* [PATCH 2/8] netxen: fix corner cases of firmware recovery
From: Amit Kumar Salecha @ 2010-03-24 13:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman
In-Reply-To: <1269437363-2606-1-git-send-email-amit.salecha@qlogic.com>

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>

o DEV_NEED_RESET state was not handled during fw intialization phase.
o nx_decr_dev_ref_cnt() can return error, if fail to grab pcie seamphore.
---
 drivers/net/netxen/netxen_nic_main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 9a7a0f3..4c9caea 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -2294,6 +2294,7 @@ netxen_fwinit_work(struct work_struct *work)
 		}
 		break;
 
+	case NX_DEV_NEED_RESET:
 	case NX_DEV_INITALIZING:
 		if (++adapter->fw_wait_cnt < FW_POLL_THRESH) {
 			netxen_schedule_work(adapter,
@@ -2337,6 +2338,9 @@ netxen_detach_work(struct work_struct *work)
 
 	ref_cnt = nx_decr_dev_ref_cnt(adapter);
 
+	if (ref_cnt == -EIO)
+		goto err_ret;
+
 	delay = (ref_cnt == 0) ? 0 : (2 * FW_POLL_DELAY);
 
 	adapter->fw_wait_cnt = 0;
-- 
1.6.0.2


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox