Netdev List
 help / color / mirror / Atom feed
* [patch net-next 02/19] team: for nomode use dummy struct team_mode
From: Jiri Pirko @ 2012-06-19 15:54 UTC (permalink / raw)
  To: netdev; +Cc: davem, eric.dumazet, jbrouer
In-Reply-To: <1340121261-2966-1-git-send-email-jpirko@redhat.com>

That leaves team->mode and all its values valid so no checks would be
needed (for example in team_mode_option_get()).

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/team/team.c |   29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index bdf87a9..343f4ff 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -479,6 +479,20 @@ rx_handler_result_t team_dummy_receive(struct team *team,
 	return RX_HANDLER_ANOTHER;
 }
 
+static const struct team_mode __team_no_mode = {
+	.kind		= "*NOMODE*",
+};
+
+static bool team_is_mode_set(struct team *team)
+{
+	return team->mode != &__team_no_mode;
+}
+
+static void team_set_no_mode(struct team *team)
+{
+	team->mode = &__team_no_mode;
+}
+
 static void team_adjust_ops(struct team *team)
 {
 	/*
@@ -487,13 +501,13 @@ static void team_adjust_ops(struct team *team)
 	 */
 
 	if (list_empty(&team->port_list) ||
-	    !team->mode || !team->mode->ops->transmit)
+	    !team_is_mode_set(team) || !team->mode->ops->transmit)
 		team->ops.transmit = team_dummy_transmit;
 	else
 		team->ops.transmit = team->mode->ops->transmit;
 
 	if (list_empty(&team->port_list) ||
-	    !team->mode || !team->mode->ops->receive)
+	    !team_is_mode_set(team) || !team->mode->ops->receive)
 		team->ops.receive = team_dummy_receive;
 	else
 		team->ops.receive = team->mode->ops->receive;
@@ -508,7 +522,7 @@ static int __team_change_mode(struct team *team,
 			      const struct team_mode *new_mode)
 {
 	/* Check if mode was previously set and do cleanup if so */
-	if (team->mode) {
+	if (team_is_mode_set(team)) {
 		void (*exit_op)(struct team *team) = team->ops.exit;
 
 		/* Clear ops area so no callback is called any longer */
@@ -518,7 +532,7 @@ static int __team_change_mode(struct team *team,
 		if (exit_op)
 			exit_op(team);
 		team_mode_put(team->mode);
-		team->mode = NULL;
+		team_set_no_mode(team);
 		/* zero private data area */
 		memset(&team->mode_priv, 0,
 		       sizeof(struct team) - offsetof(struct team, mode_priv));
@@ -553,7 +567,7 @@ static int team_change_mode(struct team *team, const char *kind)
 		return -EBUSY;
 	}
 
-	if (team->mode && strcmp(team->mode->kind, kind) == 0) {
+	if (team_is_mode_set(team) && strcmp(team->mode->kind, kind) == 0) {
 		netdev_err(dev, "Unable to change to the same mode the team is in\n");
 		return -EINVAL;
 	}
@@ -912,11 +926,9 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
  * Net device ops
  *****************/
 
-static const char team_no_mode_kind[] = "*NOMODE*";
-
 static int team_mode_option_get(struct team *team, struct team_gsetter_ctx *ctx)
 {
-	ctx->data.str_val = team->mode ? team->mode->kind : team_no_mode_kind;
+	ctx->data.str_val = team->mode->kind;
 	return 0;
 }
 
@@ -1014,6 +1026,7 @@ static int team_init(struct net_device *dev)
 
 	team->dev = dev;
 	mutex_init(&team->lock);
+	team_set_no_mode(team);
 
 	team->pcpu_stats = alloc_percpu(struct team_pcpu_stats);
 	if (!team->pcpu_stats)
-- 
1.7.10.2

^ permalink raw reply related

* [patch net-next 01/19] team: make team_mode struct const
From: Jiri Pirko @ 2012-06-19 15:54 UTC (permalink / raw)
  To: netdev; +Cc: davem, eric.dumazet, jbrouer
In-Reply-To: <1340121261-2966-1-git-send-email-jpirko@redhat.com>

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/team/team.c                   |   55 ++++++++++++++++++++---------
 drivers/net/team/team_mode_activebackup.c |    2 +-
 drivers/net/team/team_mode_loadbalance.c  |    2 +-
 drivers/net/team/team_mode_roundrobin.c   |    2 +-
 include/linux/if_team.h                   |    5 ++-
 5 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index c61ae35..bdf87a9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -371,13 +371,18 @@ static int team_option_set(struct team *team,
 static LIST_HEAD(mode_list);
 static DEFINE_SPINLOCK(mode_list_lock);
 
-static struct team_mode *__find_mode(const char *kind)
+struct team_mode_item {
+	struct list_head list;
+	const struct team_mode *mode;
+};
+
+static struct team_mode_item *__find_mode(const char *kind)
 {
-	struct team_mode *mode;
+	struct team_mode_item *mitem;
 
-	list_for_each_entry(mode, &mode_list, list) {
-		if (strcmp(mode->kind, kind) == 0)
-			return mode;
+	list_for_each_entry(mitem, &mode_list, list) {
+		if (strcmp(mitem->mode->kind, kind) == 0)
+			return mitem;
 	}
 	return NULL;
 }
@@ -392,49 +397,65 @@ static bool is_good_mode_name(const char *name)
 	return true;
 }
 
-int team_mode_register(struct team_mode *mode)
+int team_mode_register(const struct team_mode *mode)
 {
 	int err = 0;
+	struct team_mode_item *mitem;
 
 	if (!is_good_mode_name(mode->kind) ||
 	    mode->priv_size > TEAM_MODE_PRIV_SIZE)
 		return -EINVAL;
+
+	mitem = kmalloc(sizeof(*mitem), GFP_KERNEL);
+	if (!mitem)
+		return -ENOMEM;
+
 	spin_lock(&mode_list_lock);
 	if (__find_mode(mode->kind)) {
 		err = -EEXIST;
+		kfree(mitem);
 		goto unlock;
 	}
-	list_add_tail(&mode->list, &mode_list);
+	mitem->mode = mode;
+	list_add_tail(&mitem->list, &mode_list);
 unlock:
 	spin_unlock(&mode_list_lock);
 	return err;
 }
 EXPORT_SYMBOL(team_mode_register);
 
-int team_mode_unregister(struct team_mode *mode)
+void team_mode_unregister(const struct team_mode *mode)
 {
+	struct team_mode_item *mitem;
+
 	spin_lock(&mode_list_lock);
-	list_del_init(&mode->list);
+	mitem = __find_mode(mode->kind);
+	if (mitem) {
+		list_del_init(&mitem->list);
+		kfree(mitem);
+	}
 	spin_unlock(&mode_list_lock);
-	return 0;
 }
 EXPORT_SYMBOL(team_mode_unregister);
 
-static struct team_mode *team_mode_get(const char *kind)
+static const struct team_mode *team_mode_get(const char *kind)
 {
-	struct team_mode *mode;
+	struct team_mode_item *mitem;
+	const struct team_mode *mode = NULL;
 
 	spin_lock(&mode_list_lock);
-	mode = __find_mode(kind);
-	if (!mode) {
+	mitem = __find_mode(kind);
+	if (!mitem) {
 		spin_unlock(&mode_list_lock);
 		request_module("team-mode-%s", kind);
 		spin_lock(&mode_list_lock);
-		mode = __find_mode(kind);
+		mitem = __find_mode(kind);
 	}
-	if (mode)
+	if (mitem) {
+		mode = mitem->mode;
 		if (!try_module_get(mode->owner))
 			mode = NULL;
+	}
 
 	spin_unlock(&mode_list_lock);
 	return mode;
@@ -523,7 +544,7 @@ static int __team_change_mode(struct team *team,
 
 static int team_change_mode(struct team *team, const char *kind)
 {
-	struct team_mode *new_mode;
+	const struct team_mode *new_mode;
 	struct net_device *dev = team->dev;
 	int err;
 
diff --git a/drivers/net/team/team_mode_activebackup.c b/drivers/net/team/team_mode_activebackup.c
index fd6bd03..acd925f 100644
--- a/drivers/net/team/team_mode_activebackup.c
+++ b/drivers/net/team/team_mode_activebackup.c
@@ -108,7 +108,7 @@ static const struct team_mode_ops ab_mode_ops = {
 	.port_leave		= ab_port_leave,
 };
 
-static struct team_mode ab_mode = {
+static const struct team_mode ab_mode = {
 	.kind		= "activebackup",
 	.owner		= THIS_MODULE,
 	.priv_size	= sizeof(struct ab_priv),
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
index 86e8183..6452428 100644
--- a/drivers/net/team/team_mode_loadbalance.c
+++ b/drivers/net/team/team_mode_loadbalance.c
@@ -148,7 +148,7 @@ static const struct team_mode_ops lb_mode_ops = {
 	.transmit		= lb_transmit,
 };
 
-static struct team_mode lb_mode = {
+static const struct team_mode lb_mode = {
 	.kind		= "loadbalance",
 	.owner		= THIS_MODULE,
 	.priv_size	= sizeof(struct lb_priv),
diff --git a/drivers/net/team/team_mode_roundrobin.c b/drivers/net/team/team_mode_roundrobin.c
index 6abfbdc..daafca2 100644
--- a/drivers/net/team/team_mode_roundrobin.c
+++ b/drivers/net/team/team_mode_roundrobin.c
@@ -81,7 +81,7 @@ static const struct team_mode_ops rr_mode_ops = {
 	.port_change_mac	= rr_port_change_mac,
 };
 
-static struct team_mode rr_mode = {
+static const struct team_mode rr_mode = {
 	.kind		= "roundrobin",
 	.owner		= THIS_MODULE,
 	.priv_size	= sizeof(struct rr_priv),
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 8185f57..d45fcd5 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -105,7 +105,6 @@ struct team_option {
 };
 
 struct team_mode {
-	struct list_head list;
 	const char *kind;
 	struct module *owner;
 	size_t priv_size;
@@ -178,8 +177,8 @@ extern int team_options_register(struct team *team,
 extern void team_options_unregister(struct team *team,
 				    const struct team_option *option,
 				    size_t option_count);
-extern int team_mode_register(struct team_mode *mode);
-extern int team_mode_unregister(struct team_mode *mode);
+extern int team_mode_register(const struct team_mode *mode);
+extern void team_mode_unregister(const struct team_mode *mode);
 
 #endif /* __KERNEL__ */
 
-- 
1.7.10.2

^ permalink raw reply related

* [patch net-next 00/19] team: couple of patches
From: Jiri Pirko @ 2012-06-19 15:54 UTC (permalink / raw)
  To: netdev; +Cc: davem, eric.dumazet, jbrouer

The main impact is this patchset provides an implementation of userspace driven
TX loadbalancing for team driver.

Also couple of typos are fixed, minor issues fixes.

Jiri Pirko (19):
  team: make team_mode struct const
  team: for nomode use dummy struct team_mode
  team: add mode priv to port
  team: lb: push hash counting into separate function
  team: allow read/write-only options
  team: introduce array options
  team: comments: s/net\/drivers\/team/drivers\/net\/team/
  team: push array_index and port into separate structure
  team: allow async option changes
  team: fix error path in team_nl_fill_options_get()
  team: fix error path in team_nl_fill_port_list_get()
  team: allow to specify one option instance to be send to userspace
  team: pass NULL to __team_option_inst_add() instead of 0
  team: add port_[enabled/disabled] mode callbacks
  team: lb: introduce infrastructure for userspace driven tx
    loadbalancing
  team: implement multipart netlink messages for options transfers
  team: ensure correct order of netlink messages delivery
  team: allow to send multiple set events in one message
  team: use rcu_dereference_bh() in tx path

 drivers/net/team/team.c                   |  546 ++++++++++++++++++-----------
 drivers/net/team/team_mode_activebackup.c |    6 +-
 drivers/net/team/team_mode_loadbalance.c  |  536 ++++++++++++++++++++++++++--
 drivers/net/team/team_mode_roundrobin.c   |    4 +-
 include/linux/if_team.h                   |   22 +-
 5 files changed, 885 insertions(+), 229 deletions(-)

-- 
1.7.10.2

^ permalink raw reply

* Re: [PATCH] usbnet: Activate halt interrupt endpoint before re-submit URB
From: Ming Lei @ 2012-06-19 15:50 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: Huajun Li, David Miller, stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <201206181851.49765.oneukum-l3A5Bk7waGM@public.gmane.org>

On Tue, Jun 19, 2012 at 12:51 AM, Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org> wrote:

>
> Then I am inclined to say that this is not fully thought through
> If the endpoint stalls, the device has detected an error.
> We have no idea how to generically handle this error.
> We might come into a vicious circle.

Why does it come into a vicious circle? If the interrupt endpoint is
HALTed, the clear halt event is scheduled to call usb_clear_halt(int pipe),
and if it returns successfully, the pipe shouldn't be halted any more,
so the later usb_submit_urb() should be OK on the interrupt endpoint.

The similar handling policy is taken for RX/TX endpoints in case they
are halted.

> Could you add a sanity limit for the
> amount of halts we clear?

Looks it is not needed, at least clearing HALT on Rx/Tx endpoints
works well without the limit.

Thanks,
-- 
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [RFC net-next 06/14] Fix intel/igb
From: Alexander Duyck @ 2012-06-19 15:42 UTC (permalink / raw)
  To: Yuval Mintz; +Cc: netdev, davem, eilong, Jeff Kirsher, Wyborny, Carolyn
In-Reply-To: <1340118848-30978-7-git-send-email-yuvalmin@broadcom.com>

On 06/19/2012 08:14 AM, Yuval Mintz wrote:
> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
>
> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/igb/igb_main.c |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index dd3bfe8..8e7ade5 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -2380,18 +2380,20 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
>  #endif /* CONFIG_PCI_IOV */
>  	switch (hw->mac.type) {
>  	case e1000_i210:
> -		adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I210,
> -			num_online_cpus());
> +		adapter->rss_queues = IGB_MAX_RX_QUEUES_I210;
>  		break;
>  	case e1000_i211:
> -		adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I211,
> -			num_online_cpus());
> +		adapter->rss_queues = IGB_MAX_RX_QUEUES_I211;
>  		break;
>  	default:
> -		adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES,
> -		num_online_cpus());
> +		adapter->rss_queues = IGB_MAX_RX_QUEUES;
>  		break;
>  	}
> +
> +	adapter->rss_queues = min_t(u32, adapter->rss_queues,
> +				    min_t(u32, num_online_cpus(),
> +					  DEFAULT_MAX_NUM_RSS_QUEUES));
> +
>  	/* i350 cannot do RSS and SR-IOV at the same time */
>  	if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count)
>  		adapter->rss_queues = 1;
Same issue here as ixgbevf, only we support a max of 8 Rx queues in the
hardware.  So now you are once again adding another unnecessary limit on
something that is already limited to 8 or less.

Thanks,

Alex

^ permalink raw reply

* Re: [RFC net-next 05/14] Fix intel/ixgbevf
From: Alexander Duyck @ 2012-06-19 15:39 UTC (permalink / raw)
  To: Yuval Mintz; +Cc: netdev, davem, eilong, Jeff Kirsher
In-Reply-To: <1340118848-30978-6-git-send-email-yuvalmin@broadcom.com>

On 06/19/2012 08:13 AM, Yuval Mintz wrote:
> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
>
> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> index f69ec42..3ad46c2 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> @@ -2014,7 +2014,7 @@ err_tx_ring_allocation:
>  static int ixgbevf_set_interrupt_capability(struct ixgbevf_adapter *adapter)
>  {
>  	int err = 0;
> -	int vector, v_budget;
> +	int vector, v_budget, ncpu;
>  
>  	/*
>  	 * It's easy to be greedy for MSI-X vectors, but it really
> @@ -2022,8 +2022,9 @@ static int ixgbevf_set_interrupt_capability(struct ixgbevf_adapter *adapter)
>  	 * than CPU's.  So let's be conservative and only ask for
>  	 * (roughly) twice the number of vectors as there are CPU's.
>  	 */
> +	ncpu = min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
>  	v_budget = min(adapter->num_rx_queues + adapter->num_tx_queues,
> -		       (int)(num_online_cpus() * 2)) + NON_Q_VECTORS;
> +		       ncpu * 2) + NON_Q_VECTORS;
>  
>  	/* A failure in MSI-X entry allocation isn't fatal, but it does
>  	 * mean we disable MSI-X capabilities of the adapter. */
This change is pointless on the ixgbevf driver.  The VF hardware can
support at most 4 RSS queues.  As such num_rx_queues + num_tx_queues
will never exceed 8 so you are essentially adding a necessary min(x,8).

Thanks,

Alex

^ permalink raw reply

* 2012 Kernel Summit: Call for Participation
From: Theodore Ts'o @ 2012-06-19 15:20 UTC (permalink / raw)
  To: netdev


Please note that we are using a different way of selecting who will get
invites this year; please read below, subscribe to the
ksummit-2012-discuss mailing list, and send an [ATTEND] request to the
mailing list if you are interested in attending.

Do feel free to forward this other mailing lists (especially if there
are internal kernel development lists at your company) if appropriate.

Many thanks,

						- Ted


The annual Kernel Summit for 2012 will be held on the 3 days preceding the
Linux Foundation LinuxCon and Linux Plumbers Conference at the Sheraton San
Diego Hotel and Marina from 27-29 August:

        http://www.linuxplumbersconf.org/2012/
        https://events.linuxfoundation.org/events/linuxcon

The format of the Kernel Summit will be

Monday: All Kernel Developers Plenary Sessions
Tuesday: Kernel technical working and breakout sessions
Wednesday: Additional Technical sessions shared with Plumbers


This year, in order to make the selection process more transparent,
we're trying a new mechanism where we'll be selecting this year's
attendees from amongst those who submit proposals to attend as
described below.

We'll try to cap attendance at around 80-100 for the all kernel
developers day, so get your request in early.  To request a place to
attend, please send an email to

    ksummit-2012-discuss@lists.linuxfoundation.org

Please summarize what expertise you will bring to the meeting,
and what you'd like to discuss.  Please also tag your email with
[ATTEND] so there's less chance of it getting lost in the large
mail pile.

Requests to attend will be looked upon more favorably if you also
participate in the discussion of topics at

    ksummit-2012-discuss@lists.linuxfoundation.org

You can subscribe via mailman:

    http://lists.linux-foundation.org/mailman/listinfo/ksummit-2012-discuss


For reference, the agendas from a few prior kernel summits are here:

http://ksummit2011.kernel.org/agenda
http://ksummit2010.kernel.org/agenda

^ permalink raw reply

* [RFC net-next 11/14] Fix emulex/benet
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem
  Cc: eilong, Yuval Mintz, Sathya Perla, Subbu Seetharaman,
	Ajit Khaparde
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Sathya Perla <sathya.perla@emulex.com>
Cc: Subbu Seetharaman <subbu.seetharaman@emulex.com>
Cc: Ajit Khaparde <ajit.khaparde@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 5a34503..e42597d 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2153,13 +2153,15 @@ static uint be_num_rss_want(struct be_adapter *adapter)
 static void be_msix_enable(struct be_adapter *adapter)
 {
 #define BE_MIN_MSIX_VECTORS		1
-	int i, status, num_vec, num_roce_vec = 0;
+	int i, status, num_vec, num_roce_vec = 0, ncpu;
+
+	ncpu = min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
 
 	/* If RSS queues are not used, need a vec for default RX Q */
-	num_vec = min(be_num_rss_want(adapter), num_online_cpus());
+	num_vec = min(be_num_rss_want(adapter), ncpu);
 	if (be_roce_supported(adapter)) {
 		num_roce_vec = min_t(u32, MAX_ROCE_MSIX_VECTORS,
-					(num_online_cpus() + 1));
+				     (u32)(ncpu + 1));
 		num_roce_vec = min(num_roce_vec, MAX_ROCE_EQS);
 		num_vec += num_roce_vec;
 		num_vec = min(num_vec, MAX_MSIX_VECTORS);
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 12/14] Fix broadcom/tg3
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Matt Carlson
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Matt Carlson <mcarlson@broadcom.com>
---
 drivers/net/ethernet/broadcom/tg3.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index e47ff8b..d431f17 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -9908,7 +9908,8 @@ static bool tg3_enable_msix(struct tg3 *tp)
 	int i, rc;
 	struct msix_entry msix_ent[tp->irq_max];
 
-	tp->irq_cnt = num_online_cpus();
+	tp->irq_cnt = min_t(unsigned, num_online_cpus(),
+			    DEFAULT_MAX_NUM_RSS_QUEUES);
 	if (tp->irq_cnt > 1) {
 		/* We want as many rx rings enabled as there are cpus.
 		 * In multiqueue MSI-X mode, the first MSI-X vector
@@ -10967,7 +10968,8 @@ static int tg3_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
 		if (netif_running(tp->dev))
 			info->data = tp->irq_cnt;
 		else {
-			info->data = num_online_cpus();
+			info->data = min_t(u32, num_online_cpus(),
+					   DEFAULT_MAX_NUM_RSS_QUEUES);
 			if (info->data > TG3_IRQ_MAX_VECS_RSS)
 				info->data = TG3_IRQ_MAX_VECS_RSS;
 		}
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 14/14] Fix broadcom/bnx2x
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 7cd99b7..99daadb 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -807,9 +807,10 @@ static inline void bnx2x_disable_msi(struct bnx2x *bp)
 
 static inline int bnx2x_calc_num_queues(struct bnx2x *bp)
 {
-	return  num_queues ?
-		 min_t(int, num_queues, BNX2X_MAX_QUEUES(bp)) :
-		 min_t(int, num_online_cpus(), BNX2X_MAX_QUEUES(bp));
+	int nqs = num_queues ? (int) num_queues :
+		  min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
+
+	return min_t(int, nqs, BNX2X_MAX_QUEUES(bp));
 }
 
 static inline void bnx2x_clear_sge_mask_next_elems(struct bnx2x_fastpath *fp)
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 13/14] Fix broadcom/bnx2
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Michael Chan
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Michael Chan <mchan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 9b69a62..09e1f76 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -6246,7 +6246,7 @@ bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
 static int
 bnx2_setup_int_mode(struct bnx2 *bp, int dis_msi)
 {
-	int cpus = num_online_cpus();
+	int cpus = min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
 	int msix_vecs;
 
 	if (!bp->num_req_rx_rings)
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 10/14] Fix myricom/myri10ge
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Jon Mason, Andrew Gallatin
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Jon Mason <mason@myri.com>
Cc: Andrew Gallatin <gallatin@myri.com>
---
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 90153fc..70c132d 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -3775,7 +3775,7 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp)
 
 	mgp->num_slices = 1;
 	msix_cap = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
-	ncpus = num_online_cpus();
+	ncpus = min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
 
 	if (myri10ge_max_slices == 1 || msix_cap == 0 ||
 	    (myri10ge_max_slices == -1 && ncpus < 2))
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 09/14] Fix chelsio/cxgb4
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Divy Le Ray
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Divy Le Ray <divy@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index e1f96fb..4a70867 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -3482,7 +3482,7 @@ static inline void init_rspq(struct sge_rspq *q, u8 timer_idx, u8 pkt_cnt_idx,
 static void __devinit cfg_queues(struct adapter *adap)
 {
 	struct sge *s = &adap->sge;
-	int i, q10g = 0, n10g = 0, qidx = 0;
+	int i, q10g = 0, n10g = 0, qidx = 0, ncpu;
 
 	for_each_port(adap, i)
 		n10g += is_10g_port(&adap2pinfo(adap, i)->link_cfg);
@@ -3491,10 +3491,11 @@ static void __devinit cfg_queues(struct adapter *adap)
 	 * We default to 1 queue per non-10G port and up to # of cores queues
 	 * per 10G port.
 	 */
+	ncpu = min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
 	if (n10g)
 		q10g = (MAX_ETH_QSETS - (adap->params.nports - n10g)) / n10g;
-	if (q10g > num_online_cpus())
-		q10g = num_online_cpus();
+	if (q10g > ncpu)
+		q10g = ncpu;
 
 	for_each_port(adap, i) {
 		struct port_info *pi = adap2pinfo(adap, i);
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 08/14] Fix chelsio/cxgb3
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Divy Le Ray
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Divy Le Ray <divy@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
index abb6ce7..17d7829 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
@@ -3050,7 +3050,8 @@ static struct pci_error_handlers t3_err_handler = {
 static void set_nqsets(struct adapter *adap)
 {
 	int i, j = 0;
-	int num_cpus = num_online_cpus();
+	int num_cpus = min_t(int, num_online_cpus(),
+			     DEFAULT_MAX_NUM_RSS_QUEUES);
 	int hwports = adap->params.nports;
 	int nqsets = adap->msix_nvectors - 1;
 
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 05/14] Fix intel/ixgbevf
From: Yuval Mintz @ 2012-06-19 15:13 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Jeff Kirsher
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index f69ec42..3ad46c2 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -2014,7 +2014,7 @@ err_tx_ring_allocation:
 static int ixgbevf_set_interrupt_capability(struct ixgbevf_adapter *adapter)
 {
 	int err = 0;
-	int vector, v_budget;
+	int vector, v_budget, ncpu;
 
 	/*
 	 * It's easy to be greedy for MSI-X vectors, but it really
@@ -2022,8 +2022,9 @@ static int ixgbevf_set_interrupt_capability(struct ixgbevf_adapter *adapter)
 	 * than CPU's.  So let's be conservative and only ask for
 	 * (roughly) twice the number of vectors as there are CPU's.
 	 */
+	ncpu = min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
 	v_budget = min(adapter->num_rx_queues + adapter->num_tx_queues,
-		       (int)(num_online_cpus() * 2)) + NON_Q_VECTORS;
+		       ncpu * 2) + NON_Q_VECTORS;
 
 	/* A failure in MSI-X entry allocation isn't fatal, but it does
 	 * mean we disable MSI-X capabilities of the adapter. */
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 06/14] Fix intel/igb
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Jeff Kirsher
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index dd3bfe8..8e7ade5 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2380,18 +2380,20 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
 #endif /* CONFIG_PCI_IOV */
 	switch (hw->mac.type) {
 	case e1000_i210:
-		adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I210,
-			num_online_cpus());
+		adapter->rss_queues = IGB_MAX_RX_QUEUES_I210;
 		break;
 	case e1000_i211:
-		adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I211,
-			num_online_cpus());
+		adapter->rss_queues = IGB_MAX_RX_QUEUES_I211;
 		break;
 	default:
-		adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES,
-		num_online_cpus());
+		adapter->rss_queues = IGB_MAX_RX_QUEUES;
 		break;
 	}
+
+	adapter->rss_queues = min_t(u32, adapter->rss_queues,
+				    min_t(u32, num_online_cpus(),
+					  DEFAULT_MAX_NUM_RSS_QUEUES));
+
 	/* i350 cannot do RSS and SR-IOV at the same time */
 	if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count)
 		adapter->rss_queues = 1;
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 07/14] Fix intel/ixgbe
From: Yuval Mintz @ 2012-06-19 15:14 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Jeff Kirsher
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index af1a531..21e4513 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -802,7 +802,8 @@ static int ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 	 * The default is to use pairs of vectors.
 	 */
 	v_budget = max(adapter->num_rx_queues, adapter->num_tx_queues);
-	v_budget = min_t(int, v_budget, num_online_cpus());
+	v_budget = min_t(int, v_budget, min_t(int, num_online_cpus(),
+					      DEFAULT_MAX_NUM_RSS_QUEUES));
 	v_budget += NON_Q_VECTORS;
 
 	/*
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 04/14] Fix qlogic/qlge
From: Yuval Mintz @ 2012-06-19 15:13 UTC (permalink / raw)
  To: netdev, davem
  Cc: eilong, Yuval Mintz, Anirban Chakraborty, Jitendra Kalsaria,
	Ron Mercer
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Cc: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Cc: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlge/qlge_main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 09d8d33..c6c91de 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4646,10 +4646,12 @@ static int __devinit qlge_probe(struct pci_dev *pdev,
 	struct net_device *ndev = NULL;
 	struct ql_adapter *qdev = NULL;
 	static int cards_found = 0;
-	int err = 0;
+	int err = 0, ncpu;
+
+	ncpu = min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
 
 	ndev = alloc_etherdev_mq(sizeof(struct ql_adapter),
-			min(MAX_CPUS, (int)num_online_cpus()));
+				 min(MAX_CPUS, ncpu));
 	if (!ndev)
 		return -ENOMEM;
 
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 00/14] default maximal number of RSS queues in mq drivers
From: Yuval Mintz @ 2012-06-19 15:13 UTC (permalink / raw)
  To: netdev, davem
  Cc: eilong, Yuval Mintz, Divy Le Ray, Or Gerlitz, Jon Mason,
	Anirban Chakraborty, Jitendra Kalsaria, Ron Mercer, Jeff Kirsher,
	Jon Mason, Andrew Gallatin, Sathya Perla, Subbu Seetharaman,
	Ajit Khaparde, Matt Carlson, Michael Chan

Different vendors support different number of RSS queues by default. Today,
there exists an ethtool API through which users can change the number of
channels their driver supports; This enables us to pursue the goal of using
a default number of RSS queues in various multi-queue drivers.

This RFC intendeds to achieve the above default, by upper-limiting the number
of interrupts multi-queue drivers request (by default, not via the new API) 
with correlation to the number of cpus on the machine.

After examining multi-queue drivers that call alloc_etherdev_mq[s],
it became evident that most drivers allocate their devices using hard-coded
values. Changing those defaults directly will most likely cause a regression. 

However, (most) multi-queue driver look at the number of online cpus when 
requesting for interrupts. We assume that the number of interrupts the
driver manages to request is propagated across the driver, and the number
of RSS queues it configures is based upon it. 

This RFC modifies said logic - if the number of cpus is large enough, use
a smaller default value instead. This serves 2 main purposes: 
 1. A step forward unity in the number of RSS queues of various drivers.
 2. It prevents wasteful requests for interrupts on machines with many cpus.

Notice no testing was made on this RFC (other than on the bnx2x driver)
except for compilation test.

Drivers identified as multi-queue, handled in this RFC:

* mellanox mlx4
* neterion vxge
* qlogic   qlge
* intel    igb, igbxe, igbxevf
* chelsio  cxgb3, cxgb4
* myricom  myri10ge
* emulex   benet
* broadcom tg3, bnx2, bnx2x

Driver identified as multi-queue, no reference to number of online cpus found,
and thus unhandled in this RFC:

* neterion  s2io
* marvell   mv643xx
* freescale gianfar
* ibm       ehea
* ti        cpmac
* sun       niu
* sfc       efx
* chelsio   cxgb4vf

Cheers,
Yuval Mintz

Cc: Divy Le Ray <divy@chelsio.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Cc: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Cc: Ron Mercer <ron.mercer@qlogic.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Jon Mason <mason@myri.com>
Cc: Andrew Gallatin <gallatin@myri.com>
Cc: Sathya Perla <sathya.perla@emulex.com>
Cc: Subbu Seetharaman <subbu.seetharaman@emulex.com>
Cc: Ajit Khaparde <ajit.khaparde@emulex.com>
Cc: Matt Carlson <mcarlson@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>

^ permalink raw reply

* [RFC net-next 03/14] fix neterion/vxge
From: Yuval Mintz @ 2012-06-19 15:13 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Jon Mason
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Jon Mason <jdmason@kudzu.us>
---
 drivers/net/ethernet/neterion/vxge/vxge-main.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index 2578eb1..a2c6e3f 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -3686,8 +3686,13 @@ static int __devinit vxge_config_vpaths(
 		if (driver_config->g_no_cpus == -1)
 			return 0;
 
-		if (!driver_config->g_no_cpus)
-			driver_config->g_no_cpus = num_online_cpus();
+		if (!driver_config->g_no_cpus) {
+			int ncpu = min_t(int, num_online_cpus(),
+					 DEFAULT_MAX_NUM_RSS_QUEUES);
+			driver_config->g_no_cpus = ncpu;
+		}
+
+
 
 		driver_config->vpath_per_dev = driver_config->g_no_cpus >> 1;
 		if (!driver_config->vpath_per_dev)
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 01/14] Add Default
From: Yuval Mintz @ 2012-06-19 15:13 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 include/linux/etherdevice.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 3d406e0..bb1ecaf 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -44,7 +44,10 @@ extern int eth_mac_addr(struct net_device *dev, void *p);
 extern int eth_change_mtu(struct net_device *dev, int new_mtu);
 extern int eth_validate_addr(struct net_device *dev);
 
-
+/* The maximal number of RSS queues a driver should have unless configured
+ * so explicitly.
+ */
+#define DEFAULT_MAX_NUM_RSS_QUEUES (8)
 
 extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
 					    unsigned int rxqs);
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC net-next 02/14] Fix mellanox/mlx4
From: Yuval Mintz @ 2012-06-19 15:13 UTC (permalink / raw)
  To: netdev, davem; +Cc: eilong, Yuval Mintz, Or Gerlitz
In-Reply-To: <1340118848-30978-1-git-send-email-yuvalmin@broadcom.com>

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Cc: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index ee6f4fe..57840ad 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -41,6 +41,7 @@
 #include <linux/slab.h>
 #include <linux/io-mapping.h>
 #include <linux/delay.h>
+#include <linux/etherdevice.h>
 
 #include <linux/mlx4/device.h>
 #include <linux/mlx4/doorbell.h>
@@ -1538,8 +1539,9 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
 {
 	struct mlx4_priv *priv = mlx4_priv(dev);
 	struct msix_entry *entries;
+	int ncpu = min_t(int, num_online_cpus(), DEFAULT_MAX_NUM_RSS_QUEUES);
 	int nreq = min_t(int, dev->caps.num_ports *
-			 min_t(int, num_online_cpus() + 1, MAX_MSIX_P_PORT)
+			 min_t(int, ncpu + 1, MAX_MSIX_P_PORT)
 				+ MSIX_LEGACY_SZ, MAX_MSIX);
 	int err;
 	int i;
-- 
1.7.9.rc2

^ permalink raw reply related

* [RFC] micrel KSZ8041 disable auto negotiation with fiber
From: Aníbal Almeida Pinto @ 2012-06-19 14:45 UTC (permalink / raw)
  To: netdev

Hi,

I am working on a custom board based on a OMAP L138 with a KSZ8041TL-FTL 
phy that have fibber and copper support.

When using with fibber the board can't connect to a switch, only after 
exec :

	ethtool -s eth1 speed 100 duplex full autoneg off

the phy get link and start working.

On some switches it appears that autoneg don't work well with fibber, 
ethtool reports that its at 10MB/s after exec

	ethtool -s eth1 autoneg on

The auto negotiation bit on phy register is disable on start when using 
the fibber but Linux don't appear to look at it.

Found a thread [1] that solve the problem but don't appear to be fully 
accepted.

The problem is modifying the phy code without interfere with ethtool use.

Any official/accepted solution to this problem ?

Thanks.

[1] - http://marc.info/?l=linuxppc-embedded&m=131107263711714

Aníbal

^ permalink raw reply

* Re: [net-next.git 4/4 (v6)] phy: add the EEE support and the way to access to the MMD registers.
From: Ben Hutchings @ 2012-06-19 14:41 UTC (permalink / raw)
  To: Giuseppe CAVALLARO; +Cc: netdev, eric.dumazet, rayagond, davem, yuvalmin
In-Reply-To: <1340002187-9248-5-git-send-email-peppe.cavallaro@st.com>

On Mon, 2012-06-18 at 08:49 +0200, Giuseppe CAVALLARO wrote:
> This patch adds the support for the Energy-Efficient Ethernet (EEE)
> to the Physical Abstraction Layer.
> To support the EEE we have to access to the MMD registers 3.20 and
> 7.60/61. So two new functions have been added to read/write the MMD
> registers (clause 45).
> 
> An Ethernet driver (I tested the stmmac) can invoke the phy_init_eee to properly
> check if the EEE is supported by the PHYs and it can also set the clock
> stop enable bit in the 3.0 register.
> The phy_get_eee_err can be used for reporting the number of time where
> the PHY failed to complete its normal wake sequence.
> 
> In the end, this patch also adds the EEE ethtool support implementing:
>  o phy_ethtool_set_eee
>  o phy_ethtool_get_eee
> 
> v1: initial patch
> v2: fixed some errors especially on naming convention
> v3: renamed again the mmd read/write functions thank to Ben's feedback
> v4: moved file to phy.c and added the ethtool support.
> v5: fixed phy_adv_to_eee, phy_eee_to_supported, phy_eee_to_adv return
>     values according to ethtool API (thanks to Ben's feedback).
>     Renamed some macros to avoid too long names.
> v6: fixed kernel-doc comments to be properly parsed.
>     Fixed the phy_init_eee function: we need to check which link mode
>     was autonegotiated and then the corresponding bits in 7.60 and 7.61
>     registers.
[...]
> +		adv = phy_eee_to_adv(eee_adv);
> +		lp = phy_eee_to_adv(eee_lp);
> +		if (!(lp & adv & phydev->advertising))
> +			goto eee_exit;
[...]

phydev->advertising is not the link mode that was autonegotiated, so I
can't believe this is right.  I think you need to use something like:

		adv = phy_eee_to_adv(eee_adv);
		lp = phy_eee_to_adv(eee_lp);
		i = phy_find_setting(phydev->speed, phydev->duplex);
		if ((lp & adv & settings[i].setting))
			goto eee_exit;

and require that genphy_read_status() is called first.  But I haven't
used phylib so I'm not at all sure about this!

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* [net-next patch 11/11 v2] bnx2x: Change date and version to 1.72.51-0
From: Merav Sicron @ 2012-06-19 17:48 UTC (permalink / raw)
  To: netdev, davem, eilong; +Cc: Merav Sicron
In-Reply-To: <1340128112-22935-1-git-send-email-meravs@broadcom.com>

This change updates the date and version of the bnx2x driver.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index e30e2a2..85a3b84 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -23,8 +23,8 @@
  * (you will need to reboot afterwards) */
 /* #define BNX2X_STOP_ON_ERROR */
 
-#define DRV_MODULE_VERSION      "1.72.50-0"
-#define DRV_MODULE_RELDATE      "2012/04/23"
+#define DRV_MODULE_VERSION      "1.72.51-0"
+#define DRV_MODULE_RELDATE      "2012/06/18"
 #define BNX2X_BC_VER            0x040200
 
 #if defined(CONFIG_DCB)
-- 
1.7.10

^ permalink raw reply related


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