Skip to content

Commit

Permalink
ipq40xx: essedma: disable default vlan tagging
Browse files Browse the repository at this point in the history
The essedma driver has its own unique take on VLAN management
and its configuration. In the original SDK, each VLAN is
assigned one virtual ethernet netdev.

However, this is non-standard. So, this patch does away
with the default_vlan_tag property the driver is using
and therefore forces the user to use the kernel's vlan
feature.

Unfortunately, this change will cause the essedma driver
to leak LAN<->WAN during LEDE bootup.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
  • Loading branch information
chunkeey committed Apr 12, 2017
1 parent f534dd6 commit f4c1345
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 6 deletions.
4 changes: 2 additions & 2 deletions target/linux/ipq806x/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ r7800)
;;
fritz4040)
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt" "phy1tpt"
ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth1"
ucidef_set_led_switch "wan" "WAN" "${board}:green:wan" "switch0" "0x20"
ucidef_set_led_switch "lan" "LAN" "${board}:green:lan" "switch0" "0x1e"
;;
nbg6817)
Expand All @@ -39,7 +39,7 @@ nbg6817)
rt-ac58u)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:blue:wlan2G" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:blue:wlan5G" "phy1tpt"
ucidef_set_led_netdev "wan" "WAN" "$board:blue:wan" "eth1"
ucidef_set_led_switch "wan" "WAN" "${board}:blue:wan" "switch0" "0x20"
ucidef_set_led_usbport "usb" "USB" "${board}:blue:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1"
ucidef_set_led_switch "lan" "LAN" "${board}:blue:lan" "switch0" "0x1e"
;;
Expand Down
10 changes: 6 additions & 4 deletions target/linux/ipq806x/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ ea8500)
ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;;
fritz4040)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
lan_mac_addr=$(ipq40xx_get_dt_mac 0)
wan_mac_addr=$(ipq40xx_get_dt_mac 1)
ucidef_add_switch "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
ucidef_set_interface_macaddr "lan" "$lan_mac_addr"
ucidef_set_interface_macaddr "wan" "$wan_mac_addr"
;;
nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
Expand All @@ -52,9 +55,8 @@ rt-ac58u)
CI_UBIPART=UBI_DEV
wan_mac_addr=$(mtd_get_mac_binary_ubi Factory 20486)
lan_mac_addr=$(mtd_get_mac_binary_ubi Factory 4102)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
ucidef_set_interface_macaddr "lan" "$lan_mac_addr"
ucidef_set_interface_macaddr "wan" "$wan_mac_addr"
;;
Expand Down
12 changes: 12 additions & 0 deletions target/linux/ipq806x/base-files/lib/ipq806x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,15 @@ ipq806x_get_dt_led() {

echo "$label"
}

ipq40xx_get_dt_mac() {
local mac
local ethpath
local basepath="/sys/firmware/devicetree/base"
local nodepath="$basepath/aliases/ethernet$1"

[ -f "$nodepath" ] && ethpath=$(cat "$nodepath")
[ -n "$ethpath" ] && mac=$(cat "$basepath$ethpath/local-mac-address")

echo "$mac" | hexdump -v -n 6 -e '5/1 "%02x:" 1/1 "%02x"' $part 2>/dev/null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
From: Christian Lamparter <chunkeey@googlemail.com>
Subject: [PATCH] net: essedma: disable default vlan tagging
Date: Tue, 21 Mar 13:59:02 CET 2017 +0100

The essedma driver has its own unique take on VLAN management
and its configuration. In the original SDK, each VLAN is
assigned one virtual ethernet netdev.

However, this is non-standard. So, this patch does away
with the default_vlan_tag property the driver is using
and therefore forces the user to use the kernel's vlan
feature.

This patch also removes the "qcom,poll_required = <1>;" from
the essedma node.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
---
--- a/drivers/net/ethernet/qualcomm/essedma/edma.c
+++ b/drivers/net/ethernet/qualcomm/essedma/edma.c
@@ -715,13 +715,11 @@ static void edma_rx_complete(struct edma
edma_receive_checksum(rd, skb);

/* Process VLAN HW acceleration indication provided by HW */
- if (unlikely(adapter->default_vlan_tag != rd->rrd4)) {
- vlan = rd->rrd4;
- if (likely(rd->rrd7 & EDMA_RRD_CVLAN))
- __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan);
- else if (rd->rrd1 & EDMA_RRD_SVLAN)
- __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan);
- }
+ vlan = rd->rrd4;
+ if (likely(rd->rrd7 & EDMA_RRD_CVLAN))
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan);
+ else if (rd->rrd1 & EDMA_RRD_SVLAN)
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan);

/* Update rx statistics */
adapter->stats.rx_packets++;
@@ -1390,8 +1388,6 @@ netdev_tx_t edma_xmit(struct sk_buff *sk
/* Check and mark VLAN tag offload */
if (skb_vlan_tag_present(skb))
flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_FLAG;
- else if (adapter->default_vlan_tag)
- flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_DEFAULT_FLAG;

/* Check and mark checksum offload */
if (likely(skb->ip_summed == CHECKSUM_PARTIAL))
--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
@@ -386,8 +386,7 @@
qcom,page-mode = <0>;
qcom,rx_head_buf_size = <1540>;
qcom,mdio_supported;
- qcom,poll_required = <1>;
- qcom,num_gmac = <2>;
+ qcom,num_gmac = <1>;
interrupts = <0 65 IRQ_TYPE_EDGE_RISING
0 66 IRQ_TYPE_EDGE_RISING
0 67 IRQ_TYPE_EDGE_RISING
@@ -425,7 +424,7 @@

gmac0: gmac0 {
local-mac-address = [00 00 00 00 00 00];
- vlan_tag = <1 0x1f>;
+ vlan_tag = <1 0x3f>;
};

gmac1: gmac1 {

0 comments on commit f4c1345

Please sign in to comment.