* Re: [ethtool PATCH 5/6] v4 Add RX packet classification interface
From: Alexander Duyck @ 2011-04-28 20:15 UTC (permalink / raw)
To: Ben Hutchings
Cc: davem@davemloft.net, Kirsher, Jeffrey T, netdev@vger.kernel.org
In-Reply-To: <1303927934.2875.82.camel@bwh-desktop>
On 4/27/2011 11:12 AM, Ben Hutchings wrote:
> On Thu, 2011-04-21 at 13:40 -0700, Alexander Duyck wrote:
[...]
>> + /* verify only one field is setting data field */
>> + if ((fsp->flow_type& FLOW_EXT)&&
>> + (fsp->m_ext.data[0] || fsp->m_ext.data[1])&&
>> + fsp->m_ext.vlan_etype)
>> + return -1;
>> +
>> + /* initialize entire ntuple to all 0xFF */
>> + memset(ntuple, ~0, sizeof(*ntuple));
>
> The comment needs to explain *why* the value is ~0 rather than 0. I
> assume the idea is to set the masks to ~0 if they are not initialised
> below.
This has to do with future compatibility and general setup. By setting
all of the values to ~0 the rule is essentially set to mask everything
and has a default action of drop.
>> + /* set non-filter values */
>> + ntuple->flow_type = fsp->flow_type;
>> + ntuple->action = fsp->ring_cookie;
>> +
>> + /* copy header portion over */
>> + memcpy(&ntuple->h_u,&fsp->h_u, sizeof(fsp->h_u));
>
> This deserves a comment that the two h_u fields are different unions,
> but are defined identically except for padding at the end.
I've added a comment similar to that to the code.
>> + /* copy mask portion over and invert */
>> + memcpy(&ntuple->m_u,&fsp->m_u, sizeof(fsp->m_u));
>> + for (i = 0; i< sizeof(fsp->m_u); i++)
>> + ntuple->m_u.hdata[i] ^= 0xFF;
>> +
>> + /* copy extended fields */
>> + if (fsp->flow_type& FLOW_EXT) {
>> + ntuple->vlan_tag =
>> + ntohs(fsp->h_ext.vlan_tci);
>> + ntuple->vlan_tag_mask =
>> + ~ntohs(fsp->m_ext.vlan_tci);
>> + if (fsp->m_ext.vlan_etype) {
>> + ntuple->data =
>> + ntohl(fsp->h_ext.vlan_etype);
>> + ntuple->data_mask =
>> + ~(u64)ntohl(fsp->m_ext.vlan_etype);
>> + } else {
>> + ntuple->data =
>> + (u64)ntohl(fsp->h_ext.data[0]);
>> + ntuple->data |=
>> + (u64)ntohl(fsp->h_ext.data[1])<< 32;
>> + ntuple->data_mask =
>> + (u64)ntohl(~fsp->m_ext.data[0]);
>> + ntuple->data_mask |=
>> + (u64)ntohl(~fsp->m_ext.data[1])<< 32;
>> + }
>> + }
>
> I think it would be clearer to add:
>
> else {
> ntuple->vlan_tag_mask = ~(u16)0;
> ntuple->data_mask = ~(u64)0;
> }
>
> rather than use memset() above.
I thought about doing that, but the advantage of the memset is that it
covers all of the fields. So in the unlikely event that someone were to
add fields in the future to the h_u/m_u sections of the driver this way
we can guarantee all of the fields that we didn't set are masked.
>> + return 0;
>> +}
>> +
>> static int do_srxntuple(int fd, struct ifreq *ifr)
>> {
>> + struct ethtool_rx_ntuple ntuplecmd;
>> + struct ethtool_value eval;
>> int err;
>>
>> - if (sntuple_changed) {
>> - struct ethtool_rx_ntuple ntuplecmd;
>> + /* verify if Ntuple is supported on the HW */
>
> This comment is inaccurate.
Yeah, it belonged a few lines lower I think it was left over from some
earlier work that was there and when I reordered things to do the
conversion to ntuple first the comment didn't get moved.
>> + err = flow_spec_to_ntuple(&rx_rule_fs,&ntuplecmd.fs);
>> + if (err)
>> + return -1;
>> +
>> + /*
>> + * Check to see if the flag is set for N-tuple, this allows
>> + * us to avoid the possible EINVAL response for the N-tuple
>> + * flag not being set on the device
>> + */
>> + eval.cmd = ETHTOOL_GFLAGS;
>> + ifr->ifr_data = (caddr_t)&eval;
>> + err = ioctl(fd, SIOCETHTOOL, ifr);
>> + if (err || !(eval.data& ETH_FLAG_NTUPLE))
>> + return -1;
>>
>> - ntuplecmd.cmd = ETHTOOL_SRXNTUPLE;
>> - memcpy(&ntuplecmd.fs,&ntuple_fs,
>> - sizeof(struct ethtool_rx_ntuple_flow_spec));
>> + /* send rule via N-tuple */
>> + ntuplecmd.cmd = ETHTOOL_SRXNTUPLE;
>> + ifr->ifr_data = (caddr_t)&ntuplecmd;
>> + err = ioctl(fd, SIOCETHTOOL, ifr);
>>
>> - ifr->ifr_data = (caddr_t)&ntuplecmd;
>> - err = ioctl(fd, SIOCETHTOOL, ifr);
>> - if (err< 0)
>> - perror("Cannot add new RX n-tuple filter");
>> + /*
>> + * Display error only if reponse is something other than op not
>> + * supported. It is possible that the interface uses the network
>> + * flow classifier interface instead of N-tuple.
>> + */
>> + if (err&& errno != EOPNOTSUPP)
>> + perror("Cannot add new rule via N-tuple");
>> +
>> + return err;
>> +}
>> +
>> +static int do_srxclsrule(int fd, struct ifreq *ifr)
>> +{
>> + int err;
>> +
>> + if (rx_class_rule_added) {
>> + /* attempt to add rule via N-tuple specifier */
>> + err = do_srxntuple(fd, ifr);
>> + if (!err)
>> + return 0;
>> +
>> + /* attempt to add rule via network flow classifier */
>> + err = rxclass_rule_ins(fd, ifr,&rx_rule_fs);
>> + if (err< 0) {
>> + fprintf(stderr, "Cannot insert"
>> + " classification rule\n");
>> + return 1;
>> + }
>
> Is this the right order to try them? I'm not sure.
The reason why I chose to do it this way was because it is actually
fewer steps to try doing an ntuple than it is to do a network flow
classifier rule. To fail ntuple I only really need to check the flag,
whereas for network flow classifier I end up having to go through the
path that does init for any rule add which is significantly more overhead.
All of the other changes you suggested for this patch I think I have
implemented for the next version. I'm working on finishing up the
updates now. But I think it will take me a day or to in order to
sufficient testing so I can be confident all the bugs are worked out
after the changes. I'll probably be able to email out the update
patches on Friday.
Thanks,
Alex
^ permalink raw reply
* Re: [PATCH] inet: add RCU protection to inet->opt
From: David Miller @ 2011-04-28 20:20 UTC (permalink / raw)
To: eric.dumazet; +Cc: herbert, netdev
In-Reply-To: <1303415137.2784.23.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 21 Apr 2011 21:45:37 +0200
> [PATCH] inet: add RCU protection to inet->opt
Applied, although I had to add the following build fix to the
final commit:
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index cc67367..962a607 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -416,7 +416,6 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
int rc;
struct l2tp_ip_sock *lsa = l2tp_ip_sk(sk);
struct inet_sock *inet = inet_sk(sk);
- struct ip_options *opt = inet->opt;
struct rtable *rt = NULL;
int connected = 0;
__be32 daddr;
@@ -471,9 +470,14 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
rt = (struct rtable *) __sk_dst_check(sk, 0);
if (rt == NULL) {
+ struct ip_options_rcu *inet_opt;
+
+ inet_opt = rcu_dereference_protected(inet->inet_opt,
+ sock_owned_by_user(sk));
+
/* Use correct destination address if we have options. */
- if (opt && opt->srr)
- daddr = opt->faddr;
+ if (inet_opt && inet_opt->opt.srr)
+ daddr = inet_opt->opt.faddr;
/* If this fails, retransmit mechanism of transport layer will
* keep trying until route appears or the connection times
^ permalink raw reply related
* Re: [PATCH net-next-2.6] veth: remove unneeded ifname code from veth_newlink()
From: David Miller @ 2011-04-28 20:27 UTC (permalink / raw)
To: mirqus; +Cc: jpirko, netdev, xemul
In-Reply-To: <BANLkTikUAGWhNnCrebQpVttorqVxfD6KWw@mail.gmail.com>
From: Michał Mirosław <mirqus@gmail.com>
Date: Fri, 22 Apr 2011 11:49:40 +0200
> W dniu 22 kwietnia 2011 11:43 użytkownik Michał Mirosław
> <mirqus@gmail.com> napisał:
>> 2011/1/24 Jiri Pirko <jpirko@redhat.com>:
>>> The code is not needed because tb[IFLA_IFNAME] is already
>>> processed in rtnl_newlink(). Remove this redundancy.
>> Hi. This patch broke creation of veth devices. Reverting it fixes the issue.
>>
>> Symptoms:
>>
>> icybox:~# ip link add type veth
>> RTNETLINK answers: File exists
>> icybox:~# ip link add type veth peer veth1
>> icybox:~# ip addr
>> [...]
>> 56: D: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
>> link/ether e6:57:58:52:03:50 brd ff:ff:ff:ff:ff:ff
>> 57: veth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
>> link/ether c2:c2:a2:d5:d5:3a brd ff:ff:ff:ff:ff:ff
>
> Hmm. I was too quick. Reverting it fixes only first problem - "ip link
> add type veth" adds new veth pair now, but "ip link add type veth peer
> veth1" gives the same result as above.
Jiri please look into this regression.
^ permalink raw reply
* Re: [PATCH net-next 1/3] net:use help function of skb_checksum_start_offset to calculate offset
From: David Miller @ 2011-04-28 20:29 UTC (permalink / raw)
To: shanwei; +Cc: netdev, cmetcalf
In-Reply-To: <4DB1617D.30600@cn.fujitsu.com>
From: Shan Wei <shanwei@cn.fujitsu.com>
Date: Fri, 22 Apr 2011 19:07:41 +0800
> Although these are equivalent, but the skb_checksum_start_offset() is more readable.
>
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 2/3] net: fullly using NETIF_F_GSO_SOFTWARE macros and NETIF_F_SOFT_FEATURES
From: David Miller @ 2011-04-28 20:30 UTC (permalink / raw)
To: shanwei; +Cc: netdev, kaber, rusty, mst, eric.dumazet, krkumar2, mirq-linux,
joe
In-Reply-To: <4DB16181.9010306@cn.fujitsu.com>
From: Shan Wei <shanwei@cn.fujitsu.com>
Date: Fri, 22 Apr 2011 19:07:45 +0800
>
> Fullly using NETIF_F_GSO_SOFTWARE and NETIF_F_SOFT_FEATURES.
> And some code style tuning. Just compile test.
>
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
You've received feedback on this patch and patch #3. Please
address it.
^ permalink raw reply
* Re: [PATCH] net: allow user to change NETIF_F_HIGHDMA
From: David Miller @ 2011-04-28 20:33 UTC (permalink / raw)
To: mirq-linux; +Cc: netdev
In-Reply-To: <20110422163116.37DE613909@rere.qmqm.pl>
From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Fri, 22 Apr 2011 18:31:16 +0200 (CEST)
> NETIF_F_HIGHDMA is like any other TX offloads, so allow user to toggle it.
> This is needed later for bridge and bonding convertsion to hw_features.
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Applied.
^ permalink raw reply
* Re: [PATCH] net: fix netdev_increment_features()
From: David Miller @ 2011-04-28 20:33 UTC (permalink / raw)
To: mirq-linux; +Cc: netdev, bhutchings, fubar, andy, shemminger, bridge
In-Reply-To: <20110422163116.3C5C3138DD@rere.qmqm.pl>
From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Fri, 22 Apr 2011 18:31:16 +0200 (CEST)
> Simplify and fix netdev_increment_features() to conform to what is
> stated in netdevice.h comments about NETIF_F_ONE_FOR_ALL.
> Include FCoE segmentation and VLAN-challedged flags in computation.
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Applied.
^ permalink raw reply
* Re: [PATCH] bridge: convert br_features_recompute() to ndo_fix_features
From: David Miller @ 2011-04-28 20:33 UTC (permalink / raw)
To: mirq-linux; +Cc: netdev, shemminger, bridge
In-Reply-To: <20110422163116.5BAE713A64@rere.qmqm.pl>
From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Fri, 22 Apr 2011 18:31:16 +0200 (CEST)
> Note: netdev_update_features() needs only rtnl_lock as br->port_list
> is only changed while holding it.
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Applied.
^ permalink raw reply
* Re: [PATCH] dsa/mv88e6131: fix unknown multicast/broadcast forwarding on mv88e6085
From: David Miller @ 2011-04-28 20:36 UTC (permalink / raw)
To: buytenh; +Cc: jacmet, netdev
In-Reply-To: <20110426145740.GL1897@wantstofly.org>
From: Lennert Buytenhek <buytenh@wantstofly.org>
Date: Tue, 26 Apr 2011 16:57:40 +0200
> On Tue, Apr 26, 2011 at 01:45:41PM +0200, Peter Korsgaard wrote:
>
>> The 88e6085 has a few differences from the other devices in the port
>> control registers, causing unknown multicast/broadcast packets to get
>> dropped when using the standard port setup.
>>
>> At the same time update kconfig to clarify that the mv88e6085 is now
>> supported.
>>
>> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
>
> Assuming that you've tested this.. :)
>
> Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
Applied, thanks everyone.
^ permalink raw reply
* Re: [ethtool PATCH 6/6] Update documentation for -u/-U operations
From: Alexander Duyck @ 2011-04-28 20:40 UTC (permalink / raw)
To: Ben Hutchings
Cc: davem@davemloft.net, Kirsher, Jeffrey T, netdev@vger.kernel.org
In-Reply-To: <1303928629.2875.91.camel@bwh-desktop>
On 4/27/2011 11:23 AM, Ben Hutchings wrote:
> On Thu, 2011-04-21 at 13:40 -0700, Alexander Duyck wrote:
>> This patch updates the documentation for the -u/-U operations to include
>> the recent changes made to support addition/deletion/display of network
>> flow classifier rules.
>
> This should be included in the same patch.
I'll combine the two patches for the next release if that is what is
preferred. I was just trying to keep the overall size down by splitting
them since this is documentation only.
>> Signed-off-by: Alexander Duyck<alexander.h.duyck@intel.com>
>> ---
>>
>> ethtool.8.in | 185 +++++++++++++++++++++++++++++-----------------------------
>> ethtool.c | 32 ++++++----
>> 2 files changed, 111 insertions(+), 106 deletions(-)
>>
>> diff --git a/ethtool.8.in b/ethtool.8.in
>> index 12a1d1d..8908351 100644
>> --- a/ethtool.8.in
>> +++ b/ethtool.8.in
>> @@ -42,10 +42,20 @@
>> [\\fB\\$1\\fP\ \\fIN\\fP]
>> ..
>> .\"
>> +.\" .BM - same as above but has a mask field for format "[value N [value-mask N]]"
>> +.\"
>> +.de BM
>> +[\\fB\\$1\\fP\ \\fIN\\fP\ [\\fB\\$1\-mask\\fP\ \\fIN\\fP]]
>
> You've changed the code to accept 'm' as an alternative to
> <field> '-mask', so this should be changed accordingly.
What would be the preferred way of stating that? For now I just
replaced the \\$1\-mask with m. However I am assuming that probably
isn't the best approach either. Should I state somewhere that m can be
replaced with "field name"-mask?
> [...]
>> @@ -236,9 +252,9 @@ ethtool \- query or control network driver and hardware settings
>> .HP
>> .B ethtool \-N
>> .I ethX
>> -.RB [ rx\-flow\-hash \ \*(FL
>> -.RB \ \*(HO]
>> +.RB [ rx-flow-hash \ \*(FL \ \*(HO]
>> .HP
>> +
>
> This looks like an unintentional reversion of part of commit
> db6c0cee6cd956767e1c39109fe81104cc4694cb.
Yeah, my bad. I will have it updated for the next patch. I only really
meant to combine this into one line, I didn't intend to drop the "\-"
formatting fixes you added.
>> .B ethtool \-x|\-\-show\-rxfh\-indir
>> .I ethX
>> .HP
>> @@ -257,54 +273,28 @@ ethtool \- query or control network driver and hardware settings
>> .HP
>> .B ethtool \-u|\-\-show\-ntuple
>> .I ethX
>> -.TP
>> +.BN class-rule
>> +.HP
>> +
>> .BI ethtool\ \-U|\-\-config\-ntuple \ ethX
>> -.RB {
>> -.A3 flow\-type tcp4 udp4 sctp4
>> -.RB [ src\-ip
>> -.IR addr
>> -.RB [ src\-ip\-mask
>> -.IR mask ]]
>> -.RB [ dst\-ip
>> -.IR addr
>> -.RB [ dst\-ip\-mask
>> -.IR mask ]]
>> -.RB [ src\-port
>> -.IR port
>> -.RB [ src\-port\-mask
>> -.IR mask ]]
>> -.RB [ dst\-port
>> -.IR port
>> -.RB [ dst\-port\-mask
>> -.IR mask ]]
>> -.br
>> -.RB | \ flow\-type\ ether
>> -.RB [ src
>> -.IR mac\-addr
>> -.RB [ src\-mask
>> -.IR mask ]]
>> -.RB [ dst
>> -.IR mac\-addr
>> -.RB [ dst\-mask
>> -.IR mask ]]
>> -.RB [ proto
>> -.IR N
>> -.RB [ proto\-mask
>> -.IR mask ]]\ }
>> -.br
>> -.RB [ vlan
>> -.IR VLAN\-tag
>> -.RB [ vlan\-mask
>> -.IR mask ]]
>> -.RB [ user\-def
>> -.IR data
>> -.RB [ user\-def\-mask
>> -.IR mask ]]
>> -.RI action \ N
>> -.
>> -.\" Adjust lines (i.e. full justification) and hyphenate.
>> -.ad
>> -.hy
>
> As do the last 3 deleted lines here.
I put them back so they should be left in place for the next version.
>> +.BN class-rule-del
>> +.RB [\ flow-type \ \*(NC
>> +.RB [ src \ \*(MA\ [ src-mask \ \*(MA]]
>> +.RB [ dst \ \*(MA\ [ dst-mask \ \*(MA]]
>> +.BM proto
>> +.RB [ src-ip \ \*(PA\ [ src-ip-mask \ \*(PA]]
>> +.RB [ dst-ip \ \*(PA\ [ dst-ip-mask \ \*(PA]]
>> +.BM tos
>> +.BM l4proto
>> +.BM src-port
>> +.BM dst-port
>> +.BM spi
>> +.BM vlan-etype
>> +.BM vlan
>> +.BM user-def
>> +.BN action
>> +.BN loc
>> +.RB ]
>
> But these options aren't all applicable to all flow-types.
This is the part that gets messy and I am not sure what the best
approach is. I have more comments on that below. For now what I am
planning to implement to address this is that in the "DESCRIPTION"
section below I add a statement to each specifier that has restrictions
by stating "Valid for flow-types X, Y, and Z."
> [...]
>> diff --git a/ethtool.c b/ethtool.c
>> index 421fe20..e65979d 100644
>> --- a/ethtool.c
>> +++ b/ethtool.c
>> @@ -243,20 +243,26 @@ static struct option {
>> " equal N | weight W0 W1 ...\n" },
>> { "-U", "--config-ntuple", MODE_SCLSRULE, "Configure Rx ntuple filters "
>> "and actions",
>> - " { flow-type tcp4|udp4|sctp4\n"
>> - " [ src-ip ADDR [src-ip-mask MASK] ]\n"
>> - " [ dst-ip ADDR [dst-ip-mask MASK] ]\n"
>> - " [ src-port PORT [src-port-mask MASK] ]\n"
>> - " [ dst-port PORT [dst-port-mask MASK] ]\n"
>> - " | flow-type ether\n"
>> - " [ src MAC-ADDR [src-mask MASK] ]\n"
>> - " [ dst MAC-ADDR [dst-mask MASK] ]\n"
>> - " [ proto N [proto-mask MASK] ] }\n"
>> - " [ vlan VLAN-TAG [vlan-mask MASK] ]\n"
>> - " [ user-def DATA [user-def-mask MASK] ]\n"
>> - " action N\n" },
>> + " [ class-rule-del %d ] |\n"
>> + " [ flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4\n"
>> + " [ src %x:%x:%x:%x:%x:%x [src-mask %x:%x:%x:%x:%x:%x] ]\n"
>> + " [ dst %x:%x:%x:%x:%x:%x [dst-mask %x:%x:%x:%x:%x:%x] ]\n"
>> + " [ proto %d [proto-mask MASK] ]\n"
>> + " [ src-ip %d.%d.%d.%d [src-ip-mask %d.%d.%d.%d] ]\n"
>> + " [ dst-ip %d.%d.%d.%d [dst-ip-mask %d.%d.%d.%d] ]\n"
>> + " [ tos %d [tos-mask %x] ]\n"
>> + " [ l4proto %d [l4proto-mask MASK] ]\n"
>> + " [ src-port %d [src-port-mask %x] ]\n"
>> + " [ dst-port %d [dst-port-mask %x] ]\n"
>> + " [ spi %d [spi-mask %x] ]\n"
>> + " [ vlan-etype %x [vlan-etype-mask %x] ]\n"
>> + " [ vlan %x [vlan-mask %x] ]\n"
>> + " [ user-def %x [user-def-mask %x] ]\n"
>> + " [ action %d ]\n"
>> + " [ loc %d]]\n" },
> [...]
>
> Again, it's not clear which options apply to which flow-types, and the
> 'm' shortcut is not documented.
The 'm' part I agree with 100%, however the flow types are going to
become kinda hairy using that approach. You basically end up with
something like this:
flow-type ether
[ src %x:%x:%x:%x:%x:%x [src-mask %x:%x:%x:%x:%x:%x]]
[ dst %x:%x:%x:%x:%x:%x [dst-mask %x:%x:%x:%x:%x:%x]]
[ proto %d [proto-mask %x]]
[ vlan-etype %x [vlan-etype-mask %x]]
[ vlan %x [vlan-mask %x]]
[ user-def %x [user-def-mask %x]]
[ action %d ]
[ loc %d]
flow-type ip4
[ src-ip %d.%d.%d.%d [src-ip-mask %d.%d.%d.%d]]
[ dst-ip %d.%d.%d.%d [dst-ip-mask %d.%d.%d.%d]]
[ tos %d [tos-mask %x]]
[ l4proto %d [l4proto-mask %x]]
[ src-port %d [src-port-mask %x]]
[ dst-port %d [dst-port-mask %x]]
[ spi %d [spi-mask %x]]
[ vlan-etype %x [vlan-etype-mask %x]]
[ vlan %x [vlan-mask %x]]
[ user-def %x [user-def-mask %x]]
[ action %d ]
[ loc %d]
flow-type tcp4|udp4|sctp4
[ src-ip %d.%d.%d.%d [src-ip-mask %d.%d.%d.%d]]
[ dst-ip %d.%d.%d.%d [dst-ip-mask %d.%d.%d.%d]]
[ tos %d [tos-mask %x]]
[ src-port %d [src-port-mask %x]]
[ dst-port %d [dst-port-mask %x]]
[ vlan-etype %x [vlan-etype-mask %x]]
[ vlan %x [vlan-mask %x]]
[ user-def %x [user-def-mask %x]]
[ action %d ]
[ loc %d]
flow-type ah4|esp4
[ src-ip %d.%d.%d.%d [src-ip-mask %d.%d.%d.%d]]
[ dst-ip %d.%d.%d.%d [dst-ip-mask %d.%d.%d.%d]]
[ tos %d [tos-mask %x]]
[ spi %d [spi-mask %x]]
[ vlan-etype %x [vlan-etype-mask %x]]
[ vlan %x [vlan-mask %x]]
[ user-def %x [user-def-mask %x]]
[ action %d ]
[ loc %d]
As you can see it will be a bit oversized to go through and specify
which flow-type options support what fields. If that is what you want I
can implement it that way but for now I would prefer calling out the
flow-type limitations of the fields in the "DESCRIPTION" portion of the
man page.
>
> Ben.
>
Thanks,
Alex
^ permalink raw reply
* Re: [PATCH] tg3: Convert u32 flag,flg2,flg3 uses to bitmap
From: David Miller @ 2011-04-28 20:42 UTC (permalink / raw)
To: mcarlson; +Cc: joe, mchan, eric.dumazet, netdev
In-Reply-To: <20110427162821.GA9762@mcarlson.broadcom.com>
From: "Matt Carlson" <mcarlson@broadcom.com>
Date: Wed, 27 Apr 2011 09:28:21 -0700
> On Tue, Apr 26, 2011 at 11:12:10AM -0700, Joe Perches wrote:
>> Using a bitmap instead of separate u32 flags allows a consistent, simpler
>> and more extensible mechanism to determine capabilities.
>>
>> Convert bitmasks to enum.
>> Add tg3_flag, tg3_flag_clear and tg3_flag_set.
>> Convert the flag & bitmask tests.
>>
>> Signed-off-by: Joe Perches <joe@perches.com>
>
> I looked through it and didn't see any problems. I've queued
> Michael Chan's suggestion into my queue.
>
> Acked-by: Matt Carlson <mcarlson@broadcom.com>
I've applied Joe's change to net-next-2.6, thanks everyone.
^ permalink raw reply
* Re: [NEXT PATCH 1/3] qlcnic: fix memory leak in qlcnic_blink_led.
From: David Miller @ 2011-04-28 20:44 UTC (permalink / raw)
To: amit.salecha
Cc: netdev, ameen.rahman, anirban.chakraborty, sucheta.chakraborty
In-Reply-To: <1303951426-4341-2-git-send-email-amit.salecha@qlogic.com>
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Wed, 27 Apr 2011 17:43:44 -0700
> From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
>
> o Memory allocated in ETHTOOL_ACTIVE mode, is not getting freed. So,
> in ETHTOOL_ID_INACTIVE mode, return after freeing allocated memory.
> o Using set bit instead of blink_down field, as it is also required
> in internal Loopback test and etc.
>
> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Applied.
^ permalink raw reply
* Re: [NEXT PATCH 2/3] qlcnic: support rcv ring configuration through ethtool
From: David Miller @ 2011-04-28 20:44 UTC (permalink / raw)
To: amit.salecha
Cc: netdev, ameen.rahman, anirban.chakraborty, sucheta.chakraborty
In-Reply-To: <1303951426-4341-3-git-send-email-amit.salecha@qlogic.com>
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Wed, 27 Apr 2011 17:43:45 -0700
> From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
>
> o Support ethtool command ETHTOOL_GCHANNELS and ETHTOOL_SCHANNELS.
> o Number of rcv rings configuration depend upon number of msix vector.
>
> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Please address Ben's feedback and resubmit this.
^ permalink raw reply
* Re: [NEXT PATCH 3/3] qlcnic: Support for GBE port settings
From: David Miller @ 2011-04-28 20:44 UTC (permalink / raw)
To: amit.salecha; +Cc: netdev, ameen.rahman, anirban.chakraborty, sony.chacko
In-Reply-To: <1303951426-4341-4-git-send-email-amit.salecha@qlogic.com>
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Wed, 27 Apr 2011 17:43:46 -0700
> From: Sony Chacko <sony.chacko@qlogic.com>
>
> Enable setting speed and auto negotiation parameters for GbE ports.
> Hardware do not support half duplex setting currently.
>
> o Update driver version to 5.0.17.
>
> Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Please resubmit this when you redo patch #2.
^ permalink raw reply
* Re: linux-next: ibmveth runtime errors
From: David Miller @ 2011-04-28 20:46 UTC (permalink / raw)
To: sfr; +Cc: mirq-linux, linuxppc-dev, netdev, santil, linux-next,
linux-kernel
In-Reply-To: <20110428121124.39c036ff.sfr@canb.auug.org.au>
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 28 Apr 2011 12:11:24 +1000
> From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= <mirq-linux@rere.qmqm.pl>
> Date: Thu, 28 Apr 2011 11:59:15 +1000
> Subject: [PATCH] net: ibmveth: force reconfiguring checksum settings on
> startup
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Commit b9367bf3ee6d ("net: ibmveth: convert to hw_features") accidentally
> removed call to ibmveth_set_csum_offload() in ibmveth_probe(). Put the
> call back where it was, but with additional error checking provided
> by ibmveth_set_features().
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> [sfr: dev -> netdev]
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Applied, thanks everyone.
^ permalink raw reply
* Re: [PATCH] inet: add RCU protection to inet->opt
From: Eric Dumazet @ 2011-04-28 20:49 UTC (permalink / raw)
To: David Miller; +Cc: herbert, netdev
In-Reply-To: <20110428.132032.115947683.davem@davemloft.net>
Le jeudi 28 avril 2011 à 13:20 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 21 Apr 2011 21:45:37 +0200
>
> > [PATCH] inet: add RCU protection to inet->opt
>
> Applied, although I had to add the following build fix to the
> final commit:
>
> diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
> index cc67367..962a607 100644
> --- a/net/l2tp/l2tp_ip.c
> +++ b/net/l2tp/l2tp_ip.c
> @@ -416,7 +416,6 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
> int rc;
> struct l2tp_ip_sock *lsa = l2tp_ip_sk(sk);
> struct inet_sock *inet = inet_sk(sk);
> - struct ip_options *opt = inet->opt;
> struct rtable *rt = NULL;
> int connected = 0;
> __be32 daddr;
> @@ -471,9 +470,14 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
> rt = (struct rtable *) __sk_dst_check(sk, 0);
>
> if (rt == NULL) {
> + struct ip_options_rcu *inet_opt;
> +
> + inet_opt = rcu_dereference_protected(inet->inet_opt,
> + sock_owned_by_user(sk));
> +
> /* Use correct destination address if we have options. */
> - if (opt && opt->srr)
> - daddr = opt->faddr;
> + if (inet_opt && inet_opt->opt.srr)
> + daddr = inet_opt->opt.faddr;
>
> /* If this fails, retransmit mechanism of transport layer will
> * keep trying until route appears or the connection times
Gah... I wonder how I missed it.
Are you sure socket is locked at this point ? ( by a priori call to
lock_sock())
Thanks !
^ permalink raw reply
* Re: [PATCH] inet: add RCU protection to inet->opt
From: David Miller @ 2011-04-28 20:52 UTC (permalink / raw)
To: eric.dumazet; +Cc: herbert, netdev
In-Reply-To: <1304023759.2954.8.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 28 Apr 2011 22:49:19 +0200
> Are you sure socket is locked at this point ? ( by a priori call to
> lock_sock())
Ugh, it's not, I'll commit this fix which is safe because we're only
peeking at inet_opt to fetch the faddr value then we never reference
it again:
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 962a607..e13c166 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -472,13 +472,15 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
if (rt == NULL) {
struct ip_options_rcu *inet_opt;
- inet_opt = rcu_dereference_protected(inet->inet_opt,
- sock_owned_by_user(sk));
+ rcu_read_lock();
+ inet_opt = rcu_dereference(inet->inet_opt);
/* Use correct destination address if we have options. */
if (inet_opt && inet_opt->opt.srr)
daddr = inet_opt->opt.faddr;
+ rcu_read_unlock();
+
/* If this fails, retransmit mechanism of transport layer will
* keep trying until route appears or the connection times
* itself out.
^ permalink raw reply related
* Re: [PATCH] inet: add RCU protection to inet->opt
From: Eric Dumazet @ 2011-04-28 20:55 UTC (permalink / raw)
To: David Miller; +Cc: herbert, netdev
In-Reply-To: <20110428.135226.242113407.davem@davemloft.net>
Le jeudi 28 avril 2011 à 13:52 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 28 Apr 2011 22:49:19 +0200
>
> > Are you sure socket is locked at this point ? ( by a priori call to
> > lock_sock())
>
> Ugh, it's not, I'll commit this fix which is safe because we're only
> peeking at inet_opt to fetch the faddr value then we never reference
> it again:
>
> diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
> index 962a607..e13c166 100644
> --- a/net/l2tp/l2tp_ip.c
> +++ b/net/l2tp/l2tp_ip.c
> @@ -472,13 +472,15 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
> if (rt == NULL) {
> struct ip_options_rcu *inet_opt;
>
> - inet_opt = rcu_dereference_protected(inet->inet_opt,
> - sock_owned_by_user(sk));
> + rcu_read_lock();
> + inet_opt = rcu_dereference(inet->inet_opt);
>
> /* Use correct destination address if we have options. */
> if (inet_opt && inet_opt->opt.srr)
> daddr = inet_opt->opt.faddr;
>
> + rcu_read_unlock();
> +
> /* If this fails, retransmit mechanism of transport layer will
> * keep trying until route appears or the connection times
> * itself out.
Thats perfect, thanks !
^ permalink raw reply
* [PATCH] tg3: Fix failure to enable WoL by default when possible
From: Rafael J. Wysocki @ 2011-04-28 21:02 UTC (permalink / raw)
To: netdev; +Cc: LKML, Matt Carlson, Michael Chan, David Miller
From: Rafael J. Wysocki <rjw@sisk.pl>
tg3 is supposed to enable WoL by default on adapters which support
that, but it fails to do so unless the adapter's
/sys/devices/.../power/wakeup file contains 'enabled' during the
initialization of the adapter. Fix that by making tg3 use
device_set_wakeup_enable() to enable wakeup automatically whenever
WoL should be enabled by default.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/net/tg3.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: linux-2.6/drivers/net/tg3.c
===================================================================
--- linux-2.6.orig/drivers/net/tg3.c
+++ linux-2.6/drivers/net/tg3.c
@@ -12327,8 +12327,10 @@ static void __devinit tg3_get_eeprom_hw_
if (val & VCPU_CFGSHDW_ASPM_DBNC)
tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
- (val & VCPU_CFGSHDW_WOL_MAGPKT))
+ (val & VCPU_CFGSHDW_WOL_MAGPKT)) {
tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+ device_set_wakeup_enable(&tp->pdev->dev, true);
+ }
goto done;
}
@@ -12461,8 +12463,10 @@ static void __devinit tg3_get_eeprom_hw_
tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) &&
- (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE))
+ (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)) {
tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+ device_set_wakeup_enable(&tp->pdev->dev, true);
+ }
if (cfg2 & (1 << 17))
tp->phy_flags |= TG3_PHYFLG_CAPACITIVE_COUPLING;
^ permalink raw reply
* RE: [NEXT PATCH 2/3] qlcnic: support rcv ring configuration through ethtool
From: Amit Salecha @ 2011-04-28 21:05 UTC (permalink / raw)
To: Ben Hutchings
Cc: David Miller, netdev, Ameen Rahman, Anirban Chakraborty,
Sucheta Chakraborty
In-Reply-To: <1303948962.2875.178.camel@bwh-desktop>
> From: Ben Hutchings [mailto:bhutchings@solarflare.com]
> Sent: Wednesday, April 27, 2011 5:03 PM
> To: Amit Salecha
> Cc: David Miller; netdev; Ameen Rahman; Anirban Chakraborty; Sucheta
> Chakraborty
> Subject: Re: [NEXT PATCH 2/3] qlcnic: support rcv ring configuration
> through ethtool
>
> > + if (channel->other_count || channel->combined_count)
> > + return -EOPNOTSUPP;
>
> Should be -EINVAL.
>
> > + if (channel->tx_count &&
> > + (channel->tx_count != QLCNIC_MIN_NUM_TX_DESC_RINGS)) {
> > + netdev_info(dev, "valid value for tx_count 0x%x\n",
> > + QLCNIC_MIN_NUM_TX_DESC_RINGS);
> > + return -EINVAL;
> > + }
> [...]
>
> If tx_count cannot be changed, why does qlcnic_get_channels() set
> tx_count and max_tx to different values?
>
Internally both are same values. But I will resubmit the patch to reduce this ambiguity.
> Also I don't think you should treat tx_count == 0 as a special case; it
> should be rejected as invalid.
>
Will fix this.
^ permalink raw reply
* Re: [PATCHv3 3/7] ethtool: Use the full 32 bit speed range in ethtool's set_settings
From: David Dillow @ 2011-04-28 21:14 UTC (permalink / raw)
To: David Decotigny; +Cc: David S. Miller, Ben Hutchings, linux-kernel, netdev
In-Reply-To: <1303954043-17440-4-git-send-email-decot@google.com>
On Wed, 2011-04-27 at 18:27 -0700, David Decotigny wrote:
> This makes sure the ethtool's set_settings() callback of network
> drivers don't ignore the 16 most significant bits when ethtool calls
> their set_settings().
>
> All drivers compiled with make allyesconfig on x86_64 have been
> updated.
>
> Tested: make allyesconfig compiles + e1000e and bnx2x work
> Signed-off-by: David Decotigny <decot@google.com>
For what it's worth, the typhoon changes are
Acked-by: David Dillow <dave@thedillows.org>
^ permalink raw reply
* Re: Maximum no of bytes Ethernet can transfer at a time ??
From: Rick Jones @ 2011-04-28 21:24 UTC (permalink / raw)
To: Ajit; +Cc: netdev
In-Reply-To: <loom.20110428T083015-693@post.gmane.org>
> I tried out something as you said.
>
> I introduces this lines in my code,
>
> getsockopt(s,SOL_SOCKET,SO_RCVBUF,&optval,&optlen);
> printf("The value of optlen is %d\n",optlen);
>
> It always displays 4.
Because the length of the optval is always 4 when retrieving the
SO_RCVBUF setting. You want to print the value of optval.
rick jones
^ permalink raw reply
* [PATCHv2 NEXT 0/2]qlcnic: updates
From: Amit Kumar Salecha @ 2011-04-28 22:33 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty
Hi
Series of 2 reworked patch, incorporating Ben's comment.
Apply to net-next tree.
Thanks
-Amit
^ permalink raw reply
* [PATCHv2 NEXT 2/2] qlcnic: Support for GBE port settings
From: Amit Kumar Salecha @ 2011-04-28 22:33 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Sony Chacko
In-Reply-To: <1304029988-18936-1-git-send-email-amit.salecha@qlogic.com>
From: Sony Chacko <sony.chacko@qlogic.com>
Enable setting speed and auto negotiation parameters for GbE ports.
Hardware do not support half duplex setting currently.
o Update driver version to 5.0.17.
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 9 ++--
drivers/net/qlcnic/qlcnic_ctx.c | 26 ++-----------
drivers/net/qlcnic/qlcnic_ethtool.c | 72 ++++++++++++++++-------------------
3 files changed, 42 insertions(+), 65 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 1934ed9..f729363 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -36,8 +36,8 @@
#define _QLCNIC_LINUX_MAJOR 5
#define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 16
-#define QLCNIC_LINUX_VERSIONID "5.0.16"
+#define _QLCNIC_LINUX_SUBVERSION 17
+#define QLCNIC_LINUX_VERSIONID "5.0.17"
#define QLCNIC_DRV_IDC_VER 0x01
#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
(_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
@@ -573,8 +573,10 @@ struct qlcnic_recv_context {
#define QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH 0x00000028
#define QLCNIC_CDRP_CMD_GET_ESWITCH_PORT_CONFIG 0x00000029
#define QLCNIC_CDRP_CMD_GET_ESWITCH_STATS 0x0000002a
+#define QLCNIC_CDRP_CMD_CONFIG_PORT 0x0000002E
#define QLCNIC_RCODE_SUCCESS 0
+#define QLCNIC_RCODE_NOT_SUPPORTED 9
#define QLCNIC_RCODE_TIMEOUT 17
#define QLCNIC_DESTROY_CTX_RESET 0
@@ -1155,8 +1157,7 @@ struct qlcnic_esw_statistics {
struct __qlcnic_esw_statistics tx;
};
-int qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val);
-int qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val);
+int qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config);
u32 qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off);
int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *, ulong off, u32 data);
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index 050fa5a..3a99886 100644
--- a/drivers/net/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/qlcnic/qlcnic_ctx.c
@@ -359,33 +359,15 @@ qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter)
}
int
-qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val)
-{
-
- if (qlcnic_issue_cmd(adapter,
- adapter->ahw->pci_func,
- adapter->fw_hal_version,
- reg,
- 0,
- 0,
- QLCNIC_CDRP_CMD_READ_PHY)) {
-
- return -EIO;
- }
-
- return QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
-}
-
-int
-qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val)
+qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config)
{
return qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
- reg,
- val,
+ config,
+ 0,
0,
- QLCNIC_CDRP_CMD_WRITE_PHY);
+ QLCNIC_CDRP_CMD_CONFIG_PORT);
}
int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter)
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 8db1d19..27726eb 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -284,50 +284,44 @@ skip:
static int
qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
+ u32 config = 0;
+ u32 ret = 0;
struct qlcnic_adapter *adapter = netdev_priv(dev);
- __u32 status;
+
+ if (adapter->ahw->port_type != QLCNIC_GBE)
+ return -EOPNOTSUPP;
/* read which mode */
- if (adapter->ahw->port_type == QLCNIC_GBE) {
- /* autonegotiation */
- if (qlcnic_fw_cmd_set_phy(adapter,
- QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG,
- ecmd->autoneg) != 0)
- return -EIO;
- else
- adapter->link_autoneg = ecmd->autoneg;
+ if (ecmd->duplex)
+ config |= 0x1;
- if (qlcnic_fw_cmd_query_phy(adapter,
- QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
- &status) != 0)
- return -EIO;
+ if (ecmd->autoneg)
+ config |= 0x2;
- switch (ecmd->speed) {
- case SPEED_10:
- qlcnic_set_phy_speed(status, 0);
- break;
- case SPEED_100:
- qlcnic_set_phy_speed(status, 1);
- break;
- case SPEED_1000:
- qlcnic_set_phy_speed(status, 2);
- break;
- }
+ switch (ethtool_cmd_speed(ecmd)) {
+ case SPEED_10:
+ config |= (0 << 8);
+ break;
+ case SPEED_100:
+ config |= (1 << 8);
+ break;
+ case SPEED_1000:
+ config |= (10 << 8);
+ break;
+ default:
+ return -EIO;
+ }
- if (ecmd->duplex == DUPLEX_HALF)
- qlcnic_clear_phy_duplex(status);
- if (ecmd->duplex == DUPLEX_FULL)
- qlcnic_set_phy_duplex(status);
- if (qlcnic_fw_cmd_set_phy(adapter,
- QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
- *((int *)&status)) != 0)
- return -EIO;
- else {
- adapter->link_speed = ecmd->speed;
- adapter->link_duplex = ecmd->duplex;
- }
- } else
+ ret = qlcnic_fw_cmd_set_port(adapter, config);
+
+ if (ret == QLCNIC_RCODE_NOT_SUPPORTED)
return -EOPNOTSUPP;
+ else if (ret)
+ return -EIO;
+
+ adapter->link_speed = ethtool_cmd_speed(ecmd);
+ adapter->link_duplex = ecmd->duplex;
+ adapter->link_autoneg = ecmd->autoneg;
if (!netif_running(dev))
return 0;
--
1.7.3.3
^ permalink raw reply related
* [PATCHv3 NEXT 1/2] qlcnic: support rcv ring configuration through ethtool
From: amit.salecha @ 2011-04-28 21:48 UTC (permalink / raw)
To: davem
Cc: netdev, ameen.rahman, anirban.chakraborty, Sucheta Chakraborty,
Amit Kumar Salecha
In-Reply-To: <1304027299-1960-1-git-send-email-amit.salecha@qlogic.com>
From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
o Support ethtool command ETHTOOL_GCHANNELS and ETHTOOL_SCHANNELS.
o Number of rcv rings configuration depend upon number of msix vector.
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 8 +-
drivers/net/qlcnic/qlcnic_ethtool.c | 35 ++++++++
drivers/net/qlcnic/qlcnic_main.c | 146 +++++++++++++++++++++++++++-------
3 files changed, 156 insertions(+), 33 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index f7acb80..1934ed9 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -118,7 +118,6 @@
#define PHAN_PEG_RCV_INITIALIZED 0xff01
#define NUM_RCV_DESC_RINGS 3
-#define NUM_STS_DESC_RINGS 4
#define RCV_RING_NORMAL 0
#define RCV_RING_JUMBO 1
@@ -871,7 +870,8 @@ struct qlcnic_ipaddr {
#define QLCNIC_IS_MSI_FAMILY(adapter) \
((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
-#define MSIX_ENTRIES_PER_ADAPTER NUM_STS_DESC_RINGS
+#define QLCNIC_DEF_NUM_STS_DESC_RINGS 4
+#define QLCNIC_MIN_NUM_RSS_RINGS 2
#define QLCNIC_MSIX_TBL_SPACE 8192
#define QLCNIC_PCI_REG_MSIX_TBL 0x44
#define QLCNIC_MSIX_TBL_PGSIZE 4096
@@ -987,7 +987,7 @@ struct qlcnic_adapter {
void __iomem *crb_int_state_reg;
void __iomem *isr_int_vec;
- struct msix_entry msix_entries[MSIX_ENTRIES_PER_ADAPTER];
+ struct msix_entry *msix_entries;
struct delayed_work fw_work;
@@ -1262,6 +1262,8 @@ u32 qlcnic_issue_cmd(struct qlcnic_adapter *adapter,
void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings);
int qlcnic_diag_alloc_res(struct net_device *netdev, int test);
netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
+int qlcnic_validate_max_rss(struct net_device *netdev, u8 max_hw, u8 val);
+int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data);
/* Management functions */
int qlcnic_get_mac_address(struct qlcnic_adapter *, u8*);
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index de65847..8db1d19 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -474,6 +474,39 @@ qlcnic_set_ringparam(struct net_device *dev,
return qlcnic_reset_context(adapter);
}
+static void qlcnic_get_channels(struct net_device *dev,
+ struct ethtool_channels *channel)
+{
+ struct qlcnic_adapter *adapter = netdev_priv(dev);
+
+ channel->max_rx = rounddown_pow_of_two(min_t(int,
+ adapter->max_rx_ques, num_online_cpus()));
+ channel->max_tx = adapter->max_tx_ques;
+
+ channel->rx_count = adapter->max_sds_rings;
+ channel->tx_count = adapter->max_tx_ques;
+}
+
+static int qlcnic_set_channels(struct net_device *dev,
+ struct ethtool_channels *channel)
+{
+ struct qlcnic_adapter *adapter = netdev_priv(dev);
+ int err;
+
+ if (channel->other_count || channel->combined_count ||
+ channel->tx_count != channel->max_tx)
+ return -EINVAL;
+
+ err = qlcnic_validate_max_rss(dev, channel->max_rx, channel->rx_count);
+ if (err)
+ return err;
+
+ err = qlcnic_set_max_rss(adapter, channel->rx_count);
+ netdev_info(dev, "allocated 0x%x sds rings\n",
+ adapter->max_sds_rings);
+ return err;
+}
+
static void
qlcnic_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause)
@@ -949,6 +982,8 @@ const struct ethtool_ops qlcnic_ethtool_ops = {
.get_eeprom = qlcnic_get_eeprom,
.get_ringparam = qlcnic_get_ringparam,
.set_ringparam = qlcnic_set_ringparam,
+ .get_channels = qlcnic_get_channels,
+ .set_channels = qlcnic_set_channels,
.get_pauseparam = qlcnic_get_pauseparam,
.set_pauseparam = qlcnic_set_pauseparam,
.get_wol = qlcnic_get_wol,
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 6e61951..d6cc4d4 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -18,6 +18,7 @@
#include <linux/inetdevice.h>
#include <linux/sysfs.h>
#include <linux/aer.h>
+#include <linux/log2.h>
MODULE_DESCRIPTION("QLogic 1/10 GbE Converged/Intelligent Ethernet Driver");
MODULE_LICENSE("GPL");
@@ -350,39 +351,17 @@ static struct qlcnic_nic_template qlcnic_vf_ops = {
.start_firmware = qlcnicvf_start_firmware
};
-static void
-qlcnic_setup_intr(struct qlcnic_adapter *adapter)
+static int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix)
{
- const struct qlcnic_legacy_intr_set *legacy_intrp;
struct pci_dev *pdev = adapter->pdev;
- int err, num_msix;
-
- if (adapter->msix_supported) {
- num_msix = (num_online_cpus() >= MSIX_ENTRIES_PER_ADAPTER) ?
- MSIX_ENTRIES_PER_ADAPTER : 2;
- } else
- num_msix = 1;
+ int err = -1;
adapter->max_sds_rings = 1;
-
adapter->flags &= ~(QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED);
-
- legacy_intrp = &legacy_intr[adapter->ahw->pci_func];
-
- adapter->int_vec_bit = legacy_intrp->int_vec_bit;
- adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter,
- legacy_intrp->tgt_status_reg);
- adapter->tgt_mask_reg = qlcnic_get_ioaddr(adapter,
- legacy_intrp->tgt_mask_reg);
- adapter->isr_int_vec = qlcnic_get_ioaddr(adapter, ISR_INT_VECTOR);
-
- adapter->crb_int_state_reg = qlcnic_get_ioaddr(adapter,
- ISR_INT_STATE_REG);
-
qlcnic_set_msix_bit(pdev, 0);
if (adapter->msix_supported) {
-
+ enable_msix:
qlcnic_init_msix_entries(adapter, num_msix);
err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
if (err == 0) {
@@ -392,14 +371,22 @@ qlcnic_setup_intr(struct qlcnic_adapter *adapter)
adapter->max_sds_rings = num_msix;
dev_info(&pdev->dev, "using msi-x interrupts\n");
- return;
+ return err;
}
+ if (err > 0) {
+ num_msix = rounddown_pow_of_two(err);
+ if (num_msix)
+ goto enable_msix;
+ }
+ }
+ return err;
+}
- if (err > 0)
- pci_disable_msix(pdev);
- /* fall through for msi */
- }
+static void qlcnic_enable_msi_legacy(struct qlcnic_adapter *adapter)
+{
+ const struct qlcnic_legacy_intr_set *legacy_intrp;
+ struct pci_dev *pdev = adapter->pdev;
if (use_msi && !pci_enable_msi(pdev)) {
adapter->flags |= QLCNIC_MSI_ENABLED;
@@ -410,11 +397,41 @@ qlcnic_setup_intr(struct qlcnic_adapter *adapter)
return;
}
+ legacy_intrp = &legacy_intr[adapter->ahw->pci_func];
+
+ adapter->int_vec_bit = legacy_intrp->int_vec_bit;
+ adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter,
+ legacy_intrp->tgt_status_reg);
+ adapter->tgt_mask_reg = qlcnic_get_ioaddr(adapter,
+ legacy_intrp->tgt_mask_reg);
+ adapter->isr_int_vec = qlcnic_get_ioaddr(adapter, ISR_INT_VECTOR);
+
+ adapter->crb_int_state_reg = qlcnic_get_ioaddr(adapter,
+ ISR_INT_STATE_REG);
dev_info(&pdev->dev, "using legacy interrupts\n");
adapter->msix_entries[0].vector = pdev->irq;
}
static void
+qlcnic_setup_intr(struct qlcnic_adapter *adapter)
+{
+ int num_msix;
+
+ if (adapter->msix_supported) {
+ num_msix = (num_online_cpus() >=
+ QLCNIC_DEF_NUM_STS_DESC_RINGS) ?
+ QLCNIC_DEF_NUM_STS_DESC_RINGS :
+ QLCNIC_MIN_NUM_RSS_RINGS;
+ } else
+ num_msix = 1;
+
+ if (!qlcnic_enable_msix(adapter, num_msix))
+ return;
+
+ qlcnic_enable_msi_legacy(adapter);
+}
+
+static void
qlcnic_teardown_intr(struct qlcnic_adapter *adapter)
{
if (adapter->flags & QLCNIC_MSIX_ENABLED)
@@ -1493,6 +1510,19 @@ static int qlcnic_set_dma_mask(struct pci_dev *pdev, u8 *pci_using_dac)
return 0;
}
+static int
+qlcnic_alloc_msix_entries(struct qlcnic_adapter *adapter, u16 count)
+{
+ adapter->msix_entries = kcalloc(count, sizeof(struct msix_entry),
+ GFP_KERNEL);
+
+ if (adapter->msix_entries)
+ return 0;
+
+ dev_err(&adapter->pdev->dev, "failed allocating msix_entries\n");
+ return -ENOMEM;
+}
+
static int __devinit
qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
@@ -1587,6 +1617,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
qlcnic_clear_stats(adapter);
+ err = qlcnic_alloc_msix_entries(adapter, adapter->max_rx_ques);
+ if (err)
+ goto err_out_decr_ref;
+
qlcnic_setup_intr(adapter);
err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac);
@@ -1615,6 +1649,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_disable_msi:
qlcnic_teardown_intr(adapter);
+ kfree(adapter->msix_entries);
err_out_decr_ref:
qlcnic_clr_all_drv_state(adapter, 0);
@@ -1666,6 +1701,7 @@ static void __devexit qlcnic_remove(struct pci_dev *pdev)
qlcnic_free_lb_filters_mem(adapter);
qlcnic_teardown_intr(adapter);
+ kfree(adapter->msix_entries);
qlcnic_remove_diag_entries(adapter);
@@ -3299,6 +3335,56 @@ static struct device_attribute dev_attr_diag_mode = {
.store = qlcnic_store_diag_mode,
};
+int qlcnic_validate_max_rss(struct net_device *netdev, u8 max_hw, u8 val)
+{
+ if (!use_msi_x && !use_msi) {
+ netdev_info(netdev, "no msix or msi support, hence no rss\n");
+ return -EINVAL;
+ }
+
+ if ((val > max_hw) || (val < 2) || !is_power_of_2(val)) {
+ netdev_info(netdev, "rss_ring valid range [2 - %x] in "
+ " powers of 2\n", max_hw);
+ return -EINVAL;
+ }
+ return 0;
+
+}
+
+int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data)
+{
+ struct net_device *netdev = adapter->netdev;
+ int err = 0;
+
+ if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state))
+ return -EBUSY;
+
+ netif_device_detach(netdev);
+ if (netif_running(netdev))
+ __qlcnic_down(adapter, netdev);
+ qlcnic_detach(adapter);
+ qlcnic_teardown_intr(adapter);
+
+ if (qlcnic_enable_msix(adapter, data)) {
+ netdev_info(netdev, "failed setting max_rss; rss disabled\n");
+ qlcnic_enable_msi_legacy(adapter);
+ }
+
+ if (netif_running(netdev)) {
+ err = qlcnic_attach(adapter);
+ if (err)
+ goto done;
+ err = __qlcnic_up(adapter, netdev);
+ if (err)
+ goto done;
+ qlcnic_restore_indev_addr(netdev, NETDEV_UP);
+ }
+ done:
+ netif_device_attach(netdev);
+ clear_bit(__QLCNIC_RESETTING, &adapter->state);
+ return err;
+}
+
static int
qlcnic_sysfs_validate_crb(struct qlcnic_adapter *adapter,
loff_t offset, size_t size)
--
1.6.3.3
^ permalink raw reply related
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