* Re: [PATCH net 0/4] bridge: Fix problems around the PVID
From: Toshiaki Makita @ 2013-09-30 11:46 UTC (permalink / raw)
To: vyasevic
Cc: Toshiaki Makita, David Miller, netdev, Fernando Luis Vazquez Cao,
Patrick McHardy
In-Reply-To: <5245C9FB.90307@redhat.com>
On Fri, 2013-09-27 at 14:10 -0400, Vlad Yasevich wrote:
> On 09/27/2013 01:11 PM, Toshiaki Makita wrote:
> > On Thu, 2013-09-26 at 10:22 -0400, Vlad Yasevich wrote:
> >> On 09/26/2013 06:38 AM, Toshiaki Makita wrote:
> >>> On Tue, 2013-09-24 at 13:55 -0400, Vlad Yasevich wrote:
> >>>> On 09/24/2013 01:30 PM, Toshiaki Makita wrote:
> >>>>> On Tue, 2013-09-24 at 09:35 -0400, Vlad Yasevich wrote:
> >>>>>> On 09/24/2013 07:45 AM, Toshiaki Makita wrote:
> >>>>>>> On Mon, 2013-09-23 at 10:41 -0400, Vlad Yasevich wrote:
> >>>>>>>> On 09/17/2013 04:12 AM, Toshiaki Makita wrote:
> >>>>>>>>> On Mon, 2013-09-16 at 13:49 -0400, Vlad Yasevich wrote:
> >>>>>>>>>> On 09/13/2013 08:06 AM, Toshiaki Makita wrote:
> >>>>>>>>>>> On Thu, 2013-09-12 at 16:00 -0400, David Miller wrote:
> >>>>>>>>>>>> From: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
> >>>>>>>>>>>> Date: Tue, 10 Sep 2013 19:27:54 +0900
> >>>>>>>>>>>>
> >>>>>>>>>>>>> There seem to be some undesirable behaviors related with PVID.
> >>>>>>>>>>>>> 1. It has no effect assigning PVID to a port. PVID cannot be applied
> >>>>>>>>>>>>> to any frame regardless of whether we set it or not.
> >>>>>>>>>>>>> 2. FDB entries learned via frames applied PVID are registered with
> >>>>>>>>>>>>> VID 0 rather than VID value of PVID.
> >>>>>>>>>>>>> 3. We can set 0 or 4095 as a PVID that are not allowed in IEEE 802.1Q.
> >>>>>>>>>>>>> This leads interoperational problems such as sending frames with VID
> >>>>>>>>>>>>> 4095, which is not allowed in IEEE 802.1Q, and treating frames with VID
> >>>>>>>>>>>>> 0 as they belong to VLAN 0, which is expected to be handled as they have
> >>>>>>>>>>>>> no VID according to IEEE 802.1Q.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Note: 2nd and 3rd problems are potential and not exposed unless 1st problem
> >>>>>>>>>>>>> is fixed, because we cannot activate PVID due to it.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Please work out the issues in patch #2 with Vlad and resubmit this
> >>>>>>>>>>>> series.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Thank you.
> >>>>>>>>>>>
> >>>>>>>>>>> I'm hovering between whether we should fix the issue by changing vlan 0
> >>>>>>>>>>> interface behavior in 8021q module or enabling a bridge port to sending
> >>>>>>>>>>> priority-tagged frames, or another better way.
> >>>>>>>>>>>
> >>>>>>>>>>> If you could comment it, I'd appreciate it :)
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> BTW, I think what is discussed in patch #2 is another problem about
> >>>>>>>>>>> handling priority-tags, and it exists without this patch set applied.
> >>>>>>>>>>> It looks like that we should prepare another patch set than this to fix
> >>>>>>>>>>> that problem.
> >>>>>>>>>>>
> >>>>>>>>>>> Should I include patches that fix the priority-tags problem in this
> >>>>>>>>>>> patch set and resubmit them all together?
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> I am thinking that we might need to do it in bridge and it looks like
> >>>>>>>>>> the simplest way to do it is to have default priority regeneration table
> >>>>>>>>>> (table 6-5 from 802.1Q doc).
> >>>>>>>>>>
> >>>>>>>>>> That way I think we would conform to the spec.
> >>>>>>>>>>
> >>>>>>>>>> -vlad
> >>>>>>>>>
> >>>>>>>>> Unfortunately I don't think the default priority regeneration table
> >>>>>>>>> resolves the problem because IEEE 802.1Q says that a VLAN-aware bridge
> >>>>>>>>> can transmit untagged or VLAN-tagged frames only (the end of section 7.5
> >>>>>>>>> and 8.1.7).
> >>>>>>>>>
> >>>>>>>>> No mechanism to send priority-tagged frames is found as far as I can see
> >>>>>>>>> the standard. I think the regenerated priority is used for outgoing PCP
> >>>>>>>>> field only if egress policy is not untagged (i.e. transmitting as
> >>>>>>>>> VLAN-tagged), and unused if untagged (Section 6.9.2 3rd/4th Paragraph).
> >>>>>>>>>
> >>>>>>>>> If we want to transmit priority-tagged frames from a bridge port, I
> >>>>>>>>> think we need to implement a new (optional) feature that is above the
> >>>>>>>>> standard, as I stated previously.
> >>>>>>>>>
> >>>>>>>>> How do you feel about adding a per-port policy that enables a bridge to
> >>>>>>>>> send priority-tagged frames instead of untagged frames when egress
> >>>>>>>>> policy for the port is untagged?
> >>>>>>>>> With this change, we can transmit frames for a given vlan as either all
> >>>>>>>>> untagged, all priority-tagged or all VLAN-tagged.
> >>>>>>>>
> >>>>>>>> That would work. What I am thinking is that we do it by special casing
> >>>>>>>> the vid 0 egress policy specification. Let it be untagged by default
> >>>>>>>> and if it is tagged, then we preserve the priority field and forward
> >>>>>>>> it on.
> >>>>>>>>
> >>>>>>>> This keeps the API stable and doesn't require user/admin from knowing
> >>>>>>>> exactly what happens. Default operation conforms to the spec and allows
> >>>>>>>> simple change to make it backward-compatible.
> >>>>>>>>
> >>>>>>>> What do you think. I've done a simple prototype of this an it seems to
> >>>>>>>> work with the VMs I am testing with.
> >>>>>>>
> >>>>>>> Are you saying that
> >>>>>>> - by default, set the 0th bit of untagged_bitmap; and
> >>>>>>> - if we unset the 0th bit and set the "vid"th bit, we transmit frames
> >>>>>>> classified as belonging to VLAN "vid" as priority-tagged?
> >>>>>>>
> >>>>>>> If so, though it's attractive to keep current API, I'm worried about if
> >>>>>>> it could be a bit confusing and not intuitive for kernel/iproute2
> >>>>>>> developers that VID 0 has a special meaning only in the egress policy.
> >>>>>>> Wouldn't it be better to adding a new member to struct net_port_vlans
> >>>>>>> instead of using VID 0 of untagged_bitmap?
> >>>>>>>
> >>>>>>> Or are you saying that we use a new flag in struct net_port_vlans but
> >>>>>>> use the BRIDGE_VLAN_INFO_UNTAGGED bit with VID 0 in netlink to set the
> >>>>>>> flag?
> >>>>>>>
> >>>>>>> Even in that case, I'm afraid that it might be confusing for developers
> >>>>>>> for the same reason. We are going to prohibit to specify VID with 0 (and
> >>>>>>> 4095) in adding/deleting a FDB entry or a vlan filtering entry, but it
> >>>>>>> would allow us to use VID 0 only when a vlan filtering entry is
> >>>>>>> configured.
> >>>>>>> I am thinking a new nlattr is a straightforward approach to configure
> >>>>>>> it.
> >>>>>>
> >>>>>> By making this an explicit attribute it makes vid 0 a special case for
> >>>>>> any automatic tool that would provision such filtering. Seeing vid 0
> >>>>>> would mean that these tools would have to know that this would have to
> >>>>>> be translated to a different attribute instead of setting the policy
> >>>>>> values.
> >>>>>
> >>>>> Yes, I agree with you that we can do it by the way you explained.
> >>>>> What I don't understand is the advantage of using vid 0 over another way
> >>>>> such as adding a new nlattr.
> >>>>> I think we can indicate transmitting priority-tags explicitly by such a
> >>>>> nlattr. Using vid 0 seems to be easier to implement than a new nlattr,
> >>>>> but, for me, it looks less intuitive and more difficult to maintain
> >>>>> because we have to care about vid 0 instead of simply ignoring it.
> >>>>>
> >>>>
> >>>> The point I am trying to make is that regardless of the approach someone
> >>>> has to know what to do when enabling priority tagged frames. You
> >>>> proposal would require the administrator or config tool to have that
> >>>> knowledge. Example is:
> >>>> Admin does: bridge vlan set priority on dev eth0
> >>>> Automated app:
> >>>> if (vid == 0)
> >>>> /* Turn on priority tagged frame support */
> >>>>
> >>>> My proposal would require the bridge filtering implementation to have it.
> >>>> user tool: bridge vlan add vid 0 tagged
> >>>> Automated app: No special case.
> >>>>
> >>>> IMO its better to have 1 piece code handling the special case then
> >>>> putting it multiple places.
> >>>
> >>> Thank you for the detailed explanation.
> >>> Now I understand your intention.
> >>>
> >>> I have one question about your proposal.
> >>> I guess the way to enable priority-tagged is something like
> >>> bridge vlan add vid 10 dev eth0
> >>> bridge vlan add vid 10 dev vnet0 pvid untagged
> >>> bridge vlan add vid 0 dev vnet0 tagged
> >>> where vnet0 has sub interface vnet0.0.
> >>>
> >>> Here the admin have to know the egress policy is applied to a frame
> >>> twice in a certain order when it is transmitted from the port vnet0
> >>> attached, that is, first, a frame with vid 10 get untagged, and then, an
> >>> untagged frame get priority-tagged.
> >>>
> >>> This behavior looks difficult to know without previous knowledge.
> >>> Any good idea to avoid such a need for the admin's additional knowledge?
> >>
> >> To me, the fact that there is vnet0.0 (or typically, there is eth0.0 in
> >> the guest or on the remote host) already tells the admin vlan 0 has to
> >> be tagged. The fact that we codify this in the policy makes it explicit.
> >
> > My worry is that the admin might not be able to guess how to use bridge
> > commands to enable priority-tag without any additional hint in "man
> > bridge", "bridge vlan help", etc.
> > I actually couldn't hit upon such a usage before seeing example commands
> > you gave, because I had never think the egress policy could be applied
> > twice.
> >
> >>
> >> However, I can see strong argument to be made for an addition egress
> >> policy attribute that could be for instance:
> >>
> >> bridge vlan add vid 10 dev eth0 pvid
> >> bridge vlan add vid 10 dev vnet0 pvid untagged prio_tag
> >>
> >> But this has the same connotations as wrt to egress policy. The 2
> >> policies are applied:
> >> (1) untag the frame.
> >> (2) add priority_tag.
> >>
> >> (2) only happens if initial fame received on eth0 was priority tagged.
> >
> > If we do so, we will not be able to communicate using vlan 0 interface
> > under a certain circumstance.
> > Eth0 can be receive mixed untagged and priority-tagged frames according
> > to the network element it is connected to: for example, Open vSwitch can
> > send such two kinds of frames from the same port even if original
> > incoming frames belong to the same vlan.
>
> Which priority would you assign to the frame that was received untagged?
Untagged frame's priority is by default 0, so I think 0 is likely.
802.1Q 6.9.1 i)
The received priority value and the drop_eligible parameter value are
the values in the M_UNITDATA.indication.
M_UNITDATA is passed from ISS.
802.1Q 6.7.1
The priority parameter provided in a data indication primitive shall
take the value of the Default User Priority parameter for the Port
through which the MAC frame was received. The default value of this
parameter is 0, it may be set by management in which case the
capability to set it to any of the values 0 through 7 shall be
provided.
>
> > In this situation, we can only receive frames that is priority-tagged
> > when received on eth0.
>
> Not sure I understand. Let's look at this config:
> bridge vlan add vid 10 dev eth0 pvid
> bridge vlan add vid 10 dev vnet0 pvid untagged prio_tag
>
> Here, eth0 is allowed to receive vid 10 tagged, untagged, and
> prio_tagged (if we look at the patch 2 from this set).
> Now, frame is forwarded to vnet0.
> 1) if the frame had vid 10 in the tag or was untagged,
> it should probably be sent untagged.
> 2) if the frame had a priority tag, it should probably
> be sent as such.
>
> Now, I think a case could be made that if the frame had any priority
> markings in the vlan header, we should try to preserve those markings
> if prio_tag is turned on. We can assume value of 0 means not set.
If we don't insert prio_tag when PCP is 0, we might receive mixed
priority-tagged and untagged frames on eth0.
Even if we are sending frames from eth0.0 with some priority other than
0, we could receive frames with priority 0 or untagged on the other side
of the bridge.
For example, if we receive untagged arp reply on the bridge port, we
migit not be able to communicate with such an end station, because
untagged reply will not be passed to eth0.0.
>
> > IMO, if prio_tag is configured, the bridge should send any untagged
> > frame as priority-tagged regardless of whatever it is on eth0.
>
> Which priority would you use, 0? You are not guaranteed to properly
> deliver the traffic then for a configuration such as:
> VM: eth0: 10.0.0.1/24
> eth0.0: 10.0.1.1/24
I'd like to use priority 0 for untagged frames.
I am assuming that one of our goals is at least that eth0.0 comes to be
able to communicate with another end station. It seems to be hard to use
both eth0 and eth0.0 simultaneously.
Thanks,
Toshiaki Makita
>
> -vlad
>
> >
> >>
> >> I think I am ok with either approach. Explicit vid 0 policy is easier
> >> for automatic provisioning. The flag based one is easier for admin/
> >> manual provisioning.
> >
> > Supposing we have to add something to help or man in any case, I think
> > flag based is better.
> > The format below seems to suitable for a per-port policy.
> > bridge vlan set prio_tag on dev vnet0
> >
> > Thanks,
> >
> > Toshiaki Makita
> >
> >>
> >> -vlad.
> >>
> >> -vlad
> >>
> >>
> >>
> >>
> >>>
> >>>>
> >>>> Thanks
> >>>> -vlad
> >>>>
> >>>>> Thanks,
> >>>>>
> >>>>> Toshiaki Makita
> >>>>>
> >>>>>>
> >>>>>> How it is implemented internally in the kernel isn't as big of an issue.
> >>>>>> We can do it as a separate flag or as part of existing policy.
> >>>>>>
> >>>>>> -vlad
> >>>>>>
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>>
> >>>>>>> Toshiaki Makita
> >>>>>>>
> >>>>>>>>
> >>>>>>>> -vlad
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Thanks,
> >>>>>>>>>
> >>>>>>>>> Toshiaki Makita
> >>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> Thanks,
> >>>>>>>>>>>
> >>>>>>>>>>> Toshiaki Makita
> >>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>> --
> >>>>>>>>>>>> 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
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> --
> >>>>>>>>> To unsubscribe from this list: send the line "unsubscribe netdev" in
> >>>>>>>>> the body of a message to majordomo@vger.kernel.org
> >>>>>>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>
> >
> >
^ permalink raw reply
* Re: [PATCH] ipv6: udp packets following an UFO enqueued packet need also be handled by UFO
From: Jiri Pirko @ 2013-09-30 11:43 UTC (permalink / raw)
To: hannes; +Cc: netdev, yoshfuji, davem
In-Reply-To: <20130921042700.GB8070@order.stressinduktion.org>
Sat, Sep 21, 2013 at 06:27:00AM CEST, hannes@stressinduktion.org wrote:
>In the following scenario the socket is corked:
>If the first UDP packet is larger then the mtu we try to append it to the
>write queue via ip6_ufo_append_data. A following packet, which is smaller
>than the mtu would be appended to the already queued up gso-skb via
>plain ip6_append_data. This causes random memory corruptions.
>
>In ip6_ufo_append_data we also have to be careful to not queue up the
>same skb multiple times. So setup the gso frame only when no first skb
>is available.
>
>This also fixes a shortcoming where we add the current packet's length to
>cork->length but return early because of a packet > mtu with dontfrag set
>(instead of sutracting it again).
>
>Found with trinity.
>
>Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
>Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
>---
>
>I could only test this with virtualized UFO enabled network cards. Could
>someone test this on real hardware?
>
> net/ipv6/ip6_output.c | 53 +++++++++++++++++++++------------------------------
> 1 file changed, 22 insertions(+), 31 deletions(-)
>
>diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
>index 3a692d5..a54c45c 100644
>--- a/net/ipv6/ip6_output.c
>+++ b/net/ipv6/ip6_output.c
>@@ -1015,6 +1015,8 @@ static inline int ip6_ufo_append_data(struct sock *sk,
> * udp datagram
> */
> if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) {
>+ struct frag_hdr fhdr;
>+
> skb = sock_alloc_send_skb(sk,
> hh_len + fragheaderlen + transhdrlen + 20,
> (flags & MSG_DONTWAIT), &err);
>@@ -1036,12 +1038,6 @@ static inline int ip6_ufo_append_data(struct sock *sk,
> skb->protocol = htons(ETH_P_IPV6);
> skb->ip_summed = CHECKSUM_PARTIAL;
> skb->csum = 0;
>- }
>-
>- err = skb_append_datato_frags(sk,skb, getfrag, from,
>- (length - transhdrlen));
>- if (!err) {
>- struct frag_hdr fhdr;
>
> /* Specify the length of each IPv6 datagram fragment.
> * It has to be a multiple of 8.
>@@ -1052,15 +1048,10 @@ static inline int ip6_ufo_append_data(struct sock *sk,
> ipv6_select_ident(&fhdr, rt);
> skb_shinfo(skb)->ip6_frag_id = fhdr.identification;
> __skb_queue_tail(&sk->sk_write_queue, skb);
>-
>- return 0;
> }
>- /* There is not enough support do UPD LSO,
>- * so follow normal path
>- */
>- kfree_skb(skb);
>
>- return err;
>+ return skb_append_datato_frags(sk, skb, getfrag, from,
>+ (length - transhdrlen));
> }
>
What if non-ufo-path-created skb is peeked?
^ permalink raw reply
* RE: Question regarding failure utilizing bonding mode 5 (balance-tlb)
From: Yuval Mintz @ 2013-09-30 11:30 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: netdev@vger.kernel.org, Ariel Elior
In-Reply-To: <979A8436335E3744ADCD3A9F2A2B68A52ACF96BB@SJEXCHMB10.corp.ad.broadcom.com>
> > >Again, I think the permanent address is restored only when the bond
> > >releases the slave, which I don't think happens when the slave is unloaded.
> >
> > Ah, ok, I was understanding "unloaded" to mean "remove from the
> > bond." I think you actually mean "set administratively down," e.g., "ip
> > link set dev slave down" or the like. I don't think mere loss of
> > carrier would trigger the sequence of events, because that won't go
> > through a dev_close / dev_open cycle.
> >
> > Doing that (an admin down / up bounce) would, indeed, cause a
> > failover, but the bond will not reprogram the MAC on the slave (it
> > presumes that a fail / recovery will not disrupt the MAC address, which
> > is apparently not true in this instance).
> >
> > I'll have to look at the code a bit, but for now can you confirm
> > that what you actually mean is, essentially:
> >
> > Given a bond0 with two slaves, eth0 and eth1, in tlb mode, eth0
> > being the active,
> >
> > 1) "ip link set dev eth0 down" which will fail over to eth1
> > (swapping the contents of their dev_addr fields).
> >
> > 2) "ip link set dev eth0 up" eth0 comes back up, reprograms its
> > MAC to the wrong thing (what was in dev_addr).
> >
> > 3) repeat steps 1 and 2 for eth1
> >
> > Is this correct?
> >
>
> Yes, sorry for the earlier confusion.
> I think in the case described `alb_swap_mac_addr()' will be called,
> replacing eth0 and eth1's dev_addr, causing eth0 to have dev_addr
> which defers from the bond device's. Once eth0 reloads, it will use
> the different MAC address for configuring FW/HW.
Hi,
Did you by any chance had the time to look at this issue?
Thanks,
Yuval
^ permalink raw reply
* linux-next: manual merge of the net-next tree
From: Thierry Reding @ 2013-09-30 11:26 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-next, linux-kernel
In-Reply-To: <1380540373-25352-1-git-send-email-treding@nvidia.com>
Today's linux-next merge of the net-next tree got conflicts in
arch/h8300/include/uapi/asm/socket.h
drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
include/net/secure_seq.h
I removed the h8300 file and I fixed up the other two (see below). Please
check if the resolution looks correct.
Thanks,
Thierry
---
diff --cc drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
index 74156f8,5bc0276..7f1340d
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
@@@ -132,35 -132,33 +132,34 @@@ struct pktq *brcmf_bus_gettxq(struct br
* interface functions from common layer
*/
- extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
- struct sk_buff *pkt, int prec);
+ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, struct sk_buff *pkt,
+ int prec);
/* Receive frame for delivery to OS. Callee disposes of rxp. */
- extern void brcmf_rx_frames(struct device *dev, struct sk_buff_head *rxlist);
+ void brcmf_rx_frames(struct device *dev, struct sk_buff_head *rxlist);
/* Indication from bus module regarding presence/insertion of dongle. */
- extern int brcmf_attach(uint bus_hdrlen, struct device *dev);
+ int brcmf_attach(uint bus_hdrlen, struct device *dev);
/* Indication from bus module regarding removal/absence of dongle */
- extern void brcmf_detach(struct device *dev);
+ void brcmf_detach(struct device *dev);
/* Indication from bus module that dongle should be reset */
- extern void brcmf_dev_reset(struct device *dev);
+ void brcmf_dev_reset(struct device *dev);
/* Indication from bus module to change flow-control state */
- extern void brcmf_txflowblock(struct device *dev, bool state);
+ void brcmf_txflowblock(struct device *dev, bool state);
/* Notify the bus has transferred the tx packet to firmware */
- extern void brcmf_txcomplete(struct device *dev, struct sk_buff *txp,
- bool success);
+ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
- extern int brcmf_bus_start(struct device *dev);
+ int brcmf_bus_start(struct device *dev);
#ifdef CONFIG_BRCMFMAC_SDIO
- extern void brcmf_sdio_exit(void);
- extern void brcmf_sdio_init(void);
- extern void brcmf_sdio_register(void);
+ void brcmf_sdio_exit(void);
+ void brcmf_sdio_init(void);
++void brcmf_sdio_register(void);
#endif
#ifdef CONFIG_BRCMFMAC_USB
- extern void brcmf_usb_exit(void);
- extern void brcmf_usb_register(void);
+ void brcmf_usb_exit(void);
-void brcmf_usb_init(void);
++void brcmf_usb_register(void);
#endif
#endif /* _BRCMF_BUS_H_ */
diff --cc include/net/secure_seq.h
index c2e542b,52c1a90..f257486
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@@ -3,18 -3,19 +3,18 @@@
#include <linux/types.h>
- extern __u32 secure_ip_id(__be32 daddr);
- extern __u32 secure_ipv6_id(const __be32 daddr[4]);
- extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
- extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
- __be16 dport);
- extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
- __be16 sport, __be16 dport);
- extern __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr,
- __be16 sport, __be16 dport);
- extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
- __be16 sport, __be16 dport);
- extern u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
- __be16 sport, __be16 dport);
-void net_secret_init(void);
+ __u32 secure_ip_id(__be32 daddr);
+ __u32 secure_ipv6_id(const __be32 daddr[4]);
+ u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
+ u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
+ __be16 dport);
+ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
+ __be16 sport, __be16 dport);
+ __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr,
+ __be16 sport, __be16 dport);
+ u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
+ __be16 sport, __be16 dport);
+ u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
+ __be16 sport, __be16 dport);
#endif /* _NET_SECURE_SEQ */
^ permalink raw reply
* linux-next: manual merge of the ipsec-next tree
From: Thierry Reding @ 2013-09-30 11:26 UTC (permalink / raw)
To: Steffen Klassert, Herbert Xu, David S. Miller
Cc: netdev, linux-next, linux-kernel
In-Reply-To: <1380540373-25352-1-git-send-email-treding@nvidia.com>
Today's linux-next merge of the ipsec-next tree got conflicts in
include/net/xfrm.h
I fixed it up (see below). Please check if the resolution looks correct.
Thanks,
Thierry
---
diff --cc include/net/xfrm.h
index 7657461,c7afa6e..041820c
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@@ -1493,39 -1495,35 +1499,39 @@@ static inline int xfrm4_rcv_spi(struct
return xfrm4_rcv_encap(skb, nexthdr, spi, 0);
}
-extern int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
-extern int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
-extern int xfrm4_output(struct sk_buff *skb);
-extern int xfrm4_output_finish(struct sk_buff *skb);
-extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
-extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
-extern int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
-extern int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
-extern int xfrm6_extract_header(struct sk_buff *skb);
-extern int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
-extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
-extern int xfrm6_transport_finish(struct sk_buff *skb, int async);
-extern int xfrm6_rcv(struct sk_buff *skb);
-extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
- xfrm_address_t *saddr, u8 proto);
-extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
-extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
-extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
-extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
-extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
-extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
-extern int xfrm6_output(struct sk_buff *skb);
-extern int xfrm6_output_finish(struct sk_buff *skb);
-extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
- u8 **prevhdr);
+int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
+int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
+int xfrm4_output(struct sk_buff *skb);
+int xfrm4_output_finish(struct sk_buff *skb);
+int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
+int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
- int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel *handler);
- int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel *handler);
++int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
++int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
+void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
+int xfrm6_extract_header(struct sk_buff *skb);
+int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
+int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
+int xfrm6_transport_finish(struct sk_buff *skb, int async);
+int xfrm6_rcv(struct sk_buff *skb);
+int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
+ xfrm_address_t *saddr, u8 proto);
+int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
+int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler,
+ unsigned short family);
+__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
+__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
+int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
+int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
+int xfrm6_output(struct sk_buff *skb);
+int xfrm6_output_finish(struct sk_buff *skb);
+int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
+ u8 **prevhdr);
+void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
#ifdef CONFIG_XFRM
-extern int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
-extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen);
+int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
+int xfrm_user_policy(struct sock *sk, int optname,
+ u8 __user *optval, int optlen);
#else
static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen)
{
^ permalink raw reply
* Re: [PATCH net-next 2/4] bonding: use RCU protection for alb xmit path
From: Ding Tianhong @ 2013-09-30 11:19 UTC (permalink / raw)
To: Veaceslav Falico
Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Netdev
In-Reply-To: <20130930105233.GA6096@redhat.com>
On 2013/9/30 18:52, Veaceslav Falico wrote:
> On Sun, Sep 29, 2013 at 07:45:05PM +0800, Ding Tianhong wrote:
>> The commit 278b20837511776dc9d5f6ee1c7fabd5479838bb
>> (bonding: initial RCU conversion) has convert the roundrobin,
>> active-backup, broadcast and xor xmit path to rcu protection,
>> the performance will be better for these mode, so this time,
>> convert xmit path for alb mode.
>>
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> Cc: Nikolay Aleksandrov <nikolay@redhat.com>
>> Cc: Veaceslav Falico <vfalico@redhat.com>
>> ---
>> drivers/net/bonding/bond_alb.c | 23 +++++++++--------------
>> drivers/net/bonding/bonding.h | 2 +-
>> 2 files changed, 10 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
>> index e960418..a1444d5 100644
>> --- a/drivers/net/bonding/bond_alb.c
>> +++ b/drivers/net/bonding/bond_alb.c
>> @@ -230,7 +230,7 @@ static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
>> max_gap = LLONG_MIN;
>>
>> /* Find the slave with the largest gap */
>> - bond_for_each_slave(bond, slave, iter) {
>> + bond_for_each_slave_rcu(bond, slave, iter) {
>> if (SLAVE_IS_OK(slave)) {
>> long long gap = compute_gap(slave);
>>
>> @@ -387,7 +387,7 @@ static struct slave *rlb_next_rx_slave(struct bonding *bond)
>> struct list_head *iter;
>> bool found = false;
>>
>> - bond_for_each_slave(bond, slave, iter) {
>> + bond_for_each_slave_rcu(bond, slave, iter) {
>> if (!SLAVE_IS_OK(slave))
>> continue;
>> if (!found) {
>> @@ -628,12 +628,14 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
>> {
>> struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
>> struct arp_pkt *arp = arp_pkt(skb);
>> - struct slave *assigned_slave;
>> + struct slave *assigned_slave, *curr_active_slave;
>> struct rlb_client_info *client_info;
>> u32 hash_index = 0;
>>
>> _lock_rx_hashtbl(bond);
>>
>> + curr_active_slave = rcu_dereference(bond->curr_active_slave);
>> +
>> hash_index = _simple_hash((u8 *)&arp->ip_dst, sizeof(arp->ip_dst));
>> client_info = &(bond_info->rx_hashtbl[hash_index]);
>>
>> @@ -658,8 +660,8 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
>> * that the new client can be assigned to this entry.
>> */
>> if (bond->curr_active_slave &&
>> - client_info->slave != bond->curr_active_slave) {
>> - client_info->slave = bond->curr_active_slave;
>> + client_info->slave != curr_active_slave) {
>> + client_info->slave = curr_active_slave;
>> rlb_update_client(client_info);
>> }
>> }
>> @@ -1343,11 +1345,6 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
>> skb_reset_mac_header(skb);
>> eth_data = eth_hdr(skb);
>>
>> - /* make sure that the curr_active_slave do not change during tx
>> - */
>> - read_lock(&bond->lock);
>> - read_lock(&bond->curr_slave_lock);
>> -
>> switch (ntohs(skb->protocol)) {
>> case ETH_P_IP: {
>> const struct iphdr *iph = ip_hdr(skb);
>> @@ -1429,12 +1426,12 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
>>
>> if (!tx_slave) {
>> /* unbalanced or unassigned, send through primary */
>> - tx_slave = bond->curr_active_slave;
>> + tx_slave = rcu_dereference(bond->curr_active_slave);
>> bond_info->unbalanced_load += skb->len;
>> }
>>
>> if (tx_slave && SLAVE_IS_OK(tx_slave)) {
>> - if (tx_slave != bond->curr_active_slave) {
>> + if (tx_slave != rcu_dereference(bond->curr_active_slave)) {
>> memcpy(eth_data->h_source,
>> tx_slave->dev->dev_addr,
>> ETH_ALEN);
>> @@ -1449,8 +1446,6 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
>> }
>> }
>>
>> - read_unlock(&bond->curr_slave_lock);
>> - read_unlock(&bond->lock);
>> if (res) {
>> /* no suitable interface, frame not sent */
>> kfree_skb(skb);
>> diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
>> index 713b6af..1c7d559 100644
>> --- a/drivers/net/bonding/bonding.h
>> +++ b/drivers/net/bonding/bonding.h
>> @@ -459,7 +459,7 @@ static inline struct slave *bond_slave_has_mac(struct bonding *bond,
>> struct list_head *iter;
>> struct slave *tmp;
>>
>> - bond_for_each_slave(bond, tmp, iter)
>> + bond_for_each_slave_rcu(bond, tmp, iter)
>
> This suggests that rcu_read_lock() is always held here, however it's not
> the case, as far as I can tell:
>
> bond_release()/bond_uninit() ->
> __bond_release_one() ->
> bond_alb_deinit_slave() ->
> alb_change_hw_addr_on_detach() ->
> bond_slave_has_mac()
>
> There is nobody that takes rcu_read_lock() there. And, for example, when
> doing:
>
> echo -$slave > /sys/class/net/$bond_int/bonding/slaves
>
> nobody is holding it. And, btw, in bond_for_each_slave_rcu(), which is
> actually a wrapper for netdev_for_each_lower_private_rcu(), which calls
> netdev_lower_get_next_private_rcu(), which has:
>
> 4543 void *netdev_lower_get_next_private_rcu(struct net_device *dev,
> 4544 struct list_head **iter)
> 4545 {
> 4546 struct netdev_adjacent *lower;
> 4547 4548 WARN_ON_ONCE(!rcu_read_lock_held());
>
> so you should have seen that warning when trying to remove a slave in alb
> mode.
>
>> if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
>> return tmp;
>>
>> --
>> 1.8.2.1
>>
>>
>>
oh, yes, has to do little more,thanks.
>
> .
>
^ permalink raw reply
* Re: [PATCH net-next 2/4] bonding: use RCU protection for alb xmit path
From: Veaceslav Falico @ 2013-09-30 10:52 UTC (permalink / raw)
To: Ding Tianhong
Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Netdev
In-Reply-To: <524812C1.6070407@huawei.com>
On Sun, Sep 29, 2013 at 07:45:05PM +0800, Ding Tianhong wrote:
>The commit 278b20837511776dc9d5f6ee1c7fabd5479838bb
>(bonding: initial RCU conversion) has convert the roundrobin,
>active-backup, broadcast and xor xmit path to rcu protection,
>the performance will be better for these mode, so this time,
>convert xmit path for alb mode.
>
>Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>Cc: Nikolay Aleksandrov <nikolay@redhat.com>
>Cc: Veaceslav Falico <vfalico@redhat.com>
>---
> drivers/net/bonding/bond_alb.c | 23 +++++++++--------------
> drivers/net/bonding/bonding.h | 2 +-
> 2 files changed, 10 insertions(+), 15 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
>index e960418..a1444d5 100644
>--- a/drivers/net/bonding/bond_alb.c
>+++ b/drivers/net/bonding/bond_alb.c
>@@ -230,7 +230,7 @@ static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
> max_gap = LLONG_MIN;
>
> /* Find the slave with the largest gap */
>- bond_for_each_slave(bond, slave, iter) {
>+ bond_for_each_slave_rcu(bond, slave, iter) {
> if (SLAVE_IS_OK(slave)) {
> long long gap = compute_gap(slave);
>
>@@ -387,7 +387,7 @@ static struct slave *rlb_next_rx_slave(struct bonding *bond)
> struct list_head *iter;
> bool found = false;
>
>- bond_for_each_slave(bond, slave, iter) {
>+ bond_for_each_slave_rcu(bond, slave, iter) {
> if (!SLAVE_IS_OK(slave))
> continue;
> if (!found) {
>@@ -628,12 +628,14 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
> {
> struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
> struct arp_pkt *arp = arp_pkt(skb);
>- struct slave *assigned_slave;
>+ struct slave *assigned_slave, *curr_active_slave;
> struct rlb_client_info *client_info;
> u32 hash_index = 0;
>
> _lock_rx_hashtbl(bond);
>
>+ curr_active_slave = rcu_dereference(bond->curr_active_slave);
>+
> hash_index = _simple_hash((u8 *)&arp->ip_dst, sizeof(arp->ip_dst));
> client_info = &(bond_info->rx_hashtbl[hash_index]);
>
>@@ -658,8 +660,8 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
> * that the new client can be assigned to this entry.
> */
> if (bond->curr_active_slave &&
>- client_info->slave != bond->curr_active_slave) {
>- client_info->slave = bond->curr_active_slave;
>+ client_info->slave != curr_active_slave) {
>+ client_info->slave = curr_active_slave;
> rlb_update_client(client_info);
> }
> }
>@@ -1343,11 +1345,6 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
> skb_reset_mac_header(skb);
> eth_data = eth_hdr(skb);
>
>- /* make sure that the curr_active_slave do not change during tx
>- */
>- read_lock(&bond->lock);
>- read_lock(&bond->curr_slave_lock);
>-
> switch (ntohs(skb->protocol)) {
> case ETH_P_IP: {
> const struct iphdr *iph = ip_hdr(skb);
>@@ -1429,12 +1426,12 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
>
> if (!tx_slave) {
> /* unbalanced or unassigned, send through primary */
>- tx_slave = bond->curr_active_slave;
>+ tx_slave = rcu_dereference(bond->curr_active_slave);
> bond_info->unbalanced_load += skb->len;
> }
>
> if (tx_slave && SLAVE_IS_OK(tx_slave)) {
>- if (tx_slave != bond->curr_active_slave) {
>+ if (tx_slave != rcu_dereference(bond->curr_active_slave)) {
> memcpy(eth_data->h_source,
> tx_slave->dev->dev_addr,
> ETH_ALEN);
>@@ -1449,8 +1446,6 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
> }
> }
>
>- read_unlock(&bond->curr_slave_lock);
>- read_unlock(&bond->lock);
> if (res) {
> /* no suitable interface, frame not sent */
> kfree_skb(skb);
>diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
>index 713b6af..1c7d559 100644
>--- a/drivers/net/bonding/bonding.h
>+++ b/drivers/net/bonding/bonding.h
>@@ -459,7 +459,7 @@ static inline struct slave *bond_slave_has_mac(struct bonding *bond,
> struct list_head *iter;
> struct slave *tmp;
>
>- bond_for_each_slave(bond, tmp, iter)
>+ bond_for_each_slave_rcu(bond, tmp, iter)
This suggests that rcu_read_lock() is always held here, however it's not
the case, as far as I can tell:
bond_release()/bond_uninit() ->
__bond_release_one() ->
bond_alb_deinit_slave() ->
alb_change_hw_addr_on_detach() ->
bond_slave_has_mac()
There is nobody that takes rcu_read_lock() there. And, for example, when
doing:
echo -$slave > /sys/class/net/$bond_int/bonding/slaves
nobody is holding it. And, btw, in bond_for_each_slave_rcu(), which is
actually a wrapper for netdev_for_each_lower_private_rcu(), which calls
netdev_lower_get_next_private_rcu(), which has:
4543 void *netdev_lower_get_next_private_rcu(struct net_device *dev,
4544 struct list_head **iter)
4545 {
4546 struct netdev_adjacent *lower;
4547
4548 WARN_ON_ONCE(!rcu_read_lock_held());
so you should have seen that warning when trying to remove a slave in alb
mode.
> if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
> return tmp;
>
>--
>1.8.2.1
>
>
>
^ permalink raw reply
* RE: [PATCH] {iproute2, xfrm}: Use memcpy to suppress gcc phony buffer overflow warning
From: David Laight @ 2013-09-30 9:29 UTC (permalink / raw)
To: Sohny Thomas, Fan Du; +Cc: stephen, netdev
In-Reply-To: <52479CA0.4050505@linux.vnet.ibm.com>
> > This is a false positive warning as the destination pointer "buf"
> > pointers to
> > an ZERO length array, which actually will occupy alg.buf mostly.
> > Fix this by using memcpy.
> >
> > struct xfrm_algo {
> > char alg_name[64];
> > unsigned int alg_key_len; /* in bits */
> > char alg_key[0];
> > };
> >
> > struct {
> > union {
> > struct xfrm_algo alg;
> > struct xfrm_algo_aead aead;
> > struct xfrm_algo_auth auth;
> > } u;
> > char buf[XFRM_ALGO_KEY_BUF_SIZE];
> > } alg = {};
> >
> > buf = alg.u.alg.alg_key;
That is worse than horrid...
The tools have every right to complain about any accesses to alg_key[].
> > ---
> > ip/xfrm_state.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
> > index 0d98e78..5cc87d3 100644
> > --- a/ip/xfrm_state.c
> > +++ b/ip/xfrm_state.c
> > @@ -159,7 +159,7 @@ static int xfrm_algo_parse(struct xfrm_algo *alg,
> > enum xfrm_attr_type_t type,
> > if (len > max)
> > invarg("\"ALGO-KEY\" makes buffer overflow\n", key);
I presume there is a return hiding in invarg().
> >
> > - strncpy(buf, key, len);
> > + memcpy(buf, key, len);
Passing the length of the SOURCE to strncpy() is almost always wrong.
You are still not terminating the copied string.
David
^ permalink raw reply
* RE: [PATCH v1 net-next] net: pkt_sched: PIE AQM scheme
From: David Laight @ 2013-09-30 9:19 UTC (permalink / raw)
To: Vijay Subramanian, netdev
Cc: davem, shemminger, eric.dumazet, Mythili Prabhu, Dave Taht
In-Reply-To: <1380333383-9507-1-git-send-email-subramanian.vijay@gmail.com>
> +#define PIE_DEFAULT_QUEUE_LIMIT 200 /* in packets */
> +#define QUEUE_THRESHOLD (5000)
> +#define DQCOUNT_INVALID -1
> +#define THRESHOLD_PKT_SIZE 1500
> +#define MAX_INT_VALUE 0xffffffff
> +#define MAX_INT_VALUE_CAP (0xffffffff >> 8)
The above 2 constants are both unsigned (unless 'int' is larger than 32 bits).
If nothing else this means that they are very badly named.
> +
> +typedef u32 pie_time_t;
> +typedef s32 pie_tdiff_t;
> +#define PIE_SHIFT 10
> +#define MS2PIETIME(a) ((a * NSEC_PER_MSEC) >> PIE_SHIFT)
> +#define PIE_TIME_PER_SEC ((NSEC_PER_SEC >> PIE_SHIFT))
> +
> +static inline pie_time_t pie_get_time(void)
> +{
> + u64 ns = ktime_to_ns(ktime_get());
> + return ns >> PIE_SHIFT;
> +}
> +
> +static inline u32 pie_time_to_ms(pie_time_t val)
> +{
> + u64 valms = ((u64) val << PIE_SHIFT);
> +
> + do_div(valms, NSEC_PER_MSEC);
> + return (u32) valms;
> +}
There seems to be a lot of conversions between 1/1000 ms and 1/1024 ms.
On 32 bit systems they are horrid.
Not only that the conversions are open coded a lot of times as well.
It might also be better replacing '(val * 1000u) >> 10' with
'(val * (u64)(1000 << (32 - 10))) >> 32' since I'm not sure the compiler
will perform that substitution.
What happens if pie_time_to_ms() overflows 32 bits?
If it is only ever called for small values, there may be no need for
64bit maths at all.
...
> + if (delta > (s32) (MAX_INT_VALUE * 2 / 100)
> + && q->vars.prob >= MAX_INT_VALUE / 10) {
> + delta = MAX_INT_VALUE * 2 / 100;
Calculating 'MAX_INT_VALUE * 2' isn't a good idea!
Whatever value it is supposed to be, it should be a named constant.
David
^ permalink raw reply
* Re: [PATCH net-next] xen-netfront: convert to GRO API and advertise this feature
From: Ian Campbell @ 2013-09-30 9:12 UTC (permalink / raw)
To: David Miller; +Cc: wei.liu2, netdev, xen-devel, abchak
In-Reply-To: <20130928.153800.327243541797748645.davem@davemloft.net>
On Sat, 2013-09-28 at 15:38 -0400, David Miller wrote:
> From: Wei Liu <wei.liu2@citrix.com>
> Date: Sat, 21 Sep 2013 17:05:43 +0100
>
> > @@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
> > netif_napi_add(netdev, &np->napi, xennet_poll, 64);
> > netdev->features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
> > NETIF_F_GSO_ROBUST;
> > - netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
> > + netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
> > + NETIF_F_GRO;
>
> Please post a new version of this patch with the feedback you've been
> given integrated, in particular with this part removed because it is
> not necessary.
>
> Ian, please review the patch when Wei posts it.
I will, but note:
$ ./scripts/get_maintainer.pl -f drivers/net/xen-netfront.c
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (supporter:XEN HYPERVISOR IN...)
Jeremy Fitzhardinge <jeremy@goop.org> (supporter:XEN HYPERVISOR IN...)
xen-devel@lists.xensource.com (moderated list:XEN HYPERVISOR IN...)
virtualization@lists.linux-foundation.org (open list:XEN HYPERVISOR IN...)
netdev@vger.kernel.org (open list:NETWORKING DRIVERS)
linux-kernel@vger.kernel.org (open list)
Strictly speaking I maintain netback not front, so Wei please remember
to CC the right people (mainly Konrad) as well as me.
BTW I think this separation is a good thing since it keeps changes to
the protocol "honest". Doesn't matter so much for this particular patch
since don't think it actually touches the protocol.
Ian.
^ permalink raw reply
* Re: [PATCH V5 net-next 2/3] net: huawei_cdc_ncm: Introduce the huawei_cdc_ncm driver
From: Oliver Neukum @ 2013-09-30 9:07 UTC (permalink / raw)
To: Enrico Mioso
Cc: Greg Kroah-Hartman, David S. Miller, Steve Glendinning,
Robert de Vries, Hayes Wang, Freddy Xin, Bjørn Mork,
Liu Junliang, open list, open list:USB NETWORKING DR...,
open list:NETWORKING DRIVERS, ModemManager-devel
In-Reply-To: <1380516609-31242-3-git-send-email-mrkiko.rs@gmail.com>
On Mon, 2013-09-30 at 04:50 +0000, Enrico Mioso wrote:
> +static int huawei_cdc_ncm_manage_power(struct usbnet *usbnet_dev, int on)
> +{
> + struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
> + int rv = 0;
> +
> + if ((on && atomic_add_return(1, &drvstate->pmcount) == 1) ||
> + (!on && atomic_dec_and_test(&drvstate->pmcount))) {
> + rv = usb_autopm_get_interface(usbnet_dev->intf);
> + if (rv < 0)
> + goto err;
The error case corrupts drvstate->pmcount
> + usbnet_dev->intf->needs_remote_wakeup = on;
> + usb_autopm_put_interface(usbnet_dev->intf);
> + }
> +err:
> + return rv;
> +}
> +static int huawei_cdc_ncm_suspend(struct usb_interface *intf, pm_message_t message)
> +{
> + int ret = 0;
> + struct usbnet *usbnet_dev = usb_get_intfdata(intf);
> + struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
> + struct cdc_ncm_ctx *ctx = drvstate->ctx;
> +
> + if (ctx == NULL) {
> + ret = -1;
That is not a valid way to indicate an error.
> + goto error;
> + }
> +
> + ret = usbnet_suspend(intf, message);
> + if (ret < 0)
> + goto error;
> +
> + if (intf == ctx->control &&
> + drvstate->subdriver &&
> + drvstate->subdriver->suspend)
> + ret = drvstate->subdriver->suspend(intf, message);
> + if (ret < 0)
> + usbnet_resume(intf);
> +
> +error:
> + return ret;
> +}
> +
> +static int huawei_cdc_ncm_resume(struct usb_interface *intf)
> +{
> + int ret = 0;
> + struct usbnet *usbnet_dev = usb_get_intfdata(intf);
> + struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
> + bool callsub;
> + struct cdc_ncm_ctx *ctx = drvstate->ctx;
> +
> + /* should we call subdriver's resume function? */
> + callsub =
> + (intf == ctx->control &&
> + drvstate->subdriver &&
> + drvstate->subdriver->resume);
> +
> + if (callsub)
> + ret = drvstate->subdriver->resume(intf);
> + if (ret < 0)
> + goto err;
> + ret = usbnet_resume(intf);
> + if (ret < 0 && callsub && drvstate->subdriver->suspend)
You really want drivers with a resume() but no suspend() method?
> + drvstate->subdriver->suspend(intf, PMSG_SUSPEND);
> +err:
> + return ret;
> +}
Regards
Oliver
^ permalink raw reply
* Re: [net-next PATCH V2] virtio-net: switch to use XPS to choose txq
From: Michael S. Tsirkin @ 2013-09-30 9:04 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, linux-kernel, virtualization
In-Reply-To: <1380526637-35524-1-git-send-email-jasowang@redhat.com>
On Mon, Sep 30, 2013 at 03:37:17PM +0800, Jason Wang wrote:
> We used to use a percpu structure vq_index to record the cpu to queue
> mapping, this is suboptimal since it duplicates the work of XPS and
> loses all other XPS functionality such as allowing use to configure
> their own transmission steering strategy.
>
> So this patch switches to use XPS and suggest a default mapping when
> the number of cpus is equal to the number of queues. With XPS support,
> there's no need for keeping per-cpu vq_index and .ndo_select_queue(),
> so they were removed also.
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> Changes from V1:
> - use cpumask_of() instead of allocate dynamically
>
> drivers/net/virtio_net.c | 48 +--------------------------------------------
> 1 files changed, 2 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index defec2b..4eca652 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -127,9 +127,6 @@ struct virtnet_info {
> /* Does the affinity hint is set for virtqueues? */
> bool affinity_hint_set;
>
> - /* Per-cpu variable to show the mapping from CPU to virtqueue */
> - int __percpu *vq_index;
> -
> /* CPU hot plug notifier */
> struct notifier_block nb;
> };
> @@ -1063,7 +1060,6 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev,
> static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu)
> {
> int i;
> - int cpu;
>
> if (vi->affinity_hint_set) {
> for (i = 0; i < vi->max_queue_pairs; i++) {
> @@ -1073,16 +1069,6 @@ static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu)
>
> vi->affinity_hint_set = false;
> }
> -
> - i = 0;
> - for_each_online_cpu(cpu) {
> - if (cpu == hcpu) {
> - *per_cpu_ptr(vi->vq_index, cpu) = -1;
> - } else {
> - *per_cpu_ptr(vi->vq_index, cpu) =
> - ++i % vi->curr_queue_pairs;
> - }
> - }
> }
>
> static void virtnet_set_affinity(struct virtnet_info *vi)
> @@ -1104,7 +1090,7 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
> for_each_online_cpu(cpu) {
> virtqueue_set_affinity(vi->rq[i].vq, cpu);
> virtqueue_set_affinity(vi->sq[i].vq, cpu);
> - *per_cpu_ptr(vi->vq_index, cpu) = i;
> + netif_set_xps_queue(vi->dev, cpumask_of(cpu), i);
> i++;
> }
>
> @@ -1217,28 +1203,6 @@ static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
> return 0;
> }
>
> -/* To avoid contending a lock hold by a vcpu who would exit to host, select the
> - * txq based on the processor id.
> - */
> -static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb)
> -{
> - int txq;
> - struct virtnet_info *vi = netdev_priv(dev);
> -
> - if (skb_rx_queue_recorded(skb)) {
> - txq = skb_get_rx_queue(skb);
> - } else {
> - txq = *__this_cpu_ptr(vi->vq_index);
> - if (txq == -1)
> - txq = 0;
> - }
> -
> - while (unlikely(txq >= dev->real_num_tx_queues))
> - txq -= dev->real_num_tx_queues;
> -
> - return txq;
> -}
> -
> static const struct net_device_ops virtnet_netdev = {
> .ndo_open = virtnet_open,
> .ndo_stop = virtnet_close,
> @@ -1250,7 +1214,6 @@ static const struct net_device_ops virtnet_netdev = {
> .ndo_get_stats64 = virtnet_stats,
> .ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
> .ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
> - .ndo_select_queue = virtnet_select_queue,
> #ifdef CONFIG_NET_POLL_CONTROLLER
> .ndo_poll_controller = virtnet_netpoll,
> #endif
> @@ -1559,10 +1522,6 @@ static int virtnet_probe(struct virtio_device *vdev)
> if (vi->stats == NULL)
> goto free;
>
> - vi->vq_index = alloc_percpu(int);
> - if (vi->vq_index == NULL)
> - goto free_stats;
> -
> mutex_init(&vi->config_lock);
> vi->config_enable = true;
> INIT_WORK(&vi->config_work, virtnet_config_changed_work);
> @@ -1589,7 +1548,7 @@ static int virtnet_probe(struct virtio_device *vdev)
> /* Allocate/initialize the rx/tx queues, and invoke find_vqs */
> err = init_vqs(vi);
> if (err)
> - goto free_index;
> + goto free_stats;
>
> netif_set_real_num_tx_queues(dev, 1);
> netif_set_real_num_rx_queues(dev, 1);
> @@ -1640,8 +1599,6 @@ free_recv_bufs:
> free_vqs:
> cancel_delayed_work_sync(&vi->refill);
> virtnet_del_vqs(vi);
> -free_index:
> - free_percpu(vi->vq_index);
> free_stats:
> free_percpu(vi->stats);
> free:
> @@ -1678,7 +1635,6 @@ static void virtnet_remove(struct virtio_device *vdev)
>
> flush_work(&vi->config_work);
>
> - free_percpu(vi->vq_index);
> free_percpu(vi->stats);
> free_netdev(vi->dev);
> }
> --
> 1.7.1
^ permalink raw reply
* Re: [PATCH V5 net-next 0/3] The huawei_cdc_ncm driver
From: Bjørn Mork @ 2013-09-30 8:56 UTC (permalink / raw)
To: Enrico Mioso
Cc: Oliver Neukum, Greg Kroah-Hartman, David S. Miller,
Steve Glendinning, Robert de Vries, Hayes Wang, Freddy Xin,
Liu Junliang, open list, open list:USB NETWORKING DR...,
open list:NETWORKING DRIVERS, ModemManager-devel
In-Reply-To: <1380516609-31242-1-git-send-email-mrkiko.rs@gmail.com>
Enrico Mioso <mrkiko.rs@gmail.com> writes:
> So this is a new, revised, edition of the huawei_cdc_ncm.c driver, which
> supports devices resembling the NCM standard, but using it also as a mean
> to encapsulate other protocols, as is the case for the Huawei E3131 and
> E3251 modem devices.
> Some precisations are needed however - and I encourage discussion on this: and
> that's why I'm sending this message with a broader CC.
> Merging those patches might change:
> - the way Modem Manager interacts with those devices
> - some regressions might be possible if there are some unknown firmware
> variants around (Franko?)
>
> First of all: I observed the behaviours of two devices.
> Huawei E3131: this device doesn't accept NDIS setup requests unless they're
> sent via the embedded AT channel exposed by this driver.
> So actually we gain funcionality in this case!
>
> The second case, is the Huawei E3251: which works with standard NCM driver,
> still exposing an AT embedded channel. Whith this patch set applied, you gain
> some funcionality, loosing the ability to catch standard NCM events for now.
> The device will work in both ways with no problems, but this has to be
> acknowledged and discussed. Might be we can develop this driver further to
> change this, when more devices are tested.
Your driver, and the cdc-wdm subdriver API in general, could certainly
be extended to support standard NCM events. There have been some
discussions in the linux-usb list already on how to best do this. I
believe this message from Oliver is the current conclusion to that
discussion: http://www.spinics.net/lists/linux-usb/msg70140.html
I.e:
- extend the cdc-wdm subdriver API by creating a struct holding all
necessary callbacks, and use this struct instead of the current
single "manage_power" callback, and
- create one callback hook per notification you want to handle, with
clear semantics and reasonable names
But I still believe your driver should go in as it is for now. As you
note, it is required for the E3131. And the same is most likely the
case for other devices in the same family.
Handling the NCM notifications can always be added later. IMHO, they can
be considered optional given that a separate management channel is
required in any case to configure these devices and start/stop the
connection. The NCM events you lose compared to cdc_ncm are
NETWORK_CONNECTION and SPEED_CHANGE. The first one is useful as it is
implemented in cdc_ncm because it controls the network device link
state, but it is still redundant for devices like these where a managing
userspace application is required and the connection events are
available via the management channel. The implementation of
SPEED_CHANGE events is less useful. The cdc_ncm driver doesn't use the
received speed data for anything except printing an informational
message. I don't think implementing it in your driver will gain you
anything.
> We where thinking Huawei changed their interfaces on new devices - but probably
> this driver only works around a nice firmware bug present in E3131, which
> prevented the modem from being used in NDIS mode.
I am not sure this is a firmware bug. It could very well be by design,
and the differences in observed behaviour could be just artifacts of the
interface implementation on top of different chipsets and/or base
firmwares. AFAIK, Huawei have never officially supported the serial
port for network device management on this class of devices. The
embedded AT channel is most likely the only AT command channel intended
for network device management, even on the devices with serial ports.
> I think committing this is definitely wortth-while, since it will allow for
> more Huawei devices to be used without serial connection. Some devices like the
> E3251 also, reports some status information only via the embedded AT channel,
> at least in my case.
> Note: I'm not subscribed to any list except the Modem Manager's one, so please
> CC me, thanks!!
Yes, this is most definitely a driver worth being added. There are a
number of devices which just cannot be made working in Linux without it
because the embedded management channel is the only one available.
I don't know if you are aware of this, but I have pointed a few people
to your previous submission attempts and there are therefore some
success stories around already. An example:
http://lists.freedesktop.org/archives/libqmi-devel/2013-September/000650.html
Bjørn
^ permalink raw reply
* Re: [PATCH 1/2] remove all uses of printf's %n
From: Tetsuo Handa @ 2013-09-30 8:16 UTC (permalink / raw)
To: akpm
Cc: keescook, jslaby, viro, xemul, linux-kernel, netdev, linux-sctp,
linux, dan.carpenter, geert, JBeulich, joe, kosaki.motohiro
In-Reply-To: <CAGXu5j+p=op2dtjPV9wJm03xuHcJd7ER-LzyoPZ6guOO2BX-tw@mail.gmail.com>
Hello.
As it seems that there is no critical problem (naming preference can easily be
fixed if needed), can these patches go to linux-next?
If these patches are accepted, Kees Cook will submit a patch which removes %n
support from vsnprintf() ( https://lkml.org/lkml/2013/9/16/54 ).
Regards.
----------------------------------------
>From 02b28fd709971f71e5de9a5b595ff4fd059028b3 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Thu, 19 Sep 2013 17:23:17 +0900
Subject: [PATCH] seq_file: Introduce seq_setwidth() and seq_pad()
There are several users who want to know bytes written by seq_*() for alignment
purpose. Currently they are using %n format for knowing it because seq_*()
returns 0 on success.
This patch introduces seq_setwidth() and seq_pad() for allowing them to align
without using %n format.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Kees Cook <keescook@chromium.org>
---
fs/seq_file.c | 15 +++++++++++++++
include/linux/seq_file.h | 15 +++++++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 3135c25..40e471e 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -764,6 +764,21 @@ int seq_write(struct seq_file *seq, const void *data, size_t len)
}
EXPORT_SYMBOL(seq_write);
+/**
+ * seq_pad - write padding spaces to buffer
+ * @m: seq_file identifying the buffer to which data should be written
+ * @c: the byte to append after padding if non-zero
+ */
+void seq_pad(struct seq_file *m, char c)
+{
+ int size = m->pad_until - m->count;
+ if (size > 0)
+ seq_printf(m, "%*s", size, "");
+ if (c)
+ seq_putc(m, c);
+}
+EXPORT_SYMBOL(seq_pad);
+
struct list_head *seq_list_start(struct list_head *head, loff_t pos)
{
struct list_head *lh;
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 4e32edc..52e0097 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -20,6 +20,7 @@ struct seq_file {
size_t size;
size_t from;
size_t count;
+ size_t pad_until;
loff_t index;
loff_t read_pos;
u64 version;
@@ -79,6 +80,20 @@ static inline void seq_commit(struct seq_file *m, int num)
}
}
+/**
+ * seq_setwidth - set padding width
+ * @m: the seq_file handle
+ * @size: the max number of bytes to pad.
+ *
+ * Call seq_setwidth() for setting max width, then call seq_printf() etc. and
+ * finally call seq_pad() to pad the remaining bytes.
+ */
+static inline void seq_setwidth(struct seq_file *m, size_t size)
+{
+ m->pad_until = m->count + size;
+}
+void seq_pad(struct seq_file *m, char c);
+
char *mangle_path(char *s, const char *p, const char *esc);
int seq_open(struct file *, const struct seq_operations *);
ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
--
1.7.1
----------------------------------------
>From f8b60ebe3971901b93dedb8eee0f85b60d0fdc5f Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Fri, 20 Sep 2013 12:01:07 +0900
Subject: [PATCH] Remove "%n" usage from seq_file users.
All seq_printf() users are using "%n" for calculating padding size, convert
them to use seq_setwidth() / seq_pad() pair.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Kees Cook <keescook@chromium.org>
---
fs/proc/consoles.c | 10 ++++------
fs/proc/nommu.c | 12 +++++-------
fs/proc/task_mmu.c | 20 ++++++--------------
fs/proc/task_nommu.c | 19 ++++++-------------
net/ipv4/fib_trie.c | 13 +++++++------
net/ipv4/ping.c | 15 +++++++--------
net/ipv4/tcp_ipv4.c | 33 +++++++++++++++------------------
net/ipv4/udp.c | 15 +++++++--------
net/phonet/socket.c | 24 +++++++++++-------------
net/sctp/objcnt.c | 9 +++++----
10 files changed, 73 insertions(+), 97 deletions(-)
diff --git a/fs/proc/consoles.c b/fs/proc/consoles.c
index b701eaa..51942d5 100644
--- a/fs/proc/consoles.c
+++ b/fs/proc/consoles.c
@@ -29,7 +29,6 @@ static int show_console_dev(struct seq_file *m, void *v)
char flags[ARRAY_SIZE(con_flags) + 1];
struct console *con = v;
unsigned int a;
- int len;
dev_t dev = 0;
if (con->device) {
@@ -47,11 +46,10 @@ static int show_console_dev(struct seq_file *m, void *v)
con_flags[a].name : ' ';
flags[a] = 0;
- seq_printf(m, "%s%d%n", con->name, con->index, &len);
- len = 21 - len;
- if (len < 1)
- len = 1;
- seq_printf(m, "%*c%c%c%c (%s)", len, ' ', con->read ? 'R' : '-',
+ seq_setwidth(m, 21 - 1);
+ seq_printf(m, "%s%d", con->name, con->index);
+ seq_pad(m, ' ');
+ seq_printf(m, "%c%c%c (%s)", con->read ? 'R' : '-',
con->write ? 'W' : '-', con->unblank ? 'U' : '-',
flags);
if (dev)
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index ccfd99b..5f9bc8a 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -39,7 +39,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
unsigned long ino = 0;
struct file *file;
dev_t dev = 0;
- int flags, len;
+ int flags;
flags = region->vm_flags;
file = region->vm_file;
@@ -50,8 +50,9 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
ino = inode->i_ino;
}
+ seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
seq_printf(m,
- "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
+ "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
region->vm_start,
region->vm_end,
flags & VM_READ ? 'r' : '-',
@@ -59,13 +60,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
flags & VM_EXEC ? 'x' : '-',
flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
((loff_t)region->vm_pgoff) << PAGE_SHIFT,
- MAJOR(dev), MINOR(dev), ino, &len);
+ MAJOR(dev), MINOR(dev), ino);
if (file) {
- len = 25 + sizeof(void *) * 6 - len;
- if (len < 1)
- len = 1;
- seq_printf(m, "%*c", len, ' ');
+ seq_pad(m, ' ');
seq_path(m, &file->f_path, "");
}
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 7366e9d..cc24165 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -83,14 +83,6 @@ unsigned long task_statm(struct mm_struct *mm,
return mm->total_vm;
}
-static void pad_len_spaces(struct seq_file *m, int len)
-{
- len = 25 + sizeof(void*) * 6 - len;
- if (len < 1)
- len = 1;
- seq_printf(m, "%*c", len, ' ');
-}
-
#ifdef CONFIG_NUMA
/*
* These functions are for numa_maps but called in generic **maps seq_file
@@ -268,7 +260,6 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
unsigned long long pgoff = 0;
unsigned long start, end;
dev_t dev = 0;
- int len;
const char *name = NULL;
if (file) {
@@ -286,7 +277,8 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
if (stack_guard_page_end(vma, end))
end -= PAGE_SIZE;
- seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
+ seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
+ seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
start,
end,
flags & VM_READ ? 'r' : '-',
@@ -294,14 +286,14 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
flags & VM_EXEC ? 'x' : '-',
flags & VM_MAYSHARE ? 's' : 'p',
pgoff,
- MAJOR(dev), MINOR(dev), ino, &len);
+ MAJOR(dev), MINOR(dev), ino);
/*
* Print the dentry name for named mappings, and a
* special [heap] marker for the heap:
*/
if (file) {
- pad_len_spaces(m, len);
+ seq_pad(m, ' ');
seq_path(m, &file->f_path, "\n");
goto done;
}
@@ -333,7 +325,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
name = "[stack]";
} else {
/* Thread stack in /proc/PID/maps */
- pad_len_spaces(m, len);
+ seq_pad(m, ' ');
seq_printf(m, "[stack:%d]", tid);
}
}
@@ -341,7 +333,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
done:
if (name) {
- pad_len_spaces(m, len);
+ seq_pad(m, ' ');
seq_puts(m, name);
}
seq_putc(m, '\n');
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 56123a6..678455d 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -123,14 +123,6 @@ unsigned long task_statm(struct mm_struct *mm,
return size;
}
-static void pad_len_spaces(struct seq_file *m, int len)
-{
- len = 25 + sizeof(void*) * 6 - len;
- if (len < 1)
- len = 1;
- seq_printf(m, "%*c", len, ' ');
-}
-
/*
* display a single VMA to a sequenced file
*/
@@ -142,7 +134,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
unsigned long ino = 0;
struct file *file;
dev_t dev = 0;
- int flags, len;
+ int flags;
unsigned long long pgoff = 0;
flags = vma->vm_flags;
@@ -155,8 +147,9 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
}
+ seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
seq_printf(m,
- "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
+ "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
vma->vm_start,
vma->vm_end,
flags & VM_READ ? 'r' : '-',
@@ -164,16 +157,16 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
flags & VM_EXEC ? 'x' : '-',
flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
pgoff,
- MAJOR(dev), MINOR(dev), ino, &len);
+ MAJOR(dev), MINOR(dev), ino);
if (file) {
- pad_len_spaces(m, len);
+ seq_pad(m, ' ');
seq_path(m, &file->f_path, "");
} else if (mm) {
pid_t tid = vm_is_stack(priv->task, vma, is_pid);
if (tid != 0) {
- pad_len_spaces(m, len);
+ seq_pad(m, ' ');
/*
* Thread stack in /proc/PID/task/TID/maps or
* the main process stack.
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 3df6d3e..b1af50e 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2530,16 +2530,17 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
list_for_each_entry_rcu(fa, &li->falh, fa_list) {
const struct fib_info *fi = fa->fa_info;
unsigned int flags = fib_flag_trans(fa->fa_type, mask, fi);
- int len;
if (fa->fa_type == RTN_BROADCAST
|| fa->fa_type == RTN_MULTICAST)
continue;
+ seq_setwidth(seq, 127);
+
if (fi)
seq_printf(seq,
"%s\t%08X\t%08X\t%04X\t%d\t%u\t"
- "%d\t%08X\t%d\t%u\t%u%n",
+ "%d\t%08X\t%d\t%u\t%u",
fi->fib_dev ? fi->fib_dev->name : "*",
prefix,
fi->fib_nh->nh_gw, flags, 0, 0,
@@ -2548,15 +2549,15 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
(fi->fib_advmss ?
fi->fib_advmss + 40 : 0),
fi->fib_window,
- fi->fib_rtt >> 3, &len);
+ fi->fib_rtt >> 3);
else
seq_printf(seq,
"*\t%08X\t%08X\t%04X\t%d\t%u\t"
- "%d\t%08X\t%d\t%u\t%u%n",
+ "%d\t%08X\t%d\t%u\t%u",
prefix, 0, flags, 0, 0, 0,
- mask, 0, 0, 0, &len);
+ mask, 0, 0, 0);
- seq_printf(seq, "%*s\n", 127 - len, "");
+ seq_pad(seq, '\n');
}
}
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index d7d9882..94cc685 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -1073,7 +1073,7 @@ void ping_seq_stop(struct seq_file *seq, void *v)
EXPORT_SYMBOL_GPL(ping_seq_stop);
static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,
- int bucket, int *len)
+ int bucket)
{
struct inet_sock *inet = inet_sk(sp);
__be32 dest = inet->inet_daddr;
@@ -1082,7 +1082,7 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,
__u16 srcp = ntohs(inet->inet_sport);
seq_printf(f, "%5d: %08X:%04X %08X:%04X"
- " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d%n",
+ " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d",
bucket, src, srcp, dest, destp, sp->sk_state,
sk_wmem_alloc_get(sp),
sk_rmem_alloc_get(sp),
@@ -1090,23 +1090,22 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,
from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)),
0, sock_i_ino(sp),
atomic_read(&sp->sk_refcnt), sp,
- atomic_read(&sp->sk_drops), len);
+ atomic_read(&sp->sk_drops));
}
static int ping_v4_seq_show(struct seq_file *seq, void *v)
{
+ seq_setwidth(seq, 127);
if (v == SEQ_START_TOKEN)
- seq_printf(seq, "%-127s\n",
- " sl local_address rem_address st tx_queue "
+ seq_puts(seq, " sl local_address rem_address st tx_queue "
"rx_queue tr tm->when retrnsmt uid timeout "
"inode ref pointer drops");
else {
struct ping_iter_state *state = seq->private;
- int len;
- ping_v4_format_sock(v, seq, state->bucket, &len);
- seq_printf(seq, "%*s\n", 127 - len, "");
+ ping_v4_format_sock(v, seq, state->bucket);
}
+ seq_pad(seq, '\n');
return 0;
}
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b14266b..2948b76 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2598,13 +2598,13 @@ void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo)
EXPORT_SYMBOL(tcp_proc_unregister);
static void get_openreq4(const struct sock *sk, const struct request_sock *req,
- struct seq_file *f, int i, kuid_t uid, int *len)
+ struct seq_file *f, int i, kuid_t uid)
{
const struct inet_request_sock *ireq = inet_rsk(req);
long delta = req->expires - jiffies;
seq_printf(f, "%4d: %08X:%04X %08X:%04X"
- " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK%n",
+ " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK",
i,
ireq->loc_addr,
ntohs(inet_sk(sk)->inet_sport),
@@ -2619,11 +2619,10 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req,
0, /* non standard timer */
0, /* open_requests have no inode */
atomic_read(&sk->sk_refcnt),
- req,
- len);
+ req);
}
-static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
+static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i)
{
int timer_active;
unsigned long timer_expires;
@@ -2662,7 +2661,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0);
seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
- "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d%n",
+ "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d",
i, src, srcp, dest, destp, sk->sk_state,
tp->write_seq - tp->snd_una,
rx_queue,
@@ -2679,12 +2678,11 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
tp->snd_cwnd,
sk->sk_state == TCP_LISTEN ?
(fastopenq ? fastopenq->max_qlen : 0) :
- (tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh),
- len);
+ (tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh));
}
static void get_timewait4_sock(const struct inet_timewait_sock *tw,
- struct seq_file *f, int i, int *len)
+ struct seq_file *f, int i)
{
__be32 dest, src;
__u16 destp, srcp;
@@ -2696,10 +2694,10 @@ static void get_timewait4_sock(const struct inet_timewait_sock *tw,
srcp = ntohs(tw->tw_sport);
seq_printf(f, "%4d: %08X:%04X %08X:%04X"
- " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK%n",
+ " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK",
i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
3, jiffies_delta_to_clock_t(delta), 0, 0, 0, 0,
- atomic_read(&tw->tw_refcnt), tw, len);
+ atomic_read(&tw->tw_refcnt), tw);
}
#define TMPSZ 150
@@ -2707,11 +2705,10 @@ static void get_timewait4_sock(const struct inet_timewait_sock *tw,
static int tcp4_seq_show(struct seq_file *seq, void *v)
{
struct tcp_iter_state *st;
- int len;
+ seq_setwidth(seq, TMPSZ - 1);
if (v == SEQ_START_TOKEN) {
- seq_printf(seq, "%-*s\n", TMPSZ - 1,
- " sl local_address rem_address st tx_queue "
+ seq_puts(seq, " sl local_address rem_address st tx_queue "
"rx_queue tr tm->when retrnsmt uid timeout "
"inode");
goto out;
@@ -2721,17 +2718,17 @@ static int tcp4_seq_show(struct seq_file *seq, void *v)
switch (st->state) {
case TCP_SEQ_STATE_LISTENING:
case TCP_SEQ_STATE_ESTABLISHED:
- get_tcp4_sock(v, seq, st->num, &len);
+ get_tcp4_sock(v, seq, st->num);
break;
case TCP_SEQ_STATE_OPENREQ:
- get_openreq4(st->syn_wait_sk, v, seq, st->num, st->uid, &len);
+ get_openreq4(st->syn_wait_sk, v, seq, st->num, st->uid);
break;
case TCP_SEQ_STATE_TIME_WAIT:
- get_timewait4_sock(v, seq, st->num, &len);
+ get_timewait4_sock(v, seq, st->num);
break;
}
- seq_printf(seq, "%*s\n", TMPSZ - 1 - len, "");
out:
+ seq_pad(seq, '\n');
return 0;
}
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 74d2c95..31c132c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2150,7 +2150,7 @@ EXPORT_SYMBOL(udp_proc_unregister);
/* ------------------------------------------------------------------------ */
static void udp4_format_sock(struct sock *sp, struct seq_file *f,
- int bucket, int *len)
+ int bucket)
{
struct inet_sock *inet = inet_sk(sp);
__be32 dest = inet->inet_daddr;
@@ -2159,7 +2159,7 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f,
__u16 srcp = ntohs(inet->inet_sport);
seq_printf(f, "%5d: %08X:%04X %08X:%04X"
- " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d%n",
+ " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d",
bucket, src, srcp, dest, destp, sp->sk_state,
sk_wmem_alloc_get(sp),
sk_rmem_alloc_get(sp),
@@ -2167,23 +2167,22 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f,
from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)),
0, sock_i_ino(sp),
atomic_read(&sp->sk_refcnt), sp,
- atomic_read(&sp->sk_drops), len);
+ atomic_read(&sp->sk_drops));
}
int udp4_seq_show(struct seq_file *seq, void *v)
{
+ seq_setwidth(seq, 127);
if (v == SEQ_START_TOKEN)
- seq_printf(seq, "%-127s\n",
- " sl local_address rem_address st tx_queue "
+ seq_puts(seq, " sl local_address rem_address st tx_queue "
"rx_queue tr tm->when retrnsmt uid timeout "
"inode ref pointer drops");
else {
struct udp_iter_state *state = seq->private;
- int len;
- udp4_format_sock(v, seq, state->bucket, &len);
- seq_printf(seq, "%*s\n", 127 - len, "");
+ udp4_format_sock(v, seq, state->bucket);
}
+ seq_pad(seq, '\n');
return 0;
}
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index 77e38f7..008214a 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -595,26 +595,25 @@ static void pn_sock_seq_stop(struct seq_file *seq, void *v)
static int pn_sock_seq_show(struct seq_file *seq, void *v)
{
- int len;
-
+ seq_setwidth(seq, 127);
if (v == SEQ_START_TOKEN)
- seq_printf(seq, "%s%n", "pt loc rem rs st tx_queue rx_queue "
- " uid inode ref pointer drops", &len);
+ seq_puts(seq, "pt loc rem rs st tx_queue rx_queue "
+ " uid inode ref pointer drops");
else {
struct sock *sk = v;
struct pn_sock *pn = pn_sk(sk);
seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %lu "
- "%d %pK %d%n",
+ "%d %pK %d",
sk->sk_protocol, pn->sobject, pn->dobject,
pn->resource, sk->sk_state,
sk_wmem_alloc_get(sk), sk_rmem_alloc_get(sk),
from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)),
sock_i_ino(sk),
atomic_read(&sk->sk_refcnt), sk,
- atomic_read(&sk->sk_drops), &len);
+ atomic_read(&sk->sk_drops));
}
- seq_printf(seq, "%*s\n", 127 - len, "");
+ seq_pad(seq, '\n');
return 0;
}
@@ -785,20 +784,19 @@ static void pn_res_seq_stop(struct seq_file *seq, void *v)
static int pn_res_seq_show(struct seq_file *seq, void *v)
{
- int len;
-
+ seq_setwidth(seq, 63);
if (v == SEQ_START_TOKEN)
- seq_printf(seq, "%s%n", "rs uid inode", &len);
+ seq_puts(seq, "rs uid inode");
else {
struct sock **psk = v;
struct sock *sk = *psk;
- seq_printf(seq, "%02X %5u %lu%n",
+ seq_printf(seq, "%02X %5u %lu",
(int) (psk - pnres.sk),
from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)),
- sock_i_ino(sk), &len);
+ sock_i_ino(sk));
}
- seq_printf(seq, "%*s\n", 63 - len, "");
+ seq_pad(seq, '\n');
return 0;
}
diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c
index 5ea573b..647396b 100644
--- a/net/sctp/objcnt.c
+++ b/net/sctp/objcnt.c
@@ -79,12 +79,13 @@ static sctp_dbg_objcnt_entry_t sctp_dbg_objcnt[] = {
*/
static int sctp_objcnt_seq_show(struct seq_file *seq, void *v)
{
- int i, len;
+ int i;
i = (int)*(loff_t *)v;
- seq_printf(seq, "%s: %d%n", sctp_dbg_objcnt[i].label,
- atomic_read(sctp_dbg_objcnt[i].counter), &len);
- seq_printf(seq, "%*s\n", 127 - len, "");
+ seq_setwidth(seq, 127);
+ seq_printf(seq, "%s: %d", sctp_dbg_objcnt[i].label,
+ atomic_read(sctp_dbg_objcnt[i].counter));
+ seq_pad(seq, '\n');
return 0;
}
--
1.7.1
^ permalink raw reply related
* Re: [PATCH 3/3] net: can: c_can_platform: Remove redundant of_match_ptr
From: Marc Kleine-Budde @ 2013-09-30 8:00 UTC (permalink / raw)
To: Sachin Kamat; +Cc: netdev, davem, linux-can
In-Reply-To: <1380515114-2823-3-git-send-email-sachin.kamat@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
On 09/30/2013 06:25 AM, Sachin Kamat wrote:
> The data structure of_match_ptr() protects is always compiled in.
> Hence of_match_ptr() is not needed.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Marc Kleine-Budde <mkl@pengutronix.de>
> Cc: linux-can@vger.kernel.org
Applied to linux-can-next/testing, it will be included in my next pull
request to David Miller.
tnx,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply
* Re: [PATCH 01/21] drivers: remove unnecessary prom.h includes
From: Marc Kleine-Budde @ 2013-09-30 7:54 UTC (permalink / raw)
To: Rob Herring
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Grant Likely, Rob Herring,
Wolfgang Grandegger, linux-can-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1380221456-11192-2-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 949 bytes --]
On 09/26/2013 08:50 PM, Rob Herring wrote:
> From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
>
> Remove unnecessary prom.h includes in preparation to remove implicit
> includes of prom.h.
>
> Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Cc: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
> Cc: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Applied to linux-can-next/testing, it will be included in my next pull
request to David Miller.
tnx,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply
* [net-next PATCH V2] virtio-net: switch to use XPS to choose txq
From: Jason Wang @ 2013-09-30 7:37 UTC (permalink / raw)
To: rusty, mst, virtualization, netdev, linux-kernel
We used to use a percpu structure vq_index to record the cpu to queue
mapping, this is suboptimal since it duplicates the work of XPS and
loses all other XPS functionality such as allowing use to configure
their own transmission steering strategy.
So this patch switches to use XPS and suggest a default mapping when
the number of cpus is equal to the number of queues. With XPS support,
there's no need for keeping per-cpu vq_index and .ndo_select_queue(),
so they were removed also.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
Changes from V1:
- use cpumask_of() instead of allocate dynamically
drivers/net/virtio_net.c | 48 +--------------------------------------------
1 files changed, 2 insertions(+), 46 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index defec2b..4eca652 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -127,9 +127,6 @@ struct virtnet_info {
/* Does the affinity hint is set for virtqueues? */
bool affinity_hint_set;
- /* Per-cpu variable to show the mapping from CPU to virtqueue */
- int __percpu *vq_index;
-
/* CPU hot plug notifier */
struct notifier_block nb;
};
@@ -1063,7 +1060,6 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev,
static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu)
{
int i;
- int cpu;
if (vi->affinity_hint_set) {
for (i = 0; i < vi->max_queue_pairs; i++) {
@@ -1073,16 +1069,6 @@ static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu)
vi->affinity_hint_set = false;
}
-
- i = 0;
- for_each_online_cpu(cpu) {
- if (cpu == hcpu) {
- *per_cpu_ptr(vi->vq_index, cpu) = -1;
- } else {
- *per_cpu_ptr(vi->vq_index, cpu) =
- ++i % vi->curr_queue_pairs;
- }
- }
}
static void virtnet_set_affinity(struct virtnet_info *vi)
@@ -1104,7 +1090,7 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
for_each_online_cpu(cpu) {
virtqueue_set_affinity(vi->rq[i].vq, cpu);
virtqueue_set_affinity(vi->sq[i].vq, cpu);
- *per_cpu_ptr(vi->vq_index, cpu) = i;
+ netif_set_xps_queue(vi->dev, cpumask_of(cpu), i);
i++;
}
@@ -1217,28 +1203,6 @@ static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
return 0;
}
-/* To avoid contending a lock hold by a vcpu who would exit to host, select the
- * txq based on the processor id.
- */
-static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb)
-{
- int txq;
- struct virtnet_info *vi = netdev_priv(dev);
-
- if (skb_rx_queue_recorded(skb)) {
- txq = skb_get_rx_queue(skb);
- } else {
- txq = *__this_cpu_ptr(vi->vq_index);
- if (txq == -1)
- txq = 0;
- }
-
- while (unlikely(txq >= dev->real_num_tx_queues))
- txq -= dev->real_num_tx_queues;
-
- return txq;
-}
-
static const struct net_device_ops virtnet_netdev = {
.ndo_open = virtnet_open,
.ndo_stop = virtnet_close,
@@ -1250,7 +1214,6 @@ static const struct net_device_ops virtnet_netdev = {
.ndo_get_stats64 = virtnet_stats,
.ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
- .ndo_select_queue = virtnet_select_queue,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = virtnet_netpoll,
#endif
@@ -1559,10 +1522,6 @@ static int virtnet_probe(struct virtio_device *vdev)
if (vi->stats == NULL)
goto free;
- vi->vq_index = alloc_percpu(int);
- if (vi->vq_index == NULL)
- goto free_stats;
-
mutex_init(&vi->config_lock);
vi->config_enable = true;
INIT_WORK(&vi->config_work, virtnet_config_changed_work);
@@ -1589,7 +1548,7 @@ static int virtnet_probe(struct virtio_device *vdev)
/* Allocate/initialize the rx/tx queues, and invoke find_vqs */
err = init_vqs(vi);
if (err)
- goto free_index;
+ goto free_stats;
netif_set_real_num_tx_queues(dev, 1);
netif_set_real_num_rx_queues(dev, 1);
@@ -1640,8 +1599,6 @@ free_recv_bufs:
free_vqs:
cancel_delayed_work_sync(&vi->refill);
virtnet_del_vqs(vi);
-free_index:
- free_percpu(vi->vq_index);
free_stats:
free_percpu(vi->stats);
free:
@@ -1678,7 +1635,6 @@ static void virtnet_remove(struct virtio_device *vdev)
flush_work(&vi->config_work);
- free_percpu(vi->vq_index);
free_percpu(vi->stats);
free_netdev(vi->dev);
}
--
1.7.1
^ permalink raw reply related
* [PATCH V5 net-next 3/3] net: cdc_ncm: remove non-standard NCM device IDs
From: Enrico Mioso @ 2013-09-30 4:50 UTC (permalink / raw)
To: Oliver Neukum, Greg Kroah-Hartman, David S. Miller,
Steve Glendinning, Robert de Vries, Hayes Wang, Freddy Xin,
Bjørn Mork, Liu Junliang, open list,
open list:USB NETWORKING DR..., open list:NETWORKING DRIVERS,
ModemManager-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Enrico Mioso
In-Reply-To: <1380516609-31242-1-git-send-email-mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Remove device IDs of NCM-like (but not NCM-conformant) devices, that are
handled by the huawwei_cdc_ncm driver now.
Signed-off-by: Enrico Mioso <mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 62686be..31f43f7 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1236,17 +1236,6 @@ static const struct usb_device_id cdc_devs[] = {
.driver_info = (unsigned long)&wwan_info,
},
- /* Huawei NCM devices disguised as vendor specific */
- { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x16),
- .driver_info = (unsigned long)&wwan_info,
- },
- { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46),
- .driver_info = (unsigned long)&wwan_info,
- },
- { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x76),
- .driver_info = (unsigned long)&wwan_info,
- },
^ permalink raw reply related
* [PATCH V5 net-next 2/3] net: huawei_cdc_ncm: Introduce the huawei_cdc_ncm driver
From: Enrico Mioso @ 2013-09-30 4:50 UTC (permalink / raw)
To: Oliver Neukum, Greg Kroah-Hartman, David S. Miller,
Steve Glendinning, Robert de Vries, Hayes Wang, Freddy Xin,
Bjørn Mork, Liu Junliang, open list,
open list:USB NETWORKING DR..., open list:NETWORKING DRIVERS,
ModemManager-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Enrico Mioso
In-Reply-To: <1380516609-31242-1-git-send-email-mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
This driver supports devices using the NCM protocol as an encapsulation layer
for other protocols, like the E3131 Huawei 3G modem. This drivers approach was
heavily inspired by the qmi_wwan/cdc_mbim approach & code model.
Suggested-by: Bjorn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
Signed-off-by: Enrico Mioso <mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
create mode 100644 drivers/net/usb/huawei_cdc_ncm.c
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 40db312..85e4a01 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -242,6 +242,21 @@ config USB_NET_CDC_NCM
* ST-Ericsson M343 HSPA Mobile Broadband Modem (reference design)
* Ericsson F5521gw Mobile Broadband Module
+config USB_NET_HUAWEI_CDC_NCM
+ tristate "Huawei NCM embedded AT channel support"
+ depends on USB_USBNET
+ select USB_WDM
+ select USB_NET_CDC_NCM
+ help
+ This driver supports huawei-style NCM devices, that use NCM as a
+ transport for other protocols, usually an embedded AT channel.
+ Good examples are:
+ * Huawei E3131
+ * Huawei E3251
+
+ To compile this driver as a module, choose M here: the module will be
+ called huawei_cdc_ncm.ko.
+
config USB_NET_CDC_MBIM
tristate "CDC MBIM support"
depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 8b342cf..b17b5e8 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_USB_IPHETH) += ipheth.o
obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o
obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o
obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o
+obj-$(CONFIG_USB_NET_HUAWEI_CDC_NCM) += huawei_cdc_ncm.o
obj-$(CONFIG_USB_VL600) += lg-vl600.o
obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o
obj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.o
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c
new file mode 100644
index 0000000..ff07b18
--- /dev/null
+++ b/drivers/net/usb/huawei_cdc_ncm.c
@@ -0,0 +1,228 @@
+/* huawei_cdc_ncm.c - handles Huawei devices using the CDC NCM protocol as
+ * transport layer.
+ * Copyright (C) 2013 Enrico Mioso <mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
+ *
+ *
+ * ABSTRACT:
+ * This driver handles devices resembling the CDC NCM standard, but
+ * encapsulating another protocol inside it. An example are some Huawei 3G
+ * devices, exposing an embedded AT channel where you can set up the NCM
+ * connection.
+ * This code has been heavily inspired by the cdc_mbim.c driver, which is
+ * Copyright (c) 2012 Smith Micro Software, Inc.
+ * Copyright (c) 2012 Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/ethtool.h>
+#include <linux/if_vlan.h>
+#include <linux/ip.h>
+#include <linux/mii.h>
+#include <linux/usb.h>
+#include <linux/usb/cdc.h>
+#include <linux/usb/usbnet.h>
+#include <linux/usb/cdc-wdm.h>
+#include <linux/usb/cdc_ncm.h>
+
+/* Driver data */
+struct huawei_cdc_ncm_state {
+ struct cdc_ncm_ctx *ctx;
+ atomic_t pmcount;
+ struct usb_driver *subdriver;
+ struct usb_interface *control;
+ struct usb_interface *data;
+};
+
+static int huawei_cdc_ncm_manage_power(struct usbnet *usbnet_dev, int on)
+{
+ struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
+ int rv = 0;
+
+ if ((on && atomic_add_return(1, &drvstate->pmcount) == 1) ||
+ (!on && atomic_dec_and_test(&drvstate->pmcount))) {
+ rv = usb_autopm_get_interface(usbnet_dev->intf);
+ if (rv < 0)
+ goto err;
+ usbnet_dev->intf->needs_remote_wakeup = on;
+ usb_autopm_put_interface(usbnet_dev->intf);
+ }
+err:
+ return rv;
+}
+
+static int huawei_cdc_ncm_wdm_manage_power(struct usb_interface *intf, int status)
+{
+ struct usbnet *usbnet_dev = usb_get_intfdata(intf);
+
+ /* can be called while disconnecting */
+ if (!usbnet_dev)
+ return 0;
+
+ return huawei_cdc_ncm_manage_power(usbnet_dev, status);
+}
+
+
+static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev, struct usb_interface *intf)
+{
+ struct cdc_ncm_ctx *ctx;
+ struct usb_driver *subdriver = ERR_PTR(-ENODEV);
+ int ret = -ENODEV;
+ struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
+
+ /* altsetting should always be 1 for NCM devices - so we hard-coded
+ * it here
+ */
+ ret = cdc_ncm_bind_common(usbnet_dev, intf, 1);
+ if (ret)
+ goto err;
+
+ ctx = drvstate->ctx;
+
+ if (usbnet_dev->status)
+ /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256
+ * decimal (0x100)"
+ */
+ subdriver = usb_cdc_wdm_register(ctx->control,
+ &usbnet_dev->status->desc,
+ 256, /* wMaxCommand */
+ huawei_cdc_ncm_wdm_manage_power);
+ if (IS_ERR(subdriver)) {
+ ret = PTR_ERR(subdriver);
+ cdc_ncm_unbind(usbnet_dev, intf);
+ goto err;
+ }
+
+ /* Prevent usbnet from using the status descriptor */
+ usbnet_dev->status = NULL;
+
+ drvstate->subdriver = subdriver;
+
+err:
+ return ret;
+}
+
+static void huawei_cdc_ncm_unbind(struct usbnet *usbnet_dev, struct usb_interface *intf)
+{
+ struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
+ struct cdc_ncm_ctx *ctx = drvstate->ctx;
+
+ if (drvstate->subdriver && drvstate->subdriver->disconnect)
+ drvstate->subdriver->disconnect(ctx->control);
+ drvstate->subdriver = NULL;
+
+ cdc_ncm_unbind(usbnet_dev, intf);
+}
+
+static int huawei_cdc_ncm_suspend(struct usb_interface *intf, pm_message_t message)
+{
+ int ret = 0;
+ struct usbnet *usbnet_dev = usb_get_intfdata(intf);
+ struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
+ struct cdc_ncm_ctx *ctx = drvstate->ctx;
+
+ if (ctx == NULL) {
+ ret = -1;
+ goto error;
+ }
+
+ ret = usbnet_suspend(intf, message);
+ if (ret < 0)
+ goto error;
+
+ if (intf == ctx->control &&
+ drvstate->subdriver &&
+ drvstate->subdriver->suspend)
+ ret = drvstate->subdriver->suspend(intf, message);
+ if (ret < 0)
+ usbnet_resume(intf);
+
+error:
+ return ret;
+}
+
+static int huawei_cdc_ncm_resume(struct usb_interface *intf)
+{
+ int ret = 0;
+ struct usbnet *usbnet_dev = usb_get_intfdata(intf);
+ struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
+ bool callsub;
+ struct cdc_ncm_ctx *ctx = drvstate->ctx;
+
+ /* should we call subdriver's resume function? */
+ callsub =
+ (intf == ctx->control &&
+ drvstate->subdriver &&
+ drvstate->subdriver->resume);
+
+ if (callsub)
+ ret = drvstate->subdriver->resume(intf);
+ if (ret < 0)
+ goto err;
+ ret = usbnet_resume(intf);
+ if (ret < 0 && callsub && drvstate->subdriver->suspend)
+ drvstate->subdriver->suspend(intf, PMSG_SUSPEND);
+err:
+ return ret;
+}
+
+static int huawei_cdc_ncm_check_connect(struct usbnet *usbnet_dev)
+{
+ struct cdc_ncm_ctx *ctx;
+
+ ctx = (struct cdc_ncm_ctx *)usbnet_dev->data[0];
+
+ if (ctx == NULL)
+ return 1; /* disconnected */
+
+ return !ctx->connected;
+}
+
+static const struct driver_info huawei_cdc_ncm_info = {
+ .description = "Huawei CDC NCM device",
+ .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN,
+ .bind = huawei_cdc_ncm_bind,
+ .unbind = huawei_cdc_ncm_unbind,
+ .check_connect = huawei_cdc_ncm_check_connect,
+ .manage_power = huawei_cdc_ncm_manage_power,
+ .rx_fixup = cdc_ncm_rx_fixup,
+ .tx_fixup = cdc_ncm_tx_fixup,
+};
+
+static const struct usb_device_id huawei_cdc_ncm_devs[] = {
+ /* Huawei NCM devices disguised as vendor specific */
+ { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x16),
+ .driver_info = (unsigned long)&huawei_cdc_ncm_info,
+ },
+ { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46),
+ .driver_info = (unsigned long)&huawei_cdc_ncm_info,
+ },
+ { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x76),
+ .driver_info = (unsigned long)&huawei_cdc_ncm_info,
+ },
+
+ /* Terminating entry */
+ {
+ },
+};
+MODULE_DEVICE_TABLE(usb, huawei_cdc_ncm_devs);
+
+static struct usb_driver huawei_cdc_ncm_driver = {
+ .name = "huawei_cdc_ncm",
+ .id_table = huawei_cdc_ncm_devs,
+ .probe = usbnet_probe,
+ .disconnect = usbnet_disconnect,
+ .suspend = huawei_cdc_ncm_suspend,
+ .resume = huawei_cdc_ncm_resume,
+ .reset_resume = huawei_cdc_ncm_resume,
+ .supports_autosuspend = 1,
+ .disable_hub_initiated_lpm = 1,
+};
+module_usb_driver(huawei_cdc_ncm_driver);
+MODULE_AUTHOR("Enrico Mioso <mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>");
+MODULE_DESCRIPTION("USB CDC NCM host driver with encapsulated protocol support");
+MODULE_LICENSE("GPL");
--
1.8.4
--
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 related
* [PATCH V5 net-next 1/3] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use
From: Enrico Mioso @ 2013-09-30 4:50 UTC (permalink / raw)
To: Oliver Neukum, Greg Kroah-Hartman, David S. Miller,
Steve Glendinning, Robert de Vries, Hayes Wang, Freddy Xin,
Bjørn Mork, Liu Junliang, open list,
open list:USB NETWORKING DR..., open list:NETWORKING DRIVERS,
ModemManager-devel
Cc: Enrico Mioso
In-Reply-To: <1380516609-31242-1-git-send-email-mrkiko.rs@gmail.com>
Some drivers implementing NCM-like protocols, may re-use those functions, as is
the case in the huawei_cdc_ncm driver.
Export them via EXPORT_SYMBOL_GPL, in accordance with how other functions have
been exported.
Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 43afde8..62686be 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -858,7 +858,7 @@ static void cdc_ncm_txpath_bh(unsigned long param)
}
}
-static struct sk_buff *
+struct sk_buff *
cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
{
struct sk_buff *skb_out;
@@ -885,6 +885,7 @@ error:
return NULL;
}
+EXPORT_SYMBOL_GPL(cdc_ncm_tx_fixup);
/* verify NTB header and return offset of first NDP, or negative error */
int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in)
@@ -965,7 +966,7 @@ error:
}
EXPORT_SYMBOL_GPL(cdc_ncm_rx_verify_ndp16);
-static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
+int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
{
struct sk_buff *skb;
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
@@ -1040,6 +1041,7 @@ err_ndp:
error:
return 0;
}
+EXPORT_SYMBOL_GPL(cdc_ncm_rx_fixup);
static void
cdc_ncm_speed_change(struct cdc_ncm_ctx *ctx,
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index cc25b70..163244b 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -133,3 +133,6 @@ extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign);
extern int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
extern int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);
+struct sk_buff *
+cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
+int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in);
--
1.8.4
^ permalink raw reply related
* [PATCH V5 net-next 0/3] The huawei_cdc_ncm driver
From: Enrico Mioso @ 2013-09-30 4:50 UTC (permalink / raw)
To: Oliver Neukum, Greg Kroah-Hartman, David S. Miller,
Steve Glendinning, Robert de Vries, Hayes Wang, Freddy Xin,
Bjørn Mork, Liu Junliang, open list,
open list:USB NETWORKING DR..., open list:NETWORKING DRIVERS,
ModemManager-devel
Cc: Enrico Mioso
So this is a new, revised, edition of the huawei_cdc_ncm.c driver, which
supports devices resembling the NCM standard, but using it also as a mean
to encapsulate other protocols, as is the case for the Huawei E3131 and
E3251 modem devices.
Some precisations are needed however - and I encourage discussion on this: and
that's why I'm sending this message with a broader CC.
Merging those patches might change:
- the way Modem Manager interacts with those devices
- some regressions might be possible if there are some unknown firmware
variants around (Franko?)
First of all: I observed the behaviours of two devices.
Huawei E3131: this device doesn't accept NDIS setup requests unless they're
sent via the embedded AT channel exposed by this driver.
So actually we gain funcionality in this case!
The second case, is the Huawei E3251: which works with standard NCM driver,
still exposing an AT embedded channel. Whith this patch set applied, you gain
some funcionality, loosing the ability to catch standard NCM events for now.
The device will work in both ways with no problems, but this has to be
acknowledged and discussed. Might be we can develop this driver further to
change this, when more devices are tested.
We where thinking Huawei changed their interfaces on new devices - but probably
this driver only works around a nice firmware bug present in E3131, which
prevented the modem from being used in NDIS mode.
I think committing this is definitely wortth-while, since it will allow for
more Huawei devices to be used without serial connection. Some devices like the
E3251 also, reports some status information only via the embedded AT channel,
at least in my case.
Note: I'm not subscribed to any list except the Modem Manager's one, so please
CC me, thanks!!
Enrico Mioso (3):
net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use
net: huawei_cdc_ncm: Introduce the huawei_cdc_ncm driver
net: cdc_ncm: remove non-standard NCM device IDs
drivers/net/usb/Kconfig | 15 +++
drivers/net/usb/Makefile | 1 +
drivers/net/usb/cdc_ncm.c | 17 +--
drivers/net/usb/huawei_cdc_ncm.c | 228 +++++++++++++++++++++++++++++++++++++++
include/linux/usb/cdc_ncm.h | 3 +
5 files changed, 251 insertions(+), 13 deletions(-)
create mode 100644 drivers/net/usb/huawei_cdc_ncm.c
--
1.8.4
^ permalink raw reply
* Re: [PATCH v3] bgmac: add support for Byte Queue Limits
From: Eric Dumazet @ 2013-09-30 4:34 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: davem, zajec5, netdev
In-Reply-To: <1380455698-5897-1-git-send-email-hauke@hauke-m.de>
On Sun, 2013-09-29 at 13:54 +0200, Hauke Mehrtens wrote:
> This makes it possible to use some more advanced queuing
> techniques with this driver.
>
> When multi queue support will be added some changes to Byte Queue
> handling is needed.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* [PATCH 2/3] net: ethernet: cpsw-phy-sel: Remove redundant of_match_ptr
From: Sachin Kamat @ 2013-09-30 4:25 UTC (permalink / raw)
To: netdev; +Cc: davem, sachin.kamat
In-Reply-To: <1380515114-2823-1-git-send-email-sachin.kamat@linaro.org>
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
drivers/net/ethernet/ti/cpsw-phy-sel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c
index e092ede..148da9a 100644
--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c
@@ -152,7 +152,7 @@ static struct platform_driver cpsw_phy_sel_driver = {
.driver = {
.name = "cpsw-phy-sel",
.owner = THIS_MODULE,
- .of_match_table = of_match_ptr(cpsw_phy_sel_id_table),
+ .of_match_table = cpsw_phy_sel_id_table,
},
};
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/3] net: ethernet: cpsw: Remove redundant of_match_ptr
From: Sachin Kamat @ 2013-09-30 4:25 UTC (permalink / raw)
To: netdev; +Cc: davem, sachin.kamat
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
drivers/net/ethernet/ti/cpsw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 5efb37b..7290f11 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2217,7 +2217,7 @@ static struct platform_driver cpsw_driver = {
.name = "cpsw",
.owner = THIS_MODULE,
.pm = &cpsw_pm_ops,
- .of_match_table = of_match_ptr(cpsw_of_mtable),
+ .of_match_table = cpsw_of_mtable,
},
.probe = cpsw_probe,
.remove = cpsw_remove,
--
1.7.9.5
^ permalink raw reply related
* [PATCH 3/3] net: can: c_can_platform: Remove redundant of_match_ptr
From: Sachin Kamat @ 2013-09-30 4:25 UTC (permalink / raw)
To: netdev; +Cc: davem, sachin.kamat, Marc Kleine-Budde, linux-can
In-Reply-To: <1380515114-2823-1-git-send-email-sachin.kamat@linaro.org>
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org
---
drivers/net/can/c_can/c_can_platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 294ced3..d66ac26 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -322,7 +322,7 @@ static struct platform_driver c_can_plat_driver = {
.driver = {
.name = KBUILD_MODNAME,
.owner = THIS_MODULE,
- .of_match_table = of_match_ptr(c_can_of_table),
+ .of_match_table = c_can_of_table,
},
.probe = c_can_plat_probe,
.remove = c_can_plat_remove,
--
1.7.9.5
^ 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