Netdev List
 help / color / mirror / Atom feed
* [net-next PATCH 00/17] fib_trie: Reduce time spent in fib_table_lookup by 35 to 75%
From: Alexander Duyck @ 2014-12-31 18:55 UTC (permalink / raw)
  To: netdev

These patches are meant to address several performance issues I have seen 
in the fib_trie implementation, and fib_table_lookup specifically.  With 
these changes in place I have seen a reduction of up to 35 to 75% for the 
total time spent in fib_table_lookup depending on the type of search being 
performed.

On a VM running in my Corei7-4930K system with a trie of maximum depth of 7 
this resulted in a reduction of over 370ns per packet in the total time to 
process packets received from an ixgbe interface and route them to a dummy 
interface.  This represents a failed lookup in the local trie followed by 
a successful search in the main trie.

				Baseline	Refactor
  ixgbe->dummy routing		1.20Mpps	2.21Mpps
  ------------------------------------------------------------
  processing time per packet		835ns		453ns
  fib_table_lookup		50.1%	418ns	25.0%	113ns
  check_leaf.isra.9		 7.9%	 66ns	   --	 --
  ixgbe_clean_rx_irq		 5.3%	 44ns	 9.8%	 44ns
  ip_route_input_noref		 2.9%	 25ns	 4.6%	 21ns
  pvclock_clocksource_read	 2.6%	 21ns	 4.6%	 21ns
  ip_rcv			 2.6%	 22ns	 4.0%	 18ns

In the simple case of receiving a frame and dropping it before it can reach 
the socket layer I saw a reduction of 40ns per packet.  This represents a 
trip through the local trie with the correct leaf found with no need for 
any backtracing.

				Baseline	Refactor
  ixgbe->local receive		2.65Mpps	2.96Mpps
  ------------------------------------------------------------
  processing time per packet		377ns		337ns
  fib_table_lookup		25.1%	 95ns	25.8%	 87ns
  ixgbe_clean_rx_irq		 8.7%	 33ns	 9.0%	 30ns
  check_leaf.isra.9		 7.2%	 27ns	   --	 --
  ip_rcv			 5.7%	 21ns	 6.5%	 22ns

These changes have resulted in several functions being inlined such as 
check_leaf and fib_find_node, but due to the code simplification the 
overall size of the code has been reduced.

   text	   data	    bss	    dec	    hex	filename
  16932	    376	     16	  17324	   43ac	net/ipv4/fib_trie.o - before
  15259	    376	      8	  15643	   3d1b	net/ipv4/fib_trie.o - after

Changes since RFC:
  Replaced this_cpu_ptr with correct call to this_cpu_inc in patch 1
  Changed test for leaf_info mismatch to (key ^ n->key) & li->mask_plen in patch 10
  
---

Alexander Duyck (17):
      fib_trie: Update usage stats to be percpu instead of global variables
      fib_trie: Make leaf and tnode more uniform
      fib_trie: Merge tnode_free and leaf_free into node_free
      fib_trie: Merge leaf into tnode
      fib_trie: Optimize fib_table_lookup to avoid wasting time on loops/variables
      fib_trie: Optimize fib_find_node
      fib_trie: Optimize fib_table_insert
      fib_trie: Update meaning of pos to represent unchecked bits
      fib_trie: Use unsigned long for anything dealing with a shift by bits
      fib_trie: Push rcu_read_lock/unlock to callers
      fib_trie: Move resize to after inflate/halve
      fib_trie: Add functions should_inflate and should_halve
      fib_trie: Push assignment of child to parent down into inflate/halve
      fib_trie: Push tnode flushing down to inflate/halve
      fib_trie: inflate/halve nodes in a more RCU friendly way
      fib_trie: Remove checks for index >= tnode_child_length from tnode_get_child
      fib_trie: Add tracking value for suffix length


 include/net/ip_fib.h    |   50 +
 net/ipv4/fib_frontend.c |   29 -
 net/ipv4/fib_rules.c    |   22 -
 net/ipv4/fib_trie.c     | 1916 ++++++++++++++++++++++-------------------------
 4 files changed, 946 insertions(+), 1071 deletions(-)

--
Signature

^ permalink raw reply

* Re: [PATCH net-next v2 1/2] bridge: new attribute and flags to represent vlan info lists and ranges
From: Jeremiah Mahler @ 2014-12-31 18:48 UTC (permalink / raw)
  To: roopa; +Cc: netdev, shemminger, vyasevic, sfeldma, wkok
In-Reply-To: <54A43D59.1080304@cumulusnetworks.com>

Roopa,

On Wed, Dec 31, 2014 at 10:15:53AM -0800, roopa wrote:
> On 12/31/14, 9:45 AM, Jeremiah Mahler wrote:
> >Roopa,
> >
> >On Wed, Dec 31, 2014 at 08:48:52AM -0800, roopa@cumulusnetworks.com wrote:
> >>From: Roopa Prabhu <roopa@cumulusnetworks.com>
> >>
> >>This patch adds (as suggested by scott feldman),
> >>         - new netlink attribute IFLA_BRIDGE_VLAN_INFO_LIST to represent
> >>           vlan list
> >>         - And bridge_vlan_info flags BRIDGE_VLAN_INFO_RANGE_START and
> >>           BRIDGE_VLAN_INFO_RANGE_END to indicate start and end of vlan range
> >>
> >>Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> >>---
> >>  include/uapi/linux/if_bridge.h |    4 ++++
> >>  net/bridge/br_netlink.c        |    1 +
> >>  2 files changed, 5 insertions(+)
> >>
> >>diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
> >>index b03ee8f..fa468aa 100644
> >>--- a/include/uapi/linux/if_bridge.h
> >>+++ b/include/uapi/linux/if_bridge.h
> >>@@ -112,12 +112,14 @@ struct __fdb_entry {
> >>   *     [IFLA_BRIDGE_FLAGS]
> >>   *     [IFLA_BRIDGE_MODE]
> >>   *     [IFLA_BRIDGE_VLAN_INFO]
> >>+ *     [IFLA_BRIDGE_VLAN_INFO_LIST]
> >>   * }
> >>   */
> >>  enum {
> >>  	IFLA_BRIDGE_FLAGS,
> >>  	IFLA_BRIDGE_MODE,
> >>  	IFLA_BRIDGE_VLAN_INFO,
> >>+	IFLA_BRIDGE_VLAN_INFO_LIST,
> >>  	__IFLA_BRIDGE_MAX,
> >>  };
> >>  #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
> >>@@ -125,6 +127,8 @@ enum {
> >>  #define BRIDGE_VLAN_INFO_MASTER	(1<<0)	/* Operate on Bridge device as well */
> >>  #define BRIDGE_VLAN_INFO_PVID	(1<<1)	/* VLAN is PVID, ingress untagged */
> >>  #define BRIDGE_VLAN_INFO_UNTAGGED	(1<<2)	/* VLAN egresses untagged */
> >>+#define BRIDGE_VLAN_INFO_RANGE_START	(1<<3) /* VLAN is start of vlan range */
> >>+#define BRIDGE_VLAN_INFO_RANGE_END	(1<<4) /* VLAN is end of vlan range */
> >You add these here but you don't use them until the next patch.
> >If they were wrong a bisect would point to the next patch.
> >
> >I would add them in the next patch where you start to use them.
> I thought it was ok to declare it first and use them in the next patch. Only
> the other way around would be bad.
>  I have submitted in a similar way before. If needed i will resubmit.
> 
> 
Hmm.  I cannot see how the other way would be bad but maybe I am missing
something.  Hopefully someone else has some insight.

> 
> 
> >>  struct bridge_vlan_info {
> >>  	__u16 flags;
> >>diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> >>index 9f5eb55..492ef6a 100644
> >>--- a/net/bridge/br_netlink.c
> >>+++ b/net/bridge/br_netlink.c
> >>@@ -223,6 +223,7 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
> >>  	[IFLA_BRIDGE_MODE]	= { .type = NLA_U16 },
> >>  	[IFLA_BRIDGE_VLAN_INFO]	= { .type = NLA_BINARY,
> >>  				    .len = sizeof(struct bridge_vlan_info), },
> >>+	[IFLA_BRIDGE_VLAN_INFO_LIST] = { .type = NLA_NESTED, },
> >>  };
> >>  static int br_afspec(struct net_bridge *br,
> >>-- 
> >>1.7.10.4
> >>
> >>--
> >>To unsubscribe from this list: send the line "unsubscribe netdev" in
> >>the body of a message to majordomo@vger.kernel.org
> >>More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
- Jeremiah Mahler

^ permalink raw reply

* Re: [ovs-dev] [PATCH net] openvswitch: Consistently include VLAN header in flow and port stats.
From: Flavio Leitner @ 2014-12-31 18:45 UTC (permalink / raw)
  To: dev; +Cc: Ben Pfaff, netdev, Motonori Shindo
In-Reply-To: <1420044346-27957-1-git-send-email-blp@nicira.com>

On Wednesday, December 31, 2014 08:45:46 AM Ben Pfaff wrote:
> Until now, when VLAN acceleration was in use, the bytes of the VLAN header
> were not included in port or flow byte counters.  They were however
> included when VLAN acceleration was not used.  This commit corrects the
> inconsistency, by always including the VLAN header in byte counters.
> 
> Previous discussion at
> http://openvswitch.org/pipermail/dev/2014-December/049521.html
> 
> Reported-by: Motonori Shindo <mshindo@vmware.com>
> Signed-off-by: Ben Pfaff <blp@nicira.com>
> ---
>  net/openvswitch/flow.c  | 5 +++--
>  net/openvswitch/vport.c | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)

Looks good to me.
Reviewed-by: Flavio Leitner <fbl@sysclose.org>

^ permalink raw reply

* Re: [PATCH net-next v1 4/5] ixgbevf: Add RSS Key query code
From: Vlad Zolotarov @ 2014-12-31 18:36 UTC (permalink / raw)
  To: Jeff Kirsher, Alexander Duyck; +Cc: netdev, gleb, avi
In-Reply-To: <1420050773.31582.71.camel@jtkirshe-mobl>


On 12/31/14 20:32, Jeff Kirsher wrote:
> On Wed, 2014-12-31 at 20:03 +0200, Vlad Zolotarov wrote:
>> On 12/31/14 18:28, Jeff Kirsher wrote:
>>> On Wed, 2014-12-31 at 11:51 +0200, Vlad Zolotarov wrote:
>>>> Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
>>>> ---
>>>> New in v1 (compared to RFC):
>>>>      - Use "if-else" statement instead of a "switch-case" for a
>> single
>>>> option case
>>>>        (in ixgbevf_get_rss_key()).
>>>>
>>>> ---
>>>>    drivers/net/ethernet/intel/ixgbevf/mbx.h |  2 ++
>>>>    drivers/net/ethernet/intel/ixgbevf/vf.c  | 44
>>>> ++++++++++++++++++++++++++++++++
>>>>    drivers/net/ethernet/intel/ixgbevf/vf.h  |  1 +
>>>>    3 files changed, 47 insertions(+)
>>> Just caught this now, sorry but your patch description is sparse
>> (i.e.
>>> non-existent).  I know that the title of the patch pretty much tells
>>> what you are doing, but it would be nice to have a bit more detail
>> as to
>>> why (like your first patch).
>> I've sent a v2 where I tried to address your last remarks. Pls., note
>> that the whole series "why" motivation is located in the PATCH0 and
>> in
>> the final PATCH5: adding a new ethtool options for 82599 VF devices.
> Thanks v2 appears fine with regards to code/patch format goes.  Alex
> Duyck appears to have provided feedback on the series, which is a
> concern for me.  I have dropped v1 (since v2 is out), but I am going to
> hold off on pulling in v2 until Alex's concerns have been addressed.

Sure. He's caught a few real issues there. The main is that I had only 
82599 in mind and there are also x540 and x550 to consider. It may take 
a day or two... ;)
Again, thanks for looking at this guys.

^ permalink raw reply

* Re: [PATCH net-next v1 2/5] ixgbevf: Add a RETA query code
From: Vlad Zolotarov @ 2014-12-31 18:33 UTC (permalink / raw)
  To: Alexander Duyck, netdev
  Cc: gleb, avi, jeffrey.t.kirsher, Don Skidmore, tantilov, Emil S
In-Reply-To: <54A439C4.8020004@gmail.com>


On 12/31/14 20:00, Alexander Duyck wrote:
> I suspect this code is badly broken as it doesn't take several things
> into account.
>
> First the PF redirection table can have values outside of the range
> supported by the VF.  This is allowed as the VF can set how many bits of
> the redirection table it actually wants to use.  This is controlled via
> the PSRTYPE register.  So for example the PF can be running with 4
> queues, and the VF can run either in single queue or as just a pair of
> queues.
>
> Second you could compress this data much more tightly by taking
> advantage of the bit widths allowed.  So for everything x540 and older
> they only use a 4 bit value per entry.  That means you could
> theoretically stuff 8 entries per u32 instead of just 4.

Compression is nice but I think ethtool expects it in a certain format: 
one entry per byte. And since this patch is targeting the ethtool the 
output format should be as ethtool expects it to be and this is what 
this patch does. However I agree that masking the appropriate bits 
according to PSRTYPE is required. Good catch!

> Though I am
> not sure if that even really matters since we only care about the last
> bit anyway since we should only support RSS for up to 2 queues on the
> VFs (IRQ limitation).  You might be able to just get away with a 128b
> vector containing a single bit per RSS entry since that is all the VFs
> normally will use.

As I mentioned above we shouldn't compress it as u suggested (or in any 
other way) - this would make me uncompress it back in PATCH5 of this 
series... ;)

>
> The third issue I see is that this set of patches seem to completely
> ignore the X550.  The X550 has a much larger RETA on the PF, and I
> believe it does something different for the VF in terms of RSS though I
> don't recall exactly what the differences are.

That's right - the whole patch is written based on the 82599 spec. Now 
when u mentioned it I see that ixgbe/ixgbevf driver supports 3 device 
variants: 82599, x540 and x550. I'll have to revisit their specs and 
update the series correspondingly. Thanks for catching...

vlad

>
> - Alex
>
> On 12/31/2014 01:51 AM, Vlad Zolotarov wrote:
>>     - Added a new API version support.
>>     - Added the query implementation in the ixgbevf.
>>
>> Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
>> ---
>> New in v1 (compared to RFC):
>>     - Use "if-else" statement instead of a "switch-case" for a single option case
>>       (in ixgbevf_get_reta()).
>> ---
>>   drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  4 +-
>>   drivers/net/ethernet/intel/ixgbevf/mbx.h          |  6 ++
>>   drivers/net/ethernet/intel/ixgbevf/vf.c           | 73 +++++++++++++++++++++++
>>   drivers/net/ethernet/intel/ixgbevf/vf.h           |  1 +
>>   4 files changed, 83 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
>> index 62a0d8e..ba6ab61 100644
>> --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
>> +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
>> @@ -1880,7 +1880,8 @@ static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter)
>>   static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter)
>>   {
>>   	struct ixgbe_hw *hw = &adapter->hw;
>> -	int api[] = { ixgbe_mbox_api_11,
>> +	int api[] = { ixgbe_mbox_api_12,
>> +		      ixgbe_mbox_api_11,
>>   		      ixgbe_mbox_api_10,
>>   		      ixgbe_mbox_api_unknown };
>>   	int err = 0, idx = 0;
>> @@ -3525,6 +3526,7 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)
>>   
>>   	switch (adapter->hw.api_version) {
>>   	case ixgbe_mbox_api_11:
>> +	case ixgbe_mbox_api_12:
>>   		max_possible_frame = IXGBE_MAX_JUMBO_FRAME_SIZE;
>>   		break;
>>   	default:
>> diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/ethernet/intel/ixgbevf/mbx.h
>> index 0bc3005..3e148a8 100644
>> --- a/drivers/net/ethernet/intel/ixgbevf/mbx.h
>> +++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h
>> @@ -86,6 +86,7 @@ enum ixgbe_pfvf_api_rev {
>>   	ixgbe_mbox_api_10,	/* API version 1.0, linux/freebsd VF driver */
>>   	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
>>   	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
>> +	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
>>   	/* This value should always be last */
>>   	ixgbe_mbox_api_unknown,	/* indicates that API version is not known */
>>   };
>> @@ -104,6 +105,11 @@ enum ixgbe_pfvf_api_rev {
>>   /* mailbox API, version 1.1 VF requests */
>>   #define IXGBE_VF_GET_QUEUE	0x09 /* get queue configuration */
>>   
>> +/* mailbox API, version 1.2 VF requests */
>> +#define IXGBE_VF_GET_RETA_0	0x0a /* get RETA[0..11]  */
>> +#define IXGBE_VF_GET_RETA_1	0x0b /* get RETA[12..23] */
>> +#define IXGBE_VF_GET_RETA_2	0x0c /* get RETA[24..31] */
>> +
>>   /* GET_QUEUES return data indices within the mailbox */
>>   #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
>>   #define IXGBE_VF_RX_QUEUES	2	/* number of Rx queues supported */
>> diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
>> index cdb53be..8b98cdf 100644
>> --- a/drivers/net/ethernet/intel/ixgbevf/vf.c
>> +++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
>> @@ -258,6 +258,78 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
>>   	return ret_val;
>>   }
>>   
>> +static inline int _ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *msgbuf,
>> +				    u32 *reta, u32 op, int reta_offset_dw,
>> +				    size_t dwords)
>> +{
>> +	int err;
>> +
>> +	msgbuf[0] = op;
>> +	err = hw->mbx.ops.write_posted(hw, msgbuf, 1);
>> +
>> +	if (err)
>> +		return err;
>> +
>> +	err = hw->mbx.ops.read_posted(hw, msgbuf, 1 + dwords);
>> +
>> +	if (err)
>> +		return err;
>> +
>> +	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
>> +
>> +	/* If we didn't get an ACK there must have been
>> +	 * some sort of mailbox error so we should treat it
>> +	 * as such.
>> +	 */
>> +	if (msgbuf[0] != (op | IXGBE_VT_MSGTYPE_ACK))
>> +		return IXGBE_ERR_MBX;
>> +
>> +	memcpy(reta + reta_offset_dw, msgbuf + 1, 4 * dwords);
>> +
>> +	return 0;
>> +}
>> +
>> +/**
>> + * ixgbevf_get_reta - get the RSS redirection table (RETA) contents.
>> + * @hw: pointer to the HW structure
>> + * @reta: buffer to fill with RETA contents.
>> + *
>> + * The "reta" buffer should be big enough to contain 32 registers.
>> + *
>> + * Returns: 0 on success.
>> + *          if API doesn't support this operation - (-EPERM).
>> + */
>> +int ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *reta)
>> +{
>> +	int err;
>> +	u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
>> +
>> +	/* Return an error if API doesn't RETA querying. */
>> +	if (hw->api_version != ixgbe_mbox_api_12)
>> +		return -EPERM;
>> +
>> +	/* Fetch RETA from the PF. We do it in 3 steps due to mailbox size
>> +	 * limitation - we can bring up to 15 dwords every time while RETA
>> +	 * consists of 32 dwords. Therefore we'll bring 12, 12 and 8 dwords in
>> +	 * each step correspondingly.
>> +	 */
>> +
>> +	/* RETA[0..11] */
>> +	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_0, 0, 12);
>> +	if (err)
>> +		return err;
>> +
>> +	/* RETA[12..23] */
>> +	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_1, 12, 12);
>> +	if (err)
>> +		return err;
>> +
>> +	/* RETA[24..31] */
>> +	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_2, 24, 8);
>> +
>> +	return err;
>> +}
>> +
>>   /**
>>    *  ixgbevf_set_rar_vf - set device MAC address
>>    *  @hw: pointer to hardware structure
>> @@ -545,6 +617,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
>>   	/* do nothing if API doesn't support ixgbevf_get_queues */
>>   	switch (hw->api_version) {
>>   	case ixgbe_mbox_api_11:
>> +	case ixgbe_mbox_api_12:
>>   		break;
>>   	default:
>>   		return 0;
>> diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
>> index 5b17242..73c1b33 100644
>> --- a/drivers/net/ethernet/intel/ixgbevf/vf.h
>> +++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
>> @@ -208,5 +208,6 @@ void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
>>   int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
>>   int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
>>   		       unsigned int *default_tc);
>> +int ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *reta);
>>   #endif /* __IXGBE_VF_H__ */
>>   

^ permalink raw reply

* Re: [PATCH net-next v1 4/5] ixgbevf: Add RSS Key query code
From: Jeff Kirsher @ 2014-12-31 18:32 UTC (permalink / raw)
  To: Vlad Zolotarov, Alexander Duyck; +Cc: netdev, gleb, avi
In-Reply-To: <54A43A67.9020407@cloudius-systems.com>

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

On Wed, 2014-12-31 at 20:03 +0200, Vlad Zolotarov wrote:
> On 12/31/14 18:28, Jeff Kirsher wrote:
> > On Wed, 2014-12-31 at 11:51 +0200, Vlad Zolotarov wrote:
> >> Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
> >> ---
> >> New in v1 (compared to RFC):
> >>     - Use "if-else" statement instead of a "switch-case" for a
> single
> >> option case
> >>       (in ixgbevf_get_rss_key()).
> >>
> >> ---
> >>   drivers/net/ethernet/intel/ixgbevf/mbx.h |  2 ++
> >>   drivers/net/ethernet/intel/ixgbevf/vf.c  | 44
> >> ++++++++++++++++++++++++++++++++
> >>   drivers/net/ethernet/intel/ixgbevf/vf.h  |  1 +
> >>   3 files changed, 47 insertions(+)
> > Just caught this now, sorry but your patch description is sparse
> (i.e.
> > non-existent).  I know that the title of the patch pretty much tells
> > what you are doing, but it would be nice to have a bit more detail
> as to
> > why (like your first patch).
> 
> I've sent a v2 where I tried to address your last remarks. Pls., note 
> that the whole series "why" motivation is located in the PATCH0 and
> in 
> the final PATCH5: adding a new ethtool options for 82599 VF devices.

Thanks v2 appears fine with regards to code/patch format goes.  Alex
Duyck appears to have provided feedback on the series, which is a
concern for me.  I have dropped v1 (since v2 is out), but I am going to
hold off on pulling in v2 until Alex's concerns have been addressed.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH] Drivers: isdn: gigaset: checkpatch cleanup
From: Jeremiah Mahler @ 2014-12-31 18:32 UTC (permalink / raw)
  To: Bas Peters; +Cc: hjlipp, tilman, isdn, gigaset307x-common, netdev, linux-kernel
In-Reply-To: <CAOgR63d6FNxntkBaSWM6ozibYGzajt07OLiM2XcszJarSaGX6A@mail.gmail.com>

Bas,

On Wed, Dec 31, 2014 at 07:04:30PM +0100, Bas Peters wrote:
> 2014-12-31 18:49 GMT+01:00 Jeremiah Mahler <jmmahler@gmail.com>:
> > Bas,
> >
> > On Wed, Dec 31, 2014 at 06:34:58PM +0100, Bas Peters wrote:
> >> Fixed many checkpatch.pl complaints, ranging from whitespace issues to
> >> reportedly deprecated function and macro usage.
> >>
> > One patch should fix one type of problem.  This needs to be broken up
> > in to individual patches.
> >
> >> I have not been able to test the code as I do not have access to the
> >> hardware but since no new features were really added I don't think that
> >> should pose a problem.
> >>
> >> There are still some checkpatch complaints, particularly concerning
> >> potentially unnecessary 'out of memory' messages. I will provide patches
> >> for these complaints when I figure out the reason behind it and what to
> >> do about it.
> >>
> >> NOTE: This is my first patch (ever). I have attempted to follow all
> >> guidelines provided, but I probably will have missed some. If you have
> >> any comments regarding the quality of this patch or suggestions as to
> >> what I could do better in the future, please let me know.
> >>
> > You are ambitious.  I would suggest trying a smaller patch first to
> > make sure you are doing everything right.
> 
> With 'smaller patch', do you refer to less files at once or a different driver?
> Is it generally preferred to send patches that relate to the same
> issue (changes to a single file,
> grouping of patches to tackle the same issue, such as conversion of a
> specific function) over
> patch(sets) that deal with an entire driver?
> 
> Thanks for the advice!
> 

Your patch should solve one problem.  This could result in a single file
being changed or many being changed.  For simple checkpatch errors I
usually group all of one type of error for one file as a patch.

The goal is to make it easy to review.  If you fixed 10 different types
of issues in one patch it would difficult to review because I would have
to remember whether the change I am looking at was for issue 3 or 8 or
5 or ...?

Also, if the code had a bug, a bisect will point me to the patch.  But
then I have to figure out which of the 10 changes in that one patch
created the problem.  This is much easier if there was only one change
in that one patch.

Also have a look at Documentation/SubmittingPatches.  Specifically the
section "Separate your changes".

> >
> >> Signed-off-by: Bas Peters <baspeters93@gmail.com>
> >> ---
> >>  drivers/isdn/gigaset/asyncdata.c   |  9 +++--
> >>  drivers/isdn/gigaset/bas-gigaset.c | 80 ++++++++++++++++++++------------------
> >>  drivers/isdn/gigaset/capi.c        |  5 ++-
> >>  drivers/isdn/gigaset/common.c      |  8 ++--
> >>  drivers/isdn/gigaset/ev-layer.c    | 38 +++++++++++-------
> >>  drivers/isdn/gigaset/gigaset.h     |  4 +-
> >>  drivers/isdn/gigaset/i4l.c         | 12 +++---
> >>  drivers/isdn/gigaset/interface.c   | 10 ++---
> >>  drivers/isdn/gigaset/isocdata.c    |  3 ++
> >>  drivers/isdn/gigaset/proc.c        | 17 +++++---
> >>  drivers/isdn/gigaset/usb-gigaset.c | 46 +++++++++++++++-------
> >>  11 files changed, 141 insertions(+), 91 deletions(-)
> >>
> >> diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
> > [...]
> >
> > --
> > - Jeremiah Mahler

-- 
- Jeremiah Mahler

^ permalink raw reply

* Re: [PATCH net-next v2 1/2] bridge: new attribute and flags to represent vlan info lists and ranges
From: roopa @ 2014-12-31 18:15 UTC (permalink / raw)
  To: Jeremiah Mahler, netdev, shemminger, vyasevic, sfeldma, wkok
In-Reply-To: <20141231174542.GA1922@hudson.localdomain>

On 12/31/14, 9:45 AM, Jeremiah Mahler wrote:
> Roopa,
>
> On Wed, Dec 31, 2014 at 08:48:52AM -0800, roopa@cumulusnetworks.com wrote:
>> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>>
>> This patch adds (as suggested by scott feldman),
>>          - new netlink attribute IFLA_BRIDGE_VLAN_INFO_LIST to represent
>>            vlan list
>>          - And bridge_vlan_info flags BRIDGE_VLAN_INFO_RANGE_START and
>>            BRIDGE_VLAN_INFO_RANGE_END to indicate start and end of vlan range
>>
>> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
>> ---
>>   include/uapi/linux/if_bridge.h |    4 ++++
>>   net/bridge/br_netlink.c        |    1 +
>>   2 files changed, 5 insertions(+)
>>
>> diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
>> index b03ee8f..fa468aa 100644
>> --- a/include/uapi/linux/if_bridge.h
>> +++ b/include/uapi/linux/if_bridge.h
>> @@ -112,12 +112,14 @@ struct __fdb_entry {
>>    *     [IFLA_BRIDGE_FLAGS]
>>    *     [IFLA_BRIDGE_MODE]
>>    *     [IFLA_BRIDGE_VLAN_INFO]
>> + *     [IFLA_BRIDGE_VLAN_INFO_LIST]
>>    * }
>>    */
>>   enum {
>>   	IFLA_BRIDGE_FLAGS,
>>   	IFLA_BRIDGE_MODE,
>>   	IFLA_BRIDGE_VLAN_INFO,
>> +	IFLA_BRIDGE_VLAN_INFO_LIST,
>>   	__IFLA_BRIDGE_MAX,
>>   };
>>   #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
>> @@ -125,6 +127,8 @@ enum {
>>   #define BRIDGE_VLAN_INFO_MASTER	(1<<0)	/* Operate on Bridge device as well */
>>   #define BRIDGE_VLAN_INFO_PVID	(1<<1)	/* VLAN is PVID, ingress untagged */
>>   #define BRIDGE_VLAN_INFO_UNTAGGED	(1<<2)	/* VLAN egresses untagged */
>> +#define BRIDGE_VLAN_INFO_RANGE_START	(1<<3) /* VLAN is start of vlan range */
>> +#define BRIDGE_VLAN_INFO_RANGE_END	(1<<4) /* VLAN is end of vlan range */
>>   
> You add these here but you don't use them until the next patch.
> If they were wrong a bisect would point to the next patch.
>
> I would add them in the next patch where you start to use them.
I thought it was ok to declare it first and use them in the next patch. 
Only the other way around would be bad.
  I have submitted in a similar way before. If needed i will resubmit.




>>   struct bridge_vlan_info {
>>   	__u16 flags;
>> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
>> index 9f5eb55..492ef6a 100644
>> --- a/net/bridge/br_netlink.c
>> +++ b/net/bridge/br_netlink.c
>> @@ -223,6 +223,7 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
>>   	[IFLA_BRIDGE_MODE]	= { .type = NLA_U16 },
>>   	[IFLA_BRIDGE_VLAN_INFO]	= { .type = NLA_BINARY,
>>   				    .len = sizeof(struct bridge_vlan_info), },
>> +	[IFLA_BRIDGE_VLAN_INFO_LIST] = { .type = NLA_NESTED, },
>>   };
>>   
>>   static int br_afspec(struct net_bridge *br,
>> -- 
>> 1.7.10.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 1/1 net-next] tipc: replace 0 by NULL for pointers
From: David Miller @ 2014-12-31 18:11 UTC (permalink / raw)
  To: fabf; +Cc: jon.maloy, netdev, tipc-discussion, linux-kernel, allan.stephens
In-Reply-To: <1419505550-17336-1-git-send-email-fabf@skynet.be>

From: Fabian Frederick <fabf@skynet.be>
Date: Thu, 25 Dec 2014 12:05:50 +0100

> Fix sparse warning:
> net/tipc/link.c:1924:40: warning: Using plain integer as NULL pointer
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Applied, thanks.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net

^ permalink raw reply

* Re: [PATCH net-next 0/3] enic: Check for DMA mapping error
From: David Miller @ 2014-12-31 18:09 UTC (permalink / raw)
  To: _govind; +Cc: netdev, sassmann, ssujith, benve
In-Reply-To: <1419416978-1008-1-git-send-email-_govind@gmx.com>

From: Govindarajulu Varadarajan <_govind@gmx.com>
Date: Wed, 24 Dec 2014 15:59:35 +0530

> After dma mapping the buffers, enic does not call dma_mapping_error() to check
> if mapping is successful.
> 
> This series fixes the issue by checking return value of pci_dma_mapping_error()
> after pci_map_single().
> 
> This is reported by redhat here
> https://bugzilla.redhat.com/show_bug.cgi?id=1145016

Series applied, thank you.

^ permalink raw reply

* Re: [PATCH net-next v1 0/3] net: fec: add Wake-on-LAN support
From: David Miller @ 2014-12-31 18:07 UTC (permalink / raw)
  To: b38611; +Cc: shawn.guo, netdev, bhutchings, stephen
In-Reply-To: <1419413441-3406-1-git-send-email-b38611@freescale.com>

From: Fugang Duan <b38611@freescale.com>
Date: Wed, 24 Dec 2014 17:30:38 +0800

> The patch series enable FEC Wake-on-LAN feature for i.MX6q/dl and i.MX6SX SOCs.
> FEC HW support sleep mode, when system in suspend status with FEC all clock gate
> off, magic packet can wake up system. For different SOCs, there have special SOC
> GPR register to let FEC enter sleep mode or exit sleep mode, add these to platform
> callback for driver' call.
> 
> Patch#1: add WOL interface supports.
> Patch#2: add SOC special sleep of/off operations for driver's sleep callback.
> Patch#3: add magic pattern support for devicetree.

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH] Drivers: isdn: gigaset: checkpatch cleanup
From: Bas Peters @ 2014-12-31 18:04 UTC (permalink / raw)
  To: Jeremiah Mahler, Bas Peters, hjlipp, tilman, isdn,
	gigaset307x-common, netdev, linux-kernel
In-Reply-To: <20141231174936.GB1922@hudson.localdomain>

2014-12-31 18:49 GMT+01:00 Jeremiah Mahler <jmmahler@gmail.com>:
> Bas,
>
> On Wed, Dec 31, 2014 at 06:34:58PM +0100, Bas Peters wrote:
>> Fixed many checkpatch.pl complaints, ranging from whitespace issues to
>> reportedly deprecated function and macro usage.
>>
> One patch should fix one type of problem.  This needs to be broken up
> in to individual patches.
>
>> I have not been able to test the code as I do not have access to the
>> hardware but since no new features were really added I don't think that
>> should pose a problem.
>>
>> There are still some checkpatch complaints, particularly concerning
>> potentially unnecessary 'out of memory' messages. I will provide patches
>> for these complaints when I figure out the reason behind it and what to
>> do about it.
>>
>> NOTE: This is my first patch (ever). I have attempted to follow all
>> guidelines provided, but I probably will have missed some. If you have
>> any comments regarding the quality of this patch or suggestions as to
>> what I could do better in the future, please let me know.
>>
> You are ambitious.  I would suggest trying a smaller patch first to
> make sure you are doing everything right.

With 'smaller patch', do you refer to less files at once or a different driver?
Is it generally preferred to send patches that relate to the same
issue (changes to a single file,
grouping of patches to tackle the same issue, such as conversion of a
specific function) over
patch(sets) that deal with an entire driver?

Thanks for the advice!

>
>> Signed-off-by: Bas Peters <baspeters93@gmail.com>
>> ---
>>  drivers/isdn/gigaset/asyncdata.c   |  9 +++--
>>  drivers/isdn/gigaset/bas-gigaset.c | 80 ++++++++++++++++++++------------------
>>  drivers/isdn/gigaset/capi.c        |  5 ++-
>>  drivers/isdn/gigaset/common.c      |  8 ++--
>>  drivers/isdn/gigaset/ev-layer.c    | 38 +++++++++++-------
>>  drivers/isdn/gigaset/gigaset.h     |  4 +-
>>  drivers/isdn/gigaset/i4l.c         | 12 +++---
>>  drivers/isdn/gigaset/interface.c   | 10 ++---
>>  drivers/isdn/gigaset/isocdata.c    |  3 ++
>>  drivers/isdn/gigaset/proc.c        | 17 +++++---
>>  drivers/isdn/gigaset/usb-gigaset.c | 46 +++++++++++++++-------
>>  11 files changed, 141 insertions(+), 91 deletions(-)
>>
>> diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
> [...]
>
> --
> - Jeremiah Mahler

^ permalink raw reply

* Re: [PATCH net-next v1 4/5] ixgbevf: Add RSS Key query code
From: Vlad Zolotarov @ 2014-12-31 18:03 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: netdev, gleb, avi
In-Reply-To: <1420043307.31582.53.camel@jtkirshe-mobl>


On 12/31/14 18:28, Jeff Kirsher wrote:
> On Wed, 2014-12-31 at 11:51 +0200, Vlad Zolotarov wrote:
>> Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
>> ---
>> New in v1 (compared to RFC):
>>     - Use "if-else" statement instead of a "switch-case" for a single
>> option case
>>       (in ixgbevf_get_rss_key()).
>>
>> ---
>>   drivers/net/ethernet/intel/ixgbevf/mbx.h |  2 ++
>>   drivers/net/ethernet/intel/ixgbevf/vf.c  | 44
>> ++++++++++++++++++++++++++++++++
>>   drivers/net/ethernet/intel/ixgbevf/vf.h  |  1 +
>>   3 files changed, 47 insertions(+)
> Just caught this now, sorry but your patch description is sparse (i.e.
> non-existent).  I know that the title of the patch pretty much tells
> what you are doing, but it would be nice to have a bit more detail as to
> why (like your first patch).

I've sent a v2 where I tried to address your last remarks. Pls., note 
that the whole series "why" motivation is located in the PATCH0 and in 
the final PATCH5: adding a new ethtool options for 82599 VF devices.

thanks,
vlad

>
> Same goes for patch 5 of the series as well.

^ permalink raw reply

* Re: [PATCH net-next v1 2/5] ixgbevf: Add a RETA query code
From: Alexander Duyck @ 2014-12-31 18:00 UTC (permalink / raw)
  To: Vlad Zolotarov, netdev
  Cc: gleb, avi, jeffrey.t.kirsher, Don Skidmore, tantilov, Emil S
In-Reply-To: <1420019519-18139-3-git-send-email-vladz@cloudius-systems.com>

I suspect this code is badly broken as it doesn't take several things
into account.

First the PF redirection table can have values outside of the range
supported by the VF.  This is allowed as the VF can set how many bits of
the redirection table it actually wants to use.  This is controlled via
the PSRTYPE register.  So for example the PF can be running with 4
queues, and the VF can run either in single queue or as just a pair of
queues.

Second you could compress this data much more tightly by taking
advantage of the bit widths allowed.  So for everything x540 and older
they only use a 4 bit value per entry.  That means you could
theoretically stuff 8 entries per u32 instead of just 4.  Though I am
not sure if that even really matters since we only care about the last
bit anyway since we should only support RSS for up to 2 queues on the
VFs (IRQ limitation).  You might be able to just get away with a 128b
vector containing a single bit per RSS entry since that is all the VFs
normally will use.

The third issue I see is that this set of patches seem to completely
ignore the X550.  The X550 has a much larger RETA on the PF, and I
believe it does something different for the VF in terms of RSS though I
don't recall exactly what the differences are.

- Alex

On 12/31/2014 01:51 AM, Vlad Zolotarov wrote:
>    - Added a new API version support.
>    - Added the query implementation in the ixgbevf.
>
> Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
> ---
> New in v1 (compared to RFC):
>    - Use "if-else" statement instead of a "switch-case" for a single option case
>      (in ixgbevf_get_reta()).
> ---
>  drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  4 +-
>  drivers/net/ethernet/intel/ixgbevf/mbx.h          |  6 ++
>  drivers/net/ethernet/intel/ixgbevf/vf.c           | 73 +++++++++++++++++++++++
>  drivers/net/ethernet/intel/ixgbevf/vf.h           |  1 +
>  4 files changed, 83 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> index 62a0d8e..ba6ab61 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> @@ -1880,7 +1880,8 @@ static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter)
>  static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter)
>  {
>  	struct ixgbe_hw *hw = &adapter->hw;
> -	int api[] = { ixgbe_mbox_api_11,
> +	int api[] = { ixgbe_mbox_api_12,
> +		      ixgbe_mbox_api_11,
>  		      ixgbe_mbox_api_10,
>  		      ixgbe_mbox_api_unknown };
>  	int err = 0, idx = 0;
> @@ -3525,6 +3526,7 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)
>  
>  	switch (adapter->hw.api_version) {
>  	case ixgbe_mbox_api_11:
> +	case ixgbe_mbox_api_12:
>  		max_possible_frame = IXGBE_MAX_JUMBO_FRAME_SIZE;
>  		break;
>  	default:
> diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/ethernet/intel/ixgbevf/mbx.h
> index 0bc3005..3e148a8 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/mbx.h
> +++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h
> @@ -86,6 +86,7 @@ enum ixgbe_pfvf_api_rev {
>  	ixgbe_mbox_api_10,	/* API version 1.0, linux/freebsd VF driver */
>  	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
>  	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
> +	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
>  	/* This value should always be last */
>  	ixgbe_mbox_api_unknown,	/* indicates that API version is not known */
>  };
> @@ -104,6 +105,11 @@ enum ixgbe_pfvf_api_rev {
>  /* mailbox API, version 1.1 VF requests */
>  #define IXGBE_VF_GET_QUEUE	0x09 /* get queue configuration */
>  
> +/* mailbox API, version 1.2 VF requests */
> +#define IXGBE_VF_GET_RETA_0	0x0a /* get RETA[0..11]  */
> +#define IXGBE_VF_GET_RETA_1	0x0b /* get RETA[12..23] */
> +#define IXGBE_VF_GET_RETA_2	0x0c /* get RETA[24..31] */
> +
>  /* GET_QUEUES return data indices within the mailbox */
>  #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
>  #define IXGBE_VF_RX_QUEUES	2	/* number of Rx queues supported */
> diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
> index cdb53be..8b98cdf 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/vf.c
> +++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
> @@ -258,6 +258,78 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
>  	return ret_val;
>  }
>  
> +static inline int _ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *msgbuf,
> +				    u32 *reta, u32 op, int reta_offset_dw,
> +				    size_t dwords)
> +{
> +	int err;
> +
> +	msgbuf[0] = op;
> +	err = hw->mbx.ops.write_posted(hw, msgbuf, 1);
> +
> +	if (err)
> +		return err;
> +
> +	err = hw->mbx.ops.read_posted(hw, msgbuf, 1 + dwords);
> +
> +	if (err)
> +		return err;
> +
> +	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
> +
> +	/* If we didn't get an ACK there must have been
> +	 * some sort of mailbox error so we should treat it
> +	 * as such.
> +	 */
> +	if (msgbuf[0] != (op | IXGBE_VT_MSGTYPE_ACK))
> +		return IXGBE_ERR_MBX;
> +
> +	memcpy(reta + reta_offset_dw, msgbuf + 1, 4 * dwords);
> +
> +	return 0;
> +}
> +
> +/**
> + * ixgbevf_get_reta - get the RSS redirection table (RETA) contents.
> + * @hw: pointer to the HW structure
> + * @reta: buffer to fill with RETA contents.
> + *
> + * The "reta" buffer should be big enough to contain 32 registers.
> + *
> + * Returns: 0 on success.
> + *          if API doesn't support this operation - (-EPERM).
> + */
> +int ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *reta)
> +{
> +	int err;
> +	u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
> +
> +	/* Return an error if API doesn't RETA querying. */
> +	if (hw->api_version != ixgbe_mbox_api_12)
> +		return -EPERM;
> +
> +	/* Fetch RETA from the PF. We do it in 3 steps due to mailbox size
> +	 * limitation - we can bring up to 15 dwords every time while RETA
> +	 * consists of 32 dwords. Therefore we'll bring 12, 12 and 8 dwords in
> +	 * each step correspondingly.
> +	 */
> +
> +	/* RETA[0..11] */
> +	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_0, 0, 12);
> +	if (err)
> +		return err;
> +
> +	/* RETA[12..23] */
> +	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_1, 12, 12);
> +	if (err)
> +		return err;
> +
> +	/* RETA[24..31] */
> +	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_2, 24, 8);
> +
> +	return err;
> +}
> +
>  /**
>   *  ixgbevf_set_rar_vf - set device MAC address
>   *  @hw: pointer to hardware structure
> @@ -545,6 +617,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
>  	/* do nothing if API doesn't support ixgbevf_get_queues */
>  	switch (hw->api_version) {
>  	case ixgbe_mbox_api_11:
> +	case ixgbe_mbox_api_12:
>  		break;
>  	default:
>  		return 0;
> diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
> index 5b17242..73c1b33 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/vf.h
> +++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
> @@ -208,5 +208,6 @@ void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
>  int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
>  int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
>  		       unsigned int *default_tc);
> +int ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *reta);
>  #endif /* __IXGBE_VF_H__ */
>  

^ permalink raw reply

* Re: [PATCH] Drivers: isdn: gigaset: checkpatch cleanup
From: Jeremiah Mahler @ 2014-12-31 17:49 UTC (permalink / raw)
  To: Bas Peters; +Cc: hjlipp, tilman, isdn, gigaset307x-common, netdev, linux-kernel
In-Reply-To: <1420047298-7798-1-git-send-email-baspeters93@gmail.com>

Bas,

On Wed, Dec 31, 2014 at 06:34:58PM +0100, Bas Peters wrote:
> Fixed many checkpatch.pl complaints, ranging from whitespace issues to
> reportedly deprecated function and macro usage.
> 
One patch should fix one type of problem.  This needs to be broken up
in to individual patches.

> I have not been able to test the code as I do not have access to the
> hardware but since no new features were really added I don't think that
> should pose a problem.
> 
> There are still some checkpatch complaints, particularly concerning
> potentially unnecessary 'out of memory' messages. I will provide patches
> for these complaints when I figure out the reason behind it and what to
> do about it.
> 
> NOTE: This is my first patch (ever). I have attempted to follow all
> guidelines provided, but I probably will have missed some. If you have
> any comments regarding the quality of this patch or suggestions as to
> what I could do better in the future, please let me know.
> 
You are ambitious.  I would suggest trying a smaller patch first to
make sure you are doing everything right.

> Signed-off-by: Bas Peters <baspeters93@gmail.com>
> ---
>  drivers/isdn/gigaset/asyncdata.c   |  9 +++--
>  drivers/isdn/gigaset/bas-gigaset.c | 80 ++++++++++++++++++++------------------
>  drivers/isdn/gigaset/capi.c        |  5 ++-
>  drivers/isdn/gigaset/common.c      |  8 ++--
>  drivers/isdn/gigaset/ev-layer.c    | 38 +++++++++++-------
>  drivers/isdn/gigaset/gigaset.h     |  4 +-
>  drivers/isdn/gigaset/i4l.c         | 12 +++---
>  drivers/isdn/gigaset/interface.c   | 10 ++---
>  drivers/isdn/gigaset/isocdata.c    |  3 ++
>  drivers/isdn/gigaset/proc.c        | 17 +++++---
>  drivers/isdn/gigaset/usb-gigaset.c | 46 +++++++++++++++-------
>  11 files changed, 141 insertions(+), 91 deletions(-)
> 
> diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
[...]

-- 
- Jeremiah Mahler

^ permalink raw reply

* Re: [PATCH net-next v2 1/2] bridge: new attribute and flags to represent vlan info lists and ranges
From: Jeremiah Mahler @ 2014-12-31 17:45 UTC (permalink / raw)
  To: roopa; +Cc: netdev, hemminger, vyasevic, sfeldma, wkok
In-Reply-To: <1420044533-16963-2-git-send-email-roopa@cumulusnetworks.com>

Roopa,

On Wed, Dec 31, 2014 at 08:48:52AM -0800, roopa@cumulusnetworks.com wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
> 
> This patch adds (as suggested by scott feldman),
>         - new netlink attribute IFLA_BRIDGE_VLAN_INFO_LIST to represent
>           vlan list
>         - And bridge_vlan_info flags BRIDGE_VLAN_INFO_RANGE_START and
>           BRIDGE_VLAN_INFO_RANGE_END to indicate start and end of vlan range
> 
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
>  include/uapi/linux/if_bridge.h |    4 ++++
>  net/bridge/br_netlink.c        |    1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
> index b03ee8f..fa468aa 100644
> --- a/include/uapi/linux/if_bridge.h
> +++ b/include/uapi/linux/if_bridge.h
> @@ -112,12 +112,14 @@ struct __fdb_entry {
>   *     [IFLA_BRIDGE_FLAGS]
>   *     [IFLA_BRIDGE_MODE]
>   *     [IFLA_BRIDGE_VLAN_INFO]
> + *     [IFLA_BRIDGE_VLAN_INFO_LIST]
>   * }
>   */
>  enum {
>  	IFLA_BRIDGE_FLAGS,
>  	IFLA_BRIDGE_MODE,
>  	IFLA_BRIDGE_VLAN_INFO,
> +	IFLA_BRIDGE_VLAN_INFO_LIST,
>  	__IFLA_BRIDGE_MAX,
>  };
>  #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
> @@ -125,6 +127,8 @@ enum {
>  #define BRIDGE_VLAN_INFO_MASTER	(1<<0)	/* Operate on Bridge device as well */
>  #define BRIDGE_VLAN_INFO_PVID	(1<<1)	/* VLAN is PVID, ingress untagged */
>  #define BRIDGE_VLAN_INFO_UNTAGGED	(1<<2)	/* VLAN egresses untagged */
> +#define BRIDGE_VLAN_INFO_RANGE_START	(1<<3) /* VLAN is start of vlan range */
> +#define BRIDGE_VLAN_INFO_RANGE_END	(1<<4) /* VLAN is end of vlan range */
>  
You add these here but you don't use them until the next patch.
If they were wrong a bisect would point to the next patch.

I would add them in the next patch where you start to use them.

>  struct bridge_vlan_info {
>  	__u16 flags;
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 9f5eb55..492ef6a 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -223,6 +223,7 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
>  	[IFLA_BRIDGE_MODE]	= { .type = NLA_U16 },
>  	[IFLA_BRIDGE_VLAN_INFO]	= { .type = NLA_BINARY,
>  				    .len = sizeof(struct bridge_vlan_info), },
> +	[IFLA_BRIDGE_VLAN_INFO_LIST] = { .type = NLA_NESTED, },
>  };
>  
>  static int br_afspec(struct net_bridge *br,
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
- Jeremiah Mahler

^ permalink raw reply

* Re: [PATCH net-next 00/11] Time Counter fixes and improvements
From: Richard Cochran @ 2014-12-31 17:42 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-kernel, amirv, ariel.elior, carolyn.wyborny,
	Frank.Li, jeffrey.t.kirsher, john.stultz, matthew.vick, mlichvar,
	mugunthanvnm, ogerlitz, tglx, thomas.lendacky
In-Reply-To: <20141230.183201.53211717284248412.davem@davemloft.net>

On Tue, Dec 30, 2014 at 06:32:01PM -0500, David Miller wrote:
> 
> Series applied, thanks Richard.

I got an automated email from

  kbuild test robot <fengguang.wu@intel.com>

showing new warnings and errors introduced by this series. I'll follow
up with fixes soon.

Thanks,
Richard

^ permalink raw reply

* [PATCH net-next v2 5/5] ixgbevf: Add the appropriate ethtool ops to query RSS indirection table and key
From: Vlad Zolotarov @ 2014-12-31 17:40 UTC (permalink / raw)
  To: netdev; +Cc: gleb, avi, jeffrey.t.kirsher, Vlad Zolotarov
In-Reply-To: <1420047639-10862-1-git-send-email-vladz@cloudius-systems.com>

Added get_rxfh_indir_size, get_rxfh_key_size and get_rxfh ethtool_ops callbacks
implementations.

This enables the ethtool's "-x" and "-n rx-flow-hash" options for 82599 VF devices.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
---
New in v2:
   - Added a detailed description to the patch.
---
 drivers/net/ethernet/intel/ixgbevf/ethtool.c | 37 ++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index cc0e5b7..255bbc8 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -792,6 +792,40 @@ static int ixgbevf_set_coalesce(struct net_device *netdev,
 	return 0;
 }
 
+static u32 ixgbevf_get_rxfh_indir_size(struct net_device *netdev)
+{
+	return 128;
+}
+
+static u32 ixgbevf_get_rxfh_key_size(struct net_device *netdev)
+{
+	return 40;
+}
+
+static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
+			    u8 *hfunc)
+{
+	struct ixgbevf_adapter *adapter = netdev_priv(netdev);
+	int err;
+
+	if (hfunc)
+		*hfunc = ETH_RSS_HASH_TOP;
+
+	if (indir) {
+		err = ixgbevf_get_reta(&adapter->hw, indir);
+		if (err)
+			return err;
+	}
+
+	if (key) {
+		err = ixgbevf_get_rss_key(&adapter->hw, key);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
 static const struct ethtool_ops ixgbevf_ethtool_ops = {
 	.get_settings           = ixgbevf_get_settings,
 	.get_drvinfo            = ixgbevf_get_drvinfo,
@@ -809,6 +843,9 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = {
 	.get_ethtool_stats      = ixgbevf_get_ethtool_stats,
 	.get_coalesce           = ixgbevf_get_coalesce,
 	.set_coalesce           = ixgbevf_set_coalesce,
+	.get_rxfh_indir_size    = ixgbevf_get_rxfh_indir_size,
+	.get_rxfh_key_size      = ixgbevf_get_rxfh_key_size,
+	.get_rxfh		= ixgbevf_get_rxfh,
 };
 
 void ixgbevf_set_ethtool_ops(struct net_device *netdev)
-- 
2.1.0

^ permalink raw reply related

* [PATCH net-next v2 4/5] ixgbevf: Add RSS Key query code
From: Vlad Zolotarov @ 2014-12-31 17:40 UTC (permalink / raw)
  To: netdev; +Cc: gleb, avi, jeffrey.t.kirsher, Vlad Zolotarov
In-Reply-To: <1420047639-10862-1-git-send-email-vladz@cloudius-systems.com>

Add the ixgbevf_get_rss_key() function that queries the PF for an RSS Random Key
using a new VF-PF channel IXGBE_VF_GET_RSS_KEY command.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
---
New in v2:
   - Added a more detailed patch description.

New in v1 (compared to RFC):
   - Use "if-else" statement instead of a "switch-case" for a single option case
     (in ixgbevf_get_rss_key()).
---
 drivers/net/ethernet/intel/ixgbevf/mbx.h |  2 ++
 drivers/net/ethernet/intel/ixgbevf/vf.c  | 44 ++++++++++++++++++++++++++++++++
 drivers/net/ethernet/intel/ixgbevf/vf.h  |  1 +
 3 files changed, 47 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/ethernet/intel/ixgbevf/mbx.h
index 3e148a8..9674ac8 100644
--- a/drivers/net/ethernet/intel/ixgbevf/mbx.h
+++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h
@@ -110,6 +110,8 @@ enum ixgbe_pfvf_api_rev {
 #define IXGBE_VF_GET_RETA_1	0x0b /* get RETA[12..23] */
 #define IXGBE_VF_GET_RETA_2	0x0c /* get RETA[24..31] */
 
+#define IXGBE_VF_GET_RSS_KEY	0x0d /* get RSS hash key */
+
 /* GET_QUEUES return data indices within the mailbox */
 #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
 #define IXGBE_VF_RX_QUEUES	2	/* number of Rx queues supported */
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
index 8b98cdf..dbac264 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.c
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
@@ -290,6 +290,50 @@ static inline int _ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *msgbuf,
 }
 
 /**
+ * ixgbevf_get_rss_key - get the RSS Random Key
+ * @hw: pointer to the HW structure
+ * @reta: buffer to fill with RETA contents.
+ *
+ * The "rss_key" buffer should be big enough to contain 10 registers.
+ *
+ * Returns: 0 on success.
+ *          if API doesn't support this operation - (-EPERM).
+ */
+int ixgbevf_get_rss_key(struct ixgbe_hw *hw, u8 *rss_key)
+{
+	int err;
+	u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
+
+	/* Return and error if API doesn't support RSS Random Key retrieval */
+	if (hw->api_version != ixgbe_mbox_api_12)
+		return -EPERM;
+
+	msgbuf[0] = IXGBE_VF_GET_RSS_KEY;
+	err = hw->mbx.ops.write_posted(hw, msgbuf, 1);
+
+	if (err)
+		return err;
+
+	err = hw->mbx.ops.read_posted(hw, msgbuf, 11);
+
+	if (err)
+		return err;
+
+	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
+
+	/* If we didn't get an ACK there must have been
+	 * some sort of mailbox error so we should treat it
+	 * as such.
+	 */
+	if (msgbuf[0] != (IXGBE_VF_GET_RSS_KEY | IXGBE_VT_MSGTYPE_ACK))
+		return IXGBE_ERR_MBX;
+
+	memcpy(rss_key, msgbuf + 1, 40);
+
+	return 0;
+}
+
+/**
  * ixgbevf_get_reta - get the RSS redirection table (RETA) contents.
  * @hw: pointer to the HW structure
  * @reta: buffer to fill with RETA contents.
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index 73c1b33..54f53f2b8 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -209,5 +209,6 @@ int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
 int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 		       unsigned int *default_tc);
 int ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *reta);
+int ixgbevf_get_rss_key(struct ixgbe_hw *hw, u8 *rss_key);
 #endif /* __IXGBE_VF_H__ */
 
-- 
2.1.0

^ permalink raw reply related

* [PATCH net-next v2 2/5] ixgbevf: Add a RETA query code
From: Vlad Zolotarov @ 2014-12-31 17:40 UTC (permalink / raw)
  To: netdev; +Cc: gleb, avi, jeffrey.t.kirsher, Vlad Zolotarov
In-Reply-To: <1420047639-10862-1-git-send-email-vladz@cloudius-systems.com>

   - Added a new API version support.
   - Added the query implementation in the ixgbevf.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
---
New in v1 (compared to RFC):
   - Use "if-else" statement instead of a "switch-case" for a single option case
     (in ixgbevf_get_reta()).
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  4 +-
 drivers/net/ethernet/intel/ixgbevf/mbx.h          |  6 ++
 drivers/net/ethernet/intel/ixgbevf/vf.c           | 73 +++++++++++++++++++++++
 drivers/net/ethernet/intel/ixgbevf/vf.h           |  1 +
 4 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 62a0d8e..ba6ab61 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -1880,7 +1880,8 @@ static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter)
 static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	int api[] = { ixgbe_mbox_api_11,
+	int api[] = { ixgbe_mbox_api_12,
+		      ixgbe_mbox_api_11,
 		      ixgbe_mbox_api_10,
 		      ixgbe_mbox_api_unknown };
 	int err = 0, idx = 0;
@@ -3525,6 +3526,7 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)
 
 	switch (adapter->hw.api_version) {
 	case ixgbe_mbox_api_11:
+	case ixgbe_mbox_api_12:
 		max_possible_frame = IXGBE_MAX_JUMBO_FRAME_SIZE;
 		break;
 	default:
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/ethernet/intel/ixgbevf/mbx.h
index 0bc3005..3e148a8 100644
--- a/drivers/net/ethernet/intel/ixgbevf/mbx.h
+++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h
@@ -86,6 +86,7 @@ enum ixgbe_pfvf_api_rev {
 	ixgbe_mbox_api_10,	/* API version 1.0, linux/freebsd VF driver */
 	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
 	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
+	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
 	/* This value should always be last */
 	ixgbe_mbox_api_unknown,	/* indicates that API version is not known */
 };
@@ -104,6 +105,11 @@ enum ixgbe_pfvf_api_rev {
 /* mailbox API, version 1.1 VF requests */
 #define IXGBE_VF_GET_QUEUE	0x09 /* get queue configuration */
 
+/* mailbox API, version 1.2 VF requests */
+#define IXGBE_VF_GET_RETA_0	0x0a /* get RETA[0..11]  */
+#define IXGBE_VF_GET_RETA_1	0x0b /* get RETA[12..23] */
+#define IXGBE_VF_GET_RETA_2	0x0c /* get RETA[24..31] */
+
 /* GET_QUEUES return data indices within the mailbox */
 #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
 #define IXGBE_VF_RX_QUEUES	2	/* number of Rx queues supported */
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
index cdb53be..8b98cdf 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.c
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
@@ -258,6 +258,78 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
 	return ret_val;
 }
 
+static inline int _ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *msgbuf,
+				    u32 *reta, u32 op, int reta_offset_dw,
+				    size_t dwords)
+{
+	int err;
+
+	msgbuf[0] = op;
+	err = hw->mbx.ops.write_posted(hw, msgbuf, 1);
+
+	if (err)
+		return err;
+
+	err = hw->mbx.ops.read_posted(hw, msgbuf, 1 + dwords);
+
+	if (err)
+		return err;
+
+	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
+
+	/* If we didn't get an ACK there must have been
+	 * some sort of mailbox error so we should treat it
+	 * as such.
+	 */
+	if (msgbuf[0] != (op | IXGBE_VT_MSGTYPE_ACK))
+		return IXGBE_ERR_MBX;
+
+	memcpy(reta + reta_offset_dw, msgbuf + 1, 4 * dwords);
+
+	return 0;
+}
+
+/**
+ * ixgbevf_get_reta - get the RSS redirection table (RETA) contents.
+ * @hw: pointer to the HW structure
+ * @reta: buffer to fill with RETA contents.
+ *
+ * The "reta" buffer should be big enough to contain 32 registers.
+ *
+ * Returns: 0 on success.
+ *          if API doesn't support this operation - (-EPERM).
+ */
+int ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *reta)
+{
+	int err;
+	u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
+
+	/* Return an error if API doesn't RETA querying. */
+	if (hw->api_version != ixgbe_mbox_api_12)
+		return -EPERM;
+
+	/* Fetch RETA from the PF. We do it in 3 steps due to mailbox size
+	 * limitation - we can bring up to 15 dwords every time while RETA
+	 * consists of 32 dwords. Therefore we'll bring 12, 12 and 8 dwords in
+	 * each step correspondingly.
+	 */
+
+	/* RETA[0..11] */
+	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_0, 0, 12);
+	if (err)
+		return err;
+
+	/* RETA[12..23] */
+	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_1, 12, 12);
+	if (err)
+		return err;
+
+	/* RETA[24..31] */
+	err = _ixgbevf_get_reta(hw, msgbuf, reta, IXGBE_VF_GET_RETA_2, 24, 8);
+
+	return err;
+}
+
 /**
  *  ixgbevf_set_rar_vf - set device MAC address
  *  @hw: pointer to hardware structure
@@ -545,6 +617,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 	/* do nothing if API doesn't support ixgbevf_get_queues */
 	switch (hw->api_version) {
 	case ixgbe_mbox_api_11:
+	case ixgbe_mbox_api_12:
 		break;
 	default:
 		return 0;
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index 5b17242..73c1b33 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -208,5 +208,6 @@ void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
 int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
 int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 		       unsigned int *default_tc);
+int ixgbevf_get_reta(struct ixgbe_hw *hw, u32 *reta);
 #endif /* __IXGBE_VF_H__ */
 
-- 
2.1.0

^ permalink raw reply related

* [PATCH net-next v2 3/5] ixgbe: Add GET_RSS_KEY command to VF-PF channel commands set
From: Vlad Zolotarov @ 2014-12-31 17:40 UTC (permalink / raw)
  To: netdev; +Cc: gleb, avi, jeffrey.t.kirsher, Vlad Zolotarov
In-Reply-To: <1420047639-10862-1-git-send-email-vladz@cloudius-systems.com>

82599 VFs and PF share the same RSS Key. Therefore we will return
the same RSS key for all VFs.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
---
New in v1 (compared to RFC):
   - Use "if-else" statement instead of a "switch-case" for a single option case
     (in ixgbe_get_vf_rss_key()).
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h   |  2 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
index c1123d9..52e775b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
@@ -97,6 +97,8 @@ enum ixgbe_pfvf_api_rev {
 #define IXGBE_VF_GET_RETA_1	0x0b /* get RETA[12..23] */
 #define IXGBE_VF_GET_RETA_2	0x0c /* get RETA[24..31] */
 
+#define IXGBE_VF_GET_RSS_KEY	0x0d /* get RSS key */
+
 /* GET_QUEUES return data indices within the mailbox */
 #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
 #define IXGBE_VF_RX_QUEUES	2	/* number of Rx queues supported */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index b1625c8..d79415e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -966,6 +966,24 @@ static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter,
 	return 0;
 }
 
+static int ixgbe_get_vf_rss_key(struct ixgbe_adapter *adapter,
+				u32 *msgbuf, u32 vf)
+{
+	struct ixgbe_hw *hw = &adapter->hw;
+	int i;
+	u32 *rss_key = &msgbuf[1];
+
+	/* verify the PF is supporting the correct API */
+	if (adapter->vfinfo[vf].vf_api != ixgbe_mbox_api_12)
+		return -EPERM;
+
+	/* Read the RSS KEY */
+	for (i = 0; i < 10; i++)
+		rss_key[i] = IXGBE_READ_REG(hw, IXGBE_RSSRK(i));
+
+	return 0;
+}
+
 static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
 {
 	u32 mbx_size = IXGBE_VFMAILBOX_SIZE;
@@ -1031,6 +1049,9 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
 	case IXGBE_VF_GET_RETA_2:
 		retval = ixgbe_get_vf_reta(adapter, msgbuf, vf, 24, 8);
 		break;
+	case IXGBE_VF_GET_RSS_KEY:
+		retval = ixgbe_get_vf_rss_key(adapter, msgbuf, vf);
+		break;
 	default:
 		e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);
 		retval = IXGBE_ERR_MBX;
-- 
2.1.0

^ permalink raw reply related

* [PATCH net-next v2 1/5] ixgbe: Add a RETA query command to VF-PF channel API
From: Vlad Zolotarov @ 2014-12-31 17:40 UTC (permalink / raw)
  To: netdev; +Cc: gleb, avi, jeffrey.t.kirsher, Vlad Zolotarov
In-Reply-To: <1420047639-10862-1-git-send-email-vladz@cloudius-systems.com>

82599 VFs and PF share the same RSS redirection table (RETA). Therefore we
just return it for all VFs.

RETA table is an array of 32 registers and the maximum number of registers
that may be delivered in a single VF-PF channel command is 15. Therefore
we will deliver the whole table in 3 steps: 12, 12 and 8 registers in each
step correspondingly. Thus this patch does the following:

  - Adds a new API version (to specify a new commands set).
  - Adds the IXGBE_VF_GET_RETA_[0,1,2] commands to the VF-PF commands set.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
---
New in v1 (compared to RFC):
   - Use "if-else" statement instead of a "switch-case" for a single option case
     (in ixgbe_get_vf_reta()).
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h   |  6 +++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 31 ++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
index a5cb755..c1123d9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
@@ -73,6 +73,7 @@ enum ixgbe_pfvf_api_rev {
 	ixgbe_mbox_api_10,	/* API version 1.0, linux/freebsd VF driver */
 	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
 	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
+	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
 	/* This value should always be last */
 	ixgbe_mbox_api_unknown,	/* indicates that API version is not known */
 };
@@ -91,6 +92,11 @@ enum ixgbe_pfvf_api_rev {
 /* mailbox API, version 1.1 VF requests */
 #define IXGBE_VF_GET_QUEUES	0x09 /* get queue configuration */
 
+/* mailbox API, version 1.2 VF requests */
+#define IXGBE_VF_GET_RETA_0	0x0a /* get RETA[0..11]  */
+#define IXGBE_VF_GET_RETA_1	0x0b /* get RETA[12..23] */
+#define IXGBE_VF_GET_RETA_2	0x0c /* get RETA[24..31] */
+
 /* GET_QUEUES return data indices within the mailbox */
 #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
 #define IXGBE_VF_RX_QUEUES	2	/* number of Rx queues supported */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index c76ba90..b1625c8 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -427,6 +427,7 @@ static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
 #endif /* CONFIG_FCOE */
 		switch (adapter->vfinfo[vf].vf_api) {
 		case ixgbe_mbox_api_11:
+		case ixgbe_mbox_api_12:
 			/*
 			 * Version 1.1 supports jumbo frames on VFs if PF has
 			 * jumbo frames enabled which means legacy VFs are
@@ -894,6 +895,7 @@ static int ixgbe_negotiate_vf_api(struct ixgbe_adapter *adapter,
 	switch (api) {
 	case ixgbe_mbox_api_10:
 	case ixgbe_mbox_api_11:
+	case ixgbe_mbox_api_12:
 		adapter->vfinfo[vf].vf_api = api;
 		return 0;
 	default:
@@ -917,6 +919,7 @@ static int ixgbe_get_vf_queues(struct ixgbe_adapter *adapter,
 	switch (adapter->vfinfo[vf].vf_api) {
 	case ixgbe_mbox_api_20:
 	case ixgbe_mbox_api_11:
+	case ixgbe_mbox_api_12:
 		break;
 	default:
 		return -1;
@@ -944,6 +947,25 @@ static int ixgbe_get_vf_queues(struct ixgbe_adapter *adapter,
 	return 0;
 }
 
+static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter,
+			     u32 *msgbuf, u32 vf, int reta_offset_dw,
+			     size_t dwords)
+{
+	struct ixgbe_hw *hw = &adapter->hw;
+	int i;
+	u32 *reta = &msgbuf[1];
+
+	/* verify the PF is supporting the correct API */
+	if (adapter->vfinfo[vf].vf_api != ixgbe_mbox_api_12)
+		return -EPERM;
+
+	/* Read the appropriate portion of RETA */
+	for (i = 0; i < dwords; i++)
+		reta[i] = IXGBE_READ_REG(hw, IXGBE_RETA(i + reta_offset_dw));
+
+	return 0;
+}
+
 static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
 {
 	u32 mbx_size = IXGBE_VFMAILBOX_SIZE;
@@ -1000,6 +1022,15 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
 	case IXGBE_VF_GET_QUEUES:
 		retval = ixgbe_get_vf_queues(adapter, msgbuf, vf);
 		break;
+	case IXGBE_VF_GET_RETA_0:
+		retval = ixgbe_get_vf_reta(adapter, msgbuf, vf, 0, 12);
+		break;
+	case IXGBE_VF_GET_RETA_1:
+		retval = ixgbe_get_vf_reta(adapter, msgbuf, vf, 12, 12);
+		break;
+	case IXGBE_VF_GET_RETA_2:
+		retval = ixgbe_get_vf_reta(adapter, msgbuf, vf, 24, 8);
+		break;
 	default:
 		e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);
 		retval = IXGBE_ERR_MBX;
-- 
2.1.0

^ permalink raw reply related

* [PATCH net-next v2 0/5]: ixgbevf: Allow querying VFs RSS indirection table and key
From: Vlad Zolotarov @ 2014-12-31 17:40 UTC (permalink / raw)
  To: netdev; +Cc: gleb, avi, jeffrey.t.kirsher, Vlad Zolotarov

Add the ethtool ops to VF driver to allow querying the RSS indirection table
and RSS Random Key.
 
 - PF driver: Add new VF-PF channel commands.
 - VF driver: Utilize these new commands and add the corresponding
              ethtool callbacks.
 
New in v2:
   - Added a detailed description to patches 4 and 5.

New in v1 (compared to RFC):
   - Use "if-else" statement instead of a "switch-case" for a single option case.
     More specifically: in cases where the newly added API version is the only one
     allowed. We may consider using a "switch-case" back again when the list of
     allowed API versions in these specific places grows up.

Vlad Zolotarov (5):
  ixgbe: Add a RETA query command to VF-PF channel API
  ixgbevf: Add a RETA query code
  ixgbe: Add GET_RSS_KEY command to VF-PF channel commands set
  ixgbevf: Add RSS Key query code
  ixgbevf: Add the appropriate ethtool ops to query RSS indirection
    table and key

 drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h      |   8 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c    |  52 ++++++++++
 drivers/net/ethernet/intel/ixgbevf/ethtool.c      |  37 +++++++
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   4 +-
 drivers/net/ethernet/intel/ixgbevf/mbx.h          |   8 ++
 drivers/net/ethernet/intel/ixgbevf/vf.c           | 117 ++++++++++++++++++++++
 drivers/net/ethernet/intel/ixgbevf/vf.h           |   2 +
 7 files changed, 227 insertions(+), 1 deletion(-)

-- 
2.1.0

^ permalink raw reply

* [PATCH] Drivers: isdn: gigaset: checkpatch cleanup
From: Bas Peters @ 2014-12-31 17:34 UTC (permalink / raw)
  To: hjlipp; +Cc: tilman, isdn, gigaset307x-common, netdev, linux-kernel,
	Bas Peters

Fixed many checkpatch.pl complaints, ranging from whitespace issues to
reportedly deprecated function and macro usage.

I have not been able to test the code as I do not have access to the
hardware but since no new features were really added I don't think that
should pose a problem.

There are still some checkpatch complaints, particularly concerning
potentially unnecessary 'out of memory' messages. I will provide patches
for these complaints when I figure out the reason behind it and what to
do about it.

NOTE: This is my first patch (ever). I have attempted to follow all
guidelines provided, but I probably will have missed some. If you have
any comments regarding the quality of this patch or suggestions as to
what I could do better in the future, please let me know.

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 drivers/isdn/gigaset/asyncdata.c   |  9 +++--
 drivers/isdn/gigaset/bas-gigaset.c | 80 ++++++++++++++++++++------------------
 drivers/isdn/gigaset/capi.c        |  5 ++-
 drivers/isdn/gigaset/common.c      |  8 ++--
 drivers/isdn/gigaset/ev-layer.c    | 38 +++++++++++-------
 drivers/isdn/gigaset/gigaset.h     |  4 +-
 drivers/isdn/gigaset/i4l.c         | 12 +++---
 drivers/isdn/gigaset/interface.c   | 10 ++---
 drivers/isdn/gigaset/isocdata.c    |  3 ++
 drivers/isdn/gigaset/proc.c        | 17 +++++---
 drivers/isdn/gigaset/usb-gigaset.c | 46 +++++++++++++++-------
 11 files changed, 141 insertions(+), 91 deletions(-)

diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
index c90dca5..6120c2b 100644
--- a/drivers/isdn/gigaset/asyncdata.c
+++ b/drivers/isdn/gigaset/asyncdata.c
@@ -25,9 +25,12 @@
  */
 static inline int muststuff(unsigned char c)
 {
-	if (c < PPP_TRANS) return 1;
-	if (c == PPP_FLAG) return 1;
-	if (c == PPP_ESCAPE) return 1;
+	if (c < PPP_TRANS)
+		return 1;
+	if (c == PPP_FLAG)
+		return 1;
+	if (c == PPP_ESCAPE)
+		return 1;
 	/* other possible candidates: */
 	/* 0x91: XON with parity set */
 	/* 0x93: XOFF with parity set */
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index aecec6d..c31a416 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -261,11 +261,12 @@ static inline void dump_urb(enum debuglevel level, const char *tag,
 {
 #ifdef CONFIG_GIGASET_DEBUG
 	int i;
+
 	gig_dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb);
 	if (urb) {
 		gig_dbg(level,
-			"  dev=0x%08lx, pipe=%s:EP%d/DV%d:%s, "
-			"hcpriv=0x%08lx, transfer_flags=0x%x,",
+			"  dev=0x%08lx, pipe=%s:EP%d/DV%d:%s,
+			hcpriv=0x%08lx, transfer_flags=0x%x,",
 			(unsigned long) urb->dev,
 			usb_pipetype_str(urb->pipe),
 			usb_pipeendpoint(urb->pipe), usb_pipedevice(urb->pipe),
@@ -273,27 +274,26 @@ static inline void dump_urb(enum debuglevel level, const char *tag,
 			(unsigned long) urb->hcpriv,
 			urb->transfer_flags);
 		gig_dbg(level,
-			"  transfer_buffer=0x%08lx[%d], actual_length=%d, "
-			"setup_packet=0x%08lx,",
+			"  transfer_buffer=0x%08lx[%d], actual_length=%d,
+			setup_packet=0x%08lx,",
 			(unsigned long) urb->transfer_buffer,
 			urb->transfer_buffer_length, urb->actual_length,
 			(unsigned long) urb->setup_packet);
 		gig_dbg(level,
-			"  start_frame=%d, number_of_packets=%d, interval=%d, "
-			"error_count=%d,",
+			"  start_frame=%d, number_of_packets=%d, interval=%d,
+			error_count=%d,",
 			urb->start_frame, urb->number_of_packets, urb->interval,
 			urb->error_count);
 		gig_dbg(level,
-			"  context=0x%08lx, complete=0x%08lx, "
-			"iso_frame_desc[]={",
+			"  context=0x%08lx, complete=0x%08lx,
+			iso_frame_desc[]={",
 			(unsigned long) urb->context,
 			(unsigned long) urb->complete);
 		for (i = 0; i < urb->number_of_packets; i++) {
 			struct usb_iso_packet_descriptor *pifd
 				= &urb->iso_frame_desc[i];
 			gig_dbg(level,
-				"    {offset=%u, length=%u, actual_length=%u, "
-				"status=%u}",
+				"    {offset=%u, length=%u, actual_length=%u, status=%u}",
 				pifd->offset, pifd->length, pifd->actual_length,
 				pifd->status);
 		}
@@ -566,8 +566,8 @@ static int atread_submit(struct cardstate *cs, int timeout)
 
 	if (basstate & BS_SUSPEND) {
 		dev_notice(cs->dev,
-			   "HD_READ_ATMESSAGE not submitted, "
-			   "suspend in progress\n");
+			   "HD_READ_ATMESSAGE not submitted,\
+			   suspend in progress\n");
 		update_basstate(ucs, 0, BS_ATRDPEND);
 		/* treat like disconnect */
 		return -ENODEV;
@@ -1331,8 +1331,8 @@ static void read_iso_tasklet(unsigned long data)
 
 		if (unlikely(!(ubc->running))) {
 			gig_dbg(DEBUG_ISO,
-				"%s: channel not running, "
-				"dropped URB with status: %s",
+				"%s: channel not running,
+				dropped URB with status: %s",
 				__func__, get_usb_statmsg(status));
 			return;
 		}
@@ -1602,8 +1602,8 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout)
 	if (ucs->pending) {
 		spin_unlock_irqrestore(&ucs->lock, flags);
 		dev_err(bcs->cs->dev,
-			"submission of request 0x%02x failed: "
-			"request 0x%02x still pending\n",
+			"submission of request 0x%02x failed:\
+			request 0x%02x still pending\n",
 			req, ucs->pending);
 		return -EBUSY;
 	}
@@ -1797,23 +1797,23 @@ static void write_command_callback(struct urb *urb)
 	default:				/* any failure */
 		if (++ucs->retry_cmd_out > BAS_RETRY) {
 			dev_warn(cs->dev,
-				 "command write: %s, "
-				 "giving up after %d retries\n",
+				 "command write: %s,\
+				 giving up after %d retries\n",
 				 get_usb_statmsg(status),
 				 ucs->retry_cmd_out);
 			break;
 		}
 		if (ucs->basstate & BS_SUSPEND) {
 			dev_warn(cs->dev,
-				 "command write: %s, "
-				 "won't retry - suspend requested\n",
+				 "command write: %s,\
+				 won't retry - suspend requested\n",
 				 get_usb_statmsg(status));
 			break;
 		}
 		if (cs->cmdbuf == NULL) {
 			dev_warn(cs->dev,
-				 "command write: %s, "
-				 "cannot retry - cmdbuf gone\n",
+				 "command write: %s,\
+				 cannot retry - cmdbuf gone\n",
 				 get_usb_statmsg(status));
 			break;
 		}
@@ -2200,7 +2200,7 @@ static int gigaset_initcshw(struct cardstate *cs)
 {
 	struct bas_cardstate *ucs;
 
-	cs->hw.bas = ucs = kmalloc(sizeof *ucs, GFP_KERNEL);
+	cs->hw.bas = ucs = kmalloc(sizeof(*ucs), GFP_KERNEL);
 	if (!ucs) {
 		pr_err("out of memory\n");
 		return -ENOMEM;
@@ -2300,8 +2300,8 @@ static int gigaset_probe(struct usb_interface *interface,
 			__func__, hostif->desc.bAlternateSetting);
 		if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3)
 		    < 0) {
-			dev_warn(&udev->dev, "usb_set_interface failed, "
-				 "device %d interface %d altsetting %d\n",
+			dev_warn(&udev->dev, "usb_set_interface failed,\
+					device %d interface %d altsetting %d\n",
 				 udev->devnum, hostif->desc.bInterfaceNumber,
 				 hostif->desc.bAlternateSetting);
 			return -ENODEV;
@@ -2312,13 +2312,13 @@ static int gigaset_probe(struct usb_interface *interface,
 	/* Reject application specific interfaces
 	 */
 	if (hostif->desc.bInterfaceClass != 255) {
-		dev_warn(&udev->dev, "%s: bInterfaceClass == %d\n",
+		dev_warn(&udev->dev, "%s: bInterfaceClass == %d\n",\
 			 __func__, hostif->desc.bInterfaceClass);
 		return -ENODEV;
 	}
 
 	dev_info(&udev->dev,
-		 "%s: Device matched (Vendor: 0x%x, Product: 0x%x)\n",
+		 "%s: Device matched (Vendor: 0x%x, Product: 0x%x)\n",\
 		 __func__, le16_to_cpu(udev->descriptor.idVendor),
 		 le16_to_cpu(udev->descriptor.idProduct));
 
@@ -2340,22 +2340,28 @@ static int gigaset_probe(struct usb_interface *interface,
 	 * - three for the different uses of the default control pipe
 	 * - three for each isochronous pipe
 	 */
-	if (!(ucs->urb_int_in = usb_alloc_urb(0, GFP_KERNEL)) ||
-	    !(ucs->urb_cmd_in = usb_alloc_urb(0, GFP_KERNEL)) ||
-	    !(ucs->urb_cmd_out = usb_alloc_urb(0, GFP_KERNEL)) ||
-	    !(ucs->urb_ctrl = usb_alloc_urb(0, GFP_KERNEL)))
+	ucs->urb_int_in = usb_alloc_urb(0, GFP_KERNEL);
+	ucs->urb_cmd_in = usb_alloc_urb(0, GFP_KERNEL);
+	ucs->urb_cmd_out = usb_alloc_urb(0, GFP_KERNEL);
+	ucs->urb_ctrl = usb_alloc_urb(0, GFP_KERNEL);
+
+	if (!ucs->urb_int_in || !ucs->urb_cmd_in
+			|| !ucs->urb_cmd_out || !ucs->urb_ctrl)
 		goto allocerr;
 
 	for (j = 0; j < BAS_CHANNELS; ++j) {
 		ubc = cs->bcs[j].hw.bas;
-		for (i = 0; i < BAS_OUTURBS; ++i)
-			if (!(ubc->isoouturbs[i].urb =
-			      usb_alloc_urb(BAS_NUMFRAMES, GFP_KERNEL)))
+		for (i = 0; i < BAS_OUTURBS; ++i) {
+			ubc->isoouturbs[i].urb = usb_alloc_urb(BAS_NUMFRAMES, GFP_KERNEL);
+			if (!ubc->isoouturbs[i].urb)
 				goto allocerr;
-		for (i = 0; i < BAS_INURBS; ++i)
-			if (!(ubc->isoinurbs[i] =
-			      usb_alloc_urb(BAS_NUMFRAMES, GFP_KERNEL)))
+		}
+
+		for (i = 0; i < BAS_INURBS; ++i) {
+			ubc->isoinurbs[i] = usb_alloc_urb(BAS_NUMFRAMES, GFP_KERNEL);
+			if (!ubc->isoinurbs[i])
 				goto allocerr;
+		}
 	}
 
 	ucs->rcvbuf = NULL;
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index ccec777..2503d02 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -164,6 +164,7 @@ static inline void ignore_cstruct_param(struct cardstate *cs, _cstruct param,
 static int encode_ie(char *in, u8 *out, int maxlen)
 {
 	int l = 0;
+
 	while (*in) {
 		if (!isxdigit(in[0]) || !isxdigit(in[1]) || l >= maxlen)
 			return -1;
@@ -181,6 +182,7 @@ static int encode_ie(char *in, u8 *out, int maxlen)
 static void decode_ie(u8 *in, char *out)
 {
 	int i = *in;
+
 	while (i-- > 0) {
 		/* ToDo: conversion to upper case necessary? */
 		*out++ = toupper(hex_asc_hi(*++in));
@@ -983,6 +985,7 @@ void gigaset_isdn_start(struct cardstate *cs)
 void gigaset_isdn_stop(struct cardstate *cs)
 {
 	struct gigaset_capi_ctr *iif = cs->iif;
+
 	capi_ctr_down(&iif->ctr);
 }
 
@@ -1370,7 +1373,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
 	cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8;
 
 	/* build command table */
-	commands = kzalloc(AT_NUM * (sizeof *commands), GFP_KERNEL);
+	commands = kzalloc(AT_NUM * (sizeof(*commands)), GFP_KERNEL);
 	if (!commands)
 		goto oom;
 
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 7c78144..f6ee247 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -53,7 +53,7 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
 {
 	unsigned char outbuf[80];
 	unsigned char c;
-	size_t space = sizeof outbuf - 1;
+	size_t space = sizeof(outbuf - 1);
 	unsigned char *out = outbuf;
 	size_t numin = len;
 
@@ -434,6 +434,7 @@ static void make_valid(struct cardstate *cs, unsigned mask)
 {
 	unsigned long flags;
 	struct gigaset_driver *drv = cs->driver;
+
 	spin_lock_irqsave(&drv->lock, flags);
 	cs->flags |= mask;
 	spin_unlock_irqrestore(&drv->lock, flags);
@@ -443,6 +444,7 @@ static void make_invalid(struct cardstate *cs, unsigned mask)
 {
 	unsigned long flags;
 	struct gigaset_driver *drv = cs->driver;
+
 	spin_lock_irqsave(&drv->lock, flags);
 	cs->flags &= ~mask;
 	spin_unlock_irqrestore(&drv->lock, flags);
@@ -1077,7 +1079,7 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
 	unsigned long flags;
 	unsigned i;
 
-	drv = kmalloc(sizeof *drv, GFP_KERNEL);
+	drv = kmalloc(sizeof(*drv), GFP_KERNEL);
 	if (!drv)
 		return NULL;
 
@@ -1090,7 +1092,7 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
 	drv->owner = owner;
 	INIT_LIST_HEAD(&drv->list);
 
-	drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL);
+	drv->cs = kmalloc(minors * sizeof(*drv->cs), GFP_KERNEL);
 	if (!drv->cs)
 		goto error;
 
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index c8ced12..84b1700 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -147,8 +147,7 @@
 
 /* 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid),
  * 400: hup, 500: reset, 600: dial, 700: ring */
-struct reply_t gigaset_tab_nocid[] =
-{
+struct reply_t gigaset_tab_nocid[] = {
 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout,
  * action, command */
 
@@ -256,8 +255,7 @@ struct reply_t gigaset_tab_nocid[] =
 
 /* 600: start dialing, 650: dial in progress, 800: connection is up, 700: ring,
  * 400: hup, 750: accepted icall */
-struct reply_t gigaset_tab_cid[] =
-{
+struct reply_t gigaset_tab_cid[] = {
 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout,
  * action, command */
 
@@ -355,8 +353,7 @@ static const struct resp_type_t {
 	int	resp_code;
 	int	type;
 }
-resp_type[] =
-{
+resp_type[] = {
 	{"OK",		RSP_OK,		RT_NOTHING},
 	{"ERROR",	RSP_ERROR,	RT_NOTHING},
 	{"ZSAU",	RSP_ZSAU,	RT_ZSAU},
@@ -378,8 +375,7 @@ static const struct zsau_resp_t {
 	char	*str;
 	int	code;
 }
-zsau_resp[] =
-{
+zsau_resp[] = {
 	{"OUTGOING_CALL_PROCEEDING",	ZSAU_PROCEEDING},
 	{"CALL_DELIVERED",		ZSAU_CALL_DELIVERED},
 	{"ACTIVE",			ZSAU_ACTIVE},
@@ -1083,7 +1079,7 @@ static void do_action(int action, struct cardstate *cs,
 
 	int channel;
 
-	unsigned char *s, *e;
+	unsigned char *s;
 	int i;
 	unsigned long val;
 
@@ -1355,8 +1351,20 @@ static void do_action(int action, struct cardstate *cs,
 		}
 
 		for (i = 0; i < 4; ++i) {
-			val = simple_strtoul(s, (char **) &e, 10);
-			if (val > INT_MAX || e == s)
+			unsigned long *e;
+
+			val = kstrtoul(s, 10, e);
+			if (val == -EINVAL) {
+				dev_err(cs->dev, "Parsing error on converting string to\
+						 unsigned long\n");
+				break;
+			}
+			if (val == -ERANGE) {
+				dev_err(cs->dev, "Overflow error converting string to\
+						 unsigned long\n");
+				break;
+			}
+			if (val > INT_MAX || *e == s)
 				break;
 			if (i == 3) {
 				if (*e)
@@ -1364,7 +1372,7 @@ static void do_action(int action, struct cardstate *cs,
 			} else if (*e != '.')
 				break;
 			else
-				s = e + 1;
+				s = *e + 1;
 			cs->fwver[i] = val;
 		}
 		if (i != 4) {
@@ -1447,7 +1455,7 @@ static void do_action(int action, struct cardstate *cs,
 		else if (cs->gotfwver != 1) {
 			cs->cmd_result = -ENOENT;
 		} else {
-			memcpy(ev->arg, cs->fwver, sizeof cs->fwver);
+			memcpy(ev->arg, cs->fwver, sizeof(cs->fwver));
 			cs->cmd_result = 0;
 		}
 		cs->waiting = 0;
@@ -1576,8 +1584,8 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
 		rcode = rep->resp_code;
 		if (rcode == RSP_LAST) {
 			/* found nothing...*/
-			dev_warn(cs->dev, "%s: rcode=RSP_LAST: "
-				 "resp_code %d in ConState %d!\n",
+			dev_warn(cs->dev, "%s: rcode=RSP_LAST:\
+					 resp_code %d in ConState %d!\n",
 				 __func__, ev->type, at_state->ConState);
 			return;
 		}
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index eb63a0f..e5c6c98 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -94,8 +94,7 @@ enum debuglevel {
 #define gig_dbg(level, format, arg...)					\
 	do {								\
 		if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \
-			printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \
-			       ## arg);					\
+			dev_dbg(cs->dev, KBUILD_MODNAME ": " format "\n")\
 	} while (0)
 #define DEBUG_DEFAULT (DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
 
@@ -769,6 +768,7 @@ int gigaset_enterconfigmode(struct cardstate *cs);
 static inline void gigaset_schedule_event(struct cardstate *cs)
 {
 	unsigned long flags;
+
 	spin_lock_irqsave(&cs->lock, flags);
 	if (cs->running)
 		tasklet_schedule(&cs->event_tasklet);
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index 2d75329..57b7827 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -243,7 +243,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
 		dev_kfree_skb(bcs->rx_skb);
 		gigaset_new_rx_skb(bcs);
 
-		commands = kzalloc(AT_NUM * (sizeof *commands), GFP_ATOMIC);
+		commands = kzalloc(AT_NUM * (sizeof(*commands)), GFP_ATOMIC);
 		if (!commands) {
 			gigaset_free_channel(bcs);
 			dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n");
@@ -487,12 +487,12 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
 	}
 	if (at_state->str_var[STR_NMBR]) {
 		strlcpy(response.parm.setup.phone, at_state->str_var[STR_NMBR],
-			sizeof response.parm.setup.phone);
+			sizeof(response.parm.setup.phone));
 	} else
 		response.parm.setup.phone[0] = 0;
 	if (at_state->str_var[STR_ZCPN]) {
 		strlcpy(response.parm.setup.eazmsn, at_state->str_var[STR_ZCPN],
-			sizeof response.parm.setup.eazmsn);
+			sizeof(response.parm.setup.eazmsn));
 	} else
 		response.parm.setup.eazmsn[0] = 0;
 
@@ -624,14 +624,14 @@ int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid)
 {
 	isdn_if *iif;
 
-	iif = kmalloc(sizeof *iif, GFP_KERNEL);
+	iif = kmalloc(sizeof(*iif, GFP_KERNEL));
 	if (!iif) {
 		pr_err("out of memory\n");
 		return -ENOMEM;
 	}
 
-	if (snprintf(iif->id, sizeof iif->id, "%s_%u", isdnid, cs->minor_index)
-	    >= sizeof iif->id) {
+	if (snprintf(iif->id, sizeof(iif->id, "%s_%u", isdnid, cs->minor_index))
+	    >= sizeof(iif->id)) {
 		pr_err("ID too long: %s\n", isdnid);
 		kfree(iif);
 		return -EINVAL;
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index 600c79b..6da5d1c 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -67,10 +67,10 @@ static int if_version(struct cardstate *cs, unsigned arg[4])
 
 	switch (cmd) {
 	case GIGVER_DRIVER:
-		memcpy(arg, version, sizeof version);
+		memcpy(arg, version, sizeof(version));
 		return 0;
 	case GIGVER_COMPAT:
-		memcpy(arg, compat, sizeof compat);
+		memcpy(arg, compat, sizeof(compat));
 		return 0;
 	case GIGVER_FWBASE:
 		cs->waiting = 1;
@@ -212,13 +212,13 @@ static int if_ioctl(struct tty_struct *tty,
 			break;
 		case GIGASET_VERSION:
 			retval = copy_from_user(version,
-						(unsigned __user *) arg, sizeof version)
+						(unsigned __user *) arg, sizeof(version))
 				? -EFAULT : 0;
 			if (retval >= 0)
 				retval = if_version(cs, version);
 			if (retval >= 0)
 				retval = copy_to_user((unsigned __user *) arg,
-						      version, sizeof version)
+						      version, sizeof(version))
 					? -EFAULT : 0;
 			break;
 		default:
@@ -510,7 +510,7 @@ void gigaset_if_init(struct cardstate *cs)
 	if (!IS_ERR(cs->tty_dev))
 		dev_set_drvdata(cs->tty_dev, cs);
 	else {
-		pr_warning("could not register device to the tty subsystem\n");
+		pr_warn("could not register device to the tty subsystem\n");
 		cs->tty_dev = NULL;
 	}
 	mutex_unlock(&cs->mutex);
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index bc29f1d..32ed9c5 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -79,6 +79,7 @@ static inline int isowbuf_startwrite(struct isowbuf_t *iwb)
 static inline int isowbuf_donewrite(struct isowbuf_t *iwb)
 {
 	int write = iwb->write;
+
 	atomic_inc(&iwb->writesem);
 	return write;
 }
@@ -93,6 +94,7 @@ static inline int isowbuf_donewrite(struct isowbuf_t *iwb)
 static inline void isowbuf_putbits(struct isowbuf_t *iwb, u32 data, int nbits)
 {
 	int write = iwb->write;
+
 	data <<= iwb->wbits;
 	data |= iwb->data[write];
 	nbits += iwb->wbits;
@@ -770,6 +772,7 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count,
 					/* stuff bit at position lead1,
 					 * no interior stuffing */
 					unsigned char mask = (1 << lead1) - 1;
+
 					c = (c & mask) | ((c & ~mask) >> 1);
 					inbyte |= c << inbits;
 					inbits += 7;
diff --git a/drivers/isdn/gigaset/proc.c b/drivers/isdn/gigaset/proc.c
index e3f9d0f..10368a7 100644
--- a/drivers/isdn/gigaset/proc.c
+++ b/drivers/isdn/gigaset/proc.c
@@ -27,13 +27,18 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
 			   const char *buf, size_t count)
 {
 	struct cardstate *cs = dev_get_drvdata(dev);
-	long int value;
-	char *end;
+	long int *value;
+	int result;
 
-	value = simple_strtol(buf, &end, 0);
-	while (*end)
-		if (!isspace(*end++))
-			return -EINVAL;
+	result = kstrtol(buf, 0, &value);
+	if (result == -ERANGE)
+		/* Overflow error */
+		dev_err(cs->dev, "Overflow error on conversion from string to\
+				 long\n");
+	if (result == -EINVAL)
+		/* Parsing error  */
+		dev_err(cs->dev, "Parsing error on conversion from string to\
+				 long\n");
 	if (value < 0 || value > 1)
 		return -EINVAL;
 
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index a8e652d..5f56511 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -216,20 +216,40 @@ static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag)
 	cflag &= CBAUD;
 
 	switch (cflag) {
-	case    B300: rate =     300; break;
-	case    B600: rate =     600; break;
-	case   B1200: rate =    1200; break;
-	case   B2400: rate =    2400; break;
-	case   B4800: rate =    4800; break;
-	case   B9600: rate =    9600; break;
-	case  B19200: rate =   19200; break;
-	case  B38400: rate =   38400; break;
-	case  B57600: rate =   57600; break;
-	case B115200: rate =  115200; break;
+	case    B300:
+		rate =     300;
+		break;
+	case    B600:
+		rate =     600;
+		break;
+	case   B1200:
+		rate =    1200;
+		break;
+	case   B2400:
+		rate =    2400;
+		break;
+	case   B4800:
+		rate =    4800;
+		break;
+	case   B9600:
+		rate =    9600;
+		break;
+	case  B19200:
+		rate =   19200;
+		break;
+	case  B38400:
+		rate =   38400;
+		break;
+	case  B57600:
+		rate =   57600;
+		break;
+	case B115200:
+		rate =  115200;
+		break;
 	default:
 		rate =  9600;
-		dev_err(cs->dev, "unsupported baudrate request 0x%x,"
-			" using default of B9600\n", cflag);
+		dev_err(cs->dev, "unsupported baudrate request 0x%x,\
+				 using default of B9600\n", cflag);
 	}
 
 	val = 0x383fff / rate + 1;
@@ -619,7 +639,7 @@ static int write_modem(struct cardstate *cs)
 	}
 
 	/* Copy data to bulk out buffer and transmit data */
-	count = min(bcs->tx_skb->len, (unsigned) ucs->bulk_out_size);
+	count = min_t(unsigned, bcs->tx_skb->len, ucs->bulk_out_size);
 	skb_copy_from_linear_data(bcs->tx_skb, ucs->bulk_out_buffer, count);
 	skb_pull(bcs->tx_skb, count);
 	ucs->busy = 1;
-- 
1.8.4.5

^ permalink raw reply related

* Re: [PATCH net-next v1 4/5] ixgbevf: Add RSS Key query code
From: Vlad Zolotarov @ 2014-12-31 17:01 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: netdev, gleb, avi
In-Reply-To: <1420043307.31582.53.camel@jtkirshe-mobl>


On 12/31/14 18:28, Jeff Kirsher wrote:
> On Wed, 2014-12-31 at 11:51 +0200, Vlad Zolotarov wrote:
>> Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
>> ---
>> New in v1 (compared to RFC):
>>     - Use "if-else" statement instead of a "switch-case" for a single
>> option case
>>       (in ixgbevf_get_rss_key()).
>>
>> ---
>>   drivers/net/ethernet/intel/ixgbevf/mbx.h |  2 ++
>>   drivers/net/ethernet/intel/ixgbevf/vf.c  | 44
>> ++++++++++++++++++++++++++++++++
>>   drivers/net/ethernet/intel/ixgbevf/vf.h  |  1 +
>>   3 files changed, 47 insertions(+)
> Just caught this now, sorry but your patch description is sparse (i.e.
> non-existent).  I know that the title of the patch pretty much tells
> what you are doing, but it would be nice to have a bit more detail as to
> why (like your first patch).
>
> Same goes for patch 5 of the series as well.

No problema. ;)
Will send the v2.

^ permalink raw reply


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