ipsec through openvpn broken
Hi Yossi, Steffen, I am using ipsec throug openvpn on one of my machines and it stopped working since 4.15. Bisection showed that the culprit is: 5efec5c655dd xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version Reverting the patch does fix it for me. I am seing h_proto being changed from 0x1bac to 0x8 and wireshark doesn't see the ethernet header anymore: Packet sent: Frame 3: 142 bytes on wire (1136 bits), 142 bytes captured (1136 bits) Ethernet II, Src: xx:xx:xx:xx:52:01 (xx:xx:xx:xx:52:01), Dst: IETF-VRRP-VRID_6a (xx:xx:xx:xx:01:6a) Internet Protocol Version 4, Src: xx.xx.xx.xx, Dst: yy.yy.yy.yy User Datagram Protocol, Src Port: 4500, Dst Port: 4500 UDP Encapsulation of IPsec Packets Encapsulating Security Payload ESP SPI: 0xc4bbc7d8 (3300640728) ESP Sequence: 29 Packet received: Frame 6: 128 bytes on wire (1024 bits), 128 bytes captured (1024 bits) Raw packet data Internet Protocol Version 4, Src: xx.xx.xx.xx, Dst: zz.zz.zz.zz User Datagram Protocol, Src Port: 4500, Dst Port: 4500 UDP Encapsulation of IPsec Packets Encapsulating Security Payload ESP SPI: 0xc4bbc7d8 (3300640728) ESP Sequence: 29 -- Regards, Artem Savkov
[no subject]
Good Day, I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing Chong Hing Bank, Hong Kong, Chong Hing Bank Center, 24 Des Voeux Road Central, Hong Kong. I have a business proposal of $ 38,980,369.00. All confirmable documents to back up the claims will be made available to you prior to your acceptance and as soon as I receive your return mail. Best Regards, Alfred Chow.
[PATCH] rtl_bt: Add firmware and configuration files for the Bluetooth parts of RTL8821C and RTL8723D
These devices are new models from Realtek. Updates to driver btrtl will soon be submitted to the kernel. These files were provided by the Realtek developer. Signed-off-by: 陆朱伟Signed-off-by: Larry Finger --- WHENCE | 5 + rtl_bt/rtl8723d_config.bin | Bin 0 -> 10 bytes rtl_bt/rtl8723d_fw.bin | Bin 0 -> 47028 bytes rtl_bt/rtl8821c_config.bin | Bin 0 -> 10 bytes rtl_bt/rtl8821c_fw.bin | Bin 0 -> 37356 bytes 5 files changed, 5 insertions(+) create mode 100644 rtl_bt/rtl8723d_config.bin create mode 100644 rtl_bt/rtl8723d_fw.bin create mode 100644 rtl_bt/rtl8821c_config.bin create mode 100644 rtl_bt/rtl8821c_fw.bin diff --git a/WHENCE b/WHENCE index 368aad1..207cbcf 100644 --- a/WHENCE +++ b/WHENCE @@ -3011,6 +3011,10 @@ File: rtl_bt/rtl8812ae_fw.bin File: rtl_bt/rtl8821a_fw.bin File: rtl_bt/rtl8822b_fw.bin File: rtl_bt/rtl8822b_config.bin +File: rtl_bt/rtl8723d_fw.bin +File: rtl_bt/rtl8723d_config.bin +File: rtl_bt/rtl8821c_fw.bin +File: rtl_bt/rtl8821c_config.bin Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details. @@ -3018,6 +3022,7 @@ Found in vendor driver, linux_bt_usb_2.11.20140423_8723be.rar From https://github.com/troy-tan/driver_store Files rtl_bt/rtl8822b_* came directly from Realtek. These files are updated on April 14, 2017. +Files rtl_bt/rtl8821c_* and rtl_bt/rtl8723d_* came directly from Realtek. -- diff --git a/rtl_bt/rtl8723d_config.bin b/rtl_bt/rtl8723d_config.bin new file mode 100644 index ..bb15fcd4312379eb7d2ebc26ad2240dc87031faf GIT binary patch literal 10 RcmWGtt=!JSaFc @x0+;{* literal 0 HcmV?d1 diff --git a/rtl_bt/rtl8723d_fw.bin b/rtl_bt/rtl8723d_fw.bin new file mode 100644 index ..57f3a5997a8685fb0ead20d8f79d7c012a264f00 GIT binary patch literal 47028 zcmd443tSXemIqwbbT p0KMg0%(mky|{nu_T8-GS+j8Tlnmj-s3pL$9ba1@raLicZADa z9pQB@A-^Wr5q`xb7sv)AsFG1n-~ (_VkCP?N zAP>X&2faaF)4<7D2?kj}UVNZj^DZYh=nV4hICHrF7M{yWGRQ}fuNCP#aNUUf#~X2t zbL9FMyA+ZwQi!?2E|$6(o5m^^M~bEH$dVG#)X9`FWk@N$6SYH{rO>pN`|p{=qoD z;xEAQRev&$ulW~Bj9ut?-TySMO8r8Q4dGV^5`qJv0-+M~mst{KC=?zqOoNW~6 z8`-OIRYR Oi8$5SV)|(Np?a;(%0*lBz{2J!_0N$b2Q*#l^`Z5r66( zPQG+~j7{yS4)A$=o+A+FF?I5vQycx($?RinaUTANl6K_&)dqPU0%Mz#uk${29^dgr zd~;#J`U^rUJ5On$K;ohvE7ebpe7Oiel*TXB9!qsc%Bwry+G8@#9 (@DRp*WJ%st2NNipm4 zM|d6Qg>8=q+3X9QhQO>YR(L=}tyfsO*f}`cES-rZ$E}g47@JCn*m47$mv7}f$!6!? z_s{yS*B89eU3($!p?E9n(0iS&{1Fw$@8w$)HtW{Mqpq4#7T-!GW+Ft} z0dFbShoY@8JbQ^)zDKEZFj?uNj_{k9H@jSn@#H0@EWso9aFTPc+P*BH?{;)E##yuV z-LZC|_q@q62WXC}k5ReRoy=u}M7j2f%;ogH*pR-Mu{WmKtVVs~O1~>jU7B({nVw#u zTGiS$|QW??^n!7%vnho#xLZZcN%-v}=fY}(`S7moRaz@+AL=%R*Z6<7OUFHe z6tsrjprowcmF5=wOT;OM*N7^cDO}WIx`MG9KHsw7i1uWXd+pZvO$i%xn;GK+W_4Q} z#~4@bJ1(YfPFbIf+UPK!sjnHd)nZe$zxnOV!r=mIQ@5qMHEq^LWt>V<;7< #Un8QOP+TiBCoOMRS1 zs1y)AtR%O*DKaBZng+KC9#hy`ZwhZhc)EV9SkpDE-O=?^Pe=Wu9-%(w9${~F@G=QD{up8xe;_`5V7}M+dp_LWka9Bl z)X-ZP2OstvymWoIG`MXDW?$F%^wY&`=yKB0c%fl?uQJTJaNbTSa_fd%s<{DEj zH&%D=5Z$ebo5BU$=A)h5rr@QcmweaHPVb!F9U8Xz>a?RF FM;Nkb8 _=LU#g$HU7AwR| zuOa9-?+e@NH7nJaxp!eiX}Nyd9kSkmr(|ROc)>r-owYU22HKdxuE<9z|KJjOnq1Vn zj9qQcaSJZ?@zvrj?)4YghfLwYt}P@uf0*Uxh9_4xL_=$dRV^>cQ6usUe< zJGas}RY`NX%#|u@rZkgFTUlgfx0>^2=2ZuVnN>IzEQ+^|xz5_=2P~c1%ZyFOr7wyX zVkxStjIFqnxn|A>N9P~Hjq~s=j4h$+7Ehe@1?lw`HOETD=YAEEThK0`PPFQe@tTbP
Re: xfrm, ip tunnel: non released device reference upon device unregistration
Eyal Birgerwrote: Sorry for taking so long to respond. > On Tue, 6 Feb 2018 14:15:09 +0100 > Florian Westphal wrote: > > > Steffen Klassert wrote: > > > I gave the patch a quick try, but still I get this: > > > > > > unregister_netdevice: waiting for dummy1 to become free. Usage > > > count = 2 > > > > Was that with Eyals setup or the bridge one I posted? > > > > If it was Eyals setup, its possible the patch missed hookup > > to whatever tunnel infra is used (the setup I used has ipip tunnel, > > everything is ipv4). > > > > Thanks! > > Indeed the setup I'm testing uses ip6_tunnel. > I have tested a fix in the spirit of the patch and it looks valid > for ip6_tunnel as well. > > It looks though that this change would need to be added to any tunnel > device using dst_cache (vxlan, geneve, gre, ...). Yes. Meanwhile I tested your patch and it works for me too. As your patch is shorter and ipv4/ipv6 seem to take care of refcount put just fine I think your patch is the right way to go. The xfrm_dst size incrase isn't much of a big deal, there is ample of padding at the end so it will still be allocated from same slab. We could reduce num_pols and num_xfrms to u8, which creates a 16 bit hole, then store the cpu number instead of a list pointer. This would limit growth to 16 instead of 24. But, as I said, i do not think its a big deal. > I'm wondering - non-xfrm dsts are already correctly invalidated, > so do you think it makes sense to invalidate caches for devices that > have no xfrm dsts? or maybe I didn't understand the suggestion? See above, I think your patch is the way to go.
[PATCH iproute2-next v2 0/4] ip/tunnel: Unify local/remote endpoint address parsing
Use get_addr_rta() helper to unify address retriveal from netlink message when configuring tunnel and get_addr() to parse endpoint address into @inet_prefix. This is next step towards ip and ipv6 tunnel module merge: endpoint address parsing code will differ only in @family constant being passed to get_addr_rta() and get_addr(). Reviews, comments and suggestions are welcome. v2 Introduce and use inet_prefix_reset_flags() inline helper to initialize @inet_prefix data structure and make code self exmplaining. Set bitlen to zero in link_iptnl.c when kernel does not send corresponding prefixlen and we configure existing tunnel. Thanks, Serhey Serhey Popovych (4): utils: Introduce and use inet_prefix_reset_flags() vti/vti6: Unify local/remote endpoint address parsing gre/gre6: Unify local/remote endpoint address parsing iptnl/ip6tnl: Unify local/remote endpoint and 6rd address parsing include/utils.h|5 +++ ip/iplink_geneve.c |2 +- ip/iplink_vxlan.c |7 ++-- ip/link_gre.c | 57 + ip/link_gre6.c | 38 ++- ip/link_ip6tnl.c | 40 +++- ip/link_iptnl.c| 103 ++-- ip/link_vti.c | 32 ++-- ip/link_vti6.c | 38 ++- 9 files changed, 177 insertions(+), 145 deletions(-) -- 1.7.10.4
RE: ipsec through openvpn broken
> -Original Message- > From: Artem Savkov [mailto:artem.sav...@gmail.com] > Sent: Sunday, February 11, 2018 10:34 AM > To: Yossi Kuperman; Steffen Klassert > > Cc: netdev@vger.kernel.org > Subject: ipsec through openvpn broken > > Hi Yossi, Steffen, > > I am using ipsec throug openvpn on one of my machines and it stopped I was trying to reproduce it and install OpenVPN, but according to their website, it doesn’t support IPSec? > working since 4.15. Bisection showed that the culprit is: > 5efec5c655dd xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version > > Reverting the patch does fix it for me. > > I am seing h_proto being changed from 0x1bac to 0x8 and wireshark > doesn't see the ethernet header anymore: > > Packet sent: > Can you please share the entire packet hex dump (sent and received)? Not sure what 0x1bac should represent. > Frame 3: 142 bytes on wire (1136 bits), 142 bytes captured (1136 bits) > Ethernet II, Src: xx:xx:xx:xx:52:01 (xx:xx:xx:xx:52:01), Dst: > IETF-VRRP-VRID_6a (xx:xx:xx:xx:01:6a) > Internet Protocol Version 4, Src: xx.xx.xx.xx, Dst: yy.yy.yy.yy > User Datagram Protocol, Src Port: 4500, Dst Port: 4500 > UDP Encapsulation of IPsec Packets > Encapsulating Security Payload > ESP SPI: 0xc4bbc7d8 (3300640728) > ESP Sequence: 29 > > > Packet received: > > Frame 6: 128 bytes on wire (1024 bits), 128 bytes captured (1024 bits) > Raw packet data > Internet Protocol Version 4, Src: xx.xx.xx.xx, Dst: zz.zz.zz.zz > User Datagram Protocol, Src Port: 4500, Dst Port: 4500 > UDP Encapsulation of IPsec Packets > Encapsulating Security Payload > ESP SPI: 0xc4bbc7d8 (3300640728) > ESP Sequence: 29 > > -- > Regards, > Artem Savkov
[PATCH iproute2-next v2 2/4] vti/vti6: Unify local/remote endpoint address parsing
We are going to merge link_vti.c and link_vti6.c and this is final step to make their diffs clear and show what needs to be changed during merge. Note that it is safe to omit endpoint address(es) from netlink create request as kernel is aware of such case and will use zero for that endpoint(s). Signed-off-by: Serhey Popovych--- ip/link_vti.c | 32 ip/link_vti6.c | 38 -- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/ip/link_vti.c b/ip/link_vti.c index edd17fe..125fc20 100644 --- a/ip/link_vti.c +++ b/ip/link_vti.c @@ -64,13 +64,17 @@ static int vti_parse_opt(struct link_util *lu, int argc, char **argv, struct rtattr *vtiinfo[IFLA_VTI_MAX + 1]; __be32 ikey = 0; __be32 okey = 0; - unsigned int saddr = 0; - unsigned int daddr = 0; + inet_prefix saddr, daddr; unsigned int link = 0; __u32 fwmark = 0; int len; + inet_prefix_reset_flags(); + inet_prefix_reset_flags(); + if (!(n->nlmsg_flags & NLM_F_CREATE)) { + const struct rtattr *rta; + if (rtnl_talk(, , ) < 0) { get_failed: fprintf(stderr, @@ -96,18 +100,20 @@ get_failed: parse_rtattr_nested(vtiinfo, IFLA_VTI_MAX, linkinfo[IFLA_INFO_DATA]); + rta = vtiinfo[IFLA_VTI_LOCAL]; + if (rta && get_addr_rta(, rta, AF_INET)) + goto get_failed; + + rta = vtiinfo[IFLA_VTI_REMOTE]; + if (rta && get_addr_rta(, rta, AF_INET)) + goto get_failed; + if (vtiinfo[IFLA_VTI_IKEY]) ikey = rta_getattr_u32(vtiinfo[IFLA_VTI_IKEY]); if (vtiinfo[IFLA_VTI_OKEY]) okey = rta_getattr_u32(vtiinfo[IFLA_VTI_OKEY]); - if (vtiinfo[IFLA_VTI_LOCAL]) - saddr = rta_getattr_u32(vtiinfo[IFLA_VTI_LOCAL]); - - if (vtiinfo[IFLA_VTI_REMOTE]) - daddr = rta_getattr_u32(vtiinfo[IFLA_VTI_REMOTE]); - if (vtiinfo[IFLA_VTI_LINK]) link = rta_getattr_u8(vtiinfo[IFLA_VTI_LINK]); @@ -129,10 +135,10 @@ get_failed: okey = tnl_parse_key("okey", *argv); } else if (!matches(*argv, "remote")) { NEXT_ARG(); - daddr = get_addr32(*argv); + get_addr(, *argv, AF_INET); } else if (!matches(*argv, "local")) { NEXT_ARG(); - saddr = get_addr32(*argv); + get_addr(, *argv, AF_INET); } else if (!matches(*argv, "dev")) { NEXT_ARG(); link = ll_name_to_index(*argv); @@ -154,8 +160,10 @@ get_failed: addattr32(n, 1024, IFLA_VTI_IKEY, ikey); addattr32(n, 1024, IFLA_VTI_OKEY, okey); - addattr_l(n, 1024, IFLA_VTI_LOCAL, , 4); - addattr_l(n, 1024, IFLA_VTI_REMOTE, , 4); + if (is_addrtype_inet()) + addattr_l(n, 1024, IFLA_VTI_LOCAL, saddr.data, saddr.bytelen); + if (is_addrtype_inet()) + addattr_l(n, 1024, IFLA_VTI_REMOTE, daddr.data, daddr.bytelen); addattr32(n, 1024, IFLA_VTI_FWMARK, fwmark); if (link) addattr32(n, 1024, IFLA_VTI_LINK, link); diff --git a/ip/link_vti6.c b/ip/link_vti6.c index 1276ebd..9f2c6ac 100644 --- a/ip/link_vti6.c +++ b/ip/link_vti6.c @@ -64,15 +64,19 @@ static int vti6_parse_opt(struct link_util *lu, int argc, char **argv, struct rtattr *tb[IFLA_MAX + 1]; struct rtattr *linkinfo[IFLA_INFO_MAX+1]; struct rtattr *vtiinfo[IFLA_VTI_MAX + 1]; - struct in6_addr saddr = IN6ADDR_ANY_INIT; - struct in6_addr daddr = IN6ADDR_ANY_INIT; __be32 ikey = 0; __be32 okey = 0; + inet_prefix saddr, daddr; unsigned int link = 0; __u32 fwmark = 0; int len; + inet_prefix_reset_flags(); + inet_prefix_reset_flags(); + if (!(n->nlmsg_flags & NLM_F_CREATE)) { + const struct rtattr *rta; + if (rtnl_talk(, , ) < 0) { get_failed: fprintf(stderr, @@ -98,18 +102,20 @@ get_failed: parse_rtattr_nested(vtiinfo, IFLA_VTI_MAX, linkinfo[IFLA_INFO_DATA]); + rta = vtiinfo[IFLA_VTI_LOCAL]; + if (rta && get_addr_rta(, rta, AF_INET6)) + goto get_failed; + + rta = vtiinfo[IFLA_VTI_REMOTE]; + if (rta && get_addr_rta(, rta, AF_INET6)) + goto get_failed; + if (vtiinfo[IFLA_VTI_IKEY]) ikey = rta_getattr_u32(vtiinfo[IFLA_VTI_IKEY]); if
[PATCH iproute2-next v2 3/4] gre/gre6: Unify local/remote endpoint address parsing
We are going to merge link_gre.c and link_gre6.c and this is final step to make their diffs clear and show what needs to be changed during merge. Note that it is safe to omit endpoint address(es) from netlink create request as kernel is aware of such case and will use zero for that endpoint(s). Signed-off-by: Serhey Popovych--- ip/link_gre.c | 57 +--- ip/link_gre6.c | 38 +++-- 2 files changed, 54 insertions(+), 41 deletions(-) diff --git a/ip/link_gre.c b/ip/link_gre.c index e3e5323..df7c12d 100644 --- a/ip/link_gre.c +++ b/ip/link_gre.c @@ -86,8 +86,7 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, __u16 oflags = 0; __be32 ikey = 0; __be32 okey = 0; - unsigned int saddr = 0; - unsigned int daddr = 0; + inet_prefix saddr, daddr; __u8 pmtudisc = 1; __u8 ignore_df = 0; __u8 tos = 0; @@ -104,7 +103,12 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, __u8 erspan_dir = 0; __u16 erspan_hwid = 0; + inet_prefix_reset_flags(); + inet_prefix_reset_flags(); + if (!(n->nlmsg_flags & NLM_F_CREATE)) { + const struct rtattr *rta; + if (rtnl_talk(, , ) < 0) { get_failed: fprintf(stderr, @@ -130,6 +134,14 @@ get_failed: parse_rtattr_nested(greinfo, IFLA_GRE_MAX, linkinfo[IFLA_INFO_DATA]); + rta = greinfo[IFLA_GRE_LOCAL]; + if (rta && get_addr_rta(, rta, AF_INET)) + goto get_failed; + + rta = greinfo[IFLA_GRE_REMOTE]; + if (rta && get_addr_rta(, rta, AF_INET)) + goto get_failed; + if (greinfo[IFLA_GRE_IKEY]) ikey = rta_getattr_u32(greinfo[IFLA_GRE_IKEY]); @@ -142,12 +154,6 @@ get_failed: if (greinfo[IFLA_GRE_OFLAGS]) oflags = rta_getattr_u16(greinfo[IFLA_GRE_OFLAGS]); - if (greinfo[IFLA_GRE_LOCAL]) - saddr = rta_getattr_u32(greinfo[IFLA_GRE_LOCAL]); - - if (greinfo[IFLA_GRE_REMOTE]) - daddr = rta_getattr_u32(greinfo[IFLA_GRE_REMOTE]); - if (greinfo[IFLA_GRE_PMTUDISC]) pmtudisc = rta_getattr_u8( greinfo[IFLA_GRE_PMTUDISC]); @@ -232,10 +238,10 @@ get_failed: pmtudisc = 1; } else if (!matches(*argv, "remote")) { NEXT_ARG(); - daddr = get_addr32(*argv); + get_addr(, *argv, AF_INET); } else if (!matches(*argv, "local")) { NEXT_ARG(); - saddr = get_addr32(*argv); + get_addr(, *argv, AF_INET); } else if (!matches(*argv, "dev")) { NEXT_ARG(); link = ll_name_to_index(*argv); @@ -343,17 +349,20 @@ get_failed: argc--; argv++; } - if (!ikey && IN_MULTICAST(ntohl(daddr))) { - ikey = daddr; - iflags |= GRE_KEY; - } - if (!okey && IN_MULTICAST(ntohl(daddr))) { - okey = daddr; - oflags |= GRE_KEY; - } - if (IN_MULTICAST(ntohl(daddr)) && !saddr) { - fprintf(stderr, "A broadcast tunnel requires a source address.\n"); - return -1; + if (is_addrtype_inet_multi()) { + if (!ikey) { + ikey = daddr.data[0]; + iflags |= GRE_KEY; + } + if (!okey) { + okey = daddr.data[0]; + oflags |= GRE_KEY; + } + if (!is_addrtype_inet_not_unspec()) { + fprintf(stderr, + "A broadcast tunnel requires a source address.\n"); + return -1; + } } if (metadata) { @@ -365,8 +374,10 @@ get_failed: addattr32(n, 1024, IFLA_GRE_OKEY, okey); addattr_l(n, 1024, IFLA_GRE_IFLAGS, , 2); addattr_l(n, 1024, IFLA_GRE_OFLAGS, , 2); - addattr_l(n, 1024, IFLA_GRE_LOCAL, , 4); - addattr_l(n, 1024, IFLA_GRE_REMOTE, , 4); + if (is_addrtype_inet()) + addattr_l(n, 1024, IFLA_GRE_LOCAL, saddr.data, saddr.bytelen); + if (is_addrtype_inet()) + addattr_l(n, 1024, IFLA_GRE_REMOTE, daddr.data, daddr.bytelen); addattr_l(n, 1024, IFLA_GRE_PMTUDISC, , 1); if (ignore_df) addattr8(n, 1024, IFLA_GRE_IGNORE_DF, ignore_df & 1); diff --git a/ip/link_gre6.c b/ip/link_gre6.c index 251ae0e..46f396f 100644 --- a/ip/link_gre6.c +++ b/ip/link_gre6.c
[PATCH iproute2-next v2 4/4] iptnl/ip6tnl: Unify local/remote endpoint and 6rd address parsing
We are going to merge link_iptnl.c and link_ip6tnl.c and this is final step to make their diffs clear and show what needs to be changed during merge. Note that it is safe to omit endpoint address(es) from netlink create request as kernel is aware of such case and will use zero for that endpoint(s). Make sure we initialize ip6rdprefix and ip6rdrelayprefix bitlen in link_iptnl.c only when configuring existing tunnel: if kernel does not submit prefixlen in corresponding attributes preceeding get_addr_rta() will set bitlen to -1 which is incorrect value. Signed-off-by: Serhey Popovych--- ip/link_ip6tnl.c | 40 +++-- ip/link_iptnl.c | 103 +++--- 2 files changed, 73 insertions(+), 70 deletions(-) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 8a45d42..1891947 100644 --- a/ip/link_ip6tnl.c +++ b/ip/link_ip6tnl.c @@ -93,8 +93,7 @@ static int ip6tunnel_parse_opt(struct link_util *lu, int argc, char **argv, struct rtattr *linkinfo[IFLA_INFO_MAX+1]; struct rtattr *iptuninfo[IFLA_IPTUN_MAX + 1]; int len; - struct in6_addr laddr = IN6ADDR_ANY_INIT; - struct in6_addr raddr = IN6ADDR_ANY_INIT; + inet_prefix saddr, daddr; __u8 hop_limit = DEFAULT_TNL_HOP_LIMIT; __u8 encap_limit = IPV6_DEFAULT_TNL_ENCAP_LIMIT; __u32 flowinfo = 0; @@ -108,7 +107,12 @@ static int ip6tunnel_parse_opt(struct link_util *lu, int argc, char **argv, __u8 metadata = 0; __u32 fwmark = 0; + inet_prefix_reset_flags(); + inet_prefix_reset_flags(); + if (!(n->nlmsg_flags & NLM_F_CREATE)) { + const struct rtattr *rta; + if (rtnl_talk(, , ) < 0) { get_failed: fprintf(stderr, @@ -134,13 +138,13 @@ get_failed: parse_rtattr_nested(iptuninfo, IFLA_IPTUN_MAX, linkinfo[IFLA_INFO_DATA]); - if (iptuninfo[IFLA_IPTUN_LOCAL]) - memcpy(, RTA_DATA(iptuninfo[IFLA_IPTUN_LOCAL]), - sizeof(laddr)); + rta = iptuninfo[IFLA_IPTUN_LOCAL]; + if (rta && get_addr_rta(, rta, AF_INET6)) + goto get_failed; - if (iptuninfo[IFLA_IPTUN_REMOTE]) - memcpy(, RTA_DATA(iptuninfo[IFLA_IPTUN_REMOTE]), - sizeof(raddr)); + rta = iptuninfo[IFLA_IPTUN_REMOTE]; + if (rta && get_addr_rta(, rta, AF_INET6)) + goto get_failed; if (iptuninfo[IFLA_IPTUN_TTL]) hop_limit = rta_getattr_u8(iptuninfo[IFLA_IPTUN_TTL]); @@ -185,17 +189,11 @@ get_failed: else invarg("Cannot guess tunnel mode.", *argv); } else if (strcmp(*argv, "remote") == 0) { - inet_prefix addr; - NEXT_ARG(); - get_addr(, *argv, AF_INET6); - memcpy(, addr.data, sizeof(raddr)); + get_addr(, *argv, AF_INET6); } else if (strcmp(*argv, "local") == 0) { - inet_prefix addr; - NEXT_ARG(); - get_addr(, *argv, AF_INET6); - memcpy(, addr.data, sizeof(laddr)); + get_addr(, *argv, AF_INET6); } else if (matches(*argv, "dev") == 0) { NEXT_ARG(); link = ll_name_to_index(*argv); @@ -322,8 +320,14 @@ get_failed: return 0; } - addattr_l(n, 1024, IFLA_IPTUN_LOCAL, , sizeof(laddr)); - addattr_l(n, 1024, IFLA_IPTUN_REMOTE, , sizeof(raddr)); + if (is_addrtype_inet()) { + addattr_l(n, 1024, IFLA_IPTUN_LOCAL, + saddr.data, saddr.bytelen); + } + if (is_addrtype_inet()) { + addattr_l(n, 1024, IFLA_IPTUN_REMOTE, + daddr.data, daddr.bytelen); + } addattr8(n, 1024, IFLA_IPTUN_TTL, hop_limit); addattr8(n, 1024, IFLA_IPTUN_ENCAP_LIMIT, encap_limit); addattr32(n, 1024, IFLA_IPTUN_FLOWINFO, flowinfo); diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c index bc1074e..368d6cc 100644 --- a/ip/link_iptnl.c +++ b/ip/link_iptnl.c @@ -90,16 +90,11 @@ static int iptunnel_parse_opt(struct link_util *lu, int argc, char **argv, struct rtattr *linkinfo[IFLA_INFO_MAX+1]; struct rtattr *iptuninfo[IFLA_IPTUN_MAX + 1]; int len; - __u32 laddr = 0; - __u32 raddr = 0; + inet_prefix saddr, daddr, ip6rdprefix, ip6rdrelayprefix; __u8 pmtudisc = 1; __u8 tos = 0; __u16 iflags = 0; __u8 ttl = 0; - struct in6_addr ip6rdprefix = {}; - __u16 ip6rdprefixlen = 0; - __u32 ip6rdrelayprefix = 0; -
[PATCH iproute2-next v2 1/4] utils: Introduce and use inet_prefix_reset_flags()
Initializing @inet_prefix using C initializers or memset() seems inefficient and unnecessary: only small part of ->data[] field will be used to store address corresponding to ->family. Instead initialize ->flags with zero and assume no other fields accessed before checking corresponding bits in ->flags. For example special helpers (e.g. is_addrtype_*()) can be used to ensure that @inet_prefix contains valid ip or ipv6 address. Signed-off-by: Serhey Popovych--- include/utils.h|5 + ip/iplink_geneve.c |2 +- ip/iplink_vxlan.c |7 --- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/utils.h b/include/utils.h index 4dc514d..ccbf353 100644 --- a/include/utils.h +++ b/include/utils.h @@ -65,6 +65,11 @@ enum { ADDRTYPE_INET_MULTI = ADDRTYPE_INET | ADDRTYPE_MULTI }; +static inline void inet_prefix_reset_flags(inet_prefix *p) +{ + p->flags = 0; +} + static inline bool is_addrtype_inet(const inet_prefix *p) { return p->flags & ADDRTYPE_INET; diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c index c666072..f90bca6 100644 --- a/ip/iplink_geneve.c +++ b/ip/iplink_geneve.c @@ -71,7 +71,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv, bool set_op = (n->nlmsg_type == RTM_NEWLINK && !(n->nlmsg_flags & NLM_F_CREATE)); - daddr.flags = 0; + inet_prefix_reset_flags(); while (argc > 0) { if (!matches(*argv, "id") || diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c index 00875ba..02fdc66 100644 --- a/ip/iplink_vxlan.c +++ b/ip/iplink_vxlan.c @@ -74,8 +74,7 @@ static void check_duparg(__u64 *attrs, int type, const char *key, static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { - inet_prefix saddr; - inet_prefix daddr; + inet_prefix saddr, daddr; __u32 vni = 0; __u8 learning = 1; __u16 dstport = 0; @@ -85,7 +84,9 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv, !(n->nlmsg_flags & NLM_F_CREATE)); saddr.family = daddr.family = AF_UNSPEC; - saddr.flags = daddr.flags = 0; + + inet_prefix_reset_flags(); + inet_prefix_reset_flags(); while (argc > 0) { if (!matches(*argv, "id") || -- 1.7.10.4
Re: [PATCH net] ptr_ring: prevent integer overflow when calculating size
On Sun, Feb 11, 2018 at 11:28:12AM +0800, Jason Wang wrote: > Switch to use dividing to prevent integer overflow when size is too > big to calculate allocation size properly. > > Reported-by: Eric Biggers> Fixes: 6e6e41c31122 ("ptr_ring: fail early if queue occupies more than > KMALLOC_MAX_SIZE") > Signed-off-by: Jason Wang Acked-by: Michael S. Tsirkin > --- > include/linux/ptr_ring.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h > index b884b77..e633522 100644 > --- a/include/linux/ptr_ring.h > +++ b/include/linux/ptr_ring.h > @@ -469,7 +469,7 @@ static inline int ptr_ring_consume_batched_bh(struct > ptr_ring *r, > */ > static inline void **__ptr_ring_init_queue_alloc(unsigned int size, gfp_t > gfp) > { > - if (size * sizeof(void *) > KMALLOC_MAX_SIZE) > + if (size > KMALLOC_MAX_SIZE / sizeof(void *)) > return NULL; > return kvmalloc_array(size, sizeof(void *), gfp | __GFP_ZERO); > } > -- > 2.7.4
[PATCH net-next] trace_events_filter: conditional trace event (tcp_probe full=0)
Recently tcp_probe kernel module has been replaced by trace_event. Old tcp_probe had full=0 option where it only takes a snapshot only when congestion window is changed. However I did not find such functionality in trace_event. This is why I implemented this "conditional trace_event" where a snapshot is taken only if some field is changed. For instance, following filter will record a snapshot only if snd_cwnd field is changed from the previous snapshot: cd /sys/kernel/debug/tracing echo 1 > events/tcp/tcp_probe/enable echo "(sport == 8554 && snd_cwnd =< 0)" > events/tcp/tcp_probe/filter & cat trace_pipe > /home/tamim/net-next/trace.data This will record a snapshot where source port is 8554 and snd_cwnd is not same as the snd_cwnd in previous snapshot. For lack of better operator, I used "=<" to represent the field on which the filter will be applied. The way it works is, it updates the predicate with new value every time. So the next time, if the field is same as in the predicate, the snapshot is ignored. Initially it checks if the field is 0 or not. diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 61e7f06..8d733fa 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -39,6 +39,7 @@ enum filter_op_ids OP_AND, OP_GLOB, OP_NE, +OP_NE_PREV, OP_EQ, OP_LT, OP_LE, @@ -62,6 +63,7 @@ static struct filter_op filter_ops[] = { { OP_AND,"&&",2 }, { OP_GLOB,"~",4 }, { OP_NE,"!=",4 }, +{ OP_NE_PREV, "=<",4 }, { OP_EQ,"==",4 }, { OP_LT,"<",5 }, { OP_LE,"<=",5 }, @@ -202,6 +204,21 @@ static int filter_pred_##size(struct filter_pred *pred, void *event)\ return match;\ } +#define DEFINE_NE_PREV_PRED(size)\ +static int filter_ne_prev_pred_##size(struct filter_pred *pred, void *event)\ +{\ +u##size *addr = (u##size *)(event + pred->offset);\ +u##size val = (u##size)pred->val;\ +int match; \ +\ +match = (val == *addr) ^ pred->not;\ +\ +if(match == 1) \ +pred->val = *addr; \ +return match;\ +} + + DEFINE_COMPARISON_PRED(s64); DEFINE_COMPARISON_PRED(u64); DEFINE_COMPARISON_PRED(s32); @@ -216,6 +233,11 @@ DEFINE_EQUALITY_PRED(32); DEFINE_EQUALITY_PRED(16); DEFINE_EQUALITY_PRED(8); +DEFINE_NE_PREV_PRED(64); +DEFINE_NE_PREV_PRED(32); +DEFINE_NE_PREV_PRED(16); +DEFINE_NE_PREV_PRED(8); + /* Filter predicate for fixed sized arrays of characters */ static int filter_pred_string(struct filter_pred *pred, void *event) { @@ -980,7 +1002,7 @@ int filter_assign_type(const char *type) static bool is_legal_op(struct ftrace_event_field *field, enum filter_op_ids op) { if (is_string_field(field) && -(op != OP_EQ && op != OP_NE && op != OP_GLOB)) +(op != OP_EQ && op != OP_NE && op != OP_GLOB && op != OP_NE_PREV)) return false; if (!is_string_field(field) && op == OP_GLOB) return false; @@ -997,6 +1019,8 @@ static filter_pred_fn_t select_comparison_fn(enum filter_op_ids op, case 8: if (op == OP_EQ || op == OP_NE) fn = filter_pred_64; +else if (op == OP_NE_PREV) +fn = filter_ne_prev_pred_64; else if (field_is_signed) fn = pred_funcs_s64[op - PRED_FUNC_START]; else @@ -1005,6 +1029,8 @@ static filter_pred_fn_t select_comparison_fn(enum filter_op_ids op, case 4: if (op == OP_EQ || op == OP_NE) fn = filter_pred_32; +else if (op == OP_NE_PREV) +fn = filter_ne_prev_pred_32; else if (field_is_signed) fn = pred_funcs_s32[op - PRED_FUNC_START]; else @@ -1013,6 +1039,8 @@ static filter_pred_fn_t select_comparison_fn(enum filter_op_ids op, case 2: if (op == OP_EQ || op == OP_NE) fn = filter_pred_16; +else if (op == OP_NE_PREV) +fn = filter_ne_prev_pred_16; else if (field_is_signed) fn = pred_funcs_s16[op - PRED_FUNC_START]; else @@ -1021,6 +1049,8 @@ static filter_pred_fn_t select_comparison_fn(enum filter_op_ids op, case 1: if (op == OP_EQ || op == OP_NE) fn = filter_pred_8; +else if (op == OP_NE_PREV) +fn = filter_ne_prev_pred_8; else if (field_is_signed) fn = pred_funcs_s8[op - PRED_FUNC_START]; else @@ -1088,7 +1118,7 @@ static int init_pred(struct filter_parse_state *ps,
Re: tg3 crashes under high load, when using 100Mbits
On Fri, Feb 9, 2018 at 10:41 AM, Kai Heng Fengwrote: > Hi Broadcom folks, > > We are now enabling a new platform with tg3 nic, unfortunately we observed > the bug [1] that dated back to 2015. > I tried commit 4419bb1cedcd ("tg3: Add workaround to restrict 5762 MRRS to > 2048”) but it does’t work. > > Do you have any idea how to solve the issue? > > [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1447664 > > Kai-Heng > Thank you for reporting. We will check and update you.
[PATCH RFC net-next 3/4] ipv4: route: dissect flow in input path if fib rules need it
From: Roopa PrabhuDissect flow in fwd path if fib rules require it. Controlled by a flag to avoid penatly for the common case. Flag is set when fib rules with sport, dport and proto match that require flow dissect are installed. Also passes the dissected hash keys to the multipath hash function when applicable to avoid dissecting the flow again. icmp packets will continue to use inner header for hash calculations (Thanks to Nikolay Aleksandrov for some review here). Signed-off-by: Roopa Prabhu --- include/net/ip_fib.h | 2 +- include/net/netns/ipv4.h | 1 + net/ipv4/fib_rules.c | 13 ++--- net/ipv4/fib_semantics.c | 2 +- net/ipv4/route.c | 49 +++- 5 files changed, 49 insertions(+), 18 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index f805243..5ada772 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -371,7 +371,7 @@ int fib_sync_up(struct net_device *dev, unsigned int nh_flags); #ifdef CONFIG_IP_ROUTE_MULTIPATH int fib_multipath_hash(const struct fib_info *fi, const struct flowi4 *fl4, - const struct sk_buff *skb); + const struct sk_buff *skb, struct flow_keys *flkeys); #endif void fib_select_multipath(struct fib_result *res, int hash); void fib_select_path(struct net *net, struct fib_result *res, diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 44668c2..87b8fdc 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -52,6 +52,7 @@ struct netns_ipv4 { #ifdef CONFIG_IP_MULTIPLE_TABLES struct fib_rules_ops*rules_ops; boolfib_has_custom_rules; + boolfib_rules_require_fldissect; struct fib_table __rcu *fib_main; struct fib_table __rcu *fib_default; #endif diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index f204c85..fb6a637 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c @@ -256,14 +256,20 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, net->ipv4.fib_num_tclassid_users++; } #endif - if (tb[FRA_PROTO]) + if (tb[FRA_PROTO]) { rule4->proto = nla_get_u8(tb[FRA_PROTO]); + net->ipv4.fib_rules_require_fldissect = true; + } - if (tb[FRA_DPORT]) + if (tb[FRA_DPORT]) { rule4->dport = nla_get_be16(tb[FRA_DPORT]); + net->ipv4.fib_rules_require_fldissect = true; + } - if (tb[FRA_SPORT]) + if (tb[FRA_SPORT]) { rule4->sport = nla_get_be16(tb[FRA_SPORT]); + net->ipv4.fib_rules_require_fldissect = true; + } rule4->src_len = frh->src_len; rule4->srcmask = inet_make_mask(rule4->src_len); @@ -431,6 +437,7 @@ int __net_init fib4_rules_init(struct net *net) goto fail; net->ipv4.rules_ops = ops; net->ipv4.fib_has_custom_rules = false; + net->ipv4.fib_rules_require_fldissect = false; return 0; fail: diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index c586597..88f66e6 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1767,7 +1767,7 @@ void fib_select_path(struct net *net, struct fib_result *res, #ifdef CONFIG_IP_ROUTE_MULTIPATH if (res->fi->fib_nhs > 1 && oif_check) { - int h = fib_multipath_hash(res->fi, fl4, skb); + int h = fib_multipath_hash(res->fi, fl4, skb, NULL); fib_select_multipath(res, h); } diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 49cc1c1..8889d5e 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1798,7 +1798,7 @@ static void ip_multipath_l3_keys(const struct sk_buff *skb, /* if skb is set it will be used and fl4 can be NULL */ int fib_multipath_hash(const struct fib_info *fi, const struct flowi4 *fl4, - const struct sk_buff *skb) + const struct sk_buff *skb, struct flow_keys *flkeys) { struct net *net = fi->fib_net; struct flow_keys hash_keys; @@ -1825,12 +1825,20 @@ int fib_multipath_hash(const struct fib_info *fi, const struct flowi4 *fl4, if (skb->l4_hash) return skb_get_hash_raw(skb) >> 1; memset(_keys, 0, sizeof(hash_keys)); - skb_flow_dissect_flow_keys(skb, , flag); - hash_keys.addrs.v4addrs.src = keys.addrs.v4addrs.src; - hash_keys.addrs.v4addrs.dst = keys.addrs.v4addrs.dst; - hash_keys.ports.src = keys.ports.src; - hash_keys.ports.dst = keys.ports.dst; - hash_keys.basic.ip_proto = keys.basic.ip_proto; + if (flkeys) { +
[PATCH RFC net-next 1/4] ipv4: fib_rules: support match on sport, dport and ip proto
From: Roopa PrabhuAdd support to match on src port, dst port and ip protocol. Signed-off-by: Roopa Prabhu --- include/uapi/linux/fib_rules.h | 3 +++ net/ipv4/fib_rules.c | 46 -- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/fib_rules.h b/include/uapi/linux/fib_rules.h index 2b642bf..79ff3c2 100644 --- a/include/uapi/linux/fib_rules.h +++ b/include/uapi/linux/fib_rules.h @@ -58,6 +58,9 @@ enum { FRA_PAD, FRA_L3MDEV, /* iif or oif is l3mdev goto its table */ FRA_UID_RANGE, /* UID range */ + FRA_PROTO, /* ip proto */ + FRA_SPORT, /* sport */ + FRA_DPORT, /* dport */ __FRA_MAX }; diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 35d646a..f204c85 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c @@ -45,13 +45,17 @@ struct fib4_rule { #ifdef CONFIG_IP_ROUTE_CLASSID u32 tclassid; #endif + __be16 sport; + __be16 dport; + u8 proto; }; static bool fib4_rule_matchall(const struct fib_rule *rule) { struct fib4_rule *r = container_of(rule, struct fib4_rule, common); - if (r->dst_len || r->src_len || r->tos) + if (r->dst_len || r->src_len || r->tos || r->proto || r->sport || + r->dport) return false; return fib_rule_matchall(rule); } @@ -182,6 +186,15 @@ static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) if (r->tos && (r->tos != fl4->flowi4_tos)) return 0; + if (r->proto && (r->proto != fl4->flowi4_proto)) + return 0; + + if (r->sport && (r->sport != fl4->fl4_sport)) + return 0; + + if (r->dport && (r->dport != fl4->fl4_dport)) + return 0; + return 1; } @@ -243,6 +256,14 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, net->ipv4.fib_num_tclassid_users++; } #endif + if (tb[FRA_PROTO]) + rule4->proto = nla_get_u8(tb[FRA_PROTO]); + + if (tb[FRA_DPORT]) + rule4->dport = nla_get_be16(tb[FRA_DPORT]); + + if (tb[FRA_SPORT]) + rule4->sport = nla_get_be16(tb[FRA_SPORT]); rule4->src_len = frh->src_len; rule4->srcmask = inet_make_mask(rule4->src_len); @@ -301,6 +322,15 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, if (frh->dst_len && (rule4->dst != nla_get_in_addr(tb[FRA_DST]))) return 0; + if (tb[FRA_PROTO] && (rule4->proto != nla_get_u8(tb[FRA_PROTO]))) + return 0; + + if (tb[FRA_SPORT] && (rule4->sport != nla_get_be16(tb[FRA_SPORT]))) + return 0; + + if (tb[FRA_DPORT] && (rule4->dport != nla_get_be16(tb[FRA_DPORT]))) + return 0; + return 1; } @@ -323,6 +353,15 @@ static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb, nla_put_u32(skb, FRA_FLOW, rule4->tclassid)) goto nla_put_failure; #endif + if (rule4->proto && + nla_put_u8(skb, FRA_PROTO, rule4->proto)) + goto nla_put_failure; + if (rule4->sport && + nla_put_be16(skb, FRA_SPORT, rule4->sport)) + goto nla_put_failure; + if (rule4->dport && + nla_put_be16(skb, FRA_DPORT, rule4->dport)) + goto nla_put_failure; return 0; nla_put_failure: @@ -333,7 +372,10 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule) { return nla_total_size(4) /* dst */ + nla_total_size(4) /* src */ - + nla_total_size(4); /* flow */ + + nla_total_size(4) /* flow */ + + nla_total_size(1) /* proto */ + + nla_total_size(2) /* sport */ + + nla_total_size(2); /* dport */ } static void fib4_rule_flush_cache(struct fib_rules_ops *ops) -- 2.1.4
[PATCH RFC net-next 0/4] fib_rules: support sport, dport and proto match
From: Roopa PrabhuThis series extends fib rule match support to include sport, dport and ip proto match (to complete the 5-tuple match support). Common use-cases of Policy based routing in the data center require 5-tuple match. The last 2 patches in the series add a call to flow dissect in the fwd path if required by the installed fib rules (controlled by a flag). Roopa Prabhu (4): ipv4: fib_rules: support match on sport, dport and ip proto ipv6: fib6_rules: support for match on sport, dport and ip proto ipv4: route: dissect flow in input path if fib rules need it ipv6: route: dissect flow in input path if fib rules need it -- sending this as RFC for first review (as net-next is closed) include/net/ip6_route.h| 3 ++- include/net/ip_fib.h | 2 +- include/net/netns/ipv4.h | 1 + include/net/netns/ipv6.h | 1 + include/uapi/linux/fib_rules.h | 3 +++ net/ipv4/fib_rules.c | 55 ++-- net/ipv4/fib_semantics.c | 2 +- net/ipv4/route.c | 46 ++ net/ipv6/fib6_rules.c | 57 +++--- net/ipv6/icmp.c| 2 +- net/ipv6/route.c | 46 +++--- 11 files changed, 189 insertions(+), 29 deletions(-) -- 2.1.4
[PATCH RFC net-next 4/4] ipv6: route: dissect flow in input path if fib rules need it
From: Roopa PrabhuDissect flow in fwd path if fib rules require it. Controlled by a flag to avoid penatly for the common case. Flag is set when fib rules with sport, dport and proto match that require flow dissect are installed. Also passes the dissected hash keys to the multipath hash function when applicable to avoid dissecting the flow again. icmp packets will continue to use inner header for hash calculations. Signed-off-by: Roopa Prabhu --- include/net/ip6_route.h | 3 ++- include/net/netns/ipv6.h | 1 + net/ipv6/fib6_rules.c| 12 +--- net/ipv6/icmp.c | 2 +- net/ipv6/route.c | 45 - 5 files changed, 49 insertions(+), 14 deletions(-) diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 27d23a6..218f89c 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -127,7 +127,8 @@ static inline int ip6_route_get_saddr(struct net *net, struct rt6_info *rt, struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr, const struct in6_addr *saddr, int oif, int flags); -u32 rt6_multipath_hash(const struct flowi6 *fl6, const struct sk_buff *skb); +u32 rt6_multipath_hash(const struct flowi6 *fl6, const struct sk_buff *skb, + struct flow_keys *hkeys); struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6); diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 987cc45..7aca00e 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -72,6 +72,7 @@ struct netns_ipv6 { unsigned longip6_rt_last_gc; #ifdef CONFIG_IPV6_MULTIPLE_TABLES bool fib6_has_custom_rules; + bool fib6_rules_require_fldissect; struct rt6_info *ip6_prohibit_entry; struct rt6_info *ip6_blk_hole_entry; struct fib6_table *fib6_local_tbl; diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 57c0836..68b946d 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -271,14 +271,20 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, rule6->dst.plen = frh->dst_len; rule6->tclass = frh->tos; - if (tb[FRA_PROTO]) + if (tb[FRA_PROTO]) { rule6->proto = nla_get_u8(tb[FRA_PROTO]); + net->ipv6.fib6_rules_require_fldissect = true; + } - if (tb[FRA_SPORT]) + if (tb[FRA_SPORT]) { rule6->sport = nla_get_be16(tb[FRA_SPORT]); + net->ipv6.fib6_rules_require_fldissect = true; + } - if (tb[FRA_DPORT]) + if (tb[FRA_DPORT]) { rule6->dport = nla_get_be16(tb[FRA_DPORT]); + net->ipv6.fib6_rules_require_fldissect = true; + } net->ipv6.fib6_has_custom_rules = true; err = 0; diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 6ae5dd3..6997b2c 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -522,7 +522,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, fl6.fl6_icmp_type = type; fl6.fl6_icmp_code = code; fl6.flowi6_uid = sock_net_uid(net, NULL); - fl6.mp_hash = rt6_multipath_hash(, skb); + fl6.mp_hash = rt6_multipath_hash(, skb, NULL); security_skb_classify_flow(skb, flowi6_to_flowi()); sk = icmpv6_xmit_lock(net); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 9dcfadd..742c312 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -460,7 +460,7 @@ static struct rt6_info *rt6_multipath_select(struct rt6_info *match, * case it will always be non-zero. Otherwise now is the time to do it. */ if (!fl6->mp_hash) - fl6->mp_hash = rt6_multipath_hash(fl6, NULL); + fl6->mp_hash = rt6_multipath_hash(fl6, NULL, NULL); if (fl6->mp_hash <= atomic_read(>rt6i_nh_upper_bound)) return match; @@ -1786,10 +1786,12 @@ struct dst_entry *ip6_route_input_lookup(struct net *net, EXPORT_SYMBOL_GPL(ip6_route_input_lookup); static void ip6_multipath_l3_keys(const struct sk_buff *skb, - struct flow_keys *keys) + struct flow_keys *keys, + struct flow_keys *flkeys) { const struct ipv6hdr *outer_iph = ipv6_hdr(skb); const struct ipv6hdr *key_iph = outer_iph; + struct flow_keys *_flkeys = flkeys; const struct ipv6hdr *inner_iph; const struct icmp6hdr *icmph; struct ipv6hdr _inner_iph; @@ -1811,22 +1813,31 @@ static void ip6_multipath_l3_keys(const struct sk_buff *skb, goto out; key_iph = inner_iph; + _flkeys = NULL; out: memset(keys, 0, sizeof(*keys)); keys->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
[PATCH RFC net-next 2/4] ipv6: fib6_rules: support for match on sport, dport and ip proto
From: Roopa PrabhuAdd support to match on src port, dst port and ip protocol. Signed-off-by: Roopa Prabhu --- net/ipv6/fib6_rules.c | 49 ++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index b240f24..57c0836 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -28,13 +28,17 @@ struct fib6_rule { struct rt6key src; struct rt6key dst; u8 tclass; + u8 proto; + __be16 sport; + __be16 dport; }; static bool fib6_rule_matchall(const struct fib_rule *rule) { struct fib6_rule *r = container_of(rule, struct fib6_rule, common); - if (r->dst.plen || r->src.plen || r->tclass) + if (r->dst.plen || r->src.plen || r->tclass || r->proto || r->sport || + r->dport) return false; return fib_rule_matchall(rule); } @@ -223,6 +227,15 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) if (r->tclass && r->tclass != ip6_tclass(fl6->flowlabel)) return 0; + if (r->proto && r->proto != fl6->flowi6_proto) + return 0; + + if (r->sport && r->sport != fl6->fl6_sport) + return 0; + + if (r->dport && r->dport != fl6->fl6_dport) + return 0; + return 1; } @@ -258,6 +271,15 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, rule6->dst.plen = frh->dst_len; rule6->tclass = frh->tos; + if (tb[FRA_PROTO]) + rule6->proto = nla_get_u8(tb[FRA_PROTO]); + + if (tb[FRA_SPORT]) + rule6->sport = nla_get_be16(tb[FRA_SPORT]); + + if (tb[FRA_DPORT]) + rule6->dport = nla_get_be16(tb[FRA_DPORT]); + net->ipv6.fib6_has_custom_rules = true; err = 0; errout: @@ -286,6 +308,18 @@ static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, nla_memcmp(tb[FRA_DST], >dst.addr, sizeof(struct in6_addr))) return 0; + if (tb[FRA_PROTO] && + (rule6->proto != nla_get_u8(tb[FRA_PROTO]))) + return 0; + + if (tb[FRA_SPORT] && + (rule6->sport != nla_get_be32(tb[FRA_SPORT]))) + return 0; + + if (tb[FRA_DPORT] && + (rule6->dport != nla_get_be32(tb[FRA_DPORT]))) + return 0; + return 1; } @@ -301,7 +335,13 @@ static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb, if ((rule6->dst.plen && nla_put_in6_addr(skb, FRA_DST, >dst.addr)) || (rule6->src.plen && -nla_put_in6_addr(skb, FRA_SRC, >src.addr))) +nla_put_in6_addr(skb, FRA_SRC, >src.addr)) || + (rule6->proto && + nla_put_u8(skb, FRA_PROTO, rule6->proto)) || + (rule6->sport && + nla_put_be16(skb, FRA_SPORT, rule6->sport)) || + (rule6->dport && + nla_put_be16(skb, FRA_DPORT, rule6->dport))) goto nla_put_failure; return 0; @@ -312,7 +352,10 @@ static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb, static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule) { return nla_total_size(16) /* dst */ - + nla_total_size(16); /* src */ + + nla_total_size(16) /* src */ + + nla_total_size(1) /* proto */ + + nla_total_size(2) /* sport */ + + nla_total_size(2); /* dport */ } static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = { -- 2.1.4
Re: [PATCH iproute2-next v2 1/4] utils: Introduce and use inet_prefix_reset_flags()
On 2/11/18 4:48 PM, Stephen Hemminger wrote: > On Sun, 11 Feb 2018 22:02:30 +0200 > Serhey Popovychwrote: > >> +static inline void inet_prefix_reset_flags(inet_prefix *p) >> +{ >> +p->flags = 0; >> +} > > Just do it. > > Wrapper adds nothing here. > I asked for a wrapper to flags b/c embedding 'p->flags = 0' into code hides what it is doing - which is resetting the address type in inet_prefix. If inet_prefix is hiding address family and address type details from the main ip code, details of how it works should be opaque to that code.
[PATCH] mvpp2: fix multicast address filter
IPv6 doesn't work on the MacchiatoBIN board. It is caused by broken multicast address filter in the mvpp2 driver. The driver loads doesn't load any multicast entries if "allmulti" is not set. This condition should be reversed. The condition !netdev_mc_empty(dev) is useless (because netdev_for_each_mc_addr is nop if the list is empty). This patch also fixes a possible overflow of the multicast list - if mvpp2_prs_mac_da_accept fails, we set the allmulti flag and retry. Signed-off-by: Mikulas PatockaCc: sta...@vger.kernel.org --- drivers/net/ethernet/marvell/mvpp2.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) Index: linux-2.6/drivers/net/ethernet/marvell/mvpp2.c === --- linux-2.6.orig/drivers/net/ethernet/marvell/mvpp2.c 2018-02-11 23:40:01.0 +0100 +++ linux-2.6/drivers/net/ethernet/marvell/mvpp2.c 2018-02-11 23:44:09.0 +0100 @@ -7137,6 +7137,7 @@ static void mvpp2_set_rx_mode(struct net int id = port->id; bool allmulti = dev->flags & IFF_ALLMULTI; +retry: mvpp2_prs_mac_promisc_set(priv, id, dev->flags & IFF_PROMISC); mvpp2_prs_mac_multi_set(priv, id, MVPP2_PE_MAC_MC_ALL, allmulti); mvpp2_prs_mac_multi_set(priv, id, MVPP2_PE_MAC_MC_IP6, allmulti); @@ -7144,9 +7145,13 @@ static void mvpp2_set_rx_mode(struct net /* Remove all port->id's mcast enries */ mvpp2_prs_mcast_del_all(priv, id); - if (allmulti && !netdev_mc_empty(dev)) { - netdev_for_each_mc_addr(ha, dev) - mvpp2_prs_mac_da_accept(priv, id, ha->addr, true); + if (!allmulti) { + netdev_for_each_mc_addr(ha, dev) { + if (mvpp2_prs_mac_da_accept(priv, id, ha->addr, true)) { + allmulti = true; + goto retry; + } + } } }
Re: [PATCH iproute2-next v2 1/4] utils: Introduce and use inet_prefix_reset_flags()
On Sun, 11 Feb 2018 22:02:30 +0200 Serhey Popovychwrote: > +static inline void inet_prefix_reset_flags(inet_prefix *p) > +{ > + p->flags = 0; > +} Just do it. Wrapper adds nothing here.
Re: [PATCH RFC net-next 4/4] ipv6: route: dissect flow in input path if fib rules need it
On Sun, Feb 11, 2018 at 02:26:29PM -0800, Roopa Prabhu wrote: > From: Roopa Prabhu> > Dissect flow in fwd path if fib rules require it. Controlled by > a flag to avoid penatly for the common case. Flag is set when fib > rules with sport, dport and proto match that require flow dissect > are installed. Also passes the dissected hash keys to the multipath > hash function when applicable to avoid dissecting the flow again. > icmp packets will continue to use inner header for hash > calculations. > > Signed-off-by: Roopa Prabhu > --- > include/net/ip6_route.h | 3 ++- > include/net/netns/ipv6.h | 1 + > net/ipv6/fib6_rules.c| 12 +--- > net/ipv6/icmp.c | 2 +- > net/ipv6/route.c | 45 - > 5 files changed, 49 insertions(+), 14 deletions(-) > > diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h > index 27d23a6..218f89c 100644 > --- a/include/net/ip6_route.h > +++ b/include/net/ip6_route.h > @@ -127,7 +127,8 @@ static inline int ip6_route_get_saddr(struct net *net, > struct rt6_info *rt, > > struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr, > const struct in6_addr *saddr, int oif, int flags); > -u32 rt6_multipath_hash(const struct flowi6 *fl6, const struct sk_buff *skb); > +u32 rt6_multipath_hash(const struct flowi6 *fl6, const struct sk_buff *skb, > +struct flow_keys *hkeys); > > struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 > *fl6); > > diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h > index 987cc45..7aca00e 100644 > --- a/include/net/netns/ipv6.h > +++ b/include/net/netns/ipv6.h > @@ -72,6 +72,7 @@ struct netns_ipv6 { > unsigned longip6_rt_last_gc; > #ifdef CONFIG_IPV6_MULTIPLE_TABLES > bool fib6_has_custom_rules; > + bool fib6_rules_require_fldissect; > struct rt6_info *ip6_prohibit_entry; > struct rt6_info *ip6_blk_hole_entry; > struct fib6_table *fib6_local_tbl; [...] > @@ -1847,12 +1858,27 @@ void ip6_route_input(struct sk_buff *skb) > .flowi6_mark = skb->mark, > .flowi6_proto = iph->nexthdr, > }; > + struct flow_keys *flkeys = NULL, _flkeys; > > tun_info = skb_tunnel_info(skb); > if (tun_info && !(tun_info->mode & IP_TUNNEL_INFO_TX)) > fl6.flowi6_tun_key.tun_id = tun_info->key.tun_id; > + > +#ifdef CONFIG_IP_MULTIPLE_TABLES s/CONFIG_IP_MULTIPLE_TABLES/CONFIG_IPV6_MULTIPLE_TABLES/ ? > + if (net->ipv6.fib6_rules_require_fldissect) { > + unsigned int flag = FLOW_DISSECTOR_F_STOP_AT_ENCAP; > + > + memset(&_flkeys, 0, sizeof(_flkeys)); > + skb_flow_dissect_flow_keys(skb, &_flkeys, flag); > + fl6.fl6_sport = _flkeys.ports.src; > + fl6.fl6_dport = _flkeys.ports.dst; > + fl6.flowi6_proto = _flkeys.basic.ip_proto; > + flkeys = &_flkeys; > + } > +#endif
[PATCH] headers: untangle kmemleak.h from mm.h
From: Randy DunlapCurrently #includes for no obvious reason. It looks like it's only a convenience, so remove kmemleak.h from slab.h and add to any users of kmemleak_* that don't already #include it. Also remove from source files that do not use it. This is tested on i386 allmodconfig and x86_64 allmodconfig. It would be good to run it through the 0day bot for other $ARCHes. I have neither the horsepower nor the storage space for the other $ARCHes. [slab.h is the second most used header file after module.h; kernel.h is right there with slab.h. There could be some minor error in the counting due to some #includes having comments after them and I didn't combine all of those.] This is Lingchi patch #1 (death by a thousand cuts, applied to kernel header files). Signed-off-by: Randy Dunlap --- Fengguang, can you have this patch run thru 0day builds, please? arch/powerpc/sysdev/dart_iommu.c |1 + arch/powerpc/sysdev/msi_bitmap.c |1 + arch/s390/kernel/nmi.c|2 +- arch/s390/kernel/smp.c|1 - arch/sparc/kernel/irq_64.c|1 - arch/x86/kernel/pci-dma.c |1 - drivers/iommu/exynos-iommu.c |1 + drivers/iommu/mtk_iommu_v1.c |1 - drivers/net/ethernet/ti/cpsw.c|1 + drivers/net/wireless/realtek/rtlwifi/pci.c|1 - drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c |1 - drivers/staging/rtl8188eu/hal/fw.c|2 +- drivers/staging/rtlwifi/pci.c |1 - drivers/virtio/virtio_ring.c |1 - include/linux/slab.h |1 - kernel/ucount.c |1 + mm/cma.c |1 + mm/memblock.c |1 + net/core/sysctl_net_core.c|1 - net/ipv4/route.c |1 - security/apparmor/lsm.c |1 - 21 files changed, 9 insertions(+), 14 deletions(-) --- lnx-416-rc1.orig/include/linux/slab.h +++ lnx-416-rc1/include/linux/slab.h @@ -125,7 +125,6 @@ #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ (unsigned long)ZERO_SIZE_PTR) -#include #include struct mem_cgroup; --- lnx-416-rc1.orig/kernel/ucount.c +++ lnx-416-rc1/kernel/ucount.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #define UCOUNTS_HASHTABLE_BITS 10 --- lnx-416-rc1.orig/mm/memblock.c +++ lnx-416-rc1/mm/memblock.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include --- lnx-416-rc1.orig/mm/cma.c +++ lnx-416-rc1/mm/cma.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "cma.h" --- lnx-416-rc1.orig/drivers/staging/rtl8188eu/hal/fw.c +++ lnx-416-rc1/drivers/staging/rtl8188eu/hal/fw.c @@ -30,7 +30,7 @@ #include "rtl8188e_hal.h" #include -#include +#include static void _rtl88e_enable_fw_download(struct adapter *adapt, bool enable) { --- lnx-416-rc1.orig/drivers/iommu/exynos-iommu.c +++ lnx-416-rc1/drivers/iommu/exynos-iommu.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include --- lnx-416-rc1.orig/arch/s390/kernel/nmi.c +++ lnx-416-rc1/arch/s390/kernel/nmi.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include --- lnx-416-rc1.orig/arch/powerpc/sysdev/dart_iommu.c +++ lnx-416-rc1/arch/powerpc/sysdev/dart_iommu.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include --- lnx-416-rc1.orig/arch/powerpc/sysdev/msi_bitmap.c +++ lnx-416-rc1/arch/powerpc/sysdev/msi_bitmap.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include --- lnx-416-rc1.orig/drivers/net/ethernet/ti/cpsw.c +++ lnx-416-rc1/drivers/net/ethernet/ti/cpsw.c @@ -35,6 +35,7 @@ #include #include #include +#include #include --- lnx-416-rc1.orig/drivers/virtio/virtio_ring.c +++ lnx-416-rc1/drivers/virtio/virtio_ring.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include --- lnx-416-rc1.orig/security/apparmor/lsm.c +++ lnx-416-rc1/security/apparmor/lsm.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include "include/apparmor.h" --- lnx-416-rc1.orig/drivers/iommu/mtk_iommu_v1.c +++ lnx-416-rc1/drivers/iommu/mtk_iommu_v1.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include --- lnx-416-rc1.orig/drivers/staging/rtlwifi/pci.c +++
Re: [PATCH] headers: untangle kmemleak.h from mm.h
* Randy Dunlapwrote: > From: Randy Dunlap > > Currently #includes for no obvious > reason. It looks like it's only a convenience, so remove kmemleak.h > from slab.h and add to any users of kmemleak_* > that don't already #include it. > Also remove from source files that do not use it. > > This is tested on i386 allmodconfig and x86_64 allmodconfig. It > would be good to run it through the 0day bot for other $ARCHes. > I have neither the horsepower nor the storage space for the other > $ARCHes. > > [slab.h is the second most used header file after module.h; kernel.h > is right there with slab.h. There could be some minor error in the > counting due to some #includes having comments after them and I > didn't combine all of those.] > > This is Lingchi patch #1 (death by a thousand cuts, applied to kernel > header files). > > Signed-off-by: Randy Dunlap Nice find: Reviewed-by: Ingo Molnar I agree that it needs to go through 0-day to find any hidden dependencies we might have grown due to this. Thanks, Ingo
[PATCH net v4 13/13] net/sonic: Replace custom debug logging with netif_* calls
Eliminate duplicated debug code by moving it into the core driver. Don't log the only valid silicon revision number (it's in the source). Cc: Thomas BogendoerferCc: Chris Zankel Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Only the sonic.[ch] and macsonic.c changes have been tested. The other changes are similar but untested. --- drivers/net/ethernet/natsemi/jazzsonic.c | 19 +-- drivers/net/ethernet/natsemi/macsonic.c | 25 ++--- drivers/net/ethernet/natsemi/sonic.c | 92 +++- drivers/net/ethernet/natsemi/sonic.h | 2 + drivers/net/ethernet/natsemi/xtsonic.c | 19 +-- 5 files changed, 54 insertions(+), 103 deletions(-) diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c index 58495316d318..51fa82b429a3 100644 --- a/drivers/net/ethernet/natsemi/jazzsonic.c +++ b/drivers/net/ethernet/natsemi/jazzsonic.c @@ -60,14 +60,6 @@ do { \ *((volatile unsigned int *)dev->base_addr+(reg)) = (val); \ } while (0) - -/* use 0 for production, 1 for verification, >1 for debug */ -#ifdef SONIC_DEBUG -static unsigned int sonic_debug = SONIC_DEBUG; -#else -static unsigned int sonic_debug = 1; -#endif - /* * We cannot use station (ethernet) address prefixes to detect the * sonic controller since these are board manufacturer depended. @@ -117,7 +109,6 @@ static const struct net_device_ops sonic_netdev_ops = { static int sonic_probe1(struct net_device *dev) { - static unsigned version_printed; unsigned int silicon_revision; unsigned int val; struct sonic_local *lp = netdev_priv(dev); @@ -133,9 +124,6 @@ static int sonic_probe1(struct net_device *dev) * the expected location. */ silicon_revision = SONIC_READ(SONIC_SR); - if (sonic_debug > 1) - printk("SONIC Silicon Revision = 0x%04x\n",silicon_revision); - i = 0; while (known_revisions[i] != 0x && known_revisions[i] != silicon_revision) @@ -147,9 +135,6 @@ static int sonic_probe1(struct net_device *dev) goto out; } - if (sonic_debug && version_printed++ == 0) - printk(version); - /* * Put the sonic into software reset, then * retrieve and print the ethernet address. @@ -246,6 +231,8 @@ static int jazz_sonic_probe(struct platform_device *pdev) pr_info("SONIC ethernet @%08lx, MAC %pM, IRQ %d\n", dev->base_addr, dev->dev_addr, dev->irq); + sonic_msg_init(dev); + err = register_netdev(dev); if (err) goto out1; @@ -261,8 +248,6 @@ static int jazz_sonic_probe(struct platform_device *pdev) } MODULE_DESCRIPTION("Jazz SONIC ethernet driver"); -module_param(sonic_debug, int, 0); -MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)"); MODULE_ALIAS("platform:jazzsonic"); #include "sonic.c" diff --git a/drivers/net/ethernet/natsemi/macsonic.c b/drivers/net/ethernet/natsemi/macsonic.c index a2d1d1587433..54acaaeef1f3 100644 --- a/drivers/net/ethernet/natsemi/macsonic.c +++ b/drivers/net/ethernet/natsemi/macsonic.c @@ -70,15 +70,6 @@ #define SONIC_WRITE(reg,val) (nubus_writew(val, dev->base_addr + (reg * 4) \ + lp->reg_offset)) -/* use 0 for production, 1 for verification, >1 for debug */ -#ifdef SONIC_DEBUG -static unsigned int sonic_debug = SONIC_DEBUG; -#else -static unsigned int sonic_debug = 1; -#endif - -static int sonic_version_printed; - /* For onboard SONIC */ #define ONBOARD_SONIC_REGISTERS0x50F0A000 #define ONBOARD_SONIC_PROM_BASE0x50f08000 @@ -336,11 +327,6 @@ static int mac_onboard_sonic_probe(struct net_device *dev) else dev->irq = IRQ_NUBUS_9; - if (!sonic_version_printed) { - printk(KERN_INFO "%s", version); - sonic_version_printed = 1; - } - /* The PowerBook's SONIC is 16 bit always. */ if (macintosh_config->ident == MAC_MODEL_PB520) { lp->reg_offset = 0; @@ -502,11 +488,6 @@ static int mac_sonic_nubus_probe_board(struct nubus_board *board, int id, lp->dma_bitmode = dma_bitmode; dev->irq = SLOT2IRQ(board->slot); - if (!sonic_version_printed) { - printk(KERN_INFO "%s", version); - sonic_version_printed = 1; - } - dev_info(>dev, "%s, revision 0x%04x, %d bit DMA, register offset %d\n", board->name, SONIC_READ(SONIC_SR), lp->dma_bitmode ? 32 : 16, lp->reg_offset); @@ -558,6 +539,8 @@ static int mac_sonic_platform_probe(struct platform_device *pdev) if (err) goto out; + sonic_msg_init(dev); + err = register_netdev(dev); if (err)
[PATCH net v4 11/13] net/macsonic: Convert to nubus_driver
This resolves an old issue preventing any NuBus SONIC NICs from working in a Mac with an on-board SONIC device. Tested-by: Stan JohnsonSigned-off-by: Finn Thain --- drivers/net/ethernet/natsemi/macsonic.c | 172 ++-- 1 file changed, 118 insertions(+), 54 deletions(-) diff --git a/drivers/net/ethernet/natsemi/macsonic.c b/drivers/net/ethernet/natsemi/macsonic.c index b922ab5cedea..14b25175dc2f 100644 --- a/drivers/net/ethernet/natsemi/macsonic.c +++ b/drivers/net/ethernet/natsemi/macsonic.c @@ -60,8 +60,6 @@ #include #include -static char mac_sonic_string[] = "macsonic"; - #include "sonic.h" /* These should basically be bus-size and endian independent (since @@ -410,7 +408,7 @@ static int mac_onboard_sonic_probe(struct net_device *dev) return macsonic_init(dev); } -static int mac_nubus_sonic_ethernet_addr(struct net_device *dev, +static int mac_sonic_nubus_ethernet_addr(struct net_device *dev, unsigned long prom_addr, int id) { int i; @@ -449,70 +447,49 @@ static int macsonic_ident(struct nubus_rsrc *fres) return -1; } -static int mac_nubus_sonic_probe(struct net_device *dev) +static int mac_sonic_nubus_probe_board(struct nubus_board *board, int id, + struct net_device *dev) { - static int slots; - struct nubus_rsrc *ndev = NULL; struct sonic_local* lp = netdev_priv(dev); unsigned long base_addr, prom_addr; u16 sonic_dcr; - int id = -1; int reg_offset, dma_bitmode; - /* Find the first SONIC that hasn't been initialized already */ - for_each_func_rsrc(ndev) { - if (ndev->category != NUBUS_CAT_NETWORK || - ndev->type != NUBUS_TYPE_ETHERNET) - continue; - - /* Have we seen it already? */ - if (slots & (1 slot)) - continue; - slots |= 1 slot; - - /* Is it one of ours? */ - if ((id = macsonic_ident(ndev)) != -1) - break; - } - - if (ndev == NULL) - return -ENODEV; - switch (id) { case MACSONIC_DUODOCK: - base_addr = ndev->board->slot_addr + DUODOCK_SONIC_REGISTERS; - prom_addr = ndev->board->slot_addr + DUODOCK_SONIC_PROM_BASE; + base_addr = board->slot_addr + DUODOCK_SONIC_REGISTERS; + prom_addr = board->slot_addr + DUODOCK_SONIC_PROM_BASE; sonic_dcr = SONIC_DCR_EXBUS | SONIC_DCR_RFT0 | SONIC_DCR_RFT1 | SONIC_DCR_TFT0; reg_offset = 2; dma_bitmode = SONIC_BITMODE32; break; case MACSONIC_APPLE: - base_addr = ndev->board->slot_addr + APPLE_SONIC_REGISTERS; - prom_addr = ndev->board->slot_addr + APPLE_SONIC_PROM_BASE; + base_addr = board->slot_addr + APPLE_SONIC_REGISTERS; + prom_addr = board->slot_addr + APPLE_SONIC_PROM_BASE; sonic_dcr = SONIC_DCR_BMS | SONIC_DCR_RFT1 | SONIC_DCR_TFT0; reg_offset = 0; dma_bitmode = SONIC_BITMODE32; break; case MACSONIC_APPLE16: - base_addr = ndev->board->slot_addr + APPLE_SONIC_REGISTERS; - prom_addr = ndev->board->slot_addr + APPLE_SONIC_PROM_BASE; + base_addr = board->slot_addr + APPLE_SONIC_REGISTERS; + prom_addr = board->slot_addr + APPLE_SONIC_PROM_BASE; sonic_dcr = SONIC_DCR_EXBUS | SONIC_DCR_RFT1 | SONIC_DCR_TFT0 | SONIC_DCR_PO1 | SONIC_DCR_BMS; reg_offset = 0; dma_bitmode = SONIC_BITMODE16; break; case MACSONIC_DAYNALINK: - base_addr = ndev->board->slot_addr + APPLE_SONIC_REGISTERS; - prom_addr = ndev->board->slot_addr + DAYNALINK_PROM_BASE; + base_addr = board->slot_addr + APPLE_SONIC_REGISTERS; + prom_addr = board->slot_addr + DAYNALINK_PROM_BASE; sonic_dcr = SONIC_DCR_RFT1 | SONIC_DCR_TFT0 | SONIC_DCR_PO1 | SONIC_DCR_BMS; reg_offset = 0; dma_bitmode = SONIC_BITMODE16; break; case MACSONIC_DAYNA: - base_addr = ndev->board->slot_addr + DAYNA_SONIC_REGISTERS; - prom_addr = ndev->board->slot_addr + DAYNA_SONIC_MAC_ADDR; + base_addr = board->slot_addr + DAYNA_SONIC_REGISTERS; + prom_addr = board->slot_addr + DAYNA_SONIC_MAC_ADDR; sonic_dcr = SONIC_DCR_BMS | SONIC_DCR_RFT1 | SONIC_DCR_TFT0 | SONIC_DCR_PO1; reg_offset = 0; @@ -528,14 +505,14 @@ static int mac_nubus_sonic_probe(struct net_device
[PATCH net v4 02/13] net/8390: Fix msg_enable patch snafu
The lib8390 module parameter 'msg_enable' doesn't do anything useful: it causes an ancient version string to be logged. Remove redundant code that logs the same string. In ne.c and wd.c, the value of ei_local->msg_enable is used before being assigned. Use ne_msg_enable and wd_msg_enable, respectively. Most of the other 8390 drivers never assign ei_local->msg_enable. Use the 'msg_enable' module parameter from lib8390 as the default value. Eliminate the pointless static and local variables. Clean up an indentation mistake. All of these issues originated from the same patch. Cc: Russell KingFixes: c45f812f0280 ("8390 : Replace ei_debug with msg_enable/NETIF_MSG_* feature") Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Only the mac8390.c and lib8390.c changes have been tested. The other changes are similar but untested. --- drivers/net/ethernet/8390/ax88796.c | 3 --- drivers/net/ethernet/8390/axnet_cs.c | 2 -- drivers/net/ethernet/8390/etherh.c| 17 - drivers/net/ethernet/8390/hydra.c | 4 drivers/net/ethernet/8390/lib8390.c | 2 ++ drivers/net/ethernet/8390/mac8390.c | 8 drivers/net/ethernet/8390/mcf8390.c | 4 drivers/net/ethernet/8390/ne.c| 2 +- drivers/net/ethernet/8390/pcnet_cs.c | 4 drivers/net/ethernet/8390/wd.c| 2 +- drivers/net/ethernet/8390/zorro8390.c | 5 - 11 files changed, 4 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 245554707163..da61cf3cb3a9 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -77,8 +77,6 @@ static unsigned char version[] = "ax88796.c: Copyright 2005,2007 Simtec Electron #define AX_GPOC_PPDSET BIT(6) -static u32 ax_msg_enable; - /* device private data */ struct ax_device { @@ -747,7 +745,6 @@ static int ax_init_dev(struct net_device *dev) ei_local->block_output = _block_output; ei_local->get_8390_hdr = _get_8390_hdr; ei_local->priv = 0; - ei_local->msg_enable = ax_msg_enable; dev->netdev_ops = _netdev_ops; dev->ethtool_ops = _ethtool_ops; diff --git a/drivers/net/ethernet/8390/axnet_cs.c b/drivers/net/ethernet/8390/axnet_cs.c index 7bddb8efb6d5..d422a124cd7c 100644 --- a/drivers/net/ethernet/8390/axnet_cs.c +++ b/drivers/net/ethernet/8390/axnet_cs.c @@ -104,7 +104,6 @@ static void AX88190_init(struct net_device *dev, int startp); static int ax_open(struct net_device *dev); static int ax_close(struct net_device *dev); static irqreturn_t ax_interrupt(int irq, void *dev_id); -static u32 axnet_msg_enable; /**/ @@ -151,7 +150,6 @@ static int axnet_probe(struct pcmcia_device *link) return -ENOMEM; ei_local = netdev_priv(dev); -ei_local->msg_enable = axnet_msg_enable; spin_lock_init(_local->page_lock); info = PRIV(dev); diff --git a/drivers/net/ethernet/8390/etherh.c b/drivers/net/ethernet/8390/etherh.c index 11cbf22ad201..32e9627e3880 100644 --- a/drivers/net/ethernet/8390/etherh.c +++ b/drivers/net/ethernet/8390/etherh.c @@ -64,8 +64,6 @@ static char version[] = #include "lib8390.c" -static u32 etherh_msg_enable; - struct etherh_priv { void __iomem*ioc_fast; void __iomem*memc; @@ -502,18 +500,6 @@ etherh_close(struct net_device *dev) } /* - * Initialisation - */ - -static void __init etherh_banner(void) -{ - static int version_printed; - - if ((etherh_msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0)) - pr_info("%s", version); -} - -/* * Read the ethernet address string from the on board rom. * This is an ascii string... */ @@ -671,8 +657,6 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) struct etherh_priv *eh; int ret; - etherh_banner(); - ret = ecard_request_resources(ec); if (ret) goto out; @@ -757,7 +741,6 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) ei_local->block_output = etherh_block_output; ei_local->get_8390_hdr = etherh_get_header; ei_local->interface_num = 0; - ei_local->msg_enable = etherh_msg_enable; etherh_reset(dev); __NS8390_init(dev, 0); diff --git a/drivers/net/ethernet/8390/hydra.c b/drivers/net/ethernet/8390/hydra.c index 8ae249195301..941754ea78ec 100644 --- a/drivers/net/ethernet/8390/hydra.c +++ b/drivers/net/ethernet/8390/hydra.c @@ -66,7 +66,6 @@ static void hydra_block_input(struct net_device *dev, int count, static void hydra_block_output(struct net_device *dev, int count, const unsigned char *buf, int start_page); static void hydra_remove_one(struct zorro_dev *z); -static u32 hydra_msg_enable; static struct zorro_device_id
[PATCH net v4 06/13] net/mac89x0: Convert to platform_driver
Apparently these Dayna cards don't have a pseudoslot declaration ROM which means they can't be probed like NuBus cards. Cc: Geert UytterhoevenSigned-off-by: Finn Thain --- arch/m68k/mac/config.c| 4 ++ drivers/net/Space.c | 3 -- drivers/net/ethernet/cirrus/mac89x0.c | 69 --- include/net/Space.h | 1 - 4 files changed, 35 insertions(+), 42 deletions(-) diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index d3d435248a24..c73eb8209555 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -1088,6 +1088,10 @@ int __init mac_platform_init(void) macintosh_config->expansion_type == MAC_EXP_PDS_COMM) platform_device_register_simple("macsonic", -1, NULL, 0); + if (macintosh_config->expansion_type == MAC_EXP_PDS || + macintosh_config->expansion_type == MAC_EXP_PDS_COMM) + platform_device_register_simple("mac89x0", -1, NULL, 0); + if (macintosh_config->ether_type == MAC_ETHER_MACE) platform_device_register_simple("macmace", -1, NULL, 0); diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 11fe71278f40..fe123808c6b8 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c @@ -117,9 +117,6 @@ static struct devprobe2 m68k_probes[] __initdata = { #ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */ {mac8390_probe, 0}, #endif -#ifdef CONFIG_MAC89x0 - {mac89x0_probe, 0}, -#endif {NULL, 0}, }; diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c index 4fe0ae93ab36..7f7c72409921 100644 --- a/drivers/net/ethernet/cirrus/mac89x0.c +++ b/drivers/net/ethernet/cirrus/mac89x0.c @@ -93,6 +93,7 @@ static const char version[] = #include #include #include +#include #include #include #include @@ -105,6 +106,10 @@ static const char version[] = #include "cs89x0.h" +static int debug; +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); + static unsigned int net_debug = NET_DEBUG; /* Information that need to be kept for each board. */ @@ -167,10 +172,9 @@ static const struct net_device_ops mac89x0_netdev_ops = { /* Probe for the CS8900 card in slot E. We won't bother looking anywhere else until we have a really good reason to do so. */ -struct net_device * __init mac89x0_probe(int unit) +static int mac89x0_device_probe(struct platform_device *pdev) { struct net_device *dev; - static int once_is_enough; struct net_local *lp; static unsigned version_printed; int i, slot; @@ -181,20 +185,13 @@ struct net_device * __init mac89x0_probe(int unit) struct nubus_rsrc *fres; if (!MACH_IS_MAC) - return ERR_PTR(-ENODEV); + return -ENODEV; + + net_debug = debug; dev = alloc_etherdev(sizeof(struct net_local)); if (!dev) - return ERR_PTR(-ENOMEM); - - if (unit >= 0) { - sprintf(dev->name, "eth%d", unit); - netdev_boot_setup_check(dev); - } - - if (once_is_enough) - goto out; - once_is_enough = 1; + return -ENOMEM; /* We might have to parameterize this later */ slot = 0xE; @@ -221,6 +218,8 @@ struct net_device * __init mac89x0_probe(int unit) if (sig != swab16(CHIP_EISA_ID_SIG)) goto out; + SET_NETDEV_DEV(dev, >dev); + /* Initialize the net_device structure. */ lp = netdev_priv(dev); @@ -280,12 +279,14 @@ struct net_device * __init mac89x0_probe(int unit) err = register_netdev(dev); if (err) goto out1; - return NULL; + + platform_set_drvdata(pdev, dev); + return 0; out1: nubus_writew(0, dev->base_addr + ADD_PORT); out: free_netdev(dev); - return ERR_PTR(err); + return err; } /* Open/initialize the board. This is called (in the current kernel) @@ -571,32 +572,24 @@ static int set_mac_address(struct net_device *dev, void *addr) return 0; } -#ifdef MODULE - -static struct net_device *dev_cs89x0; -static int debug; - -module_param(debug, int, 0); -MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); MODULE_LICENSE("GPL"); -int __init -init_module(void) +static int mac89x0_device_remove(struct platform_device *pdev) { - net_debug = debug; -dev_cs89x0 = mac89x0_probe(-1); - if (IS_ERR(dev_cs89x0)) { -printk(KERN_WARNING "mac89x0.c: No card found\n"); - return PTR_ERR(dev_cs89x0); - } + struct net_device *dev = platform_get_drvdata(pdev); + + unregister_netdev(dev); + nubus_writew(0, dev->base_addr + ADD_PORT); + free_netdev(dev); return 0; } -void -cleanup_module(void) -{ -
[PATCH net v4 05/13] net/mac89x0: Remove dead or unreachable code
Signed-off-by: Finn Thain--- drivers/net/ethernet/cirrus/mac89x0.c | 32 1 file changed, 32 deletions(-) diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c index 977d4c2c759d..4fe0ae93ab36 100644 --- a/drivers/net/ethernet/cirrus/mac89x0.c +++ b/drivers/net/ethernet/cirrus/mac89x0.c @@ -115,14 +115,9 @@ struct net_local { int rx_mode; int curr_rx_cfg; int send_underrun; /* keep track of how many underruns in a row we get */ - struct sk_buff *skb; }; /* Index to functions, as function prototypes. */ - -#if 0 -extern void reset_chip(struct net_device *dev); -#endif static int net_open(struct net_device *dev); static int net_send_packet(struct sk_buff *skb, struct net_device *dev); static irqreturn_t net_interrupt(int irq, void *dev_id); @@ -132,10 +127,6 @@ static int net_close(struct net_device *dev); static struct net_device_stats *net_get_stats(struct net_device *dev); static int set_mac_address(struct net_device *dev, void *addr); - -/* Example routines you must write ;->. */ -#define tx_done(dev) 1 - /* For reading/writing registers ISA-style */ static inline int readreg_io(struct net_device *dev, int portno) @@ -297,24 +288,6 @@ struct net_device * __init mac89x0_probe(int unit) return ERR_PTR(err); } -#if 0 -/* This is useful for something, but I don't know what yet. */ -void __init reset_chip(struct net_device *dev) -{ - int reset_start_time; - - writereg(dev, PP_SelfCTL, readreg(dev, PP_SelfCTL) | POWER_ON_RESET); - - /* wait 30 ms */ - msleep_interruptible(30); - - /* Wait until the chip is reset */ - reset_start_time = jiffies; - while( (readreg(dev, PP_SelfST) & INIT_DONE) == 0 && jiffies - reset_start_time < 2) - ; -} -#endif - /* Open/initialize the board. This is called (in the current kernel) sometime after booting when the 'ifconfig' program is run. @@ -416,11 +389,6 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) struct net_local *lp; int ioaddr, status; - if (dev == NULL) { - printk ("net_interrupt(): irq %d for unknown device.\n", irq); - return IRQ_NONE; - } - ioaddr = dev->base_addr; lp = netdev_priv(dev); -- 2.13.6
[PATCH net v4 04/13] net/macmace: Fix and clean up log messages
Don't log the unexpanded "eth%d" format string. Log the chip revision in the probe message (consistent with mace.c). Drop redundant debug messages for FIFO events recorded in the interface statistics (also consistent with mace.c). Tested-by: Stan JohnsonSigned-off-by: Finn Thain --- drivers/net/ethernet/apple/macmace.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/apple/macmace.c b/drivers/net/ethernet/apple/macmace.c index f17a160dbff2..cfd8f3d8a94c 100644 --- a/drivers/net/ethernet/apple/macmace.c +++ b/drivers/net/ethernet/apple/macmace.c @@ -247,8 +247,8 @@ static int mace_probe(struct platform_device *pdev) dev->netdev_ops = _netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; - printk(KERN_INFO "%s: 68K MACE, hardware address %pM\n", - dev->name, dev->dev_addr); + pr_info("Onboard MACE, hardware address %pM, chip revision 0x%04X\n", + dev->dev_addr, mp->chipid); err = register_netdev(dev); if (!err) @@ -589,7 +589,6 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) else if (fs & (UFLO|LCOL|RTRY)) { ++dev->stats.tx_aborted_errors; if (mb->xmtfs & UFLO) { - printk(KERN_ERR "%s: DMA underrun.\n", dev->name); dev->stats.tx_fifo_errors++; mace_txdma_reset(dev); } @@ -644,10 +643,8 @@ static void mace_dma_rx_frame(struct net_device *dev, struct mace_frame *mf) if (frame_status & (RS_OFLO | RS_CLSN | RS_FRAMERR | RS_FCSERR)) { dev->stats.rx_errors++; - if (frame_status & RS_OFLO) { - printk(KERN_DEBUG "%s: fifo overflow.\n", dev->name); + if (frame_status & RS_OFLO) dev->stats.rx_fifo_errors++; - } if (frame_status & RS_CLSN) dev->stats.collisions++; if (frame_status & RS_FRAMERR) -- 2.13.6
[PATCH net v4 03/13] net/smc9194: Remove bogus CONFIG_MAC reference
AFAIK the only version of smc9194.c with Mac support is the one in the linux-mac68k CVS repo, which never made it to the mainline. Despite that, from v2.3.45, arch/m68k/config.in listed CONFIG_SMC9194 under CONFIG_MAC. This mistake got carried over into Kconfig in v2.5.55. (See pre-git era "[PATCH] add m68k dependencies to net driver config".) Signed-off-by: Finn Thain--- drivers/net/ethernet/smsc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/smsc/Kconfig b/drivers/net/ethernet/smsc/Kconfig index 63aca9f847e1..4c2f612e4414 100644 --- a/drivers/net/ethernet/smsc/Kconfig +++ b/drivers/net/ethernet/smsc/Kconfig @@ -20,7 +20,7 @@ if NET_VENDOR_SMSC config SMC9194 tristate "SMC 9194 support" - depends on (ISA || MAC && BROKEN) + depends on ISA select CRC32 ---help--- This is support for the SMC9xxx based Ethernet cards. Choose this -- 2.13.6
Re: [PATCH] ath9k: turn on btcoex_enable as default
> On 10 Feb 2018, at 10:05 PM, Felix Fietkauwrote: > > On 2018-02-10 14:56, Kai Heng Feng wrote: >> >>> On 9 Feb 2018, at 3:16 PM, Kalle Valo wrote: >>> Sure, but we have to make sure that we don't create regressions on >>> existing systems. For example, did you test this with any system which >>> don't support btcoex? (just asking, haven't tested this myself) >> >> No not really, but I will definitely test it. >> The only module I have that uses ath9k is Dell’s DW1707. >> How do I check if it support btcoex or not? > I just reviewed the code again, and I am sure that we cannot merge this > patch. Enabling the btcoex parameter makes the driver enable a whole > bunch of code starting timers, listening to some GPIOs, etc. > > On non-btcoex systems, some of those GPIOs might be floating or even > connected to different things, which could cause a lot of undefined > behavior. > > This is simply too big a risk, so there absolutely needs to be a > whitelist for systems that need this, otherwise it has to remain > disabled by default. So what information can we use to whitelist btcoex chips? Can we get btcoex support status at ath9k probing? Kai-Heng > > - Felix
[PATCH net v4 01/13] net/8390: Remove redundant make dependencies
The hydra, zorro8390 and mcf8390 drivers all #include "lib8390.c" and have no need for 8390.o. modinfo confirms no dependency on 8390.ko. Drop the redundant dependency from the Makefile. objdump confirms that this has no effect on the module binaries. Cc: Greg UngererCc: Geert Uytterhoeven Signed-off-by: Finn Thain --- drivers/net/ethernet/8390/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/8390/Makefile b/drivers/net/ethernet/8390/Makefile index f975c2fc88a3..1d650e66cc6e 100644 --- a/drivers/net/ethernet/8390/Makefile +++ b/drivers/net/ethernet/8390/Makefile @@ -7,8 +7,8 @@ obj-$(CONFIG_MAC8390) += mac8390.o obj-$(CONFIG_APNE) += apne.o 8390.o obj-$(CONFIG_ARM_ETHERH) += etherh.o obj-$(CONFIG_AX88796) += ax88796.o -obj-$(CONFIG_HYDRA) += hydra.o 8390.o -obj-$(CONFIG_MCF8390) += mcf8390.o 8390.o +obj-$(CONFIG_HYDRA) += hydra.o +obj-$(CONFIG_MCF8390) += mcf8390.o obj-$(CONFIG_NE2000) += ne.o 8390p.o obj-$(CONFIG_NE2K_PCI) += ne2k-pci.o 8390.o obj-$(CONFIG_PCMCIA_AXNET) += axnet_cs.o 8390.o @@ -16,4 +16,4 @@ obj-$(CONFIG_PCMCIA_PCNET) += pcnet_cs.o 8390.o obj-$(CONFIG_STNIC) += stnic.o 8390.o obj-$(CONFIG_ULTRA) += smc-ultra.o 8390.o obj-$(CONFIG_WD80x3) += wd.o 8390.o -obj-$(CONFIG_ZORRO8390) += zorro8390.o 8390.o +obj-$(CONFIG_ZORRO8390) += zorro8390.o -- 2.13.6
[PATCH net v4 07/13] net/mac89x0: Fix and modernize log messages
Fix log message fragments that no longer produce the desired output since the behaviour of printk() was changed. Add missing printk severity levels. Drop deprecated "out of memory" message as per checkpatch advice. Signed-off-by: Finn Thain--- drivers/net/ethernet/cirrus/mac89x0.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c index 7f7c72409921..9cc8d4cf2785 100644 --- a/drivers/net/ethernet/cirrus/mac89x0.c +++ b/drivers/net/ethernet/cirrus/mac89x0.c @@ -56,6 +56,8 @@ local_irq_{dis,en}able() */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + static const char version[] = "cs89x0.c:v1.02 11/26/96 Russell Nelson \n"; @@ -248,16 +250,14 @@ static int mac89x0_device_probe(struct platform_device *pdev) if (net_debug && version_printed++ == 0) printk(version); - printk(KERN_INFO "%s: cs89%c0%s rev %c found at %#8lx", - dev->name, - lp->chip_type==CS8900?'0':'2', - lp->chip_type==CS8920M?"M":"", - lp->chip_revision, - dev->base_addr); + pr_info("cs89%c0%s rev %c found at %#8lx\n", + lp->chip_type == CS8900 ? '0' : '2', + lp->chip_type == CS8920M ? "M" : "", + lp->chip_revision, dev->base_addr); /* Try to read the MAC address */ if ((readreg(dev, PP_SelfST) & (EEPROM_PRESENT | EEPROM_OK)) == 0) { - printk("\nmac89x0: No EEPROM, giving up now.\n"); + pr_info("No EEPROM, giving up now.\n"); goto out1; } else { for (i = 0; i < ETH_ALEN; i += 2) { @@ -272,7 +272,7 @@ static int mac89x0_device_probe(struct platform_device *pdev) /* print the IRQ and ethernet address. */ - printk(" IRQ %d ADDR %pM\n", dev->irq, dev->dev_addr); + pr_info("MAC %pM, IRQ %d\n", dev->dev_addr, dev->irq); dev->netdev_ops = _netdev_ops; @@ -475,7 +475,6 @@ net_rx(struct net_device *dev) /* Malloc up new buffer. */ skb = alloc_skb(length, GFP_ATOMIC); if (skb == NULL) { - printk("%s: Memory squeeze, dropping packet.\n", dev->name); dev->stats.rx_dropped++; return; } @@ -563,7 +562,7 @@ static int set_mac_address(struct net_device *dev, void *addr) return -EADDRNOTAVAIL; memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN); - printk("%s: Setting MAC address to %pM\n", dev->name, dev->dev_addr); + netdev_info(dev, "Setting MAC address to %pM\n", dev->dev_addr); /* set the Ethernet address */ for (i=0; i < ETH_ALEN/2; i++) -- 2.13.6
[PATCH net v4 10/13] net/mac8390: Fix log messages
Use dev_foo() to log the slot number instead of the unexpanded "eth%d" format string. Disambiguate the two identical "Card type %s is unsupported" messages. Tested-by: Stan JohnsonSigned-off-by: Finn Thain --- drivers/net/ethernet/8390/mac8390.c | 36 +--- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/8390/mac8390.c b/drivers/net/ethernet/8390/mac8390.c index 1113add733b6..44b20bce554e 100644 --- a/drivers/net/ethernet/8390/mac8390.c +++ b/drivers/net/ethernet/8390/mac8390.c @@ -308,14 +308,14 @@ static bool mac8390_rsrc_init(struct net_device *dev, */ if (nubus_get_func_dir(fres, ) == -1) { - pr_err("%s: Unable to get Nubus functional directory for slot %X!\n", - dev->name, board->slot); + dev_err(>dev, + "Unable to get Nubus functional directory\n"); return false; } /* Get the MAC address */ if (nubus_find_rsrc(, NUBUS_RESID_MAC_ADDRESS, ) == -1) { - pr_info("%s: Couldn't get MAC address!\n", dev->name); + dev_info(>dev, "MAC address resource not found\n"); return false; } @@ -325,8 +325,8 @@ static bool mac8390_rsrc_init(struct net_device *dev, nubus_rewinddir(); if (nubus_find_rsrc(, NUBUS_RESID_MINOR_BASEOS, ) == -1) { - pr_err("%s: Memory offset resource for slot %X not found!\n", - dev->name, board->slot); + dev_err(>dev, + "Memory offset resource not found\n"); return false; } nubus_get_rsrc_mem(, , 4); @@ -336,8 +336,8 @@ static bool mac8390_rsrc_init(struct net_device *dev, nubus_rewinddir(); if (nubus_find_rsrc(, NUBUS_RESID_MINOR_LENGTH, ) == -1) { - pr_info("%s: Memory length resource for slot %X not found, probing\n", - dev->name, board->slot); + dev_info(>dev, +"Memory length resource not found, probing\n"); offset = mac8390_memsize(dev->mem_start); } else { nubus_get_rsrc_mem(, , 4); @@ -380,8 +380,8 @@ static bool mac8390_rsrc_init(struct net_device *dev, break; default: - pr_err("Card type %s is unsupported, sorry\n", - board->name); + dev_err(>dev, + "No known base address for card type\n"); return false; } } @@ -536,7 +536,8 @@ static int mac8390_initdev(struct net_device *dev, struct nubus_board *board, case MAC8390_APPLE: switch (mac8390_testio(dev->mem_start)) { case ACCESS_UNKNOWN: - pr_err("Don't know how to access card memory!\n"); + dev_err(>dev, + "Don't know how to access card memory\n"); return -ENODEV; case ACCESS_16: @@ -602,21 +603,18 @@ static int mac8390_initdev(struct net_device *dev, struct nubus_board *board, break; default: - pr_err("Card type %s is unsupported, sorry\n", - board->name); + dev_err(>dev, "Unsupported card type\n"); return -ENODEV; } __NS8390_init(dev, 0); /* Good, done, now spit out some messages */ - pr_info("%s: %s in slot %X (type %s)\n", - dev->name, board->name, board->slot, - cardname[type]); - pr_info("MAC %pM IRQ %d, %d KB shared memory at %#lx, %d-bit access.\n", - dev->dev_addr, dev->irq, - (unsigned int)(dev->mem_end - dev->mem_start) >> 10, - dev->mem_start, access_bitmode ? 32 : 16); + dev_info(>dev, "%s (type %s)\n", board->name, cardname[type]); + dev_info(>dev, "MAC %pM, IRQ %d, %d KB shared memory at %#lx, %d-bit access.\n", +dev->dev_addr, dev->irq, +(unsigned int)(dev->mem_end - dev->mem_start) >> 10, +dev->mem_start, access_bitmode ? 32 : 16); return 0; } -- 2.13.6
[PATCH net v4 12/13] net/sonic: Clean up and modernize log messages
Add missing printk severity levels by adopting pr_foo() calls for the platform_driver and dev_foo() calls for the nubus_driver. Avoid KERN_CONT usage as per advice from checkpatch. Avoid #ifdef around printk calls. Don't log driver probe messages after calling register_netdev(). Cc: Thomas BogendoerferCc: Chris Zankel Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Only the macsonic.c changes have been tested. The other changes are similar but untested. --- drivers/net/ethernet/natsemi/jazzsonic.c | 13 drivers/net/ethernet/natsemi/macsonic.c | 54 ++-- drivers/net/ethernet/natsemi/xtsonic.c | 11 --- 3 files changed, 36 insertions(+), 42 deletions(-) diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c index d5b28884e21e..58495316d318 100644 --- a/drivers/net/ethernet/natsemi/jazzsonic.c +++ b/drivers/net/ethernet/natsemi/jazzsonic.c @@ -142,17 +142,14 @@ static int sonic_probe1(struct net_device *dev) i++; if (known_revisions[i] == 0x) { - printk("SONIC ethernet controller not found (0x%4x)\n", - silicon_revision); + pr_info("SONIC ethernet controller not found (0x%4x)\n", + silicon_revision); goto out; } if (sonic_debug && version_printed++ == 0) printk(version); - printk(KERN_INFO "%s: Sonic ethernet found at 0x%08lx, ", - dev_name(lp->device), dev->base_addr); - /* * Put the sonic into software reset, then * retrieve and print the ethernet address. @@ -245,12 +242,14 @@ static int jazz_sonic_probe(struct platform_device *pdev) err = sonic_probe1(dev); if (err) goto out; + + pr_info("SONIC ethernet @%08lx, MAC %pM, IRQ %d\n", + dev->base_addr, dev->dev_addr, dev->irq); + err = register_netdev(dev); if (err) goto out1; - printk("%s: MAC %pM IRQ %d\n", dev->name, dev->dev_addr, dev->irq); - return 0; out1: diff --git a/drivers/net/ethernet/natsemi/macsonic.c b/drivers/net/ethernet/natsemi/macsonic.c index 14b25175dc2f..a2d1d1587433 100644 --- a/drivers/net/ethernet/natsemi/macsonic.c +++ b/drivers/net/ethernet/natsemi/macsonic.c @@ -314,8 +314,6 @@ static int mac_onboard_sonic_probe(struct net_device *dev) if (!MACH_IS_MAC) return -ENODEV; - printk(KERN_INFO "Checking for internal Macintosh ethernet (SONIC).. "); - /* Bogus probing, on the models which may or may not have Ethernet (BTW, the Ethernet *is* always at the same address, and nothing else lives there, at least if Apple's @@ -325,13 +323,11 @@ static int mac_onboard_sonic_probe(struct net_device *dev) card_present = hwreg_present((void*)ONBOARD_SONIC_REGISTERS); if (!card_present) { - printk("none.\n"); + pr_info("Onboard/comm-slot SONIC not found\n"); return -ENODEV; } } - printk("yes\n"); - /* Danger! My arms are flailing wildly! You *must* set lp->reg_offset * and dev->base_addr before using SONIC_READ() or SONIC_WRITE() */ dev->base_addr = ONBOARD_SONIC_REGISTERS; @@ -344,14 +340,11 @@ static int mac_onboard_sonic_probe(struct net_device *dev) printk(KERN_INFO "%s", version); sonic_version_printed = 1; } - printk(KERN_INFO "%s: onboard / comm-slot SONIC at 0x%08lx\n", - dev_name(lp->device), dev->base_addr); /* The PowerBook's SONIC is 16 bit always. */ if (macintosh_config->ident == MAC_MODEL_PB520) { lp->reg_offset = 0; lp->dma_bitmode = SONIC_BITMODE16; - sr = SONIC_READ(SONIC_SR); } else if (commslot) { /* Some of the comm-slot cards are 16 bit. But some of them are not. The 32-bit cards use offset 2 and @@ -368,22 +361,21 @@ static int mac_onboard_sonic_probe(struct net_device *dev) else { lp->dma_bitmode = SONIC_BITMODE16; lp->reg_offset = 0; - sr = SONIC_READ(SONIC_SR); } } else { /* All onboard cards are at offset 2 with 32 bit DMA. */ lp->reg_offset = 2; lp->dma_bitmode = SONIC_BITMODE32; - sr = SONIC_READ(SONIC_SR); } - printk(KERN_INFO - "%s: revision 0x%04x, using %d bit DMA and register offset %d\n", - dev_name(lp->device), sr, lp->dma_bitmode?32:16, lp->reg_offset); -#if 0 /* This is sometimes useful to find out how MacOS configured the card.
[PATCH net v4 09/13] net/mac8390: Convert to nubus_driver
This resolves an old bug that constrained this driver to no more than one card. Tested-by: Stan JohnsonSigned-off-by: Finn Thain --- drivers/net/Space.c | 3 - drivers/net/ethernet/8390/mac8390.c | 138 ++-- include/net/Space.h | 1 - 3 files changed, 68 insertions(+), 74 deletions(-) diff --git a/drivers/net/Space.c b/drivers/net/Space.c index fe123808c6b8..3afda6561434 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c @@ -114,9 +114,6 @@ static struct devprobe2 m68k_probes[] __initdata = { #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ {mvme147lance_probe, 0}, #endif -#ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */ - {mac8390_probe, 0}, -#endif {NULL, 0}, }; diff --git a/drivers/net/ethernet/8390/mac8390.c b/drivers/net/ethernet/8390/mac8390.c index abe50338b9f7..1113add733b6 100644 --- a/drivers/net/ethernet/8390/mac8390.c +++ b/drivers/net/ethernet/8390/mac8390.c @@ -123,8 +123,7 @@ enum mac8390_access { }; extern int mac8390_memtest(struct net_device *dev); -static int mac8390_initdev(struct net_device *dev, - struct nubus_rsrc *ndev, +static int mac8390_initdev(struct net_device *dev, struct nubus_board *board, enum mac8390_type type); static int mac8390_open(struct net_device *dev); @@ -169,7 +168,7 @@ static void slow_sane_block_output(struct net_device *dev, int count, static void word_memcpy_tocard(unsigned long tp, const void *fp, int count); static void word_memcpy_fromcard(void *tp, unsigned long fp, int count); -static enum mac8390_type __init mac8390_ident(struct nubus_rsrc *fres) +static enum mac8390_type mac8390_ident(struct nubus_rsrc *fres) { switch (fres->dr_sw) { case NUBUS_DRSW_3COM: @@ -235,7 +234,7 @@ static enum mac8390_type __init mac8390_ident(struct nubus_rsrc *fres) return MAC8390_NONE; } -static enum mac8390_access __init mac8390_testio(volatile unsigned long membase) +static enum mac8390_access mac8390_testio(unsigned long membase) { unsigned long outdata = 0xA5A0B5B0; unsigned long indata = 0x; @@ -253,7 +252,7 @@ static enum mac8390_access __init mac8390_testio(volatile unsigned long membase) return ACCESS_UNKNOWN; } -static int __init mac8390_memsize(unsigned long membase) +static int mac8390_memsize(unsigned long membase) { unsigned long flags; int i, j; @@ -289,28 +288,28 @@ static int __init mac8390_memsize(unsigned long membase) return i * 0x1000; } -static bool __init mac8390_init(struct net_device *dev, - struct nubus_rsrc *ndev, - enum mac8390_type cardtype) +static bool mac8390_rsrc_init(struct net_device *dev, + struct nubus_rsrc *fres, + enum mac8390_type cardtype) { + struct nubus_board *board = fres->board; struct nubus_dir dir; struct nubus_dirent ent; int offset; volatile unsigned short *i; - dev->irq = SLOT2IRQ(ndev->board->slot); + dev->irq = SLOT2IRQ(board->slot); /* This is getting to be a habit */ - dev->base_addr = (ndev->board->slot_addr | - ((ndev->board->slot & 0xf) << 20)); + dev->base_addr = board->slot_addr | ((board->slot & 0xf) << 20); /* * Get some Nubus info - we will trust the card's idea * of where its memory and registers are. */ - if (nubus_get_func_dir(ndev, ) == -1) { + if (nubus_get_func_dir(fres, ) == -1) { pr_err("%s: Unable to get Nubus functional directory for slot %X!\n", - dev->name, ndev->board->slot); + dev->name, board->slot); return false; } @@ -327,7 +326,7 @@ static bool __init mac8390_init(struct net_device *dev, if (nubus_find_rsrc(, NUBUS_RESID_MINOR_BASEOS, ) == -1) { pr_err("%s: Memory offset resource for slot %X not found!\n", - dev->name, ndev->board->slot); + dev->name, board->slot); return false; } nubus_get_rsrc_mem(, , 4); @@ -338,7 +337,7 @@ static bool __init mac8390_init(struct net_device *dev, if (nubus_find_rsrc(, NUBUS_RESID_MINOR_LENGTH, ) == -1) { pr_info("%s: Memory length resource for slot %X not found, probing\n", - dev->name, ndev->board->slot); + dev->name, board->slot); offset = mac8390_memsize(dev->mem_start); } else {
[PATCH net v4 08/13] net/mac89x0: Replace custom debug logging with netif_* calls
Adopt the conventional style of debug logging because it is both shorter and more flexible. Signed-off-by: Finn Thain--- drivers/net/ethernet/cirrus/mac89x0.c | 47 +++ 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c index 9cc8d4cf2785..165ea3c6be04 100644 --- a/drivers/net/ethernet/cirrus/mac89x0.c +++ b/drivers/net/ethernet/cirrus/mac89x0.c @@ -61,18 +61,6 @@ static const char version[] = "cs89x0.c:v1.02 11/26/96 Russell Nelson \n"; -/* === configure the driver here === */ - -/* use 0 for production, 1 for verification, >2 for debug */ -#ifndef NET_DEBUG -#define NET_DEBUG 0 -#endif - -/* === end of configuration === */ - - -/* Always include 'config.h' first in case the user wants to turn on - or override something. */ #include /* @@ -108,14 +96,13 @@ static const char version[] = #include "cs89x0.h" -static int debug; +static int debug = -1; module_param(debug, int, 0); -MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); - -static unsigned int net_debug = NET_DEBUG; +MODULE_PARM_DESC(debug, "debug message level"); /* Information that need to be kept for each board. */ struct net_local { + int msg_enable; int chip_type; /* one of: CS8900, CS8920, CS8920M */ char chip_revision; /* revision letter of the chip ('A'...) */ int send_cmd; /* the propercommand used to send a packet. */ @@ -178,7 +165,6 @@ static int mac89x0_device_probe(struct platform_device *pdev) { struct net_device *dev; struct net_local *lp; - static unsigned version_printed; int i, slot; unsigned rev_type = 0; unsigned long ioaddr; @@ -189,8 +175,6 @@ static int mac89x0_device_probe(struct platform_device *pdev) if (!MACH_IS_MAC) return -ENODEV; - net_debug = debug; - dev = alloc_etherdev(sizeof(struct net_local)); if (!dev) return -ENOMEM; @@ -225,6 +209,8 @@ static int mac89x0_device_probe(struct platform_device *pdev) /* Initialize the net_device structure. */ lp = netdev_priv(dev); + lp->msg_enable = netif_msg_init(debug, 0); + /* Fill in the 'dev' fields. */ dev->base_addr = ioaddr; dev->mem_start = (unsigned long) @@ -247,8 +233,7 @@ static int mac89x0_device_probe(struct platform_device *pdev) if (lp->chip_type != CS8900 && lp->chip_revision >= 'C') lp->send_cmd = TX_NOW; - if (net_debug && version_printed++ == 0) - printk(version); + netif_dbg(lp, drv, dev, "%s", version); pr_info("cs89%c0%s rev %c found at %#8lx\n", lp->chip_type == CS8900 ? '0' : '2', @@ -348,11 +333,9 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev) struct net_local *lp = netdev_priv(dev); unsigned long flags; - if (net_debug > 3) - printk("%s: sent %d byte packet of type %x\n", - dev->name, skb->len, - (skb->data[ETH_ALEN+ETH_ALEN] << 8) - | skb->data[ETH_ALEN+ETH_ALEN+1]); + netif_dbg(lp, tx_queued, dev, "sent %d byte packet of type %x\n", + skb->len, skb->data[ETH_ALEN + ETH_ALEN] << 8 | + skb->data[ETH_ALEN + ETH_ALEN + 1]); /* keep the upload from being interrupted, since we ask the chip to start transmitting before the @@ -401,7 +384,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) faster than you can read them off, you're screwed. Hasta la vista, baby! */ while ((status = swab16(nubus_readw(dev->base_addr + ISQ_PORT { - if (net_debug > 4)printk("%s: event=%04x\n", dev->name, status); + netif_dbg(lp, intr, dev, "status=%04x\n", status); switch(status & ISQ_EVENT_MASK) { case ISQ_RECEIVER_EVENT: /* Got a packet(s). */ @@ -431,7 +414,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) netif_wake_queue(dev); } if (status & TX_UNDERRUN) { - if (net_debug > 0) printk("%s: transmit underrun\n", dev->name); + netif_dbg(lp, tx_err, dev, "transmit underrun\n"); lp->send_underrun++; if (lp->send_underrun == 3) lp->send_cmd = TX_AFTER_381; else if (lp->send_underrun == 6) lp->send_cmd = TX_AFTER_ALL; @@ -452,6 +435,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) static void net_rx(struct net_device *dev) { + struct net_local
[PATCH net v4 00/13] Fixes, cleanup and modernization for some legacy ethernet NIC drivers
This patch series adds Driver Model support to Mac NIC drivers, fixes some bugs, removes some dead code and adopts netif_* calls to reduce code duplication. This series results in a reduction of about 100 lines of code. It has been tested on a variety of Macs, with coverage for the changes to lib8390.c, mac8390.c, macsonic.c, sonic.c and macmace.c. Much of this patch series depends on the NuBus modernization series which has been merged for 4.16-rc. Changes since v3: - Rebased on current nubus code. - Renamed some more struct nubus_rsrc pointers that were misleadingly called 'dev' and 'ndev'. - Removed an unused struct member from the mac89x0 driver. - Dropped gratuitous log message changes (capitalization, punctuation etc.) so that the old messages can still be grep'd. - Improved patch descriptions. - Revised code style to reduce checkpatch.pl noise. - Addressed two more 8390 logging issues. - Added a new patch to remove redundant 8390.o dependencies. - Re-ordered some patches for easier cherry picking. Changes since v2: - Modernized the Mac NIC drivers by adopting the Linux Driver Model. - Used dev_foo() in NuBus drivers. - Removed device probe messages logged after register_netdev(). Changes since v1: - Retained the once_is_enough test in mac89x0.c. - Added tested-by tags. - Moved netdev_info() call to correct branch in macmace.c. Finn Thain (13): net/8390: Remove redundant make dependencies net/8390: Fix msg_enable patch snafu net/smc9194: Remove bogus CONFIG_MAC reference net/macmace: Fix and clean up log messages net/mac89x0: Remove dead or unreachable code net/mac89x0: Convert to platform_driver net/mac89x0: Fix and modernize log messages net/mac89x0: Replace custom debug logging with netif_* calls net/mac8390: Convert to nubus_driver net/mac8390: Fix log messages net/macsonic: Convert to nubus_driver net/sonic: Clean up and modernize log messages net/sonic: Replace custom debug logging with netif_* calls arch/m68k/mac/config.c | 4 + drivers/net/Space.c | 6 - drivers/net/ethernet/8390/Makefile | 6 +- drivers/net/ethernet/8390/ax88796.c | 3 - drivers/net/ethernet/8390/axnet_cs.c | 2 - drivers/net/ethernet/8390/etherh.c | 17 --- drivers/net/ethernet/8390/hydra.c| 4 - drivers/net/ethernet/8390/lib8390.c | 2 + drivers/net/ethernet/8390/mac8390.c | 170 ++ drivers/net/ethernet/8390/mcf8390.c | 4 - drivers/net/ethernet/8390/ne.c | 2 +- drivers/net/ethernet/8390/pcnet_cs.c | 4 - drivers/net/ethernet/8390/wd.c | 2 +- drivers/net/ethernet/8390/zorro8390.c| 5 - drivers/net/ethernet/apple/macmace.c | 9 +- drivers/net/ethernet/cirrus/mac89x0.c| 157 +++- drivers/net/ethernet/natsemi/jazzsonic.c | 32 +--- drivers/net/ethernet/natsemi/macsonic.c | 241 ++- drivers/net/ethernet/natsemi/sonic.c | 92 ++-- drivers/net/ethernet/natsemi/sonic.h | 2 + drivers/net/ethernet/natsemi/xtsonic.c | 30 +--- drivers/net/ethernet/smsc/Kconfig| 2 +- include/net/Space.h | 2 - 23 files changed, 347 insertions(+), 451 deletions(-) -- 2.13.6
Re: [PATCH net] ptr_ring: prevent integer overflow when calculating size
From: Jason WangDate: Sun, 11 Feb 2018 11:28:12 +0800 > Switch to use dividing to prevent integer overflow when size is too > big to calculate allocation size properly. > > Reported-by: Eric Biggers > Fixes: 6e6e41c31122 ("ptr_ring: fail early if queue occupies more than > KMALLOC_MAX_SIZE") > Signed-off-by: Jason Wang Applied and queued up for -stable, thanks Jason.
Re: [PATCH] mvpp2: fix multicast address filter
From: Mikulas PatockaDate: Sun, 11 Feb 2018 18:10:28 -0500 (EST) > IPv6 doesn't work on the MacchiatoBIN board. It is caused by broken > multicast address filter in the mvpp2 driver. > > The driver loads doesn't load any multicast entries if "allmulti" is not > set. This condition should be reversed. > > The condition !netdev_mc_empty(dev) is useless (because > netdev_for_each_mc_addr is nop if the list is empty). > > This patch also fixes a possible overflow of the multicast list - if > mvpp2_prs_mac_da_accept fails, we set the allmulti flag and retry. > > Signed-off-by: Mikulas Patocka Applied, thanks.
Re: [PATCH net-next 07/16] l2tp: hide sessions if they are closing
Hi James, I love your patch! Yet something to improve: [auto build test ERROR on net-next/master] url: https://github.com/0day-ci/linux/commits/James-Chapman/l2tp-fix-API-races-discovered-by-syzbot/20180212-102613 config: i386-randconfig-x079-201806 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 Note: the linux-review/James-Chapman/l2tp-fix-API-races-discovered-by-syzbot/20180212-102613 HEAD 0b6885922178c50183cc441ee2b0e2346292de81 builds fine. It only hurts bisectibility. All errors (new ones prefixed by >>): net/l2tp/l2tp_core.c: In function 'l2tp_tunnel_closeall': >> net/l2tp/l2tp_core.c:1266:36: error: 'struct l2tp_session' has no member >> named 'dead' if (test_and_set_bit(0, >dead)) ^~ vim +1266 net/l2tp/l2tp_core.c fd558d18 James Chapman 2010-04-02 1240 fd558d18 James Chapman 2010-04-02 1241 /* When the tunnel is closed, all the attached sessions need to go too. fd558d18 James Chapman 2010-04-02 1242 */ e34f4c70 Tom Parkin 2013-03-19 1243 void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel) fd558d18 James Chapman 2010-04-02 1244 { fd558d18 James Chapman 2010-04-02 1245 int hash; fd558d18 James Chapman 2010-04-02 1246 struct hlist_node *walk; fd558d18 James Chapman 2010-04-02 1247 struct hlist_node *tmp; fd558d18 James Chapman 2010-04-02 1248 struct l2tp_session *session; fd558d18 James Chapman 2010-04-02 1249 fd558d18 James Chapman 2010-04-02 1250 BUG_ON(tunnel == NULL); fd558d18 James Chapman 2010-04-02 1251 a4ca44fa Joe Perches 2012-05-16 1252 l2tp_info(tunnel, L2TP_MSG_CONTROL, "%s: closing all sessions...\n", a4ca44fa Joe Perches 2012-05-16 1253 tunnel->name); fd558d18 James Chapman 2010-04-02 1254 fd558d18 James Chapman 2010-04-02 1255 write_lock_bh(>hlist_lock); fd558d18 James Chapman 2010-04-02 1256 for (hash = 0; hash < L2TP_HASH_SIZE; hash++) { fd558d18 James Chapman 2010-04-02 1257 again: fd558d18 James Chapman 2010-04-02 1258 hlist_for_each_safe(walk, tmp, >session_hlist[hash]) { fd558d18 James Chapman 2010-04-02 1259 session = hlist_entry(walk, struct l2tp_session, hlist); fd558d18 James Chapman 2010-04-02 1260 a4ca44fa Joe Perches 2012-05-16 1261 l2tp_info(session, L2TP_MSG_CONTROL, fd558d18 James Chapman 2010-04-02 1262 "%s: closing session\n", session->name); fd558d18 James Chapman 2010-04-02 1263 fd558d18 James Chapman 2010-04-02 1264 hlist_del_init(>hlist); fd558d18 James Chapman 2010-04-02 1265 b228a940 Guillaume Nault 2017-09-22 @1266 if (test_and_set_bit(0, >dead)) b228a940 Guillaume Nault 2017-09-22 1267 goto again; b228a940 Guillaume Nault 2017-09-22 1268 fd558d18 James Chapman 2010-04-02 1269 write_unlock_bh(>hlist_lock); fd558d18 James Chapman 2010-04-02 1270 f6e16b29 Tom Parkin 2013-03-19 1271 __l2tp_session_unhash(session); 4c6e2fd3 Tom Parkin 2013-03-19 1272 l2tp_session_queue_purge(session); 4c6e2fd3 Tom Parkin 2013-03-19 1273 fd558d18 James Chapman 2010-04-02 1274 if (session->session_close != NULL) fd558d18 James Chapman 2010-04-02 1275 (*session->session_close)(session); fd558d18 James Chapman 2010-04-02 1276 9980d001 Tom Parkin 2013-03-19 1277 l2tp_session_dec_refcount(session); 9980d001 Tom Parkin 2013-03-19 1278 fd558d18 James Chapman 2010-04-02 1279 write_lock_bh(>hlist_lock); fd558d18 James Chapman 2010-04-02 1280 fd558d18 James Chapman 2010-04-02 1281 /* Now restart from the beginning of this hash fd558d18 James Chapman 2010-04-02 1282* chain. We always remove a session from the fd558d18 James Chapman 2010-04-02 1283* list so we are guaranteed to make forward fd558d18 James Chapman 2010-04-02 1284* progress. fd558d18 James Chapman 2010-04-02 1285*/ fd558d18 James Chapman 2010-04-02 1286 goto again; fd558d18 James Chapman 2010-04-02 1287 } fd558d18 James Chapman 2010-04-02 1288 } fd558d18 James Chapman 2010-04-02 1289 write_unlock_bh(>hlist_lock); fd558d18 James Chapman 2010-04-02 1290 } e34f4c70 Tom Parkin 2013-03-19 1291 EXPORT_SYMBOL_GPL(l2tp_tunnel_closeall); fd558d18 James Chapman 2010-04-02 1292 :: The code at line 1266 was first introduced by commit :: b228a94066406b6c456321d69643b0d7ce11cfa6