* Re: [PATCH net-next 0/9] mlx4: Fix and enhance the device reset flow
From: David Miller @ 2015-01-25 7:31 UTC (permalink / raw)
To: ogerlitz; +Cc: netdev, matanb, amirv, talal, roland
In-Reply-To: <54C103B2.2090406@mellanox.com>
From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Thu, 22 Jan 2015 16:05:38 +0200
> On 1/21/2015 4:45 PM, Or Gerlitz wrote:
>> This series from Yishai Hadas fixes the device reset flow and adds
>> SRIOV support.
>>
>> Reset flows are required whenever a device experiences errors, is
>> unresponsive,
>> or is not in a deterministic state. In such cases, the driver is
>> expected to
>> reset the HW and continue operation. When SRIOV is enabled, these
>> requirements
>> apply both to PF and VF devices.
>
> So we spotted some problem in the SRIOV flow and prefer to fix it in a
> V1, which will be sent next week, please don't take this one.
Ok, I'll toss this series and wait for the new version. Thanks.
^ permalink raw reply
* Re: [PATCH v3 net-next] net: ipv6: Add sysctl entry to disable MTU updates from RA
From: Vadim Kochan @ 2015-01-25 7:21 UTC (permalink / raw)
To: David Miller; +Cc: harouth, netdev
In-Reply-To: <20150124.231432.1788575004982971514.davem@davemloft.net>
On Sat, Jan 24, 2015 at 11:14:32PM -0800, David Miller wrote:
> From: Harout Hedeshian <harouth@codeaurora.org>
> Date: Tue, 20 Jan 2015 10:06:05 -0700
>
> > The kernel forcefully applies MTU values received in router
> > advertisements provided the new MTU is less than the current. This
> > behavior is undesirable when the user space is managing the MTU. Instead
> > a sysctl flag 'accept_ra_mtu' is introduced such that the user space
> > can control whether or not RA provided MTU updates should be applied. The
> > default behavior is unchanged; user space must explicitly set this flag
> > to 0 for RA MTUs to be ignored.
> >
> > Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
>
> Under what circumstances would userland ignore a router advertized
> MTU, and are the RFCs ok with this?
> --
> 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
Hi,
I don't know if it make sense but I had the same use case when was
working on supporting IPv6 infrastructure for home gateway.
One of the provider had requirements to have ability set force IPv6 MTU
value via TR parameters and disable update it via RA.
Regards,
^ permalink raw reply
* Re: [PATCH] atheros/atlx: Simplify bit manipulations
From: David Miller @ 2015-01-25 7:35 UTC (permalink / raw)
To: linux; +Cc: jcliburn, chris.snook, netdev, linux-kernel
In-Reply-To: <1422011212-30095-1-git-send-email-linux@rasmusvillemoes.dk>
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date: Fri, 23 Jan 2015 12:06:52 +0100
> The code 'if (foo & X) foo &= ~X;' is semantically equivalent to
> simply 'foo &= ~X;', but gcc generates about four instructions for the
> former, one for the latter. Similarly, if X consists of a single bit,
> 'if (!(foo & X)) X |= X;' can be replaced by 'foo |= X;'.
>
> In the atl2 case, gcc does know how to merge the new adjacent
> operations, so altogether this gives a nice little code size
> reduction of about 80 bytes.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
I agree with the feedback given that these open-coded sequences should
be replaced with the appropriate PCI helpers instead of edited
further.
^ permalink raw reply
* Re: [PATCH v1] usbnet: re-use native hex2bin()
From: David Miller @ 2015-01-25 8:09 UTC (permalink / raw)
To: andy.shevchenko; +Cc: oneukum, netdev
In-Reply-To: <1421962032-25497-1-git-send-email-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andy.shevchenko@gmail.com>
Date: Thu, 22 Jan 2015 23:27:12 +0200
> Call hex2bin() library function, instead of doing conversion here.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH v1] cxgb3: re-use native hex2bin()
From: David Miller @ 2015-01-25 8:10 UTC (permalink / raw)
To: andy.shevchenko; +Cc: netdev, santosh
In-Reply-To: <1421962659-25885-1-git-send-email-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andy.shevchenko@gmail.com>
Date: Thu, 22 Jan 2015 23:37:39 +0200
> Call hex2bin() library function instead of doing conversion here.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH] net:wireless:Add proper locking for the function, b43_op_beacon_set_tim in main.c
From: Rafał Miłecki @ 2015-01-25 8:14 UTC (permalink / raw)
To: Nicholas Krause
Cc: Stefano Brivio, Network Development,
linux-wireless@vger.kernel.org, b43-dev, Kalle Valo,
Linux Kernel Mailing List
In-Reply-To: <1422169574-8451-1-git-send-email-xerofoify@gmail.com>
On 25 January 2015 at 08:06, Nicholas Krause <xerofoify@gmail.com> wrote:
> Adds proper locking for the function, b43_op_beacon_set_tim in main.c that internally calls b43_update_templates.
> Due to the function that is being called internally,b43_update_templates needing the mutex lock of the structure
> pointer wl passed it to run successfully and without issues we add the calls to mutex_lock before and mutex_unlock
> after it's call internally in b43_op_beacon_set_tim in order to allow the function,,b43_update_templates to run
> successfully and without issues related to concurrent access.
Nack
^ permalink raw reply
* Re: [PATCH net] netxen: fix netxen_nic_poll() logic
From: David Miller @ 2015-01-25 8:22 UTC (permalink / raw)
To: eric.dumazet; +Cc: umgwanakikbuti, netdev, manish.chopra
In-Reply-To: <1421942178.3471.10.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 22 Jan 2015 07:56:18 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> NAPI poll logic now enforces that a poller returns exactly the budget
> when it wants to be called again.
>
> If a driver limits TX completion, it has to return budget as well when
> the limit is hit, not the number of received packets.
>
> Reported-and-tested-by: Mike Galbraith <umgwanakikbuti@gmail.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Fixes: d75b1ade567f ("net: less interrupt masking in NAPI")
Applied and queued up for -stable, thanks Eric.
^ permalink raw reply
* Re: [PATCH] net: llc: use correct size for sysctl timeout entries
From: David Miller @ 2015-01-25 8:23 UTC (permalink / raw)
To: sasha.levin; +Cc: linux-kernel, acme, netdev
In-Reply-To: <1422064020-22080-1-git-send-email-sasha.levin@oracle.com>
From: Sasha Levin <sasha.levin@oracle.com>
Date: Fri, 23 Jan 2015 20:47:00 -0500
> The timeout entries are sizeof(int) rather than sizeof(long), which
> means that when they were getting read we'd also leak kernel memory
> to userspace along with the timeout values.
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH net] ipvlan: fix incorrect usage of IS_ERR() macro in IPv6 code path.
From: David Miller @ 2015-01-25 8:24 UTC (permalink / raw)
To: maheshb; +Cc: netdev, edumazet, dan.carpenter
In-Reply-To: <1422165223-13496-1-git-send-email-maheshb@google.com>
From: Mahesh Bandewar <maheshb@google.com>
Date: Sat, 24 Jan 2015 21:53:43 -0800
> The ip6_route_output() always returns a valid dst pointer unlike in IPv4
> case. So the validation has to be different from the IPv4 path. Correcting
> that error in this patch.
>
> This was picked up by a static checker with a following warning -
>
> drivers/net/ipvlan/ipvlan_core.c:380 ipvlan_process_v6_outbound()
> warn: 'dst' isn't an ERR_PTR
>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks.
^ permalink raw reply
* [PATCH] hyperv: fixup of wait_for_completion_timeout return type
From: Nicholas Mc Guire @ 2015-01-25 8:46 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: devel, Haiyang Zhang, Nicholas Mc Guire, linux-kernel, netdev
return type of wait_for_completion_timeout is unsigned long not int, this
patch just fixes up the declarations.
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
The return type of wait_for_completion_timeout is unsigned long not
int. This patch fixes up the declarations only.
Patch was compile tested only for x86_64_defconfig + CONFIG_X86_VSMP=y
CONFIG_HYPERV=m, CONFIG_HYPERV_NET=m
Patch is against 3.19.0-rc5 -next-20150123
drivers/net/hyperv/rndis_filter.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index ec0c40a..7bd8387 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -470,7 +470,7 @@ static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
struct rndis_query_request *query;
struct rndis_query_complete *query_complete;
int ret = 0;
- int t;
+ unsigned long t;
if (!result)
return -EINVAL;
@@ -560,7 +560,8 @@ int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac)
char macstr[2*ETH_ALEN+1];
u32 extlen = sizeof(struct rndis_config_parameter_info) +
2*NWADR_STRLEN + 4*ETH_ALEN;
- int ret, t;
+ int ret;
+ unsigned long t;
request = get_rndis_request(rdev, RNDIS_MSG_SET,
RNDIS_MESSAGE_SIZE(struct rndis_set_request) + extlen);
@@ -634,7 +635,8 @@ int rndis_filter_set_offload_params(struct hv_device *hdev,
struct ndis_offload_params *offload_params;
struct rndis_set_complete *set_complete;
u32 extlen = sizeof(struct ndis_offload_params);
- int ret, t;
+ int ret;
+ unsigned long t;
u32 vsp_version = nvdev->nvsp_version;
if (vsp_version <= NVSP_PROTOCOL_VERSION_4) {
@@ -708,7 +710,8 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, int num_queue)
struct ndis_recv_scale_param *rssp;
u32 *itab;
u8 *keyp;
- int i, t, ret;
+ int i, ret;
+ unsigned long t;
request = get_rndis_request(
rdev, RNDIS_MSG_SET,
@@ -792,7 +795,8 @@ int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter)
struct rndis_set_request *set;
struct rndis_set_complete *set_complete;
u32 status;
- int ret, t;
+ int ret;
+ unsigned long t;
struct net_device *ndev;
ndev = dev->net_dev->ndev;
@@ -848,7 +852,8 @@ static int rndis_filter_init_device(struct rndis_device *dev)
struct rndis_initialize_request *init;
struct rndis_initialize_complete *init_complete;
u32 status;
- int ret, t;
+ int ret;
+ unsigned long t;
request = get_rndis_request(dev, RNDIS_MSG_INIT,
RNDIS_MESSAGE_SIZE(struct rndis_initialize_request));
@@ -998,7 +1003,7 @@ int rndis_filter_device_add(struct hv_device *dev,
struct netvsc_device_info *device_info = additional_info;
struct ndis_offload_params offloads;
struct nvsp_message *init_packet;
- int t;
+ unsigned long t;
struct ndis_recv_scale_cap rsscap;
u32 rsscap_size = sizeof(struct ndis_recv_scale_cap);
u32 mtu, size;
--
1.7.10.4
^ permalink raw reply related
* [PATCH] hyperv: else branch not necessary
From: Nicholas Mc Guire @ 2015-01-25 8:46 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: devel, Haiyang Zhang, Nicholas Mc Guire, linux-kernel, netdev
As the if completes with a unconditional goto the else branch
is not needed here.
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
All paths of execution that did not exit through the if branch will
go through the else branch so no need for an explicit else here
Patch was compile tested only for x86_64_defconfig + CONFIG_X86_VSMP=y
CONFIG_HYPERV=m, CONFIG_HYPERV_NET=m
Patch is against 3.19.0-rc5 -next-20150123
drivers/net/hyperv/rndis_filter.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 7bd8387..efb84a9 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -833,10 +833,10 @@ int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter)
* send completion for it.
*/
goto exit;
- } else {
- set_complete = &request->response_msg.msg.set_complete;
- status = set_complete->status;
- }
+ }
+
+ set_complete = &request->response_msg.msg.set_complete;
+ status = set_complete->status;
cleanup:
if (request)
--
1.7.10.4
^ permalink raw reply related
* [PATCH net v2] bnx2x: fix napi poll return value for repoll
From: Govindarajulu Varadarajan @ 2015-01-25 10:39 UTC (permalink / raw)
To: davem, netdev, ariel.elior; +Cc: edumazet, Govindarajulu Varadarajan
With the commit d75b1ade567ffab ("net: less interrupt masking in NAPI") napi
repoll is done only when work_done == budget. When in busy_poll is we return 0
in napi_poll. We should return budget.
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
v2:
Remove unnecessary change for work_done >= budget return value.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 1d1147c..e468ed3 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3175,7 +3175,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
}
#endif
if (!bnx2x_fp_lock_napi(fp))
- return work_done;
+ return budget;
for_each_cos_in_tx_queue(fp, cos)
if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos]))
--
2.2.2
^ permalink raw reply related
* [PATCH 3/3] hyperv: hid-hyperv.c: fixup-of-wait_for_completion_timeout-return-type
From: Nicholas Mc Guire @ 2015-01-25 11:00 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: Jiri Kosina, Haiyang Zhang, linux-kernel, Nicholas Mc Guire,
netdev, devel
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
The return type of wait_for_completion_timeout is unsigned long not
int. This patch fixes up the declarations only.
Patch was compile tested only for x86_64_defconfig + CONFIG_X86_VSMP=y
CONFIG_HYPERV=m, CONFIG_HID_HYPERV_MOUSE=m
Patch is against 3.19.0-rc5 -next-20150123
drivers/hid/hid-hyperv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index 31fad64..6039f07 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -381,7 +381,7 @@ static void mousevsc_on_channel_callback(void *context)
static int mousevsc_connect_to_vsp(struct hv_device *device)
{
int ret = 0;
- int t;
+ unsigned long t;
struct mousevsc_dev *input_dev = hv_get_drvdata(device);
struct mousevsc_prt_msg *request;
struct mousevsc_prt_msg *response;
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/3] hyperv: netvsc.c: fixup-of-wait_for_completion_timeout-return-type
From: Nicholas Mc Guire @ 2015-01-25 11:03 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: devel, Haiyang Zhang, Nicholas Mc Guire, linux-kernel, netdev
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
The return type of wait_for_completion_timeout is unsigned long not
int. This patch fixes up the declarations only.
Patch was compile tested only for x86_64_defconfig + CONFIG_X86_VSMP=y
CONFIG_HYPERV=m, CONFIG_HYPERV_NET=m
Patch is against 3.19.0-rc5 -next-20150123
drivers/net/hyperv/netvsc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 9f49c01..d2af032 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -217,7 +217,7 @@ static int netvsc_destroy_buf(struct netvsc_device *net_device)
static int netvsc_init_buf(struct hv_device *device)
{
int ret = 0;
- int t;
+ unsigned long t;
struct netvsc_device *net_device;
struct nvsp_message *init_packet;
struct net_device *ndev;
@@ -409,7 +409,8 @@ static int negotiate_nvsp_ver(struct hv_device *device,
struct nvsp_message *init_packet,
u32 nvsp_ver)
{
- int ret, t;
+ int ret;
+ unsigned long t;
memset(init_packet, 0, sizeof(struct nvsp_message));
init_packet->hdr.msg_type = NVSP_MSG_TYPE_INIT;
--
1.7.10.4
^ permalink raw reply related
* Re: CONFIG_NF_CONNTRACK_PROCFS
From: Florian Westphal @ 2015-01-25 11:22 UTC (permalink / raw)
To: Oleg; +Cc: netdev
In-Reply-To: <20150125055117.GA5586@localhost>
Oleg <lego12239@yandex.ru> wrote:
> net/netfilter/nf_conntrack procfs file is marked as obsolete in the recent
> kernels. What's wrong with it? Or it's simply a new fashion to replace
> simple file interface with anything else?
proc has several drawbacks vs. ctnetlink:
- not extensible
- doesn't have ability to query for particular items
- no add/delete support
- no event notification (e.g. conntrack -E)
^ permalink raw reply
* Re: [PATCH 1/3] hyperv: netvsc.c: fixup-of-wait_for_completion_timeout-return-type
From: Sergei Shtylyov @ 2015-01-25 11:37 UTC (permalink / raw)
To: Nicholas Mc Guire, K. Y. Srinivasan
Cc: Haiyang Zhang, devel, netdev, linux-kernel
In-Reply-To: <1422183808-7655-1-git-send-email-der.herr@hofr.at>
Hello.
On 1/25/2015 2:03 PM, Nicholas Mc Guire wrote:
You probably want to replace hyphens with spaces in the subject of this
and other patches.
And you're not fixing the return type of wait_for_completion_timeout(),
you're fixing the variables to match this type.
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
WBR, Sergei
^ permalink raw reply
* Re: [PATCH v5 4/5] can: kvaser_usb: Retry the first bulk transfer on -ETIMEDOUT
From: Ahmed S. Darwish @ 2015-01-25 11:59 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Olivier Sobrie, Oliver Hartkopp, Wolfgang Grandegger,
Marc Kleine-Budde, Andri Yngvason, Linux-CAN, netdev, LKML
In-Reply-To: <54BF9A8E.7000202@cogentembedded.com>
On Wed, Jan 21, 2015 at 03:24:46PM +0300, Sergei Shtylyov wrote:
> Hello.
>
> On 1/21/2015 12:48 AM, Ahmed S. Darwish wrote:
>
> >From: Ahmed S. Darwish <ahmed.darwish@valeo.com>
>
> >On some x86 laptops, plugging a Kvaser device again after an
> >unplug makes the firmware always ignore the very first command.
> >For such a case, provide some room for retries instead of
> >completly exiting the driver init code.
>
> Completely.
>
> >Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
> >---
> > drivers/net/can/usb/kvaser_usb.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
>
> >diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
> >index 640b0eb..068e76c 100644
> >--- a/drivers/net/can/usb/kvaser_usb.c
> >+++ b/drivers/net/can/usb/kvaser_usb.c
> [...]
> >@@ -1632,7 +1632,15 @@ static int kvaser_usb_probe(struct usb_interface *intf,
> >
> > usb_set_intfdata(intf, dev);
> >
> >- err = kvaser_usb_get_software_info(dev);
> >+ /* On some x86 laptops, plugging a Kvaser device again after
> >+ * an unplug makes the firmware always ignore the very first
> >+ * command. For such a case, provide some room for retries
> >+ * instead of completly exiting the driver.
>
> Completely.
>
Thanks, both fixed in the next submission :-D
Regards,
Darwish
^ permalink raw reply
* Re: [PATCH net] net: ipv6: allow explicitly choosing optimistic addresses
From: Hannes Frederic Sowa @ 2015-01-25 12:46 UTC (permalink / raw)
To: Erik Kline, netdev; +Cc: davem
In-Reply-To: <1421823759-15098-1-git-send-email-ek@google.com>
Hi,
On Wed, Jan 21, 2015, at 08:02, Erik Kline wrote:
> if (ipv6_addr_equal(&ifp->addr, addr) &&
> - !(ifp->flags&IFA_F_TENTATIVE) &&
> + (!(ifp->flags&IFA_F_TENTATIVE) ||
> + ifp->flags&IFA_F_OPTIMISTIC) &&
> + !(ifp->flags&banned_flags) &&
> (dev == NULL || ifp->idev->dev == dev ||
Can the wrapper take the IFA_F_TENTATIVE and IFA_F_OPTIMISTIC into the
banned_flags argument, so this condition becomes easier to read? The new
caller could also specify them verbatim. I think it would improve
readability.
Thanks,
Hannes
^ permalink raw reply
* [PATCH ethtool 1/5] ethtool-copy.h: sync with net
From: Amir Vadai @ 2015-01-25 13:51 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, Or Gerlitz, Yevgeny Petrilin, Saeed Mahameed, Eyal Perry,
Eyal Grossman, Amir Vadai
In-Reply-To: <1422193883-30504-1-git-send-email-amirv@mellanox.com>
From: Eyal Grossman <eyalgr@mellanox.com>
This covers kernel changes up to:
commit 892311f66f2411b813ca631009356891a0c2b0a1
Author: Eyal Perry <eyalpe@mellanox.com>
Date: Tue Dec 2 18:12:10 2014 +0200
ethtool: Support for configurable RSS hash function
Signed-off-by: Eyal Grossman <eyalgr@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
ethtool-copy.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 59 insertions(+), 8 deletions(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 61b78fc..5f66d9c 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -10,8 +10,8 @@
* Portions Copyright (C) Sun Microsystems 2008
*/
-#ifndef _LINUX_ETHTOOL_H
-#define _LINUX_ETHTOOL_H
+#ifndef _UAPI_LINUX_ETHTOOL_H
+#define _UAPI_LINUX_ETHTOOL_H
#include <linux/types.h>
#include <linux/if_ether.h>
@@ -110,7 +110,7 @@ struct ethtool_cmd {
__u32 reserved[2];
};
-static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
__u32 speed)
{
@@ -118,7 +118,7 @@ static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
ep->speed_hi = (__u16)(speed >> 16);
}
-static __inline__ __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
+static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
{
return (ep->speed_hi << 16) | ep->speed;
}
@@ -209,6 +209,33 @@ struct ethtool_value {
__u32 data;
};
+enum tunable_id {
+ ETHTOOL_ID_UNSPEC,
+ ETHTOOL_RX_COPYBREAK,
+ ETHTOOL_TX_COPYBREAK,
+};
+
+enum tunable_type_id {
+ ETHTOOL_TUNABLE_UNSPEC,
+ ETHTOOL_TUNABLE_U8,
+ ETHTOOL_TUNABLE_U16,
+ ETHTOOL_TUNABLE_U32,
+ ETHTOOL_TUNABLE_U64,
+ ETHTOOL_TUNABLE_STRING,
+ ETHTOOL_TUNABLE_S8,
+ ETHTOOL_TUNABLE_S16,
+ ETHTOOL_TUNABLE_S32,
+ ETHTOOL_TUNABLE_S64,
+};
+
+struct ethtool_tunable {
+ __u32 cmd;
+ __u32 id;
+ __u32 type_id;
+ __u32 len;
+ void *data[0];
+};
+
/**
* struct ethtool_regs - hardware register dump
* @cmd: Command number = %ETHTOOL_GREGS
@@ -507,6 +534,7 @@ struct ethtool_pauseparam {
* @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
* now deprecated
* @ETH_SS_FEATURES: Device feature names
+ * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
*/
enum ethtool_stringset {
ETH_SS_TEST = 0,
@@ -514,6 +542,7 @@ enum ethtool_stringset {
ETH_SS_PRIV_FLAGS,
ETH_SS_NTUPLE_FILTERS,
ETH_SS_FEATURES,
+ ETH_SS_RSS_HASH_FUNCS,
};
/**
@@ -857,6 +886,8 @@ struct ethtool_rxfh_indir {
* @key_size: On entry, the array size of the user buffer for the hash key,
* which may be zero. On return from %ETHTOOL_GRSSH, the size of the
* hardware hash key.
+ * @hfunc: Defines the current RSS hash function used by HW (or to be set to).
+ * Valid values are one of the %ETH_RSS_HASH_*.
* @rsvd: Reserved for future extensions.
* @rss_config: RX ring/queue index for each hash value i.e., indirection table
* of @indir_size __u32 elements, followed by hash key of @key_size
@@ -866,14 +897,16 @@ struct ethtool_rxfh_indir {
* size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
* %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
* and a @indir_size of zero means the indir table should be reset to default
- * values.
+ * values. An hfunc of zero means that hash function setting is not requested.
*/
struct ethtool_rxfh {
__u32 cmd;
__u32 rss_context;
__u32 indir_size;
__u32 key_size;
- __u32 rsvd[2];
+ __u8 hfunc;
+ __u8 rsvd8[3];
+ __u32 rsvd32;
__u32 rss_config[0];
};
#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
@@ -1152,6 +1185,8 @@ enum ethtool_sfeatures_retval_bits {
#define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */
#define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */
+#define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */
+#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -1184,6 +1219,10 @@ enum ethtool_sfeatures_retval_bits {
#define SUPPORTED_40000baseCR4_Full (1 << 24)
#define SUPPORTED_40000baseSR4_Full (1 << 25)
#define SUPPORTED_40000baseLR4_Full (1 << 26)
+#define SUPPORTED_56000baseKR4_Full (1 << 27)
+#define SUPPORTED_56000baseCR4_Full (1 << 28)
+#define SUPPORTED_56000baseSR4_Full (1 << 29)
+#define SUPPORTED_56000baseLR4_Full (1 << 30)
#define ADVERTISED_10baseT_Half (1 << 0)
#define ADVERTISED_10baseT_Full (1 << 1)
@@ -1212,6 +1251,10 @@ enum ethtool_sfeatures_retval_bits {
#define ADVERTISED_40000baseCR4_Full (1 << 24)
#define ADVERTISED_40000baseSR4_Full (1 << 25)
#define ADVERTISED_40000baseLR4_Full (1 << 26)
+#define ADVERTISED_56000baseKR4_Full (1 << 27)
+#define ADVERTISED_56000baseCR4_Full (1 << 28)
+#define ADVERTISED_56000baseSR4_Full (1 << 29)
+#define ADVERTISED_56000baseLR4_Full (1 << 30)
/* The following are all involved in forcing a particular link
* mode for the device for setting things. When getting the
@@ -1219,12 +1262,16 @@ enum ethtool_sfeatures_retval_bits {
* it was forced up into this mode or autonegotiated.
*/
-/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
+/* The forced speed, 10Mb, 100Mb, gigabit, [2.5|10|20|40|56]GbE. */
#define SPEED_10 10
#define SPEED_100 100
#define SPEED_1000 1000
#define SPEED_2500 2500
#define SPEED_10000 10000
+#define SPEED_20000 20000
+#define SPEED_40000 40000
+#define SPEED_56000 56000
+
#define SPEED_UNKNOWN -1
/* Duplex, half or full. */
@@ -1314,6 +1361,10 @@ enum ethtool_sfeatures_retval_bits {
#define ETH_MODULE_SFF_8079_LEN 256
#define ETH_MODULE_SFF_8472 0x2
#define ETH_MODULE_SFF_8472_LEN 512
+#define ETH_MODULE_SFF_8636 0x3
+#define ETH_MODULE_SFF_8636_LEN 256
+#define ETH_MODULE_SFF_8436 0x4
+#define ETH_MODULE_SFF_8436_LEN 256
/* Reset flags */
/* The reset() operation must clear the flags for the components which
@@ -1345,4 +1396,4 @@ enum ethtool_reset_flags {
};
#define ETH_RESET_SHARED_SHIFT 16
-#endif /* _LINUX_ETHTOOL_H */
+#endif /* _UAPI_LINUX_ETHTOOL_H */
--
1.9.3
^ permalink raw reply related
* [PATCH ethtool 2/5] ethtool: Add missing Advertised speeds
From: Amir Vadai @ 2015-01-25 13:51 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, Or Gerlitz, Yevgeny Petrilin, Saeed Mahameed, Eyal Perry,
Eyal Grossman, Amir Vadai
In-Reply-To: <1422193883-30504-1-git-send-email-amirv@mellanox.com>
From: Eyal Grossman <eyalgr@mellanox.com>
Added the following missing advertised speed modes:
- ADVERTISED_10000baseT_Full
- ADVERTISED_56000baseKR4_Full
- ADVERTISED_56000baseCR4_Full
- ADVERTISED_56000baseSR4_Full
- ADVERTISED_56000baseLR4_Full
- ADVERTISED_10000baseKX4_Full
In order to reduce code duplication we added a macro to
ALL_ADVERTISED_FLAGS in line 88 ALL_ADVERTISED_MODES,
in addition the changed we made added speed that were
missing from ALL_ADVERTISED_MODES
(e.g. ADVERTISED_10000baseKX4_Full).
Added ADVERTISED_10000baseR_FEC to mode_defs.
Signed-off-by: Eyal Grossman <eyalgr@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
ethtool.c | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index bf583f3..7b873d3 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -53,7 +53,9 @@
ADVERTISED_100baseT_Full | \
ADVERTISED_1000baseT_Half | \
ADVERTISED_1000baseT_Full | \
+ ADVERTISED_1000baseKX_Full| \
ADVERTISED_2500baseX_Full | \
+ ADVERTISED_10000baseT_Full | \
ADVERTISED_10000baseKX4_Full | \
ADVERTISED_10000baseKR_Full | \
ADVERTISED_10000baseR_FEC | \
@@ -62,36 +64,23 @@
ADVERTISED_40000baseKR4_Full | \
ADVERTISED_40000baseCR4_Full | \
ADVERTISED_40000baseSR4_Full | \
- ADVERTISED_40000baseLR4_Full)
+ ADVERTISED_40000baseLR4_Full | \
+ ADVERTISED_56000baseKR4_Full | \
+ ADVERTISED_56000baseCR4_Full | \
+ ADVERTISED_56000baseSR4_Full | \
+ ADVERTISED_56000baseLR4_Full)
#define ALL_ADVERTISED_FLAGS \
- (ADVERTISED_10baseT_Half | \
- ADVERTISED_10baseT_Full | \
- ADVERTISED_100baseT_Half | \
- ADVERTISED_100baseT_Full | \
- ADVERTISED_1000baseT_Half | \
- ADVERTISED_1000baseT_Full | \
- ADVERTISED_Autoneg | \
+ (ADVERTISED_Autoneg | \
ADVERTISED_TP | \
ADVERTISED_AUI | \
ADVERTISED_MII | \
ADVERTISED_FIBRE | \
ADVERTISED_BNC | \
- ADVERTISED_10000baseT_Full | \
ADVERTISED_Pause | \
ADVERTISED_Asym_Pause | \
- ADVERTISED_2500baseX_Full | \
ADVERTISED_Backplane | \
- ADVERTISED_1000baseKX_Full | \
- ADVERTISED_10000baseKX4_Full | \
- ADVERTISED_10000baseKR_Full | \
- ADVERTISED_10000baseR_FEC | \
- ADVERTISED_20000baseMLD2_Full | \
- ADVERTISED_20000baseKR2_Full | \
- ADVERTISED_40000baseKR4_Full | \
- ADVERTISED_40000baseCR4_Full | \
- ADVERTISED_40000baseSR4_Full | \
- ADVERTISED_40000baseLR4_Full)
+ ALL_ADVERTISED_MODES)
#ifndef HAVE_NETIF_MSG
enum {
@@ -527,15 +516,20 @@ dump_link_caps(const char *prefix, const char *an_prefix, u32 mask,
{ 1, ADVERTISED_1000baseT_Full, "1000baseT/Full" },
{ 0, ADVERTISED_1000baseKX_Full, "1000baseKX/Full" },
{ 0, ADVERTISED_2500baseX_Full, "2500baseX/Full" },
- { 0, ADVERTISED_10000baseT_Full, "10000baseT/Full" },
+ { 1, ADVERTISED_10000baseT_Full, "10000baseT/Full" },
{ 0, ADVERTISED_10000baseKX4_Full, "10000baseKX4/Full" },
{ 0, ADVERTISED_10000baseKR_Full, "10000baseKR/Full" },
+ { 0, ADVERTISED_10000baseR_FEC, "10000baseR/FEC" },
{ 0, ADVERTISED_20000baseMLD2_Full, "20000baseMLD2/Full" },
{ 0, ADVERTISED_20000baseKR2_Full, "20000baseKR2/Full" },
{ 0, ADVERTISED_40000baseKR4_Full, "40000baseKR4/Full" },
{ 0, ADVERTISED_40000baseCR4_Full, "40000baseCR4/Full" },
{ 0, ADVERTISED_40000baseSR4_Full, "40000baseSR4/Full" },
{ 0, ADVERTISED_40000baseLR4_Full, "40000baseLR4/Full" },
+ { 0, ADVERTISED_56000baseKR4_Full, "56000baseKR4/Full" },
+ { 0, ADVERTISED_56000baseCR4_Full, "56000baseCR4/Full" },
+ { 0, ADVERTISED_56000baseSR4_Full, "56000baseSR4/Full" },
+ { 0, ADVERTISED_56000baseLR4_Full, "56000baseLR4/Full" },
};
int indent;
int did1, new_line_pend, i;
--
1.9.3
^ permalink raw reply related
* [PATCH ethtool 0/5] RSS improvements + new speeds
From: Amir Vadai @ 2015-01-25 13:51 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, Or Gerlitz, Yevgeny Petrilin, Saeed Mahameed, Eyal Perry,
Amir Vadai
Hi Ben,
This patchset contains some features and small bug fixes.
A patch by Eyal Perry to enable setting RSS hash function, kernel support was
added in commit 892311f ("ethtool: Support for configurable RSS hash
function").
Eyal Grossman added some missing advertised speeds and fixed some issues in
this area of code.
Patches were tested and applied on top of commit 4614098 ("Release version 3.16.")
Thanks,
Amir
Eyal Grossman (3):
ethtool-copy.h: sync with net
ethtool: Add missing Advertised speeds
ethtool: Return bad status when send_ioctl fails
Eyal Perry (2):
ethtool: Prettify RX flow hash indirection table print
ethtool: Support for configurable RSS hash function
ethtool-copy.h | 67 +++++++++++++++++++++++++++----
ethtool.8.in | 7 ++++
ethtool.c | 122 ++++++++++++++++++++++++++++++++++++++++-----------------
3 files changed, 152 insertions(+), 44 deletions(-)
--
1.9.3
^ permalink raw reply
* [PATCH ethtool 3/5] ethtool: Return bad status when send_ioctl fails
From: Amir Vadai @ 2015-01-25 13:51 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, Or Gerlitz, Yevgeny Petrilin, Saeed Mahameed, Eyal Perry,
Eyal Grossman, Amir Vadai
In-Reply-To: <1422193883-30504-1-git-send-email-amirv@mellanox.com>
From: Eyal Grossman <eyalgr@mellanox.com>
Added to ethtool return code(rc != 0) when an error occurs after send_ioctl has fails.
Signed-off-by: Eyal Grossman <eyalgr@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
ethtool.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index 7b873d3..8d53a53 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2352,6 +2352,7 @@ static int do_sset(struct cmd_context *ctx)
char **argp = ctx->argp;
int i;
int err;
+ int status = 0;
for (i = 0; i < ARRAY_SIZE(flags_msglvl); i++)
flag_to_cmdline_info(flags_msglvl[i].name,
@@ -2523,6 +2524,7 @@ static int do_sset(struct cmd_context *ctx)
err = send_ioctl(ctx, &ecmd);
if (err < 0) {
perror("Cannot get current device settings");
+ status += err;
} else {
/* Change everything the user specified. */
if (speed_wanted != -1)
@@ -2593,8 +2595,10 @@ static int do_sset(struct cmd_context *ctx)
/* Try to perform the update. */
ecmd.cmd = ETHTOOL_SSET;
err = send_ioctl(ctx, &ecmd);
- if (err < 0)
+ if (err < 0) {
perror("Cannot set new settings");
+ status += err;
+ }
}
if (err < 0) {
if (speed_wanted != -1)
@@ -2621,6 +2625,7 @@ static int do_sset(struct cmd_context *ctx)
err = send_ioctl(ctx, &wol);
if (err < 0) {
perror("Cannot get current wake-on-lan settings");
+ status += err;
} else {
/* Change everything the user specified. */
if (wol_change) {
@@ -2636,8 +2641,10 @@ static int do_sset(struct cmd_context *ctx)
/* Try to perform the update. */
wol.cmd = ETHTOOL_SWOL;
err = send_ioctl(ctx, &wol);
- if (err < 0)
+ if (err < 0) {
perror("Cannot set new wake-on-lan settings");
+ status += err;
+ }
}
if (err < 0) {
if (wol_change)
@@ -2654,17 +2661,20 @@ static int do_sset(struct cmd_context *ctx)
err = send_ioctl(ctx, &edata);
if (err < 0) {
perror("Cannot get msglvl");
+ status += err;
} else {
edata.cmd = ETHTOOL_SMSGLVL;
edata.data = ((edata.data & ~msglvl_mask) |
msglvl_wanted);
err = send_ioctl(ctx, &edata);
- if (err < 0)
+ if (err < 0) {
perror("Cannot set new msglvl");
+ status += err;
+ }
}
}
- return 0;
+ return status;
}
static int do_gregs(struct cmd_context *ctx)
--
1.9.3
^ permalink raw reply related
* [PATCH ethtool 4/5] ethtool: Prettify RX flow hash indirection table print
From: Amir Vadai @ 2015-01-25 13:51 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, Or Gerlitz, Yevgeny Petrilin, Saeed Mahameed, Eyal Perry,
Amir Vadai
In-Reply-To: <1422193883-30504-1-git-send-email-amirv@mellanox.com>
From: Eyal Perry <eyalpe@mellanox.com>
When indirection table size is not a multiple of 8, a new line is
missing at the last row of the table.
In addition, make a distinction between the attribute name and its value
by adding an indentation on the beginning of each line which contains
values.
Before the changne:
[user@host]# ./ethtool-3.16 -x enp5s0
RX flow hash indirection table for enp5s0 with 20 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 10 11 12 13 14 15
16: 0 1 2 3RSS hash key:
16:d5:5a:31:21:8d:0e:2b:55:ea:ca:70:a8:19:5e:72:2e:c0:f9:0f:9b:6c:94:8f:59:ca:42:d1:c3:58:91:4a:3d:77:a1:e5:ab:8b:6f:68
After:
[user@host]# ./ethtool-3.16+ -x enp5s0
RX flow hash indirection table for enp5s0 with 20 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 10 11 12 13 14 15
16: 0 1 2 3
RSS hash key:
16:d5:5a:31:21:8d:0e:2b:55:ea:ca:70:a8:19:5e:72:2e:c0:f9:0f:9b:6c:94:8f:59:ca:42:d1:c3:58:91:4a:3d:77:a1:e5:ab:8b:6f:68
Signed-off-by: Eyal Perry <eyalpe@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
ethtool.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index 8d53a53..c2f4164 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -3120,19 +3120,19 @@ static void print_indir_table(struct cmd_context *ctx,
{
u32 i;
- printf("RX flow hash indirection table for %s with %llu RX ring(s):\n",
+ printf("RX flow hash indirection table for %s with %llu RX ring(s):",
ctx->devname, ring_count->data);
if (!indir_size)
- printf("Operation not supported\n");
+ printf("\n Operation not supported");
for (i = 0; i < indir_size; i++) {
if (i % 8 == 0)
- printf("%5u: ", i);
+ printf("\n%5u: ", i);
printf(" %5u", indir[i]);
- if (i % 8 == 7)
- fputc('\n', stdout);
}
+ fputc('\n', stdout);
+
}
static int do_grxfhindir(struct cmd_context *ctx,
@@ -3220,7 +3220,7 @@ static int do_grxfh(struct cmd_context *ctx)
indir_bytes = rss->indir_size * sizeof(rss->rss_config[0]);
hkey = ((char *)rss->rss_config + indir_bytes);
- printf("RSS hash key:\n");
+ printf("RSS hash key:\n ");
if (!rss->key_size)
printf("Operation not supported\n");
--
1.9.3
^ permalink raw reply related
* [PATCH ethtool 5/5] ethtool: Support for configurable RSS hash function
From: Amir Vadai @ 2015-01-25 13:51 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, Or Gerlitz, Yevgeny Petrilin, Saeed Mahameed, Eyal Perry,
Amir Vadai
In-Reply-To: <1422193883-30504-1-git-send-email-amirv@mellanox.com>
From: Eyal Perry <eyalpe@mellanox.com>
This ethtool patch adds support to set and get the current RSS hash
function for the device through through the new hfunc mask field in the
ethtool_rxfh struct. Kernel supported hash function names are queried
with ETHTOOL_GSTRINGS - each string is corresponding with a bit in hfunc
mask according to its index in the string-set.
Signed-off-by: Eyal Perry <eyalpe@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
ethtool.8.in | 7 +++++++
ethtool.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 58 insertions(+), 5 deletions(-)
diff --git a/ethtool.8.in b/ethtool.8.in
index ae56293..bdc77e0 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -297,6 +297,8 @@ ethtool \- query or control network driver and hardware settings
.BI weight\ W0
.IR W1
.RB ...\ ]
+.RB [ hfunc
+.IR FUNC ]
.HP
.B ethtool \-f|\-\-flash
.I devname file
@@ -796,6 +798,11 @@ Sets RSS hash key of the specified network device. RSS hash key should be of dev
Hash key format must be in xx:yy:zz:aa:bb:cc format meaning both the nibbles of a byte should be mentioned
even if a nibble is zero.
.TP
+.BI hfunc
+Sets RSS hash function of the specified network device. Requested hash function
+should be supported by the kernel and the device. List of RSS hash functions
+which kernel supports is shown as a part of the --show-rxfh comand output.
+.TP
.BI equal\ N
Sets the receive flow hash indirection table to spread flows evenly
between the first \fIN\fR receive queues.
diff --git a/ethtool.c b/ethtool.c
index c2f4164..c584333 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -3176,10 +3176,11 @@ static int do_grxfh(struct cmd_context *ctx)
{
struct ethtool_rxfh rss_head = {0};
struct ethtool_rxnfc ring_count;
+ struct ethtool_gstrings *hfuncs;
struct ethtool_rxfh *rss;
u32 i, indir_bytes;
char *hkey;
- int err;
+ int err, cur_len, max_len = 0;
ring_count.cmd = ETHTOOL_GRXRINGS;
err = send_ioctl(ctx, &ring_count);
@@ -3231,6 +3232,23 @@ static int do_grxfh(struct cmd_context *ctx)
printf("%02x:", (u8) hkey[i]);
}
+ printf("RSS hash function:\n");
+ if (!rss->hfunc) {
+ printf(" Operation not supported\n");
+ goto out;
+ }
+ hfuncs = get_stringset(ctx, ETH_SS_RSS_HASH_FUNCS, 0, 1);
+ for (i = 0; i < hfuncs->len; i++) {
+ cur_len = strlen((const char *)hfuncs->data +
+ i * ETH_GSTRING_LEN);
+ if (cur_len > max_len)
+ max_len = cur_len;
+ }
+ for (i = 0; i < hfuncs->len; i++)
+ printf(" %-*s: %s\n", max_len,
+ (const char *)hfuncs->data + i * ETH_GSTRING_LEN,
+ (rss->hfunc & (1 << i)) ? "on" : "off");
+out:
free(rss);
return 0;
}
@@ -3330,12 +3348,15 @@ static int do_srxfh(struct cmd_context *ctx)
struct ethtool_rxfh rss_head = {0};
struct ethtool_rxfh *rss;
struct ethtool_rxnfc ring_count;
+ struct ethtool_gstrings *hfuncs;
int rxfhindir_equal = 0;
char **rxfhindir_weight = NULL;
char *rxfhindir_key = NULL;
+ char *req_hfunc_name = NULL;
+ char *hfunc_name = NULL;
char *hkey = NULL;
- int err = 0;
- u32 arg_num = 0, indir_bytes = 0;
+ int i, err = 0;
+ u32 arg_num = 0, indir_bytes = 0, req_hfunc = 0;
u32 entry_size = sizeof(rss_head.rss_config[0]);
u32 num_weights = 0;
@@ -3364,6 +3385,12 @@ static int do_srxfh(struct cmd_context *ctx)
if (!rxfhindir_key)
exit_bad_args();
++arg_num;
+ } else if (!strcmp(ctx->argp[arg_num], "hfunc")) {
+ ++arg_num;
+ req_hfunc_name = ctx->argp[arg_num];
+ if (!req_hfunc_name)
+ exit_bad_args();
+ ++arg_num;
} else {
exit_bad_args();
}
@@ -3384,7 +3411,8 @@ static int do_srxfh(struct cmd_context *ctx)
rss_head.cmd = ETHTOOL_GRSSH;
err = send_ioctl(ctx, &rss_head);
- if (err < 0 && errno == EOPNOTSUPP && !rxfhindir_key) {
+ if (err < 0 && errno == EOPNOTSUPP &&
+ !rxfhindir_key && !req_hfunc_name) {
return do_srxfhindir(ctx, rxfhindir_equal, rxfhindir_weight,
num_weights);
} else if (err < 0) {
@@ -3402,6 +3430,22 @@ static int do_srxfh(struct cmd_context *ctx)
if (rxfhindir_equal || rxfhindir_weight)
indir_bytes = rss_head.indir_size * entry_size;
+ if (rss_head.hfunc && req_hfunc_name) {
+ hfuncs = get_stringset(ctx, ETH_SS_RSS_HASH_FUNCS, 0, 1);
+ for (i = 0; i < hfuncs->len && !req_hfunc ; i++) {
+ hfunc_name = (char *)(hfuncs->data +
+ i * ETH_GSTRING_LEN);
+ if (!strncmp(hfunc_name, req_hfunc_name,
+ ETH_GSTRING_LEN))
+ req_hfunc = (u32)1 << i;
+ }
+ if (!req_hfunc) {
+ fprintf(stderr,
+ "Unknown hash function: %s\n", req_hfunc_name);
+ return 1;
+ }
+ }
+
rss = calloc(1, sizeof(*rss) + indir_bytes + rss_head.key_size);
if (!rss) {
perror("Cannot allocate memory for RX flow hash config");
@@ -3410,6 +3454,7 @@ static int do_srxfh(struct cmd_context *ctx)
rss->cmd = ETHTOOL_SRSSH;
rss->indir_size = rss_head.indir_size;
rss->key_size = rss_head.key_size;
+ rss->hfunc = req_hfunc ? req_hfunc : 0;
if (fill_indir_table(&rss->indir_size, rss->rss_config, rxfhindir_equal,
rxfhindir_weight, num_weights)) {
@@ -4119,7 +4164,8 @@ static const struct option {
{ "-X|--set-rxfh-indir|--rxfh", 1, do_srxfh,
"Set Rx flow hash indirection and/or hash key",
" [ equal N | weight W0 W1 ... ]\n"
- " [ hkey %x:%x:%x:%x:%x:.... ]\n" },
+ " [ hkey %x:%x:%x:%x:%x:.... ]\n"
+ " [ hfunc FUNC ]\n"},
{ "-f|--flash", 1, do_flash,
"Flash firmware image from the specified file to a region on the device",
" FILENAME [ REGION-NUMBER-TO-FLASH ]\n" },
--
1.9.3
^ permalink raw reply related
* Darlehen Angebot
From: KRAUSE ARNO @ 2015-01-25 11:03 UTC (permalink / raw)
Guten Morgen
Sind Sie in Darlehen interessiert?
Der Preis ist niedrig
Für weitere Informationen und Erklärungen
Meine E-Mail: info.krause.arno@gmail.com
Danke
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox