Merge branch 'v1.4' of pi31415/libreCMC-cmh into v1.4
authorRISCI_ATOM <bob@bobcall.me>
Tue, 10 Apr 2018 16:55:26 +0000 (12:55 -0400)
committerGogs <gogs@fake.local>
Tue, 10 Apr 2018 16:55:26 +0000 (12:55 -0400)
145 files changed:
docs/GL-AR300M.md [new file with mode: 0644]
docs/How To Submit A Change To This Wiki.md
docs/OpenVPN_Layer_2_Server.md
docs/Port_Forwards.md [new file with mode: 0644]
docs/Serial.md [new file with mode: 0644]
docs/Soft_Brick_Recovery_With_IPv6.md [new file with mode: 0644]
docs/Supported_Hardware.md
docs/System_Log.md [new file with mode: 0644]
docs/images/librecmc-luci-selecting-system-log.png [new file with mode: 0644]
docs/images/librecmc-luci-system-log.png [new file with mode: 0644]
docs/images/librecmc-port-forwards-after-save-apply.png [new file with mode: 0644]
docs/images/librecmc-port-forwards-entering-parameters.png [new file with mode: 0644]
docs/images/librecmc-selecting-firewall-menu.png [new file with mode: 0644]
docs/images/librecmc-selecting-port-forwards-tab.png [new file with mode: 0644]
docs/images/serial.png [new file with mode: 0644]
include/kernel-version.mk
include/version.mk
package/firmware/linux-libre-firmware/Makefile
package/libs/libcap/Makefile [new file with mode: 0644]
package/libs/libcap/patches/100-portability.patch [new file with mode: 0644]
package/libs/mbedtls/Makefile
package/libs/mbedtls/patches/200-config.patch
package/libs/openssl/Makefile
package/libs/tcp_wrappers/Makefile [new file with mode: 0644]
package/libs/tcp_wrappers/patches/001-debian_subset.patch [new file with mode: 0644]
package/libs/tcp_wrappers/patches/002-opt_cflags.patch [new file with mode: 0644]
package/libs/tcp_wrappers/patches/003-scaffold_malloc.patch [new file with mode: 0644]
package/libs/tcp_wrappers/patches/004-ipv4_prefix.patch [new file with mode: 0644]
package/libs/tcp_wrappers/patches/005-no--lnsl-on-musl.patch [new file with mode: 0644]
package/libs/ustream-ssl/Makefile
package/luci/applications/luci-app-shellinabox/Makefile [new file with mode: 0644]
package/luci/applications/luci-app-shellinabox/files/terminal.png [new file with mode: 0644]
package/luci/applications/luci-app-shellinabox/luasrc/controller/shellinabox.lua [new file with mode: 0644]
package/luci/applications/luci-app-shellinabox/luasrc/model/cbi/shellinabox/cbi_tab.lua [new file with mode: 0644]
package/luci/applications/luci-app-shellinabox/luasrc/view/shellinabox/view_tab.htm [new file with mode: 0644]
package/network/config/firewall/Makefile
package/network/config/netifd/Makefile
package/network/config/netifd/files/etc/init.d/network
package/network/config/netifd/files/lib/netifd/dhcp.script
package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
package/network/services/dnsmasq/Makefile
package/network/services/dnsmasq/patches/270-dnssec-wildcards.patch [new file with mode: 0644]
package/network/services/nfs-kernel-server/Makefile [new file with mode: 0644]
package/network/services/nfs-kernel-server/files/nfsd.exports [new file with mode: 0644]
package/network/services/nfs-kernel-server/files/nfsd.init [new file with mode: 0644]
package/network/services/nfs-kernel-server/patches/100-no_malloc_h.patch [new file with mode: 0644]
package/network/services/nfs-kernel-server/patches/101-musl-getservbyport.patch [new file with mode: 0644]
package/network/services/nfs-kernel-server/patches/102-limits.patch [new file with mode: 0644]
package/network/services/openvpn/Makefile
package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch
package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch
package/network/services/portmap/Makefile [new file with mode: 0644]
package/network/services/portmap/files/portmap.init [new file with mode: 0644]
package/network/services/portmap/patches/101-no_pie.patch [new file with mode: 0644]
package/network/services/shellinabox/Makefile [new file with mode: 0644]
package/network/services/shellinabox/files/shellinabox.init [new file with mode: 0644]
package/network/services/shellinabox/files/style.css [new file with mode: 0644]
package/network/services/shellinabox/old/000-makefile-arch.patch [new file with mode: 0644]
package/network/services/shellinabox/old/001-makefile-objcopy.patch [new file with mode: 0644]
package/network/services/shellinabox/old/002-httpconn-isnan.patch [new file with mode: 0644]
package/network/services/shellinabox/old/readme [new file with mode: 0644]
package/network/services/tor/Makefile [new file with mode: 0644]
package/network/services/tor/files/tor.init [new file with mode: 0644]
package/network/services/tor/patches/001-torrc.patch [new file with mode: 0644]
package/network/utils/curl/Makefile
package/network/utils/curl/patches/320-mbedtls-nonblocking-handshake.patch [new file with mode: 0644]
package/system/ca-certificates/Makefile
package/system/fstools/Makefile
package/system/fstools/files/blockd.init [new file with mode: 0755]
package/system/fstools/files/snapshot
package/system/mtd/src/Makefile
package/system/mtd/src/mtd.c
package/system/mtd/src/mtd.h
package/system/mtd/src/wrg.c [new file with mode: 0644]
package/system/procd/Makefile
package/system/procd/files/procd.sh
package/system/rpcd/Makefile
package/system/ubox/Makefile
package/system/ubox/files/log.init
package/system/ubus/Makefile
package/system/uci/Makefile
package/system/uci/files/lib/config/uci.sh
package/system/usign/Makefile
package/utils/px5g/Makefile
target/linux/ar71xx/patches-4.4/004-register_gpio_driver_earlier.patch
target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch [new file with mode: 0644]
target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch
target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch [deleted file]
target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch [deleted file]
target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch [deleted file]
target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch [deleted file]
target/linux/generic/patches-4.4/051-0005-ovl-proper-cleanup-of-workdir.patch
target/linux/generic/patches-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch [deleted file]
target/linux/generic/patches-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch [deleted file]
target/linux/generic/patches-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch [deleted file]
target/linux/generic/patches-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch [deleted file]
target/linux/generic/patches-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch [deleted file]
target/linux/generic/patches-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch [deleted file]
target/linux/generic/patches-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch [deleted file]
target/linux/generic/patches-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch [deleted file]
target/linux/generic/patches-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch [deleted file]
target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch [new file with mode: 0644]
target/linux/generic/patches-4.4/201-extra_optimization.patch
target/linux/generic/patches-4.4/202-reduce_module_size.patch
target/linux/generic/patches-4.4/204-module_strip.patch
target/linux/generic/patches-4.4/221-module_exports.patch
target/linux/generic/patches-4.4/491-ubi-auto-create-ubiblock-device-for-rootfs.patch
target/linux/generic/patches-4.4/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch
target/linux/generic/patches-4.4/610-netfilter_match_bypass_default_checks.patch
target/linux/generic/patches-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch [new file with mode: 0644]
target/linux/generic/patches-4.4/650-pppoe_header_pad.patch [deleted file]
target/linux/generic/patches-4.4/653-disable_netlink_trim.patch
target/linux/generic/patches-4.4/660-fq_codel_defaults.patch
target/linux/generic/patches-4.4/662-use_fq_codel_by_default.patch
target/linux/generic/patches-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
target/linux/generic/patches-4.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
target/linux/generic/patches-4.4/701-phy_extension.patch
target/linux/generic/patches-4.4/710-phy-add-mdio_register_board_info.patch
target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch [deleted file]
target/linux/generic/patches-4.4/834-ledtrig-libata.patch
target/linux/generic/patches-4.4/901-debloat_sock_diag.patch
target/linux/generic/patches-4.4/902-debloat_proc.patch
target/linux/generic/patches-4.4/903-debloat_direct_io.patch [deleted file]
target/linux/generic/patches-4.4/904-debloat_dma_buf.patch
target/linux/generic/patches-4.4/921-use_preinit_as_init.patch
target/linux/generic/patches-4.4/995-mangle_bootargs.patch
target/linux/x86/64/config-default
target/linux/x86/config-4.4
tools/e2fsprogs/Makefile
tools/e2fsprogs/patches/005-misc-rename-copy_file_range-to-copy_file_chunk.patch [new file with mode: 0644]

diff --git a/docs/GL-AR300M.md b/docs/GL-AR300M.md
new file mode 100644 (file)
index 0000000..2b85e9d
--- /dev/null
@@ -0,0 +1,46 @@
+# GL.iNet AR300M
+
+## Hardware Specs
+
+* SoC : Qualcomm Atheros QCA9531
+* Flash ROM : 16 MB Nor + 128 MB Nand
+* RAM : 128 MB
+
+## Flashing from factory
+
+### Using GL.iNet's U-boot-mod and web UI
+
+1) Set computer IP address to 192.168.1.2
+
+2) Connect the enternet from the computer to "lan" port on the router
+
+3) Press and hold the reset button, and power on the router by plugging in the power
+
+4) Wait until the LED flashes once and red LED flashes 5 times before releasing the reset button.
+
+5) Open IP address in the browser 192.168.1.1
+
+6) Select the .img for NAND and .bin for NOR
+
+
+## Tested
+
+* v1.4.2 librecmc-ar71xx-nand-gl-ar300m-ubi-factory.img
+
+## Reset Instructions
+
+????
+
+## Notes:
+
+* This router is currently not officially supported by Librecmc
+
+* This router is dual flash and stock uboot attempts to boot nand flash first.
+
+* NOR flash uses .bin image and NAND flash uses .img image.
+
+* Use librecmc-ar71xx-nand-gl-ar300m-squashfs-sysupgrade.tar to update NAND installations
+
+* Default router ip is 192.168.10.1
+
+* On KDE, Disable change ipv4 method from automatic to manual to set the computer ip to 192.168.1.2.
index 995f35281d455f045286610bce81ddfba23aa374..3ae15ea8703061186041cd1651394695b13b8394 100644 (file)
@@ -1,10 +1,16 @@
 How To Submit A Change To This Wiki
 ===================================
+This wiki is written in Markdown and all wiki documenation is located in /docs.
+
 
 Clone this repo and:
 --------------------
 
-    git clone https://gogs.librecmc.org/libreCMC/libreCMC-wiki.git
+    git clone https://gogs.librecmc.org/libreCMC/libreCMC.git
+    
+    
+Make desired documenation changes in /docs
+
 
 then
 
@@ -22,7 +28,7 @@ Clone the upstream repo in Gogs, then clone to your computer:
 
 Add upstream repo to be able to rebase to upstream point commit:
 
-    git remote add upstream https://gogs.librecmc.org/libreCMC/libreCMC-wiki.git
+    git remote add upstream https://gogs.librecmc.org/libreCMC/libreCMC.git
     (git checkout -b optionalBranchName)
     git push (--all)
 
@@ -43,7 +49,7 @@ Clone the upstream repo to your computer.
 
 Example for piping output to haste:
 
-    git request-pull -p b3b8926484feb37c33e5150facf315ef12b4612e https://gogs.librecmc.org/jonasbits2/libreCMC-wiki.git master | haste
+    git request-pull -p b3b8926484feb37c33e5150facf315ef12b4612e https://gogs.librecmc.org/jonasbits2/libreCMC.git master | haste
 
 * Send to hastebin.com or any site you like
 * Paste link in IRC channel
index e90566c78e3018cf2a9141f94227a3ee60721302..35af86fac067e5fc5b5abaa1aff716829df01258 100644 (file)
@@ -29,7 +29,19 @@ documentation.
 
 ## Interface Setup
 
-TODO
+In LuCi, select `Network` >> `Interfaces` and then `Add New Interface`.
+
+- Set `Name of the new interface` to `myvpn` or anything else you would like.
+- Set `Protocol of the new interface` to unmanaged.
+- Set `Cover the following interface` to `Custom Interface: vpn0`.
+- In my current working system, the `firewall-zone` for the interface
+  is set to `lan`, but I don't think that really matters in this case.
+
+In my working configuration, I added tap0 into the LAN bridge
+interface, and deleted the WAN interface. However, my vpn server is a
+separate unit on my network, intended to operate in "bridge mode",
+where if you server is your gateway router, a different configuration
+might be necessary.
 
 ## Certificate and Key Setup Instructions
 
diff --git a/docs/Port_Forwards.md b/docs/Port_Forwards.md
new file mode 100644 (file)
index 0000000..aa365ea
--- /dev/null
@@ -0,0 +1,84 @@
+# Port Forwarding
+
+## What is port forwarding?
+
+Technically, port forwarding is the use of Network Address Translation
+(NAT) to map an IP address and port number to another IP address and
+port number. Typically you need this function to be able to expose a
+service running our your local network (LAN) to the Internet (WAN)
+which otherwise would be impossible because your LAN uses private,
+non-routable IP addresses; for example, if you are trying to run a
+gaming server or a Web page server from your home network.
+
+## Security Warnings
+
+Be aware that the use of port forwarding may create additional
+security holes into your local network. The local system(s) and
+service(s) you are exposing to the Internet must be free from security
+vulnerabilities, or this may allow a remote attacker to infiltrate
+your network.
+
+## LuCi Interface
+
+* Log into the LuCi Web interface, which by default is at address https://192.168.10.1
+
+* Select the `Network` >> `Firewall` menu.
+
+![alt text](images/librecmc-selecting-firewall-menu.png "Selecting the
+ Firewall menu entry")
+
+* Select the `Port Forwards` tab.
+
+![alt text](images/librecmc-selecting-port-forwards-tab.png "Selecting the
+ Port Forwards tab")
+
+* Under the `New Port forward` section, enter in the `Name` field a
+  brief description of the port forward, e.g., "HTTP server" for an
+  unencrypted Web page server.
+
+* Select a protocol from the `Protocol` field. Most services you can
+  run will be using the TCP protocol, but you can select `TCP+UDP` if
+  you aren't sure.
+
+* Usually, you will leave the `External zone` set to `wan`.
+
+* Enter a port number in the `External port` field. Typically this
+  will be the usual port number expected for a particular
+  service. E.g., HTTP servers use port 80. You are free to use
+  non-standard ports, but your remote clients may need to use special
+  techniques to connect to the correct port.
+
+* Usually, you will leave the `Internal zone` set to `lan`.
+
+* Select an IP address in the `Internal IP address` drop down menu. If
+  your server is using DHCP, you should see its hostname appear in the
+  list. If your server is has it's private IP address set statically,
+  select the `Custom` option at the bottom of the list, and enter in
+  the correct IP address in the text field that appears. Note that if
+  your server is using DHCP, you should be sure LibreCMC has a static
+  lease created for it (TODO: link to Static Leases documentation).
+
+* Enter a port number in the `Internal port` field. Typically this
+  will be the same as the external port, unless you have set your
+  server to work through a non-standard port, or you selected a
+  non-standard external port earlier.
+
+![alt text](images/librecmc-port-forwards-entering-parameters.png
+ "Entering parameters for port forwarding")
+
+* Press the `Add` button to the right.
+
+* Press the `Save & Apply` button at the bottom of the page.
+
+![alt text](images/librecmc-port-forwards-after-save-apply.png
+ "Port Forwards view after Save & Apply")
+
+## Port Numbers
+
+The official IANA port number list is available at
+
+[https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml]
+
+## Port Range
+
+(TODO: option for configuring a range of ports simultaneously)
diff --git a/docs/Serial.md b/docs/Serial.md
new file mode 100644 (file)
index 0000000..3690376
--- /dev/null
@@ -0,0 +1,104 @@
+# Using a serial interface with U-boot and libreCMC
+
+A serial interface (console) provides a means of debugging or 
+unlocking features hidden from the user. Most computing devices 
+have a serial interface whether it is broken out by the manufacture or not.
+
+In the case of devices that run libreCMC, a serial console is used
+to configure U-boot and debug libreCMC if the network interface can't
+be brought up. These instructions outline the basics of using
+a serial console with a USB to serial cable.
+
+
+
+## The basics
+
+There are a few different standards for serial interfaces, but here we are
+providing just the basics. There are 3 different connections that we care 
+about : Transmit (TX), Receive (RX) and Ground (GND). Depending on the
+serial cable, the color coding could be different. The common coloration
+is RX is Green, TX is white and GND is black*.
+
+These three wires will be connected to a pin header on the board or might need
+to be soldered to pads. Many device manufactures are kind enough to provide a 
+header and indicate where the serial interface is. Look for silkscreen labeling
+with : GND, TX, RX. Sometimes additional work is needed to break out a stable
+serial interface.
+
+* Many serial cables ship with the color corresponding to the connection on the board, 
+so TX and RX are effectively reversed.
+
+Some routers use the following standard:
+```
+         __________________
+        |            |     |
+        | .   .   .  |  .  |              <- Inside of the router (you may need to do some soldering)
+        |____________|_____|
+                 
+          |   |    \     \
+          *  GND   RX    TX
+```
+
+In this case, transmit is in the marked off box.
+
+
+
+```
+         _________________
+        |                 |
+        | .   .   .    .  |             
+      * |_________________|
+
+          |   |    \     \
+        GND   RX    TX   Vcc
+
+```
+
+Some might use a dot to indicate GND, etc...
+
+TPE-R1100 example:
+
+![alt text](images/serial.png "TPE-R1100 Serial")
+
+Warning: NEVER connect the red wire to the device / router! You will most likely fry it because
+many routers use 3.3V for Vcc instead of the 5V provided by USB.
+
+## Getting a console
+
+In order to communicate with the device, we need a terminal application to interact with
+the serial port provided by the USB to serial cable. In this case, we are going to use GNU Screen.
+Make sure that the GNU Screen package is installed and make sure that your user is part of the 
+`dialout` group.
+
+Before we can use the terminal application, we need to know the baud rate at which the serial
+console will be provided. With most devices running libreCMC and u-boot, this most likely will
+be 115200
+
+## Putting it all together
+
+
+1) Plug in / wire up the serial cable to the board.
+
+2) Plug the USB part of the serial cable into an available USB port.
+
+3) run `screen /dev/ttyUSB0 115200` or (if you are NOT part of the `dialout` group) `sudo screen /dev/ttyUSB0 115200`
+Please note that the serial device might have a different name (ttyUSB(n), ttyS0, etc...).
+
+4) Power on the device you are connecting to.
+
+5) You should see ledgible ASCII text scroll by.
+
+If the device gets all the way through the boot process, the libreCMC banner will appear with
+a shell prompt:
+
+```
+                    ____  _____  ____
+  _ _ _            |  __||     ||  __|
+ | (_) |__ _ _ ___ | |   | | | || |
+ | | | '_ \ '_/ -_)| |__ | | | || |__
+ |_|_|_.__/_| \___||____||_|_|_||____|
+ -----------------------------------------
+
+root@libreCMC:~#
+
+```
diff --git a/docs/Soft_Brick_Recovery_With_IPv6.md b/docs/Soft_Brick_Recovery_With_IPv6.md
new file mode 100644 (file)
index 0000000..60bf665
--- /dev/null
@@ -0,0 +1,32 @@
+# Soft Brick Recovery With IPv6
+
+## Use Case
+
+If you recklessly experiment with your libreCMC networking settings, it is likely you will eventually cause a "soft brick". Typically, this means you have messed up your IPv4 network configuration in such as way that you cannot connect to the LuCi control panel, nor connect to the busybox shell via SSH. One option is to figure out how to reload the firmware and start over from scratch. Something that might be easier, though, is to instead use IPv6 to connect to the router. This is usually possible for two reasons: (1) libreCMC has IPv6 enabled by default; (2) IPv6 has link-level autoconfiguration.
+
+## Determine the router's link local IPv6 Address and interface name.
+
+Connect a Gnu/Linux computer to the LAN port of the libreCMC router. Then run the `ip neigh` command. You are looking for a `REACHABLE lladdr` address that starts with `fe80`. For example:
+
+```
+christopher@evenstar:~$ ip neigh
+fe80::280:aeff:fece:5a21 dev eth0 lladdr 00:80:ae:ce:5a:21 router REACHABLE
+```
+
+Here, `fe80::280:aeff:fece:5a21` is the IPv6 address, and `eth0` is the name of the interface.
+
+## Log in to the router
+
+Unforunately, a link local IPv6 address usually cannot be used to directly connect to the LuCi control panel. This is because Web browsers are usually programmed not to process such addresses. However, you can use SSH to connect to the busybox shell, with a command like so:
+
+```
+ssh root@fe80::280:aeff:fece:5a21%eth0
+```
+
+Replace `fe80::280:aeff:fece:5a21` with the IPv6 address of your router, and `eth0` with the correct interface name.
+
+## What next?
+
+Once you are logged into the busybox shell, you can use the `ip addr` command to see what is the actual state of your IPv4 network configuration. If you understand IPv4, it may be sufficient to use `ip addr add` to add an IPv4 address, which you can then use to connect to the LuCi control panel. If the IPv4 configuration is okay, you may be having a problem with the dnsmasq dhcp server, or the LuCi Web service itself may be down, for some reason. Use the `logread` command to look for errors or warnings.
+
+If you are still not sure what to do, you can ask for help on the libreCMC IRC channel or libreCMC email list.
index 97fc6266a8c49d4fb34e3f0761119983c6cf3300..56a4b223c1a5400d6a9a7cbb541b8ecf11852b22 100644 (file)
@@ -1,37 +1,37 @@
-# libreCMC supported Hardware\r
-\r
-### Buffalo\r
-* [WZR-HP-G300NH](/WZR_HP_G300NH.md)\r
-* WHR-HP-G300NH\r
-\r
-### Netgear \r
-\r
-* [WNDR3800](/WNDR3800.md)\r
-\r
-### TP-link \r
-\r
-* [TL-MR3020 v1](/TL_MR3020.md) \r
-* [TL-WR741ND](/TL_WR741ND.md)\r
-* [TL-WR841ND](/TP_WR841ND.md)\r
-* [TL-WR842ND](/TL_WR842ND.md)\r
-* [TL-WR1043ND](/TL_WR1043ND)\r
-\r
-### ThinkPenguin\r
-* [TPE-NWIFIROUTER2](/TPE_NWIFIROUTER2.md)\r
-* [TPE-R1100](/TPE_R1100.md)\r
-\r
-### Qi-Hardware\r
-\r
-* [Ben Nanonote](/Ben_Nanonote.md)\r
-\r
-## Tested Hardware\r
-\r
-[List of tested hardware](/List_of_Tested_Hardware.md)\r
-\r
-# libreCMC unofficially supported Hardware\r
-\r
-### D-Link\r
-\r
-* DGL-5500 a1 : Ships with non-free wifi card, but can be replaced with a free one. Has a mini-pci-e card slot.\r
-\r
-#####Please note that other targets may work; we are **NOT** responsible for **ANY** _bricked_ devices.\r
+# libreCMC supported Hardware
+
+### Buffalo
+* [WZR-HP-G300NH](/WZR_HP_G300NH.md)
+* WHR-HP-G300NH
+
+### Netgear 
+
+* [WNDR3800](/WNDR3800.md)
+
+### TP-link 
+
+* [TL-MR3020 v1](/TL_MR3020.md) 
+* [TL-WR741ND](/TL_WR741ND.md)
+* [TL-WR841ND](/TL_WR841ND.md)
+* [TL-WR842ND](/TL_WR842ND.md)
+* [TL-WR1043ND](/TL_WR1043ND.md)
+
+### ThinkPenguin
+* [TPE-NWIFIROUTER2](/TPE_NWIFIROUTER2.md)
+* [TPE-R1100](/TPE_R1100.md)
+
+### Qi-Hardware
+
+* [Ben Nanonote](/Ben_Nanonote.md)
+
+## Tested Hardware
+
+[List of tested hardware](/List_of_Tested_Hardware.md)
+
+# libreCMC unofficially supported Hardware
+
+### D-Link
+
+* DGL-5500 a1 : Ships with non-free wifi card, but can be replaced with a free one. Has a mini-pci-e card slot.
+
+#####Please note that other targets may work; we are **NOT** responsible for **ANY** _bricked_ devices.
diff --git a/docs/System_Log.md b/docs/System_Log.md
new file mode 100644 (file)
index 0000000..66c686a
--- /dev/null
@@ -0,0 +1,67 @@
+# System Log
+
+## Viewing the system log from LuCi
+
+Select the `Status >> System Log` menu entry.
+
+![alt text](images/librecmc-luci-selecting-system-log.png "Selecting
+ the System Log page in LuCi")
+
+![alt text](images/librecmc-luci-system-log.png "The System Log page
+ in LuCi")
+
+The `System Log` page in LuCi does not have an interface for filtering
+output. Therefore, you will likely want to use the shell interface.
+
+## Viewing the system log from the shell
+
+Once logged in via SSH, use the `logread` command
+
+```bash
+Usage: logread [options]
+Options:
+    -s <path>          Path to ubus socket
+    -l <count>         Got only the last 'count' messages
+    -e <pattern>       Filter messages with a regexp
+    -r <server> <port> Stream message to a server
+    -F <file>          Log file
+    -S <bytes>         Log size
+    -p <file>          PID file
+    -h <hostname>      Add hostname to the message
+    -P <prefix>        Prefix custom text to streamed messages
+    -f                 Follow log messages
+    -u                 Use UDP as the protocol
+    -t                 Add an extra timestamp
+    -0                 Use \0 instead of \n as trailer when using TCP
+```
+
+For example:
+
+```bash
+root@libreCMC:~$ logread | grep 'kern\.warn'
+Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.000000] No valid device tree found, continuing without
+Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
+Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
+Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.669305] Crashlog allocated RAM at address 0x3f00000
+Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.752178] m25p80 spi0.0: found mx25l12805d, expected m25p80
+```
+
+One should be able to use `logread -e` instead of `grep`, but it seems
+that not all the same regular expressions work for both:
+
+```bash
+root@libreCMC:~$ logread -e 'kern\.warn' # and other similar variations
+(no output)
+```
+
+The system log is contained in a limited size, circular buffer in
+memory. So, if you have some process writing messages periodically,
+this will eventually erase messages that were only written once.
+
+## Configuring the system log
+
+TODO
+
+## Monitoring the system log
+
+TODO
diff --git a/docs/images/librecmc-luci-selecting-system-log.png b/docs/images/librecmc-luci-selecting-system-log.png
new file mode 100644 (file)
index 0000000..b165160
Binary files /dev/null and b/docs/images/librecmc-luci-selecting-system-log.png differ
diff --git a/docs/images/librecmc-luci-system-log.png b/docs/images/librecmc-luci-system-log.png
new file mode 100644 (file)
index 0000000..7f98e0d
Binary files /dev/null and b/docs/images/librecmc-luci-system-log.png differ
diff --git a/docs/images/librecmc-port-forwards-after-save-apply.png b/docs/images/librecmc-port-forwards-after-save-apply.png
new file mode 100644 (file)
index 0000000..88a32b3
Binary files /dev/null and b/docs/images/librecmc-port-forwards-after-save-apply.png differ
diff --git a/docs/images/librecmc-port-forwards-entering-parameters.png b/docs/images/librecmc-port-forwards-entering-parameters.png
new file mode 100644 (file)
index 0000000..c7a2ef5
Binary files /dev/null and b/docs/images/librecmc-port-forwards-entering-parameters.png differ
diff --git a/docs/images/librecmc-selecting-firewall-menu.png b/docs/images/librecmc-selecting-firewall-menu.png
new file mode 100644 (file)
index 0000000..b4001c4
Binary files /dev/null and b/docs/images/librecmc-selecting-firewall-menu.png differ
diff --git a/docs/images/librecmc-selecting-port-forwards-tab.png b/docs/images/librecmc-selecting-port-forwards-tab.png
new file mode 100644 (file)
index 0000000..0a1e05b
Binary files /dev/null and b/docs/images/librecmc-selecting-port-forwards-tab.png differ
diff --git a/docs/images/serial.png b/docs/images/serial.png
new file mode 100644 (file)
index 0000000..868e6fe
Binary files /dev/null and b/docs/images/serial.png differ
index 40f69a27b3420cb98f02d28319ccba7efe105f04..1047527dab2a746d9d2476c5c6ce738133cd4238 100644 (file)
@@ -2,9 +2,10 @@
 
 LINUX_RELEASE?=1
 
-LINUX_VERSION-4.4 = .108
+LINUX_VERSION-4.4 = .120
+
+LINUX_KERNEL_HASH-4.4.120 = 667fcda44441106b649afe0952a3f4243ee9a214d9445491a3710e75572bf39f
 
-LINUX_KERNEL_HASH-4.4.108 = aaf270b84e7b55e7cad0777a6d17515b9afa681d320178364d66926acebd8cb3
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
 endif
index dc5321117c36d8d12adcf29a6743be299714cd98..9ea2d1fecebd19b23c8381dedb998fea4a45b26d 100644 (file)
@@ -31,7 +31,7 @@ qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
 
 VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
-VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.4.2)
+VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.4.3)
 
 VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_CODE))
 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
index ad997d0f4f7d1fb7fa21dd713e9a8b9a3fb3a7bb..712dc86f307a28c6c3bc132dba740d6b174b84b1 100644 (file)
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://gogs.librecmc.org/libreCMC/libre_firmware.git
-PKG_SOURCE_DATE:=2017-12-14
-PKG_SOURCE_VERSION:=1afb874fa73dc1f4b7a4ffae49ed8dd32e2e772c
-PKG_MIRROR_HASH:=
+PKG_SOURCE_DATE:=2018-02-12
+PKG_SOURCE_VERSION:=413eefe5a96584139ffc0b95b3e220d85abe36b2
+PKG_MIRROR_HASH:=ea781ab5a73f946c0f8c9d2417a18228983000ae390133830399d1f545ad1c6c
 
 PKG_MAINTAINER:=
 
diff --git a/package/libs/libcap/Makefile b/package/libs/libcap/Makefile
new file mode 100644 (file)
index 0000000..e60b897
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libcap
+PKG_VERSION:=2.25
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2
+PKG_HASH:=693c8ac51e983ee678205571ef272439d83afe62dd8e424ea14ad9790bc35162
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=License
+PKG_MAINTAINER:=Paul Wassi <p.wassi@gmx.at>
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/libcap
+  TITLE:=Linux capabilities library
+  SECTION:=libs
+  CATEGORY:=Libraries
+  URL:=http://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/
+endef
+
+MAKE_FLAGS += \
+    CFLAGS="$(TARGET_CFLAGS)" \
+    BUILD_CC="$(CC)" \
+    BUILD_CFLAGS="$(FPIC) -I$(PKG_BUILD_DIR)/libcap/include" \
+    CFLAGS="$(TARGET_CFLAGS)" \
+    LD="$(TARGET_CC)" \
+    LDFLAGS="$(TARGET_LDFLAGS) -shared" \
+    INDENT="| true" \
+    PAM_CAP="no" \
+    RAISE_SETFCAP="no" \
+    DYNAMIC="yes" \
+    lib="lib"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/sys
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/lib/* $(1)/usr/lib/
+endef
+
+define Package/libcap/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/lib/libcap.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libcap))
diff --git a/package/libs/libcap/patches/100-portability.patch b/package/libs/libcap/patches/100-portability.patch
new file mode 100644 (file)
index 0000000..735a973
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/libcap/_makenames.c
++++ b/libcap/_makenames.c
+@@ -7,7 +7,6 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <sys/capability.h>
+ /*
+  * #include 'sed' generated array
+@@ -22,7 +21,7 @@ struct {
+ };
+ /* this should be more than big enough (factor of three at least) */
+-const char *pointers[8*sizeof(struct __user_cap_data_struct)];
++const char *pointers[8*12];
+ int main(void)
+ {
index 0e3383150d7c9c4b6ae16405b7dd29e79cc45810..ea4c533db0c277d7e2237b7eaea26e9d1c2f23e6 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mbedtls
-PKG_VERSION:=2.6.0
+PKG_VERSION:=2.8.0
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-gpl.tgz
 PKG_SOURCE_URL:=https://tls.mbed.org/download/
-PKG_HASH:=a99959d7360def22f9108d2d487c9de384fe76c349697176b1f22370080d5810
+PKG_HASH:=649eb27187154590edda52943a7f468e740ec08807e5bf68ff45f4e8ffd68923
 
 PKG_BUILD_PARALLEL:=1
 PKG_LICENSE:=GPL-2.0+
index ce32be76a5a95569114e45195f8ef24323dbdedc..3dfa9e7a22d0a4d29dd73817239f07976e52a62e 100644 (file)
@@ -1,15 +1,6 @@
 --- a/include/mbedtls/config.h
 +++ b/include/mbedtls/config.h
-@@ -220,7 +220,7 @@
-  *
-  * Uncomment to get errors on using deprecated functions.
-  */
--//#define MBEDTLS_DEPRECATED_REMOVED
-+#define MBEDTLS_DEPRECATED_REMOVED
- /* \} name SECTION: System support */
-@@ -539,17 +539,17 @@
+@@ -566,17 +566,17 @@
   *
   * Comment macros to disable the curve and functions for it
   */
@@ -35,7 +26,7 @@
  #define MBEDTLS_ECP_DP_CURVE25519_ENABLED
  
  /**
-@@ -574,8 +574,8 @@
+@@ -601,8 +601,8 @@
   * Requires: MBEDTLS_HMAC_DRBG_C
   *
   * Comment this macro to disable deterministic ECDSA.
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
-@@ -621,7 +621,7 @@
-  *      MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
-  *      MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
+@@ -655,7 +655,7 @@
+  *             See dhm.h for more details.
+  *
   */
 -#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
 +//#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
-@@ -640,8 +640,8 @@
+@@ -674,8 +674,8 @@
   *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
   *      MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
   *      MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
@@ -64,7 +55,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
-@@ -666,7 +666,7 @@
+@@ -700,7 +700,7 @@
   *      MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
   *      MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
   */
@@ -73,7 +64,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
-@@ -793,7 +793,7 @@
+@@ -834,7 +834,7 @@
   *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
   */
@@ -82,7 +73,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
-@@ -817,7 +817,7 @@
+@@ -858,7 +858,7 @@
   *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
   */
@@ -91,7 +82,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
-@@ -921,7 +921,7 @@
+@@ -962,7 +962,7 @@
   * This option is only useful if both MBEDTLS_SHA256_C and
   * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used.
   */
  
  /**
   * \def MBEDTLS_ENTROPY_NV_SEED
-@@ -1015,14 +1015,14 @@
+@@ -1057,14 +1057,14 @@
   * Uncomment this macro to disable the use of CRT in RSA.
   *
   */
  
  /**
   * \def MBEDTLS_SHA256_SMALLER
-@@ -1038,7 +1038,7 @@
+@@ -1080,7 +1080,7 @@
   *
   * Uncomment to enable the smaller implementation of SHA256.
   */
  
  /**
   * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
-@@ -1157,8 +1157,8 @@
-  * misuse/misunderstand.
+@@ -1207,7 +1207,7 @@
+  *          configuration of this extension).
   *
-  * Comment this to disable support for renegotiation.
-- */
- #define MBEDTLS_SSL_RENEGOTIATION
-+ */
+  */
+-#define MBEDTLS_SSL_RENEGOTIATION
++//#define MBEDTLS_SSL_RENEGOTIATION
  
  /**
   * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
-@@ -1332,8 +1332,8 @@
+@@ -1381,8 +1381,8 @@
   * callbacks are provided by MBEDTLS_SSL_TICKET_C.
   *
   * Comment this macro to disable support for SSL session tickets
  
  /**
   * \def MBEDTLS_SSL_EXPORT_KEYS
-@@ -1363,7 +1363,7 @@
+@@ -1412,7 +1412,7 @@
   *
   * Comment this macro to disable support for truncated HMAC in SSL
   */
 +//#define MBEDTLS_SSL_TRUNCATED_HMAC
  
  /**
-  * \def MBEDTLS_THREADING_ALT
-@@ -1397,8 +1397,8 @@
+  * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
+@@ -1470,8 +1470,8 @@
   * Requires: MBEDTLS_VERSION_C
   *
   * Comment this to disable run-time checking and save ROM space
  
  /**
   * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
-@@ -1719,7 +1719,7 @@
+@@ -1801,7 +1801,7 @@
   *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
   */
  
  /**
   * \def MBEDTLS_CCM_C
-@@ -1733,7 +1733,7 @@
+@@ -1815,7 +1815,7 @@
   * This module enables the AES-CCM ciphersuites, if other requisites are
   * enabled as well.
   */
  
  /**
   * \def MBEDTLS_CERTS_C
-@@ -1745,7 +1745,7 @@
+@@ -1827,7 +1827,7 @@
   *
   * This module is used for testing (ssl_client/server).
   */
  
  /**
   * \def MBEDTLS_CIPHER_C
-@@ -1798,7 +1798,7 @@
+@@ -1880,7 +1880,7 @@
   *
   * This module provides debugging functions.
   */
  
  /**
   * \def MBEDTLS_DES_C
-@@ -1823,8 +1823,8 @@
-  *      MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA
-  *
-  * PEM_PARSE uses DES/3DES for decrypting encrypted keys.
-- */
- #define MBEDTLS_DES_C
-+ */
+@@ -1909,7 +1909,7 @@
+  * \warning   DES is considered a weak cipher and its use constitutes a
+  *            security risk. We recommend considering stronger ciphers instead.
+  */
+-#define MBEDTLS_DES_C
++//#define MBEDTLS_DES_C
  
  /**
   * \def MBEDTLS_DHM_C
-@@ -1978,8 +1978,8 @@
+@@ -2070,8 +2070,8 @@
   * Requires: MBEDTLS_MD_C
   *
   * Uncomment to enable the HMAC_DRBG random number geerator.
  
  /**
   * \def MBEDTLS_MD_C
-@@ -2256,7 +2256,7 @@
+@@ -2365,7 +2365,7 @@
   * Caller:  library/md.c
   *
   */
  
  /**
   * \def MBEDTLS_RSA_C
-@@ -2334,8 +2334,8 @@
+@@ -2449,8 +2449,8 @@
   * Caller:
   *
   * Requires: MBEDTLS_SSL_CACHE_C
  
  /**
   * \def MBEDTLS_SSL_COOKIE_C
-@@ -2356,8 +2356,8 @@
+@@ -2471,8 +2471,8 @@
   * Caller:
   *
   * Requires: MBEDTLS_CIPHER_C
  
  /**
   * \def MBEDTLS_SSL_CLI_C
-@@ -2456,8 +2456,8 @@
+@@ -2571,8 +2571,8 @@
   * Module:  library/version.c
   *
   * This module provides run-time version information.
  
  /**
   * \def MBEDTLS_X509_USE_C
-@@ -2567,7 +2567,7 @@
+@@ -2682,7 +2682,7 @@
   * Module:  library/xtea.c
   * Caller:
   */
index 5aadbd0f50afe7a65c33179ec0e2ba0e05bd75f9..caecebf2545cb5e2a5c8da77465835d674d944ea 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssl
 PKG_BASE:=1.0.2
-PKG_BUGFIX:=n
+PKG_BUGFIX:=o
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
@@ -24,7 +24,7 @@ PKG_SOURCE_URL:=http://www.openssl.org/source/ \
        ftp://ftp.funet.fi/pub/crypt/mirrors/ftp.openssl.org/source \
        ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
 
-PKG_HASH:=370babb75f278c39e0c50e8c4e7493bc0f18db6867478341a832a982fd15a8fe
+PKG_HASH:=ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d
 
 PKG_LICENSE:=OpenSSL
 PKG_LICENSE_FILES:=LICENSE
diff --git a/package/libs/tcp_wrappers/Makefile b/package/libs/tcp_wrappers/Makefile
new file mode 100644 (file)
index 0000000..d453031
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tcp_wrappers
+PKG_VERSION:=7.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.porcupine.org/pub/security
+PKG_MD5SUM:=e6fa25f71226d090f34de3f6b122fb5a
+
+PKG_LICENSE:=BSD
+PKG_LICENE_FILES:=DISCLAIMER
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libwrap
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Security wrapper library for TCP services
+  URL:=ftp://ftp.porcupine.org/pub/security/index.html
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+ifeq ($(CONFIG_USE_MUSL),)
+TARGET_EXTRA_LIBS:=LIBS=-lnsl
+endif
+
+define Build/Compile   
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               OPT_CFLAGS="$(TARGET_CFLAGS)" \
+               $(TARGET_EXTRA_LIBS) \
+               NETGROUP= \
+               VSYSLOG= \
+               BUGS= \
+               EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_STRERROR -DHAVE_WEAKSYMS -D_REENTRANT -DINET6=1 \
+                       -Dss_family=__ss_family -Dss_len=__ss_len" \
+               FACILITY=LOG_DAEMON \
+               SEVERITY=LOG_INFO \
+               REAL_DAEMON_DIR=/usr/sbin \
+               STYLE="-DPROCESS_OPTIONS" \
+               tidy all
+endef
+
+define Build/InstallDev        
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/tcpd.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libwrap.a $(1)/usr/lib/
+       $(CP) $(PKG_BUILD_DIR)/shared/libwrap.so* $(1)/usr/lib/
+endef
+
+define Package/libwrap/install 
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/shared/libwrap.so.* $(1)/usr/lib/
+endef
+       
+$(eval $(call BuildPackage,libwrap))
diff --git a/package/libs/tcp_wrappers/patches/001-debian_subset.patch b/package/libs/tcp_wrappers/patches/001-debian_subset.patch
new file mode 100644 (file)
index 0000000..0b3ad2c
--- /dev/null
@@ -0,0 +1,936 @@
+--- a/hosts_access.c
++++ b/hosts_access.c
+@@ -240,6 +240,26 @@ struct request_info *request;
+     }
+ }
++/* hostfile_match - look up host patterns from file */
++
++static int hostfile_match(path, host)
++char   *path;
++struct hosts_info *host;
++{
++    char    tok[BUFSIZ];
++    int     match = NO;
++    FILE   *fp;
++
++    if ((fp = fopen(path, "r")) != 0) {
++        while (fscanf(fp, "%s", tok) == 1 && !(match = host_match(tok, host)))
++            /* void */ ;
++        fclose(fp);
++    } else if (errno != ENOENT) {
++        tcpd_warn("open %s: %m", path);
++    }
++    return (match);
++}
++
+ /* host_match - match host name and/or address against pattern */
+ static int host_match(tok, host)
+@@ -267,6 +287,8 @@ struct host_info *host;
+       tcpd_warn("netgroup support is disabled");      /* not tcpd_jump() */
+       return (NO);
+ #endif
++    } else if (tok[0] == '/') {                         /* /file hack */
++        return (hostfile_match(tok, host));
+     } else if (STR_EQ(tok, "KNOWN")) {                /* check address and name */
+       char   *name = eval_hostname(host);
+       return (STR_NE(eval_hostaddr(host), unknown) && HOSTNAME_KNOWN(name));
+--- a/tcpd.h
++++ b/tcpd.h
+@@ -4,6 +4,25 @@
+   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
+   */
++#ifndef _TCPWRAPPERS_TCPD_H
++#define _TCPWRAPPERS_TCPD_H
++
++/* someone else may have defined this */
++#undef  __P
++
++/* use prototypes if we have an ANSI C compiler or are using C++ */
++#if defined(__STDC__) || defined(__cplusplus)
++#define __P(args)       args
++#else
++#define __P(args)       ()
++#endif
++
++/* Need definitions of struct sockaddr_in and FILE. */
++#include <netinet/in.h>
++#include <stdio.h>
++
++__BEGIN_DECLS
++
+ /* Structure to describe one communications endpoint. */
+ #define STRING_LENGTH 128             /* hosts, users, processes */
+@@ -25,10 +44,10 @@ struct request_info {
+     char    pid[10];                  /* access via eval_pid(request) */
+     struct host_info client[1];               /* client endpoint info */
+     struct host_info server[1];               /* server endpoint info */
+-    void  (*sink) ();                 /* datagram sink function or 0 */
+-    void  (*hostname) ();             /* address to printable hostname */
+-    void  (*hostaddr) ();             /* address to printable address */
+-    void  (*cleanup) ();              /* cleanup function or 0 */
++    void  (*sink) __P((int));         /* datagram sink function or 0 */
++    void  (*hostname) __P((struct host_info *)); /* address to printable hostname */
++    void  (*hostaddr) __P((struct host_info *)); /* address to printable address */
++    void  (*cleanup) __P((struct request_info *)); /* cleanup function or 0 */
+     struct netconfig *config;         /* netdir handle */
+ };
+@@ -61,25 +80,30 @@ extern char paranoid[];
+ /* Global functions. */
+ #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
+-extern void fromhost();                       /* get/validate client host info */
++extern void fromhost __P((struct request_info *));    /* get/validate client host info */
+ #else
+ #define fromhost sock_host            /* no TLI support needed */
+ #endif
+-extern int hosts_access();            /* access control */
+-extern void shell_cmd();              /* execute shell command */
+-extern char *percent_x();             /* do %<char> expansion */
+-extern void rfc931();                 /* client name from RFC 931 daemon */
+-extern void clean_exit();             /* clean up and exit */
+-extern void refuse();                 /* clean up and exit */
+-extern char *xgets();                 /* fgets() on steroids */
+-extern char *split_at();              /* strchr() and split */
+-extern unsigned long dot_quad_addr(); /* restricted inet_addr() */
++extern void shell_cmd __P((char *));  /* execute shell command */
++extern char *percent_x __P((char *, int, char *, struct request_info *)); /* do %<char> expansion */
++extern void rfc931 __P((struct sockaddr_in *, struct sockaddr_in *, char *)); /* client name from RFC 931 daemon */
++extern void clean_exit __P((struct request_info *)); /* clean up and exit */
++extern void refuse __P((struct request_info *));      /* clean up and exit */
++extern char *xgets __P((char *, int, FILE *));        /* fgets() on steroids */
++extern char *split_at __P((char *, int));     /* strchr() and split */
++extern unsigned long dot_quad_addr __P((char *)); /* restricted inet_addr() */
+ /* Global variables. */
++#ifdef HAVE_WEAKSYMS
++extern int allow_severity __attribute__ ((weak)); /* for connection logging */
++extern int deny_severity __attribute__ ((weak)); /* for connection logging */
++#else
+ extern int allow_severity;            /* for connection logging */
+ extern int deny_severity;             /* for connection logging */
++#endif
++
+ extern char *hosts_allow_table;               /* for verification mode redirection */
+ extern char *hosts_deny_table;                /* for verification mode redirection */
+ extern int hosts_access_verbose;      /* for verbose matching mode */
+@@ -92,9 +116,14 @@ extern int resident;                       /* > 0 if residen
+   */
+ #ifdef __STDC__
++extern int hosts_access(struct request_info *request);
++extern int hosts_ctl(char *daemon, char *client_name, char *client_addr, 
++                     char *client_user);
+ extern struct request_info *request_init(struct request_info *,...);
+ extern struct request_info *request_set(struct request_info *,...);
+ #else
++extern int hosts_access();
++extern int hosts_ctl();
+ extern struct request_info *request_init();   /* initialize request */
+ extern struct request_info *request_set();    /* update request structure */
+ #endif
+@@ -117,27 +146,31 @@ extern struct request_info *request_set(
+   * host_info structures serve as caches for the lookup results.
+   */
+-extern char *eval_user();             /* client user */
+-extern char *eval_hostname();         /* printable hostname */
+-extern char *eval_hostaddr();         /* printable host address */
+-extern char *eval_hostinfo();         /* host name or address */
+-extern char *eval_client();           /* whatever is available */
+-extern char *eval_server();           /* whatever is available */
++extern char *eval_user __P((struct request_info *));  /* client user */
++extern char *eval_hostname __P((struct host_info *)); /* printable hostname */
++extern char *eval_hostaddr __P((struct host_info *)); /* printable host address */
++extern char *eval_hostinfo __P((struct host_info *)); /* host name or address */
++extern char *eval_client __P((struct request_info *));        /* whatever is available */
++extern char *eval_server __P((struct request_info *));        /* whatever is available */
+ #define eval_daemon(r)        ((r)->daemon)   /* daemon process name */
+ #define eval_pid(r)   ((r)->pid)      /* process id */
+ /* Socket-specific methods, including DNS hostname lookups. */
+-extern void sock_host();              /* look up endpoint addresses */
+-extern void sock_hostname();          /* translate address to hostname */
+-extern void sock_hostaddr();          /* address to printable address */
++/* look up endpoint addresses */
++extern void sock_host __P((struct request_info *));
++/* translate address to hostname */
++extern void sock_hostname __P((struct host_info *));
++/* address to printable address */
++extern void sock_hostaddr __P((struct host_info *));
++
+ #define sock_methods(r) \
+       { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
+ /* The System V Transport-Level Interface (TLI) interface. */
+ #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
+-extern void tli_host();                       /* look up endpoint addresses etc. */
++extern void tli_host __P((struct request_info *));    /* look up endpoint addresses etc. */
+ #endif
+  /*
+@@ -178,7 +211,7 @@ extern struct tcpd_context tcpd_context;
+   * behavior.
+   */
+-extern void process_options();                /* execute options */
++extern void process_options __P((char *, struct request_info *)); /* execute options */
+ extern int dry_run;                   /* verification flag */
+ /* Bug workarounds. */
+@@ -217,3 +250,7 @@ extern char *fix_strtok();
+ #define strtok        my_strtok
+ extern char *my_strtok();
+ #endif
++
++__END_DECLS
++
++#endif /* tcpd.h */
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,10 @@
++GLIBC=$(shell grep -s -c __GLIBC__ /usr/include/features.h)
++
+ # @(#) Makefile 1.23 97/03/21 19:27:20
++# unset the HOSTNAME environment variable
++HOSTNAME =
++
+ what:
+       @echo
+       @echo "Usage: edit the REAL_DAEMON_DIR definition in the Makefile then:"
+@@ -19,7 +24,7 @@ what:
+       @echo " generic (most bsd-ish systems with sys5 compatibility)"
+       @echo " 386bsd aix alpha apollo bsdos convex-ultranet dell-gcc dgux dgux543"
+       @echo " dynix epix esix freebsd hpux irix4 irix5 irix6 isc iunix"
+-      @echo " linux machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
++      @echo " linux gnu machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
+       @echo " ptx-2.x ptx-generic pyramid sco sco-nis sco-od2 sco-os5 sinix sunos4"
+       @echo " sunos40 sunos5 sysv4 tandem ultrix unicos7 unicos8 unixware1 unixware2"
+       @echo " uts215 uxp"
+@@ -43,8 +48,8 @@ what:
+ # Ultrix 4.x SunOS 4.x ConvexOS 10.x Dynix/ptx
+ #REAL_DAEMON_DIR=/usr/etc
+ #
+-# SysV.4 Solaris 2.x OSF AIX
+-#REAL_DAEMON_DIR=/usr/sbin
++# SysV.4 Solaris 2.x OSF AIX Linux
++REAL_DAEMON_DIR=/usr/sbin
+ #
+ # BSD 4.4
+ #REAL_DAEMON_DIR=/usr/libexec
+@@ -141,10 +146,21 @@ freebsd:
+       LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
+       EXTRA_CFLAGS=-DSYS_ERRLIST_DEFINED VSYSLOG= all
++ifneq ($(GLIBC),0)
++MYLIB=-lnsl
++endif
++
+ linux:
+       @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
+-      LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
+-      NETGROUP= TLI= EXTRA_CFLAGS="-DBROKEN_SO_LINGER" all
++      LIBS=$(MYLIB) RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
++      NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= all \
++      EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_WEAKSYMS -D_REENTRANT"
++
++gnu:
++      @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
++      LIBS=$(MYLIB) RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
++      NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= all \
++      EXTRA_CFLAGS="-DHAVE_STRERROR -DHAVE_WEAKSYMS -D_REENTRANT"
+ # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
+ hpux hpux8 hpux9 hpux10:
+@@ -391,7 +407,7 @@ AR = ar
+ # the ones provided with this source distribution. The environ.c module
+ # implements setenv(), getenv(), and putenv().
+-AUX_OBJ= setenv.o
++#AUX_OBJ= setenv.o
+ #AUX_OBJ= environ.o
+ #AUX_OBJ= environ.o strcasecmp.o
+@@ -454,7 +470,8 @@ AUX_OBJ= setenv.o
+ # host name aliases. Compile with -DSOLARIS_24_GETHOSTBYNAME_BUG to work
+ # around this. The workaround does no harm on other Solaris versions.
+-BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
++BUGS =
++#BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
+ #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DINET_ADDR_BUG
+ #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DSOLARIS_24_GETHOSTBYNAME_BUG
+@@ -464,7 +481,7 @@ BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS
+ # If your system supports NIS or YP-style netgroups, enable the following
+ # macro definition. Netgroups are used only for host access control.
+ #
+-#NETGROUP= -DNETGROUP
++NETGROUP= -DNETGROUP
+ ###############################################################
+ # System dependencies: whether or not your system has vsyslog()
+@@ -491,7 +508,7 @@ VSYSLOG    = -Dvsyslog=myvsyslog
+ # Uncomment the next definition to turn on the language extensions
+ # (examples: allow, deny, banners, twist and spawn).
+ # 
+-#STYLE        = -DPROCESS_OPTIONS     # Enable language extensions.
++STYLE = -DPROCESS_OPTIONS     # Enable language extensions.
+ ################################################################
+ # Optional: Changing the default disposition of logfile records
+@@ -514,7 +531,7 @@ VSYSLOG    = -Dvsyslog=myvsyslog
+ #
+ # The LOG_XXX names below are taken from the /usr/include/syslog.h file.
+-FACILITY= LOG_MAIL    # LOG_MAIL is what most sendmail daemons use
++FACILITY= LOG_DAEMON  # LOG_MAIL is what most sendmail daemons use
+ # The syslog priority at which successful connections are logged.
+@@ -610,7 +627,7 @@ TABLES     = -DHOSTS_DENY=\"/etc/hosts.deny\
+ # Paranoid mode implies hostname lookup. In order to disable hostname
+ # lookups altogether, see the next section.
+-PARANOID= -DPARANOID
++#PARANOID= -DPARANOID
+ ########################################
+ # Optional: turning off hostname lookups
+@@ -623,7 +640,7 @@ PARANOID= -DPARANOID
+ # In order to perform selective hostname lookups, disable paranoid
+ # mode (see previous section) and comment out the following definition.
+-HOSTNAME= -DALWAYS_HOSTNAME
++#HOSTNAME= -DALWAYS_HOSTNAME
+ #############################################
+ # Optional: Turning on host ADDRESS checking
+@@ -649,28 +666,46 @@ HOSTNAME= -DALWAYS_HOSTNAME
+ # source-routed traffic in the kernel. Examples: 4.4BSD derivatives,
+ # Solaris 2.x, and Linux. See your system documentation for details.
+ #
+-# KILL_OPT= -DKILL_IP_OPTIONS
++KILL_OPT= -DKILL_IP_OPTIONS
+ ## End configuration options
+ ############################
+ # Protection against weird shells or weird make programs.
++CC    = gcc
+ SHELL = /bin/sh
+-.c.o:;        $(CC) $(CFLAGS) -c $*.c
++.c.o:;        $(CC) $(CFLAGS) -o $*.o -c $*.c
++
++SOMAJOR = 0
++SOMINOR = 7.6
++
++LIB   = libwrap.a
++SHLIB = shared/libwrap.so.$(SOMAJOR).$(SOMINOR)
++SHLIBSOMAJ= shared/libwrap.so.$(SOMAJOR)
++SHLIBSO       = shared/libwrap.so
++SHLIBFLAGS = -Lshared -lwrap
+-CFLAGS        = -O -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
++shared/%.o: %.c
++      $(CC) $(CFLAGS) $(SHCFLAGS) -c $< -o $@
++
++CFLAGS        = -O2 -g -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
+       $(BUGS) $(SYSTYPE) $(AUTH) $(UMASK) \
+       -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" $(STYLE) $(KILL_OPT) \
+       -DSEVERITY=$(SEVERITY) -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
+       $(UCHAR) $(TABLES) $(STRINGS) $(TLI) $(EXTRA_CFLAGS) $(DOT) \
+       $(VSYSLOG) $(HOSTNAME)
++SHLINKFLAGS = -shared -Xlinker -soname -Xlinker libwrap.so.$(SOMAJOR) -lc $(LIBS)
++SHCFLAGS = -fPIC -shared -D_REENTRANT
++
+ LIB_OBJ= hosts_access.o options.o shell_cmd.o rfc931.o eval.o \
+       hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJ) \
+       $(FROM_OBJ) fix_options.o socket.o tli.o workarounds.o \
+       update.o misc.o diag.o percent_m.o myvsyslog.o
++SHLIB_OBJ= $(addprefix shared/, $(LIB_OBJ));
++
+ FROM_OBJ= fromhost.o
+ KIT   = README miscd.c tcpd.c fromhost.c hosts_access.c shell_cmd.c \
+@@ -684,46 +719,78 @@ KIT      = README miscd.c tcpd.c fromhost.c h
+       refuse.c tcpdchk.8 setenv.c inetcf.c inetcf.h scaffold.c \
+       scaffold.h tcpdmatch.8 README.NIS
+-LIB   = libwrap.a
+-
+-all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk
++all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk $(LIB)
+ # Invalidate all object files when the compiler options (CFLAGS) have changed.
+ config-check:
+       @set +e; test -n "$(REAL_DAEMON_DIR)" || { make; exit 1; }
+-      @set +e; echo $(CFLAGS) >/tmp/cflags.$$$$ ; \
+-      if cmp cflags /tmp/cflags.$$$$ ; \
+-      then rm /tmp/cflags.$$$$ ; \
+-      else mv /tmp/cflags.$$$$ cflags ; \
++      @set +e; echo $(CFLAGS) >cflags.new ; \
++      if cmp cflags cflags.new ; \
++      then rm cflags.new ; \
++      else mv cflags.new cflags ; \
+       fi >/dev/null 2>/dev/null
++      @if [ ! -d shared ]; then mkdir shared; fi
+ $(LIB):       $(LIB_OBJ)
+       rm -f $(LIB)
+       $(AR) $(ARFLAGS) $(LIB) $(LIB_OBJ)
+       -$(RANLIB) $(LIB)
+-tcpd: tcpd.o $(LIB)
+-      $(CC) $(CFLAGS) -o $@ tcpd.o $(LIB) $(LIBS)
++$(SHLIB): $(SHLIB_OBJ)
++      rm -f $(SHLIB)
++      $(CC) -o $(SHLIB) $(SHLINKFLAGS) $(SHLIB_OBJ)
++      ln -s $(notdir $(SHLIB)) $(SHLIBSOMAJ)
++      ln -s $(notdir $(SHLIBSOMAJ)) $(SHLIBSO)
++
++tcpd: tcpd.o $(SHLIB)
++      $(CC) $(CFLAGS) -o $@ tcpd.o $(SHLIBFLAGS)
+-miscd:        miscd.o $(LIB)
+-      $(CC) $(CFLAGS) -o $@ miscd.o $(LIB) $(LIBS)
++miscd:        miscd.o $(SHLIB)
++      $(CC) $(CFLAGS) -o $@ miscd.o $(SHLIBFLAGS)
+-safe_finger: safe_finger.o $(LIB)
+-      $(CC) $(CFLAGS) -o $@ safe_finger.o $(LIB) $(LIBS)
++safe_finger: safe_finger.o $(SHLIB)
++      $(CC) $(CFLAGS) -o $@ safe_finger.o $(SHLIBFLAGS)
+ TCPDMATCH_OBJ = tcpdmatch.o fakelog.o inetcf.o scaffold.o
+-tcpdmatch: $(TCPDMATCH_OBJ) $(LIB)
+-      $(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(LIB) $(LIBS)
++tcpdmatch: $(TCPDMATCH_OBJ) $(SHLIB)
++      $(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(SHLIBFLAGS)
+-try-from: try-from.o fakelog.o $(LIB)
+-      $(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(LIB) $(LIBS)
++try-from: try-from.o fakelog.o $(SHLIB)
++      $(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(SHLIBFLAGS)
+ TCPDCHK_OBJ = tcpdchk.o fakelog.o inetcf.o scaffold.o
+-tcpdchk: $(TCPDCHK_OBJ) $(LIB)
+-      $(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(LIB) $(LIBS)
++tcpdchk: $(TCPDCHK_OBJ) $(SHLIB)
++      $(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(SHLIBFLAGS)
++
++install: install-lib install-bin install-dev
++
++install-lib:
++      install -o root -g root -m 0644 $(SHLIB) ${DESTDIR}/lib/
++      ln -s $(notdir $(SHLIB)) ${DESTDIR}/lib/$(notdir $(SHLIBSOMAJ))
++
++install-bin:
++      install -o root -g root -m 0755 tcpd ${DESTDIR}/usr/sbin/
++      install -o root -g root -m 0755 tcpdchk ${DESTDIR}/usr/sbin/
++      install -o root -g root -m 0755 tcpdmatch ${DESTDIR}/usr/sbin/
++      install -o root -g root -m 0755 try-from ${DESTDIR}/usr/sbin/
++      install -o root -g root -m 0755 safe_finger ${DESTDIR}/usr/sbin/
++      install -o root -g root -m 0644 tcpd.8 ${DESTDIR}/usr/share/man/man8/
++      install -o root -g root -m 0644 tcpdchk.8 ${DESTDIR}/usr/share/man/man8/
++      install -o root -g root -m 0644 tcpdmatch.8 ${DESTDIR}/usr/share/man/man8/
++      install -o root -g root -m 0644 hosts_access.5 ${DESTDIR}/usr/share/man/man5/
++      install -o root -g root -m 0644 hosts_options.5 ${DESTDIR}/usr/share/man/man5/
++
++install-dev:
++      ln -s /lib/$(notdir $(SHLIBSOMAJ)) ${DESTDIR}/usr/lib/$(notdir $(SHLIBSO))
++      install -o root -g root -m 0644 hosts_access.3 ${DESTDIR}/usr/share/man/man3/
++      install -o root -g root -m 0644 tcpd.h ${DESTDIR}/usr/include/
++      install -o root -g root -m 0644 $(LIB) ${DESTDIR}/usr/lib/
++      ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/hosts_ctl.3
++      ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/request_init.3
++      ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/request_set.3
+ shar: $(KIT)
+       @shar $(KIT)
+@@ -739,7 +806,8 @@ archive:
+ clean:
+       rm -f tcpd miscd safe_finger tcpdmatch tcpdchk try-from *.[oa] core \
+-      cflags
++      cflags libwrap*.so*
++      rm -rf shared
+ tidy: clean
+       chmod -R a+r .
+@@ -885,5 +953,6 @@ update.o: cflags
+ update.o: mystdarg.h
+ update.o: tcpd.h
+ vfprintf.o: cflags
++weak_symbols.o: tcpd.h
+ workarounds.o: cflags
+ workarounds.o: tcpd.h
+--- a/hosts_access.5
++++ b/hosts_access.5
+@@ -8,9 +8,9 @@ name, host name/address) patterns.  Exam
+ impatient reader is encouraged to skip to the EXAMPLES section for a
+ quick introduction.
+ .PP
+-An extended version of the access control language is described in the
+-\fIhosts_options\fR(5) document. The extensions are turned on at
+-program build time by building with -DPROCESS_OPTIONS.
++The extended version of the access control language is described in the
++\fIhosts_options\fR(5) document. \fBNote that this language supersedes
++the meaning of \fIshell_command\fB as documented below.\fR
+ .PP
+ In the following text, \fIdaemon\fR is the the process name of a
+ network daemon process, and \fIclient\fR is the name and/or address of
+@@ -40,7 +40,7 @@ A newline character is ignored when it i
+ character. This permits you to break up long lines so that they are
+ easier to edit.
+ .IP \(bu
+-Blank lines or lines that begin with a `#\' character are ignored.
++Blank lines or lines that begin with a `#' character are ignored.
+ This permits you to insert comments and whitespace so that the tables
+ are easier to read.
+ .IP \(bu
+@@ -69,26 +69,33 @@ checks are case insensitive.
+ .SH PATTERNS
+ The access control language implements the following patterns:
+ .IP \(bu
+-A string that begins with a `.\' character. A host name is matched if
++A string that begins with a `.' character. A host name is matched if
+ the last components of its name match the specified pattern.  For
+-example, the pattern `.tue.nl\' matches the host name
+-`wzv.win.tue.nl\'.
++example, the pattern `.tue.nl' matches the host name
++`wzv.win.tue.nl'.
+ .IP \(bu
+-A string that ends with a `.\' character. A host address is matched if
++A string that ends with a `.' character. A host address is matched if
+ its first numeric fields match the given string.  For example, the
+-pattern `131.155.\' matches the address of (almost) every host on the
++pattern `131.155.' matches the address of (almost) every host on the
+ Eind\%hoven University network (131.155.x.x).
+ .IP \(bu
+-A string that begins with an `@\' character is treated as an NIS
++A string that begins with an `@' character is treated as an NIS
+ (formerly YP) netgroup name. A host name is matched if it is a host
+ member of the specified netgroup. Netgroup matches are not supported
+ for daemon process names or for client user names.
+ .IP \(bu
+-An expression of the form `n.n.n.n/m.m.m.m\' is interpreted as a
+-`net/mask\' pair. A host address is matched if `net\' is equal to the
+-bitwise AND of the address and the `mask\'. For example, the net/mask
+-pattern `131.155.72.0/255.255.254.0\' matches every address in the
+-range `131.155.72.0\' through `131.155.73.255\'.
++An expression of the form `n.n.n.n/m.m.m.m' is interpreted as a
++`net/mask' pair. A host address is matched if `net' is equal to the
++bitwise AND of the address and the `mask'. For example, the net/mask
++pattern `131.155.72.0/255.255.254.0' matches every address in the
++range `131.155.72.0' through `131.155.73.255'.
++.IP \(bu
++A string that begins with a `/' character is treated as a file
++name. A host name or address is matched if it matches any host name
++or address pattern listed in the named file. The file format is
++zero or more lines with zero or more host name or address patterns
++separated by whitespace.  A file name pattern can be used anywhere
++a host name or address pattern can be used.
+ .SH WILDCARDS
+ The access control language supports explicit wildcards:
+ .IP ALL
+@@ -115,19 +122,19 @@ without -DPARANOID when you want more co
+ .ne 6
+ .SH OPERATORS
+ .IP EXCEPT
+-Intended use is of the form: `list_1 EXCEPT list_2\'; this construct
++Intended use is of the form: `list_1 EXCEPT list_2'; this construct
+ matches anything that matches \fIlist_1\fR unless it matches
+ \fIlist_2\fR.  The EXCEPT operator can be used in daemon_lists and in
+ client_lists. The EXCEPT operator can be nested: if the control
+-language would permit the use of parentheses, `a EXCEPT b EXCEPT c\'
+-would parse as `(a EXCEPT (b EXCEPT c))\'.
++language would permit the use of parentheses, `a EXCEPT b EXCEPT c'
++would parse as `(a EXCEPT (b EXCEPT c))'.
+ .br
+ .ne 6
+ .SH SHELL COMMANDS
+ If the first-matched access control rule contains a shell command, that
+ command is subjected to %<letter> substitutions (see next section).
+ The result is executed by a \fI/bin/sh\fR child process with standard
+-input, output and error connected to \fI/dev/null\fR.  Specify an `&\'
++input, output and error connected to \fI/dev/null\fR.  Specify an `&'
+ at the end of the command if you do not want to wait until it has
+ completed.
+ .PP
+@@ -159,7 +166,7 @@ depending on how much information is ava
+ .IP %u
+ The client user name (or "unknown").
+ .IP %%
+-Expands to a single `%\' character.
++Expands to a single `%' character.
+ .PP
+ Characters in % expansions that may confuse the shell are replaced by
+ underscores.
+@@ -243,9 +250,9 @@ A positive IDENT lookup result (the clie
+ less trustworthy. It is possible for an intruder to spoof both the
+ client connection and the IDENT lookup, although doing so is much
+ harder than spoofing just a client connection. It may also be that
+-the client\'s IDENT server is lying.
++the client's IDENT server is lying.
+ .PP
+-Note: IDENT lookups don\'t work with UDP services. 
++Note: IDENT lookups don't work with UDP services. 
+ .SH EXAMPLES
+ The language is flexible enough that different types of access control
+ policy can be expressed with a minimum of fuss. Although the language
+@@ -285,7 +292,7 @@ ALL: LOCAL @some_netgroup
+ .br
+ ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
+ .PP
+-The first rule permits access from hosts in the local domain (no `.\'
++The first rule permits access from hosts in the local domain (no `.'
+ in the host name) and from members of the \fIsome_netgroup\fP
+ netgroup.  The second rule permits access from all hosts in the
+ \fIfoobar.edu\fP domain (notice the leading dot), with the exception of
+@@ -322,8 +329,8 @@ in.tftpd: LOCAL, .my.domain
+ /etc/hosts.deny:
+ .in +3
+ .nf
+-in.tftpd: ALL: (/some/where/safe_finger -l @%h | \\
+-      /usr/ucb/mail -s %d-%h root) &
++in.tftpd: ALL: (/usr/sbin/safe_finger -l @%h | \\
++      /usr/bin/mail -s %d-%h root) &
+ .fi
+ .PP
+ The safe_finger command comes with the tcpd wrapper and should be
+@@ -349,7 +356,7 @@ control rule; when the length of an acce
+ capacity of an internal buffer; when an access control rule is not
+ terminated by a newline character; when the result of %<letter>
+ expansion would overflow an internal buffer; when a system call fails
+-that shouldn\'t.  All problems are reported via the syslog daemon.
++that shouldn't.  All problems are reported via the syslog daemon.
+ .SH FILES
+ .na
+ .nf
+--- a/rfc931.c
++++ b/rfc931.c
+@@ -33,7 +33,7 @@ static char sccsid[] = "@(#) rfc931.c 1.
+ int     rfc931_timeout = RFC931_TIMEOUT;/* Global so it can be changed */
+-static jmp_buf timebuf;
++static sigjmp_buf timebuf;
+ /* fsocket - open stdio stream on top of socket */
+@@ -62,7 +62,7 @@ int     protocol;
+ static void timeout(sig)
+ int     sig;
+ {
+-    longjmp(timebuf, sig);
++    siglongjmp(timebuf, sig);
+ }
+ /* rfc931 - return remote user name, given socket structures */
+@@ -99,7 +99,7 @@ char   *dest;
+        * Set up a timer so we won't get stuck while waiting for the server.
+        */
+-      if (setjmp(timebuf) == 0) {
++      if (sigsetjmp(timebuf,1) == 0) {
+           signal(SIGALRM, timeout);
+           alarm(rfc931_timeout);
+--- a/tcpd.8
++++ b/tcpd.8
+@@ -94,7 +94,7 @@ configuration files.
+ .PP
+ The example assumes that the network daemons live in /usr/etc. On some
+ systems, network daemons live in /usr/sbin or in /usr/libexec, or have
+-no `in.\' prefix to their name.
++no `in.' prefix to their name.
+ .SH EXAMPLE 2
+ This example applies when \fItcpd\fR expects that the network daemons
+ are left in their original place.
+@@ -110,26 +110,26 @@ finger  stream  tcp  nowait  nobody  /us
+ becomes:
+ .sp
+ .ti +5
+-finger  stream  tcp  nowait  nobody  /some/where/tcpd     in.fingerd
++finger  stream  tcp  nowait  nobody  /usr/sbin/tcpd       in.fingerd
+ .sp
+ .fi
+ .PP
+ The example assumes that the network daemons live in /usr/etc. On some
+ systems, network daemons live in /usr/sbin or in /usr/libexec, the
+-daemons have no `in.\' prefix to their name, or there is no userid
++daemons have no `in.' prefix to their name, or there is no userid
+ field in the inetd configuration file.
+ .PP
+ Similar changes will be needed for the other services that are to be
+-covered by \fItcpd\fR.  Send a `kill -HUP\' to the \fIinetd\fR(8)
++covered by \fItcpd\fR.  Send a `kill -HUP' to the \fIinetd\fR(8)
+ process to make the changes effective. AIX users may also have to
+-execute the `inetimp\' command.
++execute the `inetimp' command.
+ .SH EXAMPLE 3
+ In the case of daemons that do not live in a common directory ("secret"
+ or otherwise), edit the \fIinetd\fR configuration file so that it
+ specifies an absolute path name for the process name field. For example:
+ .nf
+ .sp
+-    ntalk  dgram  udp  wait  root  /some/where/tcpd  /usr/local/lib/ntalkd
++    ntalk  dgram  udp  wait  root  /usr/sbin/tcpd  /usr/sbin/in.ntalkd
+ .sp
+ .fi
+ .PP
+--- a/hosts_access.3
++++ b/hosts_access.3
+@@ -3,7 +3,7 @@
+ hosts_access, hosts_ctl, request_init, request_set \- access control library
+ .SH SYNOPSIS
+ .nf
+-#include "tcpd.h"
++#include <tcpd.h>
+ extern int allow_severity;
+ extern int deny_severity;
+--- a/options.c
++++ b/options.c
+@@ -473,6 +473,9 @@ static struct syslog_names log_fac[] = {
+ #ifdef LOG_CRON
+     "cron", LOG_CRON,
+ #endif
++#ifdef LOG_FTP
++    "ftp", LOG_FTP,
++#endif
+ #ifdef LOG_LOCAL0
+     "local0", LOG_LOCAL0,
+ #endif
+--- a/fix_options.c
++++ b/fix_options.c
+@@ -35,7 +35,12 @@ struct request_info *request;
+ #ifdef IP_OPTIONS
+     unsigned char optbuf[BUFFER_SIZE / 3], *cp;
+     char    lbuf[BUFFER_SIZE], *lp;
++#if !defined(__GLIBC__)
+     int     optsize = sizeof(optbuf), ipproto;
++#else /* __GLIBC__ */
++    size_t  optsize = sizeof(optbuf);
++    int     ipproto;
++#endif /* __GLIBC__ */
+     struct protoent *ip;
+     int     fd = request->fd;
+     unsigned int opt;
+--- a/workarounds.c
++++ b/workarounds.c
+@@ -163,7 +163,11 @@ int    *fromlen;
+ int     fix_getpeername(sock, sa, len)
+ int     sock;
+ struct sockaddr *sa;
++#if !defined(__GLIBC__)
+ int    *len;
++#else /* __GLIBC__ */
++size_t *len;
++#endif /* __GLIBC__ */
+ {
+     int     ret;
+     struct sockaddr_in *sin = (struct sockaddr_in *) sa;
+--- a/socket.c
++++ b/socket.c
+@@ -76,7 +76,11 @@ struct request_info *request;
+ {
+     static struct sockaddr_in client;
+     static struct sockaddr_in server;
++#if !defined (__GLIBC__)
+     int     len;
++#else /* __GLIBC__ */
++    size_t  len;
++#endif /* __GLIBC__ */
+     char    buf[BUFSIZ];
+     int     fd = request->fd;
+@@ -224,7 +228,11 @@ int     fd;
+ {
+     char    buf[BUFSIZ];
+     struct sockaddr_in sin;
++#if !defined(__GLIBC__)
+     int     size = sizeof(sin);
++#else /* __GLIBC__ */
++    size_t  size = sizeof(sin);
++#endif /* __GLIBC__ */
+     /*
+      * Eat up the not-yet received datagram. Some systems insist on a
+--- a/safe_finger.c
++++ b/safe_finger.c
+@@ -26,21 +26,24 @@ static char sccsid[] = "@(#) safe_finger
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <pwd.h>
++#include <syslog.h>
+ extern void exit();
+ /* Local stuff */
+-char    path[] = "PATH=/bin:/usr/bin:/usr/ucb:/usr/bsd:/etc:/usr/etc:/usr/sbin";
++char    path[] = "PATH=/bin:/usr/bin:/sbin:/usr/sbin";
+ #define       TIME_LIMIT      60              /* Do not keep listinging forever */
+ #define       INPUT_LENGTH    100000          /* Do not keep listinging forever */
+ #define       LINE_LENGTH     128             /* Editors can choke on long lines */
+ #define       FINGER_PROGRAM  "finger"        /* Most, if not all, UNIX systems */
+ #define       UNPRIV_NAME     "nobody"        /* Preferred privilege level */
+-#define       UNPRIV_UGID     32767           /* Default uid and gid */
++#define       UNPRIV_UGID     65534           /* Default uid and gid */
+ int     finger_pid;
++int   allow_severity = SEVERITY;
++int   deny_severity = LOG_WARNING;
+ void    cleanup(sig)
+ int     sig;
+--- a/hosts_options.5
++++ b/hosts_options.5
+@@ -58,12 +58,12 @@ Notice the leading dot on the domain nam
+ Execute, in a child process, the specified shell command, after
+ performing the %<letter> expansions described in the hosts_access(5)
+ manual page.  The command is executed with stdin, stdout and stderr
+-connected to the null device, so that it won\'t mess up the
++connected to the null device, so that it won't mess up the
+ conversation with the client host. Example:
+ .sp
+ .nf
+ .ti +3
+-spawn (/some/where/safe_finger -l @%h | /usr/ucb/mail root) &
++spawn (/usr/sbin/safe_finger -l @%h | /usr/bin/mail root) &
+ .fi
+ .sp
+ executes, in a background child process, the shell command "safe_finger
+--- a/tcpdchk.c
++++ b/tcpdchk.c
+@@ -350,6 +350,8 @@ char   *pat;
+ {
+     if (pat[0] == '@') {
+       tcpd_warn("%s: daemon name begins with \"@\"", pat);
++    } else if (pat[0] == '/') {
++        tcpd_warn("%s: daemon name begins with \"/\"", pat);
+     } else if (pat[0] == '.') {
+       tcpd_warn("%s: daemon name begins with dot", pat);
+     } else if (pat[strlen(pat) - 1] == '.') {
+@@ -382,6 +384,8 @@ char   *pat;
+ {
+     if (pat[0] == '@') {                      /* @netgroup */
+       tcpd_warn("%s: user name begins with \"@\"", pat);
++    } else if (pat[0] == '/') {
++        tcpd_warn("%s: user name begins with \"/\"", pat);
+     } else if (pat[0] == '.') {
+       tcpd_warn("%s: user name begins with dot", pat);
+     } else if (pat[strlen(pat) - 1] == '.') {
+@@ -402,8 +406,13 @@ char   *pat;
+ static int check_host(pat)
+ char   *pat;
+ {
++    char    buf[BUFSIZ];
+     char   *mask;
+     int     addr_count = 1;
++    FILE   *fp;
++    struct tcpd_context saved_context;
++    char   *cp;
++    char   *wsp = " \t\r\n";
+     if (pat[0] == '@') {                      /* @netgroup */
+ #ifdef NO_NETGRENT
+@@ -422,6 +431,21 @@ char   *pat;
+       tcpd_warn("netgroup support disabled");
+ #endif
+ #endif
++    } else if (pat[0] == '/') {                 /* /path/name */
++        if ((fp = fopen(pat, "r")) != 0) {
++            saved_context = tcpd_context;
++            tcpd_context.file = pat;
++            tcpd_context.line = 0;
++            while (fgets(buf, sizeof(buf), fp)) {
++                tcpd_context.line++;
++                for (cp = strtok(buf, wsp); cp; cp = strtok((char *) 0, wsp))
++                    check_host(cp);
++            }
++            tcpd_context = saved_context;
++            fclose(fp);
++        } else if (errno != ENOENT) {
++            tcpd_warn("open %s: %m", pat);
++        }
+     } else if (mask = split_at(pat, '/')) {   /* network/netmask */
+       if (dot_quad_addr(pat) == INADDR_NONE
+           || dot_quad_addr(mask) == INADDR_NONE)
+--- a/percent_m.c
++++ b/percent_m.c
+@@ -13,7 +13,7 @@ static char sccsid[] = "@(#) percent_m.c
+ #include <string.h>
+ extern int errno;
+-#ifndef SYS_ERRLIST_DEFINED
++#if !defined(SYS_ERRLIST_DEFINED) && !defined(HAVE_STRERROR)
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ #endif
+@@ -29,11 +29,15 @@ char   *ibuf;
+     while (*bp = *cp)
+       if (*cp == '%' && cp[1] == 'm') {
++#ifdef HAVE_STRERROR
++            strcpy(bp, strerror(errno));
++#else
+           if (errno < sys_nerr && errno > 0) {
+               strcpy(bp, sys_errlist[errno]);
+           } else {
+               sprintf(bp, "Unknown error %d", errno);
+           }
++#endif
+           bp += strlen(bp);
+           cp += 2;
+       } else {
+--- a/scaffold.c
++++ b/scaffold.c
+@@ -180,10 +180,12 @@ struct request_info *request;
+ /* ARGSUSED */
+-void    rfc931(request)
+-struct request_info *request;
++void    rfc931(rmt_sin, our_sin, dest)
++struct sockaddr_in *rmt_sin;
++struct sockaddr_in *our_sin;
++char   *dest;
+ {
+-    strcpy(request->user, unknown);
++    strcpy(dest, unknown);
+ }
+ /* check_path - examine accessibility */
+--- /dev/null
++++ b/weak_symbols.c
+@@ -0,0 +1,11 @@
++ /*
++  * @(#) weak_symbols.h 1.5 99/12/29 23:50
++  * 
++  * Author: Anthony Towns <ajt@debian.org>
++  */
++
++#ifdef HAVE_WEAKSYMS
++#include <syslog.h>
++int deny_severity = LOG_WARNING;
++int allow_severity = SEVERITY; 
++#endif
diff --git a/package/libs/tcp_wrappers/patches/002-opt_cflags.patch b/package/libs/tcp_wrappers/patches/002-opt_cflags.patch
new file mode 100644 (file)
index 0000000..1f38eb3
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/Makefile
++++ b/Makefile
+@@ -689,7 +689,8 @@ SHLIBFLAGS = -Lshared -lwrap
+ shared/%.o: %.c
+       $(CC) $(CFLAGS) $(SHCFLAGS) -c $< -o $@
+-CFLAGS        = -O2 -g -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
++OPT_CFLAGS = -O2 -g
++CFLAGS        = $(OPT_CFLAGS) -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
+       $(BUGS) $(SYSTYPE) $(AUTH) $(UMASK) \
+       -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" $(STYLE) $(KILL_OPT) \
+       -DSEVERITY=$(SEVERITY) -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
diff --git a/package/libs/tcp_wrappers/patches/003-scaffold_malloc.patch b/package/libs/tcp_wrappers/patches/003-scaffold_malloc.patch
new file mode 100644 (file)
index 0000000..ecda5ae
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/scaffold.c
++++ b/scaffold.c
+@@ -20,13 +20,12 @@ static char sccs_id[] = "@(#) scaffold.c
+ #include <syslog.h>
+ #include <setjmp.h>
+ #include <string.h>
++#include <stdlib.h>
+ #ifndef INADDR_NONE
+ #define       INADDR_NONE     (-1)            /* XXX should be 0xffffffff */
+ #endif
+-extern char *malloc();
+-
+ /* Application-specific. */
+ #include "tcpd.h"
diff --git a/package/libs/tcp_wrappers/patches/004-ipv4_prefix.patch b/package/libs/tcp_wrappers/patches/004-ipv4_prefix.patch
new file mode 100644 (file)
index 0000000..29c9cef
--- /dev/null
@@ -0,0 +1,72 @@
+--- a/hosts_access.5
++++ b/hosts_access.5
+@@ -90,6 +90,9 @@ bitwise AND of the address and the `mask
+ pattern `131.155.72.0/255.255.254.0' matches every address in the
+ range `131.155.72.0' through `131.155.73.255'.
+ .IP \(bu
++An expression of the form `n.n.n.n/m\' is interpreted as a
++`net/prefixlen\' pair, as below, for IPv4 addresses.
++.IP \(bu
+ A string that begins with a `/' character is treated as a file
+ name. A host name or address is matched if it matches any host name
+ or address pattern listed in the named file. The file format is
+--- a/tcpd.h
++++ b/tcpd.h
+@@ -93,6 +93,7 @@ extern void refuse __P((struct request_i
+ extern char *xgets __P((char *, int, FILE *));        /* fgets() on steroids */
+ extern char *split_at __P((char *, int));     /* strchr() and split */
+ extern unsigned long dot_quad_addr __P((char *)); /* restricted inet_addr() */
++extern unsigned long prefix_to_netmask __P((char *)); /* 0-32 prefix length */
+ /* Global variables. */
+--- a/misc.c
++++ b/misc.c
+@@ -14,6 +14,8 @@ static char sccsic[] = "@(#) misc.c 1.2
+ #include <arpa/inet.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <ctype.h>
++#include <stdlib.h>
+ #include "tcpd.h"
+@@ -85,3 +87,22 @@ char   *str;
+     }
+     return (runs == 4 ? inet_addr(str) : INADDR_NONE);
+ }
++
++/* prefix_to_netmask - convert prefix (0-32) to netmask */
++
++unsigned long prefix_to_netmask(str)
++char  *str;
++{
++    unsigned long prefix;
++    char *endptr;
++
++    if (!isdigit(str[0]))
++      return INADDR_NONE;
++
++    prefix = strtoul(str, &endptr, 10);
++    if ((endptr == str) || (*endptr != '\0') || (prefix > 32))
++      return INADDR_NONE;
++
++    return htonl(~0UL << (32 - prefix));
++}
++
+--- a/hosts_access.c
++++ b/hosts_access.c
+@@ -345,7 +345,12 @@ char   *string;
+     if ((addr = dot_quad_addr(string)) == INADDR_NONE)
+       return (NO);
+     if ((net = dot_quad_addr(net_tok)) == INADDR_NONE
+-      || (mask = dot_quad_addr(mask_tok)) == INADDR_NONE) {
++      || ((mask = dot_quad_addr(mask_tok)) == INADDR_NONE
++          && strcmp(mask_tok, "255.255.255.255")
++          && (mask = prefix_to_netmask(mask_tok)) == INADDR_NONE
++          && strcmp(mask_tok, "32"))) {
++      /* 255.255.255.255 == INADDR_NONE, separate check needed. TJ. */
++      /* 32 == INADDR_NONE, separate check needed. philipp */
+       tcpd_warn("bad net/mask expression: %s/%s", net_tok, mask_tok);
+       return (NO);                            /* not tcpd_jump() */
+     }
diff --git a/package/libs/tcp_wrappers/patches/005-no--lnsl-on-musl.patch b/package/libs/tcp_wrappers/patches/005-no--lnsl-on-musl.patch
new file mode 100644 (file)
index 0000000..5e7b968
--- /dev/null
@@ -0,0 +1,22 @@
+Index: tcp_wrappers_7.6/Makefile
+===================================================================
+--- tcp_wrappers_7.6.orig/Makefile
++++ tcp_wrappers_7.6/Makefile
+@@ -1,4 +1,4 @@
+-GLIBC=$(shell grep -s -c __GLIBC__ /usr/include/features.h)
++GLIBC=$(shell grep -s -c __GLIBC__ ${STAGING_DIR}/usr/include/features.h)
+ # @(#) Makefile 1.23 97/03/21 19:27:20
+@@ -146,9 +146,11 @@ freebsd:
+       LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
+       EXTRA_CFLAGS=-DSYS_ERRLIST_DEFINED VSYSLOG= all
++ifneq ($(GLIBC),)
+ ifneq ($(GLIBC),0)
+ MYLIB=-lnsl
+ endif
++endif
+ linux:
+       @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
index ff6c4b7d015c821e37670abdaa22661734a82484..b9b9e19dfb1157faa375230598e0307ef279d675 100644 (file)
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ustream-ssl
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/ustream-ssl.git
diff --git a/package/luci/applications/luci-app-shellinabox/Makefile b/package/luci/applications/luci-app-shellinabox/Makefile
new file mode 100644 (file)
index 0000000..7de7407
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2017 Robert Call <bob@bobcall.me>
+#
+# You may redistribute this program and/or modify it under the terms of
+# the GNU General Public License as published by the Free Software Foundation,
+# either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luci-app-shellinabox
+PKG_VERSION:=0.1
+PKG_RELEASE:=4
+
+PKG_LICENSE:=GPL-3.0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luci-app-shellinabox
+       SECTION:=luci
+       CATEGORY:=LuCI
+       SUBMENU:=3. Applications
+       TITLE:=Shell in a box integration
+       URL:=
+       MAINTAINER:=Robert Call <bob@bobcall.me>
+       DEPENDS:=+shellinabox
+endef
+
+define Package/luci-app-shellinabox/description
+       This package adds terminal integration into luci to make
+       router maintanance easier for those new to GNU/Linux or
+       don't have access to a GNU/Linux box.
+
+endef
+
+define Build/Compile
+endef
+
+define Package/luci-app-shellinabox/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci
+       $(INSTALL_DIR) $(1)/www/static
+       $(CP) ./luasrc/* $(1)/usr/lib/lua/luci
+       $(CP) ./files/terminal.png $(1)/www/static/terminal.png
+endef
+
+$(eval $(call BuildPackage,luci-app-shellinabox))
diff --git a/package/luci/applications/luci-app-shellinabox/files/terminal.png b/package/luci/applications/luci-app-shellinabox/files/terminal.png
new file mode 100644 (file)
index 0000000..db5a4ff
Binary files /dev/null and b/package/luci/applications/luci-app-shellinabox/files/terminal.png differ
diff --git a/package/luci/applications/luci-app-shellinabox/luasrc/controller/shellinabox.lua b/package/luci/applications/luci-app-shellinabox/luasrc/controller/shellinabox.lua
new file mode 100644 (file)
index 0000000..9e3a4a0
--- /dev/null
@@ -0,0 +1,4 @@
+module("luci.controller.shellinabox", package.seeall)  --notice that new_tab is the name of the file new_tab.lua
+ function index()
+     entry({"admin", "system", "tab_from_view"}, template("shellinabox/view_tab"), "Terminal", 2)  --this adds the second sub-tab that is located in <luci-path>/luci-myapplication/view/myapp-mymodule and the file is called view_tab.htm, also set to the second position
+end
diff --git a/package/luci/applications/luci-app-shellinabox/luasrc/model/cbi/shellinabox/cbi_tab.lua b/package/luci/applications/luci-app-shellinabox/luasrc/model/cbi/shellinabox/cbi_tab.lua
new file mode 100644 (file)
index 0000000..a8d9649
--- /dev/null
@@ -0,0 +1,4 @@
+m = Map("cbi_file", translate("First Tab Form"), translate("Please fill out the form below")) -- cbi_file is the config file in /etc/config
+d = m:section(TypedSection, "info", "Part A of the form")  -- info is the section called info in cbi_file
+a = d:option(Value, "name", "Name"); a.optional=false; a.rmempty = false;  -- name is the option in the cbi_file
+return m
diff --git a/package/luci/applications/luci-app-shellinabox/luasrc/view/shellinabox/view_tab.htm b/package/luci/applications/luci-app-shellinabox/luasrc/view/shellinabox/view_tab.htm
new file mode 100644 (file)
index 0000000..2f4d26c
--- /dev/null
@@ -0,0 +1,3 @@
+<%+header%>                                                                    
+<a href="http://192.168.10.1:4200"><img src="/static/terminal.png"></a>
+<%+footer%>
index e5fcb8c916803978460ec2a67f351ecd9564d9c7..47ce836b86f3bc4314f30b0f21068fab3384956c 100644 (file)
@@ -9,13 +9,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=firewall
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/project/firewall3.git
-PKG_SOURCE_DATE:=2017-05-27
-PKG_SOURCE_VERSION:=a4d98aea373e04f3fdc3c492c1688ba52ce490a9
-PKG_MIRROR_HASH:=55402b1e6bb471f6aed599c61c1c63b58212f5789f094d78247646fc0a7cf435
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git
+PKG_SOURCE_DATE:=2017-11-07
+PKG_SOURCE_VERSION:=c4309372acc7e1bef8aa230269f7da1dec790e68
+PKG_MIRROR_HASH:=1699884d8499d01e433959185f79ff9eb69704de47885b996123374b8015b422
 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
 PKG_LICENSE:=ISC
 
@@ -28,7 +28,7 @@ define Package/firewall
   SECTION:=net
   CATEGORY:=Base system
   TITLE:=OpenWrt C Firewall
-  DEPENDS:=+libubox +libubus +libuci +libip4tc +IPV6:libip6tc +libxtables +kmod-ipt-core +kmod-ipt-conntrack +kmod-ipt-nat
+  DEPENDS:=+libubox +libubus +libuci +libip4tc +IPV6:libip6tc +libxtables +kmod-ipt-core +kmod-ipt-conntrack +IPV6:kmod-nf-conntrack6 +kmod-ipt-nat
 endef
 
 define Package/firewall/description
index fb035864017df739a0d0b0c0451fe8488a40c77c..d2210e7c2e148917fca62180c3a66e002b9a2f7c 100644 (file)
@@ -1,13 +1,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=netifd
-PKG_RELEASE:=1
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/project/netifd.git
-PKG_SOURCE_DATE:=2017-01-25
-PKG_SOURCE_VERSION:=650758b16e5185505a3fbc1307949340af70b611
-PKG_MIRROR_HASH:=d09c740bc1bf6269678bd75c9af52ecd4be3d1d59402a543ceb9d4459cecfa2b
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
+PKG_SOURCE_DATE:=2018-02-05
+PKG_SOURCE_VERSION:=1be329c66326c86d7a48ba71004fcef7691bbbf9
+PKG_MIRROR_HASH:=06c1c24ed56b4fe39b92b33719f8bd4f9a8fe3c6a25ce02a6a245e859f1237bf
 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
 
 PKG_LICENSE:=GPL-2.0
index a825dfd31fbc805feae2ede556ddef7f728dfb72..6cd167d19d221dead5e0dc28a518c21c8c120dbb 100755 (executable)
@@ -26,9 +26,12 @@ start_service() {
 }
 
 reload_service() {
+       local rv=0
+
        init_switch
-       ubus call network reload
+       ubus call network reload || rv=1
        /sbin/wifi reload_legacy
+       return $rv
 }
 
 stop_service() {
index b3a61e27509061f9d6aa849deb45130f88a12161..00604f40e70e8ba988bde6af04437d326b5b548a 100755 (executable)
@@ -18,10 +18,18 @@ setup_interface () {
        proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}"
        # TODO: apply $broadcast
 
+       local ip_net
+       eval "$(ipcalc.sh "$ip/$mask")";ip_net="$NETWORK"
+
+       local i
        for i in $router; do
-               proto_add_ipv4_route "$i" 32 "" "$ip"
+               local gw_net
+               eval "$(ipcalc.sh "$i/$mask")";gw_net="$NETWORK"
+
+               [ "$ip_net" != "$gw_net" ] && proto_add_ipv4_route "$i" 32 "" "$ip"
                proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
 
+               local r
                for r in $CUSTOMROUTES; do
                        proto_add_ipv4_route "${r%%/*}" "${r##*/}" "$i" "$ip"
                done
@@ -31,11 +39,11 @@ setup_interface () {
        [ -n "$staticroutes" ] && set_classless_routes $staticroutes
        [ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes
 
-       for dns in $dns; do
-               proto_add_dns_server "$dns"
+       for i in $dns; do
+               proto_add_dns_server "$i"
        done
-       for domain in $domain; do
-               proto_add_dns_search "$domain"
+       for i in $domain; do
+               proto_add_dns_search "$i"
        done
 
        proto_add_data
@@ -60,7 +68,7 @@ setup_interface () {
                ip6rd="${ip6rd#* }"
                local ip6rdbr="${ip6rd%% *}"
 
-               [ -n "$ZONE" ] || ZONE=$(fw3 -q network $INTERFACE)
+               [ -n "$ZONE" ] || ZONE=$(fw3 -q network $INTERFACE 2>/dev/null)
                [ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6
 
                json_init
index ea02d68bb4fb00a2365c4f9bfd68ea1c3b7d34ba..385cfc397474f94eee37df500dd7c35a5ecef6a3 100755 (executable)
@@ -14,6 +14,7 @@ proto_dhcp_init_config() {
        proto_config_add_boolean 'broadcast:bool'
        proto_config_add_boolean 'release:bool'
        proto_config_add_string 'reqopts:list(string)'
+       proto_config_add_boolean 'defaultreqopts:bool'
        proto_config_add_string iface6rd
        proto_config_add_string sendopts
        proto_config_add_boolean delegate
@@ -28,8 +29,8 @@ proto_dhcp_setup() {
        local config="$1"
        local iface="$2"
 
-       local ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
-       json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
+       local ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
+       json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
 
        local opt dhcpopts
        for opt in $reqopts; do
@@ -40,6 +41,8 @@ proto_dhcp_setup() {
                append dhcpopts "-x $opt"
        done
 
+       [ -z "$hostname" ] && hostname="$(cat /proc/sys/kernel/hostname)"
+       [ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts=
        [ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
        [ "$release" = 1 ] && release="-R" || release=
        [ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
@@ -61,7 +64,7 @@ proto_dhcp_setup() {
                ${ipaddr:+-r $ipaddr} \
                ${hostname:+-x "hostname:$hostname"} \
                ${vendorid:+-V "$vendorid"} \
-               $clientid $broadcast $release $dhcpopts
+               $clientid $defaultreqopts $broadcast $release $dhcpopts
 }
 
 proto_dhcp_renew() {
index fe6a6d2feddb8af80f577ae6404fdb04b9405ce6..7d6dabe0e859b053bee8d20b2294b535be3986b7 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.78
-PKG_RELEASE:=4
+PKG_RELEASE:=6
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/
diff --git a/package/network/services/dnsmasq/patches/270-dnssec-wildcards.patch b/package/network/services/dnsmasq/patches/270-dnssec-wildcards.patch
new file mode 100644 (file)
index 0000000..d13ac2c
--- /dev/null
@@ -0,0 +1,202 @@
+From 4fe6744a220eddd3f1749b40cac3dfc510787de6 Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon@thekelleys.org.uk>
+Date: Fri, 19 Jan 2018 12:26:08 +0000
+Subject: [PATCH] DNSSEC fix for wildcard NSEC records. CVE-2017-15107
+ applies.
+
+It's OK for NSEC records to be expanded from wildcards,
+but in that case, the proof of non-existence is only valid
+starting at the wildcard name, *.<domain> NOT the name expanded
+from the wildcard. Without this check it's possible for an
+attacker to craft an NSEC which wrongly proves non-existence
+in a domain which includes a wildcard for NSEC.
+---
+ src/dnssec.c |  117 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
+ 2 files changed, 114 insertions(+), 15 deletions(-)
+
+--- a/src/dnssec.c
++++ b/src/dnssec.c
+@@ -424,15 +424,17 @@ static void from_wire(char *name)
+ static int count_labels(char *name)
+ {
+   int i;
+-
++  char *p;
++  
+   if (*name == 0)
+     return 0;
+-  for (i = 0; *name; name++)
+-    if (*name == '.')
++  for (p = name, i = 0; *p; p++)
++    if (*p == '.')
+       i++;
+-  return i+1;
++  /* Don't count empty first label. */
++  return *name == '.' ? i : i+1;
+ }
+ /* Implement RFC1982 wrapped compare for 32-bit numbers */
+@@ -1412,8 +1414,8 @@ static int hostname_cmp(const char *a, c
+     }
+ }
+-static int prove_non_existence_nsec(struct dns_header *header, size_t plen, unsigned char **nsecs, int nsec_count,
+-                                  char *workspace1, char *workspace2, char *name, int type, int *nons)
++static int prove_non_existence_nsec(struct dns_header *header, size_t plen, unsigned char **nsecs, unsigned char **labels, int nsec_count,
++                                  char *workspace1_in, char *workspace2, char *name, int type, int *nons)
+ {
+   int i, rc, rdlen;
+   unsigned char *p, *psave;
+@@ -1426,6 +1428,9 @@ static int prove_non_existence_nsec(stru
+   /* Find NSEC record that proves name doesn't exist */
+   for (i = 0; i < nsec_count; i++)
+     {
++      char *workspace1 = workspace1_in;
++      int sig_labels, name_labels;
++
+       p = nsecs[i];
+       if (!extract_name(header, plen, &p, workspace1, 1, 10))
+       return 0;
+@@ -1434,7 +1439,27 @@ static int prove_non_existence_nsec(stru
+       psave = p;
+       if (!extract_name(header, plen, &p, workspace2, 1, 10))
+       return 0;
+-      
++
++      /* If NSEC comes from wildcard expansion, use original wildcard
++       as name for computation. */
++      sig_labels = *labels[i];
++      name_labels = count_labels(workspace1);
++
++      if (sig_labels < name_labels)
++      {
++        int k;
++        for (k = name_labels - sig_labels; k != 0; k--)
++          {
++            while (*workspace1 != '.' && *workspace1 != 0)
++              workspace1++;
++            if (k != 1 && *workspace1 == '.')
++              workspace1++;
++          }
++        
++        workspace1--;
++        *workspace1 = '*';
++      }
++        
+       rc = hostname_cmp(workspace1, name);
+       
+       if (rc == 0)
+@@ -1832,24 +1857,26 @@ static int prove_non_existence_nsec3(str
+ static int prove_non_existence(struct dns_header *header, size_t plen, char *keyname, char *name, int qtype, int qclass, char *wildname, int *nons)
+ {
+-  static unsigned char **nsecset = NULL;
+-  static int nsecset_sz = 0;
++  static unsigned char **nsecset = NULL, **rrsig_labels = NULL;
++  static int nsecset_sz = 0, rrsig_labels_sz = 0;
+   
+   int type_found = 0;
+-  unsigned char *p = skip_questions(header, plen);
++  unsigned char *auth_start, *p = skip_questions(header, plen);
+   int type, class, rdlen, i, nsecs_found;
+   
+   /* Move to NS section */
+   if (!p || !(p = skip_section(p, ntohs(header->ancount), header, plen)))
+     return 0;
++
++  auth_start = p;
+   
+   for (nsecs_found = 0, i = ntohs(header->nscount); i != 0; i--)
+     {
+       unsigned char *pstart = p;
+       
+-      if (!(p = skip_name(p, header, plen, 10)))
++      if (!extract_name(header, plen, &p, daemon->workspacename, 1, 10))
+       return 0;
+-      
++        
+       GETSHORT(type, p); 
+       GETSHORT(class, p);
+       p += 4; /* TTL */
+@@ -1866,7 +1893,69 @@ static int prove_non_existence(struct dn
+         if (!expand_workspace(&nsecset, &nsecset_sz, nsecs_found))
+           return 0; 
+         
+-        nsecset[nsecs_found++] = pstart;
++        if (type == T_NSEC)
++          {
++            /* If we're looking for NSECs, find the corresponding SIGs, to 
++               extract the labels value, which we need in case the NSECs
++               are the result of wildcard expansion.
++               Note that the NSEC may not have been validated yet
++               so if there are multiple SIGs, make sure the label value
++               is the same in all, to avoid be duped by a rogue one.
++               If there are no SIGs, that's an error */
++            unsigned char *p1 = auth_start;
++            int res, j, rdlen1, type1, class1;
++            
++            if (!expand_workspace(&rrsig_labels, &rrsig_labels_sz, nsecs_found))
++              return 0;
++            
++            rrsig_labels[nsecs_found] = NULL;
++            
++            for (j = ntohs(header->nscount); j != 0; j--)
++              {
++                if (!(res = extract_name(header, plen, &p1, daemon->workspacename, 0, 10)))
++                  return 0;
++
++                 GETSHORT(type1, p1); 
++                 GETSHORT(class1, p1);
++                 p1 += 4; /* TTL */
++                 GETSHORT(rdlen1, p1);
++
++                 if (!CHECK_LEN(header, p1, plen, rdlen1))
++                   return 0;
++                 
++                 if (res == 1 && class1 == qclass && type1 == T_RRSIG)
++                   {
++                     int type_covered;
++                     unsigned char *psav = p1;
++                     
++                     if (rdlen1 < 18)
++                       return 0; /* bad packet */
++
++                     GETSHORT(type_covered, p1);
++
++                     if (type_covered == T_NSEC)
++                       {
++                         p1++; /* algo */
++                         
++                         /* labels field must be the same in every SIG we find. */
++                         if (!rrsig_labels[nsecs_found])
++                           rrsig_labels[nsecs_found] = p1;
++                         else if (*rrsig_labels[nsecs_found] != *p1) /* algo */
++                           return 0;
++                         }
++                     p1 = psav;
++                   }
++                 
++                 if (!ADD_RDLEN(header, p1, plen, rdlen1))
++                   return 0;
++              }
++
++            /* Must have found at least one sig. */
++            if (!rrsig_labels[nsecs_found])
++              return 0;
++          }
++
++        nsecset[nsecs_found++] = pstart;   
+       }
+       
+       if (!ADD_RDLEN(header, p, plen, rdlen))
+@@ -1874,7 +1963,7 @@ static int prove_non_existence(struct dn
+     }
+   
+   if (type_found == T_NSEC)
+-    return prove_non_existence_nsec(header, plen, nsecset, nsecs_found, daemon->workspacename, keyname, name, qtype, nons);
++    return prove_non_existence_nsec(header, plen, nsecset, rrsig_labels, nsecs_found, daemon->workspacename, keyname, name, qtype, nons);
+   else if (type_found == T_NSEC3)
+     return prove_non_existence_nsec3(header, plen, nsecset, nsecs_found, daemon->workspacename, keyname, name, qtype, wildname, nons);
+   else
diff --git a/package/network/services/nfs-kernel-server/Makefile b/package/network/services/nfs-kernel-server/Makefile
new file mode 100644 (file)
index 0000000..127a3f6
--- /dev/null
@@ -0,0 +1,159 @@
+# Copyright (C) 2009-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=nfs-kernel-server
+PKG_VERSION:=2.3.1
+PKG_RELEASE:=1
+PKG_HASH:=245ec2f9abb51bcc233b64f6f3e9ac8e5cd16ffd35dba9450f83ce2803844cda
+
+PKG_SOURCE_URL:=@SF/nfs
+PKG_SOURCE:=nfs-utils-$(PKG_VERSION).tar.xz
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/nfs-utils-$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR)/nfs-utils-$(PKG_VERSION)
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_BUILD_DEPENDS:=$(PKG_NAME)/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nfs-kernel-server/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Filesystem
+  DEPENDS:=+libwrap +libblkid +libuuid $(LIBRPC_DEPENDS)
+  URL:=http://nfs.sourceforge.net/
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+endef
+
+define Package/nfs-kernel-server
+  $(call Package/nfs-kernel-server/Default)
+  TITLE:=Kernel NFS server support
+  DEPENDS+= +kmod-fs-nfsd +kmod-fs-nfs +portmap
+endef
+
+define Package/nfs-kernel-server/description
+  Kernel NFS server support
+endef
+
+define Package/nfs-kernel-server-utils
+  $(call Package/nfs-kernel-server/Default)
+  TITLE:=NFS server utils
+  DEPENDS:=nfs-kernel-server
+endef
+
+define Package/nfs-kernel-server-utils/description
+  NFS server utils
+endef
+
+define Package/nfs-kernel-server/conffiles
+/etc/exports
+endef
+
+define Package/nfs-utils
+  $(call Package/nfs-kernel-server/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS+= +libevent2 +USE_UCLIBC:librpc
+  TITLE:=updated mount utility (includes nfs4)
+endef
+
+define Package/nfs-utils/description
+  Updated mount.nfs command - allows mounting nfs4 volumes
+endef
+
+TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib -I$(STAGING_DIR)/usr/include/libevent \
+                -I$(STAGING_DIR)/usr/include/ -Drpc_uint=uint
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib $(LIBRPC) \
+                 -L$(STAGING_DIR)/usr/lib/libevent
+
+CONFIGURE_ARGS += \
+       --disable-gss \
+       --disable-nfsv4 \
+       --disable-nfsv41 \
+       --disable-ipv6 \
+       --enable-static \
+       --enable-shared \
+       --disable-caps \
+       --disable-tirpc \
+       --disable-nfsdcld
+
+CONFIGURE_VARS += \
+       libblkid_cv_is_recent=yes \
+       ac_cv_lib_resolv___res_querydomain=yes \
+       CONFIG_SQLITE3_TRUE="\#" \
+       CONFIG_NFSDCLD_TRUE="\#"
+
+MAKE_FLAGS += \
+       OPT="$(TARGET_CFLAGS)" \
+       INSTALLSUID="install -m 4755" \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       RPCGEN_PATH=$(STAGING_DIR_HOSTPKG)/bin/rpcgen \
+       RPCGEN=$(STAGING_DIR_HOSTPKG)/bin/rpcgen
+
+HOST_CFLAGS += -Dlinux
+
+HOST_CONFIGURE_ARGS += \
+       --disable-gss \
+       --disable-nfsv4 \
+       --disable-nfsv41 \
+       --disable-ipv6 \
+       --disable-tirpc \
+       --without-tcp-wrappers
+
+HOST_CONFIGURE_VARS += \
+       ac_cv_lib_event_event_dispatch=yes \
+       ac_cv_lib_nfsidmap_nfs4_init_name_mapping=yes \
+       ac_cv_lib_blkid_blkid_get_library_version=yes \
+       ac_cv_header_event_h=yes \
+       ac_cv_header_nfsidmap_h=yes \
+       ac_cv_header_blkid_blkid_h=yes \
+       GSSGLUE_CFLAGS=" " \
+       GSSGLUE_LIBS=" " \
+       RPCSECGSS_CFLAGS=" " \
+       RPCSECGSS_LIBS=" " \
+       CONFIG_SQLITE3_TRUE="\#" \
+       CONFIG_NFSDCLD_TRUE="\#"
+
+define Host/Compile
+       $(MAKE) -C $(HOST_BUILD_DIR)/tools/rpcgen all
+endef
+
+define Host/Install
+       $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
+       $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/rpcgen/rpcgen $(STAGING_DIR_HOSTPKG)/bin/rpcgen
+endef
+
+define Package/nfs-kernel-server/install
+       $(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
+       $(INSTALL_DATA) ./files/nfsd.exports $(1)/etc/exports
+       $(INSTALL_BIN) ./files/nfsd.init $(1)/etc/init.d/nfsd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/sm-notify $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/statd $(1)/usr/sbin/rpc.statd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsd/nfsd $(1)/usr/sbin/rpc.nfsd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/mountd/mountd $(1)/usr/sbin/rpc.mountd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/exportfs/exportfs $(1)/usr/sbin/
+endef
+
+define Package/nfs-kernel-server-utils/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/showmount/showmount $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsstat/nfsstat $(1)/usr/sbin
+endef
+
+define Package/nfs-utils/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/mount.nfs $(1)/sbin/
+       (cd $(1)/sbin; ln -sf mount.nfs mount.nfs4; ln -sf mount.nfs umount.nfs; ln -sf mount.nfs umount.nfs4)
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,nfs-kernel-server))
+$(eval $(call BuildPackage,nfs-kernel-server-utils))
+$(eval $(call BuildPackage,nfs-utils))
diff --git a/package/network/services/nfs-kernel-server/files/nfsd.exports b/package/network/services/nfs-kernel-server/files/nfsd.exports
new file mode 100644 (file)
index 0000000..0453e04
--- /dev/null
@@ -0,0 +1 @@
+/mnt   *(ro,all_squash,insecure,sync)
diff --git a/package/network/services/nfs-kernel-server/files/nfsd.init b/package/network/services/nfs-kernel-server/files/nfsd.init
new file mode 100644 (file)
index 0000000..af36c12
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=99
+STOP=60
+
+USE_PROCD=1
+
+NFS_D=/var/lib/nfs
+LOCK_D=/var/lib/nfs/sm
+
+start_service() {
+       grep -q /proc/fs/nfsd /proc/mounts || \
+               mount -t nfsd nfsd /proc/fs/nfsd
+       mkdir -p $NFS_D
+       mkdir -p $LOCK_D
+       touch $NFS_D/rmtab
+
+        sysctl -w fs.nfs.nlm_tcpport=32777 fs.nfs.nlm_udpport=32777 > /dev/null
+
+       procd_open_instance
+       procd_set_param command /usr/sbin/rpc.statd -p 32778 -o 32779 -F
+       procd_close_instance
+
+       /usr/sbin/exportfs -r
+       /usr/sbin/rpc.nfsd
+
+       procd_open_instance
+       procd_set_param command /usr/sbin/rpc.mountd -p 32780 -F
+       procd_close_instance
+}
+
+stop_service() {
+       rpc.nfsd 0 2> /dev/null
+       /usr/sbin/exportfs -au
+       grep -q /proc/fs/nfsd /proc/mounts && \
+               umount /proc/fs/nfsd
+}
diff --git a/package/network/services/nfs-kernel-server/patches/100-no_malloc_h.patch b/package/network/services/nfs-kernel-server/patches/100-no_malloc_h.patch
new file mode 100644 (file)
index 0000000..afe4c98
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/tools/rpcgen/rpc_cout.c
++++ b/tools/rpcgen/rpc_cout.c
+@@ -36,7 +36,6 @@ static char sccsid[] = "@(#)rpc_cout.c 1
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+-#include <malloc.h>
+ #include <ctype.h>
+ #include "rpc_parse.h"
+ #include "rpc_util.h"
diff --git a/package/network/services/nfs-kernel-server/patches/101-musl-getservbyport.patch b/package/network/services/nfs-kernel-server/patches/101-musl-getservbyport.patch
new file mode 100644 (file)
index 0000000..8e926e1
--- /dev/null
@@ -0,0 +1,16 @@
+Musl will always return something with getservbyport so we cannot skip
+ports that returns non-null.
+
+--- a/utils/statd/rmtcall.c
++++ b/utils/statd/rmtcall.c
+@@ -93,8 +93,10 @@ statd_get_socket(void)
+                                       __func__);
+                       break;
+               }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+               se = getservbyport(sin.sin_port, "udp");
+               if (se == NULL)
++#endif
+                       break;
+               if (retries == MAX_BRP_RETRIES) {
diff --git a/package/network/services/nfs-kernel-server/patches/102-limits.patch b/package/network/services/nfs-kernel-server/patches/102-limits.patch
new file mode 100644 (file)
index 0000000..67701c3
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/support/misc/file.c
++++ b/support/misc/file.c
+@@ -27,6 +27,7 @@
+ #include <dirent.h>
+ #include <stdlib.h>
+ #include <stdbool.h>
++#include <limits.h>
+ #include "xlog.h"
+ #include "misc.h"
index fee0296ed4f936ca0a083879380716568f74423c..118d95e5dfc07bbbbd82a5f9bc76a06abc3971b0 100644 (file)
@@ -9,14 +9,14 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openvpn
 
-PKG_VERSION:=2.4.4
-PKG_RELEASE:=2
+PKG_VERSION:=2.4.5
+PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=\
        https://build.openvpn.net/downloads/releases/ \
        https://swupdate.openvpn.net/community/releases/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_HASH:=96cd1b8fe1e8cb2920f07c3fd3985faea756e16fdeebd11d3e146d5bd2b04a80
+PKG_HASH:=43c0a363a332350f620d1cd93bb431e082bedbc93d4fb872f758650d53c1d29e
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
index 8209bca4f722c9c6f8026e202d6be697018c0057..5608fa4430fc6cd586c30ce0dfa81e71bf1186cd 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/openvpn/ssl_mbedtls.c
 +++ b/src/openvpn/ssl_mbedtls.c
-@@ -1336,7 +1336,7 @@ const char *
+@@ -1394,7 +1394,7 @@ const char *
  get_ssl_library_version(void)
  {
      static char mbedtls_version[30];
index d49e0bf9ec9f46df6a041a494059ea92cbdb8727..b3eb7c742af61a7b5ba0aa9f1c0abac41f97d66f 100644 (file)
@@ -1,15 +1,17 @@
 --- a/configure.ac
 +++ b/configure.ac
-@@ -1068,62 +1068,15 @@ dnl
+@@ -1077,68 +1077,15 @@ dnl
  AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4])
  AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4])
  if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then
 -    if test -z "${LZ4_CFLAGS}" -a -z "${LZ4_LIBS}"; then
 -      # if the user did not explicitly specify flags, try to autodetect
 -      PKG_CHECK_MODULES([LZ4],
--                        [liblz4 >= 1.7.1],
+-                        [liblz4 >= 1.7.1 liblz4 < 100],
 -                        [have_lz4="yes"],
--                        [] # If this fails, we will do another test next
+-                        [LZ4_LIBS="-llz4"] # If this fails, we will do another test next.
+-                                           # We also add set LZ4_LIBS otherwise the
+-                                           # linker will not know about the lz4 library
 -      )
 -    fi
 
 -      fi
 -    fi
 -
--    # if LZ4_LIBS is set, we assume it will work, otherwise test
--    if test -z "${LZ4_LIBS}"; then
+-    # Double check we have a few needed functions
+-    if test "${have_lz4}" = "yes" ; then
 -      AC_CHECK_LIB([lz4],
--                   [LZ4_compress],
--                   [LZ4_LIBS="-llz4"],
+-                   [LZ4_compress_default],
+-                   [],
+-                   [have_lz4="no"])
+-      AC_CHECK_LIB([lz4],
+-                   [LZ4_decompress_safe],
+-                   [],
 -                   [have_lz4="no"])
 -    fi
 -
 -    if test "${have_lz4}" != "yes" ; then
--      AC_MSG_RESULT([         usuable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
+-      AC_MSG_RESULT([         usable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
 -      AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
 -      LZ4_LIBS=""
 -    fi
-+    AC_MSG_RESULT([           usuable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
++    AC_MSG_RESULT([           usable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
 +    AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
 +    LZ4_LIBS=""
      OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}"
diff --git a/package/network/services/portmap/Makefile b/package/network/services/portmap/Makefile
new file mode 100644 (file)
index 0000000..03969f7
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=portmap
+PKG_VERSION:=6.0
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://neil.brown.name/portmap/
+PKG_MD5SUM:=ac108ab68bf0f34477f8317791aaf1ff
+
+PKG_LICENSE:=BSD-4c
+PKG_LICENSE_FILES:=portmap.man
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/portmap
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libwrap $(LIBRPC_DEPENDS)
+  TITLE:=The RPC Portmapper
+  URL:=http://neil.brown.name/portmap/
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+  USERID:=rpc=65533:rpc=65533
+endef
+
+define Package/portmap/description
+ Portmap is a server that converts RPC (Remote Procedure Call) program
+ numbers into DARPA protocol port numbers.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -DHOSTS_ACCESS -DFACILITY=LOG_DAEMON -DIGNORE_SIGCHLD" \
+       RPCUSER="rpc" \
+       LDLIBS="$(TARGET_LDFLAGS) -lwrap $(LIBRPC)" \
+       all
+
+define Package/portmap/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/portmap $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/portmap.init $(1)/etc/init.d/portmap
+endef
+
+$(eval $(call BuildPackage,portmap))
diff --git a/package/network/services/portmap/files/portmap.init b/package/network/services/portmap/files/portmap.init
new file mode 100644 (file)
index 0000000..621c313
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=19
+STOP=19
+
+USE_PROCD=1
+
+start_service() {
+       procd_open_instance
+       procd_set_param command /usr/sbin/portmap -f
+       procd_close_instance
+}
diff --git a/package/network/services/portmap/patches/101-no_pie.patch b/package/network/services/portmap/patches/101-no_pie.patch
new file mode 100644 (file)
index 0000000..6cbdece
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ur portmap_6.0.org/Makefile portmap_6.0/Makefile
+--- portmap_6.0.org/Makefile   2008-04-19 22:44:35.000000000 +0200
++++ portmap_6.0/Makefile       2008-04-19 00:02:01.000000000 +0200
+@@ -127,7 +127,7 @@
+ CPPFLAGS += $(HOSTS_ACCESS)
+ portmap: CFLAGS   += -fpie
+ portmap: LDLIBS   += $(WRAP_LIB)
+-portmap: LDFLAGS  += -pie
++#portmap: LDFLAGS  += -pie
+ portmap: portmap.o pmap_check.o from_local.o
+ from_local: CPPFLAGS += -DTEST
diff --git a/package/network/services/shellinabox/Makefile b/package/network/services/shellinabox/Makefile
new file mode 100644 (file)
index 0000000..0d2fcdf
--- /dev/null
@@ -0,0 +1,64 @@
+# 
+# Copyright (C) 2006-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# Initial port of shellinabox to OpenWrt - Jan Jaeger 25-MAR-2010
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=shellinabox
+PKG_VERSION:=2.10
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=HEAD
+PKG_SOURCE_URL:=https://github.com/OnionIoT/shellinabox.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE:=$(PKG_NAME).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+#PKG_SOURCE_URL:=http://shellinabox.googlecode.com/files
+#PKG_MD5SUM:=0e144910d85d92edc54702ab9c46f032
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/shellinabox
+       SECTION:=net
+       CATEGORY:=Network
+       TITLE:=Shell In A Box
+       DEPENDS:= zlib
+       URL:=http://shellinabox.googlecode.com
+endef
+
+define Package/shellinabox/description
+Web based AJAX terminal emulator
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               BINDIR="/usr/sbin" \
+               all
+endef
+
+define Package/shellinabox/install
+       # install the binary
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/shellinaboxd $(1)/usr/sbin/
+       # install the init.d file
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+       # install the css file
+       $(INSTALL_DIR) $(1)/usr/lib/shellinabox
+       $(INSTALL_BIN) ./files/style.css $(1)/usr/lib/shellinabox/style.css
+endef
+
+$(eval $(call BuildPackage,shellinabox))
diff --git a/package/network/services/shellinabox/files/shellinabox.init b/package/network/services/shellinabox/files/shellinabox.init
new file mode 100644 (file)
index 0000000..64da542
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010 OpenWrt.org
+
+# enable auto start of this daemon
+START=99
+
+USE_PROCD=1
+PROG=/usr/sbin/shellinaboxd
+
+start_service() {
+        procd_open_instance
+        procd_set_param command $PROG -t --service=/:LOGIN --css /usr/lib/shellinabox/style.css
+        # disable automatic respawn - allow daemon to be turned off
+       #procd_set_param respawn                                                                   
+        procd_close_instance   
+}
diff --git a/package/network/services/shellinabox/files/style.css b/package/network/services/shellinabox/files/style.css
new file mode 100644 (file)
index 0000000..f5aa24a
--- /dev/null
@@ -0,0 +1,24 @@
+#vt100 #cursor.bright {
+  background-color: white;
+  color:            black;
+}
+
+#vt100 #scrollable {
+  color:            #ffffff;
+  background-color: #000000;
+}
+
+#vt100 #scrollable.inverted {
+  color:            #000000;
+  background-color: #ffffff;
+}
+
+#vt100 .ansi15 {
+  color:            #000000;
+}
+
+#vt100 .bgAnsi0 {
+  background-color: #ffffff;
+}
+
+
diff --git a/package/network/services/shellinabox/old/000-makefile-arch.patch b/package/network/services/shellinabox/old/000-makefile-arch.patch
new file mode 100644 (file)
index 0000000..cef7ec6
--- /dev/null
@@ -0,0 +1,22 @@
+diff -Naur shellinabox-2.10.orig/Makefile.am shellinabox-2.10/Makefile.am
+--- shellinabox-2.10.orig/Makefile.am  2009-11-18 17:55:52.000000000 +0100
++++ shellinabox-2.10/Makefile.am       2010-03-25 14:16:03.000000000 +0100
+@@ -107,6 +107,7 @@
+ objcopyflags         = case "$(host_cpu)" in                                  \
+                          i[0-9]86) echo '-O elf32-i386 -B i386';;             \
+                          x86_64)   echo '-O elf64-x86-64 -B i386:x86-64';;    \
++                         mips*)    echo '-O elf32-tradbigmips -B mips:isa32';; \
+                          arm*)     echo '-O elf32-littlearm -B arm';;         \
+                        esac
+diff -Naur shellinabox-2.10.orig/Makefile.in shellinabox-2.10/Makefile.in
+--- shellinabox-2.10.orig/Makefile.in  2009-11-21 23:47:39.000000000 +0100
++++ shellinabox-2.10/Makefile.in       2010-03-25 14:16:28.000000000 +0100
+@@ -371,6 +371,7 @@
+ objcopyflags = case "$(host_cpu)" in                                  \
+                          i[0-9]86) echo '-O elf32-i386 -B i386';;             \
+                          x86_64)   echo '-O elf64-x86-64 -B i386:x86-64';;    \
++                         mips*)    echo '-O elf32-tradbigmips -B mips:isa32';; \
+                          arm*)     echo '-O elf32-littlearm -B arm';;         \
+                        esac
diff --git a/package/network/services/shellinabox/old/001-makefile-objcopy.patch b/package/network/services/shellinabox/old/001-makefile-objcopy.patch
new file mode 100644 (file)
index 0000000..21c4b41
--- /dev/null
@@ -0,0 +1,105 @@
+diff -Naur shellinabox-2.10.orig/Makefile.am shellinabox-2.10/Makefile.am
+--- shellinabox-2.10.orig/Makefile.am  2010-03-25 19:30:55.000000000 +0100
++++ shellinabox-2.10/Makefile.am       2010-03-25 19:53:49.000000000 +0100
+@@ -218,23 +218,23 @@
+                 debian/tmp
+ .css.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ .gif.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ .html.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ .ico.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
+@@ -249,12 +249,12 @@
+            "$<" >"$@"
+ .js.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ .wav.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+diff -Naur shellinabox-2.10.orig/Makefile.in shellinabox-2.10/Makefile.in
+--- shellinabox-2.10.orig/Makefile.in  2010-03-25 19:30:55.000000000 +0100
++++ shellinabox-2.10/Makefile.in       2010-03-25 19:54:21.000000000 +0100
+@@ -1231,23 +1231,23 @@
+                 debian/tmp
+ .css.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ .gif.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ .html.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ .ico.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
+@@ -1262,13 +1262,13 @@
+            "$<" >"$@"
+ .js.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ .wav.o:
+-      @echo objcopy "$<" "$@"
+-      @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
++      @echo $(OBJCOPY) "$<" "$@"
++      @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`   \
+         "$<" "$@"
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/package/network/services/shellinabox/old/002-httpconn-isnan.patch b/package/network/services/shellinabox/old/002-httpconn-isnan.patch
new file mode 100644 (file)
index 0000000..85484af
--- /dev/null
@@ -0,0 +1,20 @@
+--- shellinabox-2.10.orig/libhttp/httpconnection.c      2015-09-25 10:55:38.350974827 +0000
++++ shellinabox-2.10/libhttp/httpconnection.c   2015-09-25 10:56:23.462944723 +0000
+@@ -69,6 +69,17 @@
+ #define max(a, b) ({ typeof(a) _a = (a); typeof(b) _b = (b);                  \
+                      _a > _b ? _a : _b; })
++#undef isnan
++#ifndef isnan
++# define isnan(x) \
++    (sizeof (x) == sizeof (long double) ? isnan_ld (x) \
++     : sizeof (x) == sizeof (double) ? isnan_d (x) \
++     : isnan_f (x))
++static inline int isnan_f  (float       x) { return x != x; }
++static inline int isnan_d  (double      x) { return x != x; }
++static inline int isnan_ld (long double x) { return x != x; }
++#endif
++
+ #include "libhttp/httpconnection.h"
+ #include "logging/logging.h"
diff --git a/package/network/services/shellinabox/old/readme b/package/network/services/shellinabox/old/readme
new file mode 100644 (file)
index 0000000..77f4bf8
--- /dev/null
@@ -0,0 +1,5 @@
+Files here are patches required to get shellinabox-2.10 from Google Code to compile in OpenWRT buildroot
+
+These fixes have been integrated into the code in the Onion shellinabox repo
+
+
diff --git a/package/network/services/tor/Makefile b/package/network/services/tor/Makefile
new file mode 100644 (file)
index 0000000..d1787dd
--- /dev/null
@@ -0,0 +1,145 @@
+#
+# Copyright (C) 2008-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tor
+PKG_VERSION:=0.3.2.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://dist.torproject.org/ \
+       https://archive.torproject.org/tor-package-archive
+PKG_HASH:=435a7b91aa98d8b1a0ac1f60ca30c0ff3665b18a02e570bab5fe27935829160f
+PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de>
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tor/Default
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=https://www.torproject.org/
+  USERID:=tor=52:tor=52
+endef
+
+define Package/tor/Default/description
+ Tor is a toolset for a wide range of organizations and people that want to
+ improve their safety and security on the Internet. Using Tor can help you
+ anonymize web browsing and publishing, instant messaging, IRC, SSH, and
+ more. Tor also provides a platform on which software developers can build
+ new applications with built-in anonymity, safety, and privacy features.
+endef
+
+define Package/tor
+$(call Package/tor/Default)
+  TITLE:=An anonymous Internet communication system
+  DEPENDS:=+libevent2 +libopenssl +libpthread +librt +zlib +libcap
+endef
+
+define Package/tor/description
+$(call Package/tor/Default/description)
+ This package contains the tor daemon.
+endef
+
+define Package/tor-gencert
+$(call Package/tor/Default)
+  TITLE:=Tor certificate generation
+  DEPENDS:=+tor
+endef
+
+define Package/tor-gencert/description
+$(call Package/tor/Default/description)
+ Generate certs and keys for Tor directory authorities
+endef
+
+define Package/tor-resolve
+$(call Package/tor/Default)
+  TITLE:=tor hostname resolve
+  DEPENDS:=+tor
+endef
+
+define Package/tor-resolve/description
+$(call Package/tor/Default/description)
+ Resolve a hostname to an IP address via tor 
+endef
+
+define Package/tor-geoip
+$(call Package/tor/Default)
+  TITLE:=GeoIP db for tor
+  DEPENDS:=+tor
+endef
+
+define Package/tor-geoip/description
+$(call Package/tor/Default/description)
+ This package contains a GeoIP database mapping IP addresses to countries.
+endef
+
+define Package/tor/conffiles
+/etc/tor/torrc
+/var/lib/tor/fingerprint
+/var/lib/tor/keys/*
+endef
+
+CONFIGURE_ARGS += \
+       --with-libevent-dir="$(STAGING_DIR)/usr" \
+       --with-ssl-dir="$(STAGING_DIR)/usr" \
+       --with-openssl-dir="$(STAGING_DIR)/usr" \
+       --with-zlib-dir="$(STAGING_DIR)/usr" \
+       --disable-asciidoc \
+       --disable-seccomp \
+       --disable-libscrypt \
+       --disable-unittests \
+       --disable-largefile \
+       --disable-lzma \
+       --with-tor-user=tor \
+       --with-tor-group=tor
+
+EXTRA_CFLAGS += -std=gnu99
+
+ifneq ($(CONFIG_SSP_SUPPORT),y)
+       CONFIGURE_ARGS += \
+               --disable-gcc-hardening
+else
+       EXTRA_CFLAGS += -fPIC
+endif
+
+CONFIGURE_VARS += \
+       CROSS_COMPILE="yes"
+
+define Package/tor/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/torify $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
+       $(INSTALL_DIR) $(1)/etc/tor
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
+endef
+
+define Package/tor-gencert/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-gencert $(1)/usr/sbin/
+endef
+
+define Package/tor-resolve/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-resolve $(1)/usr/sbin/
+endef
+
+define Package/tor-geoip/install
+       $(INSTALL_DIR) $(1)/usr/share/tor
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 $(1)/usr/share/tor/
+endef
+
+$(eval $(call BuildPackage,tor))
+$(eval $(call BuildPackage,tor-gencert))
+$(eval $(call BuildPackage,tor-resolve))
+$(eval $(call BuildPackage,tor-geoip))
diff --git a/package/network/services/tor/files/tor.init b/package/network/services/tor/files/tor.init
new file mode 100644 (file)
index 0000000..6974057
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+STOP=50
+
+USE_PROCD=1
+
+start_service() {
+       [ -f /var/run/tor.pid ] || {
+               touch /var/run/tor.pid
+               chown tor:tor /var/run/tor.pid
+       }
+       [ -d /var/lib/tor ] || {
+               mkdir -m 0755 -p /var/lib/tor
+               chmod 0700 /var/lib/tor
+               chown tor:tor /var/lib/tor
+       }
+       [ -d /var/log/tor ] || {
+               mkdir -m 0755 -p /var/log/tor
+               chown tor:tor /var/log/tor
+       }
+       procd_open_instance
+       procd_set_param command /usr/sbin/tor --runasdaemon 0
+       procd_close_instance
+}
diff --git a/package/network/services/tor/patches/001-torrc.patch b/package/network/services/tor/patches/001-torrc.patch
new file mode 100644 (file)
index 0000000..78d4ee9
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/src/config/torrc.sample.in
++++ b/src/config/torrc.sample.in
+@@ -39,7 +39,7 @@
+ ## Send every possible message to @LOCALSTATEDIR@/log/tor/debug.log
+ #Log debug file @LOCALSTATEDIR@/log/tor/debug.log
+ ## Use the system log instead of Tor's logfiles
+-#Log notice syslog
++Log notice syslog
+ ## To send all messages to stderr:
+ #Log debug stderr
+@@ -50,7 +50,7 @@
+ ## The directory for keeping all the keys/etc. By default, we store
+ ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
+-#DataDirectory @LOCALSTATEDIR@/lib/tor
++DataDirectory @LOCALSTATEDIR@/lib/tor
+ ## The port on which Tor will listen for local connections from Tor
+ ## controller applications, as documented in control-spec.txt.
+@@ -227,3 +227,4 @@
+ #%include /etc/torrc.d/
+ #%include /etc/torrc.custom
++User tor
index 5d829547aaed6487e3c55073e46e229bfa3c1e2f..07056a2cd0e3c451599440b8107fd0fc6660ccce 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=curl
 PKG_VERSION:=7.52.1
-PKG_RELEASE:=6
+PKG_RELEASE:=8
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://curl.haxx.se/download/ \
diff --git a/package/network/utils/curl/patches/320-mbedtls-nonblocking-handshake.patch b/package/network/utils/curl/patches/320-mbedtls-nonblocking-handshake.patch
new file mode 100644 (file)
index 0000000..33ab296
--- /dev/null
@@ -0,0 +1,27 @@
+From b993d2cca536870ecdf3b4611de9f77215af8eb8 Mon Sep 17 00:00:00 2001
+From: Antoine Aubert <a.aubert@overkiz.com>
+Date: Fri, 20 Jan 2017 08:10:28 +0100
+Subject: [PATCH] vtls: fix mbedtls multi non blocking handshake.
+
+When using multi, mbedtls handshake is in non blocking mode.
+vtls must set wait for read/write flags for the socket.
+---
+ lib/vtls/vtls.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
+index fad9335bbf..871622fef1 100644
+--- a/lib/vtls/vtls.c
++++ b/lib/vtls/vtls.c
+@@ -485,8 +485,9 @@ void Curl_ssl_close_all(struct Curl_easy *data)
+ }
+ #if defined(USE_OPENSSL) || defined(USE_GNUTLS) || defined(USE_SCHANNEL) || \
+-    defined(USE_DARWINSSL) || defined(USE_NSS)
+-/* This function is for OpenSSL, GnuTLS, darwinssl, and schannel only. */
++    defined(USE_DARWINSSL) || defined(USE_NSS) || defined(USE_MBEDTLS)
++/* This function is for OpenSSL, GnuTLS, darwinssl, mbedtls, and schannel
++   only. */
+ int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks,
+                      int numsocks)
+ {
index ecf9a6b039bf5995330795591bfcb27c679b2cc6..73a267e0b7fc4082e4243ee53475f54e5097ff86 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2016 OpenWrt.org
+# Copyright (C) 2006-2017 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -7,13 +7,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ca-certificates
-PKG_VERSION:=20161130+nmu1
+PKG_VERSION:=20170717
 PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
 
 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/c/ca-certificates
-PKG_HASH:=77f9aca431e3122bf04aa0ffd989b723d906db4d1c106e3290e463d73c177f0e
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-20161130
+PKG_HASH:=e487639b641fa75445174734dd6e9d600373e3248b3d86a7e3c6d0f6977decd2
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
 
 PKG_INSTALL:=1
 
index 43febd4727b94bca1311987558b0363eb5319180..fe4530ac008f61e011d4f76a3733b089ac6c32c3 100644 (file)
@@ -11,11 +11,10 @@ PKG_NAME:=fstools
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/project/fstools.git
-PKG_SOURCE_DATE:=2017-06-30
-PKG_SOURCE_VERSION:=bdcb075fafdac0bfe3207c23f64acd58432bad86
-PKG_MIRROR_HASH:=760a1fdbd379f1191947ac6ba9881a85a9b8c43f4a96d49db18d4654b0c312c4
-PKG_RELEASE:=1
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
+PKG_SOURCE_DATE:=2018-02-11
+PKG_SOURCE_VERSION:=3d239815bb048041ec0d48cba273573d148ad7a9
+PKG_MIRROR_HASH:=28b7e9f6b8ba4ad3dcab44daa629df412af103bf31448177cffb0d176f0aacf1
 CMAKE_INSTALL:=1
 
 PKG_LICENSE:=GPL-2.0
@@ -67,6 +66,13 @@ define Package/block-mount
   DEPENDS:=+ubox +libubox +libuci
 endef
 
+define Package/blockd
+  SECTION:=base
+  CATEGORY:=Base system
+  TITLE:=Block device automounting
+  DEPENDS:=+block-mount +fstools +libubus +kmod-fs-autofs4
+endef
+
 define Package/fstools/install
        $(INSTALL_DIR) $(1)/sbin $(1)/lib
 
@@ -96,6 +102,12 @@ define Package/block-mount/install
 
 endef
 
+define Package/blockd/install
+       $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/blockd $(1)/sbin/
+       $(INSTALL_BIN) ./files/blockd.init $(1)/etc/init.d/blockd
+endef
+
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
@@ -106,3 +118,4 @@ endef
 $(eval $(call BuildPackage,fstools))
 $(eval $(call BuildPackage,snapshot-tool))
 $(eval $(call BuildPackage,block-mount))
+$(eval $(call BuildPackage,blockd))
diff --git a/package/system/fstools/files/blockd.init b/package/system/fstools/files/blockd.init
new file mode 100755 (executable)
index 0000000..a4ce57d
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+
+START=80
+
+USE_PROCD=1
+PROG=/sbin/blockd
+
+service_triggers() {
+       procd_add_reload_trigger "fstab"
+}
+
+reload_service() {
+       block autofs start
+}
+
+start_service() {
+       procd_open_instance
+       procd_set_param command "$PROG"
+       procd_set_param respawn
+       procd_close_instance
+}
index c1a5b733f3c70e2bb5f2e83d3589e2f10832760f..a495e3434523b7a4b1b2f1bc3f4c9298197fc745 100644 (file)
@@ -42,7 +42,7 @@ do_snapshot_upgrade() {
 
        opkg list-upgradable
        [ $? -eq 0 ] || exit 2
-       
+
        UPDATES=`opkg list-upgradable | cut -d" " -f1`
        [ -z "${UPDATES}" ] && exit 0
 
@@ -64,14 +64,16 @@ do_convert_jffs2() {
 do_convert() {
        . /lib/functions.sh
        . /lib/upgrade/common.sh
-       ubus call system upgrade
-       touch /tmp/sysupgrade
+
        cd /overlay/upper
        tar czf /tmp/snapshot.tar.gz *
-       kill_remaining TERM
-       sleep 3
-       kill_remaining KILL
-       run_ramfs '. /sbin/snapshot; do_convert_jffs2'
+
+       install_bin /sbin/upgraded
+       ubus call system sysupgrade "{
+               \"prefix\": \"$RAM_ROOT\",
+               \"path\": \"\",
+               \"command\": \". /sbin/snapshot; do_convert_jffs2\"
+       }"
 }
 
 [ -n "$(cat /proc/mounts|grep /overlay|grep jffs2)" ] && {
index 4e39a89315bc9605b4e21ec7e66c99fafae976fd..daeadbcd35eee3ab3058b62f0f6ab72adb4ae2fc 100644 (file)
@@ -4,13 +4,14 @@ LDFLAGS += -lubox
 
 obj = mtd.o jffs2.o crc32.o md5.o
 obj.seama = seama.o md5.o
+obj.wrg = wrg.o md5.o
 obj.wrgg = wrgg.o md5.o
 obj.ar71xx = trx.o $(obj.seama) $(obj.wrgg)
 obj.brcm = trx.o
 obj.brcm47xx = $(obj.brcm)
 obj.bcm53xx = $(obj.brcm) $(obj.seama)
 obj.brcm63xx = imagetag.o
-obj.ramips = $(obj.seama)
+obj.ramips = $(obj.seama) $(obj.wrg)
 obj.mvebu = linksys_bootcount.o
 obj.kirkwood = linksys_bootcount.o
 obj.ipq806x = linksys_bootcount.o
index e66e647c0135625bf57cbad69268063008642de3..55a3bdba8105dea7c6260b32e2f652c9225a1861 100644 (file)
@@ -54,6 +54,7 @@
 
 #define TRX_MAGIC              0x48445230      /* "HDR0" */
 #define SEAMA_MAGIC            0x5ea3a417
+#define WRG_MAGIC              0x20040220
 #define WRGG03_MAGIC           0x20080321
 
 #if !defined(__BYTE_ORDER)
@@ -76,6 +77,7 @@ enum mtd_image_format {
        MTD_IMAGE_FORMAT_UNKNOWN,
        MTD_IMAGE_FORMAT_TRX,
        MTD_IMAGE_FORMAT_SEAMA,
+       MTD_IMAGE_FORMAT_WRG,
        MTD_IMAGE_FORMAT_WRGG03,
 };
 
@@ -205,6 +207,8 @@ image_check(int imagefd, const char *mtd)
                imageformat = MTD_IMAGE_FORMAT_TRX;
        else if (be32_to_cpu(magic) == SEAMA_MAGIC)
                imageformat = MTD_IMAGE_FORMAT_SEAMA;
+       else if (le32_to_cpu(magic) == WRG_MAGIC)
+               imageformat = MTD_IMAGE_FORMAT_WRG;
        else if (le32_to_cpu(magic) == WRGG03_MAGIC)
                imageformat = MTD_IMAGE_FORMAT_WRGG03;
 
@@ -214,7 +218,7 @@ image_check(int imagefd, const char *mtd)
                        ret = trx_check(imagefd, mtd, buf, &buflen);
                break;
        case MTD_IMAGE_FORMAT_SEAMA:
-               break;
+       case MTD_IMAGE_FORMAT_WRG:
        case MTD_IMAGE_FORMAT_WRGG03:
                break;
        default:
@@ -685,6 +689,10 @@ resume:
                        if (mtd_fixseama)
                                mtd_fixseama(mtd, 0, 0);
                        break;
+               case MTD_IMAGE_FORMAT_WRG:
+                       if (mtd_fixwrg)
+                               mtd_fixwrg(mtd, 0, 0);
+                       break;
                case MTD_IMAGE_FORMAT_WRGG03:
                        if (mtd_fixwrgg)
                                mtd_fixwrgg(mtd, 0, 0);
@@ -734,6 +742,10 @@ static void usage(void)
            fprintf(stderr,
        "        fixseama                fix the checksum in a seama header on first boot\n");
        }
+       if (mtd_fixwrg) {
+           fprintf(stderr,
+       "        fixwrg                  fix the checksum in a wrg header on first boot\n");
+       }
        if (mtd_fixwrgg) {
            fprintf(stderr,
        "        fixwrgg                 fix the checksum in a wrgg header on first boot\n");
@@ -755,9 +767,9 @@ static void usage(void)
            fprintf(stderr,
        "        -o offset               offset of the image header in the partition(for fixtrx)\n");
        }
-       if (mtd_fixtrx || mtd_fixseama || mtd_fixwrgg) {
+       if (mtd_fixtrx || mtd_fixseama || mtd_fixwrg || mtd_fixwrgg) {
                fprintf(stderr,
-       "        -c datasize             amount of data to be used for checksum calculation (for fixtrx / fixseama / fixwrgg)\n");
+       "        -c datasize             amount of data to be used for checksum calculation (for fixtrx / fixseama / fixwrg / fixwrgg)\n");
        }
        fprintf(stderr,
 #ifdef FIS_SUPPORT
@@ -798,6 +810,7 @@ int main (int argc, char **argv)
                CMD_JFFS2WRITE,
                CMD_FIXTRX,
                CMD_FIXSEAMA,
+               CMD_FIXWRG,
                CMD_FIXWRGG,
                CMD_VERIFY,
                CMD_DUMP,
@@ -913,6 +926,9 @@ int main (int argc, char **argv)
        } else if (((strcmp(argv[0], "fixseama") == 0) && (argc == 2)) && mtd_fixseama) {
                cmd = CMD_FIXSEAMA;
                device = argv[1];
+       } else if (((strcmp(argv[0], "fixwrg") == 0) && (argc == 2)) && mtd_fixwrg) {
+               cmd = CMD_FIXWRG;
+               device = argv[1];
        } else if (((strcmp(argv[0], "fixwrgg") == 0) && (argc == 2)) && mtd_fixwrgg) {
                cmd = CMD_FIXWRGG;
                device = argv[1];
@@ -1012,6 +1028,10 @@ int main (int argc, char **argv)
                        if (mtd_fixseama)
                                mtd_fixseama(device, 0, data_size);
                        break;
+               case CMD_FIXWRG:
+                       if (mtd_fixwrg)
+                               mtd_fixwrg(device, 0, data_size);
+                       break;
                case CMD_FIXWRGG:
                        if (mtd_fixwrgg)
                                mtd_fixwrgg(device, 0, data_size);
index 50a42da14bbd5b3f7acc6f94adcbc299f3bfb359..0250a90e0be65ba03d4f11cf7ff539e1d3da5f92 100644 (file)
@@ -27,6 +27,7 @@ extern int trx_fixup(int fd, const char *name)  __attribute__ ((weak));
 extern int trx_check(int imagefd, const char *mtd, char *buf, int *len) __attribute__ ((weak));
 extern int mtd_fixtrx(const char *mtd, size_t offset, size_t data_size) __attribute__ ((weak));
 extern int mtd_fixseama(const char *mtd, size_t offset, size_t data_size) __attribute__ ((weak));
+extern int mtd_fixwrg(const char *mtd, size_t offset, size_t data_size) __attribute__ ((weak));
 extern int mtd_fixwrgg(const char *mtd, size_t offset, size_t data_size) __attribute__ ((weak));
 extern int mtd_resetbc(const char *mtd) __attribute__ ((weak));
 #endif /* __mtd_h */
diff --git a/package/system/mtd/src/wrg.c b/package/system/mtd/src/wrg.c
new file mode 100644 (file)
index 0000000..879cf1b
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * wrg.c
+ *
+ * Copyright (C) 2005 Mike Baker
+ * Copyright (C) 2008 Felix Fietkau <nbd@nbd.name>
+ * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2016 Stijn Tintel <stijn@linux-ipv6.be>
+ * Copyright (C) 2017 George Hopkins <george-hopkins@null.net>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#include <byteswap.h>
+#include <endian.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+#include <arpa/inet.h>
+
+#include <sys/ioctl.h>
+#include <mtd/mtd-user.h>
+#include "mtd.h"
+#include "md5.h"
+
+#if !defined(__BYTE_ORDER)
+#error "Unknown byte order"
+#endif
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define cpu_to_le32(x) bswap_32(x)
+#define le32_to_cpu(x) bswap_32(x)
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+#define cpu_to_le32(x) (x)
+#define le32_to_cpu(x) (x)
+#else
+#error "Unsupported endianness"
+#endif
+
+#define WRG_MAGIC      0x20040220
+
+struct wrg_header {
+       char            signature[32];
+       uint32_t        magic1;
+       uint32_t        magic2;
+       uint32_t        size;
+       uint32_t        offset;
+       char            devname[32];
+       char            digest[16];
+} __attribute__ ((packed));
+
+ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
+
+int
+wrg_fix_md5(struct wrg_header *shdr, int fd, size_t data_offset, size_t data_size)
+{
+       char *buf;
+       ssize_t res;
+       MD5_CTX ctx;
+       unsigned char digest[16];
+       int i;
+       int err = 0;
+
+       buf = malloc(data_size);
+       if (!buf) {
+               err = -ENOMEM;
+               goto err_out;
+       }
+
+       res = pread(fd, buf, data_size, data_offset);
+       if (res != data_size) {
+               perror("pread");
+               err = -EIO;
+               goto err_free;
+       }
+
+       MD5_Init(&ctx);
+       MD5_Update(&ctx, (char *)&shdr->offset, sizeof(shdr->offset));
+       MD5_Update(&ctx, (char *)&shdr->devname, sizeof(shdr->devname));
+       MD5_Update(&ctx, buf, data_size);
+       MD5_Final(digest, &ctx);
+
+       if (!memcmp(digest, shdr->digest, sizeof(digest))) {
+               if (quiet < 2)
+                       fprintf(stderr, "the header is fixed already\n");
+               return -1;
+       }
+
+       if (quiet < 2) {
+               fprintf(stderr, "new size: %u, new MD5: ", data_size);
+               for (i = 0; i < sizeof(digest); i++)
+                       fprintf(stderr, "%02x", digest[i]);
+
+               fprintf(stderr, "\n");
+       }
+
+       /* update the size in the image */
+       shdr->size = cpu_to_le32(data_size);
+
+       /* update the checksum in the image */
+       memcpy(shdr->digest, digest, sizeof(digest));
+
+err_free:
+       free(buf);
+err_out:
+       return err;
+}
+
+int
+mtd_fixwrg(const char *mtd, size_t offset, size_t data_size)
+{
+       int fd;
+       char *first_block;
+       ssize_t res;
+       size_t block_offset;
+       size_t data_offset;
+       struct wrg_header *shdr;
+
+       if (quiet < 2)
+               fprintf(stderr, "Trying to fix WRG header in %s at 0x%x...\n",
+                       mtd, offset);
+
+       block_offset = offset & ~(erasesize - 1);
+       offset -= block_offset;
+
+       fd = mtd_check_open(mtd);
+       if(fd < 0) {
+               fprintf(stderr, "Could not open mtd device: %s\n", mtd);
+               exit(1);
+       }
+
+       if (block_offset + erasesize > mtdsize) {
+               fprintf(stderr, "Offset too large, device size 0x%x\n",
+                       mtdsize);
+               exit(1);
+       }
+
+       first_block = malloc(erasesize);
+       if (!first_block) {
+               perror("malloc");
+               exit(1);
+       }
+
+       res = pread(fd, first_block, erasesize, block_offset);
+       if (res != erasesize) {
+               perror("pread");
+               exit(1);
+       }
+
+       shdr = (struct wrg_header *)(first_block + offset);
+       if (le32_to_cpu(shdr->magic1) != WRG_MAGIC) {
+               fprintf(stderr, "No WRG header found (%08x != %08x)\n",
+                       le32_to_cpu(shdr->magic1), WRG_MAGIC);
+               exit(1);
+       } else if (!le32_to_cpu(shdr->size)) {
+               fprintf(stderr, "WRG entity with empty image\n");
+               exit(1);
+       }
+
+       data_offset = offset + sizeof(struct wrg_header);
+       if (!data_size)
+               data_size = mtdsize - data_offset;
+       if (data_size > le32_to_cpu(shdr->size))
+               data_size = le32_to_cpu(shdr->size);
+       if (wrg_fix_md5(shdr, fd, data_offset, data_size))
+               goto out;
+
+       if (mtd_erase_block(fd, block_offset)) {
+               fprintf(stderr, "Can't erease block at 0x%x (%s)\n",
+                       block_offset, strerror(errno));
+               exit(1);
+       }
+
+       if (quiet < 2)
+               fprintf(stderr, "Rewriting block at 0x%x\n", block_offset);
+
+       if (pwrite(fd, first_block, erasesize, block_offset) != erasesize) {
+               fprintf(stderr, "Error writing block (%s)\n", strerror(errno));
+               exit(1);
+       }
+
+       if (quiet < 2)
+               fprintf(stderr, "Done.\n");
+
+out:
+       close (fd);
+       sync();
+
+       return 0;
+}
index 864d3f62a9c3e0f9ab1b72b1ede8205a2edd83d4..95e1666e8c9357b222a94622b379cdff440688f7 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=procd
-PKG_RELEASE:=1
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/procd.git
-PKG_SOURCE_DATE:=2017-11-14
-PKG_SOURCE_VERSION:=d9dc0e03d70937dbbea12af86997701fbd717dc5
-PKG_MIRROR_HASH:=ad62410e6e43113c13aebf15f60c145f1eac09f309b8e7bd006a3621ca8f07a5
+PKG_SOURCE_DATE:=2018-01-23
+PKG_SOURCE_VERSION:=9a4036fb1b7412ab2ea4f360d2cc7e6a5e0fa6b5
+PKG_MIRROR_HASH:=bc500e2afe76fc0ce591900ddc5d68b33092841229a835699abc1e3455fc4499
 CMAKE_INSTALL:=1
 
 PKG_LICENSE:=GPL-2.0
@@ -107,9 +107,8 @@ ifdef CONFIG_PACKAGE_procd-ujail
   CMAKE_OPTIONS += -DJAIL_SUPPORT=1
 endif
 
-ifdef CONFIG_PACKAGE_procd-seccomp
-  CMAKE_OPTIONS += -DSECCOMP_SUPPORT=1 -DUTRACE_SUPPORT=1
-endif
+SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0)
+CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
 
 define Package/procd/install
        $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
@@ -130,6 +129,7 @@ define Package/procd-seccomp/install
        $(INSTALL_DIR) $(1)/sbin $(1)/lib
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
+       ln -s utrace $(1)/sbin/seccomp-trace
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
 endef
 
index 6347de57abb186126133d3c25ac2ce2f88a0e7a6..e6ca8a6bc924fe65d8832f96a203d0a6edabf987 100644 (file)
@@ -351,8 +351,10 @@ _procd_close_instance() {
        if json_select respawn ; then
                json_get_values respawn_vals
                if [ -z "$respawn_vals" ]; then
+                       local respawn_threshold=$(uci_get system.@service[0].respawn_threshold)
+                       local respawn_timeout=$(uci_get system.@service[0].respawn_timeout)
                        local respawn_retry=$(uci_get system.@service[0].respawn_retry)
-                       _procd_add_array_data 3600 5 ${respawn_retry:-5}
+                       _procd_add_array_data ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
                fi
                json_select ..
        fi
@@ -421,7 +423,7 @@ procd_add_mdns_service() {
        json_add_int port "$port"
        [ -n "$1" ] && {
                json_add_array txt
-               for txt in $@; do json_add_string "" $txt; done
+               for txt in "$@"; do json_add_string "" "$txt"; done
                json_select ..
        }
        json_select ..
@@ -430,7 +432,7 @@ procd_add_mdns_service() {
 procd_add_mdns() {
        procd_open_data
        json_add_object "mdns"
-       procd_add_mdns_service $@
+       procd_add_mdns_service "$@"
        json_close_object
        procd_close_data
 }
index ce62e83673718ff755b4a327fb4391f75c107b75..2dc960e48dc48e3b88f29ed661a5207b049f8385 100644 (file)
@@ -11,11 +11,11 @@ PKG_NAME:=rpcd
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/project/rpcd.git
-PKG_SOURCE_DATE:=2017-11-12
-PKG_SOURCE_VERSION:=a0231be8fbc61bb97e725eb206fc9b1ce9f69c05
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
+PKG_SOURCE_DATE:=2017-12-07
+PKG_SOURCE_VERSION:=cfe1e75c91bc1bac82e6caab3e652b0ebee59524
 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
-PKG_MIRROR_HASH:=5f66a6ad2eced71cccd43fc011077806e3bbc6dadd0403175947a02c25fe6344
+PKG_MIRROR_HASH:=4857497c88115defbf6add68a37975ed79e8f992e65d7d0df56cd29288dea379
 
 PKG_LICENSE:=ISC
 PKG_LICENSE_FILES:=
index 3c9b4aa5157d5ff0eb8e9ff6d31fe5d6ab74ad13..89cc6768fbeb24fc9c0a3ebc78ef97c74f28f027 100644 (file)
@@ -4,10 +4,10 @@ PKG_NAME:=ubox
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/project/ubox.git
-PKG_SOURCE_DATE:=2017-03-10
-PKG_SOURCE_VERSION:=16f7e16181e2f3e9cf3e2ce56a7e291844900d09
-PKG_MIRROR_HASH:=5f10f3df134eb8a69d281a73d39f5d2e2fc96af531a2f3960b0c6116ff11a707
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubox.git
+PKG_SOURCE_DATE:=2018-02-14
+PKG_SOURCE_VERSION:=128bc35fa951ac3beff6e977bc3cced87c2e2600
+PKG_MIRROR_HASH:=f58dfb9a9bb69c6303cb69bbd850b14bd29ec59ea240bac4063fd74a7fce64aa
 CMAKE_INSTALL:=1
 
 PKG_LICENSE:=GPL-2.0
@@ -41,11 +41,11 @@ define Package/ubox/install
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/getrandom $(1)/usr/bin/
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libvalidate.so $(1)/lib
 
-       $(LN) ../../sbin/kmodloader $(1)/usr/sbin/rmmod
-       $(LN) ../../sbin/kmodloader $(1)/usr/sbin/insmod
-       $(LN) ../../sbin/kmodloader $(1)/usr/sbin/lsmod
-       $(LN) ../../sbin/kmodloader $(1)/usr/sbin/modinfo
-       $(LN) ../../sbin/kmodloader $(1)/usr/sbin/modprobe
+       $(LN) kmodloader $(1)/sbin/rmmod
+       $(LN) kmodloader $(1)/sbin/insmod
+       $(LN) kmodloader $(1)/sbin/lsmod
+       $(LN) kmodloader $(1)/sbin/modinfo
+       $(LN) kmodloader $(1)/sbin/modprobe
 endef
 
 define Package/logd/install
index 722dc20e90baf3d945f08f1e04a849edf6255583..21e078712559f3e839c8154210bac766c3f231a0 100644 (file)
@@ -39,7 +39,7 @@ start_service_daemon()
        procd_open_instance
        procd_set_param command "/sbin/logd"
        procd_append_param command -S "${log_buffer_size}"
-       procd_set_param respawn
+       procd_set_param respawn 5 1 -1
        procd_close_instance
 }
 
index 4f3d4e8309d626044bbeea3aa9798da440cae7c7..7dc3c92deadbaf0e15d8e0135585b6e8cbc0e8c5 100644 (file)
@@ -4,10 +4,10 @@ PKG_NAME:=ubus
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/project/ubus.git
-PKG_SOURCE_DATE:=2017-02-18
-PKG_SOURCE_VERSION:=34c6e818e431cc53478a0f7c7c1eca07d194d692
-PKG_MIRROR_HASH:=fc4f1121faa4f5b8fa52ee25460b98b2e60e7d245aefa70e7f76c56ce5628fd5
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git
+PKG_SOURCE_DATE:=2018-01-16
+PKG_SOURCE_VERSION:=5bae22eb5472c9c7cc30caa9a84004bba19940d3
+PKG_MIRROR_HASH:=6f46398279339dcc597965306275fe1272af384f8cb253ee8de2c68e366eed55
 CMAKE_INSTALL:=1
 
 PKG_LICENSE:=LGPL-2.1
index b4d019cf39367c84629cd8a51884f4450584ca40..d5b4eac4aa8cbbb1733d0ccaa4610a4d049ea3b0 100644 (file)
@@ -11,11 +11,11 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=uci
 PKG_RELEASE:=1
 
-PKG_SOURCE_URL=$(LEDE_GIT)/project/uci.git
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE=2016-07-04
-PKG_SOURCE_VERSION:=e1bf4356e1b513e158e1b5049147087ed6342cfd
-PKG_MIRROR_HASH:=4994a10a9e15f71312502f8babf045da7cea18c64227b387fc2dcf64f2252f19
+PKG_SOURCE_DATE=2018-01-01
+PKG_SOURCE_VERSION:=5beb95da3dbec6db11a6bdfaab7807ee2daf41e6
+PKG_MIRROR_HASH:=123c5d3ed8f86db76ab52584e952c8e870891bca4dab682b753ca384d7d067bf
 
 PKG_LICENSE:=LGPL-2.1
 PKG_LICENSE_FILES:=
index 50891a64e4b444500ef82c0803f22a643752759d..78ec277669977d5c3328be16af7c455c3aae44d3 100644 (file)
@@ -118,9 +118,10 @@ uci_add() {
 uci_rename() {
        local PACKAGE="$1"
        local CONFIG="$2"
-       local VALUE="$3"
+       local OPTION="$3"
+       local VALUE="$4"
 
-       /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} rename "$PACKAGE.$CONFIG=$VALUE"
+       /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} rename "$PACKAGE.$CONFIG${VALUE:+.$OPTION}=${VALUE:-$OPTION}"
 }
 
 uci_remove() {
index 84adccb4a3e9d9f8e5c88d83c336f0a6c8039629..63f9f09953d47459729d8f4859e8bfac4012c90c 100644 (file)
@@ -4,7 +4,7 @@ PKG_NAME:=usign
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/project/usign.git
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/usign.git
 PKG_SOURCE_DATE:=2015-07-04
 PKG_SOURCE_VERSION:=ef6419142a3b0fbcddcccf536e3c1880302c6f89
 PKG_MIRROR_HASH:=9499ed7e40889b364e446a428e185c40986b75087888bd7e1496542457a6dbaa
index 6fd73e3a48a89b3565d5b620105274e910bdbed0..4ea495867c5b886635114254b3e80f756a16f18f 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=px5g
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 PKG_LICENSE:=LGPL-2.1
 PKG_BUILD_DIR:=$(BUILD_DIR)/px5g-$(BUILD_VARIANT)
 
@@ -47,7 +47,7 @@ define Build/Prepare
        mkdir -p $(PKG_BUILD_DIR)
 endef
 
-TARGET_LDFLAGS := -lmbedtls -lmbedx509 -lmbedcrypto
+TARGET_LDFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
 
 ifeq ($(BUILD_VARIANT),standalone)
   TARGET_LDFLAGS := -Wl,-Bstatic $(TARGET_LDFLAGS) -Wl,-Bdynamic
@@ -56,7 +56,7 @@ endif
 TARGET_CFLAGS += -Wl,--gc-sections
 
 define Build/Compile
-       $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/px5g px5g.c $(TARGET_LDFLAGS)
+       $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/px5g px5g.c $(TARGET_LDFLAGS)
 endef
 
 define Package/px5g-mbedtls/install
index 0c07cb18c7c3f4df7390ec3ff07edc71b4c2d895..639e82c24562b951665141dec475a7c4e7147521 100644 (file)
@@ -3,7 +3,7 @@ from mach files succeed.
 
 --- a/drivers/gpio/gpio-ath79.c
 +++ b/drivers/gpio/gpio-ath79.c
-@@ -202,4 +202,8 @@ static struct platform_driver ath79_gpio
+@@ -202,7 +202,11 @@ static struct platform_driver ath79_gpio
        .probe = ath79_gpio_probe,
  };
  
@@ -13,3 +13,6 @@ from mach files succeed.
 +      return platform_driver_register(&ath79_gpio_driver);
 +}
 +postcore_initcall(ath79_gpio_init);
+ MODULE_DESCRIPTION("Atheros AR71XX/AR724X/AR913X GPIO API support");
+ MODULE_LICENSE("GPL v2");
diff --git a/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch
new file mode 100644 (file)
index 0000000..dff3543
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+@@ -157,6 +157,10 @@
+ #define QCA956X_EHCI0_BASE    0x1b000000
+ #define QCA956X_EHCI1_BASE    0x1b400000
+ #define QCA956X_EHCI_SIZE     0x200
++#define QCA956X_GMAC_SGMII_BASE       (AR71XX_APB_BASE + 0x00070000)
++#define QCA956X_GMAC_SGMII_SIZE       0x64
++#define QCA956X_PLL_BASE      (AR71XX_APB_BASE + 0x00050000)
++#define QCA956X_PLL_SIZE      0x50
+ #define QCA956X_GMAC_BASE     (AR71XX_APB_BASE + 0x00070000)
+ #define QCA956X_GMAC_SIZE     0x64
+@@ -404,6 +408,7 @@
+ #define QCA956X_PLL_DDR_CONFIG_REG                    0x08
+ #define QCA956X_PLL_DDR_CONFIG1_REG                   0x0c
+ #define QCA956X_PLL_CLK_CTRL_REG                      0x10
++#define QCA956X_PLL_ETH_XMII_CONTROL_REG              0x30
+ #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT           12
+ #define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK            0x1f
+@@ -1186,4 +1191,16 @@
+ #define QCA955X_ETH_CFG_TXE_DELAY_MASK        0x3
+ #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT       20
++/*
++ * QCA956X GMAC Interface
++ */
++
++#define QCA956X_GMAC_REG_ETH_CFG              0x00
++
++#define QCA956X_ETH_CFG_SW_ONLY_MODE          BIT(7)
++#define QCA956X_ETH_CFG_SW_PHY_SWAP               BIT(8)
++#define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP      BIT(9)
++#define QCA956X_ETH_CFG_SW_APB_ACCESS         BIT(10)
++#define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST      BIT(13)
++
+ #endif /* __ASM_MACH_AR71XX_REGS_H */
index add2992186ad1d82ce924d2f1ccdf3c36c390a3d..8aa5957a7152af27854f6f7c197120b8029cf9e8 100644 (file)
@@ -20,7 +20,7 @@
  #define AR71XX_UART_BASE      (AR71XX_APB_BASE + 0x00020000)
  #define AR71XX_UART_SIZE      0x100
  #define AR71XX_USB_CTRL_BASE  (AR71XX_APB_BASE + 0x00030000)
-@@ -218,6 +218,9 @@
+@@ -222,6 +222,9 @@
  #define QCA953X_DDR_REG_FLUSH_PCIE    0xa8
  #define QCA953X_DDR_REG_FLUSH_WMAC    0xac
  
index 7db6ad361fa21252118e589195b0bc73222cf4f5..6b331587d157511a40fc1e46630c416a60565a0b 100644 (file)
@@ -48,7 +48,7 @@ functions on the Arduino Yun.
        void __iomem *reg = ath79_gpio_get_function_reg();
 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
-@@ -850,6 +850,7 @@
+@@ -855,6 +855,7 @@
  #define AR71XX_GPIO_REG_INT_PENDING   0x20
  #define AR71XX_GPIO_REG_INT_ENABLE    0x24
  #define AR71XX_GPIO_REG_FUNC          0x28
@@ -56,7 +56,7 @@ functions on the Arduino Yun.
  
  #define AR934X_GPIO_REG_OUT_FUNC0     0x2c
  #define AR934X_GPIO_REG_OUT_FUNC1     0x30
-@@ -974,6 +975,8 @@
+@@ -979,6 +980,8 @@
  #define AR724X_GPIO_FUNC_UART_EN              BIT(1)
  #define AR724X_GPIO_FUNC_JTAG_DISABLE         BIT(0)
  
index 5bedf5dc9effc53c96a8ace4ac393b49315ffe9c..72d964df639ba2a91071fbdc893bf500ece51a48 100644 (file)
  
        t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr,
                                 key, greh->protocol);
-@@ -479,11 +479,11 @@ static int ip6gre_rcv(struct sk_buff *sk
+@@ -482,11 +482,11 @@ static int ip6gre_rcv(struct sk_buff *sk
                        offset += 4;
                }
                if (flags&GRE_KEY) {
                        offset += 4;
                }
        }
-@@ -745,7 +745,7 @@ static netdev_tx_t ip6gre_xmit2(struct s
+@@ -748,7 +748,7 @@ static netdev_tx_t ip6gre_xmit2(struct s
  
                if (tunnel->parms.o_flags&GRE_SEQ) {
                        ++tunnel->o_seqno;
                        ptr--;
                }
                if (tunnel->parms.o_flags&GRE_KEY) {
-@@ -841,7 +841,7 @@ static inline int ip6gre_xmit_ipv6(struc
+@@ -844,7 +844,7 @@ static inline int ip6gre_xmit_ipv6(struc
  
        dsfield = ipv6_get_dsfield(ipv6h);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
 --- a/net/ipv6/ip6_tunnel.c
 +++ b/net/ipv6/ip6_tunnel.c
-@@ -1409,7 +1409,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1307,7 +1307,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
  
        dsfield = ipv6_get_dsfield(ipv6h);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
                memcpy(p, foc->val, foc->len);
 --- a/net/ipv4/igmp.c
 +++ b/net/ipv4/igmp.c
-@@ -505,7 +505,7 @@ static struct sk_buff *add_grec(struct s
+@@ -533,7 +533,7 @@ static struct sk_buff *add_grec(struct s
                if (!skb)
                        return NULL;
                psrc = (__be32 *)skb_put(skb, sizeof(__be32));
  
  #define       IP6_MF          0x0001
  #define       IP6_OFFSET      0xFFF8
-@@ -417,8 +417,8 @@ static inline void __ipv6_addr_set_half(
+@@ -418,8 +418,8 @@ static inline void __ipv6_addr_set_half(
        }
  #endif
  #endif
  }
  
  static inline void ipv6_addr_set(struct in6_addr *addr, 
-@@ -477,6 +477,8 @@ static inline bool ipv6_prefix_equal(con
+@@ -478,6 +478,8 @@ static inline bool ipv6_prefix_equal(con
        const __be32 *a1 = addr1->s6_addr32;
        const __be32 *a2 = addr2->s6_addr32;
        unsigned int pdw, pbi;
  
        /* check complete u32 in prefix */
        pdw = prefixlen >> 5;
-@@ -485,7 +487,9 @@ static inline bool ipv6_prefix_equal(con
+@@ -486,7 +488,9 @@ static inline bool ipv6_prefix_equal(con
  
        /* check incomplete u32 in prefix */
        pbi = prefixlen & 0x1f;
                return false;
  
        return true;
-@@ -629,13 +633,13 @@ static inline void ipv6_addr_set_v4mappe
+@@ -630,13 +634,13 @@ static inline void ipv6_addr_set_v4mappe
   */
  static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
  {
                if (xb)
                        return i * 32 + 31 - __fls(ntohl(xb));
        }
-@@ -804,17 +808,18 @@ static inline int ip6_default_np_autolab
+@@ -805,17 +809,18 @@ static inline int ip6_default_np_autolab
  static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
                                __be32 flowlabel)
  {
diff --git a/target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
deleted file mode 100644 (file)
index 6312f0f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-From b7c6d2675899cfff0180412c63fc9cbd5bacdb4d Mon Sep 17 00:00:00 2001
-From: Eric Dumazet <edumazet@google.com>
-Date: Wed, 19 Apr 2017 09:59:21 -0700
-Subject: [PATCH] smsc75xx: use skb_cow_head() to deal with cloned skbs
-
-We need to ensure there is enough headroom to push extra header,
-but we also need to check if we are allowed to change headers.
-
-skb_cow_head() is the proper helper to deal with this.
-
-Fixes: d0cad871703b ("smsc75xx: SMSC LAN75xx USB gigabit ethernet adapter driver")
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Cc: James Hughes <james.hughes@raspberrypi.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/usb/smsc75xx.c | 8 ++------
- 1 file changed, 2 insertions(+), 6 deletions(-)
-
---- a/drivers/net/usb/smsc75xx.c
-+++ b/drivers/net/usb/smsc75xx.c
-@@ -2193,13 +2193,9 @@ static struct sk_buff *smsc75xx_tx_fixup
- {
-       u32 tx_cmd_a, tx_cmd_b;
--      if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) {
--              struct sk_buff *skb2 =
--                      skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags);
-+      if (skb_cow_head(skb, SMSC75XX_TX_OVERHEAD)) {
-               dev_kfree_skb_any(skb);
--              skb = skb2;
--              if (!skb)
--                      return NULL;
-+              return NULL;
-       }
-       tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN) | TX_CMD_A_FCS;
diff --git a/target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch b/target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch
deleted file mode 100644 (file)
index aee8aa9..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-From a9e840a2081ed28c2b7caa6a9a0041c950b3c37d Mon Sep 17 00:00:00 2001
-From: Eric Dumazet <edumazet@google.com>
-Date: Wed, 19 Apr 2017 09:59:22 -0700
-Subject: [PATCH] cx82310_eth: use skb_cow_head() to deal with cloned skbs
-
-We need to ensure there is enough headroom to push extra header,
-but we also need to check if we are allowed to change headers.
-
-skb_cow_head() is the proper helper to deal with this.
-
-Fixes: cc28a20e77b2 ("introduce cx82310_eth: Conexant CX82310-based ADSL router USB ethernet driver")
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Cc: James Hughes <james.hughes@raspberrypi.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/usb/cx82310_eth.c | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
-
---- a/drivers/net/usb/cx82310_eth.c
-+++ b/drivers/net/usb/cx82310_eth.c
-@@ -293,12 +293,9 @@ static struct sk_buff *cx82310_tx_fixup(
- {
-       int len = skb->len;
--      if (skb_headroom(skb) < 2) {
--              struct sk_buff *skb2 = skb_copy_expand(skb, 2, 0, flags);
-+      if (skb_cow_head(skb, 2)) {
-               dev_kfree_skb_any(skb);
--              skb = skb2;
--              if (!skb)
--                      return NULL;
-+              return NULL;
-       }
-       skb_push(skb, 2);
diff --git a/target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
deleted file mode 100644 (file)
index 4d0fcf6..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-From d532c1082f68176363ed766d09bf187616e282fe Mon Sep 17 00:00:00 2001
-From: Eric Dumazet <edumazet@google.com>
-Date: Wed, 19 Apr 2017 09:59:23 -0700
-Subject: [PATCH] sr9700: use skb_cow_head() to deal with cloned skbs
-
-We need to ensure there is enough headroom to push extra header,
-but we also need to check if we are allowed to change headers.
-
-skb_cow_head() is the proper helper to deal with this.
-
-Fixes: c9b37458e956 ("USB2NET : SR9700 : One chip USB 1.1 USB2NET SR9700Device Driver Support")
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Cc: James Hughes <james.hughes@raspberrypi.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/usb/sr9700.c | 9 ++-------
- 1 file changed, 2 insertions(+), 7 deletions(-)
-
---- a/drivers/net/usb/sr9700.c
-+++ b/drivers/net/usb/sr9700.c
-@@ -456,14 +456,9 @@ static struct sk_buff *sr9700_tx_fixup(s
-       len = skb->len;
--      if (skb_headroom(skb) < SR_TX_OVERHEAD) {
--              struct sk_buff *skb2;
--
--              skb2 = skb_copy_expand(skb, SR_TX_OVERHEAD, 0, flags);
-+      if (skb_cow_head(skb, SR_TX_OVERHEAD)) {
-               dev_kfree_skb_any(skb);
--              skb = skb2;
--              if (!skb)
--                      return NULL;
-+              return NULL;
-       }
-       __skb_push(skb, SR_TX_OVERHEAD);
diff --git a/target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
deleted file mode 100644 (file)
index 4f96041..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-From d4ca73591916b760478d2b04334d5dcadc028e9c Mon Sep 17 00:00:00 2001
-From: Eric Dumazet <edumazet@google.com>
-Date: Wed, 19 Apr 2017 09:59:24 -0700
-Subject: [PATCH] lan78xx: use skb_cow_head() to deal with cloned skbs
-
-We need to ensure there is enough headroom to push extra header,
-but we also need to check if we are allowed to change headers.
-
-skb_cow_head() is the proper helper to deal with this.
-
-Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Cc: James Hughes <james.hughes@raspberrypi.org>
-Cc: Woojung Huh <woojung.huh@microchip.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/usb/lan78xx.c | 9 ++-------
- 1 file changed, 2 insertions(+), 7 deletions(-)
-
---- a/drivers/net/usb/lan78xx.c
-+++ b/drivers/net/usb/lan78xx.c
-@@ -2050,14 +2050,9 @@ static struct sk_buff *lan78xx_tx_prep(s
- {
-       u32 tx_cmd_a, tx_cmd_b;
--      if (skb_headroom(skb) < TX_OVERHEAD) {
--              struct sk_buff *skb2;
--
--              skb2 = skb_copy_expand(skb, TX_OVERHEAD, 0, flags);
-+      if (skb_cow_head(skb, TX_OVERHEAD)) {
-               dev_kfree_skb_any(skb);
--              skb = skb2;
--              if (!skb)
--                      return NULL;
-+              return NULL;
-       }
-       if (lan78xx_linearize(skb) < 0)
index eb095b7a2e5d99afdd28e01dd9aa66efbcefad49..7225fc8cd9aed5a5eecfe2249895a0eacdf6df76 100644 (file)
@@ -53,7 +53,7 @@ Cc: <stable@vger.kernel.org>
                err = ovl_check_whiteouts(realpath->dentry, rdd);
  
        fput(realfile);
-@@ -569,3 +569,64 @@ void ovl_cleanup_whiteouts(struct dentry
+@@ -573,3 +573,64 @@ void ovl_cleanup_whiteouts(struct dentry
        }
        mutex_unlock(&upper->d_inode->i_mutex);
  }
diff --git a/target/linux/generic/patches-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch b/target/linux/generic/patches-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch
deleted file mode 100644 (file)
index cd0d098..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-From 1f820f538f7396db7fd40684b9c3620816acc5a3 Mon Sep 17 00:00:00 2001
-From: Arnd Bergmann <arnd@arndb.de>
-Date: Fri, 29 Jan 2016 12:39:12 +0100
-Subject: [PATCH] net: bgmac: clarify CONFIG_BCMA dependency
-
-The bgmac driver depends on BCMA_HOST_SOC, which is only used
-when CONFIG_BCMA is enabled. However, it is a bool option and can
-be set when CONFIG_BCMA=m, and then bgmac can be built-in, leading
-to an obvious link error:
-
-drivers/built-in.o: In function `bgmac_init':
-:(.init.text+0x7f2c): undefined reference to `__bcma_driver_register'
-drivers/built-in.o: In function `bgmac_exit':
-:(.exit.text+0x110a): undefined reference to `bcma_driver_unregister'
-
-To avoid this case, we need to depend on both BCMA and BCMA_SOC,
-as this patch does. I'm also trying to make the dependency more
-readable by splitting it into three lines, and adding a COMPILE_TEST
-alternative so we can test-build it in all configurations that
-support BCMA.
-
-The added dependency on FIXED_PHY addresses a related issue where
-we cannot call fixed_phy_register() when CONFIG_FIXED_PHY=m and
-CONFIG_BGMAC=y.
-
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/Kconfig | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/Kconfig
-+++ b/drivers/net/ethernet/broadcom/Kconfig
-@@ -151,8 +151,11 @@ config BNX2X_VXLAN
- config BGMAC
-       tristate "BCMA bus GBit core support"
--      depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X)
-+      depends on BCMA && BCMA_HOST_SOC
-+      depends on HAS_DMA
-+      depends on BCM47XX || ARCH_BCM_5301X || COMPILE_TEST
-       select PHYLIB
-+      select FIXED_PHY
-       ---help---
-         This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus.
-         They can be found on BCM47xx SoCs and provide gigabit ethernet.
diff --git a/target/linux/generic/patches-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch b/target/linux/generic/patches-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch
deleted file mode 100644 (file)
index 94a37d4..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-From 387b75f8b31437792e8334390fdf5cf060d1e3da Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Tue, 2 Feb 2016 07:47:14 +0100
-Subject: [PATCH] bgmac: add helper checking for BCM4707 / BCM53018 chip id
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Chipsets with BCM4707 / BCM53018 ID require special handling at a few
-places in the code. It's likely there will be more IDs to check in the
-future. To simplify it add this trivial helper.
-
-Signed-off-by: RafaÅ‚ MiÅ‚ecki <zajec5@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 30 ++++++++++++++++--------------
- 1 file changed, 16 insertions(+), 14 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -26,6 +26,17 @@ static const struct bcma_device_id bgmac
- };
- MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
-+static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac)
-+{
-+      switch (bgmac->core->bus->chipinfo.id) {
-+      case BCMA_CHIP_ID_BCM4707:
-+      case BCMA_CHIP_ID_BCM53018:
-+              return true;
-+      default:
-+              return false;
-+      }
-+}
-+
- static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask,
-                            u32 value, int timeout)
- {
-@@ -991,11 +1002,9 @@ static void bgmac_mac_speed(struct bgmac
- static void bgmac_miiconfig(struct bgmac *bgmac)
- {
-       struct bcma_device *core = bgmac->core;
--      struct bcma_chipinfo *ci = &core->bus->chipinfo;
-       u8 imode;
--      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--          ci->id == BCMA_CHIP_ID_BCM53018) {
-+      if (bgmac_is_bcm4707_family(bgmac)) {
-               bcma_awrite32(core, BCMA_IOCTL,
-                             bcma_aread32(core, BCMA_IOCTL) | 0x40 |
-                             BGMAC_BCMA_IOCTL_SW_CLKEN);
-@@ -1059,9 +1068,7 @@ static void bgmac_chip_reset(struct bgma
-       }
-       /* Request Misc PLL for corerev > 2 */
--      if (core->id.rev > 2 &&
--          ci->id != BCMA_CHIP_ID_BCM4707 &&
--          ci->id != BCMA_CHIP_ID_BCM53018) {
-+      if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) {
-               bgmac_set(bgmac, BCMA_CLKCTLST,
-                         BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
-               bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
-@@ -1197,8 +1204,7 @@ static void bgmac_enable(struct bgmac *b
-               break;
-       }
--      if (ci->id != BCMA_CHIP_ID_BCM4707 &&
--          ci->id != BCMA_CHIP_ID_BCM53018) {
-+      if (!bgmac_is_bcm4707_family(bgmac)) {
-               rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
-               rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
-               bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) /
-@@ -1477,14 +1483,12 @@ static int bgmac_fixed_phy_register(stru
- static int bgmac_mii_register(struct bgmac *bgmac)
- {
--      struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
-       struct mii_bus *mii_bus;
-       struct phy_device *phy_dev;
-       char bus_id[MII_BUS_ID_SIZE + 3];
-       int i, err = 0;
--      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--          ci->id == BCMA_CHIP_ID_BCM53018)
-+      if (bgmac_is_bcm4707_family(bgmac))
-               return bgmac_fixed_phy_register(bgmac);
-       mii_bus = mdiobus_alloc();
-@@ -1555,7 +1559,6 @@ static void bgmac_mii_unregister(struct
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
- static int bgmac_probe(struct bcma_device *core)
- {
--      struct bcma_chipinfo *ci = &core->bus->chipinfo;
-       struct net_device *net_dev;
-       struct bgmac *bgmac;
-       struct ssb_sprom *sprom = &core->bus->sprom;
-@@ -1641,8 +1644,7 @@ static int bgmac_probe(struct bcma_devic
-       bgmac_chip_reset(bgmac);
-       /* For Northstar, we have to take all GMAC core out of reset */
--      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--          ci->id == BCMA_CHIP_ID_BCM53018) {
-+      if (bgmac_is_bcm4707_family(bgmac)) {
-               struct bcma_device *ns_core;
-               int ns_gmac;
diff --git a/target/linux/generic/patches-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch b/target/linux/generic/patches-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch
deleted file mode 100644 (file)
index 41e470b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-From 9e4e6206c67ae11d68fc96882256f37c237087d4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Mon, 22 Feb 2016 22:51:13 +0100
-Subject: [PATCH] bgmac: support Ethernet device on BCM47094 SoC
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It needs very similar workarounds to the one on BCM4707. It was tested
-on D-Link DIR-885L home router.
-
-Signed-off-by: RafaÅ‚ MiÅ‚ecki <zajec5@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -30,6 +30,7 @@ static inline bool bgmac_is_bcm4707_fami
- {
-       switch (bgmac->core->bus->chipinfo.id) {
-       case BCMA_CHIP_ID_BCM4707:
-+      case BCMA_CHIP_ID_BCM47094:
-       case BCMA_CHIP_ID_BCM53018:
-               return true;
-       default:
-@@ -1056,8 +1057,9 @@ static void bgmac_chip_reset(struct bgma
-           (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188))
-               iost &= ~BGMAC_BCMA_IOST_ATTACHED;
--      /* 3GMAC: for BCM4707, only do core reset at bgmac_probe() */
--      if (ci->id != BCMA_CHIP_ID_BCM4707) {
-+      /* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */
-+      if (ci->id != BCMA_CHIP_ID_BCM4707 &&
-+          ci->id != BCMA_CHIP_ID_BCM47094) {
-               flags = 0;
-               if (iost & BGMAC_BCMA_IOST_ATTACHED) {
-                       flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
diff --git a/target/linux/generic/patches-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch b/target/linux/generic/patches-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch
deleted file mode 100644 (file)
index a5fcaab..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-From c02bc350f9dbce7d637c394a6e1c4d29dc5b28b2 Mon Sep 17 00:00:00 2001
-From: Felix Fietkau <nbd@nbd.name>
-Date: Tue, 12 Apr 2016 18:27:29 +0200
-Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0. This mainly
-fixes support for BCM4708A0KF SoCs with Ethernet core rev 5 (it means
-only some devices as most of BCM4708A0KF-s got core rev 4).
-This was tested for regressions on BCM47094 which doesn't seem to care
-which bit gets used.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-Signed-off-by: RafaÅ‚ MiÅ‚ecki <zajec5@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
-
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -199,9 +199,9 @@
- #define  BGMAC_CMDCFG_TAI                     0x00000200
- #define  BGMAC_CMDCFG_HD                      0x00000400      /* Set if in half duplex mode */
- #define  BGMAC_CMDCFG_HD_SHIFT                        10
--#define  BGMAC_CMDCFG_SR_REV0                 0x00000800      /* Set to reset mode, for other revs */
--#define  BGMAC_CMDCFG_SR_REV4                 0x00002000      /* Set to reset mode, only for core rev 4 */
--#define  BGMAC_CMDCFG_SR(rev)  ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
-+#define  BGMAC_CMDCFG_SR_REV0                 0x00000800      /* Set to reset mode, for core rev 0-3 */
-+#define  BGMAC_CMDCFG_SR_REV4                 0x00002000      /* Set to reset mode, for core rev >= 4 */
-+#define  BGMAC_CMDCFG_SR(rev)  ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
- #define  BGMAC_CMDCFG_ML                      0x00008000      /* Set to activate mac loopback mode */
- #define  BGMAC_CMDCFG_AE                      0x00400000
- #define  BGMAC_CMDCFG_CFE                     0x00800000
diff --git a/target/linux/generic/patches-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch b/target/linux/generic/patches-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch
deleted file mode 100644 (file)
index 8f6d9a9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-From 2022e9d50798aa592887ccb5a7d045e537f3855f Mon Sep 17 00:00:00 2001
-From: Florian Fainelli <f.fainelli@gmail.com>
-Date: Tue, 7 Jun 2016 15:06:13 -0700
-Subject: [PATCH 1/3] bgmac: Bind net_device with backing device structure
-
-In preparation for allowing different helpers to be utilized against
-network devices created by the bgmac driver, make sure that we bind the
-net_device with core->dev.
-
-Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1604,6 +1604,7 @@ static int bgmac_probe(struct bcma_devic
-       bgmac->net_dev = net_dev;
-       bgmac->core = core;
-       bcma_set_drvdata(core, bgmac);
-+      SET_NETDEV_DEV(net_dev, &core->dev);
-       /* Defaults */
-       memcpy(bgmac->net_dev->dev_addr, mac, ETH_ALEN);
diff --git a/target/linux/generic/patches-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch b/target/linux/generic/patches-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch
deleted file mode 100644 (file)
index 585282b..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-From f6613d4fa937fa8388f2c1cb4e69ccc25e9e2336 Mon Sep 17 00:00:00 2001
-From: Florian Fainelli <f.fainelli@gmail.com>
-Date: Tue, 7 Jun 2016 15:06:14 -0700
-Subject: [PATCH 2/3] bgmac: Add support for ethtool statistics
-
-Read the statistics from the BGMAC's builtin MAC and return them to
-user-space using the standard ethtool helpers.
-
-Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 124 ++++++++++++++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.h |   4 +-
- 2 files changed, 126 insertions(+), 2 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1387,6 +1387,127 @@ static const struct net_device_ops bgmac
-  * ethtool_ops
-  **************************************************/
-+struct bgmac_stat {
-+      u8 size;
-+      u32 offset;
-+      const char *name;
-+};
-+
-+static struct bgmac_stat bgmac_get_strings_stats[] = {
-+      { 8, BGMAC_TX_GOOD_OCTETS, "tx_good_octets" },
-+      { 4, BGMAC_TX_GOOD_PKTS, "tx_good" },
-+      { 8, BGMAC_TX_OCTETS, "tx_octets" },
-+      { 4, BGMAC_TX_PKTS, "tx_pkts" },
-+      { 4, BGMAC_TX_BROADCAST_PKTS, "tx_broadcast" },
-+      { 4, BGMAC_TX_MULTICAST_PKTS, "tx_multicast" },
-+      { 4, BGMAC_TX_LEN_64, "tx_64" },
-+      { 4, BGMAC_TX_LEN_65_TO_127, "tx_65_127" },
-+      { 4, BGMAC_TX_LEN_128_TO_255, "tx_128_255" },
-+      { 4, BGMAC_TX_LEN_256_TO_511, "tx_256_511" },
-+      { 4, BGMAC_TX_LEN_512_TO_1023, "tx_512_1023" },
-+      { 4, BGMAC_TX_LEN_1024_TO_1522, "tx_1024_1522" },
-+      { 4, BGMAC_TX_LEN_1523_TO_2047, "tx_1523_2047" },
-+      { 4, BGMAC_TX_LEN_2048_TO_4095, "tx_2048_4095" },
-+      { 4, BGMAC_TX_LEN_4096_TO_8191, "tx_4096_8191" },
-+      { 4, BGMAC_TX_LEN_8192_TO_MAX, "tx_8192_max" },
-+      { 4, BGMAC_TX_JABBER_PKTS, "tx_jabber" },
-+      { 4, BGMAC_TX_OVERSIZE_PKTS, "tx_oversize" },
-+      { 4, BGMAC_TX_FRAGMENT_PKTS, "tx_fragment" },
-+      { 4, BGMAC_TX_UNDERRUNS, "tx_underruns" },
-+      { 4, BGMAC_TX_TOTAL_COLS, "tx_total_cols" },
-+      { 4, BGMAC_TX_SINGLE_COLS, "tx_single_cols" },
-+      { 4, BGMAC_TX_MULTIPLE_COLS, "tx_multiple_cols" },
-+      { 4, BGMAC_TX_EXCESSIVE_COLS, "tx_excessive_cols" },
-+      { 4, BGMAC_TX_LATE_COLS, "tx_late_cols" },
-+      { 4, BGMAC_TX_DEFERED, "tx_defered" },
-+      { 4, BGMAC_TX_CARRIER_LOST, "tx_carrier_lost" },
-+      { 4, BGMAC_TX_PAUSE_PKTS, "tx_pause" },
-+      { 4, BGMAC_TX_UNI_PKTS, "tx_unicast" },
-+      { 4, BGMAC_TX_Q0_PKTS, "tx_q0" },
-+      { 8, BGMAC_TX_Q0_OCTETS, "tx_q0_octets" },
-+      { 4, BGMAC_TX_Q1_PKTS, "tx_q1" },
-+      { 8, BGMAC_TX_Q1_OCTETS, "tx_q1_octets" },
-+      { 4, BGMAC_TX_Q2_PKTS, "tx_q2" },
-+      { 8, BGMAC_TX_Q2_OCTETS, "tx_q2_octets" },
-+      { 4, BGMAC_TX_Q3_PKTS, "tx_q3" },
-+      { 8, BGMAC_TX_Q3_OCTETS, "tx_q3_octets" },
-+      { 8, BGMAC_RX_GOOD_OCTETS, "rx_good_octets" },
-+      { 4, BGMAC_RX_GOOD_PKTS, "rx_good" },
-+      { 8, BGMAC_RX_OCTETS, "rx_octets" },
-+      { 4, BGMAC_RX_PKTS, "rx_pkts" },
-+      { 4, BGMAC_RX_BROADCAST_PKTS, "rx_broadcast" },
-+      { 4, BGMAC_RX_MULTICAST_PKTS, "rx_multicast" },
-+      { 4, BGMAC_RX_LEN_64, "rx_64" },
-+      { 4, BGMAC_RX_LEN_65_TO_127, "rx_65_127" },
-+      { 4, BGMAC_RX_LEN_128_TO_255, "rx_128_255" },
-+      { 4, BGMAC_RX_LEN_256_TO_511, "rx_256_511" },
-+      { 4, BGMAC_RX_LEN_512_TO_1023, "rx_512_1023" },
-+      { 4, BGMAC_RX_LEN_1024_TO_1522, "rx_1024_1522" },
-+      { 4, BGMAC_RX_LEN_1523_TO_2047, "rx_1523_2047" },
-+      { 4, BGMAC_RX_LEN_2048_TO_4095, "rx_2048_4095" },
-+      { 4, BGMAC_RX_LEN_4096_TO_8191, "rx_4096_8191" },
-+      { 4, BGMAC_RX_LEN_8192_TO_MAX, "rx_8192_max" },
-+      { 4, BGMAC_RX_JABBER_PKTS, "rx_jabber" },
-+      { 4, BGMAC_RX_OVERSIZE_PKTS, "rx_oversize" },
-+      { 4, BGMAC_RX_FRAGMENT_PKTS, "rx_fragment" },
-+      { 4, BGMAC_RX_MISSED_PKTS, "rx_missed" },
-+      { 4, BGMAC_RX_CRC_ALIGN_ERRS, "rx_crc_align" },
-+      { 4, BGMAC_RX_UNDERSIZE, "rx_undersize" },
-+      { 4, BGMAC_RX_CRC_ERRS, "rx_crc" },
-+      { 4, BGMAC_RX_ALIGN_ERRS, "rx_align" },
-+      { 4, BGMAC_RX_SYMBOL_ERRS, "rx_symbol" },
-+      { 4, BGMAC_RX_PAUSE_PKTS, "rx_pause" },
-+      { 4, BGMAC_RX_NONPAUSE_PKTS, "rx_nonpause" },
-+      { 4, BGMAC_RX_SACHANGES, "rx_sa_changes" },
-+      { 4, BGMAC_RX_UNI_PKTS, "rx_unicast" },
-+};
-+
-+#define BGMAC_STATS_LEN       ARRAY_SIZE(bgmac_get_strings_stats)
-+
-+static int bgmac_get_sset_count(struct net_device *dev, int string_set)
-+{
-+      switch (string_set) {
-+      case ETH_SS_STATS:
-+              return BGMAC_STATS_LEN;
-+      }
-+
-+      return -EOPNOTSUPP;
-+}
-+
-+static void bgmac_get_strings(struct net_device *dev, u32 stringset,
-+                            u8 *data)
-+{
-+      int i;
-+
-+      if (stringset != ETH_SS_STATS)
-+              return;
-+
-+      for (i = 0; i < BGMAC_STATS_LEN; i++)
-+              strlcpy(data + i * ETH_GSTRING_LEN,
-+                      bgmac_get_strings_stats[i].name, ETH_GSTRING_LEN);
-+}
-+
-+static void bgmac_get_ethtool_stats(struct net_device *dev,
-+                                  struct ethtool_stats *ss, uint64_t *data)
-+{
-+      struct bgmac *bgmac = netdev_priv(dev);
-+      const struct bgmac_stat *s;
-+      unsigned int i;
-+      u64 val;
-+
-+      if (!netif_running(dev))
-+              return;
-+
-+      for (i = 0; i < BGMAC_STATS_LEN; i++) {
-+              s = &bgmac_get_strings_stats[i];
-+              val = 0;
-+              if (s->size == 8)
-+                      val = (u64)bgmac_read(bgmac, s->offset + 4) << 32;
-+              val |= bgmac_read(bgmac, s->offset);
-+              data[i] = val;
-+      }
-+}
-+
- static int bgmac_get_settings(struct net_device *net_dev,
-                             struct ethtool_cmd *cmd)
- {
-@@ -1411,6 +1532,9 @@ static void bgmac_get_drvinfo(struct net
- }
- static const struct ethtool_ops bgmac_ethtool_ops = {
-+      .get_strings            = bgmac_get_strings,
-+      .get_sset_count         = bgmac_get_sset_count,
-+      .get_ethtool_stats      = bgmac_get_ethtool_stats,
-       .get_settings           = bgmac_get_settings,
-       .set_settings           = bgmac_set_settings,
-       .get_drvinfo            = bgmac_get_drvinfo,
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -123,7 +123,7 @@
- #define BGMAC_TX_LEN_1024_TO_1522             0x334
- #define BGMAC_TX_LEN_1523_TO_2047             0x338
- #define BGMAC_TX_LEN_2048_TO_4095             0x33c
--#define BGMAC_TX_LEN_4095_TO_8191             0x340
-+#define BGMAC_TX_LEN_4096_TO_8191             0x340
- #define BGMAC_TX_LEN_8192_TO_MAX              0x344
- #define BGMAC_TX_JABBER_PKTS                  0x348           /* Error */
- #define BGMAC_TX_OVERSIZE_PKTS                        0x34c           /* Error */
-@@ -166,7 +166,7 @@
- #define BGMAC_RX_LEN_1024_TO_1522             0x3e4
- #define BGMAC_RX_LEN_1523_TO_2047             0x3e8
- #define BGMAC_RX_LEN_2048_TO_4095             0x3ec
--#define BGMAC_RX_LEN_4095_TO_8191             0x3f0
-+#define BGMAC_RX_LEN_4096_TO_8191             0x3f0
- #define BGMAC_RX_LEN_8192_TO_MAX              0x3f4
- #define BGMAC_RX_JABBER_PKTS                  0x3f8           /* Error */
- #define BGMAC_RX_OVERSIZE_PKTS                        0x3fc           /* Error */
diff --git a/target/linux/generic/patches-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch b/target/linux/generic/patches-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch
deleted file mode 100644 (file)
index 1dbe174..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-From 6d490f62a4c7f11c552591bdd08eda3636aa0db9 Mon Sep 17 00:00:00 2001
-From: Florian Fainelli <f.fainelli@gmail.com>
-Date: Tue, 7 Jun 2016 15:06:15 -0700
-Subject: [PATCH 3/3] bgmac: Maintain some netdev statistics
-
-Add a few netdev statistics to report transmitted and received bytes and
-packets and a few obvious errors.
-
-Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -246,6 +246,8 @@ err_dma_head:
- err_drop:
-       dev_kfree_skb(skb);
-+      net_dev->stats.tx_dropped++;
-+      net_dev->stats.tx_errors++;
-       return NETDEV_TX_OK;
- }
-@@ -285,6 +287,8 @@ static void bgmac_dma_tx_free(struct bgm
-                                      DMA_TO_DEVICE);
-               if (slot->skb) {
-+                      bgmac->net_dev->stats.tx_bytes += slot->skb->len;
-+                      bgmac->net_dev->stats.tx_packets++;
-                       bytes_compl += slot->skb->len;
-                       pkts_compl++;
-@@ -468,6 +472,7 @@ static int bgmac_dma_rx_read(struct bgma
-                               bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
-                                         ring->start);
-                               put_page(virt_to_head_page(buf));
-+                              bgmac->net_dev->stats.rx_errors++;
-                               break;
-                       }
-@@ -475,6 +480,8 @@ static int bgmac_dma_rx_read(struct bgma
-                               bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
-                                         ring->start);
-                               put_page(virt_to_head_page(buf));
-+                              bgmac->net_dev->stats.rx_length_errors++;
-+                              bgmac->net_dev->stats.rx_errors++;
-                               break;
-                       }
-@@ -485,6 +492,7 @@ static int bgmac_dma_rx_read(struct bgma
-                       if (unlikely(!skb)) {
-                               bgmac_err(bgmac, "build_skb failed\n");
-                               put_page(virt_to_head_page(buf));
-+                              bgmac->net_dev->stats.rx_errors++;
-                               break;
-                       }
-                       skb_put(skb, BGMAC_RX_FRAME_OFFSET +
-@@ -494,6 +502,8 @@ static int bgmac_dma_rx_read(struct bgma
-                       skb_checksum_none_assert(skb);
-                       skb->protocol = eth_type_trans(skb, bgmac->net_dev);
-+                      bgmac->net_dev->stats.rx_bytes += len;
-+                      bgmac->net_dev->stats.rx_packets++;
-                       napi_gro_receive(&bgmac->napi, skb);
-                       handled++;
-               } while (0);
diff --git a/target/linux/generic/patches-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch b/target/linux/generic/patches-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch
deleted file mode 100644 (file)
index 7ce6a09..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-From b21fcb259313bcf7d4f73ecd5e44948995c8957c Mon Sep 17 00:00:00 2001
-From: Philippe Reynes <tremyfr@gmail.com>
-Date: Sun, 19 Jun 2016 22:37:05 +0200
-Subject: [PATCH 1/2] net: ethernet: bgmac: use phydev from struct net_device
-
-The private structure contain a pointer to phydev, but the structure
-net_device already contain such pointer. So we can remove the pointer
-phydev in the private structure, and update the driver to use the
-one contained in struct net_device.
-
-Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 17 ++++++-----------
- drivers/net/ethernet/broadcom/bgmac.h |  1 -
- 2 files changed, 6 insertions(+), 12 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1324,7 +1324,7 @@ static int bgmac_open(struct net_device
-       }
-       napi_enable(&bgmac->napi);
--      phy_start(bgmac->phy_dev);
-+      phy_start(net_dev->phydev);
-       netif_start_queue(net_dev);
-@@ -1337,7 +1337,7 @@ static int bgmac_stop(struct net_device
-       netif_carrier_off(net_dev);
--      phy_stop(bgmac->phy_dev);
-+      phy_stop(net_dev->phydev);
-       napi_disable(&bgmac->napi);
-       bgmac_chip_intrs_off(bgmac);
-@@ -1375,12 +1375,10 @@ static int bgmac_set_mac_address(struct
- static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
- {
--      struct bgmac *bgmac = netdev_priv(net_dev);
--
-       if (!netif_running(net_dev))
-               return -EINVAL;
--      return phy_mii_ioctl(bgmac->phy_dev, ifr, cmd);
-+      return phy_mii_ioctl(net_dev->phydev, ifr, cmd);
- }
- static const struct net_device_ops bgmac_netdev_ops = {
-@@ -1523,7 +1521,7 @@ static int bgmac_get_settings(struct net
- {
-       struct bgmac *bgmac = netdev_priv(net_dev);
--      return phy_ethtool_gset(bgmac->phy_dev, cmd);
-+      return phy_ethtool_gset(net_dev->phydev, cmd);
- }
- static int bgmac_set_settings(struct net_device *net_dev,
-@@ -1531,7 +1529,7 @@ static int bgmac_set_settings(struct net
- {
-       struct bgmac *bgmac = netdev_priv(net_dev);
--      return phy_ethtool_sset(bgmac->phy_dev, cmd);
-+      return phy_ethtool_sset(net_dev->phydev, cmd);
- }
- static void bgmac_get_drvinfo(struct net_device *net_dev,
-@@ -1568,7 +1566,7 @@ static int bgmac_mii_write(struct mii_bu
- static void bgmac_adjust_link(struct net_device *net_dev)
- {
-       struct bgmac *bgmac = netdev_priv(net_dev);
--      struct phy_device *phy_dev = bgmac->phy_dev;
-+      struct phy_device *phy_dev = net_dev->phydev;
-       bool update = false;
-       if (phy_dev->link) {
-@@ -1612,8 +1610,6 @@ static int bgmac_fixed_phy_register(stru
-               return err;
-       }
--      bgmac->phy_dev = phy_dev;
--
-       return err;
- }
-@@ -1666,7 +1662,6 @@ static int bgmac_mii_register(struct bgm
-               err = PTR_ERR(phy_dev);
-               goto err_unregister_bus;
-       }
--      bgmac->phy_dev = phy_dev;
-       return err;
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -441,7 +441,6 @@ struct bgmac {
-       struct net_device *net_dev;
-       struct napi_struct napi;
-       struct mii_bus *mii_bus;
--      struct phy_device *phy_dev;
-       /* DMA */
-       struct bgmac_dma_ring tx_ring[BGMAC_MAX_TX_RINGS];
diff --git a/target/linux/generic/patches-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch b/target/linux/generic/patches-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch
deleted file mode 100644 (file)
index 3837b60..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-From d00a8281bcc962027dfe409c2f3e3f0546be9200 Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:53 -0400
-Subject: [PATCH 1/5] net: ethernet: bgmac: change bgmac_* prints to dev_*
- prints
-
-The bgmac_* print wrappers call dev_* prints with the dev pointer from
-the bcma core.  In anticipation of removing the bcma requirement for
-this driver, these must be changed to not reference that struct.  So,
-simply change all of the bgmac_* prints to their dev_* counterparts.  In
-some cases netdev_* prints are more appropriate, so change those as
-well.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 103 +++++++++++++++++-----------------
- drivers/net/ethernet/broadcom/bgmac.h |  14 +----
- 2 files changed, 55 insertions(+), 62 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -50,7 +50,7 @@ static bool bgmac_wait_value(struct bcma
-                       return true;
-               udelay(10);
-       }
--      pr_err("Timeout waiting for reg 0x%X\n", reg);
-+      dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg);
-       return false;
- }
-@@ -84,8 +84,8 @@ static void bgmac_dma_tx_reset(struct bg
-               udelay(10);
-       }
-       if (i)
--              bgmac_err(bgmac, "Timeout suspending DMA TX ring 0x%X (BGMAC_DMA_TX_STAT: 0x%08X)\n",
--                        ring->mmio_base, val);
-+              dev_err(bgmac->dev, "Timeout suspending DMA TX ring 0x%X (BGMAC_DMA_TX_STAT: 0x%08X)\n",
-+                      ring->mmio_base, val);
-       /* Remove SUSPEND bit */
-       bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, 0);
-@@ -93,13 +93,13 @@ static void bgmac_dma_tx_reset(struct bg
-                             ring->mmio_base + BGMAC_DMA_TX_STATUS,
-                             BGMAC_DMA_TX_STAT, BGMAC_DMA_TX_STAT_DISABLED,
-                             10000)) {
--              bgmac_warn(bgmac, "DMA TX ring 0x%X wasn't disabled on time, waiting additional 300us\n",
--                         ring->mmio_base);
-+              dev_warn(bgmac->dev, "DMA TX ring 0x%X wasn't disabled on time, waiting additional 300us\n",
-+                       ring->mmio_base);
-               udelay(300);
-               val = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS);
-               if ((val & BGMAC_DMA_TX_STAT) != BGMAC_DMA_TX_STAT_DISABLED)
--                      bgmac_err(bgmac, "Reset of DMA TX ring 0x%X failed\n",
--                                ring->mmio_base);
-+                      dev_err(bgmac->dev, "Reset of DMA TX ring 0x%X failed\n",
-+                              ring->mmio_base);
-       }
- }
-@@ -161,7 +161,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
-       int i;
-       if (skb->len > BGMAC_DESC_CTL1_LEN) {
--              bgmac_err(bgmac, "Too long skb (%d)\n", skb->len);
-+              netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len);
-               goto err_drop;
-       }
-@@ -174,7 +174,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
-        * even when ring->end overflows
-        */
-       if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) {
--              bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n");
-+              netdev_err(bgmac->net_dev, "TX ring is full, queue should be stopped!\n");
-               netif_stop_queue(net_dev);
-               return NETDEV_TX_BUSY;
-       }
-@@ -241,8 +241,8 @@ err_dma:
-       }
- err_dma_head:
--      bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n",
--                ring->mmio_base);
-+      netdev_err(bgmac->net_dev, "Mapping error of skb on ring 0x%X\n",
-+                 ring->mmio_base);
- err_drop:
-       dev_kfree_skb(skb);
-@@ -321,8 +321,8 @@ static void bgmac_dma_rx_reset(struct bg
-                             ring->mmio_base + BGMAC_DMA_RX_STATUS,
-                             BGMAC_DMA_RX_STAT, BGMAC_DMA_RX_STAT_DISABLED,
-                             10000))
--              bgmac_err(bgmac, "Reset of ring 0x%X RX failed\n",
--                        ring->mmio_base);
-+              dev_err(bgmac->dev, "Reset of ring 0x%X RX failed\n",
-+                      ring->mmio_base);
- }
- static void bgmac_dma_rx_enable(struct bgmac *bgmac,
-@@ -374,7 +374,7 @@ static int bgmac_dma_rx_skb_for_slot(str
-       dma_addr = dma_map_single(dma_dev, buf + BGMAC_RX_BUF_OFFSET,
-                                 BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE);
-       if (dma_mapping_error(dma_dev, dma_addr)) {
--              bgmac_err(bgmac, "DMA mapping error\n");
-+              netdev_err(bgmac->net_dev, "DMA mapping error\n");
-               put_page(virt_to_head_page(buf));
-               return -ENOMEM;
-       }
-@@ -469,16 +469,16 @@ static int bgmac_dma_rx_read(struct bgma
-                       /* Check for poison and drop or pass the packet */
-                       if (len == 0xdead && flags == 0xbeef) {
--                              bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
--                                        ring->start);
-+                              netdev_err(bgmac->net_dev, "Found poisoned packet at slot %d, DMA issue!\n",
-+                                         ring->start);
-                               put_page(virt_to_head_page(buf));
-                               bgmac->net_dev->stats.rx_errors++;
-                               break;
-                       }
-                       if (len > BGMAC_RX_ALLOC_SIZE) {
--                              bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
--                                        ring->start);
-+                              netdev_err(bgmac->net_dev, "Found oversized packet at slot %d, DMA issue!\n",
-+                                         ring->start);
-                               put_page(virt_to_head_page(buf));
-                               bgmac->net_dev->stats.rx_length_errors++;
-                               bgmac->net_dev->stats.rx_errors++;
-@@ -490,7 +490,7 @@ static int bgmac_dma_rx_read(struct bgma
-                       skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE);
-                       if (unlikely(!skb)) {
--                              bgmac_err(bgmac, "build_skb failed\n");
-+                              netdev_err(bgmac->net_dev, "build_skb failed\n");
-                               put_page(virt_to_head_page(buf));
-                               bgmac->net_dev->stats.rx_errors++;
-                               break;
-@@ -644,7 +644,7 @@ static int bgmac_dma_alloc(struct bgmac
-       BUILD_BUG_ON(BGMAC_MAX_RX_RINGS > ARRAY_SIZE(ring_base));
-       if (!(bcma_aread32(bgmac->core, BCMA_IOST) & BCMA_IOST_DMA64)) {
--              bgmac_err(bgmac, "Core does not report 64-bit DMA\n");
-+              dev_err(bgmac->dev, "Core does not report 64-bit DMA\n");
-               return -ENOTSUPP;
-       }
-@@ -658,8 +658,8 @@ static int bgmac_dma_alloc(struct bgmac
-                                                    &ring->dma_base,
-                                                    GFP_KERNEL);
-               if (!ring->cpu_base) {
--                      bgmac_err(bgmac, "Allocation of TX ring 0x%X failed\n",
--                                ring->mmio_base);
-+                      dev_err(bgmac->dev, "Allocation of TX ring 0x%X failed\n",
-+                              ring->mmio_base);
-                       goto err_dma_free;
-               }
-@@ -683,8 +683,8 @@ static int bgmac_dma_alloc(struct bgmac
-                                                    &ring->dma_base,
-                                                    GFP_KERNEL);
-               if (!ring->cpu_base) {
--                      bgmac_err(bgmac, "Allocation of RX ring 0x%X failed\n",
--                                ring->mmio_base);
-+                      dev_err(bgmac->dev, "Allocation of RX ring 0x%X failed\n",
-+                              ring->mmio_base);
-                       err = -ENOMEM;
-                       goto err_dma_free;
-               }
-@@ -803,8 +803,8 @@ static u16 bgmac_phy_read(struct bgmac *
-       bcma_write32(core, phy_access_addr, tmp);
-       if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
--              bgmac_err(bgmac, "Reading PHY %d register 0x%X failed\n",
--                        phyaddr, reg);
-+              dev_err(bgmac->dev, "Reading PHY %d register 0x%X failed\n",
-+                      phyaddr, reg);
-               return 0xffff;
-       }
-@@ -836,7 +836,7 @@ static int bgmac_phy_write(struct bgmac
-       bgmac_write(bgmac, BGMAC_INT_STATUS, BGMAC_IS_MDIO);
-       if (bgmac_read(bgmac, BGMAC_INT_STATUS) & BGMAC_IS_MDIO)
--              bgmac_warn(bgmac, "Error setting MDIO int\n");
-+              dev_warn(bgmac->dev, "Error setting MDIO int\n");
-       tmp = BGMAC_PA_START;
-       tmp |= BGMAC_PA_WRITE;
-@@ -846,8 +846,8 @@ static int bgmac_phy_write(struct bgmac
-       bcma_write32(core, phy_access_addr, tmp);
-       if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
--              bgmac_err(bgmac, "Writing to PHY %d register 0x%X failed\n",
--                        phyaddr, reg);
-+              dev_err(bgmac->dev, "Writing to PHY %d register 0x%X failed\n",
-+                      phyaddr, reg);
-               return -ETIMEDOUT;
-       }
-@@ -900,7 +900,7 @@ static void bgmac_phy_reset(struct bgmac
-       bgmac_phy_write(bgmac, bgmac->phyaddr, MII_BMCR, BMCR_RESET);
-       udelay(100);
-       if (bgmac_phy_read(bgmac, bgmac->phyaddr, MII_BMCR) & BMCR_RESET)
--              bgmac_err(bgmac, "PHY reset failed\n");
-+              dev_err(bgmac->dev, "PHY reset failed\n");
-       bgmac_phy_init(bgmac);
- }
-@@ -1001,7 +1001,8 @@ static void bgmac_mac_speed(struct bgmac
-               set |= BGMAC_CMDCFG_ES_2500;
-               break;
-       default:
--              bgmac_err(bgmac, "Unsupported speed: %d\n", bgmac->mac_speed);
-+              dev_err(bgmac->dev, "Unsupported speed: %d\n",
-+                      bgmac->mac_speed);
-       }
-       if (bgmac->mac_duplex == DUPLEX_HALF)
-@@ -1100,8 +1101,8 @@ static void bgmac_chip_reset(struct bgma
-               if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
-                       if (kstrtou8(buf, 0, &et_swtype))
--                              bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n",
--                                        buf);
-+                              dev_err(bgmac->dev, "Failed to parse et_swtype (%s)\n",
-+                                      buf);
-                       et_swtype &= 0x0f;
-                       et_swtype <<= 4;
-                       sw_type = et_swtype;
-@@ -1264,7 +1265,7 @@ static irqreturn_t bgmac_interrupt(int i
-       int_status &= ~(BGMAC_IS_TX0 | BGMAC_IS_RX);
-       if (int_status)
--              bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", int_status);
-+              dev_err(bgmac->dev, "Unknown IRQs: 0x%08X\n", int_status);
-       /* Disable new interrupts until handling existing ones */
-       bgmac_chip_intrs_off(bgmac);
-@@ -1318,7 +1319,7 @@ static int bgmac_open(struct net_device
-       err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED,
-                         KBUILD_MODNAME, net_dev);
-       if (err < 0) {
--              bgmac_err(bgmac, "IRQ request error: %d!\n", err);
-+              dev_err(bgmac->dev, "IRQ request error: %d!\n", err);
-               bgmac_dma_cleanup(bgmac);
-               return err;
-       }
-@@ -1599,14 +1600,14 @@ static int bgmac_fixed_phy_register(stru
-       phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, -1, NULL);
-       if (!phy_dev || IS_ERR(phy_dev)) {
--              bgmac_err(bgmac, "Failed to register fixed PHY device\n");
-+              dev_err(bgmac->dev, "Failed to register fixed PHY device\n");
-               return -ENODEV;
-       }
-       err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link,
-                                PHY_INTERFACE_MODE_MII);
-       if (err) {
--              bgmac_err(bgmac, "Connecting PHY failed\n");
-+              dev_err(bgmac->dev, "Connecting PHY failed\n");
-               return err;
-       }
-@@ -1646,7 +1647,7 @@ static int bgmac_mii_register(struct bgm
-       err = mdiobus_register(mii_bus);
-       if (err) {
--              bgmac_err(bgmac, "Registration of mii bus failed\n");
-+              dev_err(bgmac->dev, "Registration of mii bus failed\n");
-               goto err_free_irq;
-       }
-@@ -1658,7 +1659,7 @@ static int bgmac_mii_register(struct bgm
-       phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link,
-                             PHY_INTERFACE_MODE_MII);
-       if (IS_ERR(phy_dev)) {
--              bgmac_err(bgmac, "PHY connecton failed\n");
-+              dev_err(bgmac->dev, "PHY connecton failed\n");
-               err = PTR_ERR(phy_dev);
-               goto err_unregister_bus;
-       }
-@@ -1707,7 +1708,8 @@ static int bgmac_probe(struct bcma_devic
-               mac = sprom->et2mac;
-               break;
-       default:
--              pr_err("Unsupported core_unit %d\n", core->core_unit);
-+              dev_err(&core->dev, "Unsupported core_unit %d\n",
-+                      core->core_unit);
-               return -ENOTSUPP;
-       }
-@@ -1730,6 +1732,7 @@ static int bgmac_probe(struct bcma_devic
-       net_dev->irq = core->irq;
-       net_dev->ethtool_ops = &bgmac_ethtool_ops;
-       bgmac = netdev_priv(net_dev);
-+      bgmac->dev = &core->dev;
-       bgmac->net_dev = net_dev;
-       bgmac->core = core;
-       bcma_set_drvdata(core, bgmac);
-@@ -1741,7 +1744,7 @@ static int bgmac_probe(struct bcma_devic
-       /* On BCM4706 we need common core to access PHY */
-       if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
-           !core->bus->drv_gmac_cmn.core) {
--              bgmac_err(bgmac, "GMAC CMN core not found (required for BCM4706)\n");
-+              dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n");
-               err = -ENODEV;
-               goto err_netdev_free;
-       }
-@@ -1760,15 +1763,15 @@ static int bgmac_probe(struct bcma_devic
-       }
-       bgmac->phyaddr &= BGMAC_PHY_MASK;
-       if (bgmac->phyaddr == BGMAC_PHY_MASK) {
--              bgmac_err(bgmac, "No PHY found\n");
-+              dev_err(bgmac->dev, "No PHY found\n");
-               err = -ENODEV;
-               goto err_netdev_free;
-       }
--      bgmac_info(bgmac, "Found PHY addr: %d%s\n", bgmac->phyaddr,
--                 bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
-+      dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
-+               bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
-       if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
--              bgmac_err(bgmac, "PCI setup not implemented\n");
-+              dev_err(bgmac->dev, "PCI setup not implemented\n");
-               err = -ENOTSUPP;
-               goto err_netdev_free;
-       }
-@@ -1797,7 +1800,7 @@ static int bgmac_probe(struct bcma_devic
-       err = bgmac_dma_alloc(bgmac);
-       if (err) {
--              bgmac_err(bgmac, "Unable to alloc memory for DMA\n");
-+              dev_err(bgmac->dev, "Unable to alloc memory for DMA\n");
-               goto err_netdev_free;
-       }
-@@ -1811,16 +1814,16 @@ static int bgmac_probe(struct bcma_devic
-       bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
-                              BGMAC_BFL_ENETROBO);
-       if (bgmac->has_robosw)
--              bgmac_warn(bgmac, "Support for Roboswitch not implemented\n");
-+              dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n");
-       if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM)
--              bgmac_warn(bgmac, "Support for ADMtek ethernet switch not implemented\n");
-+              dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n");
-       netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT);
-       err = bgmac_mii_register(bgmac);
-       if (err) {
--              bgmac_err(bgmac, "Cannot register MDIO\n");
-+              dev_err(bgmac->dev, "Cannot connect to phy\n");
-               goto err_dma_free;
-       }
-@@ -1830,7 +1833,7 @@ static int bgmac_probe(struct bcma_devic
-       err = register_netdev(bgmac->net_dev);
-       if (err) {
--              bgmac_err(bgmac, "Cannot register net device\n");
-+              dev_err(bgmac->dev, "Cannot register net device\n");
-               goto err_mii_unregister;
-       }
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -1,17 +1,6 @@
- #ifndef _BGMAC_H
- #define _BGMAC_H
--#define pr_fmt(fmt)           KBUILD_MODNAME ": " fmt
--
--#define bgmac_err(bgmac, fmt, ...) \
--      dev_err(&(bgmac)->core->dev, fmt, ##__VA_ARGS__)
--#define bgmac_warn(bgmac, fmt, ...) \
--      dev_warn(&(bgmac)->core->dev, fmt,  ##__VA_ARGS__)
--#define bgmac_info(bgmac, fmt, ...) \
--      dev_info(&(bgmac)->core->dev, fmt,  ##__VA_ARGS__)
--#define bgmac_dbg(bgmac, fmt, ...) \
--      dev_dbg(&(bgmac)->core->dev, fmt, ##__VA_ARGS__)
--
- #include <linux/bcma/bcma.h>
- #include <linux/brcmphy.h>
- #include <linux/netdevice.h>
-@@ -438,6 +427,8 @@ struct bgmac_rx_header {
- struct bgmac {
-       struct bcma_device *core;
-       struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
-+
-+      struct device *dev;
-       struct net_device *net_dev;
-       struct napi_struct napi;
-       struct mii_bus *mii_bus;
-@@ -489,5 +480,4 @@ static inline void bgmac_set(struct bgma
- {
-       bgmac_maskset(bgmac, offset, ~0, set);
- }
--
- #endif /* _BGMAC_H */
diff --git a/target/linux/generic/patches-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch b/target/linux/generic/patches-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch
deleted file mode 100644 (file)
index dd5b877..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-From a0b68486f6f680c7c0352a47c60042d7d95ffd87 Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:54 -0400
-Subject: [PATCH 2/5] net: ethernet: bgmac: add dma_dev pointer
-
-The dma buffer allocation, etc references a dma_dev device pointer from
-the bcma core.  In anticipation of removing the bcma requirement for
-this driver, these must be changed to not reference that struct.  Add a
-dma_dev device pointer to the bgmac stuct and reference that instead.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 17 +++++++++--------
- drivers/net/ethernet/broadcom/bgmac.h |  1 +
- 2 files changed, 10 insertions(+), 8 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -152,7 +152,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
-                                   struct bgmac_dma_ring *ring,
-                                   struct sk_buff *skb)
- {
--      struct device *dma_dev = bgmac->core->dma_dev;
-+      struct device *dma_dev = bgmac->dma_dev;
-       struct net_device *net_dev = bgmac->net_dev;
-       int index = ring->end % BGMAC_TX_RING_SLOTS;
-       struct bgmac_slot_info *slot = &ring->slots[index];
-@@ -254,7 +254,7 @@ err_drop:
- /* Free transmitted packets */
- static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
- {
--      struct device *dma_dev = bgmac->core->dma_dev;
-+      struct device *dma_dev = bgmac->dma_dev;
-       int empty_slot;
-       bool freed = false;
-       unsigned bytes_compl = 0, pkts_compl = 0;
-@@ -355,7 +355,7 @@ static void bgmac_dma_rx_enable(struct b
- static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac,
-                                    struct bgmac_slot_info *slot)
- {
--      struct device *dma_dev = bgmac->core->dma_dev;
-+      struct device *dma_dev = bgmac->dma_dev;
-       dma_addr_t dma_addr;
-       struct bgmac_rx_header *rx;
-       void *buf;
-@@ -444,7 +444,7 @@ static int bgmac_dma_rx_read(struct bgma
-       end_slot /= sizeof(struct bgmac_dma_desc);
-       while (ring->start != end_slot) {
--              struct device *dma_dev = bgmac->core->dma_dev;
-+              struct device *dma_dev = bgmac->dma_dev;
-               struct bgmac_slot_info *slot = &ring->slots[ring->start];
-               struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET;
-               struct sk_buff *skb;
-@@ -547,7 +547,7 @@ static bool bgmac_dma_unaligned(struct b
- static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
-                                  struct bgmac_dma_ring *ring)
- {
--      struct device *dma_dev = bgmac->core->dma_dev;
-+      struct device *dma_dev = bgmac->dma_dev;
-       struct bgmac_dma_desc *dma_desc = ring->cpu_base;
-       struct bgmac_slot_info *slot;
-       int i;
-@@ -573,7 +573,7 @@ static void bgmac_dma_tx_ring_free(struc
- static void bgmac_dma_rx_ring_free(struct bgmac *bgmac,
-                                  struct bgmac_dma_ring *ring)
- {
--      struct device *dma_dev = bgmac->core->dma_dev;
-+      struct device *dma_dev = bgmac->dma_dev;
-       struct bgmac_slot_info *slot;
-       int i;
-@@ -594,7 +594,7 @@ static void bgmac_dma_ring_desc_free(str
-                                    struct bgmac_dma_ring *ring,
-                                    int num_slots)
- {
--      struct device *dma_dev = bgmac->core->dma_dev;
-+      struct device *dma_dev = bgmac->dma_dev;
-       int size;
-       if (!ring->cpu_base)
-@@ -632,7 +632,7 @@ static void bgmac_dma_free(struct bgmac
- static int bgmac_dma_alloc(struct bgmac *bgmac)
- {
--      struct device *dma_dev = bgmac->core->dma_dev;
-+      struct device *dma_dev = bgmac->dma_dev;
-       struct bgmac_dma_ring *ring;
-       static const u16 ring_base[] = { BGMAC_DMA_BASE0, BGMAC_DMA_BASE1,
-                                        BGMAC_DMA_BASE2, BGMAC_DMA_BASE3, };
-@@ -1733,6 +1733,7 @@ static int bgmac_probe(struct bcma_devic
-       net_dev->ethtool_ops = &bgmac_ethtool_ops;
-       bgmac = netdev_priv(net_dev);
-       bgmac->dev = &core->dev;
-+      bgmac->dma_dev = core->dma_dev;
-       bgmac->net_dev = net_dev;
-       bgmac->core = core;
-       bcma_set_drvdata(core, bgmac);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -429,6 +429,7 @@ struct bgmac {
-       struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
-       struct device *dev;
-+      struct device *dma_dev;
-       struct net_device *net_dev;
-       struct napi_struct napi;
-       struct mii_bus *mii_bus;
diff --git a/target/linux/generic/patches-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch b/target/linux/generic/patches-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch
deleted file mode 100644 (file)
index bc7b246..0000000
+++ /dev/null
@@ -1,676 +0,0 @@
-From 55954f3bfdacc5908515b0c306cea23e77fab740 Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:55 -0400
-Subject: [PATCH 3/5] net: ethernet: bgmac: move BCMA MDIO Phy code into a
- separate file
-
-Move the BCMA MDIO phy into a separate file, as it is very tightly
-coupled with the BCMA bus.  This will help with the upcoming BCMA
-removal from the bgmac driver.  Optimally, this should be moved into
-phy drivers, but it is too tightly coupled with the bgmac driver to
-effectively move it without more changes to the driver.
-
-Note: the phy_reset was intentionally removed, as the mdio phy subsystem
-automatically resets the phy if a reset function pointer is present.  In
-addition to the moving of the driver, this reset function is added.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/Makefile          |   2 +-
- drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 264 ++++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.c           | 246 +++-------------------
- drivers/net/ethernet/broadcom/bgmac.h           |   3 +
- 4 files changed, 298 insertions(+), 217 deletions(-)
- create mode 100644 drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
-
---- a/drivers/net/ethernet/broadcom/Makefile
-+++ b/drivers/net/ethernet/broadcom/Makefile
-@@ -10,6 +10,6 @@ obj-$(CONFIG_CNIC) += cnic.o
- obj-$(CONFIG_BNX2X) += bnx2x/
- obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o
- obj-$(CONFIG_TIGON3) += tg3.o
--obj-$(CONFIG_BGMAC) += bgmac.o
-+obj-$(CONFIG_BGMAC) += bgmac.o bgmac-bcma-mdio.o
- obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o
- obj-$(CONFIG_BNXT) += bnxt/
---- /dev/null
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
-@@ -0,0 +1,275 @@
-+/*
-+ * Driver for (BCM4706)? GBit MAC core on BCMA bus.
-+ *
-+ * Copyright (C) 2012 RafaÅ‚ MiÅ‚ecki <zajec5@gmail.com>
-+ *
-+ * Licensed under the GNU/GPL. See COPYING for details.
-+ */
-+
-+#define pr_fmt(fmt)           KBUILD_MODNAME ": " fmt
-+
-+#include <linux/bcma/bcma.h>
-+#include <linux/brcmphy.h>
-+#include "bgmac.h"
-+
-+struct bcma_mdio {
-+      struct bcma_device *core;
-+      u8 phyaddr;
-+};
-+
-+static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask,
-+                               u32 value, int timeout)
-+{
-+      u32 val;
-+      int i;
-+
-+      for (i = 0; i < timeout / 10; i++) {
-+              val = bcma_read32(core, reg);
-+              if ((val & mask) == value)
-+                      return true;
-+              udelay(10);
-+      }
-+      dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg);
-+      return false;
-+}
-+
-+/**************************************************
-+ * PHY ops
-+ **************************************************/
-+
-+static u16 bcma_mdio_phy_read(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg)
-+{
-+      struct bcma_device *core;
-+      u16 phy_access_addr;
-+      u16 phy_ctl_addr;
-+      u32 tmp;
-+
-+      BUILD_BUG_ON(BGMAC_PA_DATA_MASK != BCMA_GMAC_CMN_PA_DATA_MASK);
-+      BUILD_BUG_ON(BGMAC_PA_ADDR_MASK != BCMA_GMAC_CMN_PA_ADDR_MASK);
-+      BUILD_BUG_ON(BGMAC_PA_ADDR_SHIFT != BCMA_GMAC_CMN_PA_ADDR_SHIFT);
-+      BUILD_BUG_ON(BGMAC_PA_REG_MASK != BCMA_GMAC_CMN_PA_REG_MASK);
-+      BUILD_BUG_ON(BGMAC_PA_REG_SHIFT != BCMA_GMAC_CMN_PA_REG_SHIFT);
-+      BUILD_BUG_ON(BGMAC_PA_WRITE != BCMA_GMAC_CMN_PA_WRITE);
-+      BUILD_BUG_ON(BGMAC_PA_START != BCMA_GMAC_CMN_PA_START);
-+      BUILD_BUG_ON(BGMAC_PC_EPA_MASK != BCMA_GMAC_CMN_PC_EPA_MASK);
-+      BUILD_BUG_ON(BGMAC_PC_MCT_MASK != BCMA_GMAC_CMN_PC_MCT_MASK);
-+      BUILD_BUG_ON(BGMAC_PC_MCT_SHIFT != BCMA_GMAC_CMN_PC_MCT_SHIFT);
-+      BUILD_BUG_ON(BGMAC_PC_MTE != BCMA_GMAC_CMN_PC_MTE);
-+
-+      if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) {
-+              core = bcma_mdio->core->bus->drv_gmac_cmn.core;
-+              phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS;
-+              phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL;
-+      } else {
-+              core = bcma_mdio->core;
-+              phy_access_addr = BGMAC_PHY_ACCESS;
-+              phy_ctl_addr = BGMAC_PHY_CNTL;
-+      }
-+
-+      tmp = bcma_read32(core, phy_ctl_addr);
-+      tmp &= ~BGMAC_PC_EPA_MASK;
-+      tmp |= phyaddr;
-+      bcma_write32(core, phy_ctl_addr, tmp);
-+
-+      tmp = BGMAC_PA_START;
-+      tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT;
-+      tmp |= reg << BGMAC_PA_REG_SHIFT;
-+      bcma_write32(core, phy_access_addr, tmp);
-+
-+      if (!bcma_mdio_wait_value(core, phy_access_addr, BGMAC_PA_START, 0,
-+                                1000)) {
-+              dev_err(&core->dev, "Reading PHY %d register 0x%X failed\n",
-+                      phyaddr, reg);
-+              return 0xffff;
-+      }
-+
-+      return bcma_read32(core, phy_access_addr) & BGMAC_PA_DATA_MASK;
-+}
-+
-+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */
-+static int bcma_mdio_phy_write(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg,
-+                             u16 value)
-+{
-+      struct bcma_device *core;
-+      u16 phy_access_addr;
-+      u16 phy_ctl_addr;
-+      u32 tmp;
-+
-+      if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) {
-+              core = bcma_mdio->core->bus->drv_gmac_cmn.core;
-+              phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS;
-+              phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL;
-+      } else {
-+              core = bcma_mdio->core;
-+              phy_access_addr = BGMAC_PHY_ACCESS;
-+              phy_ctl_addr = BGMAC_PHY_CNTL;
-+      }
-+
-+      tmp = bcma_read32(core, phy_ctl_addr);
-+      tmp &= ~BGMAC_PC_EPA_MASK;
-+      tmp |= phyaddr;
-+      bcma_write32(core, phy_ctl_addr, tmp);
-+
-+      bcma_write32(bcma_mdio->core, BGMAC_INT_STATUS, BGMAC_IS_MDIO);
-+      if (bcma_read32(bcma_mdio->core, BGMAC_INT_STATUS) & BGMAC_IS_MDIO)
-+              dev_warn(&core->dev, "Error setting MDIO int\n");
-+
-+      tmp = BGMAC_PA_START;
-+      tmp |= BGMAC_PA_WRITE;
-+      tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT;
-+      tmp |= reg << BGMAC_PA_REG_SHIFT;
-+      tmp |= value;
-+      bcma_write32(core, phy_access_addr, tmp);
-+
-+      if (!bcma_mdio_wait_value(core, phy_access_addr, BGMAC_PA_START, 0,
-+                                1000)) {
-+              dev_err(&core->dev, "Writing to PHY %d register 0x%X failed\n",
-+                      phyaddr, reg);
-+              return -ETIMEDOUT;
-+      }
-+
-+      return 0;
-+}
-+
-+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyinit */
-+static void bcma_mdio_phy_init(struct bcma_mdio *bcma_mdio)
-+{
-+      struct bcma_chipinfo *ci = &bcma_mdio->core->bus->chipinfo;
-+      u8 i;
-+
-+      if (ci->id == BCMA_CHIP_ID_BCM5356) {
-+              for (i = 0; i < 5; i++) {
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x008b);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x15, 0x0100);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x12, 0x2aaa);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b);
-+              }
-+      }
-+      if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) ||
-+          (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) ||
-+          (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg != 9)) {
-+              struct bcma_drv_cc *cc = &bcma_mdio->core->bus->drv_cc;
-+
-+              bcma_chipco_chipctl_maskset(cc, 2, ~0xc0000000, 0);
-+              bcma_chipco_chipctl_maskset(cc, 4, ~0x80000000, 0);
-+              for (i = 0; i < 5; i++) {
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5284);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x0010);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5296);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x1073);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9073);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x52b6);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9273);
-+                      bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b);
-+              }
-+      }
-+}
-+
-+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */
-+static int bcma_mdio_phy_reset(struct mii_bus *bus)
-+{
-+      struct bcma_mdio *bcma_mdio = bus->priv;
-+      u8 phyaddr = bcma_mdio->phyaddr;
-+
-+      if (bcma_mdio->phyaddr == BGMAC_PHY_NOREGS)
-+              return 0;
-+
-+      bcma_mdio_phy_write(bcma_mdio, phyaddr, MII_BMCR, BMCR_RESET);
-+      udelay(100);
-+      if (bcma_mdio_phy_read(bcma_mdio, phyaddr, MII_BMCR) & BMCR_RESET)
-+              dev_err(&bcma_mdio->core->dev, "PHY reset failed\n");
-+      bcma_mdio_phy_init(bcma_mdio);
-+
-+      return 0;
-+}
-+
-+/**************************************************
-+ * MII
-+ **************************************************/
-+
-+static int bcma_mdio_mii_read(struct mii_bus *bus, int mii_id, int regnum)
-+{
-+      return bcma_mdio_phy_read(bus->priv, mii_id, regnum);
-+}
-+
-+static int bcma_mdio_mii_write(struct mii_bus *bus, int mii_id, int regnum,
-+                             u16 value)
-+{
-+      return bcma_mdio_phy_write(bus->priv, mii_id, regnum, value);
-+}
-+
-+struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr)
-+{
-+      struct bcma_mdio *bcma_mdio;
-+      struct mii_bus *mii_bus;
-+      int i, err;
-+
-+      bcma_mdio = kzalloc(sizeof(*bcma_mdio), GFP_KERNEL);
-+      if (!bcma_mdio)
-+              return ERR_PTR(-ENOMEM);
-+
-+      mii_bus = mdiobus_alloc();
-+      if (!mii_bus) {
-+              err = -ENOMEM;
-+              goto err;
-+      }
-+
-+      mii_bus->name = "bcma_mdio mii bus";
-+      sprintf(mii_bus->id, "%s-%d-%d", "bcma_mdio", core->bus->num,
-+              core->core_unit);
-+      mii_bus->priv = bcma_mdio;
-+      mii_bus->read = bcma_mdio_mii_read;
-+      mii_bus->write = bcma_mdio_mii_write;
-+      mii_bus->reset = bcma_mdio_phy_reset;
-+      mii_bus->parent = &core->dev;
-+      mii_bus->phy_mask = ~(1 << phyaddr);
-+ 
-+      mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
-+      if (!mii_bus->irq) {
-+              err = -ENOMEM;
-+              goto err_free_bus;
-+      }
-+      for (i = 0; i < PHY_MAX_ADDR; i++)
-+              mii_bus->irq[i] = PHY_POLL;
-+
-+      bcma_mdio->core = core;
-+      bcma_mdio->phyaddr = phyaddr;
-+
-+      err = mdiobus_register(mii_bus);
-+      if (err) {
-+              dev_err(&core->dev, "Registration of mii bus failed\n");
-+              goto err_free_irq;
-+      }
-+
-+      return mii_bus;
-+
-+err_free_irq:
-+      kfree(mii_bus->irq);
-+err_free_bus:
-+      mdiobus_free(mii_bus);
-+err:
-+      kfree(bcma_mdio);
-+      return ERR_PTR(err);
-+}
-+
-+void bcma_mdio_mii_unregister(struct mii_bus *mii_bus)
-+{
-+      struct bcma_mdio *bcma_mdio;
-+
-+      if (!mii_bus)
-+              return;
-+
-+      bcma_mdio = mii_bus->priv;
-+
-+      mdiobus_unregister(mii_bus);
-+      kfree(mii_bus->irq);
-+      mdiobus_free(mii_bus);
-+      kfree(bcma_mdio);
-+}
-+
-+MODULE_AUTHOR("RafaÅ‚ MiÅ‚ecki");
-+MODULE_LICENSE("GPL");
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -759,150 +759,6 @@ error:
-       return err;
- }
--/**************************************************
-- * PHY ops
-- **************************************************/
--
--static u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg)
--{
--      struct bcma_device *core;
--      u16 phy_access_addr;
--      u16 phy_ctl_addr;
--      u32 tmp;
--
--      BUILD_BUG_ON(BGMAC_PA_DATA_MASK != BCMA_GMAC_CMN_PA_DATA_MASK);
--      BUILD_BUG_ON(BGMAC_PA_ADDR_MASK != BCMA_GMAC_CMN_PA_ADDR_MASK);
--      BUILD_BUG_ON(BGMAC_PA_ADDR_SHIFT != BCMA_GMAC_CMN_PA_ADDR_SHIFT);
--      BUILD_BUG_ON(BGMAC_PA_REG_MASK != BCMA_GMAC_CMN_PA_REG_MASK);
--      BUILD_BUG_ON(BGMAC_PA_REG_SHIFT != BCMA_GMAC_CMN_PA_REG_SHIFT);
--      BUILD_BUG_ON(BGMAC_PA_WRITE != BCMA_GMAC_CMN_PA_WRITE);
--      BUILD_BUG_ON(BGMAC_PA_START != BCMA_GMAC_CMN_PA_START);
--      BUILD_BUG_ON(BGMAC_PC_EPA_MASK != BCMA_GMAC_CMN_PC_EPA_MASK);
--      BUILD_BUG_ON(BGMAC_PC_MCT_MASK != BCMA_GMAC_CMN_PC_MCT_MASK);
--      BUILD_BUG_ON(BGMAC_PC_MCT_SHIFT != BCMA_GMAC_CMN_PC_MCT_SHIFT);
--      BUILD_BUG_ON(BGMAC_PC_MTE != BCMA_GMAC_CMN_PC_MTE);
--
--      if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT) {
--              core = bgmac->core->bus->drv_gmac_cmn.core;
--              phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS;
--              phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL;
--      } else {
--              core = bgmac->core;
--              phy_access_addr = BGMAC_PHY_ACCESS;
--              phy_ctl_addr = BGMAC_PHY_CNTL;
--      }
--
--      tmp = bcma_read32(core, phy_ctl_addr);
--      tmp &= ~BGMAC_PC_EPA_MASK;
--      tmp |= phyaddr;
--      bcma_write32(core, phy_ctl_addr, tmp);
--
--      tmp = BGMAC_PA_START;
--      tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT;
--      tmp |= reg << BGMAC_PA_REG_SHIFT;
--      bcma_write32(core, phy_access_addr, tmp);
--
--      if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
--              dev_err(bgmac->dev, "Reading PHY %d register 0x%X failed\n",
--                      phyaddr, reg);
--              return 0xffff;
--      }
--
--      return bcma_read32(core, phy_access_addr) & BGMAC_PA_DATA_MASK;
--}
--
--/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */
--static int bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value)
--{
--      struct bcma_device *core;
--      u16 phy_access_addr;
--      u16 phy_ctl_addr;
--      u32 tmp;
--
--      if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT) {
--              core = bgmac->core->bus->drv_gmac_cmn.core;
--              phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS;
--              phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL;
--      } else {
--              core = bgmac->core;
--              phy_access_addr = BGMAC_PHY_ACCESS;
--              phy_ctl_addr = BGMAC_PHY_CNTL;
--      }
--
--      tmp = bcma_read32(core, phy_ctl_addr);
--      tmp &= ~BGMAC_PC_EPA_MASK;
--      tmp |= phyaddr;
--      bcma_write32(core, phy_ctl_addr, tmp);
--
--      bgmac_write(bgmac, BGMAC_INT_STATUS, BGMAC_IS_MDIO);
--      if (bgmac_read(bgmac, BGMAC_INT_STATUS) & BGMAC_IS_MDIO)
--              dev_warn(bgmac->dev, "Error setting MDIO int\n");
--
--      tmp = BGMAC_PA_START;
--      tmp |= BGMAC_PA_WRITE;
--      tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT;
--      tmp |= reg << BGMAC_PA_REG_SHIFT;
--      tmp |= value;
--      bcma_write32(core, phy_access_addr, tmp);
--
--      if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
--              dev_err(bgmac->dev, "Writing to PHY %d register 0x%X failed\n",
--                      phyaddr, reg);
--              return -ETIMEDOUT;
--      }
--
--      return 0;
--}
--
--/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyinit */
--static void bgmac_phy_init(struct bgmac *bgmac)
--{
--      struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
--      struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc;
--      u8 i;
--
--      if (ci->id == BCMA_CHIP_ID_BCM5356) {
--              for (i = 0; i < 5; i++) {
--                      bgmac_phy_write(bgmac, i, 0x1f, 0x008b);
--                      bgmac_phy_write(bgmac, i, 0x15, 0x0100);
--                      bgmac_phy_write(bgmac, i, 0x1f, 0x000f);
--                      bgmac_phy_write(bgmac, i, 0x12, 0x2aaa);
--                      bgmac_phy_write(bgmac, i, 0x1f, 0x000b);
--              }
--      }
--      if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) ||
--          (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) ||
--          (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg != 9)) {
--              bcma_chipco_chipctl_maskset(cc, 2, ~0xc0000000, 0);
--              bcma_chipco_chipctl_maskset(cc, 4, ~0x80000000, 0);
--              for (i = 0; i < 5; i++) {
--                      bgmac_phy_write(bgmac, i, 0x1f, 0x000f);
--                      bgmac_phy_write(bgmac, i, 0x16, 0x5284);
--                      bgmac_phy_write(bgmac, i, 0x1f, 0x000b);
--                      bgmac_phy_write(bgmac, i, 0x17, 0x0010);
--                      bgmac_phy_write(bgmac, i, 0x1f, 0x000f);
--                      bgmac_phy_write(bgmac, i, 0x16, 0x5296);
--                      bgmac_phy_write(bgmac, i, 0x17, 0x1073);
--                      bgmac_phy_write(bgmac, i, 0x17, 0x9073);
--                      bgmac_phy_write(bgmac, i, 0x16, 0x52b6);
--                      bgmac_phy_write(bgmac, i, 0x17, 0x9273);
--                      bgmac_phy_write(bgmac, i, 0x1f, 0x000b);
--              }
--      }
--}
--
--/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */
--static void bgmac_phy_reset(struct bgmac *bgmac)
--{
--      if (bgmac->phyaddr == BGMAC_PHY_NOREGS)
--              return;
--
--      bgmac_phy_write(bgmac, bgmac->phyaddr, MII_BMCR, BMCR_RESET);
--      udelay(100);
--      if (bgmac_phy_read(bgmac, bgmac->phyaddr, MII_BMCR) & BMCR_RESET)
--              dev_err(bgmac->dev, "PHY reset failed\n");
--      bgmac_phy_init(bgmac);
--}
- /**************************************************
-  * Chip ops
-@@ -1159,7 +1015,8 @@ static void bgmac_chip_reset(struct bgma
-       else
-               bgmac_set(bgmac, BGMAC_PHY_CNTL, BGMAC_PC_MTE);
-       bgmac_miiconfig(bgmac);
--      bgmac_phy_init(bgmac);
-+      if (bgmac->mii_bus)
-+              bgmac->mii_bus->reset(bgmac->mii_bus);
-       netdev_reset_queue(bgmac->net_dev);
- }
-@@ -1553,17 +1410,6 @@ static const struct ethtool_ops bgmac_et
-  * MII
-  **************************************************/
--static int bgmac_mii_read(struct mii_bus *bus, int mii_id, int regnum)
--{
--      return bgmac_phy_read(bus->priv, mii_id, regnum);
--}
--
--static int bgmac_mii_write(struct mii_bus *bus, int mii_id, int regnum,
--                         u16 value)
--{
--      return bgmac_phy_write(bus->priv, mii_id, regnum, value);
--}
--
- static void bgmac_adjust_link(struct net_device *net_dev)
- {
-       struct bgmac *bgmac = netdev_priv(net_dev);
-@@ -1588,7 +1434,7 @@ static void bgmac_adjust_link(struct net
-       }
- }
--static int bgmac_fixed_phy_register(struct bgmac *bgmac)
-+static int bgmac_phy_connect_direct(struct bgmac *bgmac)
- {
-       struct fixed_phy_status fphy_status = {
-               .link = 1,
-@@ -1614,81 +1460,24 @@ static int bgmac_fixed_phy_register(stru
-       return err;
- }
--static int bgmac_mii_register(struct bgmac *bgmac)
-+static int bgmac_phy_connect(struct bgmac *bgmac)
- {
--      struct mii_bus *mii_bus;
-       struct phy_device *phy_dev;
-       char bus_id[MII_BUS_ID_SIZE + 3];
--      int i, err = 0;
--
--      if (bgmac_is_bcm4707_family(bgmac))
--              return bgmac_fixed_phy_register(bgmac);
--
--      mii_bus = mdiobus_alloc();
--      if (!mii_bus)
--              return -ENOMEM;
--
--      mii_bus->name = "bgmac mii bus";
--      sprintf(mii_bus->id, "%s-%d-%d", "bgmac", bgmac->core->bus->num,
--              bgmac->core->core_unit);
--      mii_bus->priv = bgmac;
--      mii_bus->read = bgmac_mii_read;
--      mii_bus->write = bgmac_mii_write;
--      mii_bus->parent = &bgmac->core->dev;
--      mii_bus->phy_mask = ~(1 << bgmac->phyaddr);
--
--      mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
--      if (!mii_bus->irq) {
--              err = -ENOMEM;
--              goto err_free_bus;
--      }
--      for (i = 0; i < PHY_MAX_ADDR; i++)
--              mii_bus->irq[i] = PHY_POLL;
--
--      err = mdiobus_register(mii_bus);
--      if (err) {
--              dev_err(bgmac->dev, "Registration of mii bus failed\n");
--              goto err_free_irq;
--      }
--
--      bgmac->mii_bus = mii_bus;
-       /* Connect to the PHY */
--      snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, mii_bus->id,
-+      snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id,
-                bgmac->phyaddr);
-       phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link,
-                             PHY_INTERFACE_MODE_MII);
-       if (IS_ERR(phy_dev)) {
-               dev_err(bgmac->dev, "PHY connecton failed\n");
--              err = PTR_ERR(phy_dev);
--              goto err_unregister_bus;
-+              return PTR_ERR(phy_dev);
-       }
--      return err;
--
--err_unregister_bus:
--      mdiobus_unregister(mii_bus);
--err_free_irq:
--      kfree(mii_bus->irq);
--err_free_bus:
--      mdiobus_free(mii_bus);
--      return err;
--}
--
--static void bgmac_mii_unregister(struct bgmac *bgmac)
--{
--      struct mii_bus *mii_bus = bgmac->mii_bus;
--
--      mdiobus_unregister(mii_bus);
--      kfree(mii_bus->irq);
--      mdiobus_free(mii_bus);
-+      return 0;
- }
--/**************************************************
-- * BCMA bus ops
-- **************************************************/
--
--/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
- static int bgmac_probe(struct bcma_device *core)
- {
-       struct net_device *net_dev;
-@@ -1809,9 +1598,6 @@ static int bgmac_probe(struct bcma_devic
-       if (bcm47xx_nvram_getenv("et0_no_txint", NULL, 0) == 0)
-               bgmac->int_mask &= ~BGMAC_IS_TX_MASK;
--      /* TODO: reset the external phy. Specs are needed */
--      bgmac_phy_reset(bgmac);
--
-       bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
-                              BGMAC_BFL_ENETROBO);
-       if (bgmac->has_robosw)
-@@ -1822,10 +1608,25 @@ static int bgmac_probe(struct bcma_devic
-       netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT);
--      err = bgmac_mii_register(bgmac);
-+      if (!bgmac_is_bcm4707_family(bgmac)) {
-+              struct mii_bus *mii_bus;
-+
-+              mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
-+              if (!IS_ERR(mii_bus)) {
-+                      err = PTR_ERR(mii_bus);
-+                      goto err_dma_free;
-+              }
-+
-+              bgmac->mii_bus = mii_bus;
-+      }
-+
-+      if (!bgmac->mii_bus)
-+              err = bgmac_phy_connect_direct(bgmac);
-+      else
-+              err = bgmac_phy_connect(bgmac);
-       if (err) {
-               dev_err(bgmac->dev, "Cannot connect to phy\n");
--              goto err_dma_free;
-+              goto err_mii_unregister;
-       }
-       net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
-@@ -1835,18 +1636,19 @@ static int bgmac_probe(struct bcma_devic
-       err = register_netdev(bgmac->net_dev);
-       if (err) {
-               dev_err(bgmac->dev, "Cannot register net device\n");
--              goto err_mii_unregister;
-+              goto err_phy_disconnect;
-       }
-       netif_carrier_off(net_dev);
-       return 0;
-+err_phy_disconnect:
-+      phy_disconnect(net_dev->phydev);
- err_mii_unregister:
--      bgmac_mii_unregister(bgmac);
-+      bcma_mdio_mii_unregister(bgmac->mii_bus);
- err_dma_free:
-       bgmac_dma_free(bgmac);
--
- err_netdev_free:
-       bcma_set_drvdata(core, NULL);
-       free_netdev(net_dev);
-@@ -1859,7 +1661,8 @@ static void bgmac_remove(struct bcma_dev
-       struct bgmac *bgmac = bcma_get_drvdata(core);
-       unregister_netdev(bgmac->net_dev);
--      bgmac_mii_unregister(bgmac);
-+      phy_disconnect(bgmac->net_dev->phydev);
-+      bcma_mdio_mii_unregister(bgmac->mii_bus);
-       netif_napi_del(&bgmac->napi);
-       bgmac_dma_free(bgmac);
-       bcma_set_drvdata(core, NULL);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -456,6 +456,9 @@ struct bgmac {
-       bool loopback;
- };
-+struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr);
-+void bcma_mdio_mii_unregister(struct mii_bus *mii_bus);
-+
- static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset)
- {
-       return bcma_read32(bgmac->core, offset);
diff --git a/target/linux/generic/patches-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch b/target/linux/generic/patches-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch
deleted file mode 100644 (file)
index 0f62791..0000000
+++ /dev/null
@@ -1,384 +0,0 @@
-From db791eb2970bad193b1dc95a4461b222dd22cb64 Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:56 -0400
-Subject: [PATCH 4/5] net: ethernet: bgmac: convert to feature flags
-
-The bgmac driver is using the bcma provides device ID and revision, as
-well as the SoC ID and package, to determine which features are
-necessary to enable, reset, etc in the driver.   In anticipation of
-removing the bcma requirement for this driver, these must be changed to
-not reference that struct.  In place of that, each "feature" has been
-given a flag, and the flags are enabled for their respective device and
-SoC.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 167 ++++++++++++++++++++++++----------
- drivers/net/ethernet/broadcom/bgmac.h |  21 ++++-
- 2 files changed, 140 insertions(+), 48 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -109,7 +109,7 @@ static void bgmac_dma_tx_enable(struct b
-       u32 ctl;
-       ctl = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL);
--      if (bgmac->core->id.rev >= 4) {
-+      if (bgmac->feature_flags & BGMAC_FEAT_TX_MASK_SETUP) {
-               ctl &= ~BGMAC_DMA_TX_BL_MASK;
-               ctl |= BGMAC_DMA_TX_BL_128 << BGMAC_DMA_TX_BL_SHIFT;
-@@ -335,7 +335,7 @@ static void bgmac_dma_rx_enable(struct b
-       /* preserve ONLY bits 16-17 from current hardware value */
-       ctl &= BGMAC_DMA_RX_ADDREXT_MASK;
--      if (bgmac->core->id.rev >= 4) {
-+      if (bgmac->feature_flags & BGMAC_FEAT_RX_MASK_SETUP) {
-               ctl &= ~BGMAC_DMA_RX_BL_MASK;
-               ctl |= BGMAC_DMA_RX_BL_128 << BGMAC_DMA_RX_BL_SHIFT;
-@@ -772,14 +772,20 @@ static void bgmac_cmdcfg_maskset(struct
- {
-       u32 cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG);
-       u32 new_val = (cmdcfg & mask) | set;
-+      u32 cmdcfg_sr;
--      bgmac_set(bgmac, BGMAC_CMDCFG, BGMAC_CMDCFG_SR(bgmac->core->id.rev));
-+      if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4)
-+              cmdcfg_sr = BGMAC_CMDCFG_SR_REV4;
-+      else
-+              cmdcfg_sr = BGMAC_CMDCFG_SR_REV0;
-+
-+      bgmac_set(bgmac, BGMAC_CMDCFG, cmdcfg_sr);
-       udelay(2);
-       if (new_val != cmdcfg || force)
-               bgmac_write(bgmac, BGMAC_CMDCFG, new_val);
--      bgmac_mask(bgmac, BGMAC_CMDCFG, ~BGMAC_CMDCFG_SR(bgmac->core->id.rev));
-+      bgmac_mask(bgmac, BGMAC_CMDCFG, ~cmdcfg_sr);
-       udelay(2);
- }
-@@ -808,7 +814,7 @@ static void bgmac_chip_stats_update(stru
- {
-       int i;
--      if (bgmac->core->id.id != BCMA_CORE_4706_MAC_GBIT) {
-+      if (!(bgmac->feature_flags & BGMAC_FEAT_NO_CLR_MIB)) {
-               for (i = 0; i < BGMAC_NUM_MIB_TX_REGS; i++)
-                       bgmac->mib_tx_regs[i] =
-                               bgmac_read(bgmac,
-@@ -827,7 +833,7 @@ static void bgmac_clear_mib(struct bgmac
- {
-       int i;
--      if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT)
-+      if (bgmac->feature_flags & BGMAC_FEAT_NO_CLR_MIB)
-               return;
-       bgmac_set(bgmac, BGMAC_DEV_CTL, BGMAC_DC_MROR);
-@@ -870,9 +876,8 @@ static void bgmac_mac_speed(struct bgmac
- static void bgmac_miiconfig(struct bgmac *bgmac)
- {
-       struct bcma_device *core = bgmac->core;
--      u8 imode;
--      if (bgmac_is_bcm4707_family(bgmac)) {
-+      if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) {
-               bcma_awrite32(core, BCMA_IOCTL,
-                             bcma_aread32(core, BCMA_IOCTL) | 0x40 |
-                             BGMAC_BCMA_IOCTL_SW_CLKEN);
-@@ -880,6 +885,8 @@ static void bgmac_miiconfig(struct bgmac
-               bgmac->mac_duplex = DUPLEX_FULL;
-               bgmac_mac_speed(bgmac);
-       } else {
-+              u8 imode;
-+
-               imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) &
-                       BGMAC_DS_MM_MASK) >> BGMAC_DS_MM_SHIFT;
-               if (imode == 0 || imode == 1) {
-@@ -894,9 +901,7 @@ static void bgmac_miiconfig(struct bgmac
- static void bgmac_chip_reset(struct bgmac *bgmac)
- {
-       struct bcma_device *core = bgmac->core;
--      struct bcma_bus *bus = core->bus;
--      struct bcma_chipinfo *ci = &bus->chipinfo;
--      u32 flags;
-+      u32 cmdcfg_sr;
-       u32 iost;
-       int i;
-@@ -919,15 +924,12 @@ static void bgmac_chip_reset(struct bgma
-       }
-       iost = bcma_aread32(core, BCMA_IOST);
--      if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) ||
--          (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg == 10) ||
--          (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188))
-+      if (bgmac->feature_flags & BGMAC_FEAT_IOST_ATTACHED)
-               iost &= ~BGMAC_BCMA_IOST_ATTACHED;
-       /* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */
--      if (ci->id != BCMA_CHIP_ID_BCM4707 &&
--          ci->id != BCMA_CHIP_ID_BCM47094) {
--              flags = 0;
-+      if (!(bgmac->feature_flags & BGMAC_FEAT_NO_RESET)) {
-+              u32 flags = 0;
-               if (iost & BGMAC_BCMA_IOST_ATTACHED) {
-                       flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
-                       if (!bgmac->has_robosw)
-@@ -937,7 +939,7 @@ static void bgmac_chip_reset(struct bgma
-       }
-       /* Request Misc PLL for corerev > 2 */
--      if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) {
-+      if (bgmac->feature_flags & BGMAC_FEAT_MISC_PLL_REQ) {
-               bgmac_set(bgmac, BCMA_CLKCTLST,
-                         BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
-               bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
-@@ -946,9 +948,7 @@ static void bgmac_chip_reset(struct bgma
-                                1000);
-       }
--      if (ci->id == BCMA_CHIP_ID_BCM5357 ||
--          ci->id == BCMA_CHIP_ID_BCM4749 ||
--          ci->id == BCMA_CHIP_ID_BCM53572) {
-+      if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_PHY) {
-               struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc;
-               u8 et_swtype = 0;
-               u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY |
-@@ -962,11 +962,9 @@ static void bgmac_chip_reset(struct bgma
-                       et_swtype &= 0x0f;
-                       et_swtype <<= 4;
-                       sw_type = et_swtype;
--              } else if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM5358) {
-+              } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_EPHYRMII) {
-                       sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
--              } else if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) ||
--                         (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg == 10) ||
--                         (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188)) {
-+              } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_RGMII) {
-                       sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
-                                 BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
-               }
-@@ -986,6 +984,11 @@ static void bgmac_chip_reset(struct bgma
-        * BGMAC_CMDCFG is read _after_ putting chip in a reset. So it has to
-        * be keps until taking MAC out of the reset.
-        */
-+      if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4)
-+              cmdcfg_sr = BGMAC_CMDCFG_SR_REV4;
-+      else
-+              cmdcfg_sr = BGMAC_CMDCFG_SR_REV0;
-+
-       bgmac_cmdcfg_maskset(bgmac,
-                            ~(BGMAC_CMDCFG_TE |
-                              BGMAC_CMDCFG_RE |
-@@ -1003,13 +1006,13 @@ static void bgmac_chip_reset(struct bgma
-                            BGMAC_CMDCFG_PROM |
-                            BGMAC_CMDCFG_NLC |
-                            BGMAC_CMDCFG_CFE |
--                           BGMAC_CMDCFG_SR(core->id.rev),
-+                           cmdcfg_sr,
-                            false);
-       bgmac->mac_speed = SPEED_UNKNOWN;
-       bgmac->mac_duplex = DUPLEX_UNKNOWN;
-       bgmac_clear_mib(bgmac);
--      if (core->id.id == BCMA_CORE_4706_MAC_GBIT)
-+      if (bgmac->feature_flags & BGMAC_FEAT_CMN_PHY_CTL)
-               bcma_maskset32(bgmac->cmn, BCMA_GMAC_CMN_PHY_CTL, ~0,
-                              BCMA_GMAC_CMN_PC_MTE);
-       else
-@@ -1035,46 +1038,48 @@ static void bgmac_chip_intrs_off(struct
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_enable */
- static void bgmac_enable(struct bgmac *bgmac)
- {
--      struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
-+      u32 cmdcfg_sr;
-       u32 cmdcfg;
-       u32 mode;
--      u32 rxq_ctl;
--      u32 fl_ctl;
--      u16 bp_clk;
--      u8 mdp;
-+
-+      if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4)
-+              cmdcfg_sr = BGMAC_CMDCFG_SR_REV4;
-+      else
-+              cmdcfg_sr = BGMAC_CMDCFG_SR_REV0;
-       cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG);
-       bgmac_cmdcfg_maskset(bgmac, ~(BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE),
--                           BGMAC_CMDCFG_SR(bgmac->core->id.rev), true);
-+                           cmdcfg_sr, true);
-       udelay(2);
-       cmdcfg |= BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE;
-       bgmac_write(bgmac, BGMAC_CMDCFG, cmdcfg);
-       mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
-               BGMAC_DS_MM_SHIFT;
--      if (ci->id != BCMA_CHIP_ID_BCM47162 || mode != 0)
-+      if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0)
-               bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
--      if (ci->id == BCMA_CHIP_ID_BCM47162 && mode == 2)
-+      if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2)
-               bcma_chipco_chipctl_maskset(&bgmac->core->bus->drv_cc, 1, ~0,
-                                           BGMAC_CHIPCTL_1_RXC_DLL_BYPASS);
--      switch (ci->id) {
--      case BCMA_CHIP_ID_BCM5357:
--      case BCMA_CHIP_ID_BCM4749:
--      case BCMA_CHIP_ID_BCM53572:
--      case BCMA_CHIP_ID_BCM4716:
--      case BCMA_CHIP_ID_BCM47162:
--              fl_ctl = 0x03cb04cb;
--              if (ci->id == BCMA_CHIP_ID_BCM5357 ||
--                  ci->id == BCMA_CHIP_ID_BCM4749 ||
--                  ci->id == BCMA_CHIP_ID_BCM53572)
-+      if (bgmac->feature_flags & (BGMAC_FEAT_FLW_CTRL1 |
-+                                  BGMAC_FEAT_FLW_CTRL2)) {
-+              u32 fl_ctl;
-+
-+              if (bgmac->feature_flags & BGMAC_FEAT_FLW_CTRL1)
-                       fl_ctl = 0x2300e1;
-+              else
-+                      fl_ctl = 0x03cb04cb;
-+
-               bgmac_write(bgmac, BGMAC_FLOW_CTL_THRESH, fl_ctl);
-               bgmac_write(bgmac, BGMAC_PAUSE_CTL, 0x27fff);
--              break;
-       }
--      if (!bgmac_is_bcm4707_family(bgmac)) {
-+      if (bgmac->feature_flags & BGMAC_FEAT_SET_RXQ_CLK) {
-+              u32 rxq_ctl;
-+              u16 bp_clk;
-+              u8 mdp;
-+
-               rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
-               rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
-               bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) /
-@@ -1606,6 +1611,74 @@ static int bgmac_probe(struct bcma_devic
-       if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM)
-               dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n");
-+      /* Feature Flags */
-+      switch (core->bus->chipinfo.id) {
-+      case BCMA_CHIP_ID_BCM5357:
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+              }
-+              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358)
-+                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII;
-+              break;
-+      case BCMA_CHIP_ID_BCM53572:
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+              }
-+              break;
-+      case BCMA_CHIP_ID_BCM4749:
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+              if (core->bus->chipinfo.pkg == 10) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+              }
-+              break;
-+      case BCMA_CHIP_ID_BCM4716:
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              /* fallthrough */
-+      case BCMA_CHIP_ID_BCM47162:
-+              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2;
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              break;
-+      /* bcm4707_family */
-+      case BCMA_CHIP_ID_BCM4707:
-+      case BCMA_CHIP_ID_BCM47094:
-+      case BCMA_CHIP_ID_BCM53018:
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-+              bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-+              break;
-+      default:
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+      }
-+
-+      if (!bgmac_is_bcm4707_family(bgmac) && core->id.rev > 2)
-+              bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ;
-+
-+      if (core->id.id == BCMA_CORE_4706_MAC_GBIT) {
-+              bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL;
-+              bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB;
-+      }
-+
-+      if (core->id.rev >= 4) {
-+              bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
-+              bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
-+              bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
-+      }
-+
-       netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT);
-       if (!bgmac_is_bcm4707_family(bgmac)) {
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -190,7 +190,6 @@
- #define  BGMAC_CMDCFG_HD_SHIFT                        10
- #define  BGMAC_CMDCFG_SR_REV0                 0x00000800      /* Set to reset mode, for core rev 0-3 */
- #define  BGMAC_CMDCFG_SR_REV4                 0x00002000      /* Set to reset mode, for core rev >= 4 */
--#define  BGMAC_CMDCFG_SR(rev)  ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
- #define  BGMAC_CMDCFG_ML                      0x00008000      /* Set to activate mac loopback mode */
- #define  BGMAC_CMDCFG_AE                      0x00400000
- #define  BGMAC_CMDCFG_CFE                     0x00800000
-@@ -376,6 +375,24 @@
- #define ETHER_MAX_LEN   1518
-+/* Feature Flags */
-+#define BGMAC_FEAT_TX_MASK_SETUP      BIT(0)
-+#define BGMAC_FEAT_RX_MASK_SETUP      BIT(1)
-+#define BGMAC_FEAT_IOST_ATTACHED      BIT(2)
-+#define BGMAC_FEAT_NO_RESET           BIT(3)
-+#define BGMAC_FEAT_MISC_PLL_REQ               BIT(4)
-+#define BGMAC_FEAT_SW_TYPE_PHY                BIT(5)
-+#define BGMAC_FEAT_SW_TYPE_EPHYRMII   BIT(6)
-+#define BGMAC_FEAT_SW_TYPE_RGMII      BIT(7)
-+#define BGMAC_FEAT_CMN_PHY_CTL                BIT(8)
-+#define BGMAC_FEAT_FLW_CTRL1          BIT(9)
-+#define BGMAC_FEAT_FLW_CTRL2          BIT(10)
-+#define BGMAC_FEAT_SET_RXQ_CLK                BIT(11)
-+#define BGMAC_FEAT_CLKCTLST           BIT(12)
-+#define BGMAC_FEAT_NO_CLR_MIB         BIT(13)
-+#define BGMAC_FEAT_FORCE_SPEED_2500   BIT(14)
-+#define BGMAC_FEAT_CMDCFG_SR_REV4     BIT(15)
-+
- struct bgmac_slot_info {
-       union {
-               struct sk_buff *skb;
-@@ -430,6 +447,8 @@ struct bgmac {
-       struct device *dev;
-       struct device *dma_dev;
-+      u32 feature_flags;
-+
-       struct net_device *net_dev;
-       struct napi_struct napi;
-       struct mii_bus *mii_bus;
diff --git a/target/linux/generic/patches-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch b/target/linux/generic/patches-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch
deleted file mode 100644 (file)
index 5755184..0000000
+++ /dev/null
@@ -1,1260 +0,0 @@
-From f6a95a24957aec5bb488c3f978c4ed508177998f Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:57 -0400
-Subject: [PATCH 5/5] net: ethernet: bgmac: Add platform device support
-
-The bcma portion of the driver has been split off into a bcma specific
-driver.  This has been mirrored for the platform driver.  The last
-references to the bcma core struct have been changed into a generic
-function call.  These function calls are wrappers to either the original
-bcma code or new platform functions that access the same areas via MMIO.
-This necessitated adding function pointers for both platform and bcma to
-hide which backend is being used from the generic bgmac code.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/Kconfig           |  23 +-
- drivers/net/ethernet/broadcom/Makefile          |   4 +-
- drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c |   2 +
- drivers/net/ethernet/broadcom/bgmac-bcma.c      | 315 +++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac-platform.c  | 189 ++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.c           | 329 ++++--------------------
- drivers/net/ethernet/broadcom/bgmac.h           |  73 +++++-
- 7 files changed, 650 insertions(+), 285 deletions(-)
- create mode 100644 drivers/net/ethernet/broadcom/bgmac-bcma.c
- create mode 100644 drivers/net/ethernet/broadcom/bgmac-platform.c
-
---- a/drivers/net/ethernet/broadcom/Kconfig
-+++ b/drivers/net/ethernet/broadcom/Kconfig
-@@ -150,10 +150,18 @@ config BNX2X_VXLAN
-         Virtual eXtensible Local Area Network (VXLAN) in the driver.
- config BGMAC
--      tristate "BCMA bus GBit core support"
-+      tristate
-+      help
-+        This enables the integrated ethernet controller support for many
-+        Broadcom (mostly iProc) SoCs. An appropriate bus interface driver
-+        needs to be enabled to select this.
-+
-+config BGMAC_BCMA
-+      tristate "Broadcom iProc GBit BCMA support"
-       depends on BCMA && BCMA_HOST_SOC
-       depends on HAS_DMA
-       depends on BCM47XX || ARCH_BCM_5301X || COMPILE_TEST
-+      select BGMAC
-       select PHYLIB
-       select FIXED_PHY
-       ---help---
-@@ -162,6 +170,19 @@ config BGMAC
-         In case of using this driver on BCM4706 it's also requires to enable
-         BCMA_DRIVER_GMAC_CMN to make it work.
-+config BGMAC_PLATFORM
-+      tristate "Broadcom iProc GBit platform support"
-+      depends on HAS_DMA
-+      depends on ARCH_BCM_IPROC || COMPILE_TEST
-+      depends on OF
-+      select BGMAC
-+      select PHYLIB
-+      select FIXED_PHY
-+      default ARCH_BCM_IPROC
-+      ---help---
-+        Say Y here if you want to use the Broadcom iProc Gigabit Ethernet
-+        controller through the generic platform interface
-+
- config SYSTEMPORT
-       tristate "Broadcom SYSTEMPORT internal MAC support"
-       depends on OF
---- a/drivers/net/ethernet/broadcom/Makefile
-+++ b/drivers/net/ethernet/broadcom/Makefile
-@@ -10,6 +10,8 @@ obj-$(CONFIG_CNIC) += cnic.o
- obj-$(CONFIG_BNX2X) += bnx2x/
- obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o
- obj-$(CONFIG_TIGON3) += tg3.o
--obj-$(CONFIG_BGMAC) += bgmac.o bgmac-bcma-mdio.o
-+obj-$(CONFIG_BGMAC) += bgmac.o
-+obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o
-+obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o
- obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o
- obj-$(CONFIG_BNXT) += bnxt/
---- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
-@@ -255,6 +255,7 @@ err:
-       kfree(bcma_mdio);
-       return ERR_PTR(err);
- }
-+EXPORT_SYMBOL_GPL(bcma_mdio_mii_register);
- void bcma_mdio_mii_unregister(struct mii_bus *mii_bus)
- {
-@@ -270,6 +271,7 @@ void bcma_mdio_mii_unregister(struct mii
-       mdiobus_free(mii_bus);
-       kfree(bcma_mdio);
- }
-+EXPORT_SYMBOL_GPL(bcma_mdio_mii_unregister);
- MODULE_AUTHOR("RafaÅ‚ MiÅ‚ecki");
- MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -0,0 +1,315 @@
-+/*
-+ * Driver for (BCM4706)? GBit MAC core on BCMA bus.
-+ *
-+ * Copyright (C) 2012 RafaÅ‚ MiÅ‚ecki <zajec5@gmail.com>
-+ *
-+ * Licensed under the GNU/GPL. See COPYING for details.
-+ */
-+
-+#define pr_fmt(fmt)           KBUILD_MODNAME ": " fmt
-+
-+#include <linux/bcma/bcma.h>
-+#include <linux/brcmphy.h>
-+#include <linux/etherdevice.h>
-+#include "bgmac.h"
-+
-+static inline bool bgmac_is_bcm4707_family(struct bcma_device *core)
-+{
-+      switch (core->bus->chipinfo.id) {
-+      case BCMA_CHIP_ID_BCM4707:
-+      case BCMA_CHIP_ID_BCM47094:
-+      case BCMA_CHIP_ID_BCM53018:
-+              return true;
-+      default:
-+              return false;
-+      }
-+}
-+
-+/**************************************************
-+ * BCMA bus ops
-+ **************************************************/
-+
-+static u32 bcma_bgmac_read(struct bgmac *bgmac, u16 offset)
-+{
-+      return bcma_read32(bgmac->bcma.core, offset);
-+}
-+
-+static void bcma_bgmac_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+      bcma_write32(bgmac->bcma.core, offset, value);
-+}
-+
-+static u32 bcma_bgmac_idm_read(struct bgmac *bgmac, u16 offset)
-+{
-+      return bcma_aread32(bgmac->bcma.core, offset);
-+}
-+
-+static void bcma_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+      return bcma_awrite32(bgmac->bcma.core, offset, value);
-+}
-+
-+static bool bcma_bgmac_clk_enabled(struct bgmac *bgmac)
-+{
-+      return bcma_core_is_enabled(bgmac->bcma.core);
-+}
-+
-+static void bcma_bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
-+{
-+      bcma_core_enable(bgmac->bcma.core, flags);
-+}
-+
-+static void bcma_bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset,
-+                                     u32 mask, u32 set)
-+{
-+      struct bcma_drv_cc *cc = &bgmac->bcma.core->bus->drv_cc;
-+
-+      bcma_chipco_chipctl_maskset(cc, offset, mask, set);
-+}
-+
-+static u32 bcma_bgmac_get_bus_clock(struct bgmac *bgmac)
-+{
-+      struct bcma_drv_cc *cc = &bgmac->bcma.core->bus->drv_cc;
-+
-+      return bcma_pmu_get_bus_clock(cc);
-+}
-+
-+static void bcma_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset, u32 mask,
-+                                   u32 set)
-+{
-+      bcma_maskset32(bgmac->bcma.cmn, offset, mask, set);
-+}
-+
-+static const struct bcma_device_id bgmac_bcma_tbl[] = {
-+      BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT,
-+                BCMA_ANY_REV, BCMA_ANY_CLASS),
-+      BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_MAC_GBIT, BCMA_ANY_REV,
-+                BCMA_ANY_CLASS),
-+      {},
-+};
-+MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
-+
-+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
-+static int bgmac_probe(struct bcma_device *core)
-+{
-+      struct ssb_sprom *sprom = &core->bus->sprom;
-+      struct mii_bus *mii_bus;
-+      struct bgmac *bgmac;
-+      u8 *mac;
-+      int err;
-+
-+      bgmac = kzalloc(sizeof(*bgmac), GFP_KERNEL);
-+      if (!bgmac)
-+              return -ENOMEM;
-+
-+      bgmac->bcma.core = core;
-+      bgmac->dev = &core->dev;
-+      bgmac->dma_dev = core->dma_dev;
-+      bgmac->irq = core->irq;
-+
-+      bcma_set_drvdata(core, bgmac);
-+
-+      switch (core->core_unit) {
-+      case 0:
-+              mac = sprom->et0mac;
-+              break;
-+      case 1:
-+              mac = sprom->et1mac;
-+              break;
-+      case 2:
-+              mac = sprom->et2mac;
-+              break;
-+      default:
-+              dev_err(bgmac->dev, "Unsupported core_unit %d\n",
-+                      core->core_unit);
-+              err = -ENOTSUPP;
-+              goto err;
-+      }
-+
-+      ether_addr_copy(bgmac->mac_addr, mac);
-+
-+      /* On BCM4706 we need common core to access PHY */
-+      if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
-+          !core->bus->drv_gmac_cmn.core) {
-+              dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n");
-+              err = -ENODEV;
-+              goto err;
-+      }
-+      bgmac->bcma.cmn = core->bus->drv_gmac_cmn.core;
-+
-+      switch (core->core_unit) {
-+      case 0:
-+              bgmac->phyaddr = sprom->et0phyaddr;
-+              break;
-+      case 1:
-+              bgmac->phyaddr = sprom->et1phyaddr;
-+              break;
-+      case 2:
-+              bgmac->phyaddr = sprom->et2phyaddr;
-+              break;
-+      }
-+      bgmac->phyaddr &= BGMAC_PHY_MASK;
-+      if (bgmac->phyaddr == BGMAC_PHY_MASK) {
-+              dev_err(bgmac->dev, "No PHY found\n");
-+              err = -ENODEV;
-+              goto err;
-+      }
-+      dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
-+               bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
-+
-+      if (!bgmac_is_bcm4707_family(core)) {
-+              mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
-+              if (!IS_ERR(mii_bus)) {
-+                      err = PTR_ERR(mii_bus);
-+                      goto err;
-+              }
-+
-+              bgmac->mii_bus = mii_bus;
-+      }
-+
-+      if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
-+              dev_err(bgmac->dev, "PCI setup not implemented\n");
-+              err = -ENOTSUPP;
-+              goto err1;
-+      }
-+
-+      bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
-+                             BGMAC_BFL_ENETROBO);
-+      if (bgmac->has_robosw)
-+              dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n");
-+
-+      if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM)
-+              dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n");
-+
-+      /* Feature Flags */
-+      switch (core->bus->chipinfo.id) {
-+      case BCMA_CHIP_ID_BCM5357:
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+              }
-+              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358)
-+                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII;
-+              break;
-+      case BCMA_CHIP_ID_BCM53572:
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+              }
-+              break;
-+      case BCMA_CHIP_ID_BCM4749:
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+              if (core->bus->chipinfo.pkg == 10) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+              }
-+              break;
-+      case BCMA_CHIP_ID_BCM4716:
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              /* fallthrough */
-+      case BCMA_CHIP_ID_BCM47162:
-+              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2;
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              break;
-+      /* bcm4707_family */
-+      case BCMA_CHIP_ID_BCM4707:
-+      case BCMA_CHIP_ID_BCM47094:
-+      case BCMA_CHIP_ID_BCM53018:
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-+              bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-+              break;
-+      default:
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+      }
-+
-+      if (!bgmac_is_bcm4707_family(core) && core->id.rev > 2)
-+              bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ;
-+
-+      if (core->id.id == BCMA_CORE_4706_MAC_GBIT) {
-+              bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL;
-+              bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB;
-+      }
-+
-+      if (core->id.rev >= 4) {
-+              bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
-+              bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
-+              bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
-+      }
-+
-+      bgmac->read = bcma_bgmac_read;
-+      bgmac->write = bcma_bgmac_write;
-+      bgmac->idm_read = bcma_bgmac_idm_read;
-+      bgmac->idm_write = bcma_bgmac_idm_write;
-+      bgmac->clk_enabled = bcma_bgmac_clk_enabled;
-+      bgmac->clk_enable = bcma_bgmac_clk_enable;
-+      bgmac->cco_ctl_maskset = bcma_bgmac_cco_ctl_maskset;
-+      bgmac->get_bus_clock = bcma_bgmac_get_bus_clock;
-+      bgmac->cmn_maskset32 = bcma_bgmac_cmn_maskset32;
-+
-+      err = bgmac_enet_probe(bgmac);
-+      if (err)
-+              goto err1;
-+
-+      return 0;
-+
-+err1:
-+      bcma_mdio_mii_unregister(bgmac->mii_bus);
-+err:
-+      kfree(bgmac);
-+      bcma_set_drvdata(core, NULL);
-+
-+      return err;
-+}
-+
-+static void bgmac_remove(struct bcma_device *core)
-+{
-+      struct bgmac *bgmac = bcma_get_drvdata(core);
-+
-+      bcma_mdio_mii_unregister(bgmac->mii_bus);
-+      bgmac_enet_remove(bgmac);
-+      bcma_set_drvdata(core, NULL);
-+      kfree(bgmac);
-+}
-+
-+static struct bcma_driver bgmac_bcma_driver = {
-+      .name           = KBUILD_MODNAME,
-+      .id_table       = bgmac_bcma_tbl,
-+      .probe          = bgmac_probe,
-+      .remove         = bgmac_remove,
-+};
-+
-+static int __init bgmac_init(void)
-+{
-+      int err;
-+
-+      err = bcma_driver_register(&bgmac_bcma_driver);
-+      if (err)
-+              return err;
-+      pr_info("Broadcom 47xx GBit MAC driver loaded\n");
-+
-+      return 0;
-+}
-+
-+static void __exit bgmac_exit(void)
-+{
-+      bcma_driver_unregister(&bgmac_bcma_driver);
-+}
-+
-+module_init(bgmac_init)
-+module_exit(bgmac_exit)
-+
-+MODULE_AUTHOR("RafaÅ‚ MiÅ‚ecki");
-+MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
-@@ -0,0 +1,189 @@
-+/*
-+ * Copyright (C) 2016 Broadcom
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation version 2.
-+ *
-+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
-+ * kind, whether express or implied; without even the implied warranty
-+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ */
-+
-+#define pr_fmt(fmt)           KBUILD_MODNAME ": " fmt
-+
-+#include <linux/bcma/bcma.h>
-+#include <linux/etherdevice.h>
-+#include <linux/of_address.h>
-+#include <linux/of_net.h>
-+#include "bgmac.h"
-+
-+static u32 platform_bgmac_read(struct bgmac *bgmac, u16 offset)
-+{
-+      return readl(bgmac->plat.base + offset);
-+}
-+
-+static void platform_bgmac_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+      writel(value, bgmac->plat.base + offset);
-+}
-+
-+static u32 platform_bgmac_idm_read(struct bgmac *bgmac, u16 offset)
-+{
-+      return readl(bgmac->plat.idm_base + offset);
-+}
-+
-+static void platform_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+      return writel(value, bgmac->plat.idm_base + offset);
-+}
-+
-+static bool platform_bgmac_clk_enabled(struct bgmac *bgmac)
-+{
-+      if ((bgmac_idm_read(bgmac, BCMA_IOCTL) &
-+           (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC)) != BCMA_IOCTL_CLK)
-+              return false;
-+      if (bgmac_idm_read(bgmac, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
-+              return false;
-+      return true;
-+}
-+
-+static void platform_bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
-+{
-+      bgmac_idm_write(bgmac, BCMA_IOCTL,
-+                      (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags));
-+      bgmac_idm_read(bgmac, BCMA_IOCTL);
-+
-+      bgmac_idm_write(bgmac, BCMA_RESET_CTL, 0);
-+      bgmac_idm_read(bgmac, BCMA_RESET_CTL);
-+      udelay(1);
-+
-+      bgmac_idm_write(bgmac, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags));
-+      bgmac_idm_read(bgmac, BCMA_IOCTL);
-+      udelay(1);
-+}
-+
-+static void platform_bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset,
-+                                         u32 mask, u32 set)
-+{
-+      /* This shouldn't be encountered */
-+      WARN_ON(1);
-+}
-+
-+static u32 platform_bgmac_get_bus_clock(struct bgmac *bgmac)
-+{
-+      /* This shouldn't be encountered */
-+      WARN_ON(1);
-+
-+      return 0;
-+}
-+
-+static void platform_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset,
-+                                       u32 mask, u32 set)
-+{
-+      /* This shouldn't be encountered */
-+      WARN_ON(1);
-+}
-+
-+static int bgmac_probe(struct platform_device *pdev)
-+{
-+      struct device_node *np = pdev->dev.of_node;
-+      struct bgmac *bgmac;
-+      struct resource *regs;
-+      const u8 *mac_addr;
-+
-+      bgmac = devm_kzalloc(&pdev->dev, sizeof(*bgmac), GFP_KERNEL);
-+      if (!bgmac)
-+              return -ENOMEM;
-+
-+      platform_set_drvdata(pdev, bgmac);
-+
-+      /* Set the features of the 4707 family */
-+      bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+      bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-+      bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-+      bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
-+      bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
-+      bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
-+
-+      bgmac->dev = &pdev->dev;
-+      bgmac->dma_dev = &pdev->dev;
-+
-+      mac_addr = of_get_mac_address(np);
-+      if (mac_addr)
-+              ether_addr_copy(bgmac->mac_addr, mac_addr);
-+      else
-+              dev_warn(&pdev->dev, "MAC address not present in device tree\n");
-+
-+      bgmac->irq = platform_get_irq(pdev, 0);
-+      if (bgmac->irq < 0) {
-+              dev_err(&pdev->dev, "Unable to obtain IRQ\n");
-+              return bgmac->irq;
-+      }
-+
-+      regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "amac_base");
-+      if (!regs) {
-+              dev_err(&pdev->dev, "Unable to obtain base resource\n");
-+              return -EINVAL;
-+      }
-+
-+      bgmac->plat.base = devm_ioremap_resource(&pdev->dev, regs);
-+      if (IS_ERR(bgmac->plat.base)) {
-+              dev_err(&pdev->dev, "Unable to map base resource\n");
-+              return PTR_ERR(bgmac->plat.base);
-+      }
-+
-+      regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
-+      if (!regs) {
-+              dev_err(&pdev->dev, "Unable to obtain idm resource\n");
-+              return -EINVAL;
-+      }
-+
-+      bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
-+      if (!bgmac->plat.idm_base) {
-+              dev_err(&pdev->dev, "Unable to map idm resource\n");
-+              return PTR_ERR(bgmac->plat.idm_base);
-+      }
-+
-+      bgmac->read = platform_bgmac_read;
-+      bgmac->write = platform_bgmac_write;
-+      bgmac->idm_read = platform_bgmac_idm_read;
-+      bgmac->idm_write = platform_bgmac_idm_write;
-+      bgmac->clk_enabled = platform_bgmac_clk_enabled;
-+      bgmac->clk_enable = platform_bgmac_clk_enable;
-+      bgmac->cco_ctl_maskset = platform_bgmac_cco_ctl_maskset;
-+      bgmac->get_bus_clock = platform_bgmac_get_bus_clock;
-+      bgmac->cmn_maskset32 = platform_bgmac_cmn_maskset32;
-+
-+      return bgmac_enet_probe(bgmac);
-+}
-+
-+static int bgmac_remove(struct platform_device *pdev)
-+{
-+      struct bgmac *bgmac = platform_get_drvdata(pdev);
-+
-+      bgmac_enet_remove(bgmac);
-+
-+      return 0;
-+}
-+
-+static const struct of_device_id bgmac_of_enet_match[] = {
-+      {.compatible = "brcm,amac",},
-+      {.compatible = "brcm,nsp-amac",},
-+      {},
-+};
-+
-+MODULE_DEVICE_TABLE(of, bgmac_of_enet_match);
-+
-+static struct platform_driver bgmac_enet_driver = {
-+      .driver = {
-+              .name  = "bgmac-enet",
-+              .of_match_table = bgmac_of_enet_match,
-+      },
-+      .probe = bgmac_probe,
-+      .remove = bgmac_remove,
-+};
-+
-+module_platform_driver(bgmac_enet_driver);
-+MODULE_LICENSE("GPL");
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -6,51 +6,27 @@
-  * Licensed under the GNU/GPL. See COPYING for details.
-  */
--#include "bgmac.h"
--#include <linux/kernel.h>
--#include <linux/module.h>
--#include <linux/delay.h>
-+#define pr_fmt(fmt)           KBUILD_MODNAME ": " fmt
-+
-+#include <linux/bcma/bcma.h>
- #include <linux/etherdevice.h>
--#include <linux/mii.h>
--#include <linux/phy.h>
--#include <linux/phy_fixed.h>
--#include <linux/interrupt.h>
--#include <linux/dma-mapping.h>
- #include <linux/bcm47xx_nvram.h>
-+#include "bgmac.h"
--static const struct bcma_device_id bgmac_bcma_tbl[] = {
--      BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
--      BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
--      {},
--};
--MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
--
--static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac)
--{
--      switch (bgmac->core->bus->chipinfo.id) {
--      case BCMA_CHIP_ID_BCM4707:
--      case BCMA_CHIP_ID_BCM47094:
--      case BCMA_CHIP_ID_BCM53018:
--              return true;
--      default:
--              return false;
--      }
--}
--
--static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask,
-+static bool bgmac_wait_value(struct bgmac *bgmac, u16 reg, u32 mask,
-                            u32 value, int timeout)
- {
-       u32 val;
-       int i;
-       for (i = 0; i < timeout / 10; i++) {
--              val = bcma_read32(core, reg);
-+              val = bgmac_read(bgmac, reg);
-               if ((val & mask) == value)
-                       return true;
-               udelay(10);
-       }
--      dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg);
-+      dev_err(bgmac->dev, "Timeout waiting for reg 0x%X\n", reg);
-       return false;
- }
-@@ -89,7 +65,7 @@ static void bgmac_dma_tx_reset(struct bg
-       /* Remove SUSPEND bit */
-       bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, 0);
--      if (!bgmac_wait_value(bgmac->core,
-+      if (!bgmac_wait_value(bgmac,
-                             ring->mmio_base + BGMAC_DMA_TX_STATUS,
-                             BGMAC_DMA_TX_STAT, BGMAC_DMA_TX_STAT_DISABLED,
-                             10000)) {
-@@ -317,7 +293,7 @@ static void bgmac_dma_rx_reset(struct bg
-               return;
-       bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_CTL, 0);
--      if (!bgmac_wait_value(bgmac->core,
-+      if (!bgmac_wait_value(bgmac,
-                             ring->mmio_base + BGMAC_DMA_RX_STATUS,
-                             BGMAC_DMA_RX_STAT, BGMAC_DMA_RX_STAT_DISABLED,
-                             10000))
-@@ -643,7 +619,7 @@ static int bgmac_dma_alloc(struct bgmac
-       BUILD_BUG_ON(BGMAC_MAX_TX_RINGS > ARRAY_SIZE(ring_base));
-       BUILD_BUG_ON(BGMAC_MAX_RX_RINGS > ARRAY_SIZE(ring_base));
--      if (!(bcma_aread32(bgmac->core, BCMA_IOST) & BCMA_IOST_DMA64)) {
-+      if (!(bgmac_idm_read(bgmac, BCMA_IOST) & BCMA_IOST_DMA64)) {
-               dev_err(bgmac->dev, "Core does not report 64-bit DMA\n");
-               return -ENOTSUPP;
-       }
-@@ -875,12 +851,10 @@ static void bgmac_mac_speed(struct bgmac
- static void bgmac_miiconfig(struct bgmac *bgmac)
- {
--      struct bcma_device *core = bgmac->core;
--
-       if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) {
--              bcma_awrite32(core, BCMA_IOCTL,
--                            bcma_aread32(core, BCMA_IOCTL) | 0x40 |
--                            BGMAC_BCMA_IOCTL_SW_CLKEN);
-+              bgmac_idm_write(bgmac, BCMA_IOCTL,
-+                              bgmac_idm_read(bgmac, BCMA_IOCTL) | 0x40 |
-+                              BGMAC_BCMA_IOCTL_SW_CLKEN);
-               bgmac->mac_speed = SPEED_2500;
-               bgmac->mac_duplex = DUPLEX_FULL;
-               bgmac_mac_speed(bgmac);
-@@ -900,12 +874,11 @@ static void bgmac_miiconfig(struct bgmac
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipreset */
- static void bgmac_chip_reset(struct bgmac *bgmac)
- {
--      struct bcma_device *core = bgmac->core;
-       u32 cmdcfg_sr;
-       u32 iost;
-       int i;
--      if (bcma_core_is_enabled(core)) {
-+      if (bgmac_clk_enabled(bgmac)) {
-               if (!bgmac->stats_grabbed) {
-                       /* bgmac_chip_stats_update(bgmac); */
-                       bgmac->stats_grabbed = true;
-@@ -923,7 +896,7 @@ static void bgmac_chip_reset(struct bgma
-               /* TODO: Clear software multicast filter list */
-       }
--      iost = bcma_aread32(core, BCMA_IOST);
-+      iost = bgmac_idm_read(bgmac, BCMA_IOST);
-       if (bgmac->feature_flags & BGMAC_FEAT_IOST_ATTACHED)
-               iost &= ~BGMAC_BCMA_IOST_ATTACHED;
-@@ -935,21 +908,20 @@ static void bgmac_chip_reset(struct bgma
-                       if (!bgmac->has_robosw)
-                               flags |= BGMAC_BCMA_IOCTL_SW_RESET;
-               }
--              bcma_core_enable(core, flags);
-+              bgmac_clk_enable(bgmac, flags);
-       }
-       /* Request Misc PLL for corerev > 2 */
-       if (bgmac->feature_flags & BGMAC_FEAT_MISC_PLL_REQ) {
-               bgmac_set(bgmac, BCMA_CLKCTLST,
-                         BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
--              bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
-+              bgmac_wait_value(bgmac, BCMA_CLKCTLST,
-                                BGMAC_BCMA_CLKCTLST_MISC_PLL_ST,
-                                BGMAC_BCMA_CLKCTLST_MISC_PLL_ST,
-                                1000);
-       }
-       if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_PHY) {
--              struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc;
-               u8 et_swtype = 0;
-               u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY |
-                            BGMAC_CHIPCTL_1_IF_TYPE_MII;
-@@ -968,16 +940,15 @@ static void bgmac_chip_reset(struct bgma
-                       sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
-                                 BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
-               }
--              bcma_chipco_chipctl_maskset(cc, 1,
--                                          ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK |
--                                            BGMAC_CHIPCTL_1_SW_TYPE_MASK),
--                                          sw_type);
-+              bgmac_cco_ctl_maskset(bgmac, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK |
-+                                                BGMAC_CHIPCTL_1_SW_TYPE_MASK),
-+                                    sw_type);
-       }
-       if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
--              bcma_awrite32(core, BCMA_IOCTL,
--                            bcma_aread32(core, BCMA_IOCTL) &
--                            ~BGMAC_BCMA_IOCTL_SW_RESET);
-+              bgmac_idm_write(bgmac, BCMA_IOCTL,
-+                              bgmac_idm_read(bgmac, BCMA_IOCTL) &
-+                              ~BGMAC_BCMA_IOCTL_SW_RESET);
-       /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_reset
-        * Specs don't say about using BGMAC_CMDCFG_SR, but in this routine
-@@ -1013,8 +984,8 @@ static void bgmac_chip_reset(struct bgma
-       bgmac_clear_mib(bgmac);
-       if (bgmac->feature_flags & BGMAC_FEAT_CMN_PHY_CTL)
--              bcma_maskset32(bgmac->cmn, BCMA_GMAC_CMN_PHY_CTL, ~0,
--                             BCMA_GMAC_CMN_PC_MTE);
-+              bgmac_cmn_maskset32(bgmac, BCMA_GMAC_CMN_PHY_CTL, ~0,
-+                                  BCMA_GMAC_CMN_PC_MTE);
-       else
-               bgmac_set(bgmac, BGMAC_PHY_CNTL, BGMAC_PC_MTE);
-       bgmac_miiconfig(bgmac);
-@@ -1059,8 +1030,8 @@ static void bgmac_enable(struct bgmac *b
-       if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0)
-               bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
-       if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2)
--              bcma_chipco_chipctl_maskset(&bgmac->core->bus->drv_cc, 1, ~0,
--                                          BGMAC_CHIPCTL_1_RXC_DLL_BYPASS);
-+              bgmac_cco_ctl_maskset(bgmac, 1, ~0,
-+                                    BGMAC_CHIPCTL_1_RXC_DLL_BYPASS);
-       if (bgmac->feature_flags & (BGMAC_FEAT_FLW_CTRL1 |
-                                   BGMAC_FEAT_FLW_CTRL2)) {
-@@ -1082,8 +1053,7 @@ static void bgmac_enable(struct bgmac *b
-               rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
-               rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
--              bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) /
--                              1000000;
-+              bp_clk = bgmac_get_bus_clock(bgmac) / 1000000;
-               mdp = (bp_clk * 128 / 1000) - 3;
-               rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT);
-               bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl);
-@@ -1178,7 +1148,7 @@ static int bgmac_open(struct net_device
-       /* Specs say about reclaiming rings here, but we do that in DMA init */
-       bgmac_chip_init(bgmac);
--      err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED,
-+      err = request_irq(bgmac->irq, bgmac_interrupt, IRQF_SHARED,
-                         KBUILD_MODNAME, net_dev);
-       if (err < 0) {
-               dev_err(bgmac->dev, "IRQ request error: %d!\n", err);
-@@ -1204,7 +1174,7 @@ static int bgmac_stop(struct net_device
-       napi_disable(&bgmac->napi);
-       bgmac_chip_intrs_off(bgmac);
--      free_irq(bgmac->core->irq, net_dev);
-+      free_irq(bgmac->irq, net_dev);
-       bgmac_chip_reset(bgmac);
-       bgmac_dma_cleanup(bgmac);
-@@ -1399,7 +1369,7 @@ static void bgmac_get_drvinfo(struct net
-                             struct ethtool_drvinfo *info)
- {
-       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
--      strlcpy(info->bus_info, "BCMA", sizeof(info->bus_info));
-+      strlcpy(info->bus_info, "AXI", sizeof(info->bus_info));
- }
- static const struct ethtool_ops bgmac_ethtool_ops = {
-@@ -1483,116 +1453,41 @@ static int bgmac_phy_connect(struct bgma
-       return 0;
- }
--static int bgmac_probe(struct bcma_device *core)
-+int bgmac_enet_probe(struct bgmac *info)
- {
-       struct net_device *net_dev;
-       struct bgmac *bgmac;
--      struct ssb_sprom *sprom = &core->bus->sprom;
--      u8 *mac;
-       int err;
--      switch (core->core_unit) {
--      case 0:
--              mac = sprom->et0mac;
--              break;
--      case 1:
--              mac = sprom->et1mac;
--              break;
--      case 2:
--              mac = sprom->et2mac;
--              break;
--      default:
--              dev_err(&core->dev, "Unsupported core_unit %d\n",
--                      core->core_unit);
--              return -ENOTSUPP;
--      }
--
--      if (!is_valid_ether_addr(mac)) {
--              dev_err(&core->dev, "Invalid MAC addr: %pM\n", mac);
--              eth_random_addr(mac);
--              dev_warn(&core->dev, "Using random MAC: %pM\n", mac);
--      }
--
--      /* This (reset &) enable is not preset in specs or reference driver but
--       * Broadcom does it in arch PCI code when enabling fake PCI device.
--       */
--      bcma_core_enable(core, 0);
--
-       /* Allocation and references */
-       net_dev = alloc_etherdev(sizeof(*bgmac));
-       if (!net_dev)
-               return -ENOMEM;
-+
-       net_dev->netdev_ops = &bgmac_netdev_ops;
--      net_dev->irq = core->irq;
-       net_dev->ethtool_ops = &bgmac_ethtool_ops;
-       bgmac = netdev_priv(net_dev);
--      bgmac->dev = &core->dev;
--      bgmac->dma_dev = core->dma_dev;
-+      memcpy(bgmac, info, sizeof(*bgmac));
-       bgmac->net_dev = net_dev;
--      bgmac->core = core;
--      bcma_set_drvdata(core, bgmac);
--      SET_NETDEV_DEV(net_dev, &core->dev);
--
--      /* Defaults */
--      memcpy(bgmac->net_dev->dev_addr, mac, ETH_ALEN);
--
--      /* On BCM4706 we need common core to access PHY */
--      if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
--          !core->bus->drv_gmac_cmn.core) {
--              dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n");
--              err = -ENODEV;
--              goto err_netdev_free;
--      }
--      bgmac->cmn = core->bus->drv_gmac_cmn.core;
-+      net_dev->irq = bgmac->irq;
-+      SET_NETDEV_DEV(net_dev, bgmac->dev);
--      switch (core->core_unit) {
--      case 0:
--              bgmac->phyaddr = sprom->et0phyaddr;
--              break;
--      case 1:
--              bgmac->phyaddr = sprom->et1phyaddr;
--              break;
--      case 2:
--              bgmac->phyaddr = sprom->et2phyaddr;
--              break;
-+      if (!is_valid_ether_addr(bgmac->mac_addr)) {
-+              dev_err(bgmac->dev, "Invalid MAC addr: %pM\n",
-+                      bgmac->mac_addr);
-+              eth_random_addr(bgmac->mac_addr);
-+              dev_warn(bgmac->dev, "Using random MAC: %pM\n",
-+                       bgmac->mac_addr);
-       }
--      bgmac->phyaddr &= BGMAC_PHY_MASK;
--      if (bgmac->phyaddr == BGMAC_PHY_MASK) {
--              dev_err(bgmac->dev, "No PHY found\n");
--              err = -ENODEV;
--              goto err_netdev_free;
--      }
--      dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
--               bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
-+      ether_addr_copy(net_dev->dev_addr, bgmac->mac_addr);
--      if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
--              dev_err(bgmac->dev, "PCI setup not implemented\n");
--              err = -ENOTSUPP;
--              goto err_netdev_free;
--      }
-+      /* This (reset &) enable is not preset in specs or reference driver but
-+       * Broadcom does it in arch PCI code when enabling fake PCI device.
-+       */
-+      bgmac_clk_enable(bgmac, 0);
-       bgmac_chip_reset(bgmac);
--      /* For Northstar, we have to take all GMAC core out of reset */
--      if (bgmac_is_bcm4707_family(bgmac)) {
--              struct bcma_device *ns_core;
--              int ns_gmac;
--
--              /* Northstar has 4 GMAC cores */
--              for (ns_gmac = 0; ns_gmac < 4; ns_gmac++) {
--                      /* As Northstar requirement, we have to reset all GMACs
--                       * before accessing one. bgmac_chip_reset() call
--                       * bcma_core_enable() for this core. Then the other
--                       * three GMACs didn't reset.  We do it here.
--                       */
--                      ns_core = bcma_find_core_unit(core->bus,
--                                                    BCMA_CORE_MAC_GBIT,
--                                                    ns_gmac);
--                      if (ns_core && !bcma_core_is_enabled(ns_core))
--                              bcma_core_enable(ns_core, 0);
--              }
--      }
--
-       err = bgmac_dma_alloc(bgmac);
-       if (err) {
-               dev_err(bgmac->dev, "Unable to alloc memory for DMA\n");
-@@ -1603,103 +1498,15 @@ static int bgmac_probe(struct bcma_devic
-       if (bcm47xx_nvram_getenv("et0_no_txint", NULL, 0) == 0)
-               bgmac->int_mask &= ~BGMAC_IS_TX_MASK;
--      bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
--                             BGMAC_BFL_ENETROBO);
--      if (bgmac->has_robosw)
--              dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n");
--
--      if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM)
--              dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n");
--
--      /* Feature Flags */
--      switch (core->bus->chipinfo.id) {
--      case BCMA_CHIP_ID_BCM5357:
--              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
--              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
--              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) {
--                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
--                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
--              }
--              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358)
--                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII;
--              break;
--      case BCMA_CHIP_ID_BCM53572:
--              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
--              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
--              if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) {
--                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
--                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
--              }
--              break;
--      case BCMA_CHIP_ID_BCM4749:
--              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
--              bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
--              if (core->bus->chipinfo.pkg == 10) {
--                      bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
--                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
--              }
--              break;
--      case BCMA_CHIP_ID_BCM4716:
--              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--              /* fallthrough */
--      case BCMA_CHIP_ID_BCM47162:
--              bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2;
--              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--              break;
--      /* bcm4707_family */
--      case BCMA_CHIP_ID_BCM4707:
--      case BCMA_CHIP_ID_BCM47094:
--      case BCMA_CHIP_ID_BCM53018:
--              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--              bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
--              bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
--              break;
--      default:
--              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--      }
--
--      if (!bgmac_is_bcm4707_family(bgmac) && core->id.rev > 2)
--              bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ;
--
--      if (core->id.id == BCMA_CORE_4706_MAC_GBIT) {
--              bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL;
--              bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB;
--      }
--
--      if (core->id.rev >= 4) {
--              bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
--              bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
--              bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
--      }
--
-       netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT);
--      if (!bgmac_is_bcm4707_family(bgmac)) {
--              struct mii_bus *mii_bus;
--
--              mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
--              if (!IS_ERR(mii_bus)) {
--                      err = PTR_ERR(mii_bus);
--                      goto err_dma_free;
--              }
--
--              bgmac->mii_bus = mii_bus;
--      }
--
-       if (!bgmac->mii_bus)
-               err = bgmac_phy_connect_direct(bgmac);
-       else
-               err = bgmac_phy_connect(bgmac);
-       if (err) {
-               dev_err(bgmac->dev, "Cannot connect to phy\n");
--              goto err_mii_unregister;
-+              goto err_dma_free;
-       }
-       net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
-@@ -1718,56 +1525,24 @@ static int bgmac_probe(struct bcma_devic
- err_phy_disconnect:
-       phy_disconnect(net_dev->phydev);
--err_mii_unregister:
--      bcma_mdio_mii_unregister(bgmac->mii_bus);
- err_dma_free:
-       bgmac_dma_free(bgmac);
- err_netdev_free:
--      bcma_set_drvdata(core, NULL);
-       free_netdev(net_dev);
-       return err;
- }
-+EXPORT_SYMBOL_GPL(bgmac_enet_probe);
--static void bgmac_remove(struct bcma_device *core)
-+void bgmac_enet_remove(struct bgmac *bgmac)
- {
--      struct bgmac *bgmac = bcma_get_drvdata(core);
--
-       unregister_netdev(bgmac->net_dev);
-       phy_disconnect(bgmac->net_dev->phydev);
--      bcma_mdio_mii_unregister(bgmac->mii_bus);
-       netif_napi_del(&bgmac->napi);
-       bgmac_dma_free(bgmac);
--      bcma_set_drvdata(core, NULL);
-       free_netdev(bgmac->net_dev);
- }
--
--static struct bcma_driver bgmac_bcma_driver = {
--      .name           = KBUILD_MODNAME,
--      .id_table       = bgmac_bcma_tbl,
--      .probe          = bgmac_probe,
--      .remove         = bgmac_remove,
--};
--
--static int __init bgmac_init(void)
--{
--      int err;
--
--      err = bcma_driver_register(&bgmac_bcma_driver);
--      if (err)
--              return err;
--      pr_info("Broadcom 47xx GBit MAC driver loaded\n");
--
--      return 0;
--}
--
--static void __exit bgmac_exit(void)
--{
--      bcma_driver_unregister(&bgmac_bcma_driver);
--}
--
--module_init(bgmac_init)
--module_exit(bgmac_exit)
-+EXPORT_SYMBOL_GPL(bgmac_enet_remove);
- MODULE_AUTHOR("RafaÅ‚ MiÅ‚ecki");
- MODULE_LICENSE("GPL");
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -1,8 +1,6 @@
- #ifndef _BGMAC_H
- #define _BGMAC_H
--#include <linux/bcma/bcma.h>
--#include <linux/brcmphy.h>
- #include <linux/netdevice.h>
- #define BGMAC_DEV_CTL                         0x000
-@@ -442,11 +440,21 @@ struct bgmac_rx_header {
- };
- struct bgmac {
--      struct bcma_device *core;
--      struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
-+      union {
-+              struct {
-+                      void *base;
-+                      void *idm_base;
-+              } plat;
-+              struct {
-+                      struct bcma_device *core;
-+                      /* Reference to CMN core for BCM4706 */
-+                      struct bcma_device *cmn;
-+              } bcma;
-+      };
-       struct device *dev;
-       struct device *dma_dev;
-+      unsigned char mac_addr[ETH_ALEN];
-       u32 feature_flags;
-       struct net_device *net_dev;
-@@ -463,6 +471,7 @@ struct bgmac {
-       u32 mib_rx_regs[BGMAC_NUM_MIB_RX_REGS];
-       /* Int */
-+      int irq;
-       u32 int_mask;
-       /* Current MAC state */
-@@ -473,19 +482,71 @@ struct bgmac {
-       bool has_robosw;
-       bool loopback;
-+
-+      u32 (*read)(struct bgmac *bgmac, u16 offset);
-+      void (*write)(struct bgmac *bgmac, u16 offset, u32 value);
-+      u32 (*idm_read)(struct bgmac *bgmac, u16 offset);
-+      void (*idm_write)(struct bgmac *bgmac, u16 offset, u32 value);
-+      bool (*clk_enabled)(struct bgmac *bgmac);
-+      void (*clk_enable)(struct bgmac *bgmac, u32 flags);
-+      void (*cco_ctl_maskset)(struct bgmac *bgmac, u32 offset, u32 mask,
-+                              u32 set);
-+      u32 (*get_bus_clock)(struct bgmac *bgmac);
-+      void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
-+                            u32 set);
- };
-+int bgmac_enet_probe(struct bgmac *info);
-+void bgmac_enet_remove(struct bgmac *bgmac);
-+
- struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr);
- void bcma_mdio_mii_unregister(struct mii_bus *mii_bus);
- static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset)
- {
--      return bcma_read32(bgmac->core, offset);
-+      return bgmac->read(bgmac, offset);
- }
- static inline void bgmac_write(struct bgmac *bgmac, u16 offset, u32 value)
- {
--      bcma_write32(bgmac->core, offset, value);
-+      bgmac->write(bgmac, offset, value);
-+}
-+
-+static inline u32 bgmac_idm_read(struct bgmac *bgmac, u16 offset)
-+{
-+      return bgmac->idm_read(bgmac, offset);
-+}
-+
-+static inline void bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+      bgmac->idm_write(bgmac, offset, value);
-+}
-+
-+static inline bool bgmac_clk_enabled(struct bgmac *bgmac)
-+{
-+      return bgmac->clk_enabled(bgmac);
-+}
-+
-+static inline void bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
-+{
-+      bgmac->clk_enable(bgmac, flags);
-+}
-+
-+static inline void bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset,
-+                                       u32 mask, u32 set)
-+{
-+      bgmac->cco_ctl_maskset(bgmac, offset, mask, set);
-+}
-+
-+static inline u32 bgmac_get_bus_clock(struct bgmac *bgmac)
-+{
-+      return bgmac->get_bus_clock(bgmac);
-+}
-+
-+static inline void bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset,
-+                                     u32 mask, u32 set)
-+{
-+      bgmac->cmn_maskset32(bgmac, offset, mask, set);
- }
- static inline void bgmac_maskset(struct bgmac *bgmac, u16 offset, u32 mask,
diff --git a/target/linux/generic/patches-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch b/target/linux/generic/patches-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch
deleted file mode 100644 (file)
index e0431c1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-From 12c2e32f14da857b58af281b029d4549d24c3292 Mon Sep 17 00:00:00 2001
-From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-Date: Tue, 12 Jul 2016 00:17:28 +0000
-Subject: [PATCH] net: ethernet: bgmac: Fix return value check in bgmac_probe()
-
-In case of error, the function devm_ioremap_resource() returns ERR_PTR()
-and never returns NULL. The NULL test in the return value check should be
-replaced with IS_ERR().
-
-Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac-platform.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-platform.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
-@@ -141,7 +141,7 @@ static int bgmac_probe(struct platform_d
-       }
-       bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
--      if (!bgmac->plat.idm_base) {
-+      if (IS_ERR(bgmac->plat.idm_base)) {
-               dev_err(&pdev->dev, "Unable to map idm resource\n");
-               return PTR_ERR(bgmac->plat.idm_base);
-       }
diff --git a/target/linux/generic/patches-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch b/target/linux/generic/patches-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch
deleted file mode 100644 (file)
index 4790948..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-From ce3a380dddd0cb16cb3d8d947b69657d7646c121 Mon Sep 17 00:00:00 2001
-From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-Date: Wed, 13 Jul 2016 12:46:57 +0000
-Subject: [PATCH] net: ethernet: bgmac: Remove redundant dev_err call in
- bgmac_probe()
-
-There is a error message within devm_ioremap_resource
-already, so remove the dev_err call to avoid redundant
-error message.
-
-Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac-platform.c | 8 ++------
- 1 file changed, 2 insertions(+), 6 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-platform.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
-@@ -129,10 +129,8 @@ static int bgmac_probe(struct platform_d
-       }
-       bgmac->plat.base = devm_ioremap_resource(&pdev->dev, regs);
--      if (IS_ERR(bgmac->plat.base)) {
--              dev_err(&pdev->dev, "Unable to map base resource\n");
-+      if (IS_ERR(bgmac->plat.base))
-               return PTR_ERR(bgmac->plat.base);
--      }
-       regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
-       if (!regs) {
-@@ -141,10 +139,8 @@ static int bgmac_probe(struct platform_d
-       }
-       bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
--      if (IS_ERR(bgmac->plat.idm_base)) {
--              dev_err(&pdev->dev, "Unable to map idm resource\n");
-+      if (IS_ERR(bgmac->plat.idm_base))
-               return PTR_ERR(bgmac->plat.idm_base);
--      }
-       bgmac->read = platform_bgmac_read;
-       bgmac->write = platform_bgmac_write;
diff --git a/target/linux/generic/patches-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch b/target/linux/generic/patches-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch
deleted file mode 100644 (file)
index 945546d..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-From b9f63ae7ba2de2ba19137c5757c0607ce40f3ed5 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 17 Aug 2016 15:37:14 +0200
-Subject: [PATCH] net: bgmac: fix reversed check for MII registration error
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It was failing on successful registration returning meaningless errors.
-
-Signed-off-by: RafaÅ‚ MiÅ‚ecki <rafal@milecki.pl>
-Fixes: 55954f3bfdac ("net: ethernet: bgmac: move BCMA MDIO Phy code into a separate file")
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -159,7 +159,7 @@ static int bgmac_probe(struct bcma_devic
-       if (!bgmac_is_bcm4707_family(core)) {
-               mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
--              if (!IS_ERR(mii_bus)) {
-+              if (IS_ERR(mii_bus)) {
-                       err = PTR_ERR(mii_bus);
-                       goto err;
-               }
diff --git a/target/linux/generic/patches-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch b/target/linux/generic/patches-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch
deleted file mode 100644 (file)
index 82d3fe4..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-From 1cb94db3d1bfe0075bde78fb2989f17e0a8a3936 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 17 Aug 2016 23:00:30 +0200
-Subject: [PATCH] net: bgmac: support Ethernet core on BCM53573 SoCs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and can
-be found in two packages (versions): BCM53573 and BCM47189. It shares
-some code with the Northstar family, but also requires some new quirks.
-
-First of all there can be up to 2 Ethernet cores on this SoC. If that is
-the case, they are connected to two different switch ports allowing some
-more complex/optimized setups. It seems the second unit doesn't come
-fully configured and requires some IRQ quirk.
-
-Other than that only the first core is connected to the PHY. For the
-second one we have to register fixed PHY (similarly to the Northstar),
-otherwise generic PHY driver would get some invalid info.
-
-This has been successfully tested on Tenda AC9 (BCM47189B0).
-
-Signed-off-by: RafaÅ‚ MiÅ‚ecki <rafal@milecki.pl>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac-bcma.c | 19 ++++++++++++++++++-
- drivers/net/ethernet/broadcom/bgmac.c      | 25 +++++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.h      | 19 +++++++++++++++++++
- include/linux/bcma/bcma.h                  |  3 +++
- include/linux/bcma/bcma_regs.h             |  1 +
- 5 files changed, 66 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -92,6 +92,7 @@ MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
- static int bgmac_probe(struct bcma_device *core)
- {
-+      struct bcma_chipinfo *ci = &core->bus->chipinfo;
-       struct ssb_sprom *sprom = &core->bus->sprom;
-       struct mii_bus *mii_bus;
-       struct bgmac *bgmac;
-@@ -157,7 +158,8 @@ static int bgmac_probe(struct bcma_devic
-       dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
-                bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
--      if (!bgmac_is_bcm4707_family(core)) {
-+      if (!bgmac_is_bcm4707_family(core) &&
-+          !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
-               mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
-               if (IS_ERR(mii_bus)) {
-                       err = PTR_ERR(mii_bus);
-@@ -230,6 +232,21 @@ static int bgmac_probe(struct bcma_devic
-               bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-               bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-               break;
-+      case BCMA_CHIP_ID_BCM53573:
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              if (ci->pkg == BCMA_PKG_ID_BCM47189)
-+                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+              if (core->core_unit == 0) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_CC4_IF_SW_TYPE;
-+                      if (ci->pkg == BCMA_PKG_ID_BCM47189)
-+                              bgmac->feature_flags |=
-+                                      BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII;
-+              } else if (core->core_unit == 1) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_IRQ_ID_OOB_6;
-+                      bgmac->feature_flags |= BGMAC_FEAT_CC7_IF_TYPE_RGMII;
-+              }
-+              break;
-       default:
-               bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-               bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -943,6 +943,27 @@ static void bgmac_chip_reset(struct bgma
-               bgmac_cco_ctl_maskset(bgmac, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK |
-                                                 BGMAC_CHIPCTL_1_SW_TYPE_MASK),
-                                     sw_type);
-+      } else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE) {
-+              u32 sw_type = BGMAC_CHIPCTL_4_IF_TYPE_MII |
-+                            BGMAC_CHIPCTL_4_SW_TYPE_EPHY;
-+              u8 et_swtype = 0;
-+              char buf[4];
-+
-+              if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
-+                      if (kstrtou8(buf, 0, &et_swtype))
-+                              dev_err(bgmac->dev, "Failed to parse et_swtype (%s)\n",
-+                                      buf);
-+                      sw_type = (et_swtype & 0x0f) << 12;
-+              } else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII) {
-+                      sw_type = BGMAC_CHIPCTL_4_IF_TYPE_RGMII |
-+                                BGMAC_CHIPCTL_4_SW_TYPE_RGMII;
-+              }
-+              bgmac_cco_ctl_maskset(bgmac, 4, ~(BGMAC_CHIPCTL_4_IF_TYPE_MASK |
-+                                                BGMAC_CHIPCTL_4_SW_TYPE_MASK),
-+                                    sw_type);
-+      } else if (bgmac->feature_flags & BGMAC_FEAT_CC7_IF_TYPE_RGMII) {
-+              bgmac_cco_ctl_maskset(bgmac, 7, ~BGMAC_CHIPCTL_7_IF_TYPE_MASK,
-+                                    BGMAC_CHIPCTL_7_IF_TYPE_RGMII);
-       }
-       if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
-@@ -1486,6 +1507,10 @@ int bgmac_enet_probe(struct bgmac *info)
-        */
-       bgmac_clk_enable(bgmac, 0);
-+      /* This seems to be fixing IRQ by assigning OOB #6 to the core */
-+      if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6)
-+              bgmac_idm_write(bgmac, BCMA_OOB_SEL_OUT_A30, 0x86);
-+
-       bgmac_chip_reset(bgmac);
-       err = bgmac_dma_alloc(bgmac);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -369,6 +369,21 @@
- #define BGMAC_CHIPCTL_1_SW_TYPE_RGMII         0x000000C0
- #define BGMAC_CHIPCTL_1_RXC_DLL_BYPASS                0x00010000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_MASK          0x00003000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_RMII          0x00000000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_MII           0x00001000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_RGMII         0x00002000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_MASK          0x0000C000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHY          0x00000000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYMII               0x00004000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYRMII      0x00008000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_RGMII         0x0000C000
-+
-+#define BGMAC_CHIPCTL_7_IF_TYPE_MASK          0x000000C0
-+#define BGMAC_CHIPCTL_7_IF_TYPE_RMII          0x00000000
-+#define BGMAC_CHIPCTL_7_IF_TYPE_MII           0x00000040
-+#define BGMAC_CHIPCTL_7_IF_TYPE_RGMII         0x00000080
-+
- #define BGMAC_WEIGHT  64
- #define ETHER_MAX_LEN   1518
-@@ -390,6 +405,10 @@
- #define BGMAC_FEAT_NO_CLR_MIB         BIT(13)
- #define BGMAC_FEAT_FORCE_SPEED_2500   BIT(14)
- #define BGMAC_FEAT_CMDCFG_SR_REV4     BIT(15)
-+#define BGMAC_FEAT_IRQ_ID_OOB_6               BIT(16)
-+#define BGMAC_FEAT_CC4_IF_SW_TYPE     BIT(17)
-+#define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII       BIT(18)
-+#define BGMAC_FEAT_CC7_IF_TYPE_RGMII  BIT(19)
- struct bgmac_slot_info {
-       union {
---- a/include/linux/bcma/bcma_regs.h
-+++ b/include/linux/bcma/bcma_regs.h
-@@ -23,6 +23,7 @@
- #define  BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
- /* Agent registers (common for every core) */
-+#define BCMA_OOB_SEL_OUT_A30          0x0100
- #define BCMA_IOCTL                    0x0408 /* IO control */
- #define  BCMA_IOCTL_CLK                       0x0001
- #define  BCMA_IOCTL_FGC                       0x0002
diff --git a/target/linux/generic/patches-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch b/target/linux/generic/patches-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch
deleted file mode 100644 (file)
index 272ec5c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-From e2d8f646c79f26e094bfaf9b21be614d1e148a67 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 17 Aug 2016 23:11:52 +0200
-Subject: [PATCH] net: bgmac: make it clear when setting interface type to RMII
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It doesn't really change anything as BGMAC_CHIPCTL_1_IF_TYPE_RMII is
-equal to 0. It make code a bit clener, so far when reading it one could
-think we forgot to set a proper mode. It also keeps this mode code in
-sync with other ones.
-
-Signed-off-by: RafaÅ‚ MiÅ‚ecki <rafal@milecki.pl>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -935,7 +935,8 @@ static void bgmac_chip_reset(struct bgma
-                       et_swtype <<= 4;
-                       sw_type = et_swtype;
-               } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_EPHYRMII) {
--                      sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
-+                      sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RMII |
-+                                BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
-               } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_RGMII) {
-                       sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
-                                 BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
diff --git a/target/linux/generic/patches-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch b/target/linux/generic/patches-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch
deleted file mode 100644 (file)
index 830d8cc..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-From 4af1474e6198b10fee7bb20e81f7e033ad1b586c Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Wed, 5 Oct 2016 15:36:49 -0400
-Subject: [PATCH] net: bgmac: Fix errant feature flag check
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-During the conversion to the feature flags, a check against
-ci->id != BCMA_CHIP_ID_BCM47162
-became
-bgmac->feature_flags & BGMAC_FEAT_CLKCTLS
-instead of
-!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLS)
-
-Reported-by: RafaÅ‚ MiÅ‚ecki <zajec5@gmail.com>
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1049,7 +1049,7 @@ static void bgmac_enable(struct bgmac *b
-       mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
-               BGMAC_DS_MM_SHIFT;
--      if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0)
-+      if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) || mode != 0)
-               bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
-       if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2)
-               bgmac_cco_ctl_maskset(bgmac, 1, ~0,
diff --git a/target/linux/generic/patches-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch b/target/linux/generic/patches-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch
deleted file mode 100644 (file)
index 5721abc..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-From c121f72a66c5f92fbe2fc53baa274eef39875cec Mon Sep 17 00:00:00 2001
-From: Colin Ian King <colin.king@canonical.com>
-Date: Mon, 24 Oct 2016 23:46:18 +0100
-Subject: [PATCH] net: bgmac: fix spelling mistake: "connecton" -> "connection"
-
-trivial fix to spelling mistake in dev_err message
-
-Signed-off-by: Colin Ian King <colin.king@canonical.com>
-Acked-by: Jon Mason <jon.mason@broadcom.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1468,7 +1468,7 @@ static int bgmac_phy_connect(struct bgma
-       phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link,
-                             PHY_INTERFACE_MODE_MII);
-       if (IS_ERR(phy_dev)) {
--              dev_err(bgmac->dev, "PHY connecton failed\n");
-+              dev_err(bgmac->dev, "PHY connection failed\n");
-               return PTR_ERR(phy_dev);
-       }
diff --git a/target/linux/generic/patches-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch b/target/linux/generic/patches-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch
deleted file mode 100644 (file)
index e9bf06c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-From cdb26d3387f0cdf7b2a2eea581385173547ef21f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Mon, 7 Nov 2016 13:53:27 +0100
-Subject: [PATCH] net: bgmac: fix reversed checks for clock control flag
-
-This fixes regression introduced by patch adding feature flags. It was
-already reported and patch followed (it got accepted) but it appears it
-was incorrect. Instead of fixing reversed condition it broke a good one.
-
-This patch was verified to actually fix SoC hanges caused by bgmac on
-BCM47186B0.
-
-Fixes: db791eb2970b ("net: ethernet: bgmac: convert to feature flags")
-Fixes: 4af1474e6198 ("net: bgmac: Fix errant feature flag check")
-Cc: Jon Mason <jon.mason@broadcom.com>
-Signed-off-by: RafaÅ‚ MiÅ‚ecki <rafal@milecki.pl>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1049,9 +1049,9 @@ static void bgmac_enable(struct bgmac *b
-       mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
-               BGMAC_DS_MM_SHIFT;
--      if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) || mode != 0)
-+      if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0)
-               bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
--      if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2)
-+      if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) && mode == 2)
-               bgmac_cco_ctl_maskset(bgmac, 1, ~0,
-                                     BGMAC_CHIPCTL_1_RXC_DLL_BYPASS);
diff --git a/target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch b/target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch
new file mode 100644 (file)
index 0000000..6378ed4
--- /dev/null
@@ -0,0 +1,28 @@
+From 4b98deaa353d8f7af3f7543d0b59497fe1275599 Mon Sep 17 00:00:00 2001
+Message-Id: <4b98deaa353d8f7af3f7543d0b59497fe1275599.1520544136.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Thu, 8 Mar 2018 22:22:08 +0100
+Subject: [PATCH] Revert "led: core: Fix brightness setting when setting
+ delay_off=0"
+
+This reverts commit 20ac8f72514b3af8b62c520d55656ded865eff00.
+---
+ drivers/leds/led-core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
+index 92b6798ef5b3..c1c3af089634 100644
+--- a/drivers/leds/led-core.c
++++ b/drivers/leds/led-core.c
+@@ -149,7 +149,7 @@ void led_blink_set(struct led_classdev *led_cdev,
+                  unsigned long *delay_on,
+                  unsigned long *delay_off)
+ {
+-      led_stop_software_blink(led_cdev);
++      del_timer_sync(&led_cdev->blink_timer);
+       led_cdev->flags &= ~LED_BLINK_ONESHOT;
+       led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP;
+-- 
+2.16.2
+
index 2f834422cb052a9abd117458c5d836fcc7c9eb9a..b4235a11d40189b120304f889b3ca8f79271c701 100644 (file)
@@ -1,6 +1,6 @@
 --- a/Makefile
 +++ b/Makefile
-@@ -624,12 +624,12 @@ KBUILD_CFLAGS    += $(call cc-disable-warni
+@@ -626,12 +626,12 @@ KBUILD_CFLAGS    += $(call cc-disable-warni
  KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context)
  
  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
index d68c463648abfd50d6956c96070eb6f282a2db77..1aabf3e722dd2ae34f1e176c7462a73111eea639 100644 (file)
@@ -1,6 +1,6 @@
 --- a/Makefile
 +++ b/Makefile
-@@ -403,7 +403,7 @@ KBUILD_CFLAGS_KERNEL :=
+@@ -405,7 +405,7 @@ KBUILD_CFLAGS_KERNEL :=
  KBUILD_AFLAGS   := -D__ASSEMBLY__ $(call cc-option,-fno-PIE)
  KBUILD_AFLAGS_MODULE  := -DMODULE
  KBUILD_CFLAGS_MODULE  := -DMODULE
index 85805b3ea1c4960efa1d0601e57e8f5dc501ec61..a661f98c659fb2de891b107acf2396c590f84996 100644 (file)
@@ -89,7 +89,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
 --- a/init/Kconfig
 +++ b/init/Kconfig
-@@ -2026,6 +2026,13 @@ config MODULE_COMPRESS_XZ
+@@ -2033,6 +2033,13 @@ config MODULE_COMPRESS_XZ
  
  endchoice
  
@@ -105,7 +105,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  config MODULES_TREE_LOOKUP
 --- a/kernel/module.c
 +++ b/kernel/module.c
-@@ -2864,6 +2864,7 @@ static struct module *setup_load_info(st
+@@ -2880,6 +2880,7 @@ static void check_modinfo_retpoline(stru
  
  static int check_modinfo(struct module *mod, struct load_info *info, int flags)
  {
@@ -113,7 +113,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        const char *modmagic = get_modinfo(info, "vermagic");
        int err;
  
-@@ -2889,6 +2890,7 @@ static int check_modinfo(struct module *
+@@ -2911,6 +2912,7 @@ static int check_modinfo(struct module *
                pr_warn("%s: module is from the staging directory, the quality "
                        "is unknown, you have been warned.\n", mod->name);
        }
@@ -123,7 +123,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        set_license(mod, get_modinfo(info, "license"));
 --- a/scripts/mod/modpost.c
 +++ b/scripts/mod/modpost.c
-@@ -1963,7 +1963,9 @@ static void read_symbols(char *modname)
+@@ -1964,7 +1964,9 @@ static void read_symbols(char *modname)
                symname = remove_dot(info.strtab + sym->st_name);
  
                handle_modversions(mod, &info, sym, symname);
@@ -133,7 +133,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        }
        if (!is_vmlinux(modname) ||
             (is_vmlinux(modname) && vmlinux_section_warnings))
-@@ -2107,7 +2109,9 @@ static void add_header(struct buffer *b,
+@@ -2108,7 +2110,9 @@ static void add_header(struct buffer *b,
        buf_printf(b, "#include <linux/vermagic.h>\n");
        buf_printf(b, "#include <linux/compiler.h>\n");
        buf_printf(b, "\n");
@@ -143,7 +143,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        buf_printf(b, "\n");
        buf_printf(b, "__visible struct module __this_module\n");
        buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
-@@ -2124,16 +2128,20 @@ static void add_header(struct buffer *b,
+@@ -2125,8 +2129,10 @@ static void add_header(struct buffer *b,
  
  static void add_intree_flag(struct buffer *b, int is_intree)
  {
@@ -153,6 +153,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +#endif
  }
  
+ /* Cannot check for assembler */
+@@ -2139,10 +2145,12 @@ static void add_retpoline(struct buffer
  static void add_staging_flag(struct buffer *b, const char *name)
  {
 +#ifndef CONFIG_MODULE_STRIPPED
@@ -164,7 +167,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  /* In kernel, this size is defined in linux/module.h;
-@@ -2237,11 +2245,13 @@ static void add_depends(struct buffer *b
+@@ -2246,11 +2254,13 @@ static void add_depends(struct buffer *b
  
  static void add_srcversion(struct buffer *b, struct module *mod)
  {
@@ -178,7 +181,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  static void write_if_changed(struct buffer *b, const char *fname)
-@@ -2475,7 +2485,9 @@ int main(int argc, char **argv)
+@@ -2485,7 +2495,9 @@ int main(int argc, char **argv)
                add_staging_flag(&buf, mod->name);
                err |= add_versions(&buf, mod);
                add_depends(&buf, mod, modules);
index 510a86c46893b7cfbb1d50eceb8959b125e70651..44c0a6dec623448c37b2f49fbaaa60b78d280304 100644 (file)
@@ -54,7 +54,7 @@
        }
 --- a/scripts/Makefile.build
 +++ b/scripts/Makefile.build
-@@ -299,7 +299,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
+@@ -372,7 +372,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
  # Linker scripts preprocessor (.lds.S -> .lds)
  # ---------------------------------------------------------------------------
  quiet_cmd_cpp_lds_S = LDS     $@
index da3111266a60e80cc01c0099a597e7299ba216fe..462f7f42cb6bc7c2f9f615cb2a6d0800987f8876 100644 (file)
@@ -11,7 +11,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 
 --- a/drivers/mtd/ubi/block.c
 +++ b/drivers/mtd/ubi/block.c
-@@ -628,6 +628,44 @@ static void __init ubiblock_create_from_
+@@ -636,6 +636,44 @@ static void __init ubiblock_create_from_
        }
  }
  
@@ -56,7 +56,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  static void ubiblock_remove_all(void)
  {
        struct ubiblock *next;
-@@ -658,6 +696,10 @@ int __init ubiblock_init(void)
+@@ -668,6 +706,10 @@ int __init ubiblock_init(void)
         */
        ubiblock_create_from_param();
  
index f55e8e3a4d12f3883de8f6805051ba7a97f688d6..9fbfc79927aef2704250fea3ed444d563ab27b16 100644 (file)
@@ -19,7 +19,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  
  #include "ubi-media.h"
  #include "ubi.h"
-@@ -448,6 +449,15 @@ int ubiblock_create(struct ubi_volume_in
+@@ -447,6 +448,15 @@ int ubiblock_create(struct ubi_volume_in
        add_disk(dev->gd);
        dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
                 dev->ubi_num, dev->vol_id, vi->name);
@@ -32,6 +32,6 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 +              ROOT_DEV = MKDEV(gd->major, gd->first_minor);
 +      }
 +
+       mutex_unlock(&devices_mutex);
        return 0;
  
- out_free_queue:
index ea9558fccfb44dacdf9accb38a9c962c81e06c3c..257bcf79ee7ff928d1e22f75a4da8e21d0f5b91b 100644 (file)
  static bool
  ip_checkentry(const struct ipt_ip *ip)
  {
-@@ -664,6 +690,8 @@ find_check_entry(struct ipt_entry *e, st
-       struct xt_mtchk_param mtpar;
+@@ -655,6 +681,8 @@ find_check_entry(struct ipt_entry *e, st
        struct xt_entry_match *ematch;
+       unsigned long pcnt;
  
 +      ip_checkdefault(&e->ip);
 +
-       e->counters.pcnt = xt_percpu_counter_alloc();
-       if (IS_ERR_VALUE(e->counters.pcnt))
+       pcnt = xt_percpu_counter_alloc();
+       if (IS_ERR_VALUE(pcnt))
                return -ENOMEM;
-@@ -948,6 +976,7 @@ copy_entries_to_user(unsigned int total_
+@@ -953,6 +981,7 @@ copy_entries_to_user(unsigned int total_
        const struct xt_table_info *private = table->private;
        int ret = 0;
        const void *loc_cpu_entry;
@@ -67,7 +67,7 @@
  
        counters = alloc_counters(table);
        if (IS_ERR(counters))
-@@ -974,6 +1003,14 @@ copy_entries_to_user(unsigned int total_
+@@ -979,6 +1008,14 @@ copy_entries_to_user(unsigned int total_
                        ret = -EFAULT;
                        goto free_counters;
                }
diff --git a/target/linux/generic/patches-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch b/target/linux/generic/patches-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch
new file mode 100644 (file)
index 0000000..2ec9c7a
--- /dev/null
@@ -0,0 +1,86 @@
+From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Date: Mon, 21 Aug 2017 11:14:14 +0300
+Subject: [PATCH] net_sched/codel: do not defer queue length update
+
+When codel wants to drop last packet in ->dequeue() it cannot call
+qdisc_tree_reduce_backlog() right away - it will notify parent qdisc
+about zero qlen and HTB/HFSC will deactivate class. The same class will
+be deactivated second time by caller of ->dequeue(). Currently codel and
+fq_codel defer update. This triggers warning in HFSC when it's qlen != 0
+but there is no active classes.
+
+This patch update parent queue length immediately: just temporary increase
+qlen around qdisc_tree_reduce_backlog() to prevent first class deactivation
+if we have skb to return.
+
+This might open another problem in HFSC - now operation peek could fail and
+deactivate parent class.
+
+Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=109581
+---
+
+--- a/net/sched/sch_codel.c
++++ b/net/sched/sch_codel.c
+@@ -79,11 +79,17 @@ static struct sk_buff *codel_qdisc_deque
+       skb = codel_dequeue(sch, &q->params, &q->vars, &q->stats, dequeue);
+-      /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0,
+-       * or HTB crashes. Defer it for next round.
++      /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate
++       * parent class, dequeue in parent qdisc will do the same if we
++       * return skb. Temporary increment qlen if we have skb.
+        */
+-      if (q->stats.drop_count && sch->q.qlen) {
+-              qdisc_tree_reduce_backlog(sch, q->stats.drop_count, q->stats.drop_len);
++      if (q->stats.drop_count) {
++              if (skb)
++                      sch->q.qlen++;
++              qdisc_tree_reduce_backlog(sch, q->stats.drop_count,
++                                        q->stats.drop_len);
++              if (skb)
++                      sch->q.qlen--;
+               q->stats.drop_count = 0;
+               q->stats.drop_len = 0;
+       }
+--- a/net/sched/sch_fq_codel.c
++++ b/net/sched/sch_fq_codel.c
+@@ -311,6 +311,21 @@ begin:
+       flow->dropped += q->cstats.drop_count - prev_drop_count;
+       flow->dropped += q->cstats.ecn_mark - prev_ecn_mark;
++      /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate
++       * parent class, dequeue in parent qdisc will do the same if we
++       * return skb. Temporary increment qlen if we have skb.
++       */
++      if (q->cstats.drop_count) {
++              if (skb)
++                      sch->q.qlen++;
++              qdisc_tree_reduce_backlog(sch, q->cstats.drop_count,
++                                        q->cstats.drop_len);
++              if (skb)
++                      sch->q.qlen--;
++              q->cstats.drop_count = 0;
++              q->cstats.drop_len = 0;
++      }
++
+       if (!skb) {
+               /* force a pass through old_flows to prevent starvation */
+               if ((head == &q->new_flows) && !list_empty(&q->old_flows))
+@@ -321,15 +336,6 @@ begin:
+       }
+       qdisc_bstats_update(sch, skb);
+       flow->deficit -= qdisc_pkt_len(skb);
+-      /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0,
+-       * or HTB crashes. Defer it for next round.
+-       */
+-      if (q->cstats.drop_count && sch->q.qlen) {
+-              qdisc_tree_reduce_backlog(sch, q->cstats.drop_count,
+-                                        q->cstats.drop_len);
+-              q->cstats.drop_count = 0;
+-              q->cstats.drop_len = 0;
+-      }
+       return skb;
+ }
diff --git a/target/linux/generic/patches-4.4/650-pppoe_header_pad.patch b/target/linux/generic/patches-4.4/650-pppoe_header_pad.patch
deleted file mode 100644 (file)
index 409de58..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/net/ppp/pppoe.c
-+++ b/drivers/net/ppp/pppoe.c
-@@ -879,7 +879,7 @@ static int pppoe_sendmsg(struct socket *
-               goto end;
--      skb = sock_wmalloc(sk, total_len + dev->hard_header_len + 32,
-+      skb = sock_wmalloc(sk, total_len + dev->hard_header_len + 32 + NET_SKB_PAD,
-                          0, GFP_KERNEL);
-       if (!skb) {
-               error = -ENOMEM;
-@@ -887,7 +887,7 @@ static int pppoe_sendmsg(struct socket *
-       }
-       /* Reserve space for headers. */
--      skb_reserve(skb, dev->hard_header_len);
-+      skb_reserve(skb, dev->hard_header_len + NET_SKB_PAD);
-       skb_reset_network_header(skb);
-       skb->dev = dev;
index 5f46885708adbc2b1d9b56efe3e770b217c61c95..b11104be9e49b542eddd3f1d53f7626f50f70484 100644 (file)
@@ -1,6 +1,6 @@
 --- a/net/netlink/af_netlink.c
 +++ b/net/netlink/af_netlink.c
-@@ -1228,24 +1228,7 @@ void netlink_detachskb(struct sock *sk,
+@@ -1231,24 +1231,7 @@ void netlink_detachskb(struct sock *sk,
  
  static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
  {
index 46fceffcf174f4b37a9a0aac9eba1d1e0505ef24..fbe900891c4faa1b7c6c63d0c03e435fa5d41ad6 100644 (file)
@@ -1,6 +1,6 @@
 --- a/net/sched/sch_fq_codel.c
 +++ b/net/sched/sch_fq_codel.c
-@@ -471,7 +471,7 @@ static int fq_codel_init(struct Qdisc *s
+@@ -477,7 +477,7 @@ static int fq_codel_init(struct Qdisc *s
  
        sch->limit = 10*1024;
        q->flows_cnt = 1024;
index 9d1962caa93f5543188809dff589750dce9d81f0..8d70b82350ee42ba7e1e1ab41b7d9555d70b719a 100644 (file)
@@ -13,7 +13,7 @@
          device, it has to decide which ones to send first, which ones to
 --- a/net/sched/sch_fq_codel.c
 +++ b/net/sched/sch_fq_codel.c
-@@ -688,7 +688,7 @@ static const struct Qdisc_class_ops fq_c
+@@ -694,7 +694,7 @@ static const struct Qdisc_class_ops fq_c
        .walk           =       fq_codel_walk,
  };
  
@@ -22,7 +22,7 @@
        .cl_ops         =       &fq_codel_class_ops,
        .id             =       "fq_codel",
        .priv_size      =       sizeof(struct fq_codel_sched_data),
-@@ -704,6 +704,7 @@ static struct Qdisc_ops fq_codel_qdisc_o
+@@ -710,6 +710,7 @@ static struct Qdisc_ops fq_codel_qdisc_o
        .dump_stats =   fq_codel_dump_stats,
        .owner          =       THIS_MODULE,
  };
index c402e04291f74a00a797ef85689ddfddaa7b3cb5..fe599798ce3a54a24638786e069faf95fbbd8ef4 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
 
 --- a/include/net/ip6_tunnel.h
 +++ b/include/net/ip6_tunnel.h
-@@ -15,6 +15,18 @@
+@@ -17,6 +17,18 @@
  /* determine capability on a per-packet basis */
  #define IP6_TNL_F_CAP_PER_PACKET 0x40000
  
@@ -35,7 +35,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  struct __ip6_tnl_parm {
        char name[IFNAMSIZ];    /* name of tunnel device */
        int link;               /* ifindex of underlying L2 interface */
-@@ -25,6 +37,7 @@ struct __ip6_tnl_parm {
+@@ -27,6 +39,7 @@ struct __ip6_tnl_parm {
        __u32 flags;            /* tunnel flags */
        struct in6_addr laddr;  /* local tunnel end-point address */
        struct in6_addr raddr;  /* remote tunnel end-point address */
@@ -94,7 +94,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  }
  
  static int ip6_tnl_dev_init(struct net_device *dev);
-@@ -230,20 +230,29 @@ EXPORT_SYMBOL_GPL(ip6_tnl_dst_init);
+@@ -139,20 +139,29 @@ static struct net_device_stats *ip6_get_
  static struct ip6_tnl *
  ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local)
  {
@@ -129,7 +129,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
        for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
                if (ipv6_addr_equal(local, &t->parms.laddr) &&
                    ipv6_addr_any(&t->parms.raddr) &&
-@@ -251,7 +260,7 @@ ip6_tnl_lookup(struct net *net, const st
+@@ -160,7 +169,7 @@ ip6_tnl_lookup(struct net *net, const st
                        return t;
        }
  
@@ -138,7 +138,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
        for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
                if (ipv6_addr_equal(remote, &t->parms.raddr) &&
                    ipv6_addr_any(&t->parms.laddr) &&
-@@ -287,7 +296,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n,
+@@ -196,7 +205,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n,
  
        if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) {
                prio = 1;
@@ -147,7 +147,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
        }
        return &ip6n->tnls[prio][h];
  }
-@@ -460,6 +469,12 @@ ip6_tnl_dev_uninit(struct net_device *de
+@@ -369,6 +378,12 @@ ip6_tnl_dev_uninit(struct net_device *de
        struct net *net = t->net;
        struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
  
@@ -160,7 +160,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
        if (dev == ip6n->fb_tnl_dev)
                RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL);
        else
-@@ -856,6 +871,108 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t,
+@@ -765,6 +780,108 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t,
  }
  EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl);
  
@@ -269,7 +269,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  /**
   * ip6_tnl_rcv - decapsulate IPv6 packet and retransmit it locally
   *   @skb: received socket buffer
-@@ -901,6 +1018,26 @@ static int ip6_tnl_rcv(struct sk_buff *s
+@@ -810,6 +927,26 @@ static int ip6_tnl_rcv(struct sk_buff *s
                skb_reset_network_header(skb);
                skb->protocol = htons(protocol);
                memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
@@ -296,7 +296,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  
                __skb_tunnel_rx(skb, t->dev, t->net);
  
-@@ -1247,6 +1384,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1145,6 +1282,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
        __u32 mtu;
        u8 tproto;
        int err;
@@ -304,7 +304,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  
        tproto = ACCESS_ONCE(t->parms.proto);
        if ((tproto != IPPROTO_IPV6 && tproto != 0) ||
-@@ -1277,6 +1415,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1175,6 +1313,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
                fl6.flowi6_mark = skb->mark;
  
@@ -323,7 +323,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
        err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu);
        if (err != 0) {
                if (err == -EMSGSIZE)
-@@ -1391,6 +1541,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
+@@ -1289,6 +1439,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
        t->parms.flowinfo = p->flowinfo;
        t->parms.link = p->link;
        t->parms.proto = p->proto;
@@ -335,10 +335,10 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
 +      }
 +      t->parms.fmrs = p->fmrs;
 +
-       ip6_tnl_dst_reset(t);
+       dst_cache_reset(&t->dst_cache);
        ip6_tnl_link_config(t);
        return 0;
-@@ -1429,6 +1587,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
+@@ -1327,6 +1485,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
        p->flowinfo = u->flowinfo;
        p->link = u->link;
        p->proto = u->proto;
@@ -346,7 +346,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
        memcpy(p->name, u->name, sizeof(u->name));
  }
  
-@@ -1724,6 +1883,15 @@ static int ip6_tnl_validate(struct nlatt
+@@ -1622,6 +1781,15 @@ static int ip6_tnl_validate(struct nlatt
        return 0;
  }
  
@@ -362,7 +362,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  static void ip6_tnl_netlink_parms(struct nlattr *data[],
                                  struct __ip6_tnl_parm *parms)
  {
-@@ -1755,6 +1923,46 @@ static void ip6_tnl_netlink_parms(struct
+@@ -1653,6 +1821,46 @@ static void ip6_tnl_netlink_parms(struct
  
        if (data[IFLA_IPTUN_PROTO])
                parms->proto = nla_get_u8(data[IFLA_IPTUN_PROTO]);
@@ -409,7 +409,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  }
  
  static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev,
-@@ -1807,6 +2015,12 @@ static void ip6_tnl_dellink(struct net_d
+@@ -1705,6 +1913,12 @@ static void ip6_tnl_dellink(struct net_d
  
  static size_t ip6_tnl_get_size(const struct net_device *dev)
  {
@@ -422,7 +422,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
        return
                /* IFLA_IPTUN_LINK */
                nla_total_size(4) +
-@@ -1824,6 +2038,24 @@ static size_t ip6_tnl_get_size(const str
+@@ -1722,6 +1936,24 @@ static size_t ip6_tnl_get_size(const str
                nla_total_size(4) +
                /* IFLA_IPTUN_PROTO */
                nla_total_size(1) +
@@ -447,7 +447,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
                0;
  }
  
-@@ -1831,6 +2063,9 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -1729,6 +1961,9 @@ static int ip6_tnl_fill_info(struct sk_b
  {
        struct ip6_tnl *tunnel = netdev_priv(dev);
        struct __ip6_tnl_parm *parm = &tunnel->parms;
@@ -457,7 +457,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  
        if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
            nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) ||
-@@ -1839,8 +2074,27 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -1737,8 +1972,27 @@ static int ip6_tnl_fill_info(struct sk_b
            nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) ||
            nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) ||
            nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) ||
@@ -486,7 +486,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
        return 0;
  
  nla_put_failure:
-@@ -1864,6 +2118,7 @@ static const struct nla_policy ip6_tnl_p
+@@ -1762,6 +2016,7 @@ static const struct nla_policy ip6_tnl_p
        [IFLA_IPTUN_FLOWINFO]           = { .type = NLA_U32 },
        [IFLA_IPTUN_FLAGS]              = { .type = NLA_U32 },
        [IFLA_IPTUN_PROTO]              = { .type = NLA_U8 },
index 4bf34c128e87898c5b5bb87ed446751d8805381f..c921a079aef3f56bce7599c44c075180cbcde05a 100644 (file)
@@ -143,7 +143,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  static const struct rt6_info ip6_blk_hole_entry_template = {
        .dst = {
                .__refcnt       = ATOMIC_INIT(1),
-@@ -1898,6 +1915,11 @@ static struct rt6_info *ip6_route_info_c
+@@ -1899,6 +1916,11 @@ static struct rt6_info *ip6_route_info_c
                        rt->dst.output = ip6_pkt_prohibit_out;
                        rt->dst.input = ip6_pkt_prohibit;
                        break;
@@ -155,7 +155,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
                case RTN_THROW:
                case RTN_UNREACHABLE:
                default:
-@@ -2501,6 +2523,17 @@ static int ip6_pkt_prohibit_out(struct n
+@@ -2502,6 +2524,17 @@ static int ip6_pkt_prohibit_out(struct n
        return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
  }
  
@@ -173,7 +173,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  /*
   *    Allocate a dst for local (unicast / anycast) address.
   */
-@@ -2743,7 +2776,8 @@ static int rtm_to_fib6_config(struct sk_
+@@ -2744,7 +2777,8 @@ static int rtm_to_fib6_config(struct sk_
        if (rtm->rtm_type == RTN_UNREACHABLE ||
            rtm->rtm_type == RTN_BLACKHOLE ||
            rtm->rtm_type == RTN_PROHIBIT ||
@@ -183,7 +183,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
                cfg->fc_flags |= RTF_REJECT;
  
        if (rtm->rtm_type == RTN_LOCAL)
-@@ -3096,6 +3130,9 @@ static int rt6_fill_node(struct net *net
+@@ -3097,6 +3131,9 @@ static int rt6_fill_node(struct net *net
                case -EACCES:
                        rtm->rtm_type = RTN_PROHIBIT;
                        break;
@@ -193,7 +193,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
                case -EAGAIN:
                        rtm->rtm_type = RTN_THROW;
                        break;
-@@ -3375,6 +3412,8 @@ static int ip6_route_dev_notify(struct n
+@@ -3376,6 +3413,8 @@ static int ip6_route_dev_notify(struct n
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
                net->ipv6.ip6_prohibit_entry->dst.dev = dev;
                net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
@@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
                net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
                net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
  #endif
-@@ -3601,6 +3640,17 @@ static int __net_init ip6_route_net_init
+@@ -3602,6 +3641,17 @@ static int __net_init ip6_route_net_init
        net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
        dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
                         ip6_template_metrics, true);
@@ -220,7 +220,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
  
        net->ipv6.sysctl.flush_delay = 0;
-@@ -3619,6 +3669,8 @@ out:
+@@ -3620,6 +3670,8 @@ out:
        return ret;
  
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
@@ -229,7 +229,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  out_ip6_prohibit_entry:
        kfree(net->ipv6.ip6_prohibit_entry);
  out_ip6_null_entry:
-@@ -3636,6 +3688,7 @@ static void __net_exit ip6_route_net_exi
+@@ -3637,6 +3689,7 @@ static void __net_exit ip6_route_net_exi
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
        kfree(net->ipv6.ip6_prohibit_entry);
        kfree(net->ipv6.ip6_blk_hole_entry);
@@ -237,7 +237,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
        dst_entries_destroy(&net->ipv6.ip6_dst_ops);
  }
-@@ -3709,6 +3762,9 @@ void __init ip6_route_init_special_entri
+@@ -3710,6 +3763,9 @@ void __init ip6_route_init_special_entri
        init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
        init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
        init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
index d91db1fe733e88af47c815db3ec000ce44d06835..7c96f4f171878ebaac9b749c875017062ba64cb6 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -4260,6 +4260,9 @@ static enum gro_result dev_gro_receive(s
+@@ -4271,6 +4271,9 @@ static enum gro_result dev_gro_receive(s
        enum gro_result ret;
        int grow;
  
@@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (!(skb->dev->features & NETIF_F_GRO))
                goto normal;
  
-@@ -5426,6 +5429,48 @@ static void __netdev_adjacent_dev_unlink
+@@ -5437,6 +5440,48 @@ static void __netdev_adjacent_dev_unlink
                                           &upper_dev->adj_list.lower);
  }
  
@@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static int __netdev_upper_dev_link(struct net_device *dev,
                                   struct net_device *upper_dev, bool master,
                                   void *private)
-@@ -5497,6 +5542,7 @@ static int __netdev_upper_dev_link(struc
+@@ -5508,6 +5553,7 @@ static int __netdev_upper_dev_link(struc
                        goto rollback_lower_mesh;
        }
  
@@ -84,7 +84,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
                                      &changeupper_info.info);
        return 0;
-@@ -5623,6 +5669,7 @@ void netdev_upper_dev_unlink(struct net_
+@@ -5634,6 +5680,7 @@ void netdev_upper_dev_unlink(struct net_
        list_for_each_entry(i, &upper_dev->all_adj_list.upper, list)
                __netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr);
  
@@ -92,7 +92,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
                                      &changeupper_info.info);
  }
-@@ -6163,6 +6210,7 @@ int dev_set_mac_address(struct net_devic
+@@ -6174,6 +6221,7 @@ int dev_set_mac_address(struct net_devic
        if (err)
                return err;
        dev->addr_assign_type = NET_ADDR_SET;
index 6cb3fdfd4431674ca4f816a5e113fa1b60cf3a7f..39b8fd46609d79ec15894d4533a7d10ba3cb2e98 100644 (file)
@@ -53,7 +53,7 @@
   * @phydev: the phy_device struct
 --- a/include/linux/phy.h
 +++ b/include/linux/phy.h
-@@ -796,6 +796,7 @@ void phy_start_machine(struct phy_device
+@@ -807,6 +807,7 @@ void phy_start_machine(struct phy_device
  void phy_stop_machine(struct phy_device *phydev);
  int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
  int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
index 4886dd0e3aa7e023ab97103a877867bc63053612..d78f3d48a7bf805261b5e98ff07920bcd5e69d9b 100644 (file)
@@ -46,7 +46,7 @@
                phy_device_free(phydev);
 --- a/include/linux/phy.h
 +++ b/include/linux/phy.h
-@@ -835,6 +835,23 @@ void mdio_bus_exit(void);
+@@ -846,6 +846,23 @@ void mdio_bus_exit(void);
  
  extern struct bus_type mdio_bus_type;
  
diff --git a/target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch b/target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch
deleted file mode 100644 (file)
index b3cb087..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-Register switch connected to srab
-
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -11,6 +11,7 @@
- #include <linux/bcma/bcma.h>
- #include <linux/etherdevice.h>
-+#include <linux/platform_data/b53.h>
- #include <linux/bcm47xx_nvram.h>
- #include "bgmac.h"
-@@ -1403,6 +1404,17 @@ static const struct ethtool_ops bgmac_et
-       .get_drvinfo            = bgmac_get_drvinfo,
- };
-+static struct b53_platform_data bgmac_b53_pdata = {
-+};
-+
-+static struct platform_device bgmac_b53_dev = {
-+      .name           = "b53-srab-switch",
-+      .id             = -1,
-+      .dev            = {
-+              .platform_data = &bgmac_b53_pdata,
-+      },
-+};
-+
- /**************************************************
-  * MII
-  **************************************************/
-@@ -1549,6 +1561,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
-       net_dev->hw_features = net_dev->features;
-       net_dev->vlan_features = net_dev->features;
-+      if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) {
-+              bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000);
-+
-+              err = platform_device_register(&bgmac_b53_dev);
-+              if (!err)
-+                      bgmac->b53_device = &bgmac_b53_dev;
-+      }
-+
-       err = register_netdev(bgmac->net_dev);
-       if (err) {
-               dev_err(bgmac->dev, "Cannot register net device\n");
-@@ -1571,6 +1591,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
- void bgmac_enet_remove(struct bgmac *bgmac)
- {
-+      if (bgmac->b53_device)
-+              platform_device_unregister(&bgmac_b53_dev);
-+      bgmac->b53_device = NULL;
-+
-       unregister_netdev(bgmac->net_dev);
-       phy_disconnect(bgmac->net_dev->phydev);
-       netif_napi_del(&bgmac->napi);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -409,6 +409,7 @@
- #define BGMAC_FEAT_CC4_IF_SW_TYPE     BIT(17)
- #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII       BIT(18)
- #define BGMAC_FEAT_CC7_IF_TYPE_RGMII  BIT(19)
-+#define BGMAC_FEAT_SRAB                       BIT(20)
- struct bgmac_slot_info {
-       union {
-@@ -513,6 +514,9 @@ struct bgmac {
-       u32 (*get_bus_clock)(struct bgmac *bgmac);
-       void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
-                             u32 set);
-+
-+      /* platform device for associated switch */
-+      struct platform_device *b53_device;
- };
- struct bgmac *bgmac_alloc(struct device *dev);
---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -236,6 +236,7 @@ static int bgmac_probe(struct bcma_devic
-               bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-               bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-               bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-+              bgmac->feature_flags |= BGMAC_FEAT_SRAB;
-               break;
-       case BCMA_CHIP_ID_BCM53573:
-               bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
index c3d187a098d3e16e7ed534ab427b67b81cfb503e..ad636344793cd456cb18f48b4e576f8599f3ddc0 100644 (file)
@@ -69,7 +69,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  /**
   *    ata_build_rw_tf - Build ATA taskfile for given read/write request
   *    @tf: Target ATA taskfile
-@@ -4780,6 +4793,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
+@@ -4781,6 +4794,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
                if (tag < 0)
                        return NULL;
        }
@@ -79,7 +79,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  
        qc = __ata_qc_from_tag(ap, tag);
        qc->tag = tag;
-@@ -5677,6 +5693,9 @@ struct ata_port *ata_port_alloc(struct a
+@@ -5678,6 +5694,9 @@ struct ata_port *ata_port_alloc(struct a
        ap->stats.unhandled_irq = 1;
        ap->stats.idle_irq = 1;
  #endif
@@ -89,7 +89,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
        ata_sff_port_init(ap);
  
        return ap;
-@@ -5698,6 +5717,12 @@ static void ata_host_release(struct devi
+@@ -5699,6 +5718,12 @@ static void ata_host_release(struct devi
  
                kfree(ap->pmp_link);
                kfree(ap->slave_link);
@@ -102,7 +102,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
                kfree(ap);
                host->ports[i] = NULL;
        }
-@@ -6144,7 +6169,23 @@ int ata_host_register(struct ata_host *h
+@@ -6145,7 +6170,23 @@ int ata_host_register(struct ata_host *h
                host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
                host->ports[i]->local_port_no = i + 1;
        }
index fa9f37b71664a78732dea9b7fbd67216ef8b3b9a..4733d1b79c35c3fa2632e2a6fca494a7ca63e55c 100644 (file)
@@ -39,7 +39,7 @@
  
 --- a/net/ipv4/Kconfig
 +++ b/net/ipv4/Kconfig
-@@ -414,6 +414,7 @@ config INET_LRO
+@@ -415,6 +415,7 @@ config INET_LRO
  
  config INET_DIAG
        tristate "INET: socket monitoring interface"
index 5aada68e31e4cb673325df445d21ce1ffb62bf50..931f43fce4810c8be0e72d0bba2c9dcb96c3572d 100644 (file)
@@ -1,6 +1,6 @@
 --- a/fs/locks.c
 +++ b/fs/locks.c
-@@ -2712,6 +2712,8 @@ static const struct file_operations proc
+@@ -2716,6 +2716,8 @@ static const struct file_operations proc
  
  static int __init proc_locks_init(void)
  {
  }
 --- a/mm/vmstat.c
 +++ b/mm/vmstat.c
-@@ -1555,10 +1555,12 @@ static int __init setup_vmstat(void)
+@@ -1558,10 +1558,12 @@ static int __init setup_vmstat(void)
        cpu_notifier_register_done();
  #endif
  #ifdef CONFIG_PROC_FS
  
 --- a/ipc/msg.c
 +++ b/ipc/msg.c
-@@ -1068,6 +1068,9 @@ void __init msg_init(void)
+@@ -1071,6 +1071,9 @@ void __init msg_init(void)
  {
        msg_init_ns(&init_ipc_ns);
  
diff --git a/target/linux/generic/patches-4.4/903-debloat_direct_io.patch b/target/linux/generic/patches-4.4/903-debloat_direct_io.patch
deleted file mode 100644 (file)
index 82e6a6b..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -74,6 +74,11 @@ config FILE_LOCKING
-           for filesystems like NFS and for the flock() system
-           call. Disabling this option saves about 11k.
-+config DIRECT_IO
-+      bool "Enable O_DIRECT support" if EXPERT
-+      depends on BLOCK
-+      default y
-+
- source "fs/notify/Kconfig"
- source "fs/quota/Kconfig"
---- a/fs/Makefile
-+++ b/fs/Makefile
-@@ -14,7 +14,8 @@ obj-y :=     open.o read_write.o file_table.
-               stack.o fs_struct.o statfs.o fs_pin.o nsfs.o
- ifeq ($(CONFIG_BLOCK),y)
--obj-y +=      buffer.o block_dev.o direct-io.o mpage.o
-+obj-y +=      buffer.o block_dev.o mpage.o
-+obj-$(CONFIG_DIRECT_IO) += direct-io.o
- else
- obj-y +=      no-block.o
- endif
---- a/include/linux/fs.h
-+++ b/include/linux/fs.h
-@@ -2722,6 +2722,7 @@ enum {
-       DIO_SKIP_DIO_COUNT = 0x08,
- };
-+#ifdef CONFIG_DIRECT_IO
- void dio_end_io(struct bio *bio, int error);
- ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
-@@ -2729,6 +2730,18 @@ ssize_t __blockdev_direct_IO(struct kioc
-                            loff_t offset, get_block_t get_block,
-                            dio_iodone_t end_io, dio_submit_t submit_io,
-                            int flags);
-+#else
-+static inline void dio_end_io(struct bio *bio, int error)
-+{
-+}
-+static inline ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
-+      struct block_device *bdev, struct iov_iter *iter, loff_t offset,
-+      get_block_t get_block, dio_iodone_t end_io,
-+      dio_submit_t submit_io, int flags)
-+{
-+      return -EOPNOTSUPP;
-+}
-+#endif
- static inline ssize_t blockdev_direct_IO(struct kiocb *iocb,
-                                        struct inode *inode,
---- a/fs/fcntl.c
-+++ b/fs/fcntl.c
-@@ -52,8 +52,10 @@ static int setfl(int fd, struct file * f
-                  arg |= O_NONBLOCK;
-       if (arg & O_DIRECT) {
-+#ifdef CONFIG_DIRECT_IO
-               if (!filp->f_mapping || !filp->f_mapping->a_ops ||
-                       !filp->f_mapping->a_ops->direct_IO)
-+#endif
-                               return -EINVAL;
-       }
---- a/fs/open.c
-+++ b/fs/open.c
-@@ -673,7 +673,9 @@ int open_check_o_direct(struct file *f)
- {
-       /* NB: we're sure to have correct a_ops only after f_op->open */
-       if (f->f_flags & O_DIRECT) {
-+#ifdef CONFIG_DIRECT_IO
-               if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO)
-+#endif
-                       return -EINVAL;
-       }
-       return 0;
index 10613de85296f297a99104d91da8258df2a84f65..b9fdad9c1b86d88815e4c54f8a0d05d3be9f2a95 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/base/Kconfig
 +++ b/drivers/base/Kconfig
-@@ -229,7 +229,7 @@ config SOC_BUS
+@@ -232,7 +232,7 @@ config SOC_BUS
  source "drivers/base/regmap/Kconfig"
  
  config DMA_SHARED_BUFFER
@@ -34,7 +34,7 @@
 +MODULE_LICENSE("GPL");
 --- a/kernel/sched/core.c
 +++ b/kernel/sched/core.c
-@@ -2097,6 +2097,7 @@ int wake_up_state(struct task_struct *p,
+@@ -2096,6 +2096,7 @@ int wake_up_state(struct task_struct *p,
  {
        return try_to_wake_up(p, state, 0);
  }
index 1f4e6322b1923236901d0c38cf858412beb459b7..3aba9d63ba06816d63206408bbcf348491e08e4c 100644 (file)
@@ -1,6 +1,6 @@
 --- a/init/main.c
 +++ b/init/main.c
-@@ -964,7 +964,8 @@ static int __ref kernel_init(void *unuse
+@@ -966,7 +966,8 @@ static int __ref kernel_init(void *unuse
                panic("Requested init %s failed (error %d).",
                      execute_command, ret);
        }
index 2483e1bb9805a5caf344ccf9d02ea7a48c2f3f7c..821370350ed431d67dba18254da80bf875303166 100644 (file)
@@ -1,6 +1,6 @@
 --- a/init/main.c
 +++ b/init/main.c
-@@ -355,6 +355,29 @@ static inline void setup_nr_cpu_ids(void
+@@ -356,6 +356,29 @@ static inline void setup_nr_cpu_ids(void
  static inline void smp_prepare_cpus(unsigned int maxcpus) { }
  #endif
  
@@ -30,7 +30,7 @@
  /*
   * We need to store the untouched command line for future reference.
   * We also need to store the touched command line since the parameter
-@@ -527,6 +550,7 @@ asmlinkage __visible void __init start_k
+@@ -529,6 +552,7 @@ asmlinkage __visible void __init start_k
        pr_notice("%s", linux_banner);
        setup_arch(&command_line);
        mm_init_cpumask(&init_mm);
@@ -40,7 +40,7 @@
        setup_per_cpu_areas();
 --- a/init/Kconfig
 +++ b/init/Kconfig
-@@ -1648,6 +1648,15 @@ config EMBEDDED
+@@ -1655,6 +1655,15 @@ config EMBEDDED
          an embedded system so certain expert options are available
          for configuration.
  
index b7028e49d5827e2ac0aa4dd0997e107ec1f48f0b..7d38df30305be464bfe4081beba1793b1bed1f21 100644 (file)
@@ -226,6 +226,7 @@ CONFIG_NR_CPUS=8
 # CONFIG_NUMA is not set
 CONFIG_OUTPUT_FORMAT="elf64-x86-64"
 CONFIG_PADATA=y
+CONFIG_PAGE_TABLE_ISOLATION=y
 CONFIG_PARAVIRT=y
 CONFIG_PARAVIRT_CLOCK=y
 # CONFIG_PARAVIRT_DEBUG is not set
index 26bb124b8c6a7b17783d7232089f4dc3821b4448..c7ec537b1e28f305f878ae5c2a3608fdc54bbb93 100644 (file)
@@ -40,6 +40,7 @@ CONFIG_ARCH_USE_BUILTIN_BSWAP=y
 CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
 CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
 CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y
+CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y
 CONFIG_ARCH_WANT_FRAME_POINTERS=y
 CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
 CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
@@ -108,6 +109,7 @@ CONFIG_DMIID=y
 CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
 CONFIG_DMI_SYSFS=y
 CONFIG_DNOTIFY=y
+# CONFIG_DST_CACHE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_EARLY_PRINTK=y
 # CONFIG_EARLY_PRINTK_DBGP is not set
@@ -138,6 +140,7 @@ CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
 CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
 CONFIG_GENERIC_CMOS_UPDATE=y
 CONFIG_GENERIC_CPU_AUTOPROBE=y
+CONFIG_GENERIC_CPU_VULNERABILITIES=y
 CONFIG_GENERIC_EARLY_IOREMAP=y
 CONFIG_GENERIC_FIND_FIRST_BIT=y
 CONFIG_GENERIC_IO=y
@@ -282,7 +285,10 @@ CONFIG_M486=y
 # CONFIG_MFD_INTEL_LPSS_PCI is not set
 # CONFIG_MGEODEGX1 is not set
 # CONFIG_MGEODE_LX is not set
-# CONFIG_MICROCODE is not set
+CONFIG_MICROCODE=y
+CONFIG_MICROCODE_AMD=y
+CONFIG_MICROCODE_INTEL=y
+CONFIG_MICROCODE_OLD_INTERFACE=y
 # CONFIG_MK6 is not set
 # CONFIG_MK7 is not set
 # CONFIG_MK8 is not set
@@ -351,6 +357,7 @@ CONFIG_RATIONAL=y
 CONFIG_RD_BZIP2=y
 CONFIG_RD_GZIP=y
 # CONFIG_RELOCATABLE is not set
+CONFIG_RETPOLINE=y
 CONFIG_RTC_CLASS=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 # CONFIG_SBC7240_WDT is not set
index fca90f2091b91dfde8a980e48a871dc8693551c2..c5bdb1c0d47779d2a9222b70bf2a79395dd11565 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=e2fsprogs
 PKG_VERSION:=1.43.3
 PKG_HASH:=ce8ef1bbb0d4730f170167284fda156ac9d6bf18db2750eb94af619a81b19927
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/e2fsprogs
diff --git a/tools/e2fsprogs/patches/005-misc-rename-copy_file_range-to-copy_file_chunk.patch b/tools/e2fsprogs/patches/005-misc-rename-copy_file_range-to-copy_file_chunk.patch
new file mode 100644 (file)
index 0000000..bd6ee81
--- /dev/null
@@ -0,0 +1,53 @@
+From 01551bdba16ab16512a01affe02ade32c41ede8a Mon Sep 17 00:00:00 2001
+From: Palmer Dabbelt <palmer@dabbelt.com>
+Date: Fri, 29 Dec 2017 10:19:51 -0800
+Subject: [PATCH] misc: rename copy_file_range to copy_file_chunk
+
+As of 2.27, glibc will have a copy_file_range library call to wrap the
+new copy_file_range system call.  This conflicts with the function in
+misc/create_inode.c, which this patch renames _copy_file_range.
+
+Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+---
+ misc/create_inode.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/misc/create_inode.c
++++ b/misc/create_inode.c
+@@ -392,7 +392,7 @@ static ssize_t my_pread(int fd, void *bu
+ }
+ #endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */
+-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
++static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file,
+                                off_t start, off_t end, char *buf,
+                                char *zerobuf)
+ {
+@@ -466,7 +466,7 @@ static errcode_t try_lseek_copy(ext2_fil
+               data_blk = data & ~(fs->blocksize - 1);
+               hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1);
+-              err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
++              err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf,
+                                     zerobuf);
+               if (err)
+                       return err;
+@@ -516,7 +516,7 @@ static errcode_t try_fiemap_copy(ext2_fi
+               }
+               for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
+                    i++, ext++) {
+-                      err = copy_file_range(fs, fd, e2_file, ext->fe_logical,
++                      err = copy_file_chunk(fs, fd, e2_file, ext->fe_logical,
+                                             ext->fe_logical + ext->fe_length,
+                                             buf, zerobuf);
+                       if (err)
+@@ -569,7 +569,7 @@ static errcode_t copy_file(ext2_filsys f
+               goto out;
+ #endif
+-      err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
++      err = copy_file_chunk(fs, fd, e2_file, 0, statbuf->st_size, buf,
+                             zerobuf);
+ out:
+       ext2fs_free_mem(&zerobuf);