Commit Graph

183 Commits (121c021989929c33036cc75ab9a8363200e8da0c)

Author SHA1 Message Date
Salvatore Mesoraca 2a43ab4a18 ramips: add arl_table support for MT7530
Use switch.h API to expose MT7530's ARL table to
user space.

Signed-off-by: Salvatore Mesoraca <salvatore@samknows.com>
4 years ago
Qin Wei cd6515c2e8 ramips: fix sd polling
This is fixed in 18.06, it appears again in 19.07.
Currently mt7628 sdcard driver do not support polling mode which is for
the device do not have card-detect pin to detect sd card insert. Without
this patch, device will not detect sdcard is inserted. This patch is a
fix of that.

Signed-off-by: Qin Wei <support@vocore.io>
4 years ago
Sungbo Eo f7112a180f ramips: 5.4: handle ERR_PTR properly
of_get_mac_address can return ERR_PTR since 5.2, so the return pointer should be
checked before used. Otherwise it might cause an oops during boot.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Chuanhong Guo 4d06229242 ramips: ralink-eth: fix leftover dma dev argument
Fixes: 05dee5833a ("ramips: ralink-eth: fix device struct passed to dma functions")
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo e29e2a9484 ramips: ralink-eth: add support for 5.4 kernel
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo 05dee5833a ramips: ralink-eth: fix device struct passed to dma functions
dma functions needs the struct from platform_device instead of
the one for ethernet interface.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo 33d027c5b8 ramips: move and rename out-of-tree mtk eth driver
move the driver into shared 'files' directory and rename all symbols
from mediatek/mtk to ralink.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
DENG Qingfang d75c9b8f81 ramips: mtk-mmc: set correct DMA mask
Since commit f8c55dc ("MIPS: use generic dma noncoherent ops for
simple noncoherent platforms") changed MIPS dma handling, the mmc
driver fails because it doesn't have a dma mask is set.

So set the correct dma mask.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang d4903b5720 ramips: move MTK MMC driver to files directory
Move MTK MMC driver from "files-4.14" to "files" so kernel 5.4
can use it

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
John Crispin fa854a02a1 ralink: drop old ethernet driver
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 47899
9 years ago
John Crispin 9e5044926b ralink: remove stray "+" from ethernet driver
this is what you get if you manually apply patches with c&p

Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 47877
9 years ago
John Crispin 6df4426245 ralink: bump to the target to v4.3
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 47831
9 years ago
Felix Fietkau b100027a83 ramips: fix for kernel 4.0 napi repoll need return budgets number
Signed-off-by: Michael Lee <igvtee@gmail.com>

SVN-Revision: 47306
9 years ago
John Crispin aecac14cc4 ramips: Enable rx of 1536 bytes ethernet frames on MT7621
The default switch frame size (with FCS + header) is 1536 bytes. But the
GMAC only accepted frames up to 1522 bytes. Setting it to 1536 allows to
receive ethernet frames using the full of MTU 1500 + an extra VLAN header +
VLAN header added by the switch.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>

SVN-Revision: 47117
9 years ago
John Crispin 7b306e3eb3 ramips: Fix too small rx buffer
The driver assumes that the maximum received buffer for non-jumbo frames is
1536 bytes. But the allocation of the rx fragment doesn't reflect that. It
currently allocates fragments which will only be large enough to be used as
rx buffer with the size of 1534 bytes. This is problematic because the GMAC
will now try to write to 2 bytes which don't belong to its receive buffer
when a large enough ethernet frame is received.

This may already be a problem on existing chips but will at least become a
problem when the 1536 byte rx modus is enabled on MT7621a. It is required
on this SoC to receive ethernet frames which use their full 1500 bytes MTU
and a VLAN header next to the switch VLAN tag.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>

SVN-Revision: 47116
9 years ago
John Crispin 6b4985b105 ramips: Fix setting of rx buffer length
The length of the DMA rx buffer was always set to 0 because the function
for extracting the length was used to calculate the value for setting it.
Instead the macro has to be split in a get and set function similar to the
TX_DMA_(GET_|)PLEN(0|1) macro.

No problem was noticed on MT7621a before this was changed and thus maybe it
was hidden by different problem which is not yet fixed.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>

SVN-Revision: 47115
9 years ago
John Crispin 1aab21df9f ramips: Allow to receive vlan over untag ports on MT7530
The MT7530 switch driver with enable_vlan set will automatically set all
ports to the user port mode. The hardware will remove the incoming vlan tag
on these ports and use it for its internal vlan. This is usually not wanted
and makes it impossible to communicate via vlan over the switch in both
directions.

It is possible to configure a switch port to "transparent mode" when this
port is only used as untag in the switch VLANs. This will disable the VLAN
untagging of packets when they were received on this port. The tagging on
"tag" ports based on the vlan id is still working.

The transparent port mode cannot be used when a port is both used in a VLAN
as "tag" and in another one as "untag" port.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>

SVN-Revision: 47114
9 years ago
Felix Fietkau 1e6479aa87 ramips: collect rx related members to fe_rx_ring struct
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 46295
9 years ago
Felix Fietkau 279be7be09 ramips: add xmit_more support
use pktgen to verify on rt3662. can improve transmit rate.
pkt_size 1500
burst 1 : 807Mb/sec
burst 8 : 984Mb/sec

pkt_size 60
burst 1 : 57Mb/sec
burst 8 : 236Mb/sec

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 46294
9 years ago
John Crispin 2238b75285 ralink: add support for mt7621 switch counters
Signed-off-by: Cristian Morales Vega <cristian@samknows.com>

SVN-Revision: 46050
9 years ago
Felix Fietkau 4480fbce62 ramips: improve tx clean up and add fe_tx_ring struct
if there is any new tx need to clean up. do it in next napi poll.
collect tx related members to fe_tx_ring struct. for better
cache usage and more readable.

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 45895
9 years ago
Felix Fietkau 2a66c9886f ramips: change ethernet napi interrupt sequence
when open device. first ready napi software rx.
then enable hardware interrupt.
final start software tx queue to send data.

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 45894
9 years ago
Felix Fietkau 0d043d3ac0 ramips: fix ethernet vlan tx offload support check when delete
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 45893
9 years ago
Felix Fietkau e890a3bc9a ramips: make ethernet register map u16 instead of u32
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 44940
9 years ago
Felix Fietkau 37912d66c2 ramips: increase NAPI weight for mt7621 to improve routing performance a bit more
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 44918
9 years ago
John Crispin c7229b96b7 ralink: support change tx/rx ring size
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44741
9 years ago
John Crispin 2c94eef5df ralink: use random generate mac address instead of default one.
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44740
9 years ago
John Crispin 0f4431758b ralink: fix when tx done is 0 also need to clean interrupt status
Signed-off-by: michael lee <igvtee@gmail.com>
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 44401
9 years ago
John Crispin 07352ca2c7 ralink: fix hw status almost full not work on mt7620 and mt7621
the old FE_INT_STATUS register becomes two registers.
FE_INT_STATUS and INT_STATUS. so the hw status almost full
must change to read from FE_INT_STATUS register.
tx/rx done read from INT_STATUS register.

mt7620 datasheet define CNT_GDM1_AF at BIT(29).
but after test it should be BIT(13). why?

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44371
9 years ago
John Crispin 654bc380ec ralink: add 3.18 support
keep default as 3.14, mt7621 gic need to be ported to 3.18

Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 44349
9 years ago
Felix Fietkau 10c8d8c483 ramips: fix ethernet driver tx completion polling
- budget is decremented with completed frames, so don't check if done is
smaller
- ACK the interrupt before processing further frames to fix a small race
condition.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 44234
9 years ago
John Crispin c56cf3edc7 ralink: check ethernet MAC address whether it is valid
The mac address usually write in factory block. but sometime user erase this block , the mac address will change to ff:ff:ff:ff:ff:ff.
This patch is purpose to fix this issue.

Signed-off-by: wengbj <linux.c@foxmail.com>

SVN-Revision: 44166
9 years ago
Felix Fietkau bef829efa5 ralink: fix ethernet feature TSO not work
* fix TSO features verify on mt7621 firewrt board
* improve tx clean up. no need to access uncached
  memory. also use TX_DTX register instead of
  read tx ring DONE bit
* mt7621 need napi weight 64 to get more performance
* remove netif_receive_skb, after kernel version
  3.7 tcp4_gro_receive can handle tcp checksum.
  on rt2880 use iperf tcp LAN to WAN throughput test.
  with gro 135 Mbits/sec. without gro 80.4Mbits/sec.

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44118
10 years ago
Felix Fietkau 3ec294a825 ralink: init tx/rx vlan offload register for mt7621
on mt7621 don't have tx vlan vid registers.
so set FE_REG_FE_DMA_VID_BASE to 0.
set rx vlan offload register to disable.

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44117
10 years ago
Felix Fietkau e634e07893 ralink: use fe_max_buf_size to get rx buffer size
the rx_buf_size now is 1534 when mtu is 1500.
the ethernet frame with vlan tag and FCS is 1522.
so the buffer is enough.

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44116
10 years ago
Felix Fietkau 5d4837706a ramips: fix ethernet vlan tx offload support check
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 44115
10 years ago
Felix Fietkau 9e7cc83edc ralink: fix ethernet rx buffer size breakage
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 44047
10 years ago
Felix Fietkau a4460ca5a7 ralink: improve check rx sg function. use check frags instead of function call
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44046
10 years ago
Felix Fietkau b3ca42ec8f ralink: correct handle hardware rx 2bytes offset
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44045
10 years ago
Felix Fietkau 03ea0cf6f1 ralink: use fe_reset to control all reset
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44044
10 years ago
Felix Fietkau 50588ef192 ralink: improve tx_timeout function
* use default timeout value
* print more debug ring info
* move timeout reset function to workqueue

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44043
10 years ago
Felix Fietkau a5b578c2d9 ralink: reduce access to uncached tx/rx dma ring buffer
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44041
10 years ago
Felix Fietkau 00db07be58 ramips: fix tx bql related race condition in the ethernet driver
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43995
10 years ago
Felix Fietkau acfc6c153b ramips: use a larger number of rx descriptors on mt7621 to work around rx overrun related packet loss
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43953
10 years ago
Felix Fietkau 05d4b8c79b ramips: remove interrupt coalescing, it is unnecessary with napi polling and could reduce throughput
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43952
10 years ago
Felix Fietkau 10c2bdbc4f ramips: disable ethernet checksum offloads for mt7621, they are broken
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43811
10 years ago
Felix Fietkau 51b1f0ca5c ramips: use netif_receive_skb instead of napi_gro_receive when rx csum offload is unavailable
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43810
10 years ago
John Crispin e1f6d0dd0a ralink: fix tx vlan offload and hardware status
hardware status and tx vlan offload support on all targets
except rt5350. so i modify the IS_ENABLE condition only for
mt7621.
support mt7621 hardware status reference by SDK. but i don't
have mt7621. if not work just set mt7621 FE_REG_FE_COUNTER_BASE
to 0 to let software count.

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 43303
10 years ago
John Crispin a5f562993e ralink: support netconsole
Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 43302
10 years ago
John Crispin 9c5dfd9546 ralink: improve tx vlan offload
hardware tx vlan offload only support max 16 vids
now use add/delete vlan interface to update vlan id table
when duplicate vlan id index detect.
disable hardware tx vlan offload support.

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 43301
10 years ago