diff --git a/.github/update.log b/.github/update.log index 416d3e9267..47adf4569b 100644 --- a/.github/update.log +++ b/.github/update.log @@ -1129,3 +1129,4 @@ Update On Fri Sep 19 20:36:14 CEST 2025 Update On Sat Sep 20 20:32:16 CEST 2025 Update On Sun Sep 21 20:36:55 CEST 2025 Update On Mon Sep 22 20:36:16 CEST 2025 +Update On Tue Sep 23 20:37:30 CEST 2025 diff --git a/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru.go b/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru.go index 8ef9cfd758..bfdf0e519f 100644 --- a/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru.go +++ b/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru.go @@ -5,6 +5,7 @@ import ( "fmt" "net" "strconv" + "strings" "sync" CN "github.com/metacubex/mihomo/common/net" @@ -30,8 +31,8 @@ type MieruOption struct { BasicOption Name string `proxy:"name"` Server string `proxy:"server"` - Port int `proxy:"port,omitempty"` - PortRange string `proxy:"port-range,omitempty"` + Port string `proxy:"port,omitempty"` + PortRange string `proxy:"port-range,omitempty"` // deprecated Transport string `proxy:"transport"` UDP bool `proxy:"udp,omitempty"` UserName string `proxy:"username"` @@ -123,13 +124,19 @@ func NewMieru(option MieruOption) (*Mieru, error) { } // Client is started lazily on the first use. + // Use the first port to construct the address. var addr string - if option.Port != 0 { - addr = net.JoinHostPort(option.Server, strconv.Itoa(option.Port)) + var portStr string + if option.Port != "" { + portStr = option.Port } else { - beginPort, _, _ := beginAndEndPortFromPortRange(option.PortRange) - addr = net.JoinHostPort(option.Server, strconv.Itoa(beginPort)) + portStr = option.PortRange } + firstPort, err := getFirstPort(portStr) + if err != nil { + return nil, fmt.Errorf("failed to get first port from port string %q: %w", portStr, err) + } + addr = net.JoinHostPort(option.Server, strconv.Itoa(firstPort)) outbound := &Mieru{ Base: &Base{ name: option.Name, @@ -183,54 +190,62 @@ func buildMieruClientConfig(option MieruOption) (*mieruclient.ClientConfig, erro } transportProtocol := mierupb.TransportProtocol_TCP.Enum() - var server *mierupb.ServerEndpoint - if net.ParseIP(option.Server) != nil { - // server is an IP address - if option.PortRange != "" { - server = &mierupb.ServerEndpoint{ - IpAddress: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - PortRange: proto.String(option.PortRange), + + portBindings := make([]*mierupb.PortBinding, 0) + if option.Port != "" { + parts := strings.Split(option.Port, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if strings.Contains(part, "-") { + _, _, err := beginAndEndPortFromPortRange(part) + if err == nil { + portBindings = append(portBindings, &mierupb.PortBinding{ + PortRange: proto.String(part), Protocol: transportProtocol, - }, - }, - } - } else { - server = &mierupb.ServerEndpoint{ - IpAddress: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - Port: proto.Int32(int32(option.Port)), - Protocol: transportProtocol, - }, - }, - } - } - } else { - // server is a domain name - if option.PortRange != "" { - server = &mierupb.ServerEndpoint{ - DomainName: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - PortRange: proto.String(option.PortRange), - Protocol: transportProtocol, - }, - }, - } - } else { - server = &mierupb.ServerEndpoint{ - DomainName: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - Port: proto.Int32(int32(option.Port)), - Protocol: transportProtocol, - }, - }, + }) + } else { + return nil, err + } + } else { + p, err := strconv.Atoi(part) + if err != nil { + return nil, fmt.Errorf("invalid port value: %s", part) + } + portBindings = append(portBindings, &mierupb.PortBinding{ + Port: proto.Int32(int32(p)), + Protocol: transportProtocol, + }) } } } + if option.PortRange != "" { + parts := strings.Split(option.PortRange, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if _, _, err := beginAndEndPortFromPortRange(part); err == nil { + portBindings = append(portBindings, &mierupb.PortBinding{ + PortRange: proto.String(part), + Protocol: transportProtocol, + }) + } + } + } + + var server *mierupb.ServerEndpoint + if net.ParseIP(option.Server) != nil { + // server is an IP address + server = &mierupb.ServerEndpoint{ + IpAddress: proto.String(option.Server), + PortBindings: portBindings, + } + } else { + // server is a domain name + server = &mierupb.ServerEndpoint{ + DomainName: proto.String(option.Server), + PortBindings: portBindings, + } + } + config := &mieruclient.ClientConfig{ Profile: &mierupb.ClientProfile{ ProfileName: proto.String(option.Name), @@ -259,31 +274,9 @@ func validateMieruOption(option MieruOption) error { if option.Server == "" { return fmt.Errorf("server is empty") } - if option.Port == 0 && option.PortRange == "" { - return fmt.Errorf("either port or port-range must be set") + if option.Port == "" && option.PortRange == "" { + return fmt.Errorf("port must be set") } - if option.Port != 0 && option.PortRange != "" { - return fmt.Errorf("port and port-range cannot be set at the same time") - } - if option.Port != 0 && (option.Port < 1 || option.Port > 65535) { - return fmt.Errorf("port must be between 1 and 65535") - } - if option.PortRange != "" { - begin, end, err := beginAndEndPortFromPortRange(option.PortRange) - if err != nil { - return fmt.Errorf("invalid port-range format") - } - if begin < 1 || begin > 65535 { - return fmt.Errorf("begin port must be between 1 and 65535") - } - if end < 1 || end > 65535 { - return fmt.Errorf("end port must be between 1 and 65535") - } - if begin > end { - return fmt.Errorf("begin port must be less than or equal to end port") - } - } - if option.Transport != "TCP" { return fmt.Errorf("transport must be TCP") } @@ -306,8 +299,36 @@ func validateMieruOption(option MieruOption) error { return nil } +func getFirstPort(portStr string) (int, error) { + if portStr == "" { + return 0, fmt.Errorf("port string is empty") + } + parts := strings.Split(portStr, ",") + firstPart := parts[0] + + if strings.Contains(firstPart, "-") { + begin, _, err := beginAndEndPortFromPortRange(firstPart) + if err != nil { + return 0, err + } + return begin, nil + } + + port, err := strconv.Atoi(firstPart) + if err != nil { + return 0, fmt.Errorf("invalid port format: %s", firstPart) + } + return port, nil +} + func beginAndEndPortFromPortRange(portRange string) (int, int, error) { var begin, end int _, err := fmt.Sscanf(portRange, "%d-%d", &begin, &end) + if err != nil { + return 0, 0, fmt.Errorf("invalid port range format: %w", err) + } + if begin > end { + return 0, 0, fmt.Errorf("begin port is greater than end port: %s", portRange) + } return begin, end, err } diff --git a/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru_test.go b/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru_test.go index 086b791044..2b7976e4c7 100644 --- a/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru_test.go +++ b/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru_test.go @@ -1,22 +1,51 @@ package outbound -import "testing" +import ( + "reflect" + "testing" + + mieruclient "github.com/enfein/mieru/v3/apis/client" + mierupb "github.com/enfein/mieru/v3/pkg/appctl/appctlpb" + "google.golang.org/protobuf/proto" +) func TestNewMieru(t *testing.T) { + transportProtocol := mierupb.TransportProtocol_TCP.Enum() testCases := []struct { option MieruOption wantBaseAddr string + wantConfig *mieruclient.ClientConfig }{ { option: MieruOption{ Name: "test", Server: "1.2.3.4", - Port: 10000, + Port: "10000", Transport: "TCP", UserName: "test", Password: "test", }, wantBaseAddr: "1.2.3.4:10000", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + IpAddress: proto.String("1.2.3.4"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10000), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, { option: MieruOption{ @@ -28,28 +57,212 @@ func TestNewMieru(t *testing.T) { Password: "test", }, wantBaseAddr: "[2001:db8::1]:10001", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + IpAddress: proto.String("2001:db8::1"), + PortBindings: []*mierupb.PortBinding{ + { + PortRange: proto.String("10001-10002"), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, { option: MieruOption{ Name: "test", Server: "example.com", - Port: 10003, + Port: "10003", Transport: "TCP", UserName: "test", Password: "test", }, wantBaseAddr: "example.com:10003", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10003), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10004,10005", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10004", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10004), + Protocol: transportProtocol, + }, + { + Port: proto.Int32(10005), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10006-10007,11000", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10006", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + PortRange: proto.String("10006-10007"), + Protocol: transportProtocol, + }, + { + Port: proto.Int32(11000), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10008", + PortRange: "10009-10010", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10008", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10008), + Protocol: transportProtocol, + }, + { + PortRange: proto.String("10009-10010"), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, } for _, testCase := range testCases { mieru, err := NewMieru(testCase.option) if err != nil { - t.Error(err) + t.Fatal(err) } + config, err := mieru.client.Load() + if err != nil { + t.Fatal(err) + } + config.Dialer = nil if mieru.addr != testCase.wantBaseAddr { t.Errorf("got addr %q, want %q", mieru.addr, testCase.wantBaseAddr) } + if !reflect.DeepEqual(config, testCase.wantConfig) { + t.Errorf("got config %+v, want %+v", config, testCase.wantConfig) + } + } +} + +func TestNewMieruError(t *testing.T) { + testCases := []MieruOption{ + { + Name: "test", + Server: "example.com", + Port: "invalid", + PortRange: "invalid", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + { + Name: "test", + Server: "example.com", + Port: "", + PortRange: "", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + } + + for _, option := range testCases { + _, err := NewMieru(option) + if err == nil { + t.Errorf("expected error for option %+v, but got nil", option) + } } } @@ -63,6 +276,7 @@ func TestBeginAndEndPortFromPortRange(t *testing.T) { {"1-10", 1, 10, false}, {"1000-2000", 1000, 2000, false}, {"65535-65535", 65535, 65535, false}, + {"2000-1000", 0, 0, true}, {"1", 0, 0, true}, {"1-", 0, 0, true}, {"-10", 0, 0, true}, diff --git a/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/shadowsocks.go b/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/shadowsocks.go index a809728e65..c6cfa9147b 100644 --- a/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/shadowsocks.go +++ b/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/shadowsocks.go @@ -13,6 +13,7 @@ import ( C "github.com/metacubex/mihomo/constant" "github.com/metacubex/mihomo/ntp" gost "github.com/metacubex/mihomo/transport/gost-plugin" + "github.com/metacubex/mihomo/transport/kcptun" "github.com/metacubex/mihomo/transport/restls" obfs "github.com/metacubex/mihomo/transport/simple-obfs" shadowtls "github.com/metacubex/mihomo/transport/sing-shadowtls" @@ -36,6 +37,7 @@ type ShadowSocks struct { gostOption *gost.Option shadowTLSOption *shadowtls.ShadowTLSOption restlsConfig *restls.Config + kcptunClient *kcptun.Client } type ShadowSocksOption struct { @@ -106,6 +108,32 @@ type restlsOption struct { RestlsScript string `obfs:"restls-script,omitempty"` } +type kcpTunOption struct { + Key string `obfs:"key,omitempty"` + Crypt string `obfs:"crypt,omitempty"` + Mode string `obfs:"mode,omitempty"` + Conn int `obfs:"conn,omitempty"` + AutoExpire int `obfs:"autoexpire,omitempty"` + ScavengeTTL int `obfs:"scavengettl,omitempty"` + MTU int `obfs:"mtu,omitempty"` + SndWnd int `obfs:"sndwnd,omitempty"` + RcvWnd int `obfs:"rcvwnd,omitempty"` + DataShard int `obfs:"datashard,omitempty"` + ParityShard int `obfs:"parityshard,omitempty"` + DSCP int `obfs:"dscp,omitempty"` + NoComp bool `obfs:"nocomp,omitempty"` + AckNodelay bool `obfs:"acknodelay,omitempty"` + NoDelay int `obfs:"nodelay,omitempty"` + Interval int `obfs:"interval,omitempty"` + Resend int `obfs:"resend,omitempty"` + NoCongestion int `obfs:"nc,omitempty"` + SockBuf int `obfs:"sockbuf,omitempty"` + SmuxVer int `obfs:"smuxver,omitempty"` + SmuxBuf int `obfs:"smuxbuf,omitempty"` + StreamBuf int `obfs:"streambuf,omitempty"` + KeepAlive int `obfs:"keepalive,omitempty"` +} + // StreamConnContext implements C.ProxyAdapter func (ss *ShadowSocks) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (_ net.Conn, err error) { useEarly := false @@ -174,7 +202,27 @@ func (ss *ShadowSocks) DialContextWithDialer(ctx context.Context, dialer C.Diale return nil, err } } - c, err := dialer.DialContext(ctx, "tcp", ss.addr) + var c net.Conn + if ss.kcptunClient != nil { + c, err = ss.kcptunClient.OpenStream(ctx, func(ctx context.Context) (net.PacketConn, net.Addr, error) { + if err = ss.ResolveUDP(ctx, metadata); err != nil { + return nil, nil, err + } + addr, err := resolveUDPAddr(ctx, "udp", ss.addr, ss.prefer) + if err != nil { + return nil, nil, err + } + + pc, err := dialer.ListenPacket(ctx, "udp", "", addr.AddrPort()) + if err != nil { + return nil, nil, err + } + + return pc, addr, nil + }) + } else { + c, err = dialer.DialContext(ctx, "tcp", ss.addr) + } if err != nil { return nil, fmt.Errorf("%s connect error: %w", ss.addr, err) } @@ -256,6 +304,13 @@ func (ss *ShadowSocks) SupportUOT() bool { return ss.option.UDPOverTCP } +func (ss *ShadowSocks) Close() error { + if ss.kcptunClient != nil { + return ss.kcptunClient.Close() + } + return nil +} + func NewShadowSocks(option ShadowSocksOption) (*ShadowSocks, error) { addr := net.JoinHostPort(option.Server, strconv.Itoa(option.Port)) method, err := shadowsocks.CreateMethod(option.Cipher, shadowsocks.MethodOptions{ @@ -271,6 +326,7 @@ func NewShadowSocks(option ShadowSocksOption) (*ShadowSocks, error) { var obfsOption *simpleObfsOption var shadowTLSOpt *shadowtls.ShadowTLSOption var restlsConfig *restls.Config + var kcptunClient *kcptun.Client obfsMode := "" decoder := structure.NewDecoder(structure.Option{TagName: "obfs", WeaklyTypedInput: true}) @@ -384,6 +440,39 @@ func NewShadowSocks(option ShadowSocksOption) (*ShadowSocks, error) { return nil, fmt.Errorf("ss %s initialize restls-plugin error: %w", addr, err) } + } else if option.Plugin == kcptun.Mode { + obfsMode = kcptun.Mode + kcptunOpt := &kcpTunOption{} + if err := decoder.Decode(option.PluginOpts, kcptunOpt); err != nil { + return nil, fmt.Errorf("ss %s initialize kcptun-plugin error: %w", addr, err) + } + + kcptunClient = kcptun.NewClient(kcptun.Config{ + Key: kcptunOpt.Key, + Crypt: kcptunOpt.Crypt, + Mode: kcptunOpt.Mode, + Conn: kcptunOpt.Conn, + AutoExpire: kcptunOpt.AutoExpire, + ScavengeTTL: kcptunOpt.ScavengeTTL, + MTU: kcptunOpt.MTU, + SndWnd: kcptunOpt.SndWnd, + RcvWnd: kcptunOpt.RcvWnd, + DataShard: kcptunOpt.DataShard, + ParityShard: kcptunOpt.ParityShard, + DSCP: kcptunOpt.DSCP, + NoComp: kcptunOpt.NoComp, + AckNodelay: kcptunOpt.AckNodelay, + NoDelay: kcptunOpt.NoDelay, + Interval: kcptunOpt.Interval, + Resend: kcptunOpt.Resend, + NoCongestion: kcptunOpt.NoCongestion, + SockBuf: kcptunOpt.SockBuf, + SmuxVer: kcptunOpt.SmuxVer, + SmuxBuf: kcptunOpt.SmuxBuf, + StreamBuf: kcptunOpt.StreamBuf, + KeepAlive: kcptunOpt.KeepAlive, + }) + option.UDPOverTCP = true // must open uot } switch option.UDPOverTCPVersion { case uot.Version, uot.LegacyVersion: @@ -414,5 +503,6 @@ func NewShadowSocks(option ShadowSocksOption) (*ShadowSocks, error) { obfsOption: obfsOption, shadowTLSOption: shadowTLSOpt, restlsConfig: restlsConfig, + kcptunClient: kcptunClient, }, nil } diff --git a/clash-meta-android/core/src/foss/golang/clash/component/tls/reality.go b/clash-meta-android/core/src/foss/golang/clash/component/tls/reality.go index cd6a47538e..fe1135f3c4 100644 --- a/clash-meta-android/core/src/foss/golang/clash/component/tls/reality.go +++ b/clash-meta-android/core/src/foss/golang/clash/component/tls/reality.go @@ -24,7 +24,6 @@ import ( "github.com/metacubex/randv2" utls "github.com/metacubex/utls" - "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/hkdf" "golang.org/x/net/http2" ) @@ -107,13 +106,8 @@ func GetRealityConn(ctx context.Context, conn net.Conn, fingerprint UClientHello if err != nil { return nil, err } - var aeadCipher cipher.AEAD - if utls.AesgcmPreferred(hello.CipherSuites) { - aesBlock, _ := aes.NewCipher(authKey) - aeadCipher, _ = cipher.NewGCM(aesBlock) - } else { - aeadCipher, _ = chacha20poly1305.New(authKey) - } + aesBlock, _ := aes.NewCipher(authKey) + aeadCipher, _ := cipher.NewGCM(aesBlock) aeadCipher.Seal(hello.SessionId[:0], hello.Random[20:], hello.SessionId[:16], hello.Raw) copy(hello.Raw[39:], hello.SessionId) //log.Debugln("REALITY hello.sessionId: %v", hello.SessionId) diff --git a/clash-meta-android/core/src/foss/golang/clash/docs/config.yaml b/clash-meta-android/core/src/foss/golang/clash/docs/config.yaml index adb7294cd1..574188182a 100644 --- a/clash-meta-android/core/src/foss/golang/clash/docs/config.yaml +++ b/clash-meta-android/core/src/foss/golang/clash/docs/config.yaml @@ -534,6 +534,37 @@ proxies: # socks5 version-hint: "tls12" restls-script: "1000?100<1,500~100,350~100,600~100,400~200" + - name: "ss-kcptun" + type: ss + server: [YOUR_SERVER_IP] + port: 443 + cipher: chacha20-ietf-poly1305 + password: [YOUR_SS_PASSWORD] + plugin: kcptun + plugin-opts: + key: it's a secrect # pre-shared secret between client and server + crypt: aes # aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none, null + mode: fast # profiles: fast3, fast2, fast, normal, manual + conn: 1 # set num of UDP connections to server + autoexpire: 0 # set auto expiration time(in seconds) for a single UDP connection, 0 to disable + scavengettl: 600 # set how long an expired connection can live (in seconds) + mtu: 1350 # set maximum transmission unit for UDP packets + sndwnd: 128 # set send window size(num of packets) + rcvwnd: 512 # set receive window size(num of packets) + datashard: 10 # set reed-solomon erasure coding - datashard + parityshard: 3 # set reed-solomon erasure coding - parityshard + dscp: 0 # set DSCP(6bit) + nocomp: false # disable compression + acknodelay: false # flush ack immediately when a packet is received + nodelay: 0 + interval: 50 + resend: false + sockbuf: 4194304 # per-socket buffer in bytes + smuxver: 1 # specify smux version, available 1,2 + smuxbuf: 4194304 # the overall de-mux buffer in bytes + streambuf: 2097152 # per stream receive buffer in bytes, smux v2+ + keepalive: 10 # seconds between heartbeats + # vmess # cipher 支持 auto/aes-128-gcm/chacha20-poly1305/none - name: "vmess" @@ -993,8 +1024,8 @@ proxies: # socks5 - name: mieru type: mieru server: 1.2.3.4 - port: 2999 - # port-range: 2090-2099 #(不可同时填写 port 和 port-range) + port: 2999 # 支持使用 ports 格式,例如 2999,3999 或 2999-3010,3950,3995-3999 + # port-range: 2090-2099 # 已废弃,请使用 port transport: TCP # 只支持 TCP udp: true # 支持 UDP over TCP username: user @@ -1336,6 +1367,30 @@ listeners: # password: password # handshake: # dest: test.com:443 + # kcp-tun: + # enable: false + # key: it's a secrect # pre-shared secret between client and server + # crypt: aes # aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none, null + # mode: fast # profiles: fast3, fast2, fast, normal, manual + # conn: 1 # set num of UDP connections to server + # autoexpire: 0 # set auto expiration time(in seconds) for a single UDP connection, 0 to disable + # scavengettl: 600 # set how long an expired connection can live (in seconds) + # mtu: 1350 # set maximum transmission unit for UDP packets + # sndwnd: 128 # set send window size(num of packets) + # rcvwnd: 512 # set receive window size(num of packets) + # datashard: 10 # set reed-solomon erasure coding - datashard + # parityshard: 3 # set reed-solomon erasure coding - parityshard + # dscp: 0 # set DSCP(6bit) + # nocomp: false # disable compression + # acknodelay: false # flush ack immediately when a packet is received + # nodelay: 0 + # interval: 50 + # resend: false + # sockbuf: 4194304 # per-socket buffer in bytes + # smuxver: 1 # specify smux version, available 1,2 + # smuxbuf: 4194304 # the overall de-mux buffer in bytes + # streambuf: 2097152 # per stream receive buffer in bytes, smux v2+ + # keepalive: 10 # seconds between heartbeats - name: vmess-in-1 type: vmess diff --git a/clash-meta-android/core/src/foss/golang/clash/go.mod b/clash-meta-android/core/src/foss/golang/clash/go.mod index 1f52ff8a2b..d807b73219 100644 --- a/clash-meta-android/core/src/foss/golang/clash/go.mod +++ b/clash-meta-android/core/src/foss/golang/clash/go.mod @@ -11,6 +11,7 @@ require ( github.com/go-chi/render v1.0.3 github.com/gobwas/ws v1.4.0 github.com/gofrs/uuid/v5 v5.3.2 + github.com/golang/snappy v1.0.0 github.com/insomniacslk/dhcp v0.0.0-20250109001534-8abf58130905 github.com/klauspost/compress v1.17.9 // lastest version compatible with golang1.20 github.com/mdlayher/netlink v1.7.2 @@ -21,6 +22,7 @@ require ( github.com/metacubex/chacha v0.1.5 github.com/metacubex/fswatch v0.1.1 github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 + github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 github.com/metacubex/randv2 v0.2.0 github.com/metacubex/restls-client-go v0.1.7 @@ -33,9 +35,9 @@ require ( github.com/metacubex/sing-tun v0.4.8 github.com/metacubex/sing-vmess v0.2.4 github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f - github.com/metacubex/smux v0.0.0-20250503055512-501391591dee + github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 - github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 + github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f github.com/miekg/dns v1.1.63 // lastest version compatible with golang1.20 github.com/mroth/weightedrand/v2 v2.1.0 @@ -83,6 +85,8 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect github.com/josharian/native v1.1.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/klauspost/reedsolomon v1.12.3 // indirect github.com/kr/text v0.2.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mailru/easyjson v0.7.7 // indirect diff --git a/clash-meta-android/core/src/foss/golang/clash/go.sum b/clash-meta-android/core/src/foss/golang/clash/go.sum index b4a6bea8d8..5bd6da5110 100644 --- a/clash-meta-android/core/src/foss/golang/clash/go.sum +++ b/clash-meta-android/core/src/foss/golang/clash/go.sum @@ -60,6 +60,8 @@ github.com/gofrs/uuid/v5 v5.3.2 h1:2jfO8j3XgSwlz/wHqemAEugfnTlikAYHhnqQ8Xh4fE0= github.com/gofrs/uuid/v5 v5.3.2/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= +github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -77,6 +79,10 @@ github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtL github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/reedsolomon v1.12.3 h1:tzUznbfc3OFwJaTebv/QdhnFf2Xvb7gZ24XaHLBPmdc= +github.com/klauspost/reedsolomon v1.12.3/go.mod h1:3K5rXwABAvzGeR01r6pWZieUALXO/Tq7bFKGIb4m4WI= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -106,6 +112,8 @@ github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvO github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759/go.mod h1:UHOv2xu+RIgLwpXca7TLrXleEd4oR3sPatW6IF8wU88= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301 h1:N5GExQJqYAH3gOCshpp2u/J3CtNYzMctmlb0xK9wtbQ= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301/go.mod h1:8LpS0IJW1VmWzUm3ylb0e2SK5QDm5lO/2qwWLZgRpBU= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b h1:z7JLKjugnQ1qvDOAD8yMA5C8AlJY3bG+VrrgRntRlUY= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b/go.mod h1:HIJZW4QMhbBqXuqC1ly6Hn0TEYT2SzRw58ns1yGhXTs= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 h1:1Qpuy+sU3DmyX9HwI+CrBT/oLNJngvBorR2RbajJcqo= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793/go.mod h1:RjRNb4G52yAgfR+Oe/kp9G4PJJ97Fnj89eY1BFO3YyA= github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 h1:8JVlYuE8uSJAvmyCd4TjvDxs57xjb0WxEoaWafK5+qs= @@ -133,12 +141,12 @@ github.com/metacubex/sing-vmess v0.2.4 h1:Tx6AGgCiEf400E/xyDuYyafsel6sGbR8oF7RkA github.com/metacubex/sing-vmess v0.2.4/go.mod h1:21R5R1u90uUvBQF0owoooEu96/SAYYD56nDrwm6nFaM= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f h1:Sr/DYKYofKHKc4GF3qkRGNuj6XA6c0eqPgEDN+VAsYU= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f/go.mod h1:jpAkVLPnCpGSfNyVmj6Cq4YbuZsFepm/Dc+9BAOcR80= -github.com/metacubex/smux v0.0.0-20250503055512-501391591dee h1:lp6hJ+4wCLZu113awp7P6odM2okB5s60HUyF0FMqKmo= -github.com/metacubex/smux v0.0.0-20250503055512-501391591dee/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= +github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 h1:T6qCCfolRDAVJKeaPW/mXwNLjnlo65AYN7WS2jrBNaM= +github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 h1:Ui+/2s5Qz0lSnDUBmEL12M5Oi/PzvFxGTNohm8ZcsmE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 h1:5OGzQvoE5yuOe8AsZsFwhf32ZxKmKN9G+k06AVd+6jY= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2/go.mod h1:GN/CB3TRwQ9LYquYpIFynDkvMTYmkjwI7+mkUIoHj88= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e h1:t9IxEaxSRp3YJ1ewQV4oGkKaJaMeSoUWjOV0boLVQo8= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e/go.mod h1:kncGGVhFaoGn5M3pFe3SXhZCzsbCJayNOH4UEqTKTko= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f h1:FGBPRb1zUabhPhDrlKEjQ9lgIwQ6cHL4x8M9lrERhbk= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f/go.mod h1:oPGcV994OGJedmmxrcK9+ni7jUEMGhR+uVQAdaduIP4= github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 h1:lhlqpYHopuTLx9xQt22kSA9HtnyTDmk5XjjQVCGHe2E= @@ -198,7 +206,6 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/tiendc/go-deepcopy v1.6.1 h1:uVRTItFeNHkMcLueHS7OCsxgxT9P8MzGB/taUa2Y4Tk= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -216,6 +223,7 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= +github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae h1:J0GxkO96kL4WF+AIT3M4mfUVinOCPgf2uUWYFUzN0sM= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= gitlab.com/go-extension/aes-ccm v0.0.0-20230221065045-e58665ef23c7 h1:UNrDfkQqiEYzdMlNsVvBYOAJWZjdktqFE9tQh5BT2+4= @@ -256,6 +264,7 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/clash-meta-android/core/src/foss/golang/clash/listener/config/kcptun.go b/clash-meta-android/core/src/foss/golang/clash/listener/config/kcptun.go new file mode 100644 index 0000000000..02293dfaed --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/listener/config/kcptun.go @@ -0,0 +1,8 @@ +package config + +import "github.com/metacubex/mihomo/transport/kcptun" + +type KcpTun struct { + Enable bool `json:"enable"` + kcptun.Config `json:",inline"` +} diff --git a/clash-meta-android/core/src/foss/golang/clash/listener/config/shadowsocks.go b/clash-meta-android/core/src/foss/golang/clash/listener/config/shadowsocks.go index 442743ef78..37bbb72119 100644 --- a/clash-meta-android/core/src/foss/golang/clash/listener/config/shadowsocks.go +++ b/clash-meta-android/core/src/foss/golang/clash/listener/config/shadowsocks.go @@ -14,6 +14,7 @@ type ShadowsocksServer struct { Udp bool MuxOption sing.MuxOption `yaml:"mux-option" json:"mux-option,omitempty"` ShadowTLS ShadowTLS `yaml:"shadow-tls" json:"shadow-tls,omitempty"` + KcpTun KcpTun `yaml:"kcp-tun" json:"kcp-tun,omitempty"` } func (t ShadowsocksServer) String() string { diff --git a/clash-meta-android/core/src/foss/golang/clash/listener/inbound/kcptun.go b/clash-meta-android/core/src/foss/golang/clash/listener/inbound/kcptun.go new file mode 100644 index 0000000000..e4098f9657 --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/listener/inbound/kcptun.go @@ -0,0 +1,64 @@ +package inbound + +import ( + LC "github.com/metacubex/mihomo/listener/config" + "github.com/metacubex/mihomo/transport/kcptun" +) + +type KcpTun struct { + Enable bool `inbound:"enable"` + Key string `inbound:"key,omitempty"` + Crypt string `inbound:"crypt,omitempty"` + Mode string `inbound:"mode,omitempty"` + Conn int `inbound:"conn,omitempty"` + AutoExpire int `inbound:"autoexpire,omitempty"` + ScavengeTTL int `inbound:"scavengettl,omitempty"` + MTU int `inbound:"mtu,omitempty"` + SndWnd int `inbound:"sndwnd,omitempty"` + RcvWnd int `inbound:"rcvwnd,omitempty"` + DataShard int `inbound:"datashard,omitempty"` + ParityShard int `inbound:"parityshard,omitempty"` + DSCP int `inbound:"dscp,omitempty"` + NoComp bool `inbound:"nocomp,omitempty"` + AckNodelay bool `inbound:"acknodelay,omitempty"` + NoDelay int `inbound:"nodelay,omitempty"` + Interval int `inbound:"interval,omitempty"` + Resend int `inbound:"resend,omitempty"` + NoCongestion int `inbound:"nc,omitempty"` + SockBuf int `inbound:"sockbuf,omitempty"` + SmuxVer int `inbound:"smuxver,omitempty"` + SmuxBuf int `inbound:"smuxbuf,omitempty"` + StreamBuf int `inbound:"streambuf,omitempty"` + KeepAlive int `inbound:"keepalive,omitempty"` +} + +func (c KcpTun) Build() LC.KcpTun { + return LC.KcpTun{ + Enable: c.Enable, + Config: kcptun.Config{ + Key: c.Key, + Crypt: c.Crypt, + Mode: c.Mode, + Conn: c.Conn, + AutoExpire: c.AutoExpire, + ScavengeTTL: c.ScavengeTTL, + MTU: c.MTU, + SndWnd: c.SndWnd, + RcvWnd: c.RcvWnd, + DataShard: c.DataShard, + ParityShard: c.ParityShard, + DSCP: c.DSCP, + NoComp: c.NoComp, + AckNodelay: c.AckNodelay, + NoDelay: c.NoDelay, + Interval: c.Interval, + Resend: c.Resend, + NoCongestion: c.NoCongestion, + SockBuf: c.SockBuf, + SmuxVer: c.SmuxVer, + SmuxBuf: c.SmuxBuf, + StreamBuf: c.StreamBuf, + KeepAlive: c.KeepAlive, + }, + } +} diff --git a/clash-meta-android/core/src/foss/golang/clash/listener/inbound/shadowsocks.go b/clash-meta-android/core/src/foss/golang/clash/listener/inbound/shadowsocks.go index 994f4c597c..b88013a80f 100644 --- a/clash-meta-android/core/src/foss/golang/clash/listener/inbound/shadowsocks.go +++ b/clash-meta-android/core/src/foss/golang/clash/listener/inbound/shadowsocks.go @@ -16,6 +16,7 @@ type ShadowSocksOption struct { UDP bool `inbound:"udp,omitempty"` MuxOption MuxOption `inbound:"mux-option,omitempty"` ShadowTLS ShadowTLS `inbound:"shadow-tls,omitempty"` + KcpTun KcpTun `inbound:"kcp-tun,omitempty"` } func (o ShadowSocksOption) Equal(config C.InboundConfig) bool { @@ -45,6 +46,7 @@ func NewShadowSocks(options *ShadowSocksOption) (*ShadowSocks, error) { Udp: options.UDP, MuxOption: options.MuxOption.Build(), ShadowTLS: options.ShadowTLS.Build(), + KcpTun: options.KcpTun.Build(), }, }, nil } diff --git a/clash-meta-android/core/src/foss/golang/clash/listener/inbound/shadowsocks_test.go b/clash-meta-android/core/src/foss/golang/clash/listener/inbound/shadowsocks_test.go index 7a26eecaf4..9950984de1 100644 --- a/clash-meta-android/core/src/foss/golang/clash/listener/inbound/shadowsocks_test.go +++ b/clash-meta-android/core/src/foss/golang/clash/listener/inbound/shadowsocks_test.go @@ -10,6 +10,7 @@ import ( "github.com/metacubex/mihomo/adapter/outbound" "github.com/metacubex/mihomo/listener/inbound" + "github.com/metacubex/mihomo/transport/kcptun" shadowtls "github.com/metacubex/mihomo/transport/sing-shadowtls" shadowsocks "github.com/metacubex/sing-shadowsocks" @@ -21,7 +22,7 @@ import ( var noneList = []string{shadowsocks.MethodNone} var shadowsocksCipherLists = [][]string{noneList, shadowaead.List, shadowaead_2022.List, shadowstream.List} -var shadowsocksCipherShortLists = [][]string{noneList, shadowaead.List[:5]} // for test shadowTLS +var shadowsocksCipherShortLists = [][]string{noneList, shadowaead.List[:5]} // for test shadowTLS and kcptun var shadowsocksPassword32 string var shadowsocksPassword16 string @@ -32,11 +33,11 @@ func init() { shadowsocksPassword16 = base64.StdEncoding.EncodeToString(passwordBytes[:16]) } -func testInboundShadowSocks(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption, cipherLists [][]string) { +func testInboundShadowSocks(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption, cipherLists [][]string, enableSingMux bool) { t.Parallel() for _, cipherList := range cipherLists { for i, cipher := range cipherList { - enableSingMux := i == 0 + enableSingMux := enableSingMux && i == 0 cipher := cipher t.Run(cipher, func(t *testing.T) { inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value @@ -100,19 +101,19 @@ func testInboundShadowSocks0(t *testing.T, inboundOptions inbound.ShadowSocksOpt func TestInboundShadowSocks_Basic(t *testing.T) { inboundOptions := inbound.ShadowSocksOption{} outboundOptions := outbound.ShadowSocksOption{} - testInboundShadowSocks(t, inboundOptions, outboundOptions, shadowsocksCipherLists) + testInboundShadowSocks(t, inboundOptions, outboundOptions, shadowsocksCipherLists, true) } func testInboundShadowSocksShadowTls(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption) { t.Parallel() t.Run("Conn", func(t *testing.T) { inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value - testInboundShadowSocks(t, inboundOptions, outboundOptions, shadowsocksCipherShortLists) + testInboundShadowSocks(t, inboundOptions, outboundOptions, shadowsocksCipherShortLists, true) }) t.Run("UConn", func(t *testing.T) { inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value outboundOptions.ClientFingerprint = "chrome" - testInboundShadowSocks(t, inboundOptions, outboundOptions, shadowsocksCipherShortLists) + testInboundShadowSocks(t, inboundOptions, outboundOptions, shadowsocksCipherShortLists, true) }) } @@ -163,3 +164,17 @@ func TestInboundShadowSocks_ShadowTlsv3(t *testing.T) { } testInboundShadowSocksShadowTls(t, inboundOptions, outboundOptions) } + +func TestInboundShadowSocks_KcpTun(t *testing.T) { + inboundOptions := inbound.ShadowSocksOption{ + KcpTun: inbound.KcpTun{ + Enable: true, + Key: shadowsocksPassword16, + }, + } + outboundOptions := outbound.ShadowSocksOption{ + Plugin: kcptun.Mode, + PluginOpts: map[string]any{"key": shadowsocksPassword16}, + } + testInboundShadowSocks(t, inboundOptions, outboundOptions, shadowsocksCipherShortLists, false) +} diff --git a/clash-meta-android/core/src/foss/golang/clash/listener/sing_shadowsocks/server.go b/clash-meta-android/core/src/foss/golang/clash/listener/sing_shadowsocks/server.go index 65adce659a..e106867d5d 100644 --- a/clash-meta-android/core/src/foss/golang/clash/listener/sing_shadowsocks/server.go +++ b/clash-meta-android/core/src/foss/golang/clash/listener/sing_shadowsocks/server.go @@ -14,6 +14,7 @@ import ( "github.com/metacubex/mihomo/listener/sing" "github.com/metacubex/mihomo/log" "github.com/metacubex/mihomo/ntp" + "github.com/metacubex/mihomo/transport/kcptun" shadowsocks "github.com/metacubex/sing-shadowsocks" "github.com/metacubex/sing-shadowsocks/shadowaead" @@ -138,6 +139,12 @@ func New(config LC.ShadowsocksServer, tunnel C.Tunnel, additions ...inbound.Addi } } + var kcptunServer *kcptun.Server + if config.KcpTun.Enable { + kcptunServer = kcptun.NewServer(config.KcpTun.Config) + config.Udp = true + } + for _, addr := range strings.Split(config.Listen, ",") { addr := addr @@ -154,6 +161,14 @@ func New(config LC.ShadowsocksServer, tunnel C.Tunnel, additions ...inbound.Addi sl.udpListeners = append(sl.udpListeners, ul) + if kcptunServer != nil { + go kcptunServer.Serve(ul, func(c net.Conn) { + sl.HandleConn(c, tunnel) + }) + + continue // skip tcp listener + } + go func() { conn := bufio.NewPacketConn(ul) rwOptions := network.NewReadWaitOptions(conn, sl.service) diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/anytls/client.go b/clash-meta-android/core/src/foss/golang/clash/transport/anytls/client.go index 4e74c9272c..dcb679ff4a 100644 --- a/clash-meta-android/core/src/foss/golang/clash/transport/anytls/client.go +++ b/clash-meta-android/core/src/foss/golang/clash/transport/anytls/client.go @@ -46,7 +46,7 @@ func NewClient(ctx context.Context, config ClientConfig) *Client { } // Initialize the padding state of this client padding.UpdatePaddingScheme(padding.DefaultPaddingScheme, &c.padding) - c.sessionClient = session.NewClient(ctx, c.CreateOutboundTLSConnection, &c.padding, config.IdleSessionCheckInterval, config.IdleSessionTimeout, config.MinIdleSession) + c.sessionClient = session.NewClient(ctx, c.createOutboundTLSConnection, &c.padding, config.IdleSessionCheckInterval, config.IdleSessionTimeout, config.MinIdleSession) return c } @@ -63,7 +63,7 @@ func (c *Client) CreateProxy(ctx context.Context, destination M.Socksaddr) (net. return conn, nil } -func (c *Client) CreateOutboundTLSConnection(ctx context.Context) (net.Conn, error) { +func (c *Client) createOutboundTLSConnection(ctx context.Context) (net.Conn, error) { conn, err := c.dialer.DialContext(ctx, N.NetworkTCP, c.server) if err != nil { return nil, err diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/client.go b/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/client.go index 0698bd5006..b2d1cf7f52 100644 --- a/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/client.go +++ b/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/client.go @@ -66,23 +66,21 @@ func (c *Client) CreateStream(ctx context.Context) (net.Conn, error) { var stream *Stream var err error - for i := 0; i < 3; i++ { - session, err = c.findSession(ctx) - if session == nil { - return nil, fmt.Errorf("failed to create session: %w", err) - } - stream, err = session.OpenStream() - if err != nil { - _ = session.Close() - continue - } - break + session = c.getIdleSession() + if session == nil { + session, err = c.createSession(ctx) } - if session == nil || stream == nil { - return nil, fmt.Errorf("too many closed session: %w", err) + if session == nil { + return nil, fmt.Errorf("failed to create session: %w", err) + } + stream, err = session.OpenStream() + if err != nil { + session.Close() + return nil, fmt.Errorf("failed to create stream: %w", err) } stream.dieHook = func() { + // If Session is not closed, put this Stream to pool if !session.IsClosed() { select { case <-c.die.Done(): @@ -100,9 +98,7 @@ func (c *Client) CreateStream(ctx context.Context) (net.Conn, error) { return stream, nil } -func (c *Client) findSession(ctx context.Context) (*Session, error) { - var idle *Session - +func (c *Client) getIdleSession() (idle *Session) { c.idleSessionLock.Lock() if !c.idleSession.IsEmpty() { it := c.idleSession.Iterate() @@ -110,12 +106,7 @@ func (c *Client) findSession(ctx context.Context) (*Session, error) { c.idleSession.Remove(it.Key()) } c.idleSessionLock.Unlock() - - if idle == nil { - s, err := c.createSession(ctx) - return s, err - } - return idle, nil + return } func (c *Client) createSession(ctx context.Context) (*Session, error) { @@ -127,7 +118,6 @@ func (c *Client) createSession(ctx context.Context) (*Session, error) { session := NewClientSession(underlying, c.padding) session.seq = c.sessionCounter.Add(1) session.dieHook = func() { - //logrus.Debugln("session died", session) c.idleSessionLock.Lock() c.idleSession.Remove(math.MaxUint64 - session.seq) c.idleSessionLock.Unlock() @@ -168,12 +158,11 @@ func (c *Client) idleCleanup() { } func (c *Client) idleCleanupExpTime(expTime time.Time) { - sessionToRemove := make([]*Session, 0, c.idleSession.Len()) + activeCount := 0 + sessionToClose := make([]*Session, 0, c.idleSession.Len()) c.idleSessionLock.Lock() it := c.idleSession.Iterate() - - activeCount := 0 for it.IsNotEnd() { session := it.Value() key := it.Key() @@ -190,12 +179,12 @@ func (c *Client) idleCleanupExpTime(expTime time.Time) { continue } - sessionToRemove = append(sessionToRemove, session) + sessionToClose = append(sessionToClose, session) c.idleSession.Remove(key) } c.idleSessionLock.Unlock() - for _, session := range sessionToRemove { + for _, session := range sessionToClose { session.Close() } } diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/session.go b/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/session.go index 23c3a087dc..12c5b682e5 100644 --- a/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/session.go +++ b/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/session.go @@ -90,7 +90,7 @@ func (s *Session) Run() { f := newFrame(cmdSettings, 0) f.data = settings.ToBytes() s.buffering = true - s.writeFrame(f) + s.writeControlFrame(f) go s.recvLoop() } @@ -119,7 +119,7 @@ func (s *Session) Close() error { } s.streamLock.Lock() for _, stream := range s.streams { - stream.Close() + stream.closeLocally() } s.streams = make(map[uint32]*Stream) s.streamLock.Unlock() @@ -138,8 +138,6 @@ func (s *Session) OpenStream() (*Stream, error) { sid := s.streamId.Add(1) stream := newStream(sid, s) - //logrus.Debugln("stream open", sid, s.streams) - if sid >= 2 && s.peerVersion >= 2 { s.synDoneLock.Lock() if s.synDone != nil { @@ -151,7 +149,7 @@ func (s *Session) OpenStream() (*Stream, error) { s.synDoneLock.Unlock() } - if _, err := s.writeFrame(newFrame(cmdSYN, sid)); err != nil { + if _, err := s.writeControlFrame(newFrame(cmdSYN, sid)); err != nil { return nil, err } @@ -207,7 +205,7 @@ func (s *Session) recvLoop() error { if !s.isClient && !receivedSettingsFromClient { f := newFrame(cmdAlert, 0) f.data = []byte("client did not send its settings") - s.writeFrame(f) + s.writeControlFrame(f) return nil } s.streamLock.Lock() @@ -241,18 +239,18 @@ func (s *Session) recvLoop() error { stream, ok := s.streams[sid] s.streamLock.RUnlock() if ok { - stream.CloseWithError(fmt.Errorf("remote: %s", string(buffer))) + stream.closeWithError(fmt.Errorf("remote: %s", string(buffer))) } pool.Put(buffer) } case cmdFIN: - s.streamLock.RLock() + s.streamLock.Lock() stream, ok := s.streams[sid] - s.streamLock.RUnlock() + delete(s.streams, sid) + s.streamLock.Unlock() if ok { - stream.Close() + stream.closeLocally() } - //logrus.Debugln("stream fin", sid, s.streams) case cmdWaste: if hdr.Length() > 0 { buffer := pool.Get(int(hdr.Length())) @@ -274,10 +272,9 @@ func (s *Session) recvLoop() error { m := util.StringMapFromBytes(buffer) paddingF := s.padding.Load() if m["padding-md5"] != paddingF.Md5 { - // logrus.Debugln("remote md5 is", m["padding-md5"]) f := newFrame(cmdUpdatePaddingScheme, 0) f.data = paddingF.RawScheme - _, err = s.writeFrame(f) + _, err = s.writeControlFrame(f) if err != nil { pool.Put(buffer) return err @@ -291,7 +288,7 @@ func (s *Session) recvLoop() error { f.data = util.StringMap{ "v": "2", }.ToBytes() - _, err = s.writeFrame(f) + _, err = s.writeControlFrame(f) if err != nil { pool.Put(buffer) return err @@ -329,7 +326,7 @@ func (s *Session) recvLoop() error { } } case cmdHeartRequest: - if _, err := s.writeFrame(newFrame(cmdHeartResponse, sid)); err != nil { + if _, err := s.writeControlFrame(newFrame(cmdHeartResponse, sid)); err != nil { return err } case cmdHeartResponse: @@ -364,14 +361,31 @@ func (s *Session) streamClosed(sid uint32) error { if s.IsClosed() { return io.ErrClosedPipe } - _, err := s.writeFrame(newFrame(cmdFIN, sid)) + _, err := s.writeControlFrame(newFrame(cmdFIN, sid)) s.streamLock.Lock() delete(s.streams, sid) s.streamLock.Unlock() return err } -func (s *Session) writeFrame(frame frame) (int, error) { +func (s *Session) writeDataFrame(sid uint32, data []byte) (int, error) { + dataLen := len(data) + + buffer := buf.NewSize(dataLen + headerOverHeadSize) + buffer.WriteByte(cmdPSH) + binary.BigEndian.PutUint32(buffer.Extend(4), sid) + binary.BigEndian.PutUint16(buffer.Extend(2), uint16(dataLen)) + buffer.Write(data) + _, err := s.writeConn(buffer.Bytes()) + buffer.Release() + if err != nil { + return 0, err + } + + return dataLen, nil +} + +func (s *Session) writeControlFrame(frame frame) (int, error) { dataLen := len(frame.data) buffer := buf.NewSize(dataLen + headerOverHeadSize) @@ -379,12 +393,18 @@ func (s *Session) writeFrame(frame frame) (int, error) { binary.BigEndian.PutUint32(buffer.Extend(4), frame.sid) binary.BigEndian.PutUint16(buffer.Extend(2), uint16(dataLen)) buffer.Write(frame.data) + + s.conn.SetWriteDeadline(time.Now().Add(time.Second * 5)) + _, err := s.writeConn(buffer.Bytes()) buffer.Release() if err != nil { + s.Close() return 0, err } + s.conn.SetWriteDeadline(time.Time{}) + return dataLen, nil } diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/stream.go b/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/stream.go index f7e8de673f..9827b0b3a3 100644 --- a/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/stream.go +++ b/clash-meta-android/core/src/foss/golang/clash/transport/anytls/session/stream.go @@ -53,21 +53,35 @@ func (s *Stream) Write(b []byte) (n int, err error) { return 0, os.ErrDeadlineExceeded default: } - f := newFrame(cmdPSH, s.id) - f.data = b - n, err = s.sess.writeFrame(f) + if s.dieErr != nil { + return 0, s.dieErr + } + n, err = s.sess.writeDataFrame(s.id, b) return } // Close implements net.Conn func (s *Stream) Close() error { - return s.CloseWithError(io.ErrClosedPipe) + return s.closeWithError(io.ErrClosedPipe) } -func (s *Stream) CloseWithError(err error) error { - // if err != io.ErrClosedPipe { - // logrus.Debugln(err) - // } +// closeLocally only closes Stream and don't notify remote peer +func (s *Stream) closeLocally() { + var once bool + s.dieOnce.Do(func() { + s.dieErr = net.ErrClosed + s.pipeR.Close() + once = true + }) + if once { + if s.dieHook != nil { + s.dieHook() + s.dieHook = nil + } + } +} + +func (s *Stream) closeWithError(err error) error { var once bool s.dieOnce.Do(func() { s.dieErr = err @@ -128,7 +142,7 @@ func (s *Stream) HandshakeFailure(err error) error { if once && err != nil && s.sess.peerVersion >= 2 { f := newFrame(cmdSYNACK, s.id) f.data = []byte(err.Error()) - if _, err := s.sess.writeFrame(f); err != nil { + if _, err := s.sess.writeControlFrame(f); err != nil { return err } } @@ -142,7 +156,7 @@ func (s *Stream) HandshakeSuccess() error { once = true }) if once && s.sess.peerVersion >= 2 { - if _, err := s.sess.writeFrame(newFrame(cmdSYNACK, s.id)); err != nil { + if _, err := s.sess.writeControlFrame(newFrame(cmdSYNACK, s.id)); err != nil { return err } } diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/LICENSE.md b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/LICENSE.md new file mode 100644 index 0000000000..b0c255f150 --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2016 xtaci + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/client.go b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/client.go new file mode 100644 index 0000000000..46731ca962 --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/client.go @@ -0,0 +1,171 @@ +package kcptun + +import ( + "context" + "net" + "sync" + "time" + + "github.com/metacubex/mihomo/log" + + "github.com/metacubex/kcp-go" + "github.com/metacubex/randv2" + "github.com/metacubex/smux" +) + +const Mode = "kcptun" + +type DialFn func(ctx context.Context) (net.PacketConn, net.Addr, error) + +type Client struct { + once sync.Once + config Config + block kcp.BlockCrypt + + ctx context.Context + cancel context.CancelFunc + + numconn uint16 + muxes []timedSession + rr uint16 + connMu sync.Mutex + + chScavenger chan timedSession +} + +func NewClient(config Config) *Client { + config.FillDefaults() + block := config.NewBlock() + + ctx, cancel := context.WithCancel(context.Background()) + + return &Client{ + config: config, + block: block, + ctx: ctx, + cancel: cancel, + } +} + +func (c *Client) Close() error { + c.cancel() + return nil +} + +func (c *Client) createConn(ctx context.Context, dial DialFn) (*smux.Session, error) { + conn, addr, err := dial(ctx) + if err != nil { + return nil, err + } + + config := c.config + convid := randv2.Uint32() + kcpconn, err := kcp.NewConn4(convid, addr, c.block, config.DataShard, config.ParityShard, true, conn) + if err != nil { + return nil, err + } + kcpconn.SetStreamMode(true) + kcpconn.SetWriteDelay(false) + kcpconn.SetNoDelay(config.NoDelay, config.Interval, config.Resend, config.NoCongestion) + kcpconn.SetWindowSize(config.SndWnd, config.RcvWnd) + kcpconn.SetMtu(config.MTU) + kcpconn.SetACKNoDelay(config.AckNodelay) + + _ = kcpconn.SetDSCP(config.DSCP) + _ = kcpconn.SetReadBuffer(config.SockBuf) + _ = kcpconn.SetWriteBuffer(config.SockBuf) + smuxConfig := smux.DefaultConfig() + smuxConfig.Version = config.SmuxVer + smuxConfig.MaxReceiveBuffer = config.SmuxBuf + smuxConfig.MaxStreamBuffer = config.StreamBuf + smuxConfig.KeepAliveInterval = time.Duration(config.KeepAlive) * time.Second + if smuxConfig.KeepAliveInterval >= smuxConfig.KeepAliveTimeout { + smuxConfig.KeepAliveTimeout = 3 * smuxConfig.KeepAliveInterval + } + + if err := smux.VerifyConfig(smuxConfig); err != nil { + return nil, err + } + + var netConn net.Conn = kcpconn + if !config.NoComp { + netConn = NewCompStream(netConn) + } + // stream multiplex + return smux.Client(netConn, smuxConfig) +} + +func (c *Client) OpenStream(ctx context.Context, dial DialFn) (*smux.Stream, error) { + c.once.Do(func() { + // start scavenger if autoexpire is set + c.chScavenger = make(chan timedSession, 128) + if c.config.AutoExpire > 0 { + go scavenger(c.ctx, c.chScavenger, &c.config) + } + + c.numconn = uint16(c.config.Conn) + c.muxes = make([]timedSession, c.config.Conn) + c.rr = uint16(0) + }) + + c.connMu.Lock() + idx := c.rr % c.numconn + + // do auto expiration && reconnection + if c.muxes[idx].session == nil || c.muxes[idx].session.IsClosed() || + (c.config.AutoExpire > 0 && time.Now().After(c.muxes[idx].expiryDate)) { + var err error + c.muxes[idx].session, err = c.createConn(ctx, dial) + if err != nil { + c.connMu.Unlock() + return nil, err + } + c.muxes[idx].expiryDate = time.Now().Add(time.Duration(c.config.AutoExpire) * time.Second) + if c.config.AutoExpire > 0 { // only when autoexpire set + c.chScavenger <- c.muxes[idx] + } + + } + c.rr++ + session := c.muxes[idx].session + c.connMu.Unlock() + + return session.OpenStream() +} + +// timedSession is a wrapper for smux.Session with expiry date +type timedSession struct { + session *smux.Session + expiryDate time.Time +} + +// scavenger goroutine is used to close expired sessions +func scavenger(ctx context.Context, ch chan timedSession, config *Config) { + ticker := time.NewTicker(scavengePeriod * time.Second) + defer ticker.Stop() + var sessionList []timedSession + for { + select { + case item := <-ch: + sessionList = append(sessionList, timedSession{ + item.session, + item.expiryDate.Add(time.Duration(config.ScavengeTTL) * time.Second)}) + case <-ticker.C: + var newList []timedSession + for k := range sessionList { + s := sessionList[k] + if s.session.IsClosed() { + log.Debugln("scavenger: session normally closed: %s", s.session.LocalAddr()) + } else if time.Now().After(s.expiryDate) { + s.session.Close() + log.Debugln("scavenger: session closed due to ttl: %s", s.session.LocalAddr()) + } else { + newList = append(newList, sessionList[k]) + } + } + sessionList = newList + case <-ctx.Done(): + return + } + } +} diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/common.go b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/common.go new file mode 100644 index 0000000000..ec260f06d2 --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/common.go @@ -0,0 +1,152 @@ +package kcptun + +import ( + "crypto/sha1" + + "github.com/metacubex/mihomo/log" + + "github.com/metacubex/kcp-go" + "golang.org/x/crypto/pbkdf2" +) + +const ( + // SALT is use for pbkdf2 key expansion + SALT = "kcp-go" + // maximum supported smux version + maxSmuxVer = 2 + // scavenger check period + scavengePeriod = 5 +) + +type Config struct { + Key string `json:"key"` + Crypt string `json:"crypt"` + Mode string `json:"mode"` + Conn int `json:"conn"` + AutoExpire int `json:"autoexpire"` + ScavengeTTL int `json:"scavengettl"` + MTU int `json:"mtu"` + SndWnd int `json:"sndwnd"` + RcvWnd int `json:"rcvwnd"` + DataShard int `json:"datashard"` + ParityShard int `json:"parityshard"` + DSCP int `json:"dscp"` + NoComp bool `json:"nocomp"` + AckNodelay bool `json:"acknodelay"` + NoDelay int `json:"nodelay"` + Interval int `json:"interval"` + Resend int `json:"resend"` + NoCongestion int `json:"nc"` + SockBuf int `json:"sockbuf"` + SmuxVer int `json:"smuxver"` + SmuxBuf int `json:"smuxbuf"` + StreamBuf int `json:"streambuf"` + KeepAlive int `json:"keepalive"` +} + +func (config *Config) FillDefaults() { + if config.Key == "" { + config.Key = "it's a secrect" + } + if config.Crypt == "" { + config.Crypt = "aes" + } + if config.Mode == "" { + config.Mode = "fast" + } + if config.Conn == 0 { + config.Conn = 1 + } + if config.ScavengeTTL == 0 { + config.ScavengeTTL = 600 + } + if config.MTU == 0 { + config.MTU = 1350 + } + if config.SndWnd == 0 { + config.SndWnd = 128 + } + if config.RcvWnd == 0 { + config.RcvWnd = 512 + } + if config.DataShard == 0 { + config.DataShard = 10 + } + if config.ParityShard == 0 { + config.ParityShard = 3 + } + if config.Interval == 0 { + config.Interval = 50 + } + if config.SockBuf == 0 { + config.SockBuf = 4194304 + } + if config.SmuxVer == 0 { + config.SmuxVer = 1 + } + if config.SmuxBuf == 0 { + config.SmuxBuf = 4194304 + } + if config.StreamBuf == 0 { + config.StreamBuf = 2097152 + } + if config.KeepAlive == 0 { + config.KeepAlive = 10 + } + switch config.Mode { + case "normal": + config.NoDelay, config.Interval, config.Resend, config.NoCongestion = 0, 40, 2, 1 + case "fast": + config.NoDelay, config.Interval, config.Resend, config.NoCongestion = 0, 30, 2, 1 + case "fast2": + config.NoDelay, config.Interval, config.Resend, config.NoCongestion = 1, 20, 2, 1 + case "fast3": + config.NoDelay, config.Interval, config.Resend, config.NoCongestion = 1, 10, 2, 1 + } + + // SMUX Version check + if config.SmuxVer > maxSmuxVer { + log.Warnln("unsupported smux version: %d", config.SmuxVer) + config.SmuxVer = maxSmuxVer + } + + // Scavenge parameters check + if config.AutoExpire != 0 && config.ScavengeTTL > config.AutoExpire { + log.Warnln("WARNING: scavengettl is bigger than autoexpire, connections may race hard to use bandwidth.") + log.Warnln("Try limiting scavengettl to a smaller value.") + } +} + +func (config *Config) NewBlock() (block kcp.BlockCrypt) { + pass := pbkdf2.Key([]byte(config.Key), []byte(SALT), 4096, 32, sha1.New) + switch config.Crypt { + case "null": + block = nil + case "tea": + block, _ = kcp.NewTEABlockCrypt(pass[:16]) + case "xor": + block, _ = kcp.NewSimpleXORBlockCrypt(pass) + case "none": + block, _ = kcp.NewNoneBlockCrypt(pass) + case "aes-128": + block, _ = kcp.NewAESBlockCrypt(pass[:16]) + case "aes-192": + block, _ = kcp.NewAESBlockCrypt(pass[:24]) + case "blowfish": + block, _ = kcp.NewBlowfishBlockCrypt(pass) + case "twofish": + block, _ = kcp.NewTwofishBlockCrypt(pass) + case "cast5": + block, _ = kcp.NewCast5BlockCrypt(pass[:16]) + case "3des": + block, _ = kcp.NewTripleDESBlockCrypt(pass[:24]) + case "xtea": + block, _ = kcp.NewXTEABlockCrypt(pass[:16]) + case "salsa20": + block, _ = kcp.NewSalsa20BlockCrypt(pass) + default: + config.Crypt = "aes" + block, _ = kcp.NewAESBlockCrypt(pass) + } + return +} diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/comp.go b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/comp.go new file mode 100644 index 0000000000..1efdd42a40 --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/comp.go @@ -0,0 +1,63 @@ +package kcptun + +import ( + "net" + "time" + + "github.com/golang/snappy" +) + +// CompStream is a net.Conn wrapper that compresses data using snappy +type CompStream struct { + conn net.Conn + w *snappy.Writer + r *snappy.Reader +} + +func (c *CompStream) Read(p []byte) (n int, err error) { + return c.r.Read(p) +} + +func (c *CompStream) Write(p []byte) (n int, err error) { + if _, err := c.w.Write(p); err != nil { + return 0, err + } + + if err := c.w.Flush(); err != nil { + return 0, err + } + return len(p), err +} + +func (c *CompStream) Close() error { + return c.conn.Close() +} + +func (c *CompStream) LocalAddr() net.Addr { + return c.conn.LocalAddr() +} + +func (c *CompStream) RemoteAddr() net.Addr { + return c.conn.RemoteAddr() +} + +func (c *CompStream) SetDeadline(t time.Time) error { + return c.conn.SetDeadline(t) +} + +func (c *CompStream) SetReadDeadline(t time.Time) error { + return c.conn.SetReadDeadline(t) +} + +func (c *CompStream) SetWriteDeadline(t time.Time) error { + return c.conn.SetWriteDeadline(t) +} + +// NewCompStream creates a new stream that compresses data using snappy +func NewCompStream(conn net.Conn) *CompStream { + c := new(CompStream) + c.conn = conn + c.w = snappy.NewBufferedWriter(conn) + c.r = snappy.NewReader(conn) + return c +} diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/doc.go b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/doc.go new file mode 100644 index 0000000000..e0801d2853 --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/doc.go @@ -0,0 +1,5 @@ +// Package kcptun copy and modify from: +// https://github.com/xtaci/kcptun/tree/52492c72592627d0005cbedbc4ba37fc36a95c3f +// adopt for mihomo +// without SM4,QPP,tcpraw support +package kcptun diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/server.go b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/server.go new file mode 100644 index 0000000000..5fcd440c8f --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/transport/kcptun/server.go @@ -0,0 +1,79 @@ +package kcptun + +import ( + "net" + "time" + + "github.com/metacubex/kcp-go" + "github.com/metacubex/smux" +) + +type Server struct { + config Config + block kcp.BlockCrypt +} + +func NewServer(config Config) *Server { + config.FillDefaults() + block := config.NewBlock() + + return &Server{ + config: config, + block: block, + } +} + +func (s *Server) Serve(pc net.PacketConn, handler func(net.Conn)) error { + lis, err := kcp.ServeConn(s.block, s.config.DataShard, s.config.ParityShard, pc) + if err != nil { + return err + } + defer lis.Close() + _ = lis.SetDSCP(s.config.DSCP) + _ = lis.SetReadBuffer(s.config.SockBuf) + _ = lis.SetWriteBuffer(s.config.SockBuf) + for { + conn, err := lis.AcceptKCP() + if err != nil { + return err + } + conn.SetStreamMode(true) + conn.SetWriteDelay(false) + conn.SetNoDelay(s.config.NoDelay, s.config.Interval, s.config.Resend, s.config.NoCongestion) + conn.SetMtu(s.config.MTU) + conn.SetWindowSize(s.config.SndWnd, s.config.RcvWnd) + conn.SetACKNoDelay(s.config.AckNodelay) + + var netConn net.Conn = conn + if !s.config.NoComp { + netConn = NewCompStream(netConn) + } + + go func() { + // stream multiplex + smuxConfig := smux.DefaultConfig() + smuxConfig.Version = s.config.SmuxVer + smuxConfig.MaxReceiveBuffer = s.config.SmuxBuf + smuxConfig.MaxStreamBuffer = s.config.StreamBuf + smuxConfig.KeepAliveInterval = time.Duration(s.config.KeepAlive) * time.Second + if smuxConfig.KeepAliveInterval >= smuxConfig.KeepAliveTimeout { + smuxConfig.KeepAliveTimeout = 3 * smuxConfig.KeepAliveInterval + } + + mux, err := smux.Server(netConn, smuxConfig) + if err != nil { + return + } + defer mux.Close() + + for { + stream, err := mux.AcceptStream() + if err != nil { + return + } + go handler(stream) + } + }() + + } +} diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/vless/encryption/client.go b/clash-meta-android/core/src/foss/golang/clash/transport/vless/encryption/client.go index 9c029ed73c..bcfce08ed8 100644 --- a/clash-meta-android/core/src/foss/golang/clash/transport/vless/encryption/client.go +++ b/clash-meta-android/core/src/foss/golang/clash/transport/vless/encryption/client.go @@ -7,23 +7,12 @@ import ( "errors" "io" "net" - "runtime" "sync" "time" "github.com/metacubex/blake3" + utls "github.com/metacubex/utls" "github.com/metacubex/utls/mlkem" - "golang.org/x/sys/cpu" -) - -var ( - // Keep in sync with crypto/tls/cipher_suites.go. - hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ && cpu.X86.HasSSE41 && cpu.X86.HasSSSE3 - hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL - hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCTR && cpu.S390X.HasGHASH - hasGCMAsmPPC64 = runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" - - HasAESGCMHardwareSupport = hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X || hasGCMAsmPPC64 ) type ClientInstance struct { @@ -77,7 +66,7 @@ func (i *ClientInstance) Handshake(conn net.Conn) (*CommonConn, error) { if i.NfsPKeys == nil { return nil, errors.New("uninitialized") } - c := NewCommonConn(conn, HasAESGCMHardwareSupport) + c := NewCommonConn(conn, utls.HasAESGCMHardwareSupport()) ivAndRealysLength := 16 + i.RelaysLength pfsKeyExchangeLength := 18 + 1184 + 32 + 16 diff --git a/clash-meta-android/core/src/foss/golang/clash/transport/vless/encryption/client_test.go b/clash-meta-android/core/src/foss/golang/clash/transport/vless/encryption/client_test.go new file mode 100644 index 0000000000..793d01919e --- /dev/null +++ b/clash-meta-android/core/src/foss/golang/clash/transport/vless/encryption/client_test.go @@ -0,0 +1,21 @@ +package encryption + +import ( + "fmt" + "runtime" + "testing" + + utls "github.com/metacubex/utls" +) + +func TestHasAESGCMHardwareSupport(t *testing.T) { + fmt.Println("HasAESGCMHardwareSupport:", utls.HasAESGCMHardwareSupport()) + + if runtime.GOARCH == "arm64" && runtime.GOOS == "darwin" { + // It should be supported starting from Apple Silicon M1 + // https://github.com/golang/go/blob/go1.25.0/src/internal/cpu/cpu_arm64_darwin.go#L26-L30 + if !utls.HasAESGCMHardwareSupport() { + t.Errorf("For ARM64 Darwin platforms (excluding iOS), AES GCM hardware acceleration should always be available.") + } + } +} diff --git a/clash-meta-android/core/src/foss/golang/go.mod b/clash-meta-android/core/src/foss/golang/go.mod index 487bc83d6f..5c3e5ddcb6 100644 --- a/clash-meta-android/core/src/foss/golang/go.mod +++ b/clash-meta-android/core/src/foss/golang/go.mod @@ -29,12 +29,15 @@ require ( github.com/gobwas/pool v0.2.1 // indirect github.com/gobwas/ws v1.4.0 // indirect github.com/gofrs/uuid/v5 v5.3.2 // indirect + github.com/golang/snappy v1.0.0 // indirect github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect github.com/insomniacslk/dhcp v0.0.0-20250109001534-8abf58130905 // indirect github.com/josharian/native v1.1.0 // indirect github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/klauspost/reedsolomon v1.12.3 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mdlayher/netlink v1.7.2 // indirect @@ -48,6 +51,7 @@ require ( github.com/metacubex/fswatch v0.1.1 // indirect github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 // indirect github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301 // indirect + github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b // indirect github.com/metacubex/mihomo v1.7.0 // indirect github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 // indirect github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 // indirect @@ -62,9 +66,9 @@ require ( github.com/metacubex/sing-tun v0.4.8 // indirect github.com/metacubex/sing-vmess v0.2.4 // indirect github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f // indirect - github.com/metacubex/smux v0.0.0-20250503055512-501391591dee // indirect + github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 // indirect github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 // indirect - github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 // indirect + github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e // indirect github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f // indirect github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 // indirect github.com/miekg/dns v1.1.63 // indirect diff --git a/clash-meta-android/core/src/foss/golang/go.sum b/clash-meta-android/core/src/foss/golang/go.sum index eacd0223d0..bea6604764 100644 --- a/clash-meta-android/core/src/foss/golang/go.sum +++ b/clash-meta-android/core/src/foss/golang/go.sum @@ -59,6 +59,8 @@ github.com/gofrs/uuid/v5 v5.3.2 h1:2jfO8j3XgSwlz/wHqemAEugfnTlikAYHhnqQ8Xh4fE0= github.com/gofrs/uuid/v5 v5.3.2/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= +github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -76,6 +78,10 @@ github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtL github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/reedsolomon v1.12.3 h1:tzUznbfc3OFwJaTebv/QdhnFf2Xvb7gZ24XaHLBPmdc= +github.com/klauspost/reedsolomon v1.12.3/go.mod h1:3K5rXwABAvzGeR01r6pWZieUALXO/Tq7bFKGIb4m4WI= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -102,6 +108,8 @@ github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvO github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759/go.mod h1:UHOv2xu+RIgLwpXca7TLrXleEd4oR3sPatW6IF8wU88= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301 h1:N5GExQJqYAH3gOCshpp2u/J3CtNYzMctmlb0xK9wtbQ= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301/go.mod h1:8LpS0IJW1VmWzUm3ylb0e2SK5QDm5lO/2qwWLZgRpBU= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b h1:z7JLKjugnQ1qvDOAD8yMA5C8AlJY3bG+VrrgRntRlUY= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b/go.mod h1:HIJZW4QMhbBqXuqC1ly6Hn0TEYT2SzRw58ns1yGhXTs= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 h1:1Qpuy+sU3DmyX9HwI+CrBT/oLNJngvBorR2RbajJcqo= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793/go.mod h1:RjRNb4G52yAgfR+Oe/kp9G4PJJ97Fnj89eY1BFO3YyA= github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 h1:8JVlYuE8uSJAvmyCd4TjvDxs57xjb0WxEoaWafK5+qs= @@ -129,12 +137,12 @@ github.com/metacubex/sing-vmess v0.2.4 h1:Tx6AGgCiEf400E/xyDuYyafsel6sGbR8oF7RkA github.com/metacubex/sing-vmess v0.2.4/go.mod h1:21R5R1u90uUvBQF0owoooEu96/SAYYD56nDrwm6nFaM= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f h1:Sr/DYKYofKHKc4GF3qkRGNuj6XA6c0eqPgEDN+VAsYU= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f/go.mod h1:jpAkVLPnCpGSfNyVmj6Cq4YbuZsFepm/Dc+9BAOcR80= -github.com/metacubex/smux v0.0.0-20250503055512-501391591dee h1:lp6hJ+4wCLZu113awp7P6odM2okB5s60HUyF0FMqKmo= -github.com/metacubex/smux v0.0.0-20250503055512-501391591dee/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= +github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 h1:T6qCCfolRDAVJKeaPW/mXwNLjnlo65AYN7WS2jrBNaM= +github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 h1:Ui+/2s5Qz0lSnDUBmEL12M5Oi/PzvFxGTNohm8ZcsmE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 h1:5OGzQvoE5yuOe8AsZsFwhf32ZxKmKN9G+k06AVd+6jY= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2/go.mod h1:GN/CB3TRwQ9LYquYpIFynDkvMTYmkjwI7+mkUIoHj88= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e h1:t9IxEaxSRp3YJ1ewQV4oGkKaJaMeSoUWjOV0boLVQo8= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e/go.mod h1:kncGGVhFaoGn5M3pFe3SXhZCzsbCJayNOH4UEqTKTko= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f h1:FGBPRb1zUabhPhDrlKEjQ9lgIwQ6cHL4x8M9lrERhbk= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f/go.mod h1:oPGcV994OGJedmmxrcK9+ni7jUEMGhR+uVQAdaduIP4= github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 h1:lhlqpYHopuTLx9xQt22kSA9HtnyTDmk5XjjQVCGHe2E= @@ -192,7 +200,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/tiendc/go-deepcopy v1.6.1 h1:uVRTItFeNHkMcLueHS7OCsxgxT9P8MzGB/taUa2Y4Tk= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -210,6 +217,7 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= +github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae h1:J0GxkO96kL4WF+AIT3M4mfUVinOCPgf2uUWYFUzN0sM= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= gitlab.com/go-extension/aes-ccm v0.0.0-20230221065045-e58665ef23c7 h1:UNrDfkQqiEYzdMlNsVvBYOAJWZjdktqFE9tQh5BT2+4= @@ -248,6 +256,7 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/clash-meta-android/core/src/main/golang/go.mod b/clash-meta-android/core/src/main/golang/go.mod index f04f12f399..36a65205f6 100644 --- a/clash-meta-android/core/src/main/golang/go.mod +++ b/clash-meta-android/core/src/main/golang/go.mod @@ -36,12 +36,15 @@ require ( github.com/gobwas/ws v1.4.0 // indirect github.com/gofrs/uuid/v5 v5.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/snappy v1.0.0 // indirect github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect github.com/insomniacslk/dhcp v0.0.0-20250109001534-8abf58130905 // indirect github.com/josharian/native v1.1.0 // indirect github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/klauspost/reedsolomon v1.12.3 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mdlayher/netlink v1.7.2 // indirect @@ -55,6 +58,7 @@ require ( github.com/metacubex/fswatch v0.1.1 // indirect github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 // indirect github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301 // indirect + github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b // indirect github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 // indirect github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 // indirect github.com/metacubex/randv2 v0.2.0 // indirect @@ -68,9 +72,9 @@ require ( github.com/metacubex/sing-tun v0.4.8 // indirect github.com/metacubex/sing-vmess v0.2.4 // indirect github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f // indirect - github.com/metacubex/smux v0.0.0-20250503055512-501391591dee // indirect + github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 // indirect github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 // indirect - github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 // indirect + github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e // indirect github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f // indirect github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 // indirect github.com/miekg/dns v1.1.63 // indirect diff --git a/clash-meta-android/core/src/main/golang/go.sum b/clash-meta-android/core/src/main/golang/go.sum index c0bc214ec6..a86e2da9e7 100644 --- a/clash-meta-android/core/src/main/golang/go.sum +++ b/clash-meta-android/core/src/main/golang/go.sum @@ -60,6 +60,8 @@ github.com/gofrs/uuid/v5 v5.3.2/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= +github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -77,6 +79,10 @@ github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtL github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/reedsolomon v1.12.3 h1:tzUznbfc3OFwJaTebv/QdhnFf2Xvb7gZ24XaHLBPmdc= +github.com/klauspost/reedsolomon v1.12.3/go.mod h1:3K5rXwABAvzGeR01r6pWZieUALXO/Tq7bFKGIb4m4WI= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -103,6 +109,8 @@ github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvO github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759/go.mod h1:UHOv2xu+RIgLwpXca7TLrXleEd4oR3sPatW6IF8wU88= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301 h1:N5GExQJqYAH3gOCshpp2u/J3CtNYzMctmlb0xK9wtbQ= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301/go.mod h1:8LpS0IJW1VmWzUm3ylb0e2SK5QDm5lO/2qwWLZgRpBU= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b h1:z7JLKjugnQ1qvDOAD8yMA5C8AlJY3bG+VrrgRntRlUY= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b/go.mod h1:HIJZW4QMhbBqXuqC1ly6Hn0TEYT2SzRw58ns1yGhXTs= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 h1:1Qpuy+sU3DmyX9HwI+CrBT/oLNJngvBorR2RbajJcqo= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793/go.mod h1:RjRNb4G52yAgfR+Oe/kp9G4PJJ97Fnj89eY1BFO3YyA= github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 h1:8JVlYuE8uSJAvmyCd4TjvDxs57xjb0WxEoaWafK5+qs= @@ -130,12 +138,12 @@ github.com/metacubex/sing-vmess v0.2.4 h1:Tx6AGgCiEf400E/xyDuYyafsel6sGbR8oF7RkA github.com/metacubex/sing-vmess v0.2.4/go.mod h1:21R5R1u90uUvBQF0owoooEu96/SAYYD56nDrwm6nFaM= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f h1:Sr/DYKYofKHKc4GF3qkRGNuj6XA6c0eqPgEDN+VAsYU= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f/go.mod h1:jpAkVLPnCpGSfNyVmj6Cq4YbuZsFepm/Dc+9BAOcR80= -github.com/metacubex/smux v0.0.0-20250503055512-501391591dee h1:lp6hJ+4wCLZu113awp7P6odM2okB5s60HUyF0FMqKmo= -github.com/metacubex/smux v0.0.0-20250503055512-501391591dee/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= +github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 h1:T6qCCfolRDAVJKeaPW/mXwNLjnlo65AYN7WS2jrBNaM= +github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 h1:Ui+/2s5Qz0lSnDUBmEL12M5Oi/PzvFxGTNohm8ZcsmE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 h1:5OGzQvoE5yuOe8AsZsFwhf32ZxKmKN9G+k06AVd+6jY= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2/go.mod h1:GN/CB3TRwQ9LYquYpIFynDkvMTYmkjwI7+mkUIoHj88= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e h1:t9IxEaxSRp3YJ1ewQV4oGkKaJaMeSoUWjOV0boLVQo8= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e/go.mod h1:kncGGVhFaoGn5M3pFe3SXhZCzsbCJayNOH4UEqTKTko= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f h1:FGBPRb1zUabhPhDrlKEjQ9lgIwQ6cHL4x8M9lrERhbk= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f/go.mod h1:oPGcV994OGJedmmxrcK9+ni7jUEMGhR+uVQAdaduIP4= github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 h1:lhlqpYHopuTLx9xQt22kSA9HtnyTDmk5XjjQVCGHe2E= @@ -193,7 +201,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/tiendc/go-deepcopy v1.6.1 h1:uVRTItFeNHkMcLueHS7OCsxgxT9P8MzGB/taUa2Y4Tk= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -211,6 +218,7 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= +github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae h1:J0GxkO96kL4WF+AIT3M4mfUVinOCPgf2uUWYFUzN0sM= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= gitlab.com/go-extension/aes-ccm v0.0.0-20230221065045-e58665ef23c7 h1:UNrDfkQqiEYzdMlNsVvBYOAJWZjdktqFE9tQh5BT2+4= @@ -249,6 +257,7 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/clash-meta/adapter/outbound/mieru.go b/clash-meta/adapter/outbound/mieru.go index 8ef9cfd758..bfdf0e519f 100644 --- a/clash-meta/adapter/outbound/mieru.go +++ b/clash-meta/adapter/outbound/mieru.go @@ -5,6 +5,7 @@ import ( "fmt" "net" "strconv" + "strings" "sync" CN "github.com/metacubex/mihomo/common/net" @@ -30,8 +31,8 @@ type MieruOption struct { BasicOption Name string `proxy:"name"` Server string `proxy:"server"` - Port int `proxy:"port,omitempty"` - PortRange string `proxy:"port-range,omitempty"` + Port string `proxy:"port,omitempty"` + PortRange string `proxy:"port-range,omitempty"` // deprecated Transport string `proxy:"transport"` UDP bool `proxy:"udp,omitempty"` UserName string `proxy:"username"` @@ -123,13 +124,19 @@ func NewMieru(option MieruOption) (*Mieru, error) { } // Client is started lazily on the first use. + // Use the first port to construct the address. var addr string - if option.Port != 0 { - addr = net.JoinHostPort(option.Server, strconv.Itoa(option.Port)) + var portStr string + if option.Port != "" { + portStr = option.Port } else { - beginPort, _, _ := beginAndEndPortFromPortRange(option.PortRange) - addr = net.JoinHostPort(option.Server, strconv.Itoa(beginPort)) + portStr = option.PortRange } + firstPort, err := getFirstPort(portStr) + if err != nil { + return nil, fmt.Errorf("failed to get first port from port string %q: %w", portStr, err) + } + addr = net.JoinHostPort(option.Server, strconv.Itoa(firstPort)) outbound := &Mieru{ Base: &Base{ name: option.Name, @@ -183,54 +190,62 @@ func buildMieruClientConfig(option MieruOption) (*mieruclient.ClientConfig, erro } transportProtocol := mierupb.TransportProtocol_TCP.Enum() - var server *mierupb.ServerEndpoint - if net.ParseIP(option.Server) != nil { - // server is an IP address - if option.PortRange != "" { - server = &mierupb.ServerEndpoint{ - IpAddress: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - PortRange: proto.String(option.PortRange), + + portBindings := make([]*mierupb.PortBinding, 0) + if option.Port != "" { + parts := strings.Split(option.Port, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if strings.Contains(part, "-") { + _, _, err := beginAndEndPortFromPortRange(part) + if err == nil { + portBindings = append(portBindings, &mierupb.PortBinding{ + PortRange: proto.String(part), Protocol: transportProtocol, - }, - }, - } - } else { - server = &mierupb.ServerEndpoint{ - IpAddress: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - Port: proto.Int32(int32(option.Port)), - Protocol: transportProtocol, - }, - }, - } - } - } else { - // server is a domain name - if option.PortRange != "" { - server = &mierupb.ServerEndpoint{ - DomainName: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - PortRange: proto.String(option.PortRange), - Protocol: transportProtocol, - }, - }, - } - } else { - server = &mierupb.ServerEndpoint{ - DomainName: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - Port: proto.Int32(int32(option.Port)), - Protocol: transportProtocol, - }, - }, + }) + } else { + return nil, err + } + } else { + p, err := strconv.Atoi(part) + if err != nil { + return nil, fmt.Errorf("invalid port value: %s", part) + } + portBindings = append(portBindings, &mierupb.PortBinding{ + Port: proto.Int32(int32(p)), + Protocol: transportProtocol, + }) } } } + if option.PortRange != "" { + parts := strings.Split(option.PortRange, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if _, _, err := beginAndEndPortFromPortRange(part); err == nil { + portBindings = append(portBindings, &mierupb.PortBinding{ + PortRange: proto.String(part), + Protocol: transportProtocol, + }) + } + } + } + + var server *mierupb.ServerEndpoint + if net.ParseIP(option.Server) != nil { + // server is an IP address + server = &mierupb.ServerEndpoint{ + IpAddress: proto.String(option.Server), + PortBindings: portBindings, + } + } else { + // server is a domain name + server = &mierupb.ServerEndpoint{ + DomainName: proto.String(option.Server), + PortBindings: portBindings, + } + } + config := &mieruclient.ClientConfig{ Profile: &mierupb.ClientProfile{ ProfileName: proto.String(option.Name), @@ -259,31 +274,9 @@ func validateMieruOption(option MieruOption) error { if option.Server == "" { return fmt.Errorf("server is empty") } - if option.Port == 0 && option.PortRange == "" { - return fmt.Errorf("either port or port-range must be set") + if option.Port == "" && option.PortRange == "" { + return fmt.Errorf("port must be set") } - if option.Port != 0 && option.PortRange != "" { - return fmt.Errorf("port and port-range cannot be set at the same time") - } - if option.Port != 0 && (option.Port < 1 || option.Port > 65535) { - return fmt.Errorf("port must be between 1 and 65535") - } - if option.PortRange != "" { - begin, end, err := beginAndEndPortFromPortRange(option.PortRange) - if err != nil { - return fmt.Errorf("invalid port-range format") - } - if begin < 1 || begin > 65535 { - return fmt.Errorf("begin port must be between 1 and 65535") - } - if end < 1 || end > 65535 { - return fmt.Errorf("end port must be between 1 and 65535") - } - if begin > end { - return fmt.Errorf("begin port must be less than or equal to end port") - } - } - if option.Transport != "TCP" { return fmt.Errorf("transport must be TCP") } @@ -306,8 +299,36 @@ func validateMieruOption(option MieruOption) error { return nil } +func getFirstPort(portStr string) (int, error) { + if portStr == "" { + return 0, fmt.Errorf("port string is empty") + } + parts := strings.Split(portStr, ",") + firstPart := parts[0] + + if strings.Contains(firstPart, "-") { + begin, _, err := beginAndEndPortFromPortRange(firstPart) + if err != nil { + return 0, err + } + return begin, nil + } + + port, err := strconv.Atoi(firstPart) + if err != nil { + return 0, fmt.Errorf("invalid port format: %s", firstPart) + } + return port, nil +} + func beginAndEndPortFromPortRange(portRange string) (int, int, error) { var begin, end int _, err := fmt.Sscanf(portRange, "%d-%d", &begin, &end) + if err != nil { + return 0, 0, fmt.Errorf("invalid port range format: %w", err) + } + if begin > end { + return 0, 0, fmt.Errorf("begin port is greater than end port: %s", portRange) + } return begin, end, err } diff --git a/clash-meta/adapter/outbound/mieru_test.go b/clash-meta/adapter/outbound/mieru_test.go index 086b791044..2b7976e4c7 100644 --- a/clash-meta/adapter/outbound/mieru_test.go +++ b/clash-meta/adapter/outbound/mieru_test.go @@ -1,22 +1,51 @@ package outbound -import "testing" +import ( + "reflect" + "testing" + + mieruclient "github.com/enfein/mieru/v3/apis/client" + mierupb "github.com/enfein/mieru/v3/pkg/appctl/appctlpb" + "google.golang.org/protobuf/proto" +) func TestNewMieru(t *testing.T) { + transportProtocol := mierupb.TransportProtocol_TCP.Enum() testCases := []struct { option MieruOption wantBaseAddr string + wantConfig *mieruclient.ClientConfig }{ { option: MieruOption{ Name: "test", Server: "1.2.3.4", - Port: 10000, + Port: "10000", Transport: "TCP", UserName: "test", Password: "test", }, wantBaseAddr: "1.2.3.4:10000", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + IpAddress: proto.String("1.2.3.4"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10000), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, { option: MieruOption{ @@ -28,28 +57,212 @@ func TestNewMieru(t *testing.T) { Password: "test", }, wantBaseAddr: "[2001:db8::1]:10001", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + IpAddress: proto.String("2001:db8::1"), + PortBindings: []*mierupb.PortBinding{ + { + PortRange: proto.String("10001-10002"), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, { option: MieruOption{ Name: "test", Server: "example.com", - Port: 10003, + Port: "10003", Transport: "TCP", UserName: "test", Password: "test", }, wantBaseAddr: "example.com:10003", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10003), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10004,10005", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10004", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10004), + Protocol: transportProtocol, + }, + { + Port: proto.Int32(10005), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10006-10007,11000", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10006", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + PortRange: proto.String("10006-10007"), + Protocol: transportProtocol, + }, + { + Port: proto.Int32(11000), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10008", + PortRange: "10009-10010", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10008", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10008), + Protocol: transportProtocol, + }, + { + PortRange: proto.String("10009-10010"), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, } for _, testCase := range testCases { mieru, err := NewMieru(testCase.option) if err != nil { - t.Error(err) + t.Fatal(err) } + config, err := mieru.client.Load() + if err != nil { + t.Fatal(err) + } + config.Dialer = nil if mieru.addr != testCase.wantBaseAddr { t.Errorf("got addr %q, want %q", mieru.addr, testCase.wantBaseAddr) } + if !reflect.DeepEqual(config, testCase.wantConfig) { + t.Errorf("got config %+v, want %+v", config, testCase.wantConfig) + } + } +} + +func TestNewMieruError(t *testing.T) { + testCases := []MieruOption{ + { + Name: "test", + Server: "example.com", + Port: "invalid", + PortRange: "invalid", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + { + Name: "test", + Server: "example.com", + Port: "", + PortRange: "", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + } + + for _, option := range testCases { + _, err := NewMieru(option) + if err == nil { + t.Errorf("expected error for option %+v, but got nil", option) + } } } @@ -63,6 +276,7 @@ func TestBeginAndEndPortFromPortRange(t *testing.T) { {"1-10", 1, 10, false}, {"1000-2000", 1000, 2000, false}, {"65535-65535", 65535, 65535, false}, + {"2000-1000", 0, 0, true}, {"1", 0, 0, true}, {"1-", 0, 0, true}, {"-10", 0, 0, true}, diff --git a/clash-meta/component/tls/reality.go b/clash-meta/component/tls/reality.go index cd6a47538e..fe1135f3c4 100644 --- a/clash-meta/component/tls/reality.go +++ b/clash-meta/component/tls/reality.go @@ -24,7 +24,6 @@ import ( "github.com/metacubex/randv2" utls "github.com/metacubex/utls" - "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/hkdf" "golang.org/x/net/http2" ) @@ -107,13 +106,8 @@ func GetRealityConn(ctx context.Context, conn net.Conn, fingerprint UClientHello if err != nil { return nil, err } - var aeadCipher cipher.AEAD - if utls.AesgcmPreferred(hello.CipherSuites) { - aesBlock, _ := aes.NewCipher(authKey) - aeadCipher, _ = cipher.NewGCM(aesBlock) - } else { - aeadCipher, _ = chacha20poly1305.New(authKey) - } + aesBlock, _ := aes.NewCipher(authKey) + aeadCipher, _ := cipher.NewGCM(aesBlock) aeadCipher.Seal(hello.SessionId[:0], hello.Random[20:], hello.SessionId[:16], hello.Raw) copy(hello.Raw[39:], hello.SessionId) //log.Debugln("REALITY hello.sessionId: %v", hello.SessionId) diff --git a/clash-meta/docs/config.yaml b/clash-meta/docs/config.yaml index b2d86c2318..574188182a 100644 --- a/clash-meta/docs/config.yaml +++ b/clash-meta/docs/config.yaml @@ -1024,8 +1024,8 @@ proxies: # socks5 - name: mieru type: mieru server: 1.2.3.4 - port: 2999 - # port-range: 2090-2099 #(不可同时填写 port 和 port-range) + port: 2999 # 支持使用 ports 格式,例如 2999,3999 或 2999-3010,3950,3995-3999 + # port-range: 2090-2099 # 已废弃,请使用 port transport: TCP # 只支持 TCP udp: true # 支持 UDP over TCP username: user diff --git a/clash-meta/go.mod b/clash-meta/go.mod index e7f0316dd0..d807b73219 100644 --- a/clash-meta/go.mod +++ b/clash-meta/go.mod @@ -22,7 +22,7 @@ require ( github.com/metacubex/chacha v0.1.5 github.com/metacubex/fswatch v0.1.1 github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 - github.com/metacubex/kcp-go v0.0.0-20250922034656-df9a2b90cdf7 + github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 github.com/metacubex/randv2 v0.2.0 github.com/metacubex/restls-client-go v0.1.7 @@ -37,7 +37,7 @@ require ( github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 - github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 + github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f github.com/miekg/dns v1.1.63 // lastest version compatible with golang1.20 github.com/mroth/weightedrand/v2 v2.1.0 diff --git a/clash-meta/go.sum b/clash-meta/go.sum index f27f5bafb5..5bd6da5110 100644 --- a/clash-meta/go.sum +++ b/clash-meta/go.sum @@ -112,8 +112,8 @@ github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvO github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759/go.mod h1:UHOv2xu+RIgLwpXca7TLrXleEd4oR3sPatW6IF8wU88= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301 h1:N5GExQJqYAH3gOCshpp2u/J3CtNYzMctmlb0xK9wtbQ= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301/go.mod h1:8LpS0IJW1VmWzUm3ylb0e2SK5QDm5lO/2qwWLZgRpBU= -github.com/metacubex/kcp-go v0.0.0-20250922034656-df9a2b90cdf7 h1:vGsrjQxlepSfkMALzJuvDzd+wp6NvKXpoyPuPb4SYCE= -github.com/metacubex/kcp-go v0.0.0-20250922034656-df9a2b90cdf7/go.mod h1:HIJZW4QMhbBqXuqC1ly6Hn0TEYT2SzRw58ns1yGhXTs= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b h1:z7JLKjugnQ1qvDOAD8yMA5C8AlJY3bG+VrrgRntRlUY= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b/go.mod h1:HIJZW4QMhbBqXuqC1ly6Hn0TEYT2SzRw58ns1yGhXTs= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 h1:1Qpuy+sU3DmyX9HwI+CrBT/oLNJngvBorR2RbajJcqo= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793/go.mod h1:RjRNb4G52yAgfR+Oe/kp9G4PJJ97Fnj89eY1BFO3YyA= github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 h1:8JVlYuE8uSJAvmyCd4TjvDxs57xjb0WxEoaWafK5+qs= @@ -145,8 +145,8 @@ github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 h1:T6qCCfolRDAVJKea github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 h1:Ui+/2s5Qz0lSnDUBmEL12M5Oi/PzvFxGTNohm8ZcsmE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 h1:5OGzQvoE5yuOe8AsZsFwhf32ZxKmKN9G+k06AVd+6jY= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2/go.mod h1:GN/CB3TRwQ9LYquYpIFynDkvMTYmkjwI7+mkUIoHj88= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e h1:t9IxEaxSRp3YJ1ewQV4oGkKaJaMeSoUWjOV0boLVQo8= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e/go.mod h1:kncGGVhFaoGn5M3pFe3SXhZCzsbCJayNOH4UEqTKTko= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f h1:FGBPRb1zUabhPhDrlKEjQ9lgIwQ6cHL4x8M9lrERhbk= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f/go.mod h1:oPGcV994OGJedmmxrcK9+ni7jUEMGhR+uVQAdaduIP4= github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 h1:lhlqpYHopuTLx9xQt22kSA9HtnyTDmk5XjjQVCGHe2E= @@ -206,7 +206,6 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/tiendc/go-deepcopy v1.6.1 h1:uVRTItFeNHkMcLueHS7OCsxgxT9P8MzGB/taUa2Y4Tk= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= diff --git a/clash-meta/transport/kcptun/client.go b/clash-meta/transport/kcptun/client.go index af84133e36..46731ca962 100644 --- a/clash-meta/transport/kcptun/client.go +++ b/clash-meta/transport/kcptun/client.go @@ -2,8 +2,6 @@ package kcptun import ( "context" - "crypto/rand" - "encoding/binary" "net" "sync" "time" @@ -11,6 +9,7 @@ import ( "github.com/metacubex/mihomo/log" "github.com/metacubex/kcp-go" + "github.com/metacubex/randv2" "github.com/metacubex/smux" ) @@ -60,8 +59,7 @@ func (c *Client) createConn(ctx context.Context, dial DialFn) (*smux.Session, er } config := c.config - var convid uint32 - binary.Read(rand.Reader, binary.LittleEndian, &convid) + convid := randv2.Uint32() kcpconn, err := kcp.NewConn4(convid, addr, c.block, config.DataShard, config.ParityShard, true, conn) if err != nil { return nil, err diff --git a/clash-meta/transport/vless/encryption/client.go b/clash-meta/transport/vless/encryption/client.go index 9c029ed73c..bcfce08ed8 100644 --- a/clash-meta/transport/vless/encryption/client.go +++ b/clash-meta/transport/vless/encryption/client.go @@ -7,23 +7,12 @@ import ( "errors" "io" "net" - "runtime" "sync" "time" "github.com/metacubex/blake3" + utls "github.com/metacubex/utls" "github.com/metacubex/utls/mlkem" - "golang.org/x/sys/cpu" -) - -var ( - // Keep in sync with crypto/tls/cipher_suites.go. - hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ && cpu.X86.HasSSE41 && cpu.X86.HasSSSE3 - hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL - hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCTR && cpu.S390X.HasGHASH - hasGCMAsmPPC64 = runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" - - HasAESGCMHardwareSupport = hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X || hasGCMAsmPPC64 ) type ClientInstance struct { @@ -77,7 +66,7 @@ func (i *ClientInstance) Handshake(conn net.Conn) (*CommonConn, error) { if i.NfsPKeys == nil { return nil, errors.New("uninitialized") } - c := NewCommonConn(conn, HasAESGCMHardwareSupport) + c := NewCommonConn(conn, utls.HasAESGCMHardwareSupport()) ivAndRealysLength := 16 + i.RelaysLength pfsKeyExchangeLength := 18 + 1184 + 32 + 16 diff --git a/clash-meta/transport/vless/encryption/client_test.go b/clash-meta/transport/vless/encryption/client_test.go new file mode 100644 index 0000000000..793d01919e --- /dev/null +++ b/clash-meta/transport/vless/encryption/client_test.go @@ -0,0 +1,21 @@ +package encryption + +import ( + "fmt" + "runtime" + "testing" + + utls "github.com/metacubex/utls" +) + +func TestHasAESGCMHardwareSupport(t *testing.T) { + fmt.Println("HasAESGCMHardwareSupport:", utls.HasAESGCMHardwareSupport()) + + if runtime.GOARCH == "arm64" && runtime.GOOS == "darwin" { + // It should be supported starting from Apple Silicon M1 + // https://github.com/golang/go/blob/go1.25.0/src/internal/cpu/cpu_arm64_darwin.go#L26-L30 + if !utls.HasAESGCMHardwareSupport() { + t.Errorf("For ARM64 Darwin platforms (excluding iOS), AES GCM hardware acceleration should always be available.") + } + } +} diff --git a/clash-nyanpasu/CODE_OF_CONDUCT.md b/clash-nyanpasu/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..b0c7f7f0a6 --- /dev/null +++ b/clash-nyanpasu/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +i@elaina.moe. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/clash-nyanpasu/backend/Cargo.lock b/clash-nyanpasu/backend/Cargo.lock index 39c71e07a3..84b855aef6 100644 --- a/clash-nyanpasu/backend/Cargo.lock +++ b/clash-nyanpasu/backend/Cargo.lock @@ -9735,11 +9735,12 @@ dependencies = [ [[package]] name = "time" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bde6f1ec10e72d583d91623c939f623002284ef622b87de38cfd546cbf2031" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", + "itoa", "js-sys", "libc", "num-conv", diff --git a/clash-nyanpasu/frontend/interface/src/ipc/use-clash-connections.ts b/clash-nyanpasu/frontend/interface/src/ipc/use-clash-connections.ts index 412aea22d4..661cb549e9 100644 --- a/clash-nyanpasu/frontend/interface/src/ipc/use-clash-connections.ts +++ b/clash-nyanpasu/frontend/interface/src/ipc/use-clash-connections.ts @@ -57,6 +57,9 @@ export const useClashConnections = () => { ]) || [] ) }, + // Ensure the query is enabled and properly initialized + enabled: true, + staleTime: 0, // Data is always fresh as it comes from WebSocket }) const deleteConnections = useMutation({ diff --git a/clash-nyanpasu/frontend/nyanpasu/package.json b/clash-nyanpasu/frontend/nyanpasu/package.json index d84e4643b8..a128741f04 100644 --- a/clash-nyanpasu/frontend/nyanpasu/package.json +++ b/clash-nyanpasu/frontend/nyanpasu/package.json @@ -31,7 +31,7 @@ "country-code-emoji": "2.3.0", "country-emoji": "1.5.6", "dayjs": "1.11.18", - "framer-motion": "12.23.18", + "framer-motion": "12.23.16", "i18next": "25.5.2", "jotai": "2.14.0", "json-schema": "0.4.0", @@ -49,14 +49,14 @@ "react-use": "17.6.0", "rxjs": "7.8.2", "swr": "2.3.6", - "virtua": "0.43.2", + "virtua": "0.43.3", "vite-bundle-visualizer": "1.2.1" }, "devDependencies": { "@csstools/normalize.css": "12.1.1", "@emotion/babel-plugin": "11.13.5", "@emotion/react": "11.14.0", - "@iconify/json": "2.2.386", + "@iconify/json": "2.2.387", "@monaco-editor/react": "4.7.0", "@tanstack/react-query": "5.87.4", "@tanstack/react-router": "1.131.50", @@ -83,12 +83,12 @@ "meta-json-schema": "1.19.13", "monaco-yaml": "5.4.0", "nanoid": "5.1.6", - "sass-embedded": "1.93.0", + "sass-embedded": "1.93.1", "shiki": "2.5.0", "unplugin-auto-import": "20.1.0", "unplugin-icons": "22.3.0", "validator": "13.15.15", - "vite": "7.1.6", + "vite": "7.1.7", "vite-plugin-html": "3.2.2", "vite-plugin-sass-dts": "1.3.31", "vite-plugin-svgr": "4.5.0", diff --git a/clash-nyanpasu/frontend/nyanpasu/src/components/connections/connections-table.tsx b/clash-nyanpasu/frontend/nyanpasu/src/components/connections/connections-table.tsx index 952bfd9437..e62afe60f0 100644 --- a/clash-nyanpasu/frontend/nyanpasu/src/components/connections/connections-table.tsx +++ b/clash-nyanpasu/frontend/nyanpasu/src/components/connections/connections-table.tsx @@ -33,7 +33,7 @@ export const ConnectionsTable = ({ searchTerm }: { searchTerm?: string }) => { const { t, i18n } = useTranslation() const { - query: { data: clashConnections }, + query: { data: clashConnections, isLoading }, } = useClashConnections() const historyMessage = useRef(null) @@ -189,6 +189,12 @@ export const ConnectionsTable = ({ searchTerm }: { searchTerm?: string }) => { columnVirtualizerOptions: { overscan: 2 }, }) + // Show loading state while data is being fetched + if (isLoading && !connectionsMessage) { + // Don't show a separate loading indicator here since the parent component already handles it + return null + } + return connectionsMessage?.connections.length ? ( <> + + + + + + + + + + + ) } return ( diff --git a/clash-nyanpasu/frontend/nyanpasu/src/pages/connections.tsx b/clash-nyanpasu/frontend/nyanpasu/src/pages/connections.tsx index ec5b74a6e9..c3391dd54c 100644 --- a/clash-nyanpasu/frontend/nyanpasu/src/pages/connections.tsx +++ b/clash-nyanpasu/frontend/nyanpasu/src/pages/connections.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next' import { SearchTermCtx } from '@/components/connections/connection-search-term' import HeaderSearch from '@/components/connections/header-search' import { FilterAlt } from '@mui/icons-material' -import { IconButton } from '@mui/material' +import { Box, CircularProgress, IconButton } from '@mui/material' import { BasePage } from '@nyanpasu/ui' import { createFileRoute, useBlocker } from '@tanstack/react-router' @@ -46,6 +46,21 @@ function Connections() { } }, [proceed, deferredMountTable]) + // Loading fallback component + const LoadingFallback = () => ( + + + + ) + return ( - + + +
} > - {mountTable && } + }> + {mountTable && } + ) diff --git a/clash-nyanpasu/frontend/ui/package.json b/clash-nyanpasu/frontend/ui/package.json index 4fb527f542..bbb5e98ccb 100644 --- a/clash-nyanpasu/frontend/ui/package.json +++ b/clash-nyanpasu/frontend/ui/package.json @@ -23,14 +23,14 @@ "@vitejs/plugin-react": "5.0.3", "ahooks": "3.9.5", "d3": "7.9.0", - "framer-motion": "12.23.18", + "framer-motion": "12.23.16", "react": "19.1.1", "react-dom": "19.1.1", "react-error-boundary": "6.0.0", "react-i18next": "15.7.3", "react-use": "17.6.0", "tailwindcss": "4.1.13", - "vite": "7.1.6", + "vite": "7.1.7", "vite-tsconfig-paths": "5.1.4" }, "devDependencies": { @@ -38,7 +38,7 @@ "@types/d3-interpolate-path": "2.0.3", "clsx": "2.1.1", "d3-interpolate-path": "2.3.0", - "sass-embedded": "1.93.0", + "sass-embedded": "1.93.1", "tailwind-merge": "3.3.1", "typescript-plugin-css-modules": "5.2.0", "vite-plugin-dts": "4.5.4" diff --git a/clash-nyanpasu/manifest/version.json b/clash-nyanpasu/manifest/version.json index 034a91b4d0..f8db3b1f27 100644 --- a/clash-nyanpasu/manifest/version.json +++ b/clash-nyanpasu/manifest/version.json @@ -2,7 +2,7 @@ "manifest_version": 1, "latest": { "mihomo": "v1.19.13", - "mihomo_alpha": "alpha-74a86f1", + "mihomo_alpha": "alpha-8a9300d", "clash_rs": "v0.9.0", "clash_premium": "2023-09-05-gdcc8d87", "clash_rs_alpha": "0.9.0-alpha+sha.50f295d" @@ -69,5 +69,5 @@ "linux-armv7hf": "clash-armv7-unknown-linux-gnueabihf" } }, - "updated_at": "2025-09-21T22:20:53.338Z" + "updated_at": "2025-09-22T22:20:56.709Z" } diff --git a/clash-nyanpasu/package.json b/clash-nyanpasu/package.json index 937cfaed65..2dd2eb3928 100644 --- a/clash-nyanpasu/package.json +++ b/clash-nyanpasu/package.json @@ -110,7 +110,7 @@ "typescript": "5.9.2", "typescript-eslint": "8.44.0" }, - "packageManager": "pnpm@10.17.0", + "packageManager": "pnpm@10.17.1", "engines": { "node": "22.19.0" }, diff --git a/clash-nyanpasu/pnpm-lock.yaml b/clash-nyanpasu/pnpm-lock.yaml index 8a58b3677a..acbf7a25ec 100644 --- a/clash-nyanpasu/pnpm-lock.yaml +++ b/clash-nyanpasu/pnpm-lock.yaml @@ -276,8 +276,8 @@ importers: specifier: 1.11.18 version: 1.11.18 framer-motion: - specifier: 12.23.18 - version: 12.23.18(@emotion/is-prop-valid@1.3.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) + specifier: 12.23.16 + version: 12.23.16(@emotion/is-prop-valid@1.3.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) i18next: specifier: 25.5.2 version: 25.5.2(typescript@5.9.2) @@ -330,8 +330,8 @@ importers: specifier: 2.3.6 version: 2.3.6(react@19.1.1) virtua: - specifier: 0.43.2 - version: 0.43.2(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5) + specifier: 0.43.3 + version: 0.43.3(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5) vite-bundle-visualizer: specifier: 1.2.1 version: 1.2.1(rollup@4.46.2) @@ -346,8 +346,8 @@ importers: specifier: 11.14.0 version: 11.14.0(@types/react@19.1.12)(react@19.1.1) '@iconify/json': - specifier: 2.2.386 - version: 2.2.386 + specifier: 2.2.387 + version: 2.2.387 '@monaco-editor/react': specifier: 4.7.0 version: 4.7.0(monaco-editor@0.52.2)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) @@ -362,7 +362,7 @@ importers: version: 1.131.50(@tanstack/react-router@1.131.50(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@tanstack/router-core@1.131.50)(csstype@3.1.3)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5)(tiny-invariant@1.3.3) '@tanstack/router-plugin': specifier: 1.131.50 - version: 1.131.50(@tanstack/react-router@1.131.50(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 1.131.50(@tanstack/react-router@1.131.50(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) '@tauri-apps/plugin-clipboard-manager': specifier: 2.3.0 version: 2.3.0 @@ -398,13 +398,13 @@ importers: version: 13.15.3 '@vitejs/plugin-legacy': specifier: 7.2.1 - version: 7.2.1(terser@5.36.0)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 7.2.1(terser@5.36.0)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) '@vitejs/plugin-react': specifier: 5.0.3 - version: 5.0.3(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 5.0.3(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) '@vitejs/plugin-react-swc': specifier: 4.1.0 - version: 4.1.0(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 4.1.0(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) change-case: specifier: 5.4.4 version: 5.4.4 @@ -427,8 +427,8 @@ importers: specifier: 5.1.6 version: 5.1.6 sass-embedded: - specifier: 1.93.0 - version: 1.93.0 + specifier: 1.93.1 + version: 1.93.1 shiki: specifier: 2.5.0 version: 2.5.0 @@ -442,20 +442,20 @@ importers: specifier: 13.15.15 version: 13.15.15 vite: - specifier: 7.1.6 - version: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + specifier: 7.1.7 + version: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) vite-plugin-html: specifier: 3.2.2 - version: 3.2.2(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 3.2.2(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) vite-plugin-sass-dts: specifier: 1.3.31 - version: 1.3.31(postcss@8.5.6)(prettier@3.6.2)(sass-embedded@1.93.0)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 1.3.31(postcss@8.5.6)(prettier@3.6.2)(sass-embedded@1.93.1)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) vite-plugin-svgr: specifier: 4.5.0 - version: 4.5.0(rollup@4.46.2)(typescript@5.9.2)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 4.5.0(rollup@4.46.2)(typescript@5.9.2)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) vite-tsconfig-paths: specifier: 5.1.4 - version: 5.1.4(typescript@5.9.2)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 5.1.4(typescript@5.9.2)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) zod: specifier: 4.1.11 version: 4.1.11 @@ -491,7 +491,7 @@ importers: version: 19.1.12 '@vitejs/plugin-react': specifier: 5.0.3 - version: 5.0.3(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 5.0.3(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) ahooks: specifier: 3.9.5 version: 3.9.5(react-dom@19.1.1(react@19.1.1))(react@19.1.1) @@ -499,8 +499,8 @@ importers: specifier: 7.9.0 version: 7.9.0 framer-motion: - specifier: 12.23.18 - version: 12.23.18(@emotion/is-prop-valid@1.3.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) + specifier: 12.23.16 + version: 12.23.16(@emotion/is-prop-valid@1.3.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) react: specifier: 19.1.1 version: 19.1.1 @@ -520,11 +520,11 @@ importers: specifier: 4.1.13 version: 4.1.13 vite: - specifier: 7.1.6 - version: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + specifier: 7.1.7 + version: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) vite-tsconfig-paths: specifier: 5.1.4 - version: 5.1.4(typescript@5.9.2)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 5.1.4(typescript@5.9.2)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) devDependencies: '@emotion/react': specifier: 11.14.0 @@ -539,8 +539,8 @@ importers: specifier: 2.3.0 version: 2.3.0 sass-embedded: - specifier: 1.93.0 - version: 1.93.0 + specifier: 1.93.1 + version: 1.93.1 tailwind-merge: specifier: 3.3.1 version: 3.3.1 @@ -549,7 +549,7 @@ importers: version: 5.2.0(typescript@5.9.2) vite-plugin-dts: specifier: 4.5.4 - version: 4.5.4(@types/node@24.3.1)(rollup@4.46.2)(typescript@5.9.2)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) + version: 4.5.4(@types/node@24.3.1)(rollup@4.46.2)(typescript@5.9.2)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)) scripts: dependencies: @@ -1821,8 +1821,8 @@ packages: prettier-plugin-ember-template-tag: optional: true - '@iconify/json@2.2.386': - resolution: {integrity: sha512-qvSvaRBu4B1PXKLoXc2yme+eRy3NDTQh/CO3k1vmXjwDKFTFUEVmn8nTD4elPMJZEQa3OOVjh4NfYopnxiAabA==} + '@iconify/json@2.2.387': + resolution: {integrity: sha512-R1PTcM799jGSqHNfzggGqEQA+bQry/X/ckoISJIMKZdC9cz4pYWrWZsRGU50DmYkqTcC9aBQcSLOZxBFHTVT3Q==} '@iconify/types@2.0.0': resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} @@ -5255,8 +5255,8 @@ packages: fraction.js@4.3.7: resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} - framer-motion@12.23.18: - resolution: {integrity: sha512-HBVXBL5x3nk/0WrYM5G4VgjBey99ytVYET5AX17s/pcnlH90cyaxVUqgoN8cpF4+PqZRVOhwWsv28F+hxA9Tzg==} + framer-motion@12.23.16: + resolution: {integrity: sha512-N81A8hiHqVsexOzI3wzkibyLURW1nEJsZaRuctPhG4AdbbciYu+bKJq9I2lQFzAO4Bx3h4swI6pBbF/Hu7f7BA==} peerDependencies: '@emotion/is-prop-valid': '*' react: ^18.0.0 || ^19.0.0 @@ -6517,8 +6517,8 @@ packages: peerDependencies: monaco-editor: '>=0.36' - motion-dom@12.23.18: - resolution: {integrity: sha512-9piw3uOcP6DpS0qpnDF95bLDzmgMxLOg/jghLnHwYJ0YFizzuvbH/L8106dy39JNgHYmXFUTztoP9JQvUqlBwQ==} + motion-dom@12.23.12: + resolution: {integrity: sha512-RcR4fvMCTESQBD/uKQe49D5RUeDOokkGRmz4ceaJKDBgHYtZtntC/s2vLvY38gqGaytinij/yi3hMcWVcEF5Kw==} motion-utils@12.23.6: resolution: {integrity: sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ==} @@ -7423,112 +7423,112 @@ packages: safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - sass-embedded-all-unknown@1.93.0: - resolution: {integrity: sha512-fBTnh5qgOyw0CGVaF2iPsIIRj40D9Mnf19WerixjmWwmYKaGhxd62STsuMt6t1dWS5lkUZWRgrJ+2biQiEcCBg==} + sass-embedded-all-unknown@1.93.1: + resolution: {integrity: sha512-APlGAJhk/Twv1i8K/jHfkruMwTVV03M5+RZ2yxalYWhn0pouC+MIQ8I/xkiOPk2sNmCQ4M3EewMb0FUVyS/LMQ==} cpu: ['!arm', '!arm64', '!riscv64', '!x64'] - sass-embedded-android-arm64@1.93.0: - resolution: {integrity: sha512-bwU+0uWUVoATaYAb9mnDj7GCEnNAIrinzT4UlA6GlicH+ELEZlNwVjaPJfdCyyYs8iOKuzUPfZrFZuwRCsXXqw==} + sass-embedded-android-arm64@1.93.1: + resolution: {integrity: sha512-kWvCvNXnHjPmjSS4uYGcSRLZo9am8cNDdg+jIY4mZy62Q3nmz0h0p9if1GszBHl4H3eIBXJIEJQiDY5E26amdQ==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [android] - sass-embedded-android-arm@1.93.0: - resolution: {integrity: sha512-oMm6RafXdpWDejufUs+GcgBSS/wa/iG1zRhwsCrkIkMLhqa34oN7xLkNs9Ieg337nlIryUBijwAVMFlAs/mgIg==} + sass-embedded-android-arm@1.93.1: + resolution: {integrity: sha512-ysejojGThRhsnyYRQtNyAstQqqOP+W+EsEbxnhKVZRLBp4WxeAza/W5x1/GBzLjhk6HUJ7N1MwNkkpvF0eqnuQ==} engines: {node: '>=14.0.0'} cpu: [arm] os: [android] - sass-embedded-android-riscv64@1.93.0: - resolution: {integrity: sha512-lKk7elql2abYeLY+wNBW8DB13W8An9JWlAr/BWOAtluz1RMsPVZwv0amQiP2PcR6HA02QDoLfRE/QpnPDHzCuw==} + sass-embedded-android-riscv64@1.93.1: + resolution: {integrity: sha512-EaNkWJ5IOMCZid3IZWl/Bvb3RkCFz0RBas6Ns05F7W3hls+ggaqiFB7RaVr4Wbr7Em8Ak6yYw5CuTgUiY58nDg==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [android] - sass-embedded-android-x64@1.93.0: - resolution: {integrity: sha512-wuyphs1VMS/PRXtCBLhA0bVo5nyKFCXKaVKMbqPylOTvoTHe7u0zxjWRN4eF5LTPVuQp0A+LYgJz07duzxwJew==} + sass-embedded-android-x64@1.93.1: + resolution: {integrity: sha512-kyGNIgFTAgWPa79LI+vkbOUNV1DzCywSAayAHsvuK6NgPcq560ET7qekp/OlbZ97wgTjVRlj68UAP0jVhq4k4A==} engines: {node: '>=14.0.0'} cpu: [x64] os: [android] - sass-embedded-darwin-arm64@1.93.0: - resolution: {integrity: sha512-lEb5J/jabesh16xdocRFgpzIa8GAZCLrdKtUnGbn9a4Y4WkEKHtUkvAm9ZtqE8YiuIm8PwHW/zBUKtZYoGYoYA==} + sass-embedded-darwin-arm64@1.93.1: + resolution: {integrity: sha512-GOD2Nt+BZZdBmg+BM2CozkhAZFGzaU8IK1lI2KP5C6HTuhQP7mTPA9UZWNN3c7iHj6JrkenfWd1ec/vsCZVr+Q==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [darwin] - sass-embedded-darwin-x64@1.93.0: - resolution: {integrity: sha512-mo9OfKyNF6MiFf711c+QGR7aPpFqAC9FttiLKPYH3RRBZQZU/UcG4mbg+yXfKbhZrJmYngbGiTzE9B+xiOz27Q==} + sass-embedded-darwin-x64@1.93.1: + resolution: {integrity: sha512-79UlR88nNDbsGqa/87yxOdShPL9Bqz0KnFzv8ioh1NkxYwKYUM9XuKwohFEBTyGg8KDw6h31oTFAvrEFR2qBzg==} engines: {node: '>=14.0.0'} cpu: [x64] os: [darwin] - sass-embedded-linux-arm64@1.93.0: - resolution: {integrity: sha512-bJclpjTeP/qCu7zYLZQXROx4xIT3x+qfj/q92fripV9L9Oj2khfUm+2nW0Cq7DS6UrHphrWZ9QSnVYFhkCKtEA==} + sass-embedded-linux-arm64@1.93.1: + resolution: {integrity: sha512-F5ZHx1s5ce3NdjtwPAq6oTXpTC1bZUlHweFgqzbYH5rhVhdhkOemIdHHUG+3gl8YttYrqZ0KASVDtJKBrJMnSg==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - sass-embedded-linux-arm@1.93.0: - resolution: {integrity: sha512-wtO2vB8rMc5zF29xwC3AMgmBgNgm3i3/8zog5vQBD4yddqCJ93JcWDjdUqYmq0H/DLD/Z7q91j6X/YgPq1WuEg==} + sass-embedded-linux-arm@1.93.1: + resolution: {integrity: sha512-CdJXeZazBU1Ry1jG0T0ohZkoKHnUBIdniqw3o8ZzqHPzVY3A4svuQWj0WvGGM+YrZ+SV5HQ3nmzezS58dlandA==} engines: {node: '>=14.0.0'} cpu: [arm] os: [linux] - sass-embedded-linux-musl-arm64@1.93.0: - resolution: {integrity: sha512-VH0zFGqsTy+lThHAm3y8Dpd/X4nC5DLJvk66+mJTg7rwblRhfPpsVO6n8QHeN5ZV1ATTnLh/PbZ7uEPiyAg2wg==} + sass-embedded-linux-musl-arm64@1.93.1: + resolution: {integrity: sha512-p7fxdQI+ev6KMkqRNgl1i7yG5PaUiPgudF4usfSE5NaQobORZYuFXt4m2XPd1h5xwP0ykYLyXjad1EMXTnGr7Q==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - sass-embedded-linux-musl-arm@1.93.0: - resolution: {integrity: sha512-mMGAy+2VLLTMDPDG/mfzMmoy09potXp/ZRPRsyJEYVjF0rQij6Iss3qsZbCjVJa4atLwBtPJ14M0NvqpAa2WIg==} + sass-embedded-linux-musl-arm@1.93.1: + resolution: {integrity: sha512-gMxRky1OjjVh8HHw/blgMggkmIu5a9l8iLAODuBIi+AOOuF9v7v20JXyUfXh2jT2HvdXjKfc/EvIuhhELnBPpg==} engines: {node: '>=14.0.0'} cpu: [arm] os: [linux] - sass-embedded-linux-musl-riscv64@1.93.0: - resolution: {integrity: sha512-/a+MvExFEKvwPXyZsQ8b1DWYJMpTnXSdwpe9pDNkdTIcliMAtP952krCx14nBP0UqqNoU/TetyMR8H0WwyeJEA==} + sass-embedded-linux-musl-riscv64@1.93.1: + resolution: {integrity: sha512-iVtkoiwXxVcIjbOD3ctX1CxgkXMPUzkw3A/1Iok55lmLLDRKB6t4nny8vT8qiejKrQ9DF4Oz2/+q7Cj0S3mN+Q==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [linux] - sass-embedded-linux-musl-x64@1.93.0: - resolution: {integrity: sha512-o168nV9QI5U+2LFBMmMecWzu6yJ7WJZZfQGlo4Frvg9vC3Em3W02GfAel+g9leJg+0PDnpJLqOsPdrngg25T/Q==} + sass-embedded-linux-musl-x64@1.93.1: + resolution: {integrity: sha512-UPtkoxgljB+Tz5TF8Pg/5EaMDlDRhqlqnA3cCOqj+bDoaAgTQcqYNpAz/6wJSXYTv7Jjs54kWjI+NDMSOPdh/Q==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - sass-embedded-linux-riscv64@1.93.0: - resolution: {integrity: sha512-KYHED49coJQT633cBbqBfBOPmRe3yNbE+D2kqMONADBqzGyxHZpQRStCenhPmDabVLI4fgc3fn//6ubqH724jA==} + sass-embedded-linux-riscv64@1.93.1: + resolution: {integrity: sha512-gTzxKGPK1vwqO8ZOYlQIVh1BFI2dBW1GyMHmyjqM4Mc/orAjOmTN3aJYGafJjxiMmH424JwlUmCN5vARRJQsJg==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [linux] - sass-embedded-linux-x64@1.93.0: - resolution: {integrity: sha512-9OD9OlZ61dmz/BbW4n29l3v74//ibiQCmWu8YBoXVgxxgcbi+2CFv+vRE8guA73BgEdPComw0tpgD1FkW3v12g==} + sass-embedded-linux-x64@1.93.1: + resolution: {integrity: sha512-x67rR5KmmjZrnqzKSqNFEEyQoybajFmWnsWvxt3Fn2BCewK40EThVjJAJwNdZtXKcc8y7CZrMF+kmxBDxFbv4g==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - sass-embedded-unknown-all@1.93.0: - resolution: {integrity: sha512-Hh9OPBMg+i1g8OzQyOtQuJg/3ncup4Z+FHdXNzPIeFXcIeS+TVuVQyvJfnB+hYgvVGyBJ+9ekuUYzB+1zA82nw==} + sass-embedded-unknown-all@1.93.1: + resolution: {integrity: sha512-noDOdIJWRTXAW77J2bkrKGyoPWNuJ5G+JnXVHH+zLll1AlVcwPjVCKag9dNk6+o4cXDb0hx8b8Sg4ojdCzK8VA==} os: ['!android', '!darwin', '!linux', '!win32'] - sass-embedded-win32-arm64@1.93.0: - resolution: {integrity: sha512-3SNRTxBVk+c0Oyd4gCp4/KAQ+S6B9S5ihq5dxMMfWpvoQSUqn6mqhkEFrofG1oNlP7KsA2UzhTnFGDRid1An+A==} + sass-embedded-win32-arm64@1.93.1: + resolution: {integrity: sha512-B6seb+gjZ9XV/rXO2STkBkFLpsRnlLS1Hs9tqJyWe723VhuaOy/cyI8LSuUjNDolYVbo4YKb4vbx3+BNFNRGBQ==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [win32] - sass-embedded-win32-x64@1.93.0: - resolution: {integrity: sha512-6/RJGOdm3bwe71YJaYanQ81I6KA//T/a+MnKlRpP5zk5fy2ygAIGNeNr2ENEBu/KZCuFg7KY49g46v+hPKT6Ow==} + sass-embedded-win32-x64@1.93.1: + resolution: {integrity: sha512-tt4OxnQN2b1PbTWHeZHVFxnQTTSbzOZlSIVeZZ8T9hQmSWrAfzjuV0B96V1/YzhKfhSKtbCo7KD/JIgADKugqg==} engines: {node: '>=14.0.0'} cpu: [x64] os: [win32] - sass-embedded@1.93.0: - resolution: {integrity: sha512-dQACVfrbwKtvnrA0xH67YAdUYi6k7XcPg8uNF3DPf/VaJMQzduE1z5w3NFa9oVjtqXM4+FA9P7Qdv06Bzf614g==} + sass-embedded@1.93.1: + resolution: {integrity: sha512-LgXSubbCngOUZ7sVhxtfREa/lHa+hkG0Pjul02I4gB4cb0PhsR+UTLH0GIMnEafoL4dhFM1x8tdtezB3Njv7ng==} engines: {node: '>=16.0.0'} hasBin: true @@ -7537,8 +7537,8 @@ packages: engines: {node: '>=14.0.0'} hasBin: true - sass@1.93.0: - resolution: {integrity: sha512-CQi5/AzCwiubU3dSqRDJ93RfOfg/hhpW1l6wCIvolmehfwgCI35R/0QDs1+R+Ygrl8jFawwwIojE2w47/mf94A==} + sass@1.93.1: + resolution: {integrity: sha512-wLAeLB7IksO2u+cCfhHqcy7/2ZUMPp/X2oV6+LjmweTqgjhOKrkaE/Q1wljxtco5EcOcupZ4c981X0gpk5Tiag==} engines: {node: '>=14.0.0'} hasBin: true @@ -8356,8 +8356,8 @@ packages: vfile@6.0.1: resolution: {integrity: sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==} - virtua@0.43.2: - resolution: {integrity: sha512-4Tv2qThKZ767PCkFbS5fz8Cy9JmqRV9hq24nGabFl+ddvw+iVdIx11tuWxKvWRhvOZOK5TUosNRUDjIkS6f3FA==} + virtua@0.43.3: + resolution: {integrity: sha512-KA4iLdc1ISLgeqWEdT++Y8zeRQxWMOsF0pMG8gXPGorfCC7xdVZS9R4/kRCkyrk9z52VoQBBOEAL48vrPnKSuw==} peerDependencies: react: '>=16.14.0' react-dom: '>=16.14.0' @@ -8417,8 +8417,8 @@ packages: vite: optional: true - vite@7.1.6: - resolution: {integrity: sha512-SRYIB8t/isTwNn8vMB3MR6E+EQZM/WG1aKmmIUCfDXfVvKfc20ZpamngWHKzAmmu9ppsgxsg4b2I7c90JZudIQ==} + vite@7.1.7: + resolution: {integrity: sha512-VbA8ScMvAISJNJVbRDTJdCwqQoAareR/wutevKanhR2/1EkoXVZVkkORaYm/tNVCjP/UDTKtcw3bAkwOUdedmA==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true peerDependencies: @@ -10190,7 +10190,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@iconify/json@2.2.386': + '@iconify/json@2.2.387': dependencies: '@iconify/types': 2.0.0 pathe: 1.1.2 @@ -11372,7 +11372,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@tanstack/router-plugin@1.131.50(@tanstack/react-router@1.131.50(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))': + '@tanstack/router-plugin@1.131.50(@tanstack/react-router@1.131.50(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))': dependencies: '@babel/core': 7.28.4 '@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.28.4) @@ -11390,7 +11390,7 @@ snapshots: zod: 3.25.76 optionalDependencies: '@tanstack/react-router': 1.131.50(react-dom@19.1.1(react@19.1.1))(react@19.1.1) - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) transitivePeerDependencies: - supports-color @@ -12005,7 +12005,7 @@ snapshots: '@unrs/resolver-binding-win32-x64-msvc@1.10.1': optional: true - '@vitejs/plugin-legacy@7.2.1(terser@5.36.0)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))': + '@vitejs/plugin-legacy@7.2.1(terser@5.36.0)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))': dependencies: '@babel/core': 7.28.0 '@babel/plugin-transform-dynamic-import': 7.27.1(@babel/core@7.28.0) @@ -12020,19 +12020,19 @@ snapshots: regenerator-runtime: 0.14.1 systemjs: 6.15.1 terser: 5.36.0 - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) transitivePeerDependencies: - supports-color - '@vitejs/plugin-react-swc@4.1.0(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))': + '@vitejs/plugin-react-swc@4.1.0(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))': dependencies: '@rolldown/pluginutils': 1.0.0-beta.35 '@swc/core': 1.13.5 - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) transitivePeerDependencies: - '@swc/helpers' - '@vitejs/plugin-react@5.0.3(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))': + '@vitejs/plugin-react@5.0.3(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))': dependencies: '@babel/core': 7.28.4 '@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/core@7.28.4) @@ -12040,7 +12040,7 @@ snapshots: '@rolldown/pluginutils': 1.0.0-beta.35 '@types/babel__core': 7.20.5 react-refresh: 0.17.0 - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) transitivePeerDependencies: - supports-color @@ -13935,9 +13935,9 @@ snapshots: fraction.js@4.3.7: {} - framer-motion@12.23.18(@emotion/is-prop-valid@1.3.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1): + framer-motion@12.23.16(@emotion/is-prop-valid@1.3.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1): dependencies: - motion-dom: 12.23.18 + motion-dom: 12.23.12 motion-utils: 12.23.6 tslib: 2.8.1 optionalDependencies: @@ -15323,7 +15323,7 @@ snapshots: vscode-uri: 3.0.8 yaml: 2.7.0 - motion-dom@12.23.18: + motion-dom@12.23.12: dependencies: motion-utils: 12.23.6 @@ -16299,65 +16299,65 @@ snapshots: safer-buffer@2.1.2: {} - sass-embedded-all-unknown@1.93.0: + sass-embedded-all-unknown@1.93.1: dependencies: - sass: 1.93.0 + sass: 1.93.1 optional: true - sass-embedded-android-arm64@1.93.0: + sass-embedded-android-arm64@1.93.1: optional: true - sass-embedded-android-arm@1.93.0: + sass-embedded-android-arm@1.93.1: optional: true - sass-embedded-android-riscv64@1.93.0: + sass-embedded-android-riscv64@1.93.1: optional: true - sass-embedded-android-x64@1.93.0: + sass-embedded-android-x64@1.93.1: optional: true - sass-embedded-darwin-arm64@1.93.0: + sass-embedded-darwin-arm64@1.93.1: optional: true - sass-embedded-darwin-x64@1.93.0: + sass-embedded-darwin-x64@1.93.1: optional: true - sass-embedded-linux-arm64@1.93.0: + sass-embedded-linux-arm64@1.93.1: optional: true - sass-embedded-linux-arm@1.93.0: + sass-embedded-linux-arm@1.93.1: optional: true - sass-embedded-linux-musl-arm64@1.93.0: + sass-embedded-linux-musl-arm64@1.93.1: optional: true - sass-embedded-linux-musl-arm@1.93.0: + sass-embedded-linux-musl-arm@1.93.1: optional: true - sass-embedded-linux-musl-riscv64@1.93.0: + sass-embedded-linux-musl-riscv64@1.93.1: optional: true - sass-embedded-linux-musl-x64@1.93.0: + sass-embedded-linux-musl-x64@1.93.1: optional: true - sass-embedded-linux-riscv64@1.93.0: + sass-embedded-linux-riscv64@1.93.1: optional: true - sass-embedded-linux-x64@1.93.0: + sass-embedded-linux-x64@1.93.1: optional: true - sass-embedded-unknown-all@1.93.0: + sass-embedded-unknown-all@1.93.1: dependencies: - sass: 1.93.0 + sass: 1.93.1 optional: true - sass-embedded-win32-arm64@1.93.0: + sass-embedded-win32-arm64@1.93.1: optional: true - sass-embedded-win32-x64@1.93.0: + sass-embedded-win32-x64@1.93.1: optional: true - sass-embedded@1.93.0: + sass-embedded@1.93.1: dependencies: '@bufbuild/protobuf': 2.5.2 buffer-builder: 0.2.0 @@ -16368,24 +16368,24 @@ snapshots: sync-child-process: 1.0.2 varint: 6.0.0 optionalDependencies: - sass-embedded-all-unknown: 1.93.0 - sass-embedded-android-arm: 1.93.0 - sass-embedded-android-arm64: 1.93.0 - sass-embedded-android-riscv64: 1.93.0 - sass-embedded-android-x64: 1.93.0 - sass-embedded-darwin-arm64: 1.93.0 - sass-embedded-darwin-x64: 1.93.0 - sass-embedded-linux-arm: 1.93.0 - sass-embedded-linux-arm64: 1.93.0 - sass-embedded-linux-musl-arm: 1.93.0 - sass-embedded-linux-musl-arm64: 1.93.0 - sass-embedded-linux-musl-riscv64: 1.93.0 - sass-embedded-linux-musl-x64: 1.93.0 - sass-embedded-linux-riscv64: 1.93.0 - sass-embedded-linux-x64: 1.93.0 - sass-embedded-unknown-all: 1.93.0 - sass-embedded-win32-arm64: 1.93.0 - sass-embedded-win32-x64: 1.93.0 + sass-embedded-all-unknown: 1.93.1 + sass-embedded-android-arm: 1.93.1 + sass-embedded-android-arm64: 1.93.1 + sass-embedded-android-riscv64: 1.93.1 + sass-embedded-android-x64: 1.93.1 + sass-embedded-darwin-arm64: 1.93.1 + sass-embedded-darwin-x64: 1.93.1 + sass-embedded-linux-arm: 1.93.1 + sass-embedded-linux-arm64: 1.93.1 + sass-embedded-linux-musl-arm: 1.93.1 + sass-embedded-linux-musl-arm64: 1.93.1 + sass-embedded-linux-musl-riscv64: 1.93.1 + sass-embedded-linux-musl-x64: 1.93.1 + sass-embedded-linux-riscv64: 1.93.1 + sass-embedded-linux-x64: 1.93.1 + sass-embedded-unknown-all: 1.93.1 + sass-embedded-win32-arm64: 1.93.1 + sass-embedded-win32-x64: 1.93.1 sass@1.83.0: dependencies: @@ -16395,7 +16395,7 @@ snapshots: optionalDependencies: '@parcel/watcher': 2.4.1 - sass@1.93.0: + sass@1.93.1: dependencies: chokidar: 4.0.0 immutable: 5.0.2 @@ -17368,7 +17368,7 @@ snapshots: unist-util-stringify-position: 4.0.0 vfile-message: 4.0.2 - virtua@0.43.2(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5): + virtua@0.43.3(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5): optionalDependencies: react: 19.1.1 react-dom: 19.1.1(react@19.1.1) @@ -17384,7 +17384,7 @@ snapshots: - rollup - supports-color - vite-plugin-dts@4.5.4(@types/node@24.3.1)(rollup@4.46.2)(typescript@5.9.2)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): + vite-plugin-dts@4.5.4(@types/node@24.3.1)(rollup@4.46.2)(typescript@5.9.2)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): dependencies: '@microsoft/api-extractor': 7.51.0(@types/node@24.3.1) '@rollup/pluginutils': 5.1.4(rollup@4.46.2) @@ -17397,13 +17397,13 @@ snapshots: magic-string: 0.30.17 typescript: 5.9.2 optionalDependencies: - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) transitivePeerDependencies: - '@types/node' - rollup - supports-color - vite-plugin-html@3.2.2(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): + vite-plugin-html@3.2.2(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): dependencies: '@rollup/pluginutils': 4.2.1 colorette: 2.0.20 @@ -17417,39 +17417,39 @@ snapshots: html-minifier-terser: 6.1.0 node-html-parser: 5.4.2 pathe: 0.2.0 - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) - vite-plugin-sass-dts@1.3.31(postcss@8.5.6)(prettier@3.6.2)(sass-embedded@1.93.0)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): + vite-plugin-sass-dts@1.3.31(postcss@8.5.6)(prettier@3.6.2)(sass-embedded@1.93.1)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): dependencies: postcss: 8.5.6 postcss-js: 4.0.1(postcss@8.5.6) prettier: 3.6.2 - sass-embedded: 1.93.0 - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + sass-embedded: 1.93.1 + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) - vite-plugin-svgr@4.5.0(rollup@4.46.2)(typescript@5.9.2)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): + vite-plugin-svgr@4.5.0(rollup@4.46.2)(typescript@5.9.2)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): dependencies: '@rollup/pluginutils': 5.2.0(rollup@4.46.2) '@svgr/core': 8.1.0(typescript@5.9.2) '@svgr/plugin-jsx': 8.1.0(@svgr/core@8.1.0(typescript@5.9.2)) - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) transitivePeerDependencies: - rollup - supports-color - typescript - vite-tsconfig-paths@5.1.4(typescript@5.9.2)(vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): + vite-tsconfig-paths@5.1.4(typescript@5.9.2)(vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)): dependencies: debug: 4.3.7 globrex: 0.1.2 tsconfck: 3.0.3(typescript@5.9.2) optionalDependencies: - vite: 7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) + vite: 7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1) transitivePeerDependencies: - supports-color - typescript - vite@7.1.6(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.0)(sass@1.93.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1): + vite@7.1.7(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.93.1)(sass@1.93.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1): dependencies: esbuild: 0.25.0 fdir: 6.5.0(picomatch@4.0.3) @@ -17463,8 +17463,8 @@ snapshots: jiti: 2.5.1 less: 4.2.0 lightningcss: 1.30.1 - sass: 1.93.0 - sass-embedded: 1.93.0 + sass: 1.93.1 + sass-embedded: 1.93.1 stylus: 0.62.0 terser: 5.36.0 tsx: 4.20.5 diff --git a/lede/package/kernel/yt6801/Makefile b/lede/package/kernel/yt6801/Makefile new file mode 100644 index 0000000000..e530373079 --- /dev/null +++ b/lede/package/kernel/yt6801/Makefile @@ -0,0 +1,34 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=yt6801 +PKG_VERSION:=1.0.30 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0-only +PKG_MAINTAINER:=Lean + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/yt6801 + SUBMENU:=Network Devices + TITLE:=Motorcomm YT6801 Gigabit Ethernet driver + DEPENDS:=@PCI_SUPPORT +kmod-libphy + FILES:=$(PKG_BUILD_DIR)/yt6801.ko + AUTOLOAD:=$(call AutoProbe,yt6801) + KCONFIG:= +endef + +define KernelPackage/yt6801/description + Kernel module for Motorcomm YT6801 PCI Gigabit Ethernet controllers. + This driver supports the YT6801 chipset from Motorcomm. +endef + +define Build/Compile + +$(KERNEL_MAKE) $(PKG_JOBS) \ + M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="-DFXGMAC_DEBUG" \ + modules +endef + +$(eval $(call KernelPackage,yt6801)) \ No newline at end of file diff --git a/lede/package/kernel/yt6801/src/Makefile b/lede/package/kernel/yt6801/src/Makefile new file mode 100644 index 0000000000..9b29b47dcf --- /dev/null +++ b/lede/package/kernel/yt6801/src/Makefile @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only +################################################################################ +# +# Copyright (c) 2023 Motorcomm, Inc. +# Motorcomm Confidential and Proprietary. +# +# This is Motorcomm NIC driver relevant files. Please don't copy, modify, +# distribute without commercial permission. +# +################################################################################ + +SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/s390x/s390/ -e s/parisc64/parisc/ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ -e s/riscv.*/riscv/) +CURARCH ?= $(SUBARCH) +ARCH ?= $(SUBARCH) +CROSS_COMPILE ?= +#CONFIG_MODULE_SIG=n +PWD :=$(shell pwd) +EXTRA_CFLAGS = -Wall -g -I$(CURDIR) -I$(subst fuxi-linux-release-package/module_fuxi/src,common,$(PWD)) -I$(PWD) +EXTRA_CFLAGS += -DFXGMAC_DEBUG + +KSRC_BASE = /lib/modules/$(shell uname -r) +KSRC = $(KSRC_BASE)/build +#KDST = /lib/modules/$(shell uname -r)/kernel/drivers/net/ethernet/motorcomm/ +KDST = kernel/drivers/net/ethernet/motorcomm +ko_dir = $(KSRC_BASE)/$(KDST)/ +KFILE = yt6801 +ko_full = $(ko_dir)$(KFILE).ko + +yt6801-objs := fuxi-gmac-common.o fuxi-gmac-desc.o fuxi-gmac-ethtool.o fuxi-gmac-hw.o fuxi-gmac-net.o fuxi-gmac-pci.o fuxi-gmac-phy.o fuxi-efuse.o fuxi-gmac-ioctl.o +obj-m += yt6801.o +modules: + make -C $(KSRC) M=$(PWD) modules + +install: + @echo "KFILE: " $(KFILE) + @echo "KDST: " $(KDST) + make -C $(KSRC) M=$(PWD) INSTALL_MOD_DIR=$(KDST) modules_install + sudo ls -l $(ko_dir) + depmod $(shell uname -r) + modprobe $(KFILE) + @file $(ko_full) + @echo install done. + @modinfo $(ko_full) + +uninstall: + sudo ls -l $(ko_dir) + sudo rm $(ko_full) + sudo ls -l $(ko_dir) + +clean: + make -C $(KSRC) M=$(PWD) clean + +.PHONY:modules install uninstall clean diff --git a/lede/package/kernel/yt6801/src/Notice.txt b/lede/package/kernel/yt6801/src/Notice.txt new file mode 100644 index 0000000000..ade991c2f6 --- /dev/null +++ b/lede/package/kernel/yt6801/src/Notice.txt @@ -0,0 +1,30 @@ +============================================================================= + +This file contains certain notices of software components included with +the software that Motorcomm, Inc. ("Motorcomm") is required to +provide you. Except where prohibited by the open source license, the +content of this file is provided solely to satisfy Motorcomm's attribution +and notice requirement; your use of these software components +together with the Motorcomm software ("Software") is subject to the terms +of your license from Motorcomm. Compliance with all copyright laws and +software license agreements included in the notice section of this +file are the responsibility of the user. Except as may be granted by +separate express written agreement, this file provides no license to +any patents, trademarks, copyrights, or other intellectual property +of Motorcomm or any of its subsidiaries. + +Software provided with this notice is NOT A CONTRIBUTION to any open +source project. If alternative licensing is available for any of the +components with licenses or attributions provided below, a license +choice is made for receiving such code by Motorcomm. + +Copyright (c) 2021 Motorcomm, Inc. All rights reserved. + +Motorcomm is a trademark of Motorcomm Incorporated, registered in China +and other countries. All Motorcomm Incorporated trademarks +are used with permission. Other products and brand names may be +trademarks or registered trademarks of their respective owners. + +============================================================================= + + diff --git a/lede/package/kernel/yt6801/src/dkms.conf b/lede/package/kernel/yt6801/src/dkms.conf new file mode 100644 index 0000000000..9c8e4d7d03 --- /dev/null +++ b/lede/package/kernel/yt6801/src/dkms.conf @@ -0,0 +1,8 @@ +PACKAGE_NAME="yt6801" +PACKAGE_VERSION="1.0.30" +CLEAN="make clean" +MAKE[0]="make" +BUILT_MODULE_NAME[0]="yt6801" +DEST_MODULE_LOCATION[0]="/kernel/drivers/net/ethernet/motorcomm" +AUTOINSTALL="yes" +REMAKE_INITRD="yes" diff --git a/lede/package/kernel/yt6801/src/fuxi-dbg.h b/lede/package/kernel/yt6801/src/fuxi-dbg.h new file mode 100644 index 0000000000..4776abd869 --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-dbg.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#ifndef _MP_DBG_H +#define _MP_DBG_H + +// +// Message verbosity: lower values indicate higher urgency +// +#define MP_OFF 0 +#define MP_ERROR 1 +#define MP_WARN 2 +#define MP_TRACE 3 +#define MP_INFO 4 +#define MP_LOUD 5 + +#endif // _MP_DBG_H diff --git a/lede/package/kernel/yt6801/src/fuxi-efuse.c b/lede/package/kernel/yt6801/src/fuxi-efuse.c new file mode 100644 index 0000000000..fde33c798b --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-efuse.c @@ -0,0 +1,991 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" +#include "fuxi-efuse.h" + +#ifdef FXGMAC_USE_ADAPTER_HANDLE +#include "fuxi-mp.h" +#endif + +bool fxgmac_read_patch_from_efuse_per_index(struct fxgmac_pdata* pdata, u8 index, u32 __far* offset, u32 __far* value) /* read patch per index. */ +{ + unsigned int wait, i; + u32 regval = 0; + bool succeed = false; + + if (index >= FXGMAC_EFUSE_MAX_ENTRY) { + FXGMAC_PR("Reading efuse out of range, index %d\n", index); + return false; + } + + if (offset) { + *offset = 0; + } + for (i = EFUSE_PATCH_ADDR_START_BYTE; i < EFUSE_PATCH_DATA_START_BYTE; i++) { + regval = 0; + regval = FXGMAC_SET_REG_BITS(regval, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, EFUSE_REGION_A_B_LENGTH + index * EFUSE_EACH_PATH_SIZE + i); + regval = FXGMAC_SET_REG_BITS(regval, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_READ); + writereg(pdata->pAdapter, regval, pdata->base_mem + EFUSE_OP_CTRL_0); + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + regval = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(regval, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + if (succeed) { + if (offset) { + *offset |= (FXGMAC_GET_REG_BITS(regval, EFUSE_OP_RD_DATA_POS, EFUSE_OP_RD_DATA_LEN) << (i << 3)); + } + } + else { + FXGMAC_PR("Fail to reading efuse Byte%d\n", index * EFUSE_EACH_PATH_SIZE + i); + return succeed; + } + } + + if (value) { + *value = 0; + } + for (i = EFUSE_PATCH_DATA_START_BYTE; i < EFUSE_EACH_PATH_SIZE; i++) { + regval = 0; + regval = FXGMAC_SET_REG_BITS(regval, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, EFUSE_REGION_A_B_LENGTH + index * EFUSE_EACH_PATH_SIZE + i); + regval = FXGMAC_SET_REG_BITS(regval, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_READ); + writereg(pdata->pAdapter, regval, pdata->base_mem + EFUSE_OP_CTRL_0); + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + regval = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(regval, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + if (succeed) { + if (value) { + *value |= (FXGMAC_GET_REG_BITS(regval, EFUSE_OP_RD_DATA_POS, EFUSE_OP_RD_DATA_LEN) << ((i - 2) << 3)); + } + } + else { + FXGMAC_PR("Fail to reading efuse Byte%d\n", index * EFUSE_EACH_PATH_SIZE + i); + return succeed; + } + } + + return succeed; +} + +bool fxgmac_read_mac_subsys_from_efuse(struct fxgmac_pdata* pdata, u8* mac_addr, u32* subsys, u32* revid) +{ + u32 offset = 0, value = 0; + u32 machr = 0, maclr = 0; + bool succeed = true; + u8 index = 0; + + for (index = 0; index < FXGMAC_EFUSE_MAX_ENTRY; index++) { + if (!fxgmac_read_patch_from_efuse_per_index(pdata, index, &offset, &value)) { + succeed = false; + break; // reach the last item. + } + if (0x00 == offset) { + break; // reach the blank. + } + if (MACA0LR_FROM_EFUSE == offset) { + maclr = value; + } + if (MACA0HR_FROM_EFUSE == offset) { + machr = value; + } + + if ((0x08 == offset) && revid) { + *revid = value; + } + if ((0x2C == offset) && subsys) { + *subsys = value; + } + } + if (mac_addr) { + mac_addr[5] = (u8)(maclr & 0xFF); + mac_addr[4] = (u8)((maclr >> 8) & 0xFF); + mac_addr[3] = (u8)((maclr >> 16) & 0xFF); + mac_addr[2] = (u8)((maclr >> 24) & 0xFF); + mac_addr[1] = (u8)(machr & 0xFF); + mac_addr[0] = (u8)((machr >> 8) & 0xFF); + } + + return succeed; +} + +bool fxgmac_efuse_read_data(struct fxgmac_pdata* pdata, u32 offset, u32 __far* value) +{ + bool succeed = false; + unsigned int wait; + u32 reg_val = 0; + + //if (reg >= EFUSE_REGION_A_B_LENGTH) { + // FXGMAC_PR("Read addr out of range %d", reg); + // return succeed; + //} + + if (value) { + *value = 0; + } + + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, offset); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_READ); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + + if (succeed) { + if (value) { + *value = FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_RD_DATA_POS, EFUSE_OP_RD_DATA_LEN); + } + } + else { + FXGMAC_PR("Fail to reading efuse Byte%d\n", offset); + } + + return succeed; +} + +#ifndef COMMENT_UNUSED_CODE_TO_REDUCE_SIZE +bool fxgmac_read_patch_from_efuse(struct fxgmac_pdata* pdata, u32 offset, u32* value) +{ + u32 reg_offset, reg_val; + u32 cur_val = 0; + bool succeed = true; + u8 index = 0; + + if(offset >> 16){ + FXGMAC_PR("Reading efuse out of range, reg %d. reg must be 2bytes.\n", index); + return false; + } + + for (index = 0; index < FXGMAC_EFUSE_MAX_ENTRY; index++) { + if (!fxgmac_read_patch_from_efuse_per_index(pdata, index, ®_offset, ®_val)) { + succeed = false; + break; + } else if (reg_offset == offset) { + cur_val = reg_val; + } else if (0 == reg_offset && 0 == reg_val) { + break; // first blank. We should write here. + } + } + + if (value) { + *value = cur_val; + } + + return succeed; +} + +bool fxgmac_write_patch_to_efuse_per_index(struct fxgmac_pdata* pdata, u8 index, u32 offset, u32 value) +{ + unsigned int wait, i; + u32 reg_val; + bool succeed = false; + u32 cur_reg, cur_val; + u8 max_index = FXGMAC_EFUSE_MAX_ENTRY; + + if(offset >> 16){ + FXGMAC_PR("Reading efuse out of range, reg %d. reg must be 2bytes.\n", index); + return false; + } + + fxgmac_efuse_read_data(pdata, EFUSE_LED_ADDR, ®_val); + if (EFUSE_LED_COMMON_SOLUTION == reg_val) { + max_index = FXGMAC_EFUSE_MAX_ENTRY_UNDER_LED_COMMON; + } + + if (index >= max_index) { + FXGMAC_PR("Writing efuse out of range, index %d max index %d\n", index, max_index); + return false; + } + + if (fxgmac_read_patch_from_efuse_per_index(pdata, index, &cur_reg, &cur_val)) { + if(cur_reg != 0 || cur_val != 0){ + FXGMAC_PR(" The index %d has writed value, cannot rewrite it.\n", index); + return false; + } + }else{ + FXGMAC_PR("Cannot read index %d.\n", index); + return false; + } + + for (i = EFUSE_PATCH_ADDR_START_BYTE; i < EFUSE_PATCH_DATA_START_BYTE; i++) { + reg_val = 0; + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, EFUSE_REGION_A_B_LENGTH + index * EFUSE_EACH_PATH_SIZE + i); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_WR_DATA_POS, EFUSE_OP_WR_DATA_LEN, (offset >> (i << 3)) & 0xFF); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_WRITE); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + + succeed = false; + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + if (!succeed) { + FXGMAC_PR("Fail to writing efuse Byte%d\n", index * EFUSE_EACH_PATH_SIZE + i); + return succeed; + } + } + + for (i = 2; i < 6; i++) { + reg_val = 0; + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, 18 + index * 6 + i); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_WR_DATA_POS, EFUSE_OP_WR_DATA_LEN, (value >> ((i - 2) << 3)) & 0xFF); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_WRITE); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + + succeed = false; + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + if (!succeed) { + FXGMAC_PR("Fail to writing efuse Byte%d\n", index * EFUSE_EACH_PATH_SIZE + i); + return succeed; + } + } + + return succeed; +} + +bool fxgmac_write_patch_to_efuse(struct fxgmac_pdata* pdata, u32 offset, u32 value) +{ + unsigned int wait, i; + u32 reg_offset, reg_val; + u32 cur_offset = 0, cur_val = 0; + bool succeed = false; + u8 index = 0; + + if(offset >> 16){ + FXGMAC_PR("Reading efuse out of range, reg %d. reg must be 2bytes.\n", index); + return false; + } + + for (index = 0; index < FXGMAC_EFUSE_MAX_ENTRY; index++) { + if (!fxgmac_read_patch_from_efuse_per_index(pdata, index, ®_offset, ®_val)) { + return false; + } else if (reg_offset == offset) { + cur_offset = reg_offset; + cur_val = reg_val; + } else if (0 == reg_offset && 0 == reg_val) { + break; // first blank. We should write here. + } + } + + if (cur_offset == offset) { + if (cur_val == value) { + FXGMAC_PR("0x%x -> Reg0x%x already exists, ignore.\n", value, offset); + return true; + } else { + FXGMAC_PR("Reg0x%x entry current value 0x%x, reprogram.\n", offset, value); + } + } + + for (i = EFUSE_PATCH_ADDR_START_BYTE; i < EFUSE_PATCH_DATA_START_BYTE; i++) { + reg_val = 0; + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, EFUSE_REGION_A_B_LENGTH + index * EFUSE_EACH_PATH_SIZE + i); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_WR_DATA_POS, EFUSE_OP_WR_DATA_LEN, (offset >> (i << 3)) & 0xFF ); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_WRITE); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + + succeed = false; + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + if (!succeed) { + FXGMAC_PR("Fail to writing efuse Byte%d\n", index * EFUSE_EACH_PATH_SIZE + i); + return succeed; + } + } + + for (i = EFUSE_PATCH_DATA_START_BYTE; i < EFUSE_EACH_PATH_SIZE; i++) { + reg_val = 0; + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, EFUSE_REGION_A_B_LENGTH + index * EFUSE_EACH_PATH_SIZE + i); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_WR_DATA_POS, EFUSE_OP_WR_DATA_LEN, (value >> ((i - 2) << 3)) & 0xFF); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_WRITE); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + + succeed = false; + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + if (!succeed) { + FXGMAC_PR("Fail to writing efuse Byte%d\n", index * EFUSE_EACH_PATH_SIZE + i); + return succeed; + } + } + + return succeed; +} + +bool fxgmac_write_mac_subsys_to_efuse(struct fxgmac_pdata* pdata, u8* mac_addr, u32* subsys, u32* revid) +{ +#ifdef DBG + u32 machr = 0, maclr = 0; +#endif + u32 cur_subsysid = 0; + u32 pcie_cfg_ctrl= PCIE_CFG_CTRL_DEFAULT_VAL; + bool succeed = true; + if (mac_addr) { +#ifdef DBG + machr = readreg(pdata->pAdapter, pdata->base_mem + MACA0HR_FROM_EFUSE); + maclr = readreg(pdata->pAdapter, pdata->base_mem + MACA0LR_FROM_EFUSE); + DPRINTK("Current mac address from efuse is %02x-%02x-%02x-%02x-%02x-%02x.\n", + (machr >> 8) & 0xFF, machr & 0xFF, (maclr >> 24) & 0xFF, (maclr >> 16) & 0xFF, (maclr >> 8) & 0xFF, maclr & 0xFF); +#endif + if(!fxgmac_write_patch_to_efuse(pdata, MACA0HR_FROM_EFUSE, (((u32)mac_addr[0]) << 8) | mac_addr[1])){ + succeed = false; + } + if(!fxgmac_write_patch_to_efuse(pdata, MACA0LR_FROM_EFUSE, (((u32)mac_addr[2]) << 24) | (((u32)mac_addr[3]) << 16) | (((u32)mac_addr[4]) << 8) | mac_addr[5])){ + succeed = false; + } + } + + if (revid) { + if(!fxgmac_write_patch_to_efuse(pdata, EFUSE_REVID_REGISTER, *revid)){ + succeed = false; + } + } + if (subsys) { + if (!fxgmac_read_mac_subsys_from_efuse(pdata, NULL, &cur_subsysid, NULL)) + return false; + + if (cur_subsysid != *subsys) + { + pcie_cfg_ctrl = FXGMAC_SET_REG_BITS(pcie_cfg_ctrl, MGMT_PCIE_CFG_CTRL_CS_EN_POS, MGMT_PCIE_CFG_CTRL_CS_EN_LEN, 1); + if (!fxgmac_write_patch_to_efuse(pdata, MGMT_PCIE_CFG_CTRL, pcie_cfg_ctrl)) { + succeed = false; + } + if (!fxgmac_write_patch_to_efuse(pdata, EFUSE_SUBSYS_REGISTER, *subsys)) { + succeed = false; + } + pcie_cfg_ctrl = FXGMAC_SET_REG_BITS(pcie_cfg_ctrl, MGMT_PCIE_CFG_CTRL_CS_EN_POS, MGMT_PCIE_CFG_CTRL_CS_EN_LEN, 0); + if (!fxgmac_write_patch_to_efuse(pdata, MGMT_PCIE_CFG_CTRL, pcie_cfg_ctrl)) { + succeed = false; + } + } + } + return succeed; +} + +bool fxgmac_write_mac_addr_to_efuse(struct fxgmac_pdata* pdata, u8* mac_addr) +{ +#ifdef DBG + u32 machr = 0, maclr = 0; +#endif + bool succeed = true; + + if (mac_addr) { +#ifdef DBG + machr = readreg(pdata->pAdapter, pdata->base_mem + MACA0HR_FROM_EFUSE); + maclr = readreg(pdata->pAdapter, pdata->base_mem + MACA0LR_FROM_EFUSE); + DPRINTK("Current mac address from efuse is %02x-%02x-%02x-%02x-%02x-%02x.\n", + (machr >> 8) & 0xFF, machr & 0xFF, (maclr >> 24) & 0xFF, (maclr >> 16) & 0xFF, (maclr >> 8) & 0xFF, maclr & 0xFF); +#endif + if(!fxgmac_write_patch_to_efuse(pdata, MACA0HR_FROM_EFUSE, (((u32)mac_addr[0]) << 8) | mac_addr[1])){ + succeed = false; + } + if(!fxgmac_write_patch_to_efuse(pdata, MACA0LR_FROM_EFUSE, (((u32)mac_addr[2]) << 24) | (((u32)mac_addr[3]) << 16) | (((u32)mac_addr[4]) << 8) | mac_addr[5])){ + succeed = false; + } + } + + return succeed; +} + +bool fxgmac_read_subsys_from_efuse(struct fxgmac_pdata* pdata, u32* subsys, u32* revid) +{ + u32 offset = 0, value = 0; + u8 index; + bool succeed = true; + + for (index = 0; index < FXGMAC_EFUSE_MAX_ENTRY; index++) { + if (!fxgmac_read_patch_from_efuse_per_index(pdata, index, &offset, &value)) { + succeed = false; + break; // reach the last item. + } + if (0x00 == offset) { + break; // reach the blank. + } + + if ((EFUSE_REVID_REGISTER == offset) && revid) { + *revid = value; + }else{ + succeed = false; + } + if ((EFUSE_SUBSYS_REGISTER == offset) && subsys) { + *subsys = value; + }else{ + succeed = false; + } + } + + return succeed; +} + +bool fxgmac_write_subsys_to_efuse(struct fxgmac_pdata* pdata, u32* subsys, u32* revid) +{ + bool succeed = true; + + /* write subsys info */ + if (revid) { + if(!fxgmac_write_patch_to_efuse(pdata, EFUSE_REVID_REGISTER, *revid)){ + succeed = false; + } + } + if (subsys) { + if(!fxgmac_write_patch_to_efuse(pdata, EFUSE_SUBSYS_REGISTER, *subsys)){ + succeed = false; + } + } + return succeed; +} + +bool fxgmac_efuse_load(struct fxgmac_pdata* pdata) +{ + bool succeed = false; + unsigned int wait; + u32 reg_val = 0; + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_AUTO_LOAD); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + if (!succeed) { + FXGMAC_PR("Fail to loading efuse, ctrl_1 0x%08x\n", reg_val); + } + return succeed; +} + +bool fxgmac_efuse_write_oob(struct fxgmac_pdata* pdata) +{ + bool succeed = false; + unsigned int wait; + u32 reg_val, value; + + if (!fxgmac_efuse_read_data(pdata, EFUSE_OOB_ADDR, ®_val)) { + return succeed; + } + + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OOB_POS, EFUSE_OOB_LEN)) { + FXGMAC_PR("OOB Ctrl bit already exists"); + return true; + } + + value = 0; + value = FXGMAC_SET_REG_BITS(value, EFUSE_OOB_POS, EFUSE_OOB_LEN, 1); + + reg_val = 0; + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, EFUSE_OOB_ADDR); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_WR_DATA_POS, EFUSE_OP_WR_DATA_LEN, value & 0xFF); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_WRITE); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + + if (!succeed) { + FXGMAC_PR("Fail to writing efuse Byte OOB"); + } + + return succeed; +} + +bool fxgmac_efuse_write_led(struct fxgmac_pdata* pdata, u32 value) +{ + bool succeed = false; + unsigned int wait; + u32 reg_val; + + if (!fxgmac_efuse_read_data(pdata, EFUSE_LED_ADDR, ®_val)) { + return succeed; + } + + if (reg_val == value) { + FXGMAC_PR("Led Ctrl option already exists"); + return true; + } + + reg_val = 0; + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, EFUSE_LED_ADDR); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_WR_DATA_POS, EFUSE_OP_WR_DATA_LEN, value & 0xFF); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_WRITE); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + + if (!succeed) { + FXGMAC_PR("Fail to writing efuse Byte LED"); + } + + return succeed; +} + +bool fxgmac_efuse_write_data(struct fxgmac_pdata* pdata, u32 offset, u32 value) +{ + bool succeed = false; + unsigned int wait; + u32 reg_val; + + if (!fxgmac_efuse_read_data(pdata, offset, ®_val)) { + return succeed; + } + + if (reg_val == value) { + FXGMAC_PR("offset 0x%x already exists", offset); + return true; + } + + reg_val = 0; + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_ADDR_POS, EFUSE_OP_ADDR_LEN, offset & 0xFF); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_WR_DATA_POS, EFUSE_OP_WR_DATA_LEN, value & 0xFF); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_START_POS, EFUSE_OP_START_LEN, 1); + reg_val = FXGMAC_SET_REG_BITS(reg_val, EFUSE_OP_MODE_POS, EFUSE_OP_MODE_LEN, EFUSE_OP_MODE_ROW_WRITE); + writereg(pdata->pAdapter, reg_val, pdata->base_mem + EFUSE_OP_CTRL_0); + + wait = 1000; + while (wait--) { + usleep_range_ex(pdata->pAdapter, 20, 50); + reg_val = readreg(pdata->pAdapter, pdata->base_mem + EFUSE_OP_CTRL_1); + if (FXGMAC_GET_REG_BITS(reg_val, EFUSE_OP_DONE_POS, EFUSE_OP_DONE_LEN)) { + succeed = true; + break; + } + } + + if (!succeed) { + FXGMAC_PR("Fail to writing efuse 0x%x Byte LED", offset); + } + + return succeed; +} + +static void fxgmac_read_led_efuse_config(struct fxgmac_pdata* pdata, struct led_setting* pfirst, struct led_setting* psecond) +{ + u32 val_high = 0, val_low = 0; + + //read first area + fxgmac_efuse_read_data(pdata, EFUSE_FISRT_UPDATE_ADDR, &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 1), &val_low); + pfirst->disable_led_setting[4] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 2), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 3), &val_low); + pfirst->disable_led_setting[3] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 4), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 5), &val_low); + pfirst->disable_led_setting[2] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 6), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 7), &val_low); + pfirst->disable_led_setting[1] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 8), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 9), &val_low); + pfirst->disable_led_setting[0] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 10), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 11), &val_low); + pfirst->s5_led_setting[4] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 12), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 13), &val_low); + pfirst->s5_led_setting[3] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 14), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 15), &val_low); + pfirst->s5_led_setting[2] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 16), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 17), &val_low); + pfirst->s5_led_setting[1] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 18), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 19), &val_low); + pfirst->s5_led_setting[0] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 20), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 21), &val_low); + pfirst->s3_led_setting[4] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 22), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 23), &val_low); + pfirst->s3_led_setting[3] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 24), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 25), &val_low); + pfirst->s3_led_setting[2] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 26), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 27), &val_low); + pfirst->s3_led_setting[1] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 28), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 29), &val_low); + pfirst->s3_led_setting[0] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 30), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 31), &val_low); + pfirst->s0_led_setting[4] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 32), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 33), &val_low); + pfirst->s0_led_setting[3] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 34), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 35), &val_low); + pfirst->s0_led_setting[2] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 36), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 37), &val_low); + pfirst->s0_led_setting[1] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 38), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 39), &val_low); + pfirst->s0_led_setting[0] = ((val_high << 8) + val_low); + + //read second area + fxgmac_efuse_read_data(pdata, EFUSE_SECOND_UPDATE_ADDR, &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 1), &val_low); + psecond->disable_led_setting[4] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 2), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 3), &val_low); + psecond->disable_led_setting[3] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 4), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 5), &val_low); + psecond->disable_led_setting[2] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 6), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 7), &val_low); + psecond->disable_led_setting[1] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 8), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 9), &val_low); + psecond->disable_led_setting[0] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 10), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 11), &val_low); + psecond->s5_led_setting[4] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 12), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 13), &val_low); + psecond->s5_led_setting[3] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 14), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 15), &val_low); + psecond->s5_led_setting[2] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 16), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 17), &val_low); + psecond->s5_led_setting[1] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 18), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 19), &val_low); + psecond->s5_led_setting[0] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 20), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 21), &val_low); + psecond->s3_led_setting[4] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 22), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 23), &val_low); + psecond->s3_led_setting[3] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 24), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 25), &val_low); + psecond->s3_led_setting[2] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 26), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 27), &val_low); + psecond->s3_led_setting[1] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 28), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 29), &val_low); + psecond->s3_led_setting[0] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 30), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 31), &val_low); + psecond->s0_led_setting[4] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 32), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 33), &val_low); + psecond->s0_led_setting[3] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 34), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 35), &val_low); + psecond->s0_led_setting[2] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 36), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 37), &val_low); + psecond->s0_led_setting[1] = ((val_high << 8) + val_low); + + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 38), &val_high); + fxgmac_efuse_read_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 39), &val_low); + psecond->s0_led_setting[0] = ((val_high << 8) + val_low); +} + +bool fxgmac_write_led_setting_to_efuse(struct fxgmac_pdata* pdata) +{ + struct led_setting led_config_first; + struct led_setting led_config_second; + bool bfirstflag = false, bsecondflag = false; + bool bsucceed = false; + + fxgmac_read_led_efuse_config(pdata, &led_config_first, &led_config_second); + + if (0x00 == led_config_first.s0_led_setting[0] && 0x00 == led_config_first.s0_led_setting[1] && 0x00 == led_config_first.s0_led_setting[2] && 0x00 == led_config_first.s0_led_setting[3] && 0x00 == led_config_first.s0_led_setting[4] + && 0x00 == led_config_first.s3_led_setting[0] && 0x00 == led_config_first.s3_led_setting[1] && 0x00 == led_config_first.s3_led_setting[2] && 0x00 == led_config_first.s3_led_setting[3] && 0x00 == led_config_first.s3_led_setting[4] + && 0x00 == led_config_first.s5_led_setting[0] && 0x00 == led_config_first.s5_led_setting[1] && 0x00 == led_config_first.s5_led_setting[2] && 0x00 == led_config_first.s5_led_setting[3] && 0x00 == led_config_first.s5_led_setting[4] + && 0x00 == led_config_first.disable_led_setting[0] && 0x00 == led_config_first.disable_led_setting[1] && 0x00 == led_config_first.disable_led_setting[2] && 0x00 == led_config_first.disable_led_setting[3] && 0x00 == led_config_first.disable_led_setting[4] + ) { + bfirstflag = true; + } + + if (0x00 == led_config_second.s0_led_setting[0] && 0x00 == led_config_second.s0_led_setting[1] && 0x00 == led_config_second.s0_led_setting[2] && 0x00 == led_config_second.s0_led_setting[3] && 0x00 == led_config_second.s0_led_setting[4] + && 0x00 == led_config_second.s3_led_setting[0] && 0x00 == led_config_second.s3_led_setting[1] && 0x00 == led_config_second.s3_led_setting[2] && 0x00 == led_config_second.s3_led_setting[3] && 0x00 == led_config_second.s3_led_setting[4] + && 0x00 == led_config_second.s5_led_setting[0] && 0x00 == led_config_second.s5_led_setting[1] && 0x00 == led_config_second.s5_led_setting[2] && 0x00 == led_config_second.s5_led_setting[3] && 0x00 == led_config_second.s5_led_setting[4] + && 0x00 == led_config_second.disable_led_setting[0] && 0x00 == led_config_second.disable_led_setting[1] && 0x00 == led_config_second.disable_led_setting[2] && 0x00 == led_config_second.disable_led_setting[3] && 0x00 == led_config_second.disable_led_setting[4] + ) { + bsecondflag = true; + } + +#ifndef LINUX + DbgPrintF(MP_TRACE, "%s s0 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x", __FUNCTION__, pdata->ledconfig.s0_led_setting[0], pdata->ledconfig.s0_led_setting[1], pdata->ledconfig.s0_led_setting[2], pdata->ledconfig.s0_led_setting[3], pdata->ledconfig.s0_led_setting[4]); + DbgPrintF(MP_TRACE, "%s s3 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x", __FUNCTION__, pdata->ledconfig.s3_led_setting[0], pdata->ledconfig.s3_led_setting[1], pdata->ledconfig.s3_led_setting[2], pdata->ledconfig.s3_led_setting[3], pdata->ledconfig.s3_led_setting[4]); + DbgPrintF(MP_TRACE, "%s s5 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x", __FUNCTION__, pdata->ledconfig.s5_led_setting[0], pdata->ledconfig.s5_led_setting[1], pdata->ledconfig.s5_led_setting[2], pdata->ledconfig.s5_led_setting[3], pdata->ledconfig.s5_led_setting[4]); + DbgPrintF(MP_TRACE, "%s disable 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x", __FUNCTION__, pdata->ledconfig.disable_led_setting[0], pdata->ledconfig.disable_led_setting[1], pdata->ledconfig.disable_led_setting[2], pdata->ledconfig.disable_led_setting[3], pdata->ledconfig.disable_led_setting[4]); +#endif + + if (bfirstflag && bsecondflag) { + //update first area + fxgmac_efuse_write_data(pdata, EFUSE_FISRT_UPDATE_ADDR, (pdata->ledconfig.disable_led_setting[4]>>8)&0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 1), pdata->ledconfig.disable_led_setting[4]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 2), (pdata->ledconfig.disable_led_setting[3] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 3), pdata->ledconfig.disable_led_setting[3]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 4), (pdata->ledconfig.disable_led_setting[2] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 5), pdata->ledconfig.disable_led_setting[2]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 6), (pdata->ledconfig.disable_led_setting[1] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 7), pdata->ledconfig.disable_led_setting[1]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 8), (pdata->ledconfig.disable_led_setting[0] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 9), pdata->ledconfig.disable_led_setting[0]); + + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 10), (pdata->ledconfig.s5_led_setting[4] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 11), pdata->ledconfig.s5_led_setting[4]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 12), (pdata->ledconfig.s5_led_setting[3] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 13), pdata->ledconfig.s5_led_setting[3]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 14), (pdata->ledconfig.s5_led_setting[2] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 15), pdata->ledconfig.s5_led_setting[2]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 16), (pdata->ledconfig.s5_led_setting[1] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 17), pdata->ledconfig.s5_led_setting[1]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 18), (pdata->ledconfig.s5_led_setting[0] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 19), pdata->ledconfig.s5_led_setting[0]); + + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 20), (pdata->ledconfig.s3_led_setting[4] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 21), pdata->ledconfig.s3_led_setting[4]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 22), (pdata->ledconfig.s3_led_setting[3] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 23), pdata->ledconfig.s3_led_setting[3]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 24), (pdata->ledconfig.s3_led_setting[2] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 25), pdata->ledconfig.s3_led_setting[2]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 26), (pdata->ledconfig.s3_led_setting[1] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 27), pdata->ledconfig.s3_led_setting[1]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 28), (pdata->ledconfig.s3_led_setting[0] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 29), pdata->ledconfig.s3_led_setting[0]); + + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 30), (pdata->ledconfig.s0_led_setting[4] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 31), pdata->ledconfig.s0_led_setting[4]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 32), (pdata->ledconfig.s0_led_setting[3] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 33), pdata->ledconfig.s0_led_setting[3]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 34), (pdata->ledconfig.s0_led_setting[2] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 35), pdata->ledconfig.s0_led_setting[2]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 36), (pdata->ledconfig.s0_led_setting[1] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 37), pdata->ledconfig.s0_led_setting[1]); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 38), (pdata->ledconfig.s0_led_setting[0] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_FISRT_UPDATE_ADDR - 39), pdata->ledconfig.s0_led_setting[0]); + + bsucceed = true; + } + else if (!bfirstflag && bsecondflag) { + //update second area + fxgmac_efuse_write_data(pdata, EFUSE_SECOND_UPDATE_ADDR, (pdata->ledconfig.disable_led_setting[4] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 1), pdata->ledconfig.disable_led_setting[4]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 2), (pdata->ledconfig.disable_led_setting[3] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 3), pdata->ledconfig.disable_led_setting[3]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 4), (pdata->ledconfig.disable_led_setting[2] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 5), pdata->ledconfig.disable_led_setting[2]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 6), (pdata->ledconfig.disable_led_setting[1] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 7), pdata->ledconfig.disable_led_setting[1]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 8), (pdata->ledconfig.disable_led_setting[0] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 9), pdata->ledconfig.disable_led_setting[0]); + + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 10), (pdata->ledconfig.s5_led_setting[4] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 11), pdata->ledconfig.s5_led_setting[4]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 12), (pdata->ledconfig.s5_led_setting[3] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 13), pdata->ledconfig.s5_led_setting[3]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 14), (pdata->ledconfig.s5_led_setting[2] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 15), pdata->ledconfig.s5_led_setting[2]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 16), (pdata->ledconfig.s5_led_setting[1] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 17), pdata->ledconfig.s5_led_setting[1]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 18), (pdata->ledconfig.s5_led_setting[0] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 19), pdata->ledconfig.s5_led_setting[0]); + + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 20), (pdata->ledconfig.s3_led_setting[4] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 21), pdata->ledconfig.s3_led_setting[4]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 22), (pdata->ledconfig.s3_led_setting[3] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 23), pdata->ledconfig.s3_led_setting[3]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 24), (pdata->ledconfig.s3_led_setting[2] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 25), pdata->ledconfig.s3_led_setting[2]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 26), (pdata->ledconfig.s3_led_setting[1] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 27), pdata->ledconfig.s3_led_setting[1]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 28), (pdata->ledconfig.s3_led_setting[0] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 29), pdata->ledconfig.s3_led_setting[0]); + + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 30), (pdata->ledconfig.s0_led_setting[4] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 31), pdata->ledconfig.s0_led_setting[4]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 32), (pdata->ledconfig.s0_led_setting[3] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 33), pdata->ledconfig.s0_led_setting[3]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 34), (pdata->ledconfig.s0_led_setting[2] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 35), pdata->ledconfig.s0_led_setting[2]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 36), (pdata->ledconfig.s0_led_setting[1] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 37), pdata->ledconfig.s0_led_setting[1]); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 38), (pdata->ledconfig.s0_led_setting[0] >> 8) & 0xFF); + fxgmac_efuse_write_data(pdata, (EFUSE_SECOND_UPDATE_ADDR - 39), pdata->ledconfig.s0_led_setting[0]); + + bsucceed = true; + } + + return bsucceed; +} + +bool fxgmac_read_led_setting_from_efuse(struct fxgmac_pdata* pdata) +{ + struct led_setting led_config_first; + struct led_setting led_config_second; + bool bfirstflag = false, bsecondflag = false; + bool bsucceed = false; + + fxgmac_read_led_efuse_config(pdata, &led_config_first, &led_config_second); + + if (0x00 == led_config_first.s0_led_setting[0] && 0x00 == led_config_first.s0_led_setting[1] && 0x00 == led_config_first.s0_led_setting[2] && 0x00 == led_config_first.s0_led_setting[3] && 0x00 == led_config_first.s0_led_setting[4] + && 0x00 == led_config_first.s3_led_setting[0] && 0x00 == led_config_first.s3_led_setting[1] && 0x00 == led_config_first.s3_led_setting[2] && 0x00 == led_config_first.s3_led_setting[3] && 0x00 == led_config_first.s3_led_setting[4] + && 0x00 == led_config_first.s5_led_setting[0] && 0x00 == led_config_first.s5_led_setting[1] && 0x00 == led_config_first.s5_led_setting[2] && 0x00 == led_config_first.s5_led_setting[3] && 0x00 == led_config_first.s5_led_setting[4] + && 0x00 == led_config_first.disable_led_setting[0] && 0x00 == led_config_first.disable_led_setting[1] && 0x00 == led_config_first.disable_led_setting[2] && 0x00 == led_config_first.disable_led_setting[3] && 0x00 == led_config_first.disable_led_setting[4] + ) { + bfirstflag = true; + } + + if (0x00 == led_config_second.s0_led_setting[0] && 0x00 == led_config_second.s0_led_setting[1] && 0x00 == led_config_second.s0_led_setting[2] && 0x00 == led_config_second.s0_led_setting[3] && 0x00 == led_config_second.s0_led_setting[4] + && 0x00 == led_config_second.s3_led_setting[0] && 0x00 == led_config_second.s3_led_setting[1] && 0x00 == led_config_second.s3_led_setting[2] && 0x00 == led_config_second.s3_led_setting[3] && 0x00 == led_config_second.s3_led_setting[4] + && 0x00 == led_config_second.s5_led_setting[0] && 0x00 == led_config_second.s5_led_setting[1] && 0x00 == led_config_second.s5_led_setting[2] && 0x00 == led_config_second.s5_led_setting[3] && 0x00 == led_config_second.s5_led_setting[4] + && 0x00 == led_config_second.disable_led_setting[0] && 0x00 == led_config_second.disable_led_setting[1] && 0x00 == led_config_second.disable_led_setting[2] && 0x00 == led_config_second.disable_led_setting[3] && 0x00 == led_config_second.disable_led_setting[4] + ) { + bsecondflag = true; + } + + if (!bfirstflag && bsecondflag) { + //read first area + memcpy(&pdata->led, &led_config_first, sizeof(struct led_setting)); + bsucceed = true; + } + else if (!bfirstflag && !bsecondflag) { + //read second area + memcpy(&pdata->led, &led_config_second, sizeof(struct led_setting)); + bsucceed = true; + } + +#ifndef LINUX + DbgPrintF(MP_TRACE, "%s s0 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x", __FUNCTION__, pdata->led.s0_led_setting[0], pdata->led.s0_led_setting[1], pdata->led.s0_led_setting[2], pdata->led.s0_led_setting[3], pdata->led.s0_led_setting[4]); + DbgPrintF(MP_TRACE, "%s s3 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x", __FUNCTION__, pdata->led.s3_led_setting[0], pdata->led.s3_led_setting[1], pdata->led.s3_led_setting[2], pdata->led.s3_led_setting[3], pdata->led.s3_led_setting[4]); + DbgPrintF(MP_TRACE, "%s s5 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x", __FUNCTION__, pdata->led.s5_led_setting[0], pdata->led.s5_led_setting[1], pdata->led.s5_led_setting[2], pdata->led.s5_led_setting[3], pdata->led.s5_led_setting[4]); + DbgPrintF(MP_TRACE, "%s disable 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x", __FUNCTION__, pdata->led.disable_led_setting[0], pdata->led.disable_led_setting[1], pdata->led.disable_led_setting[2], pdata->led.disable_led_setting[3], pdata->led.disable_led_setting[4]); +#endif + + return bsucceed; +} +#endif diff --git a/lede/package/kernel/yt6801/src/fuxi-efuse.h b/lede/package/kernel/yt6801/src/fuxi-efuse.h new file mode 100644 index 0000000000..02bd9cce6b --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-efuse.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#ifndef __FXGMAC_EFUSE_H__ +#define __FXGMAC_EFUSE_H__ + +bool fxgmac_read_patch_from_efuse_per_index(struct fxgmac_pdata* pdata, u8 index, u32 __far* offset, u32 __far* value); /* read patch per 0-based index. */ +bool fxgmac_read_mac_subsys_from_efuse(struct fxgmac_pdata* pdata, u8* mac_addr, u32* subsys, u32* revid); +bool fxgmac_efuse_read_data(struct fxgmac_pdata* pdata, u32 offset, u32 __far* value); + +#ifndef COMMENT_UNUSED_CODE_TO_REDUCE_SIZE +bool fxgmac_read_patch_from_efuse(struct fxgmac_pdata* pdata, u32 offset, u32* value); /* read patch per register offset. */ +bool fxgmac_write_patch_to_efuse(struct fxgmac_pdata* pdata, u32 offset, u32 value); +bool fxgmac_write_patch_to_efuse_per_index(struct fxgmac_pdata* pdata, u8 index, u32 offset, u32 value); +bool fxgmac_write_mac_subsys_to_efuse(struct fxgmac_pdata* pdata, u8* mac_addr, u32* subsys, u32* revid); +bool fxgmac_write_mac_addr_to_efuse(struct fxgmac_pdata* pdata, u8* mac_addr); +bool fxgmac_read_subsys_from_efuse(struct fxgmac_pdata* pdata, u32* subsys, u32* revid); +bool fxgmac_write_subsys_to_efuse(struct fxgmac_pdata* pdata, u32* subsys, u32* revid); +bool fxgmac_efuse_load(struct fxgmac_pdata* pdata); +bool fxgmac_efuse_write_data(struct fxgmac_pdata* pdata, u32 offset, u32 value); +bool fxgmac_efuse_write_oob(struct fxgmac_pdata* pdata); +bool fxgmac_efuse_write_led(struct fxgmac_pdata* pdata, u32 value); +bool fxgmac_read_led_setting_from_efuse(struct fxgmac_pdata* pdata); +bool fxgmac_write_led_setting_to_efuse(struct fxgmac_pdata* pdata); +#endif + +#endif // __FXGMAC_EFUSE_H__ diff --git a/lede/package/kernel/yt6801/src/fuxi-errno.h b/lede/package/kernel/yt6801/src/fuxi-errno.h new file mode 100644 index 0000000000..7a5d7eda95 --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-errno.h @@ -0,0 +1,179 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#ifndef __FXGMAC_ERROR_H__ +#define __FXGMAC_ERROR_H__ + +#define EOK 0 + +/* ref linux https://elixir.bootlin.com/linux/v5.18-rc7/source/include/uapi/asm-generic/errno.h#L93 */ +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ + + + +#define EDEADLK 35 /* Resource deadlock would occur */ +#define ENAMETOOLONG 36 /* File name too long */ +#define ENOLCK 37 /* No record locks available */ + +/* + * This error code is special: arch syscall entry code will return + * -ENOSYS if users try to call a syscall that doesn't exist. To keep + * failures of syscalls that really do exist distinguishable from + * failures due to attempts to use a nonexistent syscall, syscall + * implementations should refrain from returning -ENOSYS. + */ +#define ENOSYS 38 /* Invalid system call number */ + +#define ENOTEMPTY 39 /* Directory not empty */ +#define ELOOP 40 /* Too many symbolic links encountered */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define ENOMSG 42 /* No message of desired type */ +#define EIDRM 43 /* Identifier removed */ +#define ECHRNG 44 /* Channel number out of range */ +#define EL2NSYNC 45 /* Level 2 not synchronized */ +#define EL3HLT 46 /* Level 3 halted */ +#define EL3RST 47 /* Level 3 reset */ +#define ELNRNG 48 /* Link number out of range */ +#define EUNATCH 49 /* Protocol driver not attached */ +#define ENOCSI 50 /* No CSI structure available */ +#define EL2HLT 51 /* Level 2 halted */ +#define EBADE 52 /* Invalid exchange */ +#define EBADR 53 /* Invalid request descriptor */ +#define EXFULL 54 /* Exchange full */ +#define ENOANO 55 /* No anode */ +#define EBADRQC 56 /* Invalid request code */ +#define EBADSLT 57 /* Invalid slot */ + +#define EDEADLOCK EDEADLK + +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 72 /* Multihop attempted */ +#define EDOTDOT 73 /* RFS specific error */ +#define EBADMSG 74 /* Not a data message */ +#define EOVERFLOW 75 /* Value too large for defined data type */ +#define ENOTUNIQ 76 /* Name not unique on network */ +#define EBADFD 77 /* File descriptor in bad state */ +#define EREMCHG 78 /* Remote address changed */ +#define ELIBACC 79 /* Can not access a needed shared library */ +#define ELIBBAD 80 /* Accessing a corrupted shared library */ +#define ELIBSCN 81 /* .lib section in a.out corrupted */ +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define EILSEQ 84 /* Illegal byte sequence */ +#define ERESTART 85 /* Interrupted system call should be restarted */ +#define ESTRPIPE 86 /* Streams pipe error */ +#define EUSERS 87 /* Too many users */ +#define ENOTSOCK 88 /* Socket operation on non-socket */ +#define EDESTADDRREQ 89 /* Destination address required */ +#define EMSGSIZE 90 /* Message too long */ +#define EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 92 /* Protocol not available */ +#define EPROTONOSUPPORT 93 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define EADDRINUSE 98 /* Address already in use */ +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define ENETDOWN 100 /* Network is down */ +#define ENETUNREACH 101 /* Network is unreachable */ +#define ENETRESET 102 /* Network dropped connection because of reset */ +#define ECONNABORTED 103 /* Software caused connection abort */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EISCONN 106 /* Transport endpoint is already connected */ +#define ENOTCONN 107 /* Transport endpoint is not connected */ +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define ETIMEDOUT 110 /* Connection timed out */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EHOSTDOWN 112 /* Host is down */ +#define EHOSTUNREACH 113 /* No route to host */ +#define EALREADY 114 /* Operation already in progress */ +#define EINPROGRESS 115 /* Operation now in progress */ +#define ESTALE 116 /* Stale file handle */ +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ +#define EDQUOT 122 /* Quota exceeded */ + +#define ENOMEDIUM 123 /* No medium found */ +#define EMEDIUMTYPE 124 /* Wrong medium type */ +#define ECANCELED 125 /* Operation Canceled */ +#define ENOKEY 126 /* Required key not available */ +#define EKEYEXPIRED 127 /* Key has expired */ +#define EKEYREVOKED 128 /* Key has been revoked */ +#define EKEYREJECTED 129 /* Key was rejected by service */ + +/* for robust mutexes */ +#define EOWNERDEAD 130 /* Owner died */ +#define ENOTRECOVERABLE 131 /* State not recoverable */ + +#define ERFKILL 132 /* Operation not possible due to RF-kill */ + +#define EHWPOISON 133 /* Memory page has hardware error */ + +#endif // __FXGMAC_ERROR_H__ + diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-common.c b/lede/package/kernel/yt6801/src/fuxi-gmac-common.c new file mode 100644 index 0000000000..41866bbc96 --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-common.c @@ -0,0 +1,1032 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" + +MODULE_LICENSE("GPL"); + +static int debug = 16; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "FUXI ethernet debug level (0=none,...,16=all)"); + + +static int fxgmac_read_mac_addr(struct fxgmac_pdata *pdata) +{ + struct net_device *netdev = pdata->netdev; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + unsigned char dev_addr[6] = {0, 0x55, 0x7b, 0xb5, 0x7d, 0xf7}; + int ret; + /* DPRINTK("read mac from eFuse\n"); */ + + /* if efuse have mac addr,use it.if not,use static mac address. */ + ret = hw_ops->read_mac_subsys_from_efuse(pdata, pdata->mac_addr, NULL, NULL); + if (!ret ) + { + DPRINTK("eFuse mac addr err\n"); + return -1; + } + + if (ETH_IS_ZEROADDRESS(pdata->mac_addr)) { + /* Currently it uses a static mac address for test */ + memcpy(pdata->mac_addr, dev_addr, netdev->addr_len); + } + return 0; +} + +static void fxgmac_default_config(struct fxgmac_pdata *pdata) +{ + pdata->tx_osp_mode = DMA_OSP_ENABLE; + pdata->tx_sf_mode = MTL_TSF_ENABLE; + pdata->rx_sf_mode = MTL_RSF_ENABLE;//MTL_RSF_DISABLE 20210514 + pdata->pblx8 = DMA_PBL_X8_ENABLE;//DMA_PBL_X8_ENABLE 20210514 + pdata->tx_pbl = DMA_PBL_16; + pdata->rx_pbl = DMA_PBL_4;//DMA_PBL_32 20210514 + pdata->tx_threshold = MTL_TX_THRESHOLD_128; + pdata->rx_threshold = MTL_RX_THRESHOLD_128; +#if 1 + pdata->tx_pause = 1; + pdata->rx_pause = 1; +#else + pdata->tx_pause = 0; + pdata->rx_pause = 0; +#endif +#if FXGMAC_RSS_FEATURE_ENABLED + pdata->rss = 1; +#else + pdata->rss = 0; +#endif + // open interrupt moderation default + pdata->intr_mod = FXGMAC_INT_MODERATION_ENABLED; + pdata->crc_check = 1; + + pdata->sysclk_rate = FXGMAC_SYSCLOCK; + pdata->phy_autoeng = AUTONEG_ENABLE; // default to autoneg + pdata->phy_duplex = DUPLEX_FULL; + pdata->expansion.phy_link = false; + pdata->phy_speed = SPEED_1000; + pdata->expansion.pre_phy_speed = pdata->phy_speed; + pdata->expansion.pre_phy_duplex = pdata->phy_duplex; + pdata->expansion.pre_phy_autoneg = pdata->phy_autoeng; + pdata->expansion.recover_phy_state = 0; + // default to magic + pdata->expansion.wol = WAKE_MAGIC; + +#ifdef FXGMAC_ASPM_ENABLED + pdata->expansion.recover_from_aspm = false; + pdata->expansion.aspm_en = false; + pdata->expansion.aspm_work_active = false; +#endif + + strscpy(pdata->drv_name, FXGMAC_DRV_NAME, sizeof(pdata->drv_name)); + strscpy(pdata->drv_ver, FXGMAC_DRV_VERSION, sizeof(pdata->drv_ver)); + dev_info(pdata->dev, "FXGMAC_DRV_NAME:%s, FXGMAC_DRV_VERSION:%s\n", + FXGMAC_DRV_NAME, FXGMAC_DRV_VERSION); +} + +static void fxgmac_init_all_ops(struct fxgmac_pdata *pdata) +{ + fxgmac_init_desc_ops(&pdata->desc_ops); + fxgmac_init_hw_ops(&pdata->hw_ops); + + /* DPRINTK("register desc_ops and hw ops\n"); */ +} + +int fxgmac_init(struct fxgmac_pdata *pdata, bool save_private_reg) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + struct net_device *netdev = pdata->netdev; + unsigned int i; + int ret; + + /* Set all the function pointers */ + fxgmac_init_all_ops(pdata); + + /* Set default configuration data */ + fxgmac_default_config(pdata); + + /* Set irq, base_addr, MAC address, */ + netdev->irq = pdata->dev_irq; + netdev->base_addr = (unsigned long)pdata->base_mem; + ret = fxgmac_read_mac_addr(pdata); + if (ret < 0) + return ret; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) + eth_hw_addr_set(netdev, pdata->mac_addr); +#else + memcpy(netdev->dev_addr, pdata->mac_addr, netdev->addr_len); +#endif + + if (save_private_reg) { + hw_ops->save_nonstick_reg(pdata); + } + + // reset here to get hw features correctly + hw_ops->exit(pdata); + + /* Populate the hardware features */ + fxgmac_get_all_hw_features(pdata); + fxgmac_print_all_hw_features(pdata); + + /* Set the DMA mask */ + ret = dma_set_mask_and_coherent(pdata->dev, + DMA_BIT_MASK(FXGMAC_DMA_BIT_MASK64)); + if (ret) { + ret = dma_set_mask_and_coherent(pdata->dev, + DMA_BIT_MASK(FXGMAC_DMA_BIT_MASK32)); + if (ret) { + dev_err(pdata->dev, "dma_set_mask_and_coherent failed\n"); + return ret; + } + } + + /* Channel and ring params initializtion + * pdata->channel_count; + * pdata->tx_ring_count; + * pdata->rx_ring_count; + * pdata->tx_desc_count; + * pdata->rx_desc_count; + */ + BUILD_BUG_ON_NOT_POWER_OF_2(FXGMAC_TX_DESC_CNT); + pdata->tx_desc_count = FXGMAC_TX_DESC_CNT; + if (pdata->tx_desc_count & (pdata->tx_desc_count - 1)) { + dev_err(pdata->dev, "tx descriptor count (%d) is not valid\n", + pdata->tx_desc_count); + ret = -EINVAL; + return ret; + } + BUILD_BUG_ON_NOT_POWER_OF_2(FXGMAC_RX_DESC_CNT); + pdata->rx_desc_count = FXGMAC_RX_DESC_CNT; + if (pdata->rx_desc_count & (pdata->rx_desc_count - 1)) { + dev_err(pdata->dev, "rx descriptor count (%d) is not valid\n", + pdata->rx_desc_count); + ret = -EINVAL; + return ret; + } + + pdata->tx_ring_count = min_t(unsigned int, num_online_cpus(), + pdata->hw_feat.tx_ch_cnt); + pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, + pdata->hw_feat.tx_q_cnt); + pdata->tx_q_count = pdata->tx_ring_count; + + ret = netif_set_real_num_tx_queues(netdev, pdata->tx_q_count); + DPRINTK("num_online_cpus:%u, tx_ch_cnt:%u, tx_q_cnt:%u, tx_ring_count:%u\n", + num_online_cpus(), pdata->hw_feat.tx_ch_cnt, pdata->hw_feat.tx_q_cnt, + pdata->tx_ring_count); + if (ret) { + dev_err(pdata->dev, "error setting real tx queue count\n"); + return ret; + } + + pdata->rx_ring_count = min_t(unsigned int, + netif_get_num_default_rss_queues(), + pdata->hw_feat.rx_ch_cnt); +#ifdef FXGMAC_ONE_CHANNEL + pdata->rx_ring_count = 1; + pdata->hw_feat.rx_q_cnt = pdata->rx_ring_count; +#else + pdata->rx_ring_count = min_t(unsigned int, pdata->rx_ring_count, + pdata->hw_feat.rx_q_cnt); +#endif + pdata->rx_q_count = pdata->rx_ring_count; + ret = netif_set_real_num_rx_queues(netdev, pdata->rx_q_count); + if (ret) { + dev_err(pdata->dev, "error setting real rx queue count\n"); + return ret; + } + + pdata->channel_count = + max_t(unsigned int, pdata->tx_ring_count, pdata->rx_ring_count); + + DPRINTK("default rss queues:%u, rx_ch_cnt:%u, rx_q_cnt:%u, rx_ring_count:%u\n", + netif_get_num_default_rss_queues(), pdata->hw_feat.rx_ch_cnt, pdata->hw_feat.rx_q_cnt, + pdata->rx_ring_count); + DPRINTK("channel_count:%u, netdev tx channel_num=%u\n", pdata->channel_count, netdev->real_num_tx_queues); + + /* Initialize RSS hash key and lookup table */ +#if FXGMAC_RSS_HASH_KEY_LINUX + netdev_rss_key_fill(pdata->rss_key, sizeof(pdata->rss_key)); +#else + //this is for test only. HW does not want to change Hash key, 20210617 + hw_ops->get_rss_hash_key(pdata, (u8 *)pdata->rss_key); +#endif + +#if FXGMAC_MSIX_CH0RXDIS_ENABLED + for (i = 0; i < FXGMAC_RSS_MAX_TABLE_SIZE; i++) { + pdata->rss_table[i] = FXGMAC_SET_REG_BITS( + pdata->rss_table[i], + MAC_RSSDR_DMCH_POS, + MAC_RSSDR_DMCH_LEN, + (i % 3) + 1); //eliminate ch0 + } +#else + for (i = 0; i < FXGMAC_RSS_MAX_TABLE_SIZE; i++) { + pdata->rss_table[i] = FXGMAC_SET_REG_BITS( + pdata->rss_table[i], + MAC_RSSDR_DMCH_POS, + MAC_RSSDR_DMCH_LEN, + i % pdata->rx_ring_count); //note, rx_ring_count should be equal to IRQ requsted for MSIx, 4 + } +#endif + + pdata->rss_options = FXGMAC_SET_REG_BITS( + pdata->rss_options, + MAC_RSSCR_IP4TE_POS, + MAC_RSSCR_IP4TE_LEN, 1); + pdata->rss_options = FXGMAC_SET_REG_BITS( + pdata->rss_options, + MAC_RSSCR_TCP4TE_POS, + MAC_RSSCR_TCP4TE_LEN, 1); + pdata->rss_options = FXGMAC_SET_REG_BITS( + pdata->rss_options, + MAC_RSSCR_UDP4TE_POS, + MAC_RSSCR_UDP4TE_LEN, 1); + + /* config MTU supported, 20210726 */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + netdev->min_mtu = ETH_MIN_MTU; + netdev->max_mtu = FXGMAC_JUMBO_PACKET_MTU + (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); +#endif + /* + netdev->extended->min_mtu = netdev->min_mtu; + netdev->extended->max_mtu = netdev->max_mtu; + */ + + DPRINTK("rss_options:0x%x\n", pdata->rss_options); + + /* Set device operations */ + netdev->netdev_ops = fxgmac_get_netdev_ops(); + netdev->ethtool_ops = fxgmac_get_ethtool_ops(); + + /* Set device features */ + if (pdata->hw_feat.tso) { + netdev->hw_features = NETIF_F_TSO; + netdev->hw_features |= NETIF_F_TSO6; + netdev->hw_features |= NETIF_F_SG; + netdev->hw_features |= NETIF_F_IP_CSUM; + netdev->hw_features |= NETIF_F_IPV6_CSUM; + } else if (pdata->hw_feat.tx_coe) { + netdev->hw_features = NETIF_F_IP_CSUM; + netdev->hw_features |= NETIF_F_IPV6_CSUM; + } + + if (pdata->hw_feat.rx_coe) { + netdev->hw_features |= NETIF_F_RXCSUM; + netdev->hw_features |= NETIF_F_GRO; + } + + if (pdata->hw_feat.rss) { + netdev->hw_features |= NETIF_F_RXHASH; //it is NETIF_F_RXHASH_BIT finally + } + + netdev->vlan_features |= netdev->hw_features; + + netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; + pdata->vlan_strip = 1; + if (pdata->hw_feat.sa_vlan_ins) { + netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; + } +#if FXGMAC_FILTER_SINGLE_VLAN_ENABLED + /* only can filter one vlan id */ + pdata->hw_feat.vlhash = 1 ; +#else + pdata->hw_feat.vlhash = 0 ; +#endif + + if (pdata->hw_feat.vlhash) { + netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + pdata->vlan_filter = 1; + } + + netdev->features |= netdev->hw_features; + pdata->expansion.netdev_features = netdev->features; + + netdev->priv_flags |= IFF_UNICAST_FLT; + + /* Use default watchdog timeout */ + netdev->watchdog_timeo = msecs_to_jiffies(5000);//refer to sunxi-gmac, 5s +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)) + netif_set_tso_max_size(netdev, NIC_MAX_TCP_OFFLOAD_SIZE); +#else + netdev->gso_max_size = NIC_MAX_TCP_OFFLOAD_SIZE; +#endif + + /* Tx coalesce parameters initialization */ + pdata->tx_usecs = FXGMAC_INIT_DMA_TX_USECS; + pdata->tx_frames = FXGMAC_INIT_DMA_TX_FRAMES; + + /* Rx coalesce parameters initialization */ + pdata->rx_riwt = hw_ops->usec_to_riwt(pdata, FXGMAC_INIT_DMA_RX_USECS); + + pdata->rx_usecs = FXGMAC_INIT_DMA_RX_USECS; + pdata->rx_frames = FXGMAC_INIT_DMA_RX_FRAMES; + + mutex_init(&pdata->expansion.mutex); + + DPRINTK("fxgmac_init callout,ok.\n"); + + return 0; +} + +static void fxgmac_init_interrupt_scheme(struct fxgmac_pdata *pdata) +{ +#ifdef CONFIG_PCI_MSI + int vectors, rc, i, req_vectors; + /* check cpu core number. + * since we have 4 channels, we must ensure the number of cpu core > 4 + * otherwise, just roll back to legacy + */ + vectors = num_online_cpus(); + if(vectors >= FXGMAC_MAX_DMA_CHANNELS) { + // 0-3 for rx, 4 for tx, 5 for misc + req_vectors = FXGMAC_MSIX_INT_NUMS; + pdata->expansion.msix_entries = kcalloc(req_vectors, + sizeof(struct msix_entry), + GFP_KERNEL); + if (!pdata->expansion.msix_entries) { + dev_err(pdata->dev, "MSIx, kcalloc err for msix entries, \ + rollback to MSI\n"); + goto enable_msi_interrupt; + }else { + for (i = 0; i < req_vectors; i++) + pdata->expansion.msix_entries[i].entry = i; + +#ifndef RHEL_MAJOR + rc = pci_enable_msix_range(pdata->pdev, + pdata->expansion.msix_entries, + req_vectors, + req_vectors); +#else +#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,0)) && (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,8)) + rc = pci_enable_msix(pdata->pdev, + pdata->expansion.msix_entries, + req_vectors); +#else + rc = pci_enable_msix_range(pdata->pdev, + pdata->expansion.msix_entries, + req_vectors, + req_vectors); +#endif +#endif + if (rc < 0) { + dev_err(pdata->dev, "enable MSIx failed,%d.\n", rc); + req_vectors = 0; //indicate failure + } else { + req_vectors = rc; + } + + if(req_vectors >= FXGMAC_MAX_DMA_CHANNELS_PLUS_1TX) { + dev_info(pdata->dev, "enable MSIx ok, cpu=%d,vectors=%d.\n", + vectors, req_vectors); + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_INTERRUPT_POS, + FXGMAC_FLAG_INTERRUPT_LEN, + FXGMAC_FLAG_MSIX_ENABLED); + pdata->per_channel_irq = 1; + pdata->expansion.misc_irq = + pdata->expansion.msix_entries[MSI_ID_PHY_OTHER].vector; + return; + }else if (req_vectors){ + dev_err(pdata->dev, "enable MSIx with only %d vector, \ + while we need %d, rollback to MSI.\n", + req_vectors, vectors); + //roll back to msi + pci_disable_msix(pdata->pdev); + kfree(pdata->expansion.msix_entries); + pdata->expansion.msix_entries = NULL; + req_vectors = 0; + }else { + dev_err(pdata->dev, "enable MSIx failure and clear msix entries.\n"); + //roll back to msi + kfree(pdata->expansion.msix_entries); + pdata->expansion.msix_entries = NULL; + req_vectors = 0; + } + } + } + +enable_msi_interrupt: + rc = pci_enable_msi(pdata->pdev); + if (rc < 0) { + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_INTERRUPT_POS, + FXGMAC_FLAG_INTERRUPT_LEN, + FXGMAC_FLAG_LEGACY_ENABLED); + dev_err(pdata->dev, "dev_err MSI failure, rollback to LEGACY.\n"); + } else { + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_INTERRUPT_POS, + FXGMAC_FLAG_INTERRUPT_LEN, + FXGMAC_FLAG_MSI_ENABLED); + pdata->dev_irq = pdata->pdev->irq; + dev_info(pdata->dev, "enable MSI ok, cpu=%d, irq=%d.\n", vectors, pdata->pdev->irq); + } +#else + (void)pdata; +#endif +} + +int fxgmac_drv_probe(struct device *dev, struct fxgmac_resources *res) +{ + struct fxgmac_pdata *pdata; + struct net_device *netdev; + int ret; + + netdev = alloc_etherdev_mq(sizeof(struct fxgmac_pdata), + FXGMAC_MAX_DMA_CHANNELS); + + if (!netdev) { + dev_err(dev, "alloc_etherdev failed\n"); + return -ENOMEM; + } + + SET_NETDEV_DEV(netdev, dev); + dev_set_drvdata(dev, netdev); + pdata = netdev_priv(netdev); + pdata->dev = dev; + pdata->pdev = to_pci_dev(dev); + pdata->netdev = netdev; + + pdata->dev_irq = res->irq; + pdata->msg_enable = NETIF_MSG_DRV; + pdata->expansion.dev_state = FXGMAC_DEV_PROBE; + /* default to legacy interrupt */ + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_INTERRUPT_POS, + FXGMAC_FLAG_INTERRUPT_LEN, + FXGMAC_FLAG_LEGACY_ENABLED); + pdata->expansion.misc_irq = pdata->dev_irq; + + fxgmac_init_interrupt_scheme(pdata); + + pdata->mac_regs = res->addr; + pdata->base_mem = res->addr; + pdata->mac_regs = pdata->mac_regs + FXGMAC_MAC_REGS_OFFSET; + + ret = fxgmac_init(pdata, true); + if (ret) { + dev_err(dev, "fxgmac init failed\n"); + goto err_free_netdev; + } + + pdata->hw_ops.read_led_config(pdata); + + netif_carrier_off(netdev); + ret = register_netdev(netdev); + if (ret) { + dev_err(dev, "net device registration failed\n"); + goto err_free_netdev; + } + if(netif_msg_drv(pdata)) + DPRINTK("fxgamc_drv_prob callout, netdev num_tx_q=%u\n", + netdev->real_num_tx_queues); + + return 0; + +err_free_netdev: + free_netdev(netdev); + DPRINTK("fxgamc_drv_prob callout with err \n"); + + return ret; +} + +int fxgmac_drv_remove(struct device *dev) +{ + struct net_device *netdev = dev_get_drvdata(dev); + struct fxgmac_pdata * pdata = netdev_priv(netdev); + struct fxgmac_hw_ops* hw_ops = &pdata->hw_ops; + + hw_ops->led_under_shutdown(pdata); + + unregister_netdev(netdev); + free_netdev(netdev); + + return 0; +} + +void fxgmac_dump_tx_desc(struct fxgmac_pdata *pdata, + struct fxgmac_ring *ring, + unsigned int idx, + unsigned int count, + unsigned int flag) +{ + struct fxgmac_desc_data *desc_data; + struct fxgmac_dma_desc *dma_desc; + + while (count--) { + desc_data = FXGMAC_GET_DESC_DATA(ring, idx); + dma_desc = desc_data->dma_desc; + + netdev_dbg(pdata->netdev, "TX: dma_desc=%p, dma_desc_addr=%pad\n", + desc_data->dma_desc, &desc_data->dma_desc_addr); + netdev_dbg(pdata->netdev, + "TX_NORMAL_DESC[%d %s] = %08x:%08x:%08x:%08x\n", idx, + (flag == 1) ? "QUEUED FOR TX" : "TX BY DEVICE", + le32_to_cpu(dma_desc->desc0), + le32_to_cpu(dma_desc->desc1), + le32_to_cpu(dma_desc->desc2), + le32_to_cpu(dma_desc->desc3)); + + idx++; + } +} + +void fxgmac_dump_rx_desc(struct fxgmac_pdata *pdata, + struct fxgmac_ring *ring, + unsigned int idx) +{ + struct fxgmac_desc_data *desc_data; + struct fxgmac_dma_desc *dma_desc; + + desc_data = FXGMAC_GET_DESC_DATA(ring, idx); + dma_desc = desc_data->dma_desc; + + netdev_dbg(pdata->netdev, "RX: dma_desc=%p, dma_desc_addr=%pad\n", + desc_data->dma_desc, &desc_data->dma_desc_addr); + netdev_dbg(pdata->netdev, + "RX_NORMAL_DESC[%d RX BY DEVICE] = %08x:%08x:%08x:%08x\n", + idx, + le32_to_cpu(dma_desc->desc0), + le32_to_cpu(dma_desc->desc1), + le32_to_cpu(dma_desc->desc2), + le32_to_cpu(dma_desc->desc3)); +} + +void fxgmac_dbg_pkt(struct net_device *netdev, + struct sk_buff *skb, bool tx_rx) +{ + struct ethhdr *eth = (struct ethhdr *)skb->data; + unsigned char buffer[128]; + unsigned int i; + + netdev_dbg(netdev, "\n************** SKB dump ****************\n"); + + netdev_dbg(netdev, "%s packet of %d bytes\n", + (tx_rx ? "TX" : "RX"), skb->len); + + netdev_dbg(netdev, "Dst MAC addr: %pM\n", eth->h_dest); + netdev_dbg(netdev, "Src MAC addr: %pM\n", eth->h_source); + netdev_dbg(netdev, "Protocol: %#06hx\n", ntohs(eth->h_proto)); + + for (i = 0; i < skb->len; i += 32) { + unsigned int len = min(skb->len - i, 32U); + + hex_dump_to_buffer(&skb->data[i], len, 32, 1, + buffer, sizeof(buffer), false); + netdev_dbg(netdev, " %#06x: %s\n", i, buffer); + } + + netdev_dbg(netdev, "\n************** SKB dump ****************\n"); +} + +void fxgmac_print_pkt(struct net_device *netdev, + struct sk_buff *skb, bool tx_rx) +{ +#ifdef FXGMAC_DEBUG + struct ethhdr *eth = (struct ethhdr *)skb->data; +#endif + unsigned char buffer[128]; + unsigned int i; + + DPRINTK("\n************** SKB dump ****************\n"); + DPRINTK("%s packet of %d bytes\n", + (tx_rx ? "TX" : "RX"), skb->len); + +#ifdef FXGMAC_DEBUG + DPRINTK("Dst MAC addr: %pM\n", eth->h_dest); + DPRINTK("Src MAC addr: %pM\n", eth->h_source); + DPRINTK("Protocol: %#06hx\n", ntohs(eth->h_proto)); +#endif + for (i = 0; i < skb->len; i += 32) { + unsigned int len = min(skb->len - i, 32U); + + hex_dump_to_buffer(&skb->data[i], len, 32, 1, + buffer, sizeof(buffer), false); + DPRINTK(" %#06x: %s\n", i, buffer); + } + + DPRINTK("\n************** SKB dump ****************\n"); +} + +void fxgmac_get_all_hw_features(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_features *hw_feat = &pdata->hw_feat; + unsigned int mac_hfr0, mac_hfr1, mac_hfr2, mac_hfr3; + + mac_hfr0 = readl(pdata->mac_regs + MAC_HWF0R); + mac_hfr1 = readl(pdata->mac_regs + MAC_HWF1R); + mac_hfr2 = readl(pdata->mac_regs + MAC_HWF2R); + mac_hfr3 = readl(pdata->mac_regs + MAC_HWF3R); + + memset(hw_feat, 0, sizeof(*hw_feat)); + + hw_feat->version = readl(pdata->mac_regs + MAC_VR); + if(netif_msg_drv(pdata)) + DPRINTK ("Mac ver=%#x\n", hw_feat->version); + + /* Hardware feature register 0 */ + hw_feat->phyifsel = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_ACTPHYIFSEL_POS, + MAC_HWF0R_ACTPHYIFSEL_LEN); + hw_feat->vlhash = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_VLHASH_POS, + MAC_HWF0R_VLHASH_LEN); + hw_feat->sma = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_SMASEL_POS, + MAC_HWF0R_SMASEL_LEN); + hw_feat->rwk = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_RWKSEL_POS, + MAC_HWF0R_RWKSEL_LEN); + hw_feat->mgk = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_MGKSEL_POS, + MAC_HWF0R_MGKSEL_LEN); + hw_feat->mmc = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_MMCSEL_POS, + MAC_HWF0R_MMCSEL_LEN); + hw_feat->aoe = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_ARPOFFSEL_POS, + MAC_HWF0R_ARPOFFSEL_LEN); + hw_feat->ts = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_TSSEL_POS, + MAC_HWF0R_TSSEL_LEN); + hw_feat->eee = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_EEESEL_POS, + MAC_HWF0R_EEESEL_LEN); + hw_feat->tx_coe = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_TXCOESEL_POS, + MAC_HWF0R_TXCOESEL_LEN); + hw_feat->rx_coe = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_RXCOESEL_POS, + MAC_HWF0R_RXCOESEL_LEN); + hw_feat->addn_mac = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_ADDMACADRSEL_POS, + MAC_HWF0R_ADDMACADRSEL_LEN); + hw_feat->ts_src = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_TSSTSSEL_POS, + MAC_HWF0R_TSSTSSEL_LEN); + hw_feat->sa_vlan_ins = FXGMAC_GET_REG_BITS(mac_hfr0, + MAC_HWF0R_SAVLANINS_POS, + MAC_HWF0R_SAVLANINS_LEN); + + /* Hardware feature register 1 */ + hw_feat->rx_fifo_size = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_RXFIFOSIZE_POS, + MAC_HWF1R_RXFIFOSIZE_LEN); + hw_feat->tx_fifo_size = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_TXFIFOSIZE_POS, + MAC_HWF1R_TXFIFOSIZE_LEN); + hw_feat->adv_ts_hi = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_ADVTHWORD_POS, + MAC_HWF1R_ADVTHWORD_LEN); + hw_feat->dma_width = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_ADDR64_POS, + MAC_HWF1R_ADDR64_LEN); + hw_feat->dcb = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_DCBEN_POS, + MAC_HWF1R_DCBEN_LEN); + hw_feat->sph = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_SPHEN_POS, + MAC_HWF1R_SPHEN_LEN); +#if (0 /*LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)*/) + hw_feat->tso = 0; //bypass tso +#else + hw_feat->tso = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_TSOEN_POS, + MAC_HWF1R_TSOEN_LEN); +#endif + hw_feat->dma_debug = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_DBGMEMA_POS, + MAC_HWF1R_DBGMEMA_LEN); +#if (FXGMAC_RSS_FEATURE_ENABLED) + hw_feat->rss = 1; +#else + hw_feat->rss = 0; /* = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_RSSEN_POS, + MAC_HWF1R_RSSEN_LEN);*/ +#endif + hw_feat->tc_cnt = 3/*1, yzhang try,0412*/; /* FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_NUMTC_POS, + MAC_HWF1R_NUMTC_LEN); */ + hw_feat->avsel = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_AVSEL_POS, + MAC_HWF1R_AVSEL_LEN); + hw_feat->ravsel = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_RAVSEL_POS, + MAC_HWF1R_RAVSEL_LEN); + hw_feat->hash_table_size = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_HASHTBLSZ_POS, + MAC_HWF1R_HASHTBLSZ_LEN); + hw_feat->l3l4_filter_num = FXGMAC_GET_REG_BITS(mac_hfr1, + MAC_HWF1R_L3L4FNUM_POS, + MAC_HWF1R_L3L4FNUM_LEN); + + /* Hardware feature register 2 */ +#if 1 /* hw implement only 1 Q, but from software we see 4 logical Qs. hardcode to 4 Qs. */ + hw_feat->rx_q_cnt = 3/*FXGMAC_GET_REG_BITS(mac_hfr2, + MAC_HWF2R_RXQCNT_POS, + MAC_HWF2R_RXQCNT_LEN)*/; +#else + hw_feat->rx_q_cnt = FXGMAC_GET_REG_BITS(mac_hfr2, + MAC_HWF2R_RXQCNT_POS, + MAC_HWF2R_RXQCNT_LEN); +#endif + hw_feat->tx_q_cnt = FXGMAC_GET_REG_BITS(mac_hfr2, + MAC_HWF2R_TXQCNT_POS, + MAC_HWF2R_TXQCNT_LEN); +#if 0 /*yzhang for debug. only 1 rx channl and q*/ + hw_feat->rx_ch_cnt = 0 /*FXGMAC_GET_REG_BITS(mac_hfr2, + MAC_HWF2R_RXCHCNT_POS, + MAC_HWF2R_RXCHCNT_LEN)*/; +#else + hw_feat->rx_ch_cnt = FXGMAC_GET_REG_BITS(mac_hfr2, + MAC_HWF2R_RXCHCNT_POS, + MAC_HWF2R_RXCHCNT_LEN); +#endif + hw_feat->tx_ch_cnt = FXGMAC_GET_REG_BITS(mac_hfr2, + MAC_HWF2R_TXCHCNT_POS, + MAC_HWF2R_TXCHCNT_LEN); + hw_feat->pps_out_num = FXGMAC_GET_REG_BITS(mac_hfr2, + MAC_HWF2R_PPSOUTNUM_POS, + MAC_HWF2R_PPSOUTNUM_LEN); + hw_feat->aux_snap_num = FXGMAC_GET_REG_BITS(mac_hfr2, + MAC_HWF2R_AUXSNAPNUM_POS, + MAC_HWF2R_AUXSNAPNUM_LEN); + + /* Translate the Hash Table size into actual number */ + switch (hw_feat->hash_table_size) { + case 0: + break; + case 1: + hw_feat->hash_table_size = 64; + break; + case 2: + hw_feat->hash_table_size = 128; + break; + case 3: + hw_feat->hash_table_size = 256; + break; + } + + /* Translate the address width setting into actual number */ + switch (hw_feat->dma_width) { + case 0: + hw_feat->dma_width = 32; + break; + case 1: + hw_feat->dma_width = 40; + break; + case 2: + hw_feat->dma_width = 48; + break; + default: + hw_feat->dma_width = 32; + } + + /* The Queue, Channel and TC counts are zero based so increment them + * to get the actual number + */ + hw_feat->rx_q_cnt++; + hw_feat->tx_q_cnt++; + hw_feat->rx_ch_cnt++; + hw_feat->tx_ch_cnt++; + hw_feat->tc_cnt++; + + hw_feat->hwfr3 = mac_hfr3; + /* DPRINTK("HWFR3: %u\n", mac_hfr3); */ +} + +void fxgmac_print_all_hw_features(struct fxgmac_pdata *pdata) +{ + char *str = NULL; + + DPRINTK("\n"); + DPRINTK("=====================================================\n"); + DPRINTK("\n"); + DPRINTK("HW support following features,ver=%#x\n",pdata->hw_feat.version); + DPRINTK("\n"); + /* HW Feature Register0 */ + DPRINTK("VLAN Hash Filter Selected : %s\n", + pdata->hw_feat.vlhash ? "YES" : "NO"); + DPRINTK("SMA (MDIO) Interface : %s\n", + pdata->hw_feat.sma ? "YES" : "NO"); + DPRINTK("PMT Remote Wake-up Packet Enable : %s\n", + pdata->hw_feat.rwk ? "YES" : "NO"); + DPRINTK("PMT Magic Packet Enable : %s\n", + pdata->hw_feat.mgk ? "YES" : "NO"); + DPRINTK("RMON/MMC Module Enable : %s\n", + pdata->hw_feat.mmc ? "YES" : "NO"); + DPRINTK("ARP Offload Enabled : %s\n", + pdata->hw_feat.aoe ? "YES" : "NO"); + DPRINTK("IEEE 1588-2008 Timestamp Enabled : %s\n", + pdata->hw_feat.ts ? "YES" : "NO"); + DPRINTK("Energy Efficient Ethernet Enabled : %s\n", + pdata->hw_feat.eee ? "YES" : "NO"); + DPRINTK("Transmit Checksum Offload Enabled : %s\n", + pdata->hw_feat.tx_coe ? "YES" : "NO"); + DPRINTK("Receive Checksum Offload Enabled : %s\n", + pdata->hw_feat.rx_coe ? "YES" : "NO"); + DPRINTK("Additional MAC Addresses 1-31 Selected : %s\n", + pdata->hw_feat.addn_mac ? "YES" : "NO"); + + switch (pdata->hw_feat.ts_src) { + case 0: + str = "RESERVED"; + break; + case 1: + str = "INTERNAL"; + break; + case 2: + str = "EXTERNAL"; + break; + case 3: + str = "BOTH"; + break; + } + DPRINTK("Timestamp System Time Source : %s\n", str); + + DPRINTK("Source Address or VLAN Insertion Enable : %s\n", + pdata->hw_feat.sa_vlan_ins ? "YES" : "NO"); + + /* HW Feature Register1 */ + switch (pdata->hw_feat.rx_fifo_size) { + case 0: + str = "128 bytes"; + break; + case 1: + str = "256 bytes"; + break; + case 2: + str = "512 bytes"; + break; + case 3: + str = "1 KBytes"; + break; + case 4: + str = "2 KBytes"; + break; + case 5: + str = "4 KBytes"; + break; + case 6: + str = "8 KBytes"; + break; + case 7: + str = "16 KBytes"; + break; + case 8: + str = "32 kBytes"; + break; + case 9: + str = "64 KBytes"; + break; + case 10: + str = "128 KBytes"; + break; + case 11: + str = "256 KBytes"; + break; + default: + str = "RESERVED"; + } + DPRINTK("MTL Receive FIFO Size : %s\n", str); + + switch (pdata->hw_feat.tx_fifo_size) { + case 0: + str = "128 bytes"; + break; + case 1: + str = "256 bytes"; + break; + case 2: + str = "512 bytes"; + break; + case 3: + str = "1 KBytes"; + break; + case 4: + str = "2 KBytes"; + break; + case 5: + str = "4 KBytes"; + break; + case 6: + str = "8 KBytes"; + break; + case 7: + str = "16 KBytes"; + break; + case 8: + str = "32 kBytes"; + break; + case 9: + str = "64 KBytes"; + break; + case 10: + str = "128 KBytes"; + break; + case 11: + str = "256 KBytes"; + break; + default: + str = "RESERVED"; + } + DPRINTK("MTL Transmit FIFO Size : %s\n", str); + + DPRINTK("IEEE 1588 High Word Register Enable : %s\n", + pdata->hw_feat.adv_ts_hi ? "YES" : "NO"); + DPRINTK("Address width : %u\n", + pdata->hw_feat.dma_width); + DPRINTK("DCB Feature Enable : %s\n", + pdata->hw_feat.dcb ? "YES" : "NO"); + DPRINTK("Split Header Feature Enable : %s\n", + pdata->hw_feat.sph ? "YES" : "NO"); + DPRINTK("TCP Segmentation Offload Enable : %s\n", + pdata->hw_feat.tso ? "YES" : "NO"); + DPRINTK("DMA Debug Registers Enabled : %s\n", + pdata->hw_feat.dma_debug ? "YES" : "NO"); + DPRINTK("RSS Feature Enabled : %s\n", + pdata->hw_feat.rss ? "YES" : "NO"); + DPRINTK("*TODO*Number of Traffic classes : %u\n", + (pdata->hw_feat.tc_cnt)); + DPRINTK("AV Feature Enabled : %s\n", + pdata->hw_feat.avsel ? "YES" : "NO"); + DPRINTK("Rx Side Only AV Feature Enabled : %s\n", + (pdata->hw_feat.ravsel ? "YES": "NO")); + DPRINTK("Hash Table Size : %u\n", + pdata->hw_feat.hash_table_size); + DPRINTK("Total number of L3 or L4 Filters : %u\n", + pdata->hw_feat.l3l4_filter_num); + + /* HW Feature Register2 */ + DPRINTK("Number of MTL Receive Queues : %u\n", + pdata->hw_feat.rx_q_cnt); + DPRINTK("Number of MTL Transmit Queues : %u\n", + pdata->hw_feat.tx_q_cnt); + DPRINTK("Number of DMA Receive Channels : %u\n", + pdata->hw_feat.rx_ch_cnt); + DPRINTK("Number of DMA Transmit Channels : %u\n", + pdata->hw_feat.tx_ch_cnt); + + switch (pdata->hw_feat.pps_out_num) { + case 0: + str = "No PPS output"; + break; + case 1: + str = "1 PPS output"; + break; + case 2: + str = "2 PPS output"; + break; + case 3: + str = "3 PPS output"; + break; + case 4: + str = "4 PPS output"; + break; + default: + str = "RESERVED"; + } + DPRINTK("Number of PPS Outputs : %s\n", str); + + switch (pdata->hw_feat.aux_snap_num) { + case 0: + str = "No auxiliary input"; + break; + case 1: + str = "1 auxiliary input"; + break; + case 2: + str = "2 auxiliary input"; + break; + case 3: + str = "3 auxiliary input"; + break; + case 4: + str = "4 auxiliary input"; + break; + default: + str = "RESERVED"; + } + DPRINTK("Number of Auxiliary Snapshot Inputs : %s", str); + + DPRINTK("\n"); + DPRINTK("=====================================================\n"); + DPRINTK("\n"); +} diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-desc.c b/lede/package/kernel/yt6801/src/fuxi-gmac-desc.c new file mode 100644 index 0000000000..97e04b2d2d --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-desc.c @@ -0,0 +1,1475 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" + +#ifdef FXGMAC_USE_ADAPTER_HANDLE +#include "fuxi-mp.h" +#endif + +static void fxgmac_unmap_desc_data(struct fxgmac_pdata* pdata, + struct fxgmac_desc_data* desc_data) +{ +#ifndef LINUX + (void)pdata; + (void)desc_data; +#else + if (desc_data->skb_dma) { + if (desc_data->mapped_as_page) { + dma_unmap_page(pdata->dev, desc_data->skb_dma, + desc_data->skb_dma_len, DMA_TO_DEVICE); + } + else { + dma_unmap_single(pdata->dev, desc_data->skb_dma, + desc_data->skb_dma_len, DMA_TO_DEVICE); + } + desc_data->skb_dma = 0; + desc_data->skb_dma_len = 0; + } +#ifdef FXGMAC_NOT_USE_PAGE_MAPPING + if (desc_data->rx.buf.dma_base) { + dma_unmap_single(pdata->dev, desc_data->rx.buf.dma_base, + pdata->rx_buf_size, DMA_FROM_DEVICE); + desc_data->rx.buf.dma_base = 0; + } +#else + if (desc_data->rx.hdr.pa.pages) + put_page(desc_data->rx.hdr.pa.pages); + + if (desc_data->rx.hdr.pa_unmap.pages) { + dma_unmap_page(pdata->dev, desc_data->rx.hdr.pa_unmap.pages_dma, + desc_data->rx.hdr.pa_unmap.pages_len, + DMA_FROM_DEVICE); + put_page(desc_data->rx.hdr.pa_unmap.pages); + } + + if (desc_data->rx.buf.pa.pages) + put_page(desc_data->rx.buf.pa.pages); + + if (desc_data->rx.buf.pa_unmap.pages) { + dma_unmap_page(pdata->dev, desc_data->rx.buf.pa_unmap.pages_dma, + desc_data->rx.buf.pa_unmap.pages_len, + DMA_FROM_DEVICE); + put_page(desc_data->rx.buf.pa_unmap.pages); + } +#endif + + if (desc_data->skb) { + dev_kfree_skb_any(desc_data->skb); + desc_data->skb = NULL; + } + + memset(&desc_data->tx, 0, sizeof(desc_data->tx)); + memset(&desc_data->rx, 0, sizeof(desc_data->rx)); + + desc_data->mapped_as_page = 0; +#endif +} + +static void fxgmac_free_ring(struct fxgmac_pdata* pdata, + struct fxgmac_ring* ring) +{ +#ifndef LINUX + (void)pdata; + + if (!ring) + return; +#else + struct fxgmac_desc_data* desc_data; + unsigned int i; + + if (!ring) + return; + + if (ring->desc_data_head) { + for (i = 0; i < ring->dma_desc_count; i++) { + desc_data = FXGMAC_GET_DESC_DATA(ring, i); + fxgmac_unmap_desc_data(pdata, desc_data); + } + + kfree(ring->desc_data_head); + ring->desc_data_head = NULL; + } + +#ifndef FXGMAC_NOT_USE_PAGE_MAPPING + if (ring->rx_hdr_pa.pages) { + dma_unmap_page(pdata->dev, ring->rx_hdr_pa.pages_dma, + ring->rx_hdr_pa.pages_len, DMA_FROM_DEVICE); + put_page(ring->rx_hdr_pa.pages); + + ring->rx_hdr_pa.pages = NULL; + ring->rx_hdr_pa.pages_len = 0; + ring->rx_hdr_pa.pages_offset = 0; + ring->rx_hdr_pa.pages_dma = 0; + } + + if (ring->rx_buf_pa.pages) { + dma_unmap_page(pdata->dev, ring->rx_buf_pa.pages_dma, + ring->rx_buf_pa.pages_len, DMA_FROM_DEVICE); + put_page(ring->rx_buf_pa.pages); + + ring->rx_buf_pa.pages = NULL; + ring->rx_buf_pa.pages_len = 0; + ring->rx_buf_pa.pages_offset = 0; + ring->rx_buf_pa.pages_dma = 0; + } +#endif + + if (ring->dma_desc_head) { + dma_free_coherent(pdata->dev, + (sizeof(struct fxgmac_dma_desc) * + ring->dma_desc_count), + ring->dma_desc_head, + ring->dma_desc_head_addr); + ring->dma_desc_head = NULL; + } +#endif +} + +static int fxgmac_init_ring(struct fxgmac_pdata* pdata, + struct fxgmac_ring* ring, + unsigned int dma_desc_count) +{ + if (!ring) + return 0; + +#ifndef LINUX + (void)pdata; + (void)dma_desc_count; + ring->dma_desc_count = 0; + + return 0; +#else + /* Descriptors */ + ring->dma_desc_count = dma_desc_count; + ring->dma_desc_head = dma_alloc_coherent(pdata->dev, + (sizeof(struct fxgmac_dma_desc) * + dma_desc_count), + &ring->dma_desc_head_addr, + GFP_KERNEL); + if (!ring->dma_desc_head) + return -ENOMEM; + + /* Array of descriptor data */ + ring->desc_data_head = kcalloc(dma_desc_count, + sizeof(struct fxgmac_desc_data), + GFP_KERNEL); + if (!ring->desc_data_head) + return -ENOMEM; + + netif_dbg(pdata, drv, pdata->netdev, + "dma_desc_head=%p, dma_desc_head_addr=%pad, desc_data_head=%p\n", + ring->dma_desc_head, + &ring->dma_desc_head_addr, + ring->desc_data_head); + + return 0; +#endif +} + +static void fxgmac_free_rings(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel* channel; + unsigned int i; + + if (!pdata->channel_head) + return; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + fxgmac_free_ring(pdata, channel->tx_ring); + fxgmac_free_ring(pdata, channel->rx_ring); + } +} + +static int fxgmac_alloc_rings(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel* channel; + unsigned int i; + int ret; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + netif_dbg(pdata, drv, pdata->netdev, "%s - Tx ring:\n", + channel->name); + + if (i < pdata->tx_ring_count) + { + ret = fxgmac_init_ring(pdata, channel->tx_ring, + pdata->tx_desc_count); + + if (ret) { + netdev_alert(pdata->netdev, "error initializing Tx ring"); + goto err_init_ring; + } + } + + netif_dbg(pdata, drv, pdata->netdev, "%s - Rx ring:\n", channel->name); + + ret = fxgmac_init_ring(pdata, channel->rx_ring, + pdata->rx_desc_count); + if (ret) { + netdev_alert(pdata->netdev, + "error initializing Rx ring\n"); + goto err_init_ring; + } + if(netif_msg_drv(pdata)) { + DPRINTK("fxgmac_alloc_ring..ch=%u,", i); + if (i < pdata->tx_ring_count) + DPRINTK(" tx_desc_cnt=%u,", pdata->tx_desc_count); + + DPRINTK(" rx_desc_cnt=%u.\n", pdata->rx_desc_count); + } + } + if(netif_msg_drv(pdata)) { + DPRINTK("alloc_rings callout ok ch=%u\n", i); + } + + return 0; + +err_init_ring: + fxgmac_free_rings(pdata); + + DPRINTK("alloc_rings callout err,%d\n",ret); + return ret; +} + +#ifdef LINUX +static void fxgmac_free_channels(struct fxgmac_pdata *pdata) +{ + if (!pdata->channel_head) + return; + if(netif_msg_drv(pdata)) DPRINTK("free_channels,tx_ring=%p", pdata->channel_head->tx_ring); + kfree(pdata->channel_head->tx_ring); + pdata->channel_head->tx_ring = NULL; + + if(netif_msg_drv(pdata)) DPRINTK(" ,rx_ring=%p", pdata->channel_head->rx_ring); + kfree(pdata->channel_head->rx_ring); + pdata->channel_head->rx_ring = NULL; + + if(netif_msg_drv(pdata)) DPRINTK(" ,channel=%p\n", pdata->channel_head); + kfree(pdata->channel_head); + + pdata->channel_head = NULL; + //comment out below line for that, channel_count is initialized only once in hw_init() + //pdata->channel_count = 0; +} +#else +static void fxgmac_free_channels(struct fxgmac_pdata* pdata) +{ + if (!pdata->channel_head) + return; + + //kfree(pdata->channel_head->tx_ring); + pdata->channel_head->tx_ring = NULL; + + //kfree(pdata->channel_head->rx_ring); + pdata->channel_head->rx_ring = NULL; + + //kfree(pdata->channel_head); + + pdata->channel_head = NULL; + pdata->channel_count = 0; +} +#endif + +#if defined(UEFI) +static int fxgmac_alloc_channels(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel* channel_head, * channel; + struct fxgmac_ring* tx_ring, * rx_ring; + int ret = -ENOMEM; + unsigned int i; + UINT64 vir_addr; + UINT64 cache_sz = CACHE_ALIGN_SZ; + PADAPTER adpt = (PADAPTER)pdata->pAdapter; + + DEBUGPRINT(INIT, "[%a,%a,%d]:MemoryChannelPtr=%llx\n",__FILE__, __func__,__LINE__,adpt->MemoryChannelPtr); + vir_addr = (adpt->MemoryChannelPtr + cache_sz) & (~(cache_sz - 1)); +#ifdef UEFI_64 + channel_head = (struct fxgmac_channel*)vir_addr; +#else + channel_head = (struct fxgmac_channel*)(UINT32)vir_addr; +#endif + + DEBUGPRINT(INIT, "[%a,%a,%d]:Channel_head=%llx,vir_addr=%llx\n",__FILE__, __func__,__LINE__,channel_head,vir_addr); + netif_dbg(pdata, drv, pdata->netdev, + "channel_head=%p\n", channel_head); + + vir_addr = (vir_addr + 4 * sizeof(struct fxgmac_channel) + cache_sz) & (~(cache_sz - 1)); +#ifdef UEFI_64 + tx_ring = (struct fxgmac_ring*)vir_addr; +#else + tx_ring = (struct fxgmac_ring*)(UINT32)vir_addr; +#endif + + + vir_addr = (vir_addr + 4 * sizeof(struct fxgmac_ring) + cache_sz) & (~(cache_sz - 1)); +#ifdef UEFI_64 + rx_ring = (struct fxgmac_ring*)vir_addr; +#else + rx_ring = (struct fxgmac_ring*)(UINT32)vir_addr; +#endif + + DEBUGPRINT(INIT, "[%a,%a,%d]:Channel_head=%llx,*channel_head=%llx,vir_addr=%llx,tx_ring=%llx,rx_ring=%llx,channelcount=%llx,pdata=%llx\n",__FILE__, __func__,__LINE__,channel_head,*channel_head,vir_addr,tx_ring,rx_ring,pdata->channel_count,&channel_head->pdata); + for (i = 0, channel = channel_head; i < pdata->channel_count; + i++, channel++) { + //snprintf(channel->name, sizeof(channel->name), "channel-%u", i); + //RtlStringCchPrintfA(channel->name, sizeof(channel->name), "channel-%u", i); + //netif_dbg(pdata, drv, pdata->netdev,"channel-%u\n", i); + + DEBUGPRINT(INIT, "[%a,%a,%d]:channel=%llx,&channel->pdata=%llx\n",__FILE__, __func__,__LINE__,channel,&channel->pdata); + channel->pdata = pdata; + channel->queue_index = i; + channel->dma_regs = pdata->mac_regs + DMA_CH_BASE + + (DMA_CH_INC * i); + + if (pdata->per_channel_irq) { + /* Get the per DMA interrupt */ + ret = pdata->channel_irq[i]; + if (ret < 0) { + netdev_err(pdata->netdev, + "get_irq %u failed\n", + i + 1); + goto err; + } + channel->dma_irq = ret; + } + + if (i < pdata->tx_ring_count) + channel->tx_ring = tx_ring++; + + if (i < pdata->rx_ring_count) + channel->rx_ring = rx_ring++; + netif_dbg(pdata, drv, pdata->netdev, + ""STR_FORMAT": dma_regs=%p, tx_ring=%p, rx_ring=%p\n", + channel->name, channel->dma_regs, + channel->tx_ring, channel->rx_ring); + + DEBUGPRINT(INIT, "[%a,%d]:Channel_dma_regs=%llx,channel txring=%llx,channel rx_ring=%llx,i=%llx,channel_count=%llx\n", __func__,__LINE__,channel->dma_regs,channel->tx_ring,channel->rx_ring,i,pdata->channel_count); + } + + pdata->channel_head = channel_head; + + return 0; + + err: + return ret; +} +#elif defined(LINUX) +static int fxgmac_alloc_channels(struct fxgmac_pdata *pdata) +{ + struct fxgmac_channel *channel_head, *channel; + struct fxgmac_ring *tx_ring, *rx_ring; + int ret = -ENOMEM; + unsigned int i; + +#ifdef CONFIG_PCI_MSI + u32 msix = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MSIX_POS, + FXGMAC_FLAG_MSIX_LEN); +#endif + + channel_head = kcalloc(pdata->channel_count, + sizeof(struct fxgmac_channel), GFP_KERNEL); + if(netif_msg_drv(pdata)) DPRINTK("alloc_channels,channel_head=%p,size=%d*%d\n", channel_head, pdata->channel_count,(u32)sizeof(struct fxgmac_channel)); + + if (!channel_head) + return ret; + + tx_ring = kcalloc(pdata->tx_ring_count, sizeof(struct fxgmac_ring), + GFP_KERNEL); + if (!tx_ring) + goto err_tx_ring; + + if(netif_msg_drv(pdata)) DPRINTK("alloc_channels,tx_ring=%p,size=%d*%d\n", tx_ring, pdata->tx_ring_count,(u32)sizeof(struct fxgmac_ring)); + rx_ring = kcalloc(pdata->rx_ring_count, sizeof(struct fxgmac_ring), + GFP_KERNEL); + if (!rx_ring) + goto err_rx_ring; + + if(netif_msg_drv(pdata)) DPRINTK("alloc_channels,rx_ring=%p,size=%d*%d\n", rx_ring, pdata->rx_ring_count,(u32)sizeof(struct fxgmac_ring)); + //DPRINTK("fxgmac_alloc_channels ch_num=%d,rxring=%d,txring=%d\n",pdata->channel_count, pdata->rx_ring_count,pdata->tx_ring_count); + + for (i = 0, channel = channel_head; i < pdata->channel_count; + i++, channel++) { + snprintf(channel->name, sizeof(channel->name), "channel-%u", i); + channel->pdata = pdata; + channel->queue_index = i; + channel->dma_regs = pdata->mac_regs + DMA_CH_BASE + + (DMA_CH_INC * i); + + if (pdata->per_channel_irq) { + /* Get the per DMA interrupt */ +#ifdef CONFIG_PCI_MSI + //20210526 for MSIx + if(msix) { + pdata->channel_irq[i] = pdata->expansion.msix_entries[i].vector; + if (FXGMAC_IS_CHANNEL_WITH_TX_IRQ(i)) { + pdata->channel_irq[FXGMAC_MAX_DMA_CHANNELS] = pdata->expansion.msix_entries[FXGMAC_MAX_DMA_CHANNELS].vector; +#if 0 + if (pdata->channel_irq[FXGMAC_MAX_DMA_CHANNELS] < 0) { + netdev_err(pdata->netdev, + "get_irq %u for tx failed\n", + i + 1); + goto err_irq; + } +#endif + channel->expansion.dma_irq_tx = pdata->channel_irq[FXGMAC_MAX_DMA_CHANNELS]; + DPRINTK("fxgmac_alloc_channels, for MSIx, channel %d dma_irq_tx=%u\n", i, channel->expansion.dma_irq_tx); + } + } +#endif + ret = pdata->channel_irq[i]; + if (ret < 0) { + netdev_err(pdata->netdev, + "get_irq %u failed\n", + i + 1); + goto err_irq; + } + channel->dma_irq = ret; + DPRINTK("fxgmac_alloc_channels, for MSIx, channel %d dma_irq=%u\n", i, channel->dma_irq); + } + + if (i < pdata->tx_ring_count) + channel->tx_ring = tx_ring++; + + if (i < pdata->rx_ring_count) + channel->rx_ring = rx_ring++; + } + + pdata->channel_head = channel_head; + + if(netif_msg_drv(pdata)) DPRINTK("alloc_channels callout ok\n"); + return 0; + +err_irq: + kfree(rx_ring); + +err_rx_ring: + kfree(tx_ring); + +err_tx_ring: + kfree(channel_head); + + DPRINTK("fxgmac alloc_channels callout err,%d\n",ret); + return ret; +} +#elif defined(UBOOT) || defined(KDNET) || defined(PXE) +static int fxgmac_alloc_channels(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel* channel; + unsigned int i; + + for (i = 0; i < pdata->channel_count; i++) + { + //snprintf(channel->name, sizeof(channel->name), "channel-%u", i); + //RtlStringCchPrintfA(channel->name, sizeof(channel->name), "channel-%u" , i); + //netif_dbg(pdata, drv, pdata->netdev,"channel-%u\n", i); + channel = pdata->channel_head; + + channel->pdata = pdata; + channel->queue_index = i; + channel->dma_regs = pdata->mac_regs + DMA_CH_BASE + + (DMA_CH_INC * i); + + /* set tx/rx channel*/ +#if 1 + pdata->expansion.tx_channel = pdata->channel_head; + + pdata->expansion.rx_channel = pdata->channel_head; +#else + if (i == 0) + pdata->tx_channel = &pdata->channel_head[i]; + else + pdata->rx_channel = &pdata->channel_head[i]; +#endif + } + return 0; +} +#elif defined(_WIN32) || defined(_WIN64) +static int fxgmac_alloc_channels(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel* channel_head, * channel; + struct fxgmac_ring* tx_ring, * rx_ring; + PMP_ADAPTER pAdapter = (PMP_ADAPTER)pdata->pAdapter; + int ret = -ENOMEM; + unsigned int i; + + //channel_head = kcalloc(pdata->channel_count, + // sizeof(struct fxgmac_channel), GFP_KERNEL); + //if (!channel_head) + // return ret; + + channel_head = &pAdapter->MpChannelRingResources.fx_channel[0]; + + netif_dbg(pdata, drv, pdata->netdev, + "channel_head=%p\n", channel_head); + + //tx_ring = kcalloc(pdata->tx_ring_count, sizeof(struct fxgmac_ring), + // GFP_KERNEL); + //if (!tx_ring) + // goto err_tx_ring; + tx_ring = &pAdapter->MpChannelRingResources.fx_tx_ring[0]; + + //rx_ring = kcalloc(pdata->rx_ring_count, sizeof(struct fxgmac_ring), + // GFP_KERNEL); + //if (!rx_ring) + // goto err_rx_ring; + rx_ring = &pAdapter->MpChannelRingResources.fx_rx_ring[0]; + + for (i = 0, channel = channel_head; i < pdata->channel_count; + i++, channel++) { + //snprintf(channel->name, sizeof(channel->name), "channel-%u", i); + RtlStringCchPrintfA(channel->name, sizeof(channel->name), "channel-%u", i); + + channel->pdata = pdata; + channel->queue_index = i; + channel->dma_regs = pdata->mac_regs + DMA_CH_BASE + + (DMA_CH_INC * i); + + if (pdata->per_channel_irq) { + /* Get the per DMA interrupt */ + ret = pdata->channel_irq[i]; + if (ret < 0) { + netdev_err(pdata->netdev, + "get_irq %u failed\n", + i + 1); + goto err_irq; + } + channel->dma_irq = ret; + } + + if (i < pdata->tx_ring_count) + channel->tx_ring = tx_ring++; + + if (i < pdata->rx_ring_count) + channel->rx_ring = rx_ring++; + + netif_dbg(pdata, drv, pdata->netdev, + "%s: dma_regs=%p, tx_ring=%p, rx_ring=%p\n", + channel->name, channel->dma_regs, + channel->tx_ring, channel->rx_ring); + } + + pdata->channel_head = channel_head; + + return 0; + +err_irq: + //kfree(rx_ring); + +//err_rx_ring: + //kfree(tx_ring); + +//err_tx_ring: + //kfree(channel_head); + + return ret; + +} +#else +static struct fxgmac_channel fx_channel[4]; +static struct fxgmac_ring fx_tx_ring[4]; +static struct fxgmac_ring fx_rx_ring[4]; + +static int fxgmac_alloc_channels(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel* channel_head, * channel; + struct fxgmac_ring* tx_ring, * rx_ring; + int ret = -ENOMEM; + unsigned int i; + + //channel_head = kcalloc(pdata->channel_count, + // sizeof(struct fxgmac_channel), GFP_KERNEL); + //if (!channel_head) + // return ret; + channel_head = &fx_channel[0]; + + netif_dbg(pdata, drv, pdata->netdev, + "channel_head=%p\n", channel_head); + + //tx_ring = kcalloc(pdata->tx_ring_count, sizeof(struct fxgmac_ring), + // GFP_KERNEL); + //if (!tx_ring) + // goto err_tx_ring; + tx_ring = &fx_tx_ring[0]; + + //rx_ring = kcalloc(pdata->rx_ring_count, sizeof(struct fxgmac_ring), + // GFP_KERNEL); + //if (!rx_ring) + // goto err_rx_ring; + rx_ring = &fx_rx_ring[0]; + + for (i = 0, channel = channel_head; i < pdata->channel_count; + i++, channel++) { + //snprintf(channel->name, sizeof(channel->name), "channel-%u", i); + //RtlStringCchPrintfA(channel->name, sizeof(channel->name), "channel-%u", i); + + channel->pdata = pdata; + channel->queue_index = i; + channel->dma_regs = pdata->mac_regs + DMA_CH_BASE + + (DMA_CH_INC * i); + + if (pdata->per_channel_irq) { + /* Get the per DMA interrupt */ + ret = pdata->channel_irq[i]; + if (ret < 0) { + netdev_err(pdata->netdev, + "get_irq %u failed\n", + i + 1); + goto err_irq; + } + channel->dma_irq = ret; + } + + if (i < pdata->tx_ring_count) + channel->tx_ring = tx_ring++; + + if (i < pdata->rx_ring_count) + channel->rx_ring = rx_ring++; + + netif_dbg(pdata, drv, pdata->netdev, + "%s: dma_regs=%p, tx_ring=%p, rx_ring=%p\n", + channel->name, channel->dma_regs, + channel->tx_ring, channel->rx_ring); + } + + pdata->channel_head = channel_head; + + return 0; + +err_irq: + //kfree(rx_ring); + + //err_rx_ring: + //kfree(tx_ring); + + //err_tx_ring: + //kfree(channel_head); + + return ret; +} +#endif + +static void fxgmac_free_channels_and_rings(struct fxgmac_pdata* pdata) +{ + fxgmac_free_rings(pdata); + + fxgmac_free_channels(pdata); +} + +static int fxgmac_alloc_channels_and_rings(struct fxgmac_pdata* pdata) +{ + int ret; + + ret = fxgmac_alloc_channels(pdata); + if (ret) + goto err_alloc; + + ret = fxgmac_alloc_rings(pdata); + if (ret) + goto err_alloc; + + return 0; + +err_alloc: + fxgmac_free_channels_and_rings(pdata); + + return ret; +} + +#if !(defined(UEFI) || defined(UBOOT) || defined(PXE) || defined(FXGMAC_NOT_USE_PAGE_MAPPING)) +static void fxgmac_set_buffer_data(struct fxgmac_buffer_data* bd, + struct fxgmac_page_alloc* pa, + unsigned int len) +{ +#ifndef LINUX + bd = bd; + pa = pa; + len = len; +#else + get_page(pa->pages); + bd->pa = *pa; + + bd->dma_base = pa->pages_dma; + bd->dma_off = pa->pages_offset; + bd->dma_len = len; + + pa->pages_offset += len; + if ((pa->pages_offset + len) > pa->pages_len) { + /* This data descriptor is responsible for unmapping page(s) */ + bd->pa_unmap = *pa; + + /* Get a new allocation next time */ + pa->pages = NULL; + pa->pages_len = 0; + pa->pages_offset = 0; + pa->pages_dma = 0; + } +#endif +} +#endif + +#if (defined(LINUX) && !defined(FXGMAC_NOT_USE_PAGE_MAPPING)) +static int fxgmac_alloc_pages(struct fxgmac_pdata *pdata, + struct fxgmac_page_alloc *pa, + gfp_t gfp, int order) +{ + struct page *pages = NULL; + dma_addr_t pages_dma; + + /* Try to obtain pages, decreasing order if necessary */ + gfp |= __GFP_COMP | __GFP_NOWARN; + while (order >= 0) { + pages = alloc_pages(gfp, order); + if (pages) + break; + + order--; + } + if (!pages) + return -ENOMEM; + + /* Map the pages */ + pages_dma = dma_map_page(pdata->dev, pages, 0, + PAGE_SIZE << order, DMA_FROM_DEVICE); + if (dma_mapping_error(pdata->dev, pages_dma)) { + put_page(pages); + return -ENOMEM; + } + + pa->pages = pages; + pa->pages_len = PAGE_SIZE << order; + pa->pages_offset = 0; + pa->pages_dma = pages_dma; + + return 0; +} +#endif + +static int fxgmac_map_rx_buffer(struct fxgmac_pdata* pdata, + struct fxgmac_ring* ring, + struct fxgmac_desc_data* desc_data) +{ +#ifndef LINUX + (void)pdata; + (void)ring; + (void)desc_data; +#else + +#ifdef FXGMAC_NOT_USE_PAGE_MAPPING + struct sk_buff *skb; + skb = __netdev_alloc_skb_ip_align(pdata->netdev, pdata->rx_buf_size, GFP_ATOMIC); + if (!skb) { + netdev_err(pdata->netdev, + "%s: Rx init fails; skb is NULL\n", __func__); + return -ENOMEM; + } + + desc_data->skb = skb; + desc_data->rx.buf.dma_base = dma_map_single(pdata->dev, skb->data, pdata->rx_buf_size, DMA_FROM_DEVICE); + if (dma_mapping_error(pdata->dev, desc_data->rx.buf.dma_base)) { + netdev_err(pdata->netdev, "%s: DMA mapping error\n", __func__); + dev_kfree_skb_any(skb); + return -EINVAL; + } +#else + int ret; + int order; + + if (!ring->rx_hdr_pa.pages) { + if (pdata->jumbo) + order = max_t(int, PAGE_ALLOC_COSTLY_ORDER - 1, 0); + else + order = 0; + ret = fxgmac_alloc_pages(pdata, &ring->rx_hdr_pa, + GFP_ATOMIC, order); + if (ret) + return ret; + } + +#if 0 + if (!ring->rx_buf_pa.pages) { + order = max_t(int, PAGE_ALLOC_COSTLY_ORDER - 1, 0); + ret = fxgmac_alloc_pages(pdata, &ring->rx_buf_pa, + GFP_ATOMIC, order); + if (ret) + return ret; + } +#endif + + /* Set up the header page info */ + fxgmac_set_buffer_data(&desc_data->rx.hdr, &ring->rx_hdr_pa, + pdata->rx_buf_size); + +#if 0 + /* Set up the buffer page info */ + fxgmac_set_buffer_data(&desc_data->rx.buf, &ring->rx_buf_pa, + pdata->rx_buf_size); +#endif +#endif +#endif + return 0; +} + +#ifdef UBOOT +static void fxgmac_desc_reset(struct fxgmac_dma_desc *desc_data) +{ + /* Reset the Tx descriptor + * Set buffer 1 (lo) address to zero + * Set buffer 1 (hi) address to zero + * Reset all other control bits (IC, TTSE, B2L & B1L) + * Reset all other control bits (OWN, CTXT, FD, LD, CPC, CIC, etc) + */ + desc_data->desc0 = 0; + desc_data->desc1 = 0; + desc_data->desc2 = 0; + desc_data->desc3 = 0; + + /* Make sure ownership is written to the descriptor */ + //dma_wmb(); +} + +static void fxgmac_tx_desc_init(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel *channel = pdata->expansion.tx_channel; + struct fxgmac_dma_desc *desc_data; + unsigned int i; + + /* Initialize all descriptors */ + for (i = 0; i < NIC_DEF_TBDS; i++) { + desc_data = pdata->expansion.tx_desc_list + i; + + /* Initialize Tx descriptor */ + fxgmac_desc_reset(desc_data); + } + + ///* Update the total number of Tx descriptors */ + writereg(pdata->pAdapter, NIC_DEF_TBDS - 1, FXGMAC_DMA_REG(channel, DMA_CH_TDRLR)); + +#if 0 + DbgPrintF(MP_TRACE, "tx_desc_list:%p\n", pdata->tx_desc_list); + DbgPrintF(MP_TRACE, "bus_to_phys:%llx\n", bus_to_phys(pdata->pdev, + (pci_addr_t)(unsigned long)pdata->tx_desc_list));//adpt->TbdPhyAddr + DbgPrintF(MP_TRACE, "lower_32_bits:%x\n", lower_32_bits(bus_to_phys(pdata->pdev, + (pci_addr_t)(unsigned long)pdata->tx_desc_list)));//adpt->TbdPhyAddr + DbgPrintF(MP_TRACE, "dma tdlr lo:%p\n", FXGMAC_DMA_REG(channel, DMA_CH_TDLR_LO)); +#endif + /* Update the starting address of descriptor ring */ + writereg(pdata->pAdapter, upper_32_bits(cpu_to_le64(bus_to_phys(pdata->pdev, + (pci_addr_t)(unsigned long)pdata->expansion.tx_desc_list))),//adpt->TbdPhyAddr + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_HI)); + writereg(pdata->pAdapter, lower_32_bits(cpu_to_le64(bus_to_phys(pdata->pdev, + (pci_addr_t)(unsigned long)pdata->expansion.tx_desc_list))),//adpt->TbdPhyAddr + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_LO)); +#if 0 + DbgPrintF(MP_TRACE, "Read tx starting high address:%x\n", + readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TDLR_HI))); + DbgPrintF(MP_TRACE, "Read tx starting low address:%x\n", + readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TDLR_LO))); +#endif + +} + +static int fxgmac_rx_desc_init(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel * channel = pdata->expansion.rx_channel; + struct fxgmac_dma_desc *desc_data; + unsigned int i; + uint64_t HwRbdPa; + + /* Initialize all descriptors */ + for (i = 0; i < NIC_DEF_RECV_BUFFERS; i++) { + desc_data = pdata->expansion.rx_desc_list + i; + + /* Initialize Rx descriptor */ + fxgmac_desc_reset(desc_data); + desc_data->desc0 = lower_32_bits(bus_to_phys(pdata->pdev, (pci_addr_t)(unsigned long)(pdata->expansion.rx_buffer))); + desc_data->desc1 = upper_32_bits(bus_to_phys(pdata->pdev, (pci_addr_t)(unsigned long)(pdata->expansion.rx_buffer))); + desc_data->desc3 = FXGMAC_SET_REG_BITS_LE( + desc_data->desc3, + RX_NORMAL_DESC3_BUF2V_POS, + RX_NORMAL_DESC3_BUF2V_LEN, + 1); + desc_data->desc3 = FXGMAC_SET_REG_BITS_LE( + desc_data->desc3, + RX_NORMAL_DESC3_BUF1V_POS, + RX_NORMAL_DESC3_BUF1V_LEN, + 1); + desc_data->desc3 = FXGMAC_SET_REG_BITS_LE( + desc_data->desc3, + RX_NORMAL_DESC3_OWN_POS, + RX_NORMAL_DESC3_OWN_LEN, + 1); + } + + /* Update the total number of Rx descriptors */ + writereg(pdata->pAdapter, NIC_DEF_RECV_BUFFERS - 1, FXGMAC_DMA_REG(channel, DMA_CH_RDRLR)); +#if 0 + DbgPrintF(MP_TRACE, "rx_desc_list:%p\n", pdata->rx_desc_list); + DbgPrintF(MP_TRACE, "bus_to_phys:%llx\n", bus_to_phys(pdata->pdev, + (pci_addr_t)(unsigned long)pdata->rx_desc_list));//adpt->TbdPhyAddr + DbgPrintF(MP_TRACE, "lower_32_bits:%x\n", lower_32_bits(bus_to_phys(pdata->pdev, + (pci_addr_t)(unsigned long)pdata->rx_desc_list)));//adpt->TbdPhyAddr + DbgPrintF(MP_TRACE, "dma rdlr lo:%p\n", FXGMAC_DMA_REG(channel, DMA_CH_RDLR_LO)); +#endif + /* Update the starting address of descriptor ring */ + writereg(pdata->pAdapter, upper_32_bits(cpu_to_le64(bus_to_phys(pdata->pdev, + (pci_addr_t)(unsigned long)pdata->expansion.rx_desc_list))), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_HI)); + writereg(pdata->pAdapter, lower_32_bits(cpu_to_le64(bus_to_phys(pdata->pdev, + (pci_addr_t)(unsigned long)pdata->expansion.rx_desc_list))), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_LO)); +#if 0 + DbgPrintF(MP_TRACE, "Read rx starting high address:%x\n", + readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RDLR_HI))); + DbgPrintF(MP_TRACE, "Read rx starting low address:%x\n", + readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RDLR_LO))); +#endif + + HwRbdPa = (uint64_t)pdata->expansion.rx_desc_list + (NIC_DEF_RECV_BUFFERS) * sizeof(struct fxgmac_dma_desc); + /* Update the Rx Descriptor Tail Pointer */ + writereg(pdata->pAdapter, lower_32_bits((unsigned long)HwRbdPa), FXGMAC_DMA_REG(channel, DMA_CH_RDTR_LO)); + + return 0; +} + +#else +static void fxgmac_tx_desc_reset(struct fxgmac_desc_data* desc_data) +{ + struct fxgmac_dma_desc* dma_desc = desc_data->dma_desc; + + /* Reset the Tx descriptor + * Set buffer 1 (lo) address to zero + * Set buffer 1 (hi) address to zero + * Reset all other control bits (IC, TTSE, B2L & B1L) + * Reset all other control bits (OWN, CTXT, FD, LD, CPC, CIC, etc) + */ + dma_desc->desc0 = 0; + dma_desc->desc1 = 0; + dma_desc->desc2 = 0; + dma_desc->desc3 = 0; + + /* Make sure ownership is written to the descriptor */ + dma_wmb(); +} + +static void fxgmac_tx_desc_init_channel(struct fxgmac_channel* channel) +{ +#ifndef KDNET + struct fxgmac_ring* ring = channel->tx_ring; + struct fxgmac_desc_data* desc_data; + int start_index = ring->cur; + unsigned int i; + (void)start_index; + /* Initialize all descriptors */ + for (i = 0; i < ring->dma_desc_count; i++) { + desc_data = FXGMAC_GET_DESC_DATA(ring, i); + + /* Initialize Tx descriptor */ + fxgmac_tx_desc_reset(desc_data); + } +#endif + + ///* Update the total number of Tx descriptors */ + //writereg(ring->dma_desc_count - 1, FXGMAC_DMA_REG(channel, DMA_CH_TDRLR)); +#ifndef PXE + writereg(channel->pdata->pAdapter, channel->pdata->tx_desc_count - 1, FXGMAC_DMA_REG(channel, DMA_CH_TDRLR)); +#endif + + /* Update the starting address of descriptor ring */ +#if defined(LINUX) + desc_data = FXGMAC_GET_DESC_DATA(ring, start_index); + writereg(channel->pdata->pAdapter, upper_32_bits(desc_data->dma_desc_addr), + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_HI)); + writereg(channel->pdata->pAdapter, lower_32_bits(desc_data->dma_desc_addr), + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_LO)); +#elif defined(UEFI) + writereg(channel->pdata->pAdapter, GetPhyAddrHigh(((PADAPTER)channel->pdata->pAdapter)->TbdPhyAddr),//adpt->TbdPhyAddr + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_HI)); + writereg(channel->pdata->pAdapter, GetPhyAddrLow(((PADAPTER)channel->pdata->pAdapter)->TbdPhyAddr), + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_LO)); +#elif defined(PXE) + +#elif defined(UBOOT) + +#elif defined(DPDK) + +#elif defined(KDNET) + writereg(channel->pdata->pAdapter, upper_32_bits(((PMOTORCOMM_ADAPTER)channel->pdata->pAdapter)->TbdPhyAddr), + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_HI)); + writereg(channel->pdata->pAdapter, lower_32_bits(((PMOTORCOMM_ADAPTER)channel->pdata->pAdapter)->TbdPhyAddr), + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_LO)); +#else //netadaptercx & ndis + writereg(channel->pdata->pAdapter, NdisGetPhysicalAddressHigh(((PMP_ADAPTER)channel->pdata->pAdapter)->HwTbdBasePa), + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_HI)); + writereg(channel->pdata->pAdapter, NdisGetPhysicalAddressLow(((PMP_ADAPTER)channel->pdata->pAdapter)->HwTbdBasePa), + FXGMAC_DMA_REG(channel, DMA_CH_TDLR_LO)); +#endif +} + +static void fxgmac_tx_desc_init(struct fxgmac_pdata* pdata) +{ +#ifndef LINUX + struct fxgmac_channel* channel; + channel = pdata->channel_head; + fxgmac_tx_desc_init_channel(channel); +#else + struct fxgmac_desc_data *desc_data; + struct fxgmac_dma_desc *dma_desc; + struct fxgmac_channel *channel; + struct fxgmac_ring *ring; + dma_addr_t dma_desc_addr; + unsigned int i, j; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + ring = channel->tx_ring; + if (!ring) + break; + + /* reset the tx timer status. 20220104 */ + channel->tx_timer_active = 0; + + dma_desc = ring->dma_desc_head; + dma_desc_addr = ring->dma_desc_head_addr; + + for (j = 0; j < ring->dma_desc_count; j++) { + desc_data = FXGMAC_GET_DESC_DATA(ring, j); + + desc_data->dma_desc = dma_desc; + desc_data->dma_desc_addr = dma_desc_addr; + + dma_desc++; + dma_desc_addr += sizeof(struct fxgmac_dma_desc); + } + + ring->cur = 0; + ring->dirty = 0; + memset(&ring->tx, 0, sizeof(ring->tx)); + + fxgmac_tx_desc_init_channel(channel); + } +#endif +} + +static void fxgmac_rx_desc_reset(struct fxgmac_pdata* pdata, + struct fxgmac_desc_data* desc_data, + unsigned int index) +{ +#ifdef LINUX + struct fxgmac_dma_desc* dma_desc = desc_data->dma_desc; + dma_addr_t buf_dma; + + /* Reset the Rx descriptor + * Set buffer 1 (lo) address to header dma address (lo) + * Set buffer 1 (hi) address to header dma address (hi) + * Set buffer 2 (lo) address to buffer dma address (lo) + * Set buffer 2 (hi) address to buffer dma address (hi) and + * set control bits OWN and INTE + */ +#ifdef FXGMAC_NOT_USE_PAGE_MAPPING + buf_dma = desc_data->rx.buf.dma_base; +#else + buf_dma = desc_data->rx.hdr.dma_base + desc_data->rx.hdr.dma_off; +#endif + dma_desc->desc0 = cpu_to_le32(lower_32_bits(buf_dma)); + dma_desc->desc1 = cpu_to_le32(upper_32_bits(buf_dma)); + dma_desc->desc2 = 0; + dma_desc->desc3 = 0; + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + RX_NORMAL_DESC3_INTE_POS, + RX_NORMAL_DESC3_INTE_LEN, + 1); + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + RX_NORMAL_DESC3_BUF2V_POS, + RX_NORMAL_DESC3_BUF2V_LEN, + 0); + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + RX_NORMAL_DESC3_BUF1V_POS, + RX_NORMAL_DESC3_BUF1V_LEN, + 1); + + /* Since the Rx DMA engine is likely running, make sure everything + * is written to the descriptor(s) before setting the OWN bit + * for the descriptor + */ + dma_wmb(); + + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + RX_NORMAL_DESC3_OWN_POS, + RX_NORMAL_DESC3_OWN_LEN, + 1); + + /* Make sure ownership is written to the descriptor */ + dma_wmb(); +#else + (void)pdata; + (void)desc_data; + (void)index; +#endif +} + +static void fxgmac_rx_desc_init_channel(struct fxgmac_channel* channel) +{ + struct fxgmac_pdata* pdata = channel->pdata; + struct fxgmac_ring* ring = channel->rx_ring; +#ifdef LINUX + unsigned int start_index = ring->cur; +#endif + struct fxgmac_desc_data* desc_data; + unsigned int i; +#if defined(UEFI) + UINT64 HwRbdPa; +#elif defined(KDNET) + PHYSICAL_ADDRESS HwRbdPa; +#elif defined(_WIN64) || defined(_WIN32) + unsigned int Qid; + NDIS_PHYSICAL_ADDRESS HwRbdPa; + HwRbdPa.QuadPart = 0; +#elif defined(PXE) +#endif + + + /* Initialize all descriptors */ + for (i = 0; i < ring->dma_desc_count; i++) { + desc_data = FXGMAC_GET_DESC_DATA(ring, i); + + /* Initialize Rx descriptor */ + fxgmac_rx_desc_reset(pdata, desc_data, i); + } + +#if defined(LINUX) + /* Update the total number of Rx descriptors */ + writereg(pdata->pAdapter, ring->dma_desc_count - 1, FXGMAC_DMA_REG(channel, DMA_CH_RDRLR)); + + /* Update the starting address of descriptor ring */ + desc_data = FXGMAC_GET_DESC_DATA(ring, start_index); + writereg(pdata->pAdapter, upper_32_bits(desc_data->dma_desc_addr), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_HI)); + writereg(pdata->pAdapter, lower_32_bits(desc_data->dma_desc_addr), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_LO)); + + /* Update the Rx Descriptor Tail Pointer */ + desc_data = FXGMAC_GET_DESC_DATA(ring, start_index + + ring->dma_desc_count - 1); + writereg(pdata->pAdapter, lower_32_bits(desc_data->dma_desc_addr), + FXGMAC_DMA_REG(channel, DMA_CH_RDTR_LO)); +#elif defined(UEFI) + writereg(pdata->pAdapter, pdata->rx_desc_count - 1, + FXGMAC_DMA_REG(channel, DMA_CH_RDRLR)); + /* Update the starting address of descriptor ring */ + writereg(pdata->pAdapter, GetPhyAddrHigh(((PADAPTER)channel->pdata->pAdapter)->RbdPhyAddr), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_HI)); + writereg(pdata->pAdapter, GetPhyAddrLow(((PADAPTER)channel->pdata->pAdapter)->RbdPhyAddr), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_LO)); + + + HwRbdPa = ((PADAPTER)channel->pdata->pAdapter)->RbdPhyAddr + (pdata->rx_desc_count - 1) * sizeof(struct fxgmac_dma_desc); + + /* Update the Rx Descriptor Tail Pointer */ + writereg(pdata->pAdapter, GetPhyAddrLow(HwRbdPa), FXGMAC_DMA_REG(channel, DMA_CH_RDTR_LO)); +#elif defined(PXE) +#elif defined(UBOOT) +#elif defined(DPDK) +#elif defined(KDNET) + writereg(channel->pdata->pAdapter, channel->pdata->rx_desc_count - 1, + FXGMAC_DMA_REG(channel, DMA_CH_RDRLR)); + + /* Update the starting address of descriptor ring */ + writereg(channel->pdata->pAdapter, upper_32_bits(((PMOTORCOMM_ADAPTER)channel->pdata->pAdapter)->RdbPhyAddr), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_HI)); + writereg(channel->pdata->pAdapter, lower_32_bits(((PMOTORCOMM_ADAPTER)channel->pdata->pAdapter)->RdbPhyAddr), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_LO)); + + HwRbdPa.QuadPart = ((PMOTORCOMM_ADAPTER)channel->pdata->pAdapter)->RdbPhyAddr.QuadPart + + (channel->pdata->rx_desc_count - 1) * sizeof(HW_RBD); + + writereg(channel->pdata->pAdapter, HwRbdPa.LowPart, FXGMAC_DMA_REG(channel, DMA_CH_RDTR_LO)); +#else //netadaptercx & ndis + Qid = (unsigned int)(channel - pdata->channel_head); + DbgPrintF(MP_TRACE, ""STR_FORMAT": %d, Qid =%d\n", __FUNCTION__, __LINE__, Qid); + + writereg(channel->pdata->pAdapter, ((PMP_ADAPTER)channel->pdata->pAdapter)->RxQueue[Qid].NumHwRecvBuffers - 1, + FXGMAC_DMA_REG(channel, DMA_CH_RDRLR)); + + /* Update the starting address of descriptor ring */ + writereg(channel->pdata->pAdapter, NdisGetPhysicalAddressHigh(((PMP_ADAPTER)channel->pdata->pAdapter)->RxQueue[Qid].HwRbdBasePa), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_HI)); + writereg(channel->pdata->pAdapter, NdisGetPhysicalAddressLow(((PMP_ADAPTER)channel->pdata->pAdapter)->RxQueue[Qid].HwRbdBasePa), + FXGMAC_DMA_REG(channel, DMA_CH_RDLR_LO)); + +#if NIC_NET_ADAPETERCX + /* Update the Rx Descriptor Tail Pointer */ + //writereg(channel->pdata->pAdapter, NdisGetPhysicalAddressLow(((PMP_ADAPTER)channel->pdata->pAdapter)->RxQueue[Qid].HwRbdBasePa), + // FXGMAC_DMA_REG(channel, DMA_CH_RDTR_LO)); + //HwRbdPa.QuadPart = 0; +#else + HwRbdPa.QuadPart = ((PMP_ADAPTER)channel->pdata->pAdapter)->RxQueue[Qid].HwRbdBasePa.QuadPart + + (((PMP_ADAPTER)channel->pdata->pAdapter)->RxQueue[Qid].NumHwRecvBuffers - 1) * sizeof(HW_RBD); + + /* Update the Rx Descriptor Tail Pointer */ + writereg(channel->pdata->pAdapter, NdisGetPhysicalAddressLow(HwRbdPa), FXGMAC_DMA_REG(channel, DMA_CH_RDTR_LO)); +#endif +#endif +} + +static int fxgmac_rx_desc_init(struct fxgmac_pdata* pdata) +{ +#ifndef LINUX + struct fxgmac_channel* channel; + int Qid = 0; + + channel = pdata->channel_head; + for (Qid = 0; Qid < RSS_Q_COUNT; Qid++) + { + fxgmac_rx_desc_init_channel(channel + Qid); + } +#else + struct fxgmac_desc_data *desc_data; + struct fxgmac_dma_desc *dma_desc; + struct fxgmac_channel *channel; + struct fxgmac_ring *ring; + dma_addr_t dma_desc_addr; + unsigned int i, j; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + ring = channel->rx_ring; + if (!ring) + break; + + dma_desc = ring->dma_desc_head; + dma_desc_addr = ring->dma_desc_head_addr; + + for (j = 0; j < ring->dma_desc_count; j++) { + desc_data = FXGMAC_GET_DESC_DATA(ring, j); + + desc_data->dma_desc = dma_desc; + desc_data->dma_desc_addr = dma_desc_addr; + + if (fxgmac_map_rx_buffer(pdata, ring, desc_data)) + break; + + dma_desc++; + dma_desc_addr += sizeof(struct fxgmac_dma_desc); + } + + ring->cur = 0; + ring->dirty = 0; + + fxgmac_rx_desc_init_channel(channel); + + } +#endif + return 0; +} +#endif +#ifdef LINUX +static int fxgmac_map_tx_skb(struct fxgmac_channel *channel, + struct sk_buff *skb) +{ + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_ring *ring = channel->tx_ring; + unsigned int start_index, cur_index; + struct fxgmac_desc_data *desc_data; + unsigned int offset, datalen, len; + struct fxgmac_pkt_info *pkt_info; + skb_frag_t *frag; + unsigned int tso, vlan; + dma_addr_t skb_dma; + unsigned int i; +#ifdef FXGMAC_TX_DMA_MAP_SINGLE + void* addr; + struct skb_shared_info *info = skb_shinfo(skb); +#endif + + offset = 0; + start_index = ring->cur; + cur_index = ring->cur; + + pkt_info = &ring->pkt_info; + pkt_info->desc_count = 0; + pkt_info->length = 0; + + tso = FXGMAC_GET_REG_BITS(pkt_info->attributes, + TX_PACKET_ATTRIBUTES_TSO_ENABLE_POS, + TX_PACKET_ATTRIBUTES_TSO_ENABLE_LEN); + vlan = FXGMAC_GET_REG_BITS(pkt_info->attributes, + TX_PACKET_ATTRIBUTES_VLAN_CTAG_POS, + TX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN); + + /* Save space for a context descriptor if needed */ + if ((tso && (pkt_info->mss != ring->tx.cur_mss)) || + (vlan && (pkt_info->vlan_ctag != ring->tx.cur_vlan_ctag))) + { + cur_index = FXGMAC_GET_ENTRY(cur_index, ring->dma_desc_count); + } + desc_data = FXGMAC_GET_DESC_DATA(ring, cur_index); + + if (tso) { + /* Map the TSO header */ + skb_dma = dma_map_single(pdata->dev, skb->data, + pkt_info->header_len, DMA_TO_DEVICE); + if (dma_mapping_error(pdata->dev, skb_dma)) { + netdev_alert(pdata->netdev, "dma_map_single failed\n"); + goto err_out; + } + desc_data->skb_dma = skb_dma; + desc_data->skb_dma_len = pkt_info->header_len; + netif_dbg(pdata, tx_queued, pdata->netdev, + "skb header: index=%u, dma=%pad, len=%u\n", + cur_index, &skb_dma, pkt_info->header_len); + + offset = pkt_info->header_len; + + pkt_info->length += pkt_info->header_len; + + cur_index = FXGMAC_GET_ENTRY(cur_index, ring->dma_desc_count); + desc_data = FXGMAC_GET_DESC_DATA(ring, cur_index); + } + + /* Map the (remainder of the) packet */ + for (datalen = skb_headlen(skb) - offset; datalen; ) { + len = min_t(unsigned int, datalen, FXGMAC_TX_MAX_BUF_SIZE); + + skb_dma = dma_map_single(pdata->dev, skb->data + offset, len, + DMA_TO_DEVICE); + if (dma_mapping_error(pdata->dev, skb_dma)) { + netdev_alert(pdata->netdev, "dma_map_single failed\n"); + goto err_out; + } + desc_data->skb_dma = skb_dma; + desc_data->skb_dma_len = len; + netif_dbg(pdata, tx_queued, pdata->netdev, + "skb data: index=%u, dma=%pad, len=%u\n", + cur_index, &skb_dma, len); + + datalen -= len; + offset += len; + + pkt_info->length += len; + + cur_index = FXGMAC_GET_ENTRY(cur_index, ring->dma_desc_count); + desc_data = FXGMAC_GET_DESC_DATA(ring, cur_index); + } + + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + netif_dbg(pdata, tx_queued, pdata->netdev, + "mapping frag %u\n", i); +#ifdef FXGMAC_TX_DMA_MAP_SINGLE + frag = info->frags + i; + len = skb_frag_size(frag); + addr = skb_frag_address(frag); +#else + frag = &skb_shinfo(skb)->frags[i]; +#endif + offset = 0; + + for (datalen = skb_frag_size(frag); datalen; ) { + len = min_t(unsigned int, datalen, + FXGMAC_TX_MAX_BUF_SIZE); + +#ifdef FXGMAC_TX_DMA_MAP_SINGLE + skb_dma = dma_map_single(pdata->dev, addr + offset, len, DMA_TO_DEVICE); +#else + skb_dma = skb_frag_dma_map(pdata->dev, frag, offset, + len, DMA_TO_DEVICE); +#endif + if (dma_mapping_error(pdata->dev, skb_dma)) { + netdev_alert(pdata->netdev, + "skb_frag_dma_map failed\n"); + goto err_out; + } + desc_data->skb_dma = skb_dma; + desc_data->skb_dma_len = len; +#ifdef FXGMAC_TX_DMA_MAP_SINGLE + desc_data->mapped_as_page = 0; +#else + desc_data->mapped_as_page = 1; +#endif + netif_dbg(pdata, tx_queued, pdata->netdev, + "skb frag: index=%u, dma=%pad, len=%u\n", + cur_index, &skb_dma, len); + + datalen -= len; + offset += len; + + pkt_info->length += len; + + cur_index = FXGMAC_GET_ENTRY(cur_index, ring->dma_desc_count); + desc_data = FXGMAC_GET_DESC_DATA(ring, cur_index); + } + } + + /* Save the skb address in the last entry. We always have some data + * that has been mapped so desc_data is always advanced past the last + * piece of mapped data - use the entry pointed to by cur_index - 1. + */ + desc_data = FXGMAC_GET_DESC_DATA(ring, (cur_index - 1) & (ring->dma_desc_count - 1)); + desc_data->skb = skb; + + /* Save the number of descriptor entries used */ + if (start_index <= cur_index) + pkt_info->desc_count = cur_index - start_index; + else + pkt_info->desc_count = ring->dma_desc_count - start_index + cur_index; + + return pkt_info->desc_count; + +err_out: + while (start_index < cur_index) { + desc_data = FXGMAC_GET_DESC_DATA(ring, start_index); + start_index = FXGMAC_GET_ENTRY(start_index, ring->dma_desc_count); + fxgmac_unmap_desc_data(pdata, desc_data); + } + + return 0; +} +#endif + +void fxgmac_init_desc_ops(struct fxgmac_desc_ops* desc_ops) +{ +#ifdef UBOOT + desc_ops->alloc_channels_and_rings = fxgmac_alloc_channels; +#else + desc_ops->alloc_channels_and_rings = fxgmac_alloc_channels_and_rings; +#endif + desc_ops->free_channels_and_rings = fxgmac_free_channels_and_rings; +#ifndef LINUX + desc_ops->map_tx_skb = NULL; +#else + desc_ops->map_tx_skb = fxgmac_map_tx_skb; +#endif + desc_ops->map_rx_buffer = fxgmac_map_rx_buffer; + desc_ops->unmap_desc_data = fxgmac_unmap_desc_data; + desc_ops->tx_desc_init = fxgmac_tx_desc_init; + desc_ops->rx_desc_init = fxgmac_rx_desc_init; +#ifndef UBOOT + desc_ops->tx_desc_init_channel = fxgmac_tx_desc_init_channel; + desc_ops->rx_desc_init_channel = fxgmac_rx_desc_init_channel; + desc_ops->tx_desc_reset = fxgmac_tx_desc_reset; + desc_ops->rx_desc_reset = fxgmac_rx_desc_reset; +#endif +} diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-ethtool.c b/lede/package/kernel/yt6801/src/fuxi-gmac-ethtool.c new file mode 100644 index 0000000000..b4c1a0b2f5 --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-ethtool.c @@ -0,0 +1,1346 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" + +struct fxgmac_stats_desc { + char stat_string[ETH_GSTRING_LEN]; + int stat_offset; +}; + +#define FXGMAC_STAT(str, var) \ + { \ + str, \ + offsetof(struct fxgmac_pdata, stats.var), \ + } + +static const struct fxgmac_stats_desc fxgmac_gstring_stats[] = { + /* MMC TX counters */ + FXGMAC_STAT("tx_bytes", txoctetcount_gb), + FXGMAC_STAT("tx_bytes_good", txoctetcount_g), + FXGMAC_STAT("tx_packets", txframecount_gb), + FXGMAC_STAT("tx_packets_good", txframecount_g), + FXGMAC_STAT("tx_unicast_packets", txunicastframes_gb), + FXGMAC_STAT("tx_broadcast_packets", txbroadcastframes_gb), + FXGMAC_STAT("tx_broadcast_packets_good", txbroadcastframes_g), + FXGMAC_STAT("tx_multicast_packets", txmulticastframes_gb), + FXGMAC_STAT("tx_multicast_packets_good", txmulticastframes_g), + FXGMAC_STAT("tx_vlan_packets_good", txvlanframes_g), + FXGMAC_STAT("tx_64_byte_packets", tx64octets_gb), + FXGMAC_STAT("tx_65_to_127_byte_packets", tx65to127octets_gb), + FXGMAC_STAT("tx_128_to_255_byte_packets", tx128to255octets_gb), + FXGMAC_STAT("tx_256_to_511_byte_packets", tx256to511octets_gb), + FXGMAC_STAT("tx_512_to_1023_byte_packets", tx512to1023octets_gb), + FXGMAC_STAT("tx_1024_to_max_byte_packets", tx1024tomaxoctets_gb), + FXGMAC_STAT("tx_underflow_errors", txunderflowerror), + FXGMAC_STAT("tx_pause_frames", txpauseframes), + FXGMAC_STAT("tx_single_collision", txsinglecollision_g), + FXGMAC_STAT("tx_multiple_collision", txmultiplecollision_g), + FXGMAC_STAT("tx_deferred_frames", txdeferredframes), + FXGMAC_STAT("tx_late_collision_frames", txlatecollisionframes), + FXGMAC_STAT("tx_excessive_collision_frames", txexcessivecollisionframes), + FXGMAC_STAT("tx_carrier_error_frames", txcarriererrorframes), + FXGMAC_STAT("tx_excessive_deferral_error", txexcessivedeferralerror), + FXGMAC_STAT("tx_oversize_frames_good", txoversize_g), + + /* MMC RX counters */ + FXGMAC_STAT("rx_bytes", rxoctetcount_gb), + FXGMAC_STAT("rx_bytes_good", rxoctetcount_g), + FXGMAC_STAT("rx_packets", rxframecount_gb), + FXGMAC_STAT("rx_unicast_packets_good", rxunicastframes_g), + FXGMAC_STAT("rx_broadcast_packets_good", rxbroadcastframes_g), + FXGMAC_STAT("rx_multicast_packets_good", rxmulticastframes_g), + FXGMAC_STAT("rx_vlan_packets_mac", rxvlanframes_gb), + FXGMAC_STAT("rx_64_byte_packets", rx64octets_gb), + FXGMAC_STAT("rx_65_to_127_byte_packets", rx65to127octets_gb), + FXGMAC_STAT("rx_128_to_255_byte_packets", rx128to255octets_gb), + FXGMAC_STAT("rx_256_to_511_byte_packets", rx256to511octets_gb), + FXGMAC_STAT("rx_512_to_1023_byte_packets", rx512to1023octets_gb), + FXGMAC_STAT("rx_1024_to_max_byte_packets", rx1024tomaxoctets_gb), + FXGMAC_STAT("rx_undersize_packets_good", rxundersize_g), + FXGMAC_STAT("rx_oversize_packets_good", rxoversize_g), + FXGMAC_STAT("rx_crc_errors", rxcrcerror), + FXGMAC_STAT("rx_align_error", rxalignerror), + FXGMAC_STAT("rx_crc_errors_small_packets", rxrunterror), + FXGMAC_STAT("rx_crc_errors_giant_packets", rxjabbererror), + FXGMAC_STAT("rx_length_errors", rxlengtherror), + FXGMAC_STAT("rx_out_of_range_errors", rxoutofrangetype), + FXGMAC_STAT("rx_fifo_overflow_errors", rxfifooverflow), + FXGMAC_STAT("rx_watchdog_errors", rxwatchdogerror), + FXGMAC_STAT("rx_pause_frames", rxpauseframes), + FXGMAC_STAT("rx_receive_error_frames", rxreceiveerrorframe), + FXGMAC_STAT("rx_control_frames_good", rxcontrolframe_g), + + /* Extra counters */ + FXGMAC_STAT("tx_tso_packets", tx_tso_packets), + FXGMAC_STAT("rx_split_header_packets", rx_split_header_packets), + FXGMAC_STAT("tx_process_stopped", tx_process_stopped), + FXGMAC_STAT("rx_process_stopped", rx_process_stopped), + FXGMAC_STAT("tx_buffer_unavailable", tx_buffer_unavailable), + FXGMAC_STAT("rx_buffer_unavailable", rx_buffer_unavailable), + FXGMAC_STAT("fatal_bus_error", fatal_bus_error), + FXGMAC_STAT("tx_vlan_packets_net", tx_vlan_packets), + FXGMAC_STAT("rx_vlan_packets_net", rx_vlan_packets), + FXGMAC_STAT("napi_poll_isr", napi_poll_isr), + FXGMAC_STAT("napi_poll_txtimer", napi_poll_txtimer), + FXGMAC_STAT("alive_cnt_txtimer", cnt_alive_txtimer), + + FXGMAC_STAT("ephy_poll_timer", ephy_poll_timer_cnt), + FXGMAC_STAT("mgmt_int_isr", mgmt_int_isr), +}; + +#define FXGMAC_STATS_COUNT ARRAY_SIZE(fxgmac_gstring_stats) + +static void fxgmac_ethtool_get_drvinfo(struct net_device *netdev, + struct ethtool_drvinfo *drvinfo) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + u32 ver = pdata->hw_feat.version; + u32 sver, devid, userver; + + strscpy(drvinfo->driver, pdata->drv_name, sizeof(drvinfo->driver)); + strscpy(drvinfo->version, pdata->drv_ver, sizeof(drvinfo->version)); + strscpy(drvinfo->bus_info, dev_name(pdata->dev), + sizeof(drvinfo->bus_info)); + /* + * D|DEVID: Indicates the Device family + * U|USERVER: User-defined Version + */ + sver = FXGMAC_GET_REG_BITS(ver, MAC_VR_SVER_POS, + MAC_VR_SVER_LEN); + devid = FXGMAC_GET_REG_BITS(ver, MAC_VR_DEVID_POS, + MAC_VR_DEVID_LEN); + userver = FXGMAC_GET_REG_BITS(ver, MAC_VR_USERVER_POS, + MAC_VR_USERVER_LEN); + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), + "S.D.U: %x.%x.%x", sver, devid, userver); +} + +static u32 fxgmac_ethtool_get_msglevel(struct net_device *netdev) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + return pdata->msg_enable; +} + +static void fxgmac_ethtool_set_msglevel(struct net_device *netdev, + u32 msglevel) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + DPRINTK("fxmac, set msglvl from %08x to %08x\n", pdata->msg_enable, msglevel); + pdata->msg_enable = msglevel; +} + +static void fxgmac_ethtool_get_channels(struct net_device *netdev, + struct ethtool_channels *channel) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); +#if (FXGMAC_RSS_FEATURE_ENABLED) + /* report maximum channels */ + channel->max_combined = FXGMAC_MAX_DMA_CHANNELS; + channel->max_other = 0; + channel->other_count = 0; + + /* record RSS queues */ + channel->combined_count = FXGMAC_MAX_DMA_CHANNELS; + + /* nothing else to report if RSS is disabled */ + if (channel->combined_count == 1) + return; + DPRINTK("fxmac rss, get channels max=(combined %d,other %d),count(combined %d,other %d)\n", channel->max_combined, channel->max_other, channel->combined_count, channel->other_count); +#endif + + channel->max_rx = FXGMAC_MAX_DMA_CHANNELS; + channel->max_tx = FXGMAC_MAX_DMA_CHANNELS; + channel->rx_count = pdata->rx_q_count; + channel->tx_count = pdata->tx_q_count; + DPRINTK("fxmac, get channels max=(rx %d,tx %d),count(%d,%d)\n", channel->max_rx, channel->max_tx, channel->rx_count, channel->tx_count); +} + +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) ||\ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) ) +static int fxgmac_ethtool_get_coalesce(struct net_device *netdev, + struct ethtool_coalesce *ec, + struct kernel_ethtool_coalesce *kernel_coal, + struct netlink_ext_ack *extack) +#else +static int fxgmac_ethtool_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec) +#endif +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + memset(ec, 0, sizeof(struct ethtool_coalesce)); + ec->rx_coalesce_usecs = pdata->rx_usecs; + ec->tx_coalesce_usecs = pdata->tx_usecs; + /*If we need to assign values to other members, + * we need to modify the supported_coalesce_params of fxgmac_ethtool_ops synchronously + */ + //ec->rx_max_coalesced_frames = pdata->rx_frames; + //ec->tx_max_coalesced_frames = pdata->tx_frames; + + DPRINTK("fxmac, get coalesce\n"); + return 0; +} + +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) ||\ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) ) +static int fxgmac_ethtool_set_coalesce(struct net_device *netdev, + struct ethtool_coalesce *ec, + struct kernel_ethtool_coalesce *kernel_coal, + struct netlink_ext_ack *extack) +#else +static int fxgmac_ethtool_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec) +#endif +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + unsigned int rx_frames, rx_riwt, rx_usecs; + unsigned int tx_frames; + + /* Check for not supported parameters */ + if ((ec->rx_coalesce_usecs_irq) || (ec->rx_max_coalesced_frames_irq) || + (ec->tx_coalesce_usecs_high) || + (ec->tx_max_coalesced_frames_irq) || (ec->tx_coalesce_usecs_irq) || + (ec->stats_block_coalesce_usecs) || (ec->pkt_rate_low) || + (ec->use_adaptive_rx_coalesce) || (ec->use_adaptive_tx_coalesce) || + (ec->rx_max_coalesced_frames_low) || (ec->rx_coalesce_usecs_low) || + (ec->tx_coalesce_usecs_low) || (ec->tx_max_coalesced_frames_low) || + (ec->pkt_rate_high) || (ec->rx_coalesce_usecs_high) || + (ec->rx_max_coalesced_frames_high) || + (ec->tx_max_coalesced_frames_high) || + (ec->rate_sample_interval)) + return -EOPNOTSUPP; + + rx_usecs = ec->rx_coalesce_usecs; + rx_riwt = hw_ops->usec_to_riwt(pdata, rx_usecs); + rx_frames = ec->rx_max_coalesced_frames; + tx_frames = ec->tx_max_coalesced_frames; + + if ((rx_riwt > FXGMAC_MAX_DMA_RIWT) || + (rx_riwt < FXGMAC_MIN_DMA_RIWT) || + (rx_frames > pdata->rx_desc_count)) + return -EINVAL; + + if (tx_frames > pdata->tx_desc_count) + return -EINVAL; + + pdata->rx_riwt = rx_riwt; + pdata->rx_usecs = rx_usecs; + pdata->rx_frames = rx_frames; + hw_ops->config_rx_coalesce(pdata); + + pdata->tx_frames = tx_frames; + hw_ops->config_tx_coalesce(pdata); + + pdata->tx_usecs = ec->tx_coalesce_usecs; + hw_ops->set_interrupt_moderation(pdata); + + DPRINTK("fxmac, set coalesce\n"); + return 0; +} + +#if (FXGMAC_RSS_FEATURE_ENABLED) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) +static u32 fxgmac_get_rxfh_key_size(struct net_device *netdev) +{ + return FXGMAC_RSS_HASH_KEY_SIZE; +} +#endif + +static u32 fxgmac_rss_indir_size(struct net_device *netdev) +{ + return FXGMAC_RSS_MAX_TABLE_SIZE; +} + +static void fxgmac_get_reta(struct fxgmac_pdata *pdata, u32 *indir) +{ + int i, reta_size = FXGMAC_RSS_MAX_TABLE_SIZE; + u16 rss_m; +#ifdef FXGMAC_ONE_CHANNEL + rss_m = FXGMAC_MAX_DMA_CHANNELS; +#else + rss_m = FXGMAC_MAX_DMA_CHANNELS - 1; //mask for index of channel, 0-3 +#endif + + for (i = 0; i < reta_size; i++) + indir[i] = pdata->rss_table[i] & rss_m; +} + +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) ) +static int fxgmac_get_rxfh(struct net_device *netdev,struct ethtool_rxfh_param *rxfh) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + if (rxfh->hfunc) + { + rxfh->hfunc = ETH_RSS_HASH_TOP; + DPRINTK("fxmac, get_rxfh for hash function\n"); + } + + if (rxfh->indir) + { + fxgmac_get_reta(pdata, rxfh->indir); + DPRINTK("fxmac, get_rxfh for indirection tab\n"); + } + + if (rxfh->key) + { + memcpy(rxfh->key, pdata->rss_key, fxgmac_get_rxfh_key_size(netdev)); + DPRINTK("fxmac, get_rxfh for hash key\n"); + } + + return 0; +} + +static int fxgmac_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh, struct netlink_ext_ack *ack) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int i; + u32 reta_entries = fxgmac_rss_indir_size(netdev); + int max_queues = FXGMAC_MAX_DMA_CHANNELS; + + DPRINTK("fxmac, set_rxfh callin, indir=%lx, key=%lx, func=%02x\n", (unsigned long)rxfh->indir, (unsigned long)rxfh->key, rxfh->hfunc); + + if (rxfh->hfunc) + return -EINVAL; + + /* Fill out the redirection table */ + if (rxfh->indir) { +#if FXGMAC_MSIX_CH0RXDIS_ENABLED + max_queues = max_queues; // kill warning + reta_entries = reta_entries; + i = i; + DPRINTK("fxmac, set_rxfh, change of indirect talbe is not supported.\n"); + return -EINVAL; +#else + /* double check user input. */ + for (i = 0; i < reta_entries; i++) + if (rxfh->indir[i] >= max_queues) + return -EINVAL; + + for (i = 0; i < reta_entries; i++) + pdata->rss_table[i] = rxfh->indir[i]; + + hw_ops->write_rss_lookup_table(pdata); +#endif + } + + /* Fill out the rss hash key */ + if (FXGMAC_RSS_HASH_KEY_LINUX && rxfh->key) { + hw_ops->set_rss_hash_key(pdata, rxfh->key); + } + + return 0; +} +#else +static int fxgmac_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + u8 *hfunc) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + if (hfunc) + { + *hfunc = ETH_RSS_HASH_TOP; + DPRINTK("fxmac, get_rxfh for hash function\n"); + } + + if (indir) + { + fxgmac_get_reta(pdata, indir); + DPRINTK("fxmac, get_rxfh for indirection tab\n"); + } + + if (key) + { + memcpy(key, pdata->rss_key, fxgmac_get_rxfh_key_size(netdev)); + DPRINTK("fxmac, get_rxfh for hash key\n"); + } + + return 0; +} + +static int fxgmac_set_rxfh(struct net_device *netdev, const u32 *indir, + const u8 *key, const u8 hfunc) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int i = 0; + u32 reta_entries = fxgmac_rss_indir_size(netdev); + int max_queues = FXGMAC_MAX_DMA_CHANNELS; + + DPRINTK("fxmac, set_rxfh callin, indir=%lx, key=%lx, func=%02x\n", (unsigned long)indir, (unsigned long)key, hfunc); + + if (hfunc) + return -EINVAL; + + /* Fill out the redirection table */ + if (indir) { +#if FXGMAC_MSIX_CH0RXDIS_ENABLED + max_queues = max_queues; // kill warning + reta_entries = reta_entries; + i = i; + DPRINTK("fxmac, set_rxfh, change of indirect talbe is not supported.\n"); + return -EINVAL; +#else + /* double check user input. */ + for (i = 0; i < reta_entries; i++) + if (indir[i] >= max_queues) + return -EINVAL; + + for (i = 0; i < reta_entries; i++) + pdata->rss_table[i] = indir[i]; + + hw_ops->write_rss_lookup_table(pdata); +#endif + } + + /* Fill out the rss hash key */ + if (FXGMAC_RSS_HASH_KEY_LINUX && key) { + hw_ops->set_rss_hash_key(pdata, key); + } + + return 0; +} +#endif + +static int fxgmac_get_rss_hash_opts(struct fxgmac_pdata *pdata, + struct ethtool_rxnfc *cmd) +{ + u32 reg_opt; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + cmd->data = 0; + + reg_opt = hw_ops->get_rss_options(pdata); + DPRINTK ("fxgmac_get_rss_hash_opts, hw=%02x, %02x\n", reg_opt, pdata->rss_options); + + if(reg_opt != pdata->rss_options) + { + DPRINTK ("fxgmac_get_rss_hash_opts, warning, options are not consistent\n"); + } + + /* Report default options for RSS */ + switch (cmd->flow_type) { + case TCP_V4_FLOW: + case UDP_V4_FLOW: + if(((TCP_V4_FLOW == (cmd->flow_type)) && (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_TCP4TE_POS, MAC_RSSCR_TCP4TE_LEN))) || + ((UDP_V4_FLOW == (cmd->flow_type)) && (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_UDP4TE_POS, MAC_RSSCR_UDP4TE_LEN)))) + { + cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; + } + fallthrough; + case SCTP_V4_FLOW: + case AH_ESP_V4_FLOW: + case AH_V4_FLOW: + case ESP_V4_FLOW: + case IPV4_FLOW: + if(((TCP_V4_FLOW == (cmd->flow_type)) && (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_TCP4TE_POS, MAC_RSSCR_TCP4TE_LEN))) || + ((UDP_V4_FLOW == (cmd->flow_type)) && (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_UDP4TE_POS, MAC_RSSCR_UDP4TE_LEN))) || + (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_IP4TE_POS, MAC_RSSCR_IP4TE_LEN))) + { + cmd->data |= RXH_IP_SRC | RXH_IP_DST; + } + break; + case TCP_V6_FLOW: + case UDP_V6_FLOW: + if(((TCP_V6_FLOW == (cmd->flow_type)) && (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_TCP6TE_POS, MAC_RSSCR_TCP6TE_LEN))) || + ((UDP_V6_FLOW == (cmd->flow_type)) && (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_UDP6TE_POS, MAC_RSSCR_UDP6TE_LEN)))) + { + cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; + } + fallthrough; + case SCTP_V6_FLOW: + case AH_ESP_V6_FLOW: + case AH_V6_FLOW: + case ESP_V6_FLOW: + case IPV6_FLOW: + if(((TCP_V6_FLOW == (cmd->flow_type)) && (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_TCP6TE_POS, MAC_RSSCR_TCP6TE_LEN))) || + ((UDP_V6_FLOW == (cmd->flow_type)) && (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_UDP6TE_POS, MAC_RSSCR_UDP6TE_LEN))) || + (FXGMAC_GET_REG_BITS(pdata->rss_options, MAC_RSSCR_IP6TE_POS, MAC_RSSCR_IP6TE_LEN))) + { + cmd->data |= RXH_IP_SRC | RXH_IP_DST; + } + break; + default: + return -EINVAL; + } + + return 0; +} + +static int fxgmac_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, + u32 *rule_locs) +{ + struct fxgmac_pdata *pdata = netdev_priv(dev); + int ret = -EOPNOTSUPP; + + switch (cmd->cmd) { + case ETHTOOL_GRXRINGS: + cmd->data = pdata->rx_q_count; + ret = 0; + DPRINTK("fxmac, get_rxnfc for rx ring cnt\n"); + break; + case ETHTOOL_GRXCLSRLCNT: + cmd->rule_cnt = 0; + ret = 0; + DPRINTK("fxmac, get_rxnfc for classify rule cnt\n"); + break; + case ETHTOOL_GRXCLSRULE: + DPRINTK("fxmac, get_rxnfc for classify rules\n"); + ret = 0;//ixgbe_get_ethtool_fdir_entry(adapter, cmd); + break; + case ETHTOOL_GRXCLSRLALL: + cmd->rule_cnt = 0; + ret = 0; + DPRINTK("fxmac, get_rxnfc for classify both cnt and rules\n"); + break; + case ETHTOOL_GRXFH: + ret = fxgmac_get_rss_hash_opts(pdata, cmd); + DPRINTK("fxmac, get_rxnfc for hash options\n"); + break; + default: + break; + } + + return ret; +} + +static int fxgmac_set_rss_hash_opt(struct fxgmac_pdata *pdata, + struct ethtool_rxnfc *nfc) +{ + u32 rssopt = 0; //pdata->rss_options; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + DPRINTK("fxgmac_set_rss_hash_opt call in,nfc_data=%llx,cur opt=%x\n", nfc->data, pdata->rss_options); + + /* + * For RSS, it does not support anything other than hashing + * to queues on src,dst IPs and L4 ports + */ + if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | + RXH_L4_B_0_1 | RXH_L4_B_2_3)) + return -EINVAL; + + switch (nfc->flow_type) { + case TCP_V4_FLOW: + case TCP_V6_FLOW: + /* default to TCP flow and do nothting */ + if (!(nfc->data & RXH_IP_SRC) || + !(nfc->data & RXH_IP_DST) || + !(nfc->data & RXH_L4_B_0_1) || + !(nfc->data & RXH_L4_B_2_3)) + return -EINVAL; + if(TCP_V4_FLOW == (nfc->flow_type)) + { + rssopt = FXGMAC_SET_REG_BITS( + rssopt, + MAC_RSSCR_IP4TE_POS, + MAC_RSSCR_IP4TE_LEN, 1); + rssopt = FXGMAC_SET_REG_BITS( + rssopt, + MAC_RSSCR_TCP4TE_POS, + MAC_RSSCR_TCP4TE_LEN, 1); + } + + if(TCP_V6_FLOW == (nfc->flow_type)) + { + rssopt = FXGMAC_SET_REG_BITS( + rssopt, + MAC_RSSCR_IP6TE_POS, + MAC_RSSCR_IP6TE_LEN, 1); + rssopt = FXGMAC_SET_REG_BITS( + rssopt, + MAC_RSSCR_TCP6TE_POS, + MAC_RSSCR_TCP6TE_LEN, 1); + } + break; + + case UDP_V4_FLOW: + if (!(nfc->data & RXH_IP_SRC) || + !(nfc->data & RXH_IP_DST)) + return -EINVAL; + rssopt = FXGMAC_SET_REG_BITS( + rssopt, + MAC_RSSCR_IP4TE_POS, + MAC_RSSCR_IP4TE_LEN, 1); + switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { + case 0: + break; + case (RXH_L4_B_0_1 | RXH_L4_B_2_3): + rssopt = FXGMAC_SET_REG_BITS( + rssopt, + MAC_RSSCR_UDP4TE_POS, + MAC_RSSCR_UDP4TE_LEN, 1); + break; + default: + return -EINVAL; + } + break; + case UDP_V6_FLOW: + if (!(nfc->data & RXH_IP_SRC) || + !(nfc->data & RXH_IP_DST)) + return -EINVAL; + rssopt = FXGMAC_SET_REG_BITS( + rssopt, + MAC_RSSCR_IP6TE_POS, + MAC_RSSCR_IP6TE_LEN, 1); + + switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { + case 0: + break; + case (RXH_L4_B_0_1 | RXH_L4_B_2_3): + rssopt = FXGMAC_SET_REG_BITS( + rssopt, + MAC_RSSCR_UDP6TE_POS, + MAC_RSSCR_UDP6TE_LEN, 1); + break; + default: + return -EINVAL; + } + break; + case AH_ESP_V4_FLOW: + case AH_V4_FLOW: + case ESP_V4_FLOW: + case SCTP_V4_FLOW: + case AH_ESP_V6_FLOW: + case AH_V6_FLOW: + case ESP_V6_FLOW: + case SCTP_V6_FLOW: + if (!(nfc->data & RXH_IP_SRC) || + !(nfc->data & RXH_IP_DST) || + (nfc->data & RXH_L4_B_0_1) || + (nfc->data & RXH_L4_B_2_3)) + return -EINVAL; + break; + default: + return -EINVAL; + } + + /* if options are changed, then update to hw */ + if (rssopt != pdata->rss_options) { + if ((rssopt & UDP_RSS_FLAGS) && + !(pdata->rss_options & UDP_RSS_FLAGS)) + DPRINTK("enabling UDP RSS: fragmented packets" + " may arrive out of order to the stack above\n"); + + DPRINTK("rss option changed from %x to %x\n", pdata->rss_options, rssopt); + pdata->rss_options = rssopt; + hw_ops->set_rss_options(pdata); + } + + return 0; +} + +static int fxgmac_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) +{ + struct fxgmac_pdata *pdata = netdev_priv(dev); + + int ret = -EOPNOTSUPP; + + switch (cmd->cmd) { + case ETHTOOL_SRXCLSRLINS: + DPRINTK("set_rxnfc for rx cls rule insert-n\\a\n"); + break; + case ETHTOOL_SRXCLSRLDEL: + DPRINTK("set_rxnfc for rx cls rule del-n\\a\n"); + break; + case ETHTOOL_SRXFH: + DPRINTK("set_rxnfc for rx rss option\n"); + ret = fxgmac_set_rss_hash_opt(pdata, cmd); + break; + default: + break; + } + + return ret; +} +#endif //FXGMAC_RSS_FEATURE_ENABLED + +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) ||\ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) ) +static void fxgmac_get_ringparam(struct net_device *netdev, + struct ethtool_ringparam *ring, + struct kernel_ethtool_ringparam *kernel_ring, + struct netlink_ext_ack *exact) + +#else +static void fxgmac_get_ringparam(struct net_device *netdev, + struct ethtool_ringparam *ring) +#endif +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + DPRINTK("fxmac, get_ringparam callin\n"); + + ring->rx_max_pending = FXGMAC_RX_DESC_CNT; + ring->tx_max_pending = FXGMAC_TX_DESC_CNT; + ring->rx_mini_max_pending = 0; + ring->rx_jumbo_max_pending = 0; + ring->rx_pending = pdata->rx_desc_count; + ring->tx_pending = pdata->tx_desc_count; + ring->rx_mini_pending = 0; + ring->rx_jumbo_pending = 0; +} + +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) ||\ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) ) +static int fxgmac_set_ringparam(struct net_device *netdev, + struct ethtool_ringparam *ring, + struct kernel_ethtool_ringparam *kernel_ring, + struct netlink_ext_ack *exact) + +#else +static int fxgmac_set_ringparam(struct net_device *netdev, + struct ethtool_ringparam *ring) +#endif +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_desc_ops *desc_ops = &pdata->desc_ops; + + if (pdata->expansion.dev_state != FXGMAC_DEV_START) + return 0; + + fxgmac_lock(pdata); + DPRINTK("fxmac, set_ringparam callin\n"); + + pdata->tx_desc_count = ring->tx_pending; + pdata->rx_desc_count = ring->rx_pending; + + fxgmac_stop(pdata); + fxgmac_free_tx_data(pdata); + fxgmac_free_rx_data(pdata); + desc_ops->alloc_channels_and_rings(pdata); + fxgmac_start(pdata); + fxgmac_unlock(pdata); + + return 0; +} + +#if FXGMAC_WOL_FEATURE_ENABLED +static void fxgmac_get_wol(struct net_device *netdev, + struct ethtool_wolinfo *wol) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC | WAKE_ARP; +#if FXGMAC_WOL_UPON_EPHY_LINK + wol->supported |= WAKE_PHY; +#endif + + wol->wolopts = 0; + if (!(pdata->hw_feat.rwk) || !device_can_wakeup(/*pci_dev_to_dev*/(pdata->dev))) { + DPRINTK("fxgmac get_wol, pci does not support wakeup\n"); + return; + } + wol->wolopts = pdata->expansion.wol; +} + +// only supports four patterns, and patterns will be cleared on every call +static void fxgmac_set_pattern_data(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + u32 ip_addr, i = 0; + u8 type_offset, op_offset, tip_offset; + struct pattern_packet packet; + struct wol_bitmap_pattern pattern[4]; // for WAKE_UCAST, WAKE_BCAST, WAKE_MCAST, WAKE_ARP. + + memset(pattern, 0, sizeof(struct wol_bitmap_pattern) * 4); + + //config ucast + if (pdata->expansion.wol & WAKE_UCAST) { + pattern[i].mask_info[0] = 0x3F; + pattern[i].mask_size = sizeof(pattern[0].mask_info); + memcpy(pattern[i].pattern_info, pdata->mac_addr, ETH_ALEN); + pattern[i].pattern_offset = 0; + i++; + } + + // config bcast + if (pdata->expansion.wol & WAKE_BCAST) { + pattern[i].mask_info[0] = 0x3F; + pattern[i].mask_size = sizeof(pattern[0].mask_info); + memset(pattern[i].pattern_info, 0xFF, ETH_ALEN); + pattern[i].pattern_offset = 0; + i++; + } + + // config mcast + if (pdata->expansion.wol & WAKE_MCAST) { + pattern[i].mask_info[0] = 0x7; + pattern[i].mask_size = sizeof(pattern[0].mask_info); + pattern[i].pattern_info[0] = 0x1; + pattern[i].pattern_info[1] = 0x0; + pattern[i].pattern_info[2] = 0x5E; + pattern[i].pattern_offset = 0; + i++; + } + + // config arp + if (pdata->expansion.wol & WAKE_ARP) { + memset(pattern[i].mask_info, 0, sizeof(pattern[0].mask_info)); + type_offset = offsetof(struct pattern_packet, ar_pro); + pattern[i].mask_info[type_offset / 8] |= 1 << type_offset % 8; + type_offset++; + pattern[i].mask_info[type_offset / 8] |= 1 << type_offset % 8; + op_offset = offsetof(struct pattern_packet, ar_op); + pattern[i].mask_info[op_offset / 8] |= 1 << op_offset % 8; + op_offset++; + pattern[i].mask_info[op_offset / 8] |= 1 << op_offset % 8; + tip_offset = offsetof(struct pattern_packet, ar_tip); + pattern[i].mask_info[tip_offset / 8] |= 1 << tip_offset % 8; + tip_offset++; + pattern[i].mask_info[tip_offset / 8] |= 1 << type_offset % 8; + tip_offset++; + pattern[i].mask_info[tip_offset / 8] |= 1 << type_offset % 8; + tip_offset++; + pattern[i].mask_info[tip_offset / 8] |= 1 << type_offset % 8; + + packet.ar_pro = 0x0 << 8 | 0x08; // arp type is 0x0800, notice that ar_pro and ar_op is big endian + packet.ar_op = 0x1 << 8; // 1 is arp request,2 is arp replay, 3 is rarp request, 4 is rarp replay + ip_addr = fxgmac_get_netdev_ip4addr(pdata); + packet.ar_tip[0] = ip_addr & 0xFF; + packet.ar_tip[1] = (ip_addr >> 8) & 0xFF; + packet.ar_tip[2] = (ip_addr >> 16) & 0xFF; + packet.ar_tip[3] = (ip_addr >> 24) & 0xFF; + memcpy(pattern[i].pattern_info, &packet, MAX_PATTERN_SIZE); + pattern[i].mask_size = sizeof(pattern[0].mask_info); + pattern[i].pattern_offset = 0; + i++; + } + + hw_ops->set_wake_pattern(pdata, pattern, i); +} + +void fxgmac_config_wol(struct fxgmac_pdata *pdata, int en) +{ + /* enable or disable WOL. this function only set wake-up type, and power related configure + * will be in other place, see power management. + */ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + if (!pdata->hw_feat.rwk) { + netdev_err(pdata->netdev, "error configuring WOL - not supported.\n"); + return; + } + + hw_ops->disable_wake_magic_pattern(pdata); + hw_ops->disable_wake_pattern(pdata); + hw_ops->disable_wake_link_change(pdata); + + if(en) { + /* config mac address for rx of magic or ucast */ + hw_ops->set_mac_address(pdata, (u8*)(pdata->netdev->dev_addr)); + + /* Enable Magic packet */ + if (pdata->expansion.wol & WAKE_MAGIC) { + hw_ops->enable_wake_magic_pattern(pdata); + } + + /* Enable global unicast packet */ + if (pdata->expansion.wol & WAKE_UCAST + || pdata->expansion.wol & WAKE_MCAST + || pdata->expansion.wol & WAKE_BCAST + || pdata->expansion.wol & WAKE_ARP) { + hw_ops->enable_wake_pattern(pdata); + } + + /* Enable ephy link change */ + if ((FXGMAC_WOL_UPON_EPHY_LINK) && (pdata->expansion.wol & WAKE_PHY)) { + hw_ops->enable_wake_link_change(pdata); + } + } + device_set_wakeup_enable(/*pci_dev_to_dev*/(pdata->dev), en); + + DPRINTK("config_wol callout\n"); +} + +static int fxgmac_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + //currently, we do not support these options +#if FXGMAC_WOL_UPON_EPHY_LINK +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)) + if (wol->wolopts & (WAKE_MAGICSECURE | WAKE_FILTER)) { +#else + if (wol->wolopts & WAKE_MAGICSECURE) { +#endif +#else +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)) + if (wol->wolopts & (WAKE_PHY | WAKE_MAGICSECURE | WAKE_FILTER)) { +#else + if (wol->wolopts & (WAKE_PHY | WAKE_MAGICSECURE)) { +#endif +#endif + DPRINTK("fxmac, set_wol, not supported wol options, 0x%x\n", wol->wolopts); + return -EOPNOTSUPP; + } + + if (!(pdata->hw_feat.rwk)) { + DPRINTK("fxmac, set_wol, hw wol feature is n/a\n"); + return (wol->wolopts ? -EOPNOTSUPP : 0); + } + + pdata->expansion.wol = 0; + if (wol->wolopts & WAKE_UCAST) + pdata->expansion.wol |= WAKE_UCAST; + + if (wol->wolopts & WAKE_MCAST) + pdata->expansion.wol |= WAKE_MCAST; + + if (wol->wolopts & WAKE_BCAST) + pdata->expansion.wol |= WAKE_BCAST; + + if (wol->wolopts & WAKE_MAGIC) + pdata->expansion.wol |= WAKE_MAGIC; + + if (wol->wolopts & WAKE_PHY) + pdata->expansion.wol |= WAKE_PHY; + + if (wol->wolopts & WAKE_ARP) + pdata->expansion.wol |= WAKE_ARP; + + fxgmac_set_pattern_data(pdata); + + fxgmac_config_wol(pdata, (!!(pdata->expansion.wol))); + DPRINTK("fxmac, set_wol, opt=0x%x, 0x%x\n", wol->wolopts, pdata->expansion.wol); + + return 0; +} +#endif /*FXGMAC_WOL_FEATURE_ENABLED*/ + +static int fxgmac_get_regs_len(struct net_device __always_unused *netdev) +{ + return FXGMAC_EPHY_REGS_LEN * sizeof(u32); +} + +static void fxgmac_get_regs(struct net_device *netdev, struct ethtool_regs *regs, + void *p) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + u32 *regs_buff = p; + u8 i; + + memset(p, 0, FXGMAC_EPHY_REGS_LEN * sizeof(u32)); + for (i = REG_MII_BMCR; i < FXGMAC_EPHY_REGS_LEN; i++) { + hw_ops->read_ephy_reg(pdata, i, (unsigned int *)®s_buff[i]); + } + regs->version = regs_buff[REG_MII_PHYSID1] << 16 | regs_buff[REG_MII_PHYSID2]; +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) +static int fxgmac_get_link_ksettings(struct net_device *netdev, + struct ethtool_link_ksettings *cmd) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + u32 duplex, regval, link_status; + u32 adv = 0xFFFFFFFF; + int ret; +#if 0 + ret = fxgmac_ephy_autoneg_ability_get(pdata, &adv); + if (ret < 0) + return -ETIMEDOUT; +#endif + + ethtool_link_ksettings_zero_link_mode(cmd, supported); + ethtool_link_ksettings_zero_link_mode(cmd, advertising); + + /* set the supported link speeds */ + ethtool_link_ksettings_add_link_mode(cmd, supported, 1000baseT_Full); + ethtool_link_ksettings_add_link_mode(cmd, supported, 100baseT_Full); + ethtool_link_ksettings_add_link_mode(cmd, supported, 100baseT_Half); + ethtool_link_ksettings_add_link_mode(cmd, supported, 10baseT_Full); + ethtool_link_ksettings_add_link_mode(cmd, supported, 10baseT_Half); + + /* Indicate pause support */ + ethtool_link_ksettings_add_link_mode(cmd, supported, Pause); + ethtool_link_ksettings_add_link_mode(cmd, supported, Asym_Pause); + ret = hw_ops->read_ephy_reg(pdata, REG_MII_ADVERTISE, ®val); + if (ret < 0) + return ret; + + if (FXGMAC_GET_REG_BITS(regval, PHY_MII_ADVERTISE_PAUSE_POS, PHY_MII_ADVERTISE_PAUSE_LEN)) + ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause); + if (FXGMAC_GET_REG_BITS(regval, PHY_MII_ADVERTISE_ASYPAUSE_POS, PHY_MII_ADVERTISE_ASYPAUSE_LEN)) + ethtool_link_ksettings_add_link_mode(cmd, advertising, Asym_Pause); + + ethtool_link_ksettings_add_link_mode(cmd, supported, MII); + cmd->base.port = PORT_MII; + + ethtool_link_ksettings_add_link_mode(cmd, supported, Autoneg); + ret = hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, ®val); + if (ret < 0) + return ret; + + regval = FXGMAC_GET_REG_BITS(regval, PHY_CR_AUTOENG_POS, PHY_CR_AUTOENG_LEN); + if (regval) { + if (pdata->phy_autoeng) + ethtool_link_ksettings_add_link_mode(cmd, advertising, Autoneg); + else + goto FORCE_MODE; + //clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, cmd->link_modes.advertising); + + ret = hw_ops->read_ephy_reg(pdata, REG_MII_ADVERTISE, &adv); + if (ret < 0) + return ret; + + if (adv & FXGMAC_ADVERTISE_10HALF) + ethtool_link_ksettings_add_link_mode(cmd, advertising, 10baseT_Half); + if (adv & FXGMAC_ADVERTISE_10FULL) + ethtool_link_ksettings_add_link_mode(cmd, advertising, 10baseT_Full); + if (adv & FXGMAC_ADVERTISE_100HALF) + ethtool_link_ksettings_add_link_mode(cmd, advertising, 100baseT_Half); + if (adv & FXGMAC_ADVERTISE_100FULL) + ethtool_link_ksettings_add_link_mode(cmd, advertising, 100baseT_Full); + + ret = hw_ops->read_ephy_reg(pdata, REG_MII_CTRL1000, &adv); + if (ret < 0) + return ret; + + if (adv & FXGMAC_ADVERTISE_1000FULL) + ethtool_link_ksettings_add_link_mode(cmd, advertising, 1000baseT_Full); + } + else { +FORCE_MODE: + clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, cmd->link_modes.advertising); + switch (pdata->phy_speed) { + case SPEED_1000M: + if (pdata->phy_duplex) + ethtool_link_ksettings_add_link_mode(cmd, advertising, 1000baseT_Full); + else + ethtool_link_ksettings_add_link_mode(cmd, advertising, 1000baseT_Half); + break; + case SPEED_100M: + if (pdata->phy_duplex) + ethtool_link_ksettings_add_link_mode(cmd, advertising, 100baseT_Full); + else + ethtool_link_ksettings_add_link_mode(cmd, advertising, 100baseT_Half); + break; + case SPEED_10M: + if (pdata->phy_duplex) + ethtool_link_ksettings_add_link_mode(cmd, advertising, 10baseT_Full); + else + ethtool_link_ksettings_add_link_mode(cmd, advertising, 10baseT_Half); + break; + default: + break; + } + } + cmd->base.autoneg = pdata->phy_autoeng ? regval : 0; + + regval = 0; + ret = hw_ops->read_ephy_reg(pdata, REG_MII_SPEC_STATUS, ®val); + if (ret < 0) + return ret; + + link_status = regval & (BIT(FXGMAC_EPHY_LINK_STATUS_BIT)); + if (link_status) { + duplex = FXGMAC_GET_REG_BITS(regval, PHY_MII_SPEC_DUPLEX_POS, PHY_MII_SPEC_DUPLEX_LEN); + cmd->base.duplex = duplex; + cmd->base.speed = pdata->phy_speed; + }else { + cmd->base.duplex = DUPLEX_UNKNOWN; + cmd->base.speed = SPEED_UNKNOWN; + } + + return 0; +} + +static int fxgmac_set_link_ksettings(struct net_device *netdev, + const struct ethtool_link_ksettings *cmd) +{ + u32 advertising, support; + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int ret; + + if (cmd->base.speed == SPEED_1000 && cmd->base.duplex == DUPLEX_HALF) + return -EINVAL; + + pdata->phy_autoeng = cmd->base.autoneg; + pdata->phy_duplex = cmd->base.duplex; + pdata->phy_speed = cmd->base.speed; + + ethtool_convert_link_mode_to_legacy_u32(&advertising, cmd->link_modes.advertising); + ethtool_convert_link_mode_to_legacy_u32(&support, cmd->link_modes.supported); + advertising &= support; + + if (pdata->phy_autoeng || (!pdata->phy_autoeng && cmd->base.speed == SPEED_1000)){ + pdata->expansion.phy_link = false; + //pdata->phy_autoeng = AUTONEG_ENABLE; + ret = hw_ops->phy_config(pdata); + if (ret < 0) + return ret; + } else { + fxgmac_phy_force_mode(pdata); + } + + /* Save speed is used to restore it when resuming */ + pdata->expansion.pre_phy_speed = cmd->base.speed; + pdata->expansion.pre_phy_autoneg = cmd->base.autoneg; + pdata->expansion.pre_phy_duplex = cmd->base.duplex; + + return 0; +} +#endif + +#if FXGMAC_PAUSE_FEATURE_ENABLED +static void fxgmac_get_pauseparam(struct net_device *netdev, + struct ethtool_pauseparam *pause) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + pause->autoneg = pdata->phy_autoeng; + pause->rx_pause = pdata->rx_pause; + pause->tx_pause = pdata->tx_pause; + + DPRINTK("fxmac get_pauseparam done, rx=%d, tx=%d\n", pdata->rx_pause, pdata->tx_pause); +} + +static int fxgmac_set_pauseparam(struct net_device *netdev, + struct ethtool_pauseparam *pause) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + unsigned int pre_rx_pause = pdata->rx_pause; + unsigned int pre_tx_pause = pdata->tx_pause; + u32 adv; + int ret; + int enable_pause = 0; + + pdata->rx_pause = pause->rx_pause; + pdata->tx_pause = pause->tx_pause; + + if (pdata->rx_pause || pdata->tx_pause) + enable_pause = 1; + + if(pre_rx_pause != pdata->rx_pause) { + hw_ops->config_rx_flow_control(pdata); + DPRINTK("fxgmac set pause parameter, rx from %d to %d\n", pre_rx_pause, pdata->rx_pause); + } + if(pre_tx_pause != pdata->tx_pause) { + hw_ops->config_tx_flow_control(pdata); + DPRINTK("fxgmac set pause parameter, tx from %d to %d\n", pre_tx_pause, pdata->tx_pause); + } + + if (pause->autoneg) { + ret = hw_ops->read_ephy_reg(pdata, REG_MII_ADVERTISE, &adv); + if (ret < 0) + return ret; + adv = FXGMAC_SET_REG_BITS(adv, PHY_MII_ADVERTISE_PAUSE_POS, + PHY_MII_ADVERTISE_PAUSE_LEN, + enable_pause); + adv = FXGMAC_SET_REG_BITS(adv, PHY_MII_ADVERTISE_ASYPAUSE_POS, + PHY_MII_ADVERTISE_ASYPAUSE_LEN, + enable_pause); + ret = hw_ops->write_ephy_reg(pdata, REG_MII_ADVERTISE, adv); + if (ret < 0) { + return ret; + } + + ret = hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, &adv); + if (ret < 0) + return ret; + adv = FXGMAC_SET_REG_BITS(adv, PHY_CR_RE_AUTOENG_POS, PHY_CR_RE_AUTOENG_LEN, 1); + ret = hw_ops->write_ephy_reg(pdata, REG_MII_BMCR, adv); + if (ret < 0) + return ret; + }else { + DPRINTK("Can't set phy pause because autoneg is off.\n"); + } + + DPRINTK("fxgmac set pause parameter, autoneg=%d, rx=%d, tx=%d\n", pause->autoneg, pause->rx_pause, pause->tx_pause); + + return 0; +} +#endif /*FXGMAC_PAUSE_FEATURE_ENABLED*/ + +static void fxgmac_ethtool_get_strings(struct net_device *netdev, + u32 stringset, u8 *data) +{ + int i; + + switch (stringset) { + case ETH_SS_STATS: + for (i = 0; i < FXGMAC_STATS_COUNT; i++) { + memcpy(data, fxgmac_gstring_stats[i].stat_string, + strlen(fxgmac_gstring_stats[i].stat_string)); + data += ETH_GSTRING_LEN; + } + break; + default: + WARN_ON(1); + break; + } +} + +static int fxgmac_ethtool_get_sset_count(struct net_device *netdev, + int stringset) +{ + int ret; + + switch (stringset) { + case ETH_SS_STATS: + ret = FXGMAC_STATS_COUNT; + break; + + default: + ret = -EOPNOTSUPP; + } + + return ret; +} + +static void fxgmac_ethtool_get_ethtool_stats(struct net_device *netdev, + struct ethtool_stats *stats, + u64 *data) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + u8 *stat; + int i; + +#if FXGMAC_PM_FEATURE_ENABLED + if(!test_bit(FXGMAC_POWER_STATE_DOWN, &pdata->expansion.powerstate)) +#endif + { + pdata->hw_ops.read_mmc_stats(pdata); + } + + for (i = 0; i < FXGMAC_STATS_COUNT; i++) { + stat = (u8 *)pdata + fxgmac_gstring_stats[i].stat_offset; + *data++ = *(u64 *)stat; + } +} + +#if 0 +static inline bool fxgmac_removed(void __iomem *addr) +{ + return unlikely(!addr); +} +#endif + +static int fxgmac_ethtool_reset(struct net_device *netdev, u32 *flag) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + u32 val; + int ret = 0; + + val = (*flag & ETH_RESET_ALL) || (*flag & ETH_RESET_PHY); + if (!val) { + DPRINTK("Operation not support.\n"); + return -EINVAL; + } + + switch(*flag) { + case ETH_RESET_ALL: + fxgmac_restart_dev(pdata); + *flag = 0; + break; + case ETH_RESET_PHY: + /* + * power off and on the phy in order to properly + * configure the MAC timing + */ + hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, &val); + val = FXGMAC_SET_REG_BITS(val, PHY_CR_POWER_POS, + PHY_CR_POWER_LEN, + PHY_POWER_DOWN); + ret = hw_ops->write_ephy_reg(pdata, REG_MII_BMCR, val); + if(ret < 0) + return ret; + + usleep_range_ex(pdata->pAdapter, 9000, 10000); + val = FXGMAC_SET_REG_BITS(val, PHY_CR_POWER_POS, + PHY_CR_POWER_LEN, + PHY_POWER_UP); + ret = hw_ops->write_ephy_reg(pdata, REG_MII_BMCR, val); + if(ret < 0) + return ret; + + *flag = 0; + break; + default: + break; + } + + return 0; +} + +static const struct ethtool_ops fxgmac_ethtool_ops = { + .get_drvinfo = fxgmac_ethtool_get_drvinfo, + .get_link = ethtool_op_get_link, + .get_msglevel = fxgmac_ethtool_get_msglevel, + .set_msglevel = fxgmac_ethtool_set_msglevel, + .get_channels = fxgmac_ethtool_get_channels, + .get_coalesce = fxgmac_ethtool_get_coalesce, + .set_coalesce = fxgmac_ethtool_set_coalesce, + .reset = fxgmac_ethtool_reset, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) + /* + * The process of set is to get first and then set, + * and the result of get is preserved for values that have not been modified. + * + * Therefore, when using, it is necessary to ensure that this macro and the + * assignment operation in the get_coalesce are one-to-one correspondence, + * otherwise the macro and parameters will be verified when set, and the error + * of "Operation not supported " will be reported if the verification fails + */ +#ifdef ETHTOOL_COALESCE_USECS + .supported_coalesce_params = ETHTOOL_COALESCE_USECS, +#endif +#endif + .get_strings = fxgmac_ethtool_get_strings, + .get_sset_count = fxgmac_ethtool_get_sset_count, + .get_ethtool_stats = fxgmac_ethtool_get_ethtool_stats, + .get_regs_len = fxgmac_get_regs_len, + .get_regs = fxgmac_get_regs, + .get_ringparam = fxgmac_get_ringparam, + .set_ringparam = fxgmac_set_ringparam, +#if (FXGMAC_RSS_FEATURE_ENABLED) + .get_rxnfc = fxgmac_get_rxnfc, + .set_rxnfc = fxgmac_set_rxnfc, + .get_rxfh_indir_size = fxgmac_rss_indir_size, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) + .get_rxfh_key_size = fxgmac_get_rxfh_key_size, +#endif + .get_rxfh = fxgmac_get_rxfh, + .set_rxfh = fxgmac_set_rxfh, +#endif +#if (FXGMAC_WOL_FEATURE_ENABLED) + .get_wol = fxgmac_get_wol, + .set_wol = fxgmac_set_wol, +#endif +#if (FXGMAC_PAUSE_FEATURE_ENABLED) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) + .get_link_ksettings = fxgmac_get_link_ksettings, + .set_link_ksettings = fxgmac_set_link_ksettings, +#endif + .get_pauseparam = fxgmac_get_pauseparam, + .set_pauseparam = fxgmac_set_pauseparam, +#endif +}; + +const struct ethtool_ops *fxgmac_get_ethtool_ops(void) +{ + return &fxgmac_ethtool_ops; +} diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-hw.c b/lede/package/kernel/yt6801/src/fuxi-gmac-hw.c new file mode 100644 index 0000000000..f49e4ce607 --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-hw.c @@ -0,0 +1,6076 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" +#include "fuxi-efuse.h" + +#ifdef FXGMAC_USE_ADAPTER_HANDLE +#include "fuxi-mp.h" +#endif + +void fxgmac_release_phy(struct fxgmac_pdata* pdata); +static void fxgmac_pwr_clock_ungate(struct fxgmac_pdata* pdata); +static void fxgmac_pwr_clock_gate(struct fxgmac_pdata* pdata); + +static int fxgmac_tx_complete(struct fxgmac_dma_desc *dma_desc) +{ + return !FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + TX_NORMAL_DESC3_OWN_POS, + TX_NORMAL_DESC3_OWN_LEN); +} + +static int fxgmac_disable_rx_csum(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_IPC_POS, + MAC_CR_IPC_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + DPRINTK("fxgmac disable rx checksum, set val = %x.\n", regval); + return 0; +} + +static int fxgmac_enable_rx_csum(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_IPC_POS, + MAC_CR_IPC_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + DPRINTK("fxgmac enable rx checksum, set val = %x.\n", regval); + return 0; +} + +static int fxgmac_set_mac_address(struct fxgmac_pdata *pdata, u8 *addr) +{ + u32 mac_addr_hi, mac_addr_lo; + + mac_addr_hi = (((u32)(addr[5]) << 8) | ((u32)(addr[4]) << 0)); + mac_addr_lo = (((u32)(addr[3]) << 24) | ((u32)(addr[2]) << 16) | + ((u32)(addr[1]) << 8) | ((u32)(addr[0]) << 0)); + + writereg(pdata->pAdapter, mac_addr_hi, pdata->mac_regs + MAC_MACA0HR); + writereg(pdata->pAdapter, mac_addr_lo, pdata->mac_regs + MAC_MACA0LR); + + return 0; +} + +#if !defined(DPDK) +static void fxgmac_set_mac_reg(struct fxgmac_pdata *pdata, + struct netdev_hw_addr *ha, + unsigned int __far*mac_reg) +{ + u32 mac_addr_hi, mac_addr_lo; + u8 *mac_addr; + + mac_addr_lo = 0; + mac_addr_hi = 0; + + if (ha) { + mac_addr = (u8 *)&mac_addr_lo; + mac_addr[0] = ha->addr[0]; + mac_addr[1] = ha->addr[1]; + mac_addr[2] = ha->addr[2]; + mac_addr[3] = ha->addr[3]; + mac_addr = (u8 *)&mac_addr_hi; + mac_addr[0] = ha->addr[4]; + mac_addr[1] = ha->addr[5]; + + netif_dbg(pdata, drv, pdata->netdev, + "adding mac address %pM\n", + ha->addr); + netif_dbg(pdata, drv, pdata->netdev, + "adding mac addredd at %#x\n", + *mac_reg); + + mac_addr_hi = FXGMAC_SET_REG_BITS(mac_addr_hi, + MAC_MACA1HR_AE_POS, + MAC_MACA1HR_AE_LEN, + 1); + } + + writereg(pdata->pAdapter, mac_addr_hi, pdata->mac_regs + *mac_reg); + *mac_reg += MAC_MACA_INC; + writereg(pdata->pAdapter, mac_addr_lo, pdata->mac_regs + *mac_reg); + *mac_reg += MAC_MACA_INC; +} +#endif + +static int fxgmac_enable_tx_vlan(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANIR); + /* Indicate that VLAN Tx CTAGs come from mac_vlan_incl register */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_VLTI_POS, + MAC_VLANIR_VLTI_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_CSVL_POS, + MAC_VLANIR_CSVL_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_VLP_POS, + MAC_VLANIR_VLP_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_VLC_POS, + MAC_VLANIR_VLC_LEN, 2); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_VLT_POS, + MAC_VLANIR_VLT_LEN, pdata->vlan); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_VLANIR); + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANTR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_VL_POS, + MAC_VLANTR_VL_LEN, pdata->vlan); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_VLANTR); + + return 0; +} + +static int fxgmac_disable_tx_vlan(struct fxgmac_pdata *pdata) +{ + u32 regval; + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANIR); + + /* Indicate that VLAN Tx CTAGs come from mac_vlan_incl register */ + //Set VLAN Tag input enable + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_CSVL_POS, + MAC_VLANIR_CSVL_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_VLTI_POS, + MAC_VLANIR_VLTI_LEN, /*0*/1); + //Set VLAN priority control disable + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_VLP_POS, + MAC_VLANIR_VLP_LEN, /*1*/0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANIR_VLC_POS, + MAC_VLANIR_VLC_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_VLANIR); + + /* In order for the VLAN Hash Table filtering to be effective, + * the VLAN tag identifier in the VLAN Tag Register must not + * be zero. Set the VLAN tag identifier to "1" to enable the + * VLAN Hash Table filtering. This implies that a VLAN tag of + * 1 will always pass filtering. + */ + //2022-04-19 xiaojiang comment + //If it enable the following code and enable vlan filter, then the MAC only receive the packet of VLAN ID "1" + /*regval = readreg(pdata->mac_regs + MAC_VLANTR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_VL_POS, + MAC_VLANTR_VL_LEN, 1); + writereg(regval, pdata->mac_regs + MAC_VLANTR);*/ + + return 0; +} + +static int fxgmac_enable_rx_vlan_stripping(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANTR); + /* Put the VLAN tag in the Rx descriptor */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_EVLRXS_POS, + MAC_VLANTR_EVLRXS_LEN, 1); + /* Don't check the VLAN type */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_DOVLTC_POS, + MAC_VLANTR_DOVLTC_LEN, 1); + /* Check only C-TAG (0x8100) packets */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_ERSVLM_POS, + MAC_VLANTR_ERSVLM_LEN, 0); + /* Don't consider an S-TAG (0x88A8) packet as a VLAN packet */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_ESVL_POS, + MAC_VLANTR_ESVL_LEN, 0); + /* Enable VLAN tag stripping */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_EVLS_POS, + MAC_VLANTR_EVLS_LEN, 0x3); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_VLANTR); + DPRINTK("fxgmac enable MAC rx vlan stripping , set val = %x\n", regval); + + return 0; +} + +static int fxgmac_disable_rx_vlan_stripping(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANTR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_EVLS_POS, + MAC_VLANTR_EVLS_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_VLANTR); + DPRINTK("fxgmac disable MAC rx vlan stripping, set val = %x\n", regval); + + return 0; +} + +static int fxgmac_enable_rx_vlan_filtering(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PFR); + /* Enable VLAN filtering */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_PFR_VTFE_POS, + MAC_PFR_VTFE_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PFR); + +//2022-04-25 xiaojiang comment +//FXGMAC_FILTER_SINGLE_VLAN_ENABLED is used for Linux driver +//In Linux driver it uses VLAN Filter to filter packet, In windows driver it uses SW method to filter packet. +#if FXGMAC_FILTER_SINGLE_VLAN_ENABLED + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANTR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_VL_POS, + MAC_VLANTR_VL_LEN, pdata->vlan); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_VLANTR); +#else + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANTR); + /* Enable VLAN Hash Table filtering */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_VTHM_POS, + MAC_VLANTR_VTHM_LEN, 1); + /* Disable VLAN tag inverse matching */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_VTIM_POS, + MAC_VLANTR_VTIM_LEN, 0); + /* Only filter on the lower 12-bits of the VLAN tag */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_ETV_POS, + MAC_VLANTR_ETV_LEN, 1); +#endif + + return 0; +} + +static int fxgmac_disable_rx_vlan_filtering(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PFR); + /* Disable VLAN filtering */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_PFR_VTFE_POS, + MAC_PFR_VTFE_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PFR); + +#if FXGMAC_FILTER_SINGLE_VLAN_ENABLED + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANTR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANTR_VL_POS, + MAC_VLANTR_VL_LEN, pdata->vlan); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_VLANTR); +#endif + + return 0; +} + +#if FXGMAC_FILTER_MULTIPLE_VLAN_ENABLED +static u32 fxgmac_vid_crc32_le(__le16 vid_le) +{ + unsigned char *data = (unsigned char *)&vid_le; + unsigned char data_byte = 0; + u32 crc = ~0; + u32 temp = 0; + int i, bits; + + bits = get_bitmask_order(VLAN_VID_MASK); + for (i = 0; i < bits; i++) { + if ((i % 8) == 0) + data_byte = data[i / 8]; + + temp = ((crc & 1) ^ data_byte) & 1; + crc >>= 1; + data_byte >>= 1; + + if (temp) + crc ^= CRC32_POLY_LE; + } + + return crc; +} +#endif + +static int fxgmac_update_vlan_hash_table(struct fxgmac_pdata *pdata) +{ + u16 vlan_hash_table = 0; + u32 regval; + //Linux also support multiple VLAN +#if FXGMAC_FILTER_MULTIPLE_VLAN_ENABLED + __le16 vid_le; + u32 crc; + u16 vid; + /* Generate the VLAN Hash Table value */ + for_each_set_bit(vid, pdata->active_vlans, VLAN_N_VID) { + /* Get the CRC32 value of the VLAN ID */ + vid_le = cpu_to_le16(vid); + crc = bitrev32(~fxgmac_vid_crc32_le(vid_le)) >> 28; + + vlan_hash_table |= (1 << crc); + } +#endif + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_VLANHTR); + /* Set the VLAN Hash Table filtering register */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_VLANHTR_VLHT_POS, + MAC_VLANHTR_VLHT_LEN, vlan_hash_table); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_VLANHTR); + + DPRINTK("fxgmac_update_vlan_hash_tabl done,hash tbl=%08x.\n",vlan_hash_table); + return 0; +} + +static int fxgmac_set_promiscuous_mode(struct fxgmac_pdata *pdata, + unsigned int enable) +{ + unsigned int val = enable ? 1 : 0; + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PFR); + + if (FXGMAC_GET_REG_BITS(regval, MAC_PFR_PR_POS, MAC_PFR_PR_LEN) == val) { + return 0; + } + netif_dbg(pdata, drv, pdata->netdev, ""STR_FORMAT" promiscuous mode\n", + enable ? "entering" : "leaving"); + + regval = FXGMAC_SET_REG_BITS(regval, MAC_PFR_PR_POS, MAC_PFR_PR_LEN, val); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PFR); + + DbgPrintF(MP_TRACE, "promiscuous mode=%d", enable); + DbgPrintF(MP_TRACE, "set val = %x", regval); + DbgPrintF(MP_TRACE, "note, vlan filter is called when set promiscuous mode=%d", enable); + + /* Hardware will still perform VLAN filtering in promiscuous mode */ + if (enable) { + fxgmac_disable_rx_vlan_filtering(pdata); + } else { + if (FXGMAC_RX_VLAN_FILTERING_ENABLED) + { + fxgmac_enable_rx_vlan_filtering(pdata); + } + } + + DPRINTK("fxgmac set promisc mode=%d\n", enable); + return 0; +} + +static int fxgmac_enable_rx_broadcast(struct fxgmac_pdata *pdata, + unsigned int enable) +{ + unsigned int val = enable ? 0 : 1; //mac reg bit is disable,,so invert the val. + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PFR); + + if (FXGMAC_GET_REG_BITS(regval, MAC_PFR_DBF_POS, MAC_PFR_DBF_LEN) == val) { + return 0; + } + + regval = FXGMAC_SET_REG_BITS(regval, MAC_PFR_DBF_POS, MAC_PFR_DBF_LEN, val); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PFR); + + DbgPrintF(MP_TRACE, "bcast en=%d", enable); + DbgPrintF(MP_TRACE, "bit-val=%d", val); + DbgPrintF(MP_TRACE, "reg=%x", regval); + return 0; +} + +static int fxgmac_set_all_multicast_mode(struct fxgmac_pdata *pdata, + unsigned int enable) +{ + unsigned int val = enable ? 1 : 0; + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PFR); + if (FXGMAC_GET_REG_BITS(regval, MAC_PFR_PM_POS, MAC_PFR_PM_LEN) == val) { + return 0; + } + netif_dbg(pdata, drv, pdata->netdev, ""STR_FORMAT" allmulti mode\n", + enable ? "entering" : "leaving"); + + regval = FXGMAC_SET_REG_BITS(regval, MAC_PFR_PM_POS, MAC_PFR_PM_LEN, val); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PFR); + + DbgPrintF(MP_TRACE, "Enable all Multicast=%d", enable); + DbgPrintF(MP_TRACE, "set val = %#x.", regval); + + return 0; +} + +static void fxgmac_set_mac_addn_addrs(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK +#if FXGMAC_FILTER_MULTIPLE_MAC_ADDR_ENABLED + struct net_device *netdev = pdata->netdev; + struct netdev_hw_addr *ha; +#endif + u32 addn_macs; + unsigned int mac_reg; + + mac_reg = MAC_MACA1HR; + addn_macs = pdata->hw_feat.addn_mac; +#if FXGMAC_FILTER_MULTIPLE_MAC_ADDR_ENABLED + DPRINTK("xlgamc add mac addr callin\n"); + if (netdev_uc_count(netdev) > addn_macs) { + fxgmac_set_promiscuous_mode(pdata, 1); + } else { + netdev_for_each_uc_addr(ha, netdev) { + fxgmac_set_mac_reg(pdata, ha, &mac_reg); + addn_macs--; + } + + if (netdev_mc_count(netdev) > addn_macs) { + fxgmac_set_all_multicast_mode(pdata, 1); + } else { + netdev_for_each_mc_addr(ha, netdev) { + fxgmac_set_mac_reg(pdata, ha, &mac_reg); + addn_macs--; + } + } + } +#endif + /* Clear remaining additional MAC address entries */ + while (addn_macs--) { + fxgmac_set_mac_reg(pdata, NULL, &mac_reg); + } +#else + (void)pdata; +#endif +} + +#define GET_REG_AND_BIT_POS(reversalval, regOut, bitOut) \ + do { \ + regOut = (((reversalval) >> 5) & 0x7); \ + bitOut = ((reversalval) & 0x1f); \ + }while(0) + +#ifndef CRC32_POLY_LE +#define CRC32_POLY_LE 0xedb88320 +#endif +static u32 fxgmac_crc32(unsigned char *Data, int Length) +{ + u32 Crc = (u32)~0; /* Initial value. 0xFFFFFFFF */ + + while (--Length >= 0) { + unsigned char Byte = *Data++; + int Bit; + + for (Bit = 8; --Bit >= 0; Byte >>= 1) { + if ((Crc ^ Byte) & 1) { + Crc >>= 1; + Crc ^= CRC32_POLY_LE; + } + else { + Crc >>= 1; + } + } + } + + return ~Crc; +} + +/* + * configure multicast hash table, reg 0x2010~202c + * input: pmc_mac, pointer to mcast MAC. if it is null, then clean all registers. + * b_add, 1 to set the bit; 0 to clear the bit. + */ +static void fxgmac_config_multicast_mac_hash_table(struct fxgmac_pdata *pdata, unsigned char *pmc_mac, int b_add) +{ + u32 hash_reg, reg_bit; + unsigned int j; + u32 crc, reversal_crc, regval; + + if(!pmc_mac) + { + for(j = 0; j < FXGMAC_MAC_HASH_TABLE_SIZE; j++) + { + hash_reg = j; + hash_reg = (MAC_HTR0 + hash_reg * MAC_HTR_INC); + writereg(pdata->pAdapter, 0, pdata->mac_regs + hash_reg); + //DBGPRINT(MP_TRACE, ("fxgmac_config_mcast_mac_hash_table, reg %04x=0x%x\n", FXGMAC_MAC_REGS_OFFSET + hash_reg, readreg(pdata->mac_regs + hash_reg))); + } + DBGPRINT(MP_TRACE, ("fxgmac_config_mcast_mac_hash_table, clear all mcast mac hash table size %d", j)); + return; + } + + crc = fxgmac_crc32 (pmc_mac, ETH_ALEN); + + /* reverse the crc */ + for(j = 0, reversal_crc = 0; j < 32; j++) + { + if(crc & ((u32)1 << j)) reversal_crc |= ((u32)1 << (31 - j)); + } + + GET_REG_AND_BIT_POS((reversal_crc>>24), hash_reg, reg_bit); + /* Set the MAC Hash Table registers */ + hash_reg = (MAC_HTR0 + hash_reg * MAC_HTR_INC); + regval = readreg(pdata->pAdapter, pdata->mac_regs + hash_reg); + + regval = FXGMAC_SET_REG_BITS(regval, reg_bit, 1, (b_add ? 1 : 0)); + + writereg(pdata->pAdapter, regval, pdata->mac_regs + hash_reg); +} + +static void fxgmac_set_mac_hash_table(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK +#if FXGMAC_MAC_HASH_TABLE + struct net_device *netdev = pdata->netdev; + struct netdev_hw_addr *ha; + + fxgmac_config_multicast_mac_hash_table(pdata, (unsigned char *)0, 1); + netdev_for_each_mc_addr(ha, netdev) + { + fxgmac_config_multicast_mac_hash_table(pdata, ha->addr, 1); + } +#else + (void)pdata; +#endif +#else + (void)pdata; +#endif +} + +static int fxgmac_set_mc_addresses(struct fxgmac_pdata *pdata) +{ + if (pdata->hw_feat.hash_table_size) + fxgmac_set_mac_hash_table(pdata); + else + fxgmac_set_mac_addn_addrs(pdata); + + return 0; +} + +static void fxgmac_set_multicast_mode(struct fxgmac_pdata *pdata, + unsigned int enable) +{ + if (enable) + fxgmac_set_mc_addresses(pdata); + else + fxgmac_config_multicast_mac_hash_table(pdata, (unsigned char *)0, 1); +} + +static void fxgmac_config_mac_address(struct fxgmac_pdata *pdata) +{ + u32 regval; + //KdBreakPoint(); + fxgmac_set_mac_address(pdata, pdata->mac_addr); + //fxgmac_set_mac_address(pdata, (u8*)"\x00\x55\x7b\xb5\x7d\xf7");// pdata->netdev->dev_addr); + //fxgmac_set_mac_address(pdata, (u8*)"\xf7\x7d\xb5\x7b\x55\x00"); + + /* Filtering is done using perfect filtering and hash filtering */ + if (pdata->hw_feat.hash_table_size) { + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PFR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PFR_HPF_POS, + MAC_PFR_HPF_LEN, 1); +#if FXGMAC_MAC_HASH_TABLE + regval = FXGMAC_SET_REG_BITS(regval, MAC_PFR_HUC_POS, + MAC_PFR_HUC_LEN, 1); +#endif + regval = FXGMAC_SET_REG_BITS(regval, MAC_PFR_HMC_POS, + MAC_PFR_HMC_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PFR); + } +} + +static int fxgmac_config_crc_check(struct fxgmac_pdata *pdata) +{ + u32 regval, value; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_ECR); + value = (pdata->crc_check) ? 0 : 1; + regval = FXGMAC_SET_REG_BITS(regval, MAC_ECR_DCRCC_POS, + MAC_ECR_DCRCC_LEN, value); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_ECR); + + return 0; +} + +static int fxgmac_config_jumbo(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_JE_POS, + MAC_CR_JE_LEN, pdata->jumbo); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + return 0; +} + +static void fxgmac_config_checksum_offload(struct fxgmac_pdata *pdata) +{ + if (FXGMAC_RX_CHECKSUM_ENABLED) + fxgmac_enable_rx_csum(pdata); + else + fxgmac_disable_rx_csum(pdata); +} + +static void fxgmac_config_vlan_support(struct fxgmac_pdata *pdata) +{ + /*if (pdata->vlan_exist) + fxgmac_enable_tx_vlan(pdata); + else*/ + fxgmac_disable_tx_vlan(pdata); // configure dynamical vlanID from TX Context. + + /* Set the current VLAN Hash Table register value */ + fxgmac_update_vlan_hash_table(pdata); + + //2022-04-26 xiaojiang comment + //Windows driver set vlan_filter disable, but in Linux driver it enable vlan_filter + if (pdata->vlan_filter) //disable vlan rx filter by default + fxgmac_enable_rx_vlan_filtering(pdata); + else + fxgmac_disable_rx_vlan_filtering(pdata); + + if (pdata->vlan_strip) //enable vlan rx strip by default + fxgmac_enable_rx_vlan_stripping(pdata); + else + fxgmac_disable_rx_vlan_stripping(pdata); + +} + +static int fxgmac_config_rx_mode(struct fxgmac_pdata *pdata) +{ + unsigned int pr_mode, am_mode, mu_mode, bd_mode; + +#ifndef FXGMAC_NETDEV_MU_MODE_ENABLED +#define FXGMAC_NETDEV_MU_MODE_ENABLED 0 +#endif + +#ifndef FXGMAC_NETDEV_BD_MODE_ENABLED +#define FXGMAC_NETDEV_BD_MODE_ENABLED 0 +#endif + + pr_mode = FXGMAC_NETDEV_PR_MODE_ENABLED; + am_mode = FXGMAC_NETDEV_AM_MODE_ENABLED; + mu_mode = FXGMAC_NETDEV_MU_MODE_ENABLED; + bd_mode = FXGMAC_NETDEV_BD_MODE_ENABLED; + + fxgmac_enable_rx_broadcast(pdata, bd_mode); + fxgmac_set_promiscuous_mode(pdata, pr_mode); + fxgmac_set_all_multicast_mode(pdata, am_mode); + fxgmac_set_multicast_mode(pdata, mu_mode); + + return 0; +} + +static void fxgmac_prepare_tx_stop(struct fxgmac_pdata *pdata, + struct fxgmac_channel *channel) +{ +#ifdef FXGMAC_WAIT_TX_STOP + unsigned int tx_dsr, tx_pos, tx_qidx; + unsigned long tx_timeout; + unsigned int tx_status = 0; + + (void)pdata; + + /* Calculate the status register to read and the position within */ + if (channel->queue_index < DMA_DSRX_FIRST_QUEUE) { + tx_dsr = DMA_DSR0; + tx_pos = (channel->queue_index * DMA_DSR_Q_LEN) + + DMA_DSR0_TPS_START; + } else { + tx_qidx = channel->queue_index - DMA_DSRX_FIRST_QUEUE; + + tx_dsr = DMA_DSR1 + ((tx_qidx / DMA_DSRX_QPR) * DMA_DSRX_INC); + tx_pos = ((tx_qidx % DMA_DSRX_QPR) * DMA_DSR_Q_LEN) + + DMA_DSRX_TPS_START; + } + //2022-04-19 xiaojiang comment + //Windows os not have wait Tx Stop operation. + /* The Tx engine cannot be stopped if it is actively processing + * descriptors. Wait for the Tx engine to enter the stopped or + * suspended state. Don't wait forever though... + */ +#if FXGMAC_TX_HANG_TIMER_ENABLED + tx_timeout = jiffies + msecs_to_jiffies(100); /* 100ms */ +#else + tx_timeout = jiffies + (FXGMAC_DMA_STOP_TIMEOUT * HZ); +#endif + while (time_before(jiffies, tx_timeout)) { + tx_status = readreg(pdata->pAdapter, pdata->mac_regs + tx_dsr); + tx_status = FXGMAC_GET_REG_BITS(tx_status, tx_pos, + DMA_DSR_TPS_LEN); + if ((tx_status == DMA_TPS_STOPPED) || + (tx_status == DMA_TPS_SUSPENDED)) + break; + + usleep_range_ex(pdata->pAdapter, 500, 1000); + } + + if (!time_before(jiffies, tx_timeout)) + netdev_info(pdata->netdev, + "timed out waiting for Tx DMA channel %u to stop, status = 0x%x\n", + channel->queue_index, tx_status); +#else + (void)pdata; + (void)channel; +#endif +} + +static void fxgmac_enable_tx(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; +#endif + unsigned int i; + u32 regval; + +#if FXGMAC_TX_HANG_TIMER_ENABLED + pdata->tx_hang_restart_queuing = 0; +#endif + + /* Enable each Tx DMA channel */ +#ifndef DPDK + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { +#ifndef UBOOT //uboot unuse tx_ring + if (!channel->tx_ring) + break; +#endif + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_TCR_ST_POS, + DMA_CH_TCR_ST_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + } +#else + PMD_INIT_FUNC_TRACE(); + struct fxgmac_tx_queue *txq; + struct rte_eth_dev *dev = pdata->expansion.eth_dev; + + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + if (!txq) { + DPRINTK("Tx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return; + } + + /* Enable Tx DMA channel */ + FXGMAC_DMA_IOWRITE_BITS(txq, DMA_CH_TCR, ST, 1); + } +#endif + + /* Enable each Tx queue */ + for (i = 0; i < pdata->tx_q_count; i++) { + +#if FXGMAC_FAKE_4_TX_QUEUE_ENABLED + if (i>0) + break; +#endif + + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_TQOMR_TXQEN_POS, + MTL_Q_TQOMR_TXQEN_LEN, + MTL_Q_ENABLED); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + } + + /* Enable MAC Tx */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_TE_POS, + MAC_CR_TE_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); +} + +static void fxgmac_disable_tx(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; +#endif + unsigned int i; + u32 regval; + + /* Prepare for Tx DMA channel stop */ +#ifndef DPDK + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) + break; + + fxgmac_prepare_tx_stop(pdata, channel); + +#if FXGMAC_TX_HANG_TIMER_ENABLED + pdata->tx_hang_restart_queuing = 0; +#endif + } + } + +#else + PMD_INIT_FUNC_TRACE(); + struct fxgmac_tx_queue *txq; + struct rte_eth_dev *dev = pdata->expansion.eth_dev; + + for (i = 0; i < pdata->tx_q_count; i++) { + txq = dev->data->tx_queues[i]; + if (!txq) { + DPRINTK("Tx queue not setup for port %d\n", + dev->data->port_id); + return; + } + + fxgmac_txq_prepare_tx_stop(pdata, i); + } +#endif + + /* Disable MAC Tx */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_TE_POS, + MAC_CR_TE_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + /* Disable each Tx queue */ + for (i = 0; i < pdata->tx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_TQOMR_TXQEN_POS, + MTL_Q_TQOMR_TXQEN_LEN, 0); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + } + + /* Disable each Tx DMA channel */ +#ifndef DPDK + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_TCR_ST_POS, + DMA_CH_TCR_ST_LEN, 0); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + } + } +#else + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + if (!txq) { + DPRINTK("Tx queue not setup for port %d\n", + dev->data->port_id); + return; + } + + FXGMAC_DMA_IOWRITE_BITS(txq, DMA_CH_TCR, ST, 0); + } +#endif +} + +static void fxgmac_prepare_rx_stop(struct fxgmac_pdata *pdata, + unsigned int queue) +{ + u32 rx_status, prxq = 0; +#if defined(FXGMAC_WAIT_RX_STOP_BY_PRXQ_RXQSTS) + unsigned int rxqsts; + unsigned long rx_timeout; + + /* The Rx engine cannot be stopped if it is actively processing + * packets. Wait for the Rx queue to empty the Rx fifo. Don't + * wait forever though... + */ +#if FXGMAC_TX_HANG_TIMER_ENABLED + rx_timeout = jiffies + msecs_to_jiffies(500); /* 500ms, larger is better */ +#else + rx_timeout = jiffies + (FXGMAC_DMA_STOP_TIMEOUT * HZ); +#endif + while (time_before(jiffies, rx_timeout)) { + rx_status = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, queue, MTL_Q_RQDR)); + prxq = FXGMAC_GET_REG_BITS(rx_status, MTL_Q_RQDR_PRXQ_POS, + MTL_Q_RQDR_PRXQ_LEN); + rxqsts = FXGMAC_GET_REG_BITS(rx_status, MTL_Q_RQDR_RXQSTS_POS, + MTL_Q_RQDR_RXQSTS_LEN); + if ((prxq == 0) && (rxqsts == 0)) + break; + + usleep_range_ex(pdata->pAdapter, 500, 1000); + } + + if (!time_before(jiffies, rx_timeout)) + netdev_info(pdata->netdev, + "timed out waiting for Rx queue %u to empty, %d packets in fifo\n", + queue, prxq); +#else + unsigned int busy = 100; + do { + rx_status = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, queue, MTL_Q_RQDR)); + prxq = FXGMAC_GET_REG_BITS(rx_status, MTL_Q_RQDR_PRXQ_POS, MTL_Q_RQDR_PRXQ_LEN); + busy--; + usleep_range_ex(pdata->pAdapter, 500, 1000); + } while ((prxq) && (busy)); + if (0 == busy) { + rx_status = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, queue, MTL_Q_RQDR)); + DbgPrintF(MP_WARN, "warning !!!timed out waiting for Rx queue %u to empty\n", queue); + } +#endif +} + +static void fxgmac_enable_rx(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; +#endif + unsigned int i; + u32 regval; + + /* Enable each Rx DMA channel */ +#ifndef DPDK + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { +#ifndef UBOOT //uboot unuse rx_ring + if (!channel->rx_ring) + break; +#endif + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_RCR_SR_POS, + DMA_CH_RCR_SR_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + } + +#else + PMD_INIT_FUNC_TRACE(); + struct fxgmac_rx_queue *rxq; + struct rte_eth_dev *dev = pdata->expansion.eth_dev; + //struct fxgmac_pdata *pdata = pdata->dev->data->dev_private; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + if (!rxq) { + DPRINTK("Rx queue not setup for port %d\n", + dev->data->port_id); + return; + } + /* Enable Rx DMA channel */ + FXGMAC_DMA_IOWRITE_BITS(rxq, DMA_CH_RCR, SR, 1); + } +#endif + + /* Enable each Rx queue */ + regval = 0; + for (i = 0; i < pdata->rx_q_count; i++) + regval |= (0x02 << (i << 1)); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_RQC0R); + +#ifndef DPDK + /* Enable MAC Rx */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_CST_POS, + MAC_CR_CST_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_ACS_POS, + MAC_CR_ACS_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_RE_POS, + MAC_CR_RE_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); +#else + /* Enable MAC Rx */ + // FXGMAC_IOWRITE_BITS(pdata, MAC_ECR, DCRCC, 1); + + /* Frame is forwarded after stripping CRC to application*/ + if (pdata->expansion.crc_strip_enable) { + FXGMAC_IOWRITE_BITS(pdata, MAC_CR, CST, 1); + FXGMAC_IOWRITE_BITS(pdata, MAC_CR, ACS, 1); + } + FXGMAC_IOWRITE_BITS(pdata, MAC_CR, RE, 1); +#endif +} +static void fxgmac_enable_channel_rx(struct fxgmac_pdata* pdata, unsigned int queue) +{ + struct fxgmac_channel* channel; + u32 regval; + + /* Enable Rx DMA channel */ + channel = pdata->channel_head + queue; + + if (!channel->rx_ring) + return; + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_RCR_SR_POS, + DMA_CH_RCR_SR_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + /* Enable Rx queue */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_RQC0R); + regval |= (0x02 << (queue << 1)); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_RQC0R); + + /* Enable MAC Rx */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + if (!(regval&((0x01<< MAC_CR_CST_POS)|(0x01 << MAC_CR_ACS_POS)|(0x01<< MAC_CR_RE_POS)))) + { + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_CST_POS, + MAC_CR_CST_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_ACS_POS, + MAC_CR_ACS_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_RE_POS, + MAC_CR_RE_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + } +} + +static void fxgmac_disable_rx(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; +#endif + unsigned int i; + u32 regval; + + /* Disable MAC Rx */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_CST_POS, + MAC_CR_CST_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_ACS_POS, + MAC_CR_ACS_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_RE_POS, + MAC_CR_RE_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + /* Prepare for Rx DMA channel stop */ +#ifndef DPDK + for (i = 0; i < pdata->rx_q_count; i++) + fxgmac_prepare_rx_stop(pdata, i); +#else + PMD_INIT_FUNC_TRACE(); + struct fxgmac_rx_queue *rxq; + struct rte_eth_dev *dev = pdata->expansion.eth_dev; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + if (!rxq) { + DPRINTK("Rx queue not setup for port %d\n", + dev->data->port_id); + return; + } + + fxgmac_prepare_rx_stop(pdata, i); + } +#endif + + /* Disable each Rx queue */ + writereg(pdata->pAdapter, 0, pdata->mac_regs + MAC_RQC0R); + + /* Disable each Rx DMA channel */ +#ifndef DPDK + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->rx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_RCR_SR_POS, + DMA_CH_RCR_SR_LEN, 0); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + } + } +#else + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + if (!rxq) { + DPRINTK("Rx queue not setup for port %d\n", + dev->data->port_id); + return; + } + FXGMAC_DMA_IOWRITE_BITS(rxq, DMA_CH_RCR, SR, 0); + } +#endif +} + +static int fxgmac_is_context_desc(struct fxgmac_dma_desc *dma_desc) +{ + /* Rx and Tx share CTXT bit, so check TDES3.CTXT bit */ + int regval; + regval = (int)FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + TX_NORMAL_DESC3_CTXT_POS, + TX_NORMAL_DESC3_CTXT_LEN); + return regval; +} + +static int fxgmac_is_last_desc(struct fxgmac_dma_desc *dma_desc) +{ + /* Rx and Tx share LD bit, so check TDES3.LD bit */ + int regval; + regval = (int)FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + TX_NORMAL_DESC3_LD_POS, + TX_NORMAL_DESC3_LD_LEN); + return regval; +} + +static int fxgmac_disable_tx_flow_control(struct fxgmac_pdata *pdata) +{ + unsigned int max_q_count, q_count; + unsigned int reg; + unsigned int i; + u32 regval; + + /* Clear MTL flow control */ + for (i = 0; i < pdata->rx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_EHFC_POS, + MTL_Q_RQOMR_EHFC_LEN, 0); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + } + + /* Clear MAC flow control */ + max_q_count = FXGMAC_MAX_FLOW_CONTROL_QUEUES; + q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); + reg = MAC_Q0TFCR; + for (i = 0; i < q_count; i++) { + regval = readreg(pdata->pAdapter, pdata->mac_regs + reg); + regval = FXGMAC_SET_REG_BITS(regval, + MAC_Q0TFCR_TFE_POS, + MAC_Q0TFCR_TFE_LEN, + 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + reg); + + reg += MAC_QTFCR_INC; + } + + return 0; +} + +static int fxgmac_enable_tx_flow_control(struct fxgmac_pdata *pdata) +{ + unsigned int max_q_count, q_count; + unsigned int reg; + unsigned int i; + u32 regval; + + /* Set MTL flow control */ + for (i = 0; i < pdata->rx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_EHFC_POS, + MTL_Q_RQOMR_EHFC_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + } + + /* Set MAC flow control */ + max_q_count = FXGMAC_MAX_FLOW_CONTROL_QUEUES; + q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); + reg = MAC_Q0TFCR; + for (i = 0; i < q_count; i++) { + regval = readreg(pdata->pAdapter, pdata->mac_regs + reg); + + /* Enable transmit flow control */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_Q0TFCR_TFE_POS, + MAC_Q0TFCR_TFE_LEN, 1); + /* Set pause time */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_Q0TFCR_PT_POS, + MAC_Q0TFCR_PT_LEN, 0xffff); + + writereg(pdata->pAdapter, regval, pdata->mac_regs + reg); + + reg += MAC_QTFCR_INC; + } + + return 0; +} + +static int fxgmac_disable_rx_flow_control(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_RFCR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_RFCR_RFE_POS, + MAC_RFCR_RFE_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_RFCR); + + return 0; +} + +static int fxgmac_enable_rx_flow_control(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_RFCR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_RFCR_RFE_POS, + MAC_RFCR_RFE_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_RFCR); + + return 0; +} + +static int fxgmac_config_tx_flow_control(struct fxgmac_pdata *pdata) +{ + if (pdata->tx_pause) + fxgmac_enable_tx_flow_control(pdata); + else + fxgmac_disable_tx_flow_control(pdata); + + return 0; +} + +static int fxgmac_config_rx_flow_control(struct fxgmac_pdata *pdata) +{ + if (pdata->rx_pause) + fxgmac_enable_rx_flow_control(pdata); + else + fxgmac_disable_rx_flow_control(pdata); + + return 0; +} + +static int fxgmac_config_rx_coalesce(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; + unsigned int i; + u32 regval; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->rx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RIWT)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_RIWT_RWT_POS, + DMA_CH_RIWT_RWT_LEN, + pdata->rx_riwt); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_RIWT)); + } +#else + struct fxgmac_rx_queue *rxq; + unsigned int i; + + for (i = 0; i < pdata->expansion.eth_dev->data->nb_rx_queues; i++) { + rxq = pdata->expansion.eth_dev->data->rx_queues[i]; + if (!rxq) { + DPRINTK("Rx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return -1; + } + FXGMAC_DMA_IOWRITE_BITS(rxq, DMA_CH_RIWT, RWT, pdata->rx_riwt); + } +#endif + + return 0; +} + +static void fxgmac_config_rx_fep_disable(struct fxgmac_pdata *pdata) +{ + unsigned int i; + u32 regval; + + for (i = 0; i < pdata->rx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_FEP_POS, + MTL_Q_RQOMR_FEP_LEN, MTL_FEP_ENABLE);// 1:enable the rx queue forward packet with error status(crc error,gmii_er,watch dog timeout.or overflow) + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + } +} + +static void fxgmac_config_rx_fup_enable(struct fxgmac_pdata *pdata) +{ + unsigned int i; + u32 regval; + + for (i = 0; i < pdata->rx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_FUP_POS, + MTL_Q_RQOMR_FUP_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + } +} + +static int fxgmac_config_tx_coalesce(struct fxgmac_pdata *pdata) +{ + (void)pdata; + return 0; +} + +static void fxgmac_config_rx_buffer_size(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; + unsigned int i; + u32 regval; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->rx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_RCR_RBSZ_POS, + DMA_CH_RCR_RBSZ_LEN, + pdata->rx_buf_size); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + } +#else + struct fxgmac_rx_queue *rxq; + unsigned int i; + + for (i = 0; i < pdata->expansion.eth_dev->data->nb_rx_queues; i++) { + rxq = pdata->expansion.eth_dev->data->rx_queues[i]; + if (!rxq) { + DPRINTK("Rx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return; + } + + rxq->buf_size = rte_pktmbuf_data_room_size(rxq->mb_pool) - + RTE_PKTMBUF_HEADROOM; + rxq->buf_size = (rxq->buf_size + FXGMAC_RX_BUF_ALIGN - 1) & + ~(FXGMAC_RX_BUF_ALIGN - 1); + + if (rxq->buf_size > pdata->rx_buf_size) + pdata->rx_buf_size = rxq->buf_size; + + FXGMAC_DMA_IOWRITE_BITS(rxq, DMA_CH_RCR, RBSZ, rxq->buf_size); + } +#endif +} + +static void fxgmac_config_tso_mode(struct fxgmac_pdata *pdata) +{ + u32 tso; +#ifndef DPDK + struct fxgmac_channel *channel; + unsigned int i; + u32 regval; + tso = pdata->hw_feat.tso; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_TCR_TSE_POS, + DMA_CH_TCR_TSE_LEN, tso); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + } +#else + struct fxgmac_tx_queue *txq; + unsigned int i; + tso = pdata->hw_feat.tso; + for (i = 0; i < pdata->expansion.eth_dev->data->nb_tx_queues; i++) { + txq = pdata->expansion.eth_dev->data->tx_queues[i]; + if (!txq) { + DPRINTK("Tx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return; + } + + FXGMAC_DMA_IOWRITE_BITS(txq, DMA_CH_TCR, TSE, tso); + } +#endif +} + +static void fxgmac_config_sph_mode(struct fxgmac_pdata *pdata) +{ + unsigned int i; + u32 regval; + +#ifndef DPDK + struct fxgmac_channel *channel; + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->rx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_CR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_CR_SPH_POS, + DMA_CH_CR_SPH_LEN, 0); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_CR)); + } +#else + struct fxgmac_rx_queue *rxq; + + for (i = 0; i < pdata->expansion.eth_dev->data->nb_rx_queues; i++) { + rxq = pdata->expansion.eth_dev->data->rx_queues[i]; + if (!rxq) { + DPRINTK("Rx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return; + } + FXGMAC_DMA_IOWRITE_BITS(rxq, DMA_CH_CR, SPH, 0); + } +#endif + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_ECR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_ECR_HDSMS_POS, + MAC_ECR_HDSMS_LEN, + FXGMAC_SPH_HDSMS_SIZE); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_ECR); +} + +static unsigned long fxgmac_usec_to_riwt(struct fxgmac_pdata *pdata, + unsigned int usec) +{ + unsigned long rate; + unsigned long ret; + + rate = pdata->sysclk_rate; + + /* Convert the input usec value to the watchdog timer value. Each + * watchdog timer value is equivalent to 256 clock cycles. + * Calculate the required value as: + * ( usec * ( system_clock_mhz / 10^6 ) / 256 + */ + ret = (usec * (rate / 1000000)) / 256; + + return ret; +} + +static unsigned long fxgmac_riwt_to_usec(struct fxgmac_pdata *pdata, + unsigned int riwt) +{ + unsigned long rate; + unsigned long ret; + + rate = pdata->sysclk_rate; + + /* Convert the input watchdog timer value to the usec value. Each + * watchdog timer value is equivalent to 256 clock cycles. + * Calculate the required value as: + * ( riwt * 256 ) / ( system_clock_mhz / 10^6 ) + */ + ret = (riwt * 256) / (rate / 1000000); + + return ret; +} + +static int fxgmac_config_rx_threshold(struct fxgmac_pdata *pdata, + unsigned int val) +{ + unsigned int i; + u32 regval; + + for (i = 0; i < pdata->rx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_RTC_POS, + MTL_Q_RQOMR_RTC_LEN, val); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + } + + return 0; +} + +static void fxgmac_config_mtl_mode(struct fxgmac_pdata *pdata) +{ + unsigned int i; + u32 regval; + + /* Set Tx to weighted round robin scheduling algorithm */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MTL_OMR); + regval = FXGMAC_SET_REG_BITS(regval, MTL_OMR_ETSALG_POS, + MTL_OMR_ETSALG_LEN, MTL_ETSALG_WRR); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MTL_OMR); +#if 1 + /* Set Tx traffic classes to use WRR algorithm with equal weights */ + for (i = 0; i < pdata->tx_q_count/*hw_feat.tc_cnt*/; i++) { + //regval = readreg(FXGMAC_MTL_REG(pdata, i, MTL_TC_ETSCR)); + //regval = FXGMAC_SET_REG_BITS(regval, MTL_TC_ETSCR_TSA_POS, + // MTL_TC_ETSCR_TSA_LEN, MTL_TSA_ETS); + //writereg(regval, FXGMAC_MTL_REG(pdata, i, MTL_TC_ETSCR)); + + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_TC_QWR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_TC_QWR_QW_POS, + MTL_TC_QWR_QW_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_TC_QWR)); + } +#endif + /* Set Rx to strict priority algorithm */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MTL_OMR); + regval = FXGMAC_SET_REG_BITS(regval, MTL_OMR_RAA_POS, + MTL_OMR_RAA_LEN, MTL_RAA_SP); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MTL_OMR); +} + +static void fxgmac_config_queue_mapping(struct fxgmac_pdata *pdata) +{ + unsigned int ppq, ppq_extra, prio, prio_queues; + //unsigned int qptc, qptc_extra; + unsigned int reg; + unsigned int mask; + unsigned int i, j; + u32 regval; + + /* Map the MTL Tx Queues to Traffic Classes + * Note: Tx Queues >= Traffic Classes + */ +#if 0 + unsigned int queue; + qptc = pdata->tx_q_count / pdata->hw_feat.tc_cnt; + qptc_extra = pdata->tx_q_count % pdata->hw_feat.tc_cnt; + for (i = 0, queue = 0; i < pdata->hw_feat.tc_cnt; i++) { + for (j = 0; j < qptc; j++) { + netif_dbg(pdata, drv, pdata->netdev, + "TXq%u mapped to TC%u\n", queue, i); + regval = readreg(FXGMAC_MTL_REG(pdata, queue, + MTL_Q_TQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, + MTL_Q_TQOMR_Q2TCMAP_POS, + MTL_Q_TQOMR_Q2TCMAP_LEN, + i); + writereg(regval, FXGMAC_MTL_REG(pdata, queue, + MTL_Q_TQOMR)); + queue++; + } + + if (i < qptc_extra) { + netif_dbg(pdata, drv, pdata->netdev, + "TXq%u mapped to TC%u\n", queue, i); + regval = readreg(FXGMAC_MTL_REG(pdata, queue, + MTL_Q_TQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, + MTL_Q_TQOMR_Q2TCMAP_POS, + MTL_Q_TQOMR_Q2TCMAP_LEN, + i); + writereg(regval, FXGMAC_MTL_REG(pdata, queue, + MTL_Q_TQOMR)); + queue++; + } + } +#else + //queue = 0; + //DPRINTK("need to map TXq(%u) to TC\n", queue); +#endif + /* Map the 8 VLAN priority values to available MTL Rx queues */ + prio_queues = min_t(unsigned int, IEEE_8021QAZ_MAX_TCS, + pdata->rx_q_count); + ppq = IEEE_8021QAZ_MAX_TCS / prio_queues; + ppq_extra = IEEE_8021QAZ_MAX_TCS % prio_queues; + + reg = MAC_RQC2R; + regval = 0; + for (i = 0, prio = 0; i < prio_queues;) { + mask = 0; + for (j = 0; j < ppq; j++) { + netif_dbg(pdata, drv, pdata->netdev, + "PRIO%u,", prio); + netif_dbg(pdata, drv, pdata->netdev, + " mapped to RXq%u\n", i); + mask |= (1 << prio); + prio++; + } + + if (i < ppq_extra) { + netif_dbg(pdata, drv, pdata->netdev, + "PRIO%u.", i); + netif_dbg(pdata, drv, pdata->netdev, + " mapped to Rxq%u", i); + mask |= (1 << prio); + prio++; + } + + regval |= (mask << ((i++ % MAC_RQC2_Q_PER_REG) << 3)); + + if ((i % MAC_RQC2_Q_PER_REG) && (i != prio_queues)) + continue; + + writereg(pdata->pAdapter, regval, pdata->mac_regs + reg); + reg += MAC_RQC2_INC; + regval = 0; + } + + /* Configure one to one, MTL Rx queue to DMA Rx channel mapping + * ie Q0 <--> CH0, Q1 <--> CH1 ... Q11 <--> CH11 + */ + reg = MTL_RQDCM0R; + regval = readreg(pdata->pAdapter, pdata->mac_regs + reg); + regval |= (MTL_RQDCM0R_Q0MDMACH | MTL_RQDCM0R_Q1MDMACH | + MTL_RQDCM0R_Q2MDMACH | MTL_RQDCM0R_Q3MDMACH); + + if (pdata->rss) + { + /* in version later 0617, need to enable DA-based DMA Channel Selection to let RSS work, + * ie, bit4,12,20,28 for Q0,1,2,3 individual + */ + regval |= (MTL_RQDCM0R_Q0DDMACH | MTL_RQDCM0R_Q1DDMACH | + MTL_RQDCM0R_Q2DDMACH | MTL_RQDCM0R_Q3DDMACH); + } + + writereg(pdata->pAdapter, regval, pdata->mac_regs + reg); + + reg += MTL_RQDCM_INC; + regval = readreg(pdata->pAdapter, pdata->mac_regs + reg); + regval |= (MTL_RQDCM1R_Q4MDMACH | MTL_RQDCM1R_Q5MDMACH | + MTL_RQDCM1R_Q6MDMACH | MTL_RQDCM1R_Q7MDMACH); + writereg(pdata->pAdapter, regval, pdata->mac_regs + reg); +#if 0 + reg += MTL_RQDCM_INC; + regval = readreg(pdata->mac_regs + reg); + regval |= (MTL_RQDCM2R_Q8MDMACH | MTL_RQDCM2R_Q9MDMACH | + MTL_RQDCM2R_Q10MDMACH | MTL_RQDCM2R_Q11MDMACH); + writereg(regval, pdata->mac_regs + reg); +#endif +} + +static u32 fxgmac_calculate_per_queue_fifo( + unsigned long fifo_size, + unsigned int queue_count) +{ + unsigned long q_fifo_size; + unsigned long p_fifo; + + /* Calculate the configured fifo size */ + q_fifo_size = 1 << (fifo_size + 7); + + /* The configured value may not be the actual amount of fifo RAM */ + q_fifo_size = min_t(unsigned int, FXGMAC_MAX_FIFO, q_fifo_size); + + q_fifo_size = q_fifo_size / queue_count; + + /* Each increment in the queue fifo size represents 256 bytes of + * fifo, with 0 representing 256 bytes. Distribute the fifo equally + * between the queues. + */ + p_fifo = q_fifo_size / 256; + if (p_fifo) + p_fifo--; + + return p_fifo; +} + +static u32 fxgmac_calculate_max_checksum_size(struct fxgmac_pdata* pdata) +{ + u32 fifo_size; + + fifo_size = fxgmac_calculate_per_queue_fifo( + pdata->hw_feat.tx_fifo_size, + pdata->tx_q_count); + + /* Each increment in the queue fifo size represents 256 bytes of + * fifo, with 0 representing 256 bytes. Distribute the fifo equally + * between the queues. + */ + fifo_size = (fifo_size + 1) * 256; + + /* Packet size < TxQSize - (PBL + N)*(DATAWIDTH/8), + * Datawidth = 128 + * If Datawidth = 32, N = 7, elseif Datawidth != 32, N = 5. + * TxQSize is indicated by TQS field of MTL_TxQ#_Operation_Mode register + * PBL = TxPBL field in the DMA_CH#_TX_Control register in all DMA configurations. + */ + fifo_size -= (pdata->tx_pbl * (pdata->pblx8 ? 8 : 1) + 5) * (FXGMAC_DATA_WIDTH / 8); + fifo_size -= 256; + + return fifo_size; +} + +static void fxgmac_config_tx_fifo_size(struct fxgmac_pdata *pdata) +{ + u32 fifo_size; + unsigned int i; + u32 regval; + + fifo_size = fxgmac_calculate_per_queue_fifo( + pdata->hw_feat.tx_fifo_size, +#if FXGMAC_FAKE_4_TX_QUEUE_ENABLED + 1);//force to 1 queue +#else + pdata->tx_q_count); +#endif + + for (i = 0; i < pdata->tx_q_count; i++) { +#if FXGMAC_FAKE_4_TX_QUEUE_ENABLED + //DPRINTK("Tx idx > 0,break\n"); + if (i>0) + break; +#endif + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_TQOMR_TQS_POS, + MTL_Q_TQOMR_TQS_LEN, fifo_size); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + } + + netif_info(pdata, drv, pdata->netdev, + "%d Tx hardware queues,", + pdata->tx_q_count); + netif_info(pdata, drv, pdata->netdev, + " %d byte fifo per queue\n", + ((fifo_size + 1) * 256)); +} + +static void fxgmac_config_rx_fifo_size(struct fxgmac_pdata *pdata) +{ + u32 fifo_size; + unsigned int i; + u32 regval; + + fifo_size = fxgmac_calculate_per_queue_fifo( + pdata->hw_feat.rx_fifo_size, + pdata->rx_q_count); + + for (i = 0; i < pdata->rx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_RQS_POS, + MTL_Q_RQOMR_RQS_LEN, fifo_size); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + } + + netif_info(pdata, drv, pdata->netdev, + "%d Rx hardware queues,", + pdata->rx_q_count); + netif_info(pdata, drv, pdata->netdev, + " %d byte fifo per queue\n", + ((fifo_size + 1) * 256)); +} + +static void fxgmac_config_flow_control_threshold(struct fxgmac_pdata *pdata) +{ + unsigned int i; + u32 regval; + + for (i = 0; i < pdata->rx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + /* Activate flow control when less than 4k left in fifo */ + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_RFA_POS, MTL_Q_RQOMR_RFA_LEN, 6); + /* De-activate flow control when more than 6k left in fifo */ + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_RFD_POS, MTL_Q_RQOMR_RFD_LEN, 10); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + } +} + +static int fxgmac_config_tx_threshold(struct fxgmac_pdata *pdata, + unsigned int val) +{ + unsigned int i; + u32 regval; + + for (i = 0; i < pdata->tx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_TQOMR_TTC_POS, + MTL_Q_TQOMR_TTC_LEN, val); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + } + + return 0; +} + +static int fxgmac_config_rsf_mode(struct fxgmac_pdata *pdata, + unsigned int val) +{ + unsigned int i; + u32 regval; + + for (i = 0; i < pdata->rx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_RQOMR_RSF_POS, + MTL_Q_RQOMR_RSF_LEN, val); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_RQOMR)); + } + + return 0; +} + +static int fxgmac_config_tsf_mode(struct fxgmac_pdata *pdata, + unsigned int val) +{ + unsigned int i; + u32 regval; + + for (i = 0; i < pdata->tx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_TQOMR_TSF_POS, + MTL_Q_TQOMR_TSF_LEN, val); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + } + + return 0; +} + +static int fxgmac_config_osp_mode(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; + unsigned int i; + u32 regval; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_TCR_OSP_POS, + DMA_CH_TCR_OSP_LEN, + pdata->tx_osp_mode); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + } +#else + /* Force DMA to operate on second packet before closing descriptors + * of first packet + */ + struct fxgmac_tx_queue *txq; + unsigned int i; + + for (i = 0; i < pdata->expansion.eth_dev->data->nb_tx_queues; i++) { + txq = pdata->expansion.eth_dev->data->tx_queues[i]; + if (!txq) { + DPRINTK("Tx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return -1; + } + + FXGMAC_DMA_IOWRITE_BITS(txq, DMA_CH_TCR, OSP, pdata->tx_osp_mode); + } +#endif + return 0; +} + +static int fxgmac_config_pblx8(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; + unsigned int i; + u32 regval; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_CR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_CR_PBLX8_POS, + DMA_CH_CR_PBLX8_LEN, + pdata->pblx8); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_CR)); + } +#else + struct fxgmac_tx_queue *txq; + unsigned int i; + + for (i = 0; i < pdata->expansion.eth_dev->data->nb_tx_queues; i++) { + txq = pdata->expansion.eth_dev->data->tx_queues[i]; + if (!txq) { + DPRINTK("Tx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return -1; + } + + FXGMAC_DMA_IOWRITE_BITS(txq, DMA_CH_CR, PBLX8, pdata->pblx8); + } +#endif + + return 0; +} + +static u32 fxgmac_get_tx_pbl_val(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(pdata->channel_head, DMA_CH_TCR)); + regval = FXGMAC_GET_REG_BITS(regval, DMA_CH_TCR_PBL_POS, + DMA_CH_TCR_PBL_LEN); + return regval; +} + +static int fxgmac_config_tx_pbl_val(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; + unsigned int i; + u32 regval; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_TCR_PBL_POS, + DMA_CH_TCR_PBL_LEN, + pdata->tx_pbl); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + } +#else + struct fxgmac_tx_queue *txq; + unsigned int i; + + for (i = 0; i < pdata->expansion.eth_dev->data->nb_tx_queues; i++) { + txq = pdata->expansion.eth_dev->data->tx_queues[i]; + if (!txq) { + DPRINTK("Tx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return -1; + } + FXGMAC_DMA_IOWRITE_BITS(txq, DMA_CH_TCR, PBL, pdata->tx_pbl); + } +#endif + + return 0; +} + +static u32 fxgmac_get_rx_pbl_val(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(pdata->channel_head, DMA_CH_RCR)); + regval = FXGMAC_GET_REG_BITS(regval, DMA_CH_RCR_PBL_POS, + DMA_CH_RCR_PBL_LEN); + return regval; +} + +static int fxgmac_config_rx_pbl_val(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + struct fxgmac_channel *channel; + unsigned int i; + u32 regval; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->rx_ring) + break; + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_RCR_PBL_POS, + DMA_CH_RCR_PBL_LEN, + pdata->rx_pbl); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + } +#else + struct fxgmac_rx_queue *rxq; + unsigned int i; + + for (i = 0; i < pdata->expansion.eth_dev->data->nb_rx_queues; i++) { + rxq = pdata->expansion.eth_dev->data->rx_queues[i]; + if (!rxq) { + DPRINTK("Rx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return -1; + } + FXGMAC_DMA_IOWRITE_BITS(rxq, DMA_CH_RCR, PBL, pdata->rx_pbl); + } +#endif + + return 0; +} + +static u64 fxgmac_mmc_read(struct fxgmac_pdata *pdata, unsigned int reg_lo) +{ + /* bool read_hi; */ + u64 val; +#if 0 + switch (reg_lo) { + /* These registers are always 64 bit */ + case MMC_TXOCTETCOUNT_GB_LO: + case MMC_TXOCTETCOUNT_G_LO: + case MMC_RXOCTETCOUNT_GB_LO: + case MMC_RXOCTETCOUNT_G_LO: + read_hi = true; + break; + + default: + read_hi = false; + } +#endif + val = (u64)readreg(pdata->pAdapter, pdata->mac_regs + reg_lo); + + /* + if (read_hi) + val |= ((u64)readreg(pdata->mac_regs + reg_lo + 4) << 32); + */ + + return val; +} + +static void fxgmac_tx_mmc_int(struct fxgmac_pdata *pdata) +{ + u32 mmc_isr = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TISR); + struct fxgmac_stats *stats = &pdata->stats; + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXOCTETCOUNT_GB_POS, + MMC_TISR_TXOCTETCOUNT_GB_LEN)) + stats->txoctetcount_gb += + fxgmac_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXFRAMECOUNT_GB_POS, + MMC_TISR_TXFRAMECOUNT_GB_LEN)) + stats->txframecount_gb += + fxgmac_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXBROADCASTFRAMES_G_POS, + MMC_TISR_TXBROADCASTFRAMES_G_LEN)) + stats->txbroadcastframes_g += + fxgmac_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXMULTICASTFRAMES_G_POS, + MMC_TISR_TXMULTICASTFRAMES_G_LEN)) + stats->txmulticastframes_g += + fxgmac_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TX64OCTETS_GB_POS, + MMC_TISR_TX64OCTETS_GB_LEN)) + stats->tx64octets_gb += + fxgmac_mmc_read(pdata, MMC_TX64OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TX65TO127OCTETS_GB_POS, + MMC_TISR_TX65TO127OCTETS_GB_LEN)) + stats->tx65to127octets_gb += + fxgmac_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TX128TO255OCTETS_GB_POS, + MMC_TISR_TX128TO255OCTETS_GB_LEN)) + stats->tx128to255octets_gb += + fxgmac_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TX256TO511OCTETS_GB_POS, + MMC_TISR_TX256TO511OCTETS_GB_LEN)) + stats->tx256to511octets_gb += + fxgmac_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TX512TO1023OCTETS_GB_POS, + MMC_TISR_TX512TO1023OCTETS_GB_LEN)) + stats->tx512to1023octets_gb += + fxgmac_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TX1024TOMAXOCTETS_GB_POS, + MMC_TISR_TX1024TOMAXOCTETS_GB_LEN)) + stats->tx1024tomaxoctets_gb += + fxgmac_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXUNICASTFRAMES_GB_POS, + MMC_TISR_TXUNICASTFRAMES_GB_LEN)) + stats->txunicastframes_gb += + fxgmac_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXMULTICASTFRAMES_GB_POS, + MMC_TISR_TXMULTICASTFRAMES_GB_LEN)) + stats->txmulticastframes_gb += + fxgmac_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXBROADCASTFRAMES_GB_POS, + MMC_TISR_TXBROADCASTFRAMES_GB_LEN)) + stats->txbroadcastframes_g += + fxgmac_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXUNDERFLOWERROR_POS, + MMC_TISR_TXUNDERFLOWERROR_LEN)) + stats->txunderflowerror += + fxgmac_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXSINGLECOLLISION_G_POS, + MMC_TISR_TXSINGLECOLLISION_G_LEN)) + stats->txsinglecollision_g += + fxgmac_mmc_read(pdata, MMC_TXSINGLECOLLISION_G); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXMULTIPLECOLLISION_G_POS, + MMC_TISR_TXMULTIPLECOLLISION_G_LEN)) + stats->txmultiplecollision_g += + fxgmac_mmc_read(pdata, MMC_TXMULTIPLECOLLISION_G); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXDEFERREDFRAMES_POS, + MMC_TISR_TXDEFERREDFRAMES_LEN)) + stats->txdeferredframes += + fxgmac_mmc_read(pdata, MMC_TXDEFERREDFRAMES); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXLATECOLLISIONFRAMES_POS, + MMC_TISR_TXLATECOLLISIONFRAMES_LEN)) + stats->txlatecollisionframes += + fxgmac_mmc_read(pdata, MMC_TXLATECOLLISIONFRAMES); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXEXCESSIVECOLLISIONFRAMES_POS, + MMC_TISR_TXEXCESSIVECOLLISIONFRAMES_LEN)) + stats->txexcessivecollisionframes += + fxgmac_mmc_read(pdata, MMC_TXEXCESSIVECOLLSIONFRAMES); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXCARRIERERRORFRAMES_POS, + MMC_TISR_TXCARRIERERRORFRAMES_LEN)) + stats->txcarriererrorframes += + fxgmac_mmc_read(pdata, MMC_TXCARRIERERRORFRAMES); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXOCTETCOUNT_G_POS, + MMC_TISR_TXOCTETCOUNT_G_LEN)) + stats->txoctetcount_g += + fxgmac_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXFRAMECOUNT_G_POS, + MMC_TISR_TXFRAMECOUNT_G_LEN)) + stats->txframecount_g += + fxgmac_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXEXCESSIVEDEFERRALFRAMES_POS, + MMC_TISR_TXEXCESSIVEDEFERRALFRAMES_LEN)) + stats->txexcessivedeferralerror += + fxgmac_mmc_read(pdata, MMC_TXEXCESSIVEDEFERRALERROR); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXPAUSEFRAMES_POS, + MMC_TISR_TXPAUSEFRAMES_LEN)) + stats->txpauseframes += + fxgmac_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXVLANFRAMES_G_POS, + MMC_TISR_TXVLANFRAMES_G_LEN)) + stats->txvlanframes_g += + fxgmac_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_TISR_TXOVERSIZE_G_POS, + MMC_TISR_TXOVERSIZE_G_LEN)) + stats->txoversize_g += + fxgmac_mmc_read(pdata, MMC_TXOVERSIZEFRAMES); +} + +static void fxgmac_rx_mmc_int(struct fxgmac_pdata *pdata) +{ + u32 mmc_isr = readreg(pdata->pAdapter, pdata->mac_regs + MMC_RISR); + struct fxgmac_stats *stats = &pdata->stats; + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXFRAMECOUNT_GB_POS, + MMC_RISR_RXFRAMECOUNT_GB_LEN)) + stats->rxframecount_gb += + fxgmac_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXOCTETCOUNT_GB_POS, + MMC_RISR_RXOCTETCOUNT_GB_LEN)) + stats->rxoctetcount_gb += + fxgmac_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXOCTETCOUNT_G_POS, + MMC_RISR_RXOCTETCOUNT_G_LEN)) + stats->rxoctetcount_g += + fxgmac_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXBROADCASTFRAMES_G_POS, + MMC_RISR_RXBROADCASTFRAMES_G_LEN)) + stats->rxbroadcastframes_g += + fxgmac_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXMULTICASTFRAMES_G_POS, + MMC_RISR_RXMULTICASTFRAMES_G_LEN)) + stats->rxmulticastframes_g += + fxgmac_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXCRCERROR_POS, + MMC_RISR_RXCRCERROR_LEN)) + stats->rxcrcerror += + fxgmac_mmc_read(pdata, MMC_RXCRCERROR_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXALIGNERROR_POS, + MMC_RISR_RXALIGNERROR_LEN)) + stats->rxalignerror += + fxgmac_mmc_read(pdata, MMC_RXALIGNERROR); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXRUNTERROR_POS, + MMC_RISR_RXRUNTERROR_LEN)) + stats->rxrunterror += + fxgmac_mmc_read(pdata, MMC_RXRUNTERROR); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXJABBERERROR_POS, + MMC_RISR_RXJABBERERROR_LEN)) + stats->rxjabbererror += + fxgmac_mmc_read(pdata, MMC_RXJABBERERROR); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXUNDERSIZE_G_POS, + MMC_RISR_RXUNDERSIZE_G_LEN)) + stats->rxundersize_g += + fxgmac_mmc_read(pdata, MMC_RXUNDERSIZE_G); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXOVERSIZE_G_POS, + MMC_RISR_RXOVERSIZE_G_LEN)) + stats->rxoversize_g += + fxgmac_mmc_read(pdata, MMC_RXOVERSIZE_G); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RX64OCTETS_GB_POS, + MMC_RISR_RX64OCTETS_GB_LEN)) + stats->rx64octets_gb += + fxgmac_mmc_read(pdata, MMC_RX64OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RX65TO127OCTETS_GB_POS, + MMC_RISR_RX65TO127OCTETS_GB_LEN)) + stats->rx65to127octets_gb += + fxgmac_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RX128TO255OCTETS_GB_POS, + MMC_RISR_RX128TO255OCTETS_GB_LEN)) + stats->rx128to255octets_gb += + fxgmac_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RX256TO511OCTETS_GB_POS, + MMC_RISR_RX256TO511OCTETS_GB_LEN)) + stats->rx256to511octets_gb += + fxgmac_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RX512TO1023OCTETS_GB_POS, + MMC_RISR_RX512TO1023OCTETS_GB_LEN)) + stats->rx512to1023octets_gb += + fxgmac_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RX1024TOMAXOCTETS_GB_POS, + MMC_RISR_RX1024TOMAXOCTETS_GB_LEN)) + stats->rx1024tomaxoctets_gb += + fxgmac_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXUNICASTFRAMES_G_POS, + MMC_RISR_RXUNICASTFRAMES_G_LEN)) + stats->rxunicastframes_g += + fxgmac_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXLENGTHERROR_POS, + MMC_RISR_RXLENGTHERROR_LEN)) + stats->rxlengtherror += + fxgmac_mmc_read(pdata, MMC_RXLENGTHERROR_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXOUTOFRANGETYPE_POS, + MMC_RISR_RXOUTOFRANGETYPE_LEN)) + stats->rxoutofrangetype += + fxgmac_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXPAUSEFRAMES_POS, + MMC_RISR_RXPAUSEFRAMES_LEN)) + stats->rxpauseframes += + fxgmac_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXFIFOOVERFLOW_POS, + MMC_RISR_RXFIFOOVERFLOW_LEN)) + stats->rxfifooverflow += + fxgmac_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXVLANFRAMES_GB_POS, + MMC_RISR_RXVLANFRAMES_GB_LEN)) + stats->rxvlanframes_gb += + fxgmac_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXWATCHDOGERROR_POS, + MMC_RISR_RXWATCHDOGERROR_LEN)) + stats->rxwatchdogerror += + fxgmac_mmc_read(pdata, MMC_RXWATCHDOGERROR); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXERRORFRAMES_POS, + MMC_RISR_RXERRORFRAMES_LEN)) + stats->rxreceiveerrorframe += + fxgmac_mmc_read(pdata, MMC_RXRECEIVEERRORFRAME); + + if (FXGMAC_GET_REG_BITS(mmc_isr, + MMC_RISR_RXERRORCONTROLFRAMES_POS, + MMC_RISR_RXERRORCONTROLFRAMES_LEN)) + stats->rxcontrolframe_g += + fxgmac_mmc_read(pdata, MMC_RXCONTROLFRAME_G); +} + +static void fxgmac_read_mmc_stats(struct fxgmac_pdata *pdata) +{ + struct fxgmac_stats *stats = &pdata->stats; + + stats->txoctetcount_gb += + fxgmac_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO); + + stats->txframecount_gb += + fxgmac_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO); + + stats->txbroadcastframes_g += + fxgmac_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO); + + stats->txmulticastframes_g += + fxgmac_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO); + + stats->tx64octets_gb += + fxgmac_mmc_read(pdata, MMC_TX64OCTETS_GB_LO); + + stats->tx65to127octets_gb += + fxgmac_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO); + + stats->tx128to255octets_gb += + fxgmac_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO); + + stats->tx256to511octets_gb += + fxgmac_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO); + + stats->tx512to1023octets_gb += + fxgmac_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO); + + stats->tx1024tomaxoctets_gb += + fxgmac_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); + + stats->txunicastframes_gb += + fxgmac_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO); + + stats->txmulticastframes_gb += + fxgmac_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO); + + stats->txbroadcastframes_g += + fxgmac_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO); + + stats->txunderflowerror += + fxgmac_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO); + + stats->txsinglecollision_g += + fxgmac_mmc_read(pdata, MMC_TXSINGLECOLLISION_G); + + stats->txmultiplecollision_g += + fxgmac_mmc_read(pdata, MMC_TXMULTIPLECOLLISION_G); + + stats->txdeferredframes += + fxgmac_mmc_read(pdata, MMC_TXDEFERREDFRAMES); + + stats->txlatecollisionframes += + fxgmac_mmc_read(pdata, MMC_TXLATECOLLISIONFRAMES); + + stats->txexcessivecollisionframes += + fxgmac_mmc_read(pdata, MMC_TXEXCESSIVECOLLSIONFRAMES); + + stats->txcarriererrorframes += + fxgmac_mmc_read(pdata, MMC_TXCARRIERERRORFRAMES); + + stats->txoctetcount_g += + fxgmac_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO); + + stats->txframecount_g += + fxgmac_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO); + + stats->txexcessivedeferralerror += + fxgmac_mmc_read(pdata, MMC_TXEXCESSIVEDEFERRALERROR); + + stats->txpauseframes += + fxgmac_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO); + + stats->txvlanframes_g += + fxgmac_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO); + + stats->txoversize_g += + fxgmac_mmc_read(pdata, MMC_TXOVERSIZEFRAMES); + + stats->rxframecount_gb += + fxgmac_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO); + + stats->rxoctetcount_gb += + fxgmac_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO); + + stats->rxoctetcount_g += + fxgmac_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO); + + stats->rxbroadcastframes_g += + fxgmac_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO); + + stats->rxmulticastframes_g += + fxgmac_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO); + + stats->rxcrcerror += + fxgmac_mmc_read(pdata, MMC_RXCRCERROR_LO); + + stats->rxalignerror += + fxgmac_mmc_read(pdata, MMC_RXALIGNERROR); + + stats->rxrunterror += + fxgmac_mmc_read(pdata, MMC_RXRUNTERROR); + + stats->rxjabbererror += + fxgmac_mmc_read(pdata, MMC_RXJABBERERROR); + + stats->rxundersize_g += + fxgmac_mmc_read(pdata, MMC_RXUNDERSIZE_G); + + stats->rxoversize_g += + fxgmac_mmc_read(pdata, MMC_RXOVERSIZE_G); + + stats->rx64octets_gb += + fxgmac_mmc_read(pdata, MMC_RX64OCTETS_GB_LO); + + stats->rx65to127octets_gb += + fxgmac_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO); + + stats->rx128to255octets_gb += + fxgmac_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO); + + stats->rx256to511octets_gb += + fxgmac_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO); + + stats->rx512to1023octets_gb += + fxgmac_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO); + + stats->rx1024tomaxoctets_gb += + fxgmac_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); + + stats->rxunicastframes_g += + fxgmac_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO); + + stats->rxlengtherror += + fxgmac_mmc_read(pdata, MMC_RXLENGTHERROR_LO); + + stats->rxoutofrangetype += + fxgmac_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO); + + stats->rxpauseframes += + fxgmac_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO); + + stats->rxfifooverflow += + fxgmac_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO); + + stats->rxvlanframes_gb += + fxgmac_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO); + + stats->rxwatchdogerror += + fxgmac_mmc_read(pdata, MMC_RXWATCHDOGERROR); + + stats->rxreceiveerrorframe += + fxgmac_mmc_read(pdata, MMC_RXRECEIVEERRORFRAME); + + stats->rxcontrolframe_g += + fxgmac_mmc_read(pdata, MMC_RXCONTROLFRAME_G); +} + +static void fxgmac_config_mmc(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MMC_CR); + /* Set counters to reset on read */ + regval = FXGMAC_SET_REG_BITS(regval, MMC_CR_ROR_POS, + MMC_CR_ROR_LEN, 1); + /* Reset the counters */ + regval = FXGMAC_SET_REG_BITS(regval, MMC_CR_CR_POS, + MMC_CR_CR_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MMC_CR); + +#if FXGMAC_MISC_INT_HANDLE_FEATURE_ENABLED + //disable interrupts for rx Tcp and ip good pkt counter which is not read by MMC counter process. + //regval = readreg(pdata->mac_regs + 0x800); + writereg(pdata->pAdapter, 0xffffffff, pdata->mac_regs + MMC_IPCRXINTMASK); +#endif +} + +static int fxgmac_write_rss_reg(struct fxgmac_pdata *pdata, unsigned int type, + unsigned int index, u32 val) +{ + int ret = 0; + (void)type; + + writereg(pdata->pAdapter, val, (pdata->base_mem+ index)); + + return ret; +} + +static u32 fxgmac_read_rss_options(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_RSS_CTRL); + + /* Get the RSS options bits */ + regval = FXGMAC_GET_REG_BITS(regval, MGMT_RSS_CTRL_OPT_POS, MGMT_RSS_CTRL_OPT_LEN); + + return regval; +} + +static int fxgmac_write_rss_options(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_RSS_CTRL); + + /* Set the RSS options */ + regval = FXGMAC_SET_REG_BITS(regval, MGMT_RSS_CTRL_OPT_POS, + MGMT_RSS_CTRL_OPT_LEN, pdata->rss_options); + + writereg(pdata->pAdapter, regval, (pdata->base_mem + MGMT_RSS_CTRL)); + + return 0; +} + +static int fxgmac_read_rss_hash_key(struct fxgmac_pdata *pdata, u8 *key_buf) +{ + //struct net_device *netdev = pdata->netdev; + unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32); + u32 *key = (u32 *)key_buf; + + while (key_regs--) { + (*key) = cpu_to_be32(readreg(pdata->pAdapter, pdata->base_mem + (MGMT_RSS_KEY0 + key_regs * MGMT_RSS_KEY_REG_INC))) ; + + DBGPRINT(MP_LOUD, ("fxgmac_read_rss_hash_key: idx=%d, reg=%x, key=0x%08x\n", + key_regs, MGMT_RSS_KEY0 + key_regs * MGMT_RSS_KEY_REG_INC, (u32)(*key))); + key++; + } + + return 0; +} + +static int fxgmac_write_rss_hash_key(struct fxgmac_pdata *pdata) +{ + unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32); + u32 *key = (u32 *)&pdata->rss_key; + int ret; + + while (key_regs--) { + ret = fxgmac_write_rss_reg(pdata, (unsigned int)FXGMAC_RSS_HASH_KEY_TYPE, + (unsigned int)(MGMT_RSS_KEY0 + key_regs * MGMT_RSS_KEY_REG_INC), (unsigned int)(cpu_to_be32 (*key))); + if (ret) + return ret; + key++; + } + + return 0; +} + +static int fxgmac_write_rss_lookup_table(struct fxgmac_pdata *pdata) +{ + unsigned int i, j; + u32 regval = 0; + int ret; + + for (i = 0, j = 0; i < ARRAY_SIZE(pdata->rss_table); i++, j++) { + if(j < MGMT_RSS_IDT_ENTRY_PER_REG) + { + regval |= ((pdata->rss_table[i] & MGMT_RSS_IDT_ENTRY_MASK) << (j * 2)); + }else{ + ret = fxgmac_write_rss_reg(pdata, + FXGMAC_RSS_LOOKUP_TABLE_TYPE, MGMT_RSS_IDT + (i / MGMT_RSS_IDT_ENTRY_PER_REG - 1) * MGMT_RSS_IDT_REG_INC, + regval); + if (ret) + return ret; + + regval = pdata->rss_table[i]; + j = 0; + } + } + + if (j == MGMT_RSS_IDT_ENTRY_PER_REG) + { + //last IDT + fxgmac_write_rss_reg(pdata, + FXGMAC_RSS_LOOKUP_TABLE_TYPE, MGMT_RSS_IDT + (i / MGMT_RSS_IDT_ENTRY_PER_REG - 1) * MGMT_RSS_IDT_REG_INC, + regval); + } + + return 0; +} + +static int fxgmac_set_rss_hash_key(struct fxgmac_pdata *pdata, const u8 *key) +{ + memcpy(pdata->rss_key, (void*)key, sizeof(pdata->rss_key));//CopyMem + + return fxgmac_write_rss_hash_key(pdata); +} + +static int fxgmac_set_rss_lookup_table(struct fxgmac_pdata *pdata, + const u32 *table) +{ + unsigned int i; + u32 tval; + +#if FXGMAC_MSIX_CH0RXDIS_ENABLED + DPRINTK("Set_rss_table, rss ctrl eth=0x%08x\n", 0); + + return 0; +#endif + + for (i = 0; i < ARRAY_SIZE(pdata->rss_table); i++) { + tval = table[i]; + pdata->rss_table[i] = FXGMAC_SET_REG_BITS( + pdata->rss_table[i], + MAC_RSSDR_DMCH_POS, + MAC_RSSDR_DMCH_LEN, + tval); + } + + return fxgmac_write_rss_lookup_table(pdata); +} + +static u32 log2ex(u32 value) +{ + u32 i = 31; + while (i > 0) + { + if (value & 0x80000000) + { + break; + } + value <<= 1; + i--; + } + return i; +} + +static int fxgmac_enable_rss(struct fxgmac_pdata* pdata) +{ + u32 regval; + u32 size = 0; + +#ifdef FXGMAC_USE_DEFAULT_RSS_KEY_TBALE + int ret; + + if (!pdata->hw_feat.rss) { + return -EOPNOTSUPP; + } + + /* Program the hash key */ + ret = fxgmac_write_rss_hash_key(pdata); + if (ret) { + return ret; + } + + /* Program the lookup table */ + ret = fxgmac_write_rss_lookup_table(pdata); + if (ret) { + return ret; + } +#endif + + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_RSS_CTRL); + + //2022-04-19 xiaojiang comment + //In Linux driver, it does not set the IDT table size, but windos implement it, so linux driver follow it. + /* Set RSS IDT table size */ + size = log2ex(FXGMAC_RSS_MAX_TABLE_SIZE) - 1; + regval = FXGMAC_SET_REG_BITS(regval, MGMT_RSS_CTRL_TBL_SIZE_POS, + MGMT_RSS_CTRL_TBL_SIZE_LEN, size); + +#if FXGMAC_MSIX_CH0RXDIS_ENABLED + /* set default cpu id to 1 */ + regval = FXGMAC_SET_REG_BITS(regval, 8, + 2, 1); +#endif + /* Enable RSS */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_RSSCR_RSSE_POS, + MAC_RSSCR_RSSE_LEN, 1); + + /* Set the RSS options */ + regval = FXGMAC_SET_REG_BITS(regval, MGMT_RSS_CTRL_OPT_POS, + MGMT_RSS_CTRL_OPT_LEN, pdata->rss_options); + + writereg(pdata->pAdapter, regval, (pdata->base_mem + MGMT_RSS_CTRL)); + DPRINTK("enable_rss callout, set val = 0x%08x\n", regval); + + return 0; +} + +static int fxgmac_disable_rss(struct fxgmac_pdata *pdata) +{ + u32 regval; + + if (!pdata->hw_feat.rss) + return -EOPNOTSUPP; + +#if FXGMAC_MSIX_CH0RXDIS_ENABLED + DPRINTK("Disable_rss, rss ctrl eth=0x%08x\n", 0); + + return 0; +#endif + + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_RSS_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, MAC_RSSCR_RSSE_POS, + MAC_RSSCR_RSSE_LEN, 0); + + writereg(pdata->pAdapter, regval, (pdata->base_mem + MGMT_RSS_CTRL)); + DPRINTK("disable_rss, set val = 0x%08x\n", regval); + + return 0; +} + +static void fxgmac_config_rss(struct fxgmac_pdata *pdata) +{ + int ret; + + if (!pdata->hw_feat.rss) + return; + + if (pdata->rss) + ret = fxgmac_enable_rss(pdata); + else + ret = fxgmac_disable_rss(pdata); + + if (ret) + DPRINTK("fxgmac_config_rss: error configuring RSS\n"); +} + +#if defined(FXGMAC_POWER_MANAGEMENT) +// +static void fxgmac_update_aoe_ipv4addr(struct fxgmac_pdata* pdata, u8* ip_addr) +{ + unsigned int regval, ipval = 0; + + /* enable or disable ARP offload engine. */ + if (!pdata->hw_feat.aoe) { + netdev_err(pdata->netdev, "error update ip addr - arp offload not supported.\n"); + return; + } + +#if 0 + if(ip_addr) { + sscanf(ip_addr, "%x.%x.%x.%x", (unsigned int *)&tmp32[0], (unsigned int *)&tmp32[1], (unsigned int *)&tmp32[2], (unsigned int *)&tmp32[3]); + tmp[0] = (uint8_t)tmp32[0]; + tmp[1] = (uint8_t)tmp32[1]; + tmp[2] = (uint8_t)tmp32[2]; + tmp[3] = (uint8_t)tmp32[3]; + } else + { + ipval = 0; //0xc0a801ca; //here just hard code to 192.168.1.202 + } +#endif + + if(ip_addr) { + //inet_aton((const char *)ip_addr, (struct in_addr *)&ipval); + //ipval = (unsigned int)in_aton((const char *)ip_addr); + ipval = (ip_addr[0] << 24) | (ip_addr[1] << 16) | (ip_addr[2] << 8) | (ip_addr[3] << 0); + DPRINTK("%s, covert IP dotted-addr %s to binary 0x%08x ok.\n", __FUNCTION__, ip_addr, cpu_to_be32(ipval)); + } else + { +#ifdef FXGMAC_AOE_FEATURE_ENABLED + /* get ipv4 addr from net device */ + //2022-04-25 xiaojiang Linux Driver behavior + ipval = fxgmac_get_netdev_ip4addr(pdata); + DPRINTK("%s, Get net device binary IP ok, 0x%08x\n", __FUNCTION__, cpu_to_be32(ipval)); + + ipval = cpu_to_be32(ipval); +#endif + } + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_ARP_PROTO_ADDR); + if(regval != /*cpu_to_be32*/(ipval)) { + writereg(pdata->pAdapter, /*cpu_to_be32*/(ipval), pdata->mac_regs + MAC_ARP_PROTO_ADDR); + DPRINTK("%s, update arp ipaddr reg from 0x%08x to 0x%08x\n", __FUNCTION__, regval, /*cpu_to_be32*/(ipval)); + } +} + +static int fxgmac_enable_arp_offload(struct fxgmac_pdata* pdata) +{ + u32 regval; + + if (!pdata->hw_feat.aoe) + return -EOPNOTSUPP; + + /* Enable arpoffload */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_ARPEN_POS, + MAC_CR_ARPEN_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + return 0; +} + +static int fxgmac_disable_arp_offload(struct fxgmac_pdata* pdata) +{ + u32 regval; + + if (!pdata->hw_feat.aoe) + return -EOPNOTSUPP; + /* disable arpoffload */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_ARPEN_POS, + MAC_CR_ARPEN_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + return 0; +} + +/* this function config register for NS offload function + * parameters: + * index - 0~1, index to NS look up table. one entry of the lut is like this |remote|solicited|target0|target1| + * remote_addr - ipv6 addr where fuxi gets the NS solicitation pkt(request). in common, it is 0 to match any remote machine. + * solicited_addr - the solicited node multicast group address which fuxi computes and joins. + * target_addr1 - it is the target address in NS solicitation pkt. + * target_addr2 - second target address, any address (with last 6B same with target address?). + */ +static int fxgmac_set_ns_offload(struct fxgmac_pdata* pdata,unsigned int index, unsigned char* remote_addr,unsigned char* solicited_addr,unsigned char*target_addr1,unsigned char *target_addr2,unsigned char *mac_addr) +//static int fxgmac_set_ns_offload(struct nic_pdata* pdata,unsigned char index, PIPV6NSPARAMETERS PIPv6NSPara) + +{ + u32 regval; + u32 Address[4],mac_addr_hi,mac_addr_lo; + u8 i, remote_not_zero = 0; + +#if 1 + regval = readreg(pdata->pAdapter, pdata->base_mem + NS_TPID_PRO); + regval = FXGMAC_SET_REG_BITS(regval, NS_TPID_PRO_STPID_POS, + NS_TPID_PRO_STPID_LEN, 0X8100); + regval = FXGMAC_SET_REG_BITS(regval, NS_TPID_PRO_CTPID_POS, + NS_TPID_PRO_CTPID_LEN, 0X9100); + writereg(pdata->pAdapter, regval, pdata->base_mem + NS_TPID_PRO); + regval = readreg(pdata->pAdapter, pdata->base_mem + 0X38 * index + NS_LUT_MAC_ADDR_CTL ); + regval = FXGMAC_SET_REG_BITS(regval, NS_LUT_DST_CMP_TYPE_POS, + NS_LUT_DST_CMP_TYPE_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, NS_LUT_DST_IGNORED_POS, + NS_LUT_DST_IGNORED_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, NS_LUT_REMOTE_AWARED_POS, + NS_LUT_REMOTE_AWARED_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, NS_LUT_TARGET_ISANY_POS, + NS_LUT_TARGET_ISANY_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + 0X38 * index + NS_LUT_MAC_ADDR_CTL); + + //AR + for (i = 0; i < 16/4; i++) + { + Address[i] = (remote_addr[i * 4 + 0] << 24) | (remote_addr[i * 4 + 1] << 16) | (remote_addr[i * 4 + 2] << 8) | (remote_addr[i * 4 + 3] << 0); + writereg(pdata->pAdapter, Address[i], pdata->base_mem + 0X38 * index + NS_LUT_ROMOTE0 + 4 * i); + if(Address[i] ) + { + remote_not_zero = 1; + } + Address[i] = (target_addr1[i * 4 + 0] << 24) | (target_addr1[i * 4 + 1] << 16) | (target_addr1[i * 4 + 2] << 8) | (target_addr1[i * 4 + 3] << 0); + writereg(pdata->pAdapter, Address[i], pdata->base_mem + 0X38 * index + NS_LUT_TARGET0 + 4 * i); + Address[i] = (solicited_addr[i * 4 + 0] << 24) | (solicited_addr[i * 4 + 1] << 16) | (solicited_addr[i * 4 + 2] << 8) | (solicited_addr[i * 4 + 3] << 0); + writereg(pdata->pAdapter, Address[i], pdata->base_mem + 0X38 * index + NS_LUT_SOLICITED0 + 4 * i); + Address[i] = (target_addr2[i * 4 + 0] << 24) | (target_addr2[i * 4 + 1] << 16) | (target_addr2[i * 4 + 2] << 8) | (target_addr2[i * 4 + 3] << 0); + writereg(pdata->pAdapter, Address[i], pdata->base_mem + 0X10 * index + NS_LUT_TARGET4 + 4 * i); + + } + mac_addr_hi = (mac_addr[0] << 24) | (mac_addr[1] << 16)|(mac_addr[2] << 8) | (mac_addr[3] << 0); + mac_addr_lo = (mac_addr[4] << 8) | (mac_addr[5] << 0); + + writereg(pdata->pAdapter, mac_addr_hi, pdata->base_mem + 0X38 * index + NS_LUT_MAC_ADDR); + if(remote_not_zero==0) + { + regval = readreg(pdata->pAdapter, pdata->base_mem + 0X38 * index + NS_LUT_MAC_ADDR_CTL ); + regval = FXGMAC_SET_REG_BITS(regval, NS_LUT_REMOTE_AWARED_POS, + NS_LUT_REMOTE_AWARED_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, NS_LUT_MAC_ADDR_LOW_POS, + NS_LUT_MAC_ADDR_LOW_LEN, mac_addr_lo); + writereg(pdata->pAdapter, regval, pdata->base_mem + 0X38 * index + NS_LUT_MAC_ADDR_CTL); + } + else + { + regval = readreg(pdata->pAdapter, pdata->base_mem + 0X38 * index + NS_LUT_MAC_ADDR_CTL ); + regval = FXGMAC_SET_REG_BITS(regval, NS_LUT_REMOTE_AWARED_POS, + NS_LUT_REMOTE_AWARED_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, NS_LUT_MAC_ADDR_LOW_POS, + NS_LUT_MAC_ADDR_LOW_LEN, mac_addr_lo); + writereg(pdata->pAdapter, regval, pdata->base_mem + 0X38 * index + NS_LUT_MAC_ADDR_CTL); + } + +#else + regval = readreg(pdata->mac_regs -0x2000 + NS_TPID_PRO); + regval = FXGMAC_SET_REG_BITS(regval, NS_TPID_PRO_STPID_POS, + NS_TPID_PRO_STPID_LEN, 0X8100); + regval = FXGMAC_SET_REG_BITS(regval, NS_TPID_PRO_CTPID_POS, + NS_TPID_PRO_CTPID_LEN, 0X9100); + writereg(regval, pdata->mac_regs - 0x2000 + NS_TPID_PRO); + //AR + writereg(0X20000000, pdata->mac_regs - 0x2000 + NS_LUT_ROMOTE0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + NS_LUT_ROMOTE1); + writereg(0X00000000, pdata->mac_regs - 0x2000 + NS_LUT_ROMOTE2); + writereg(0X00000001, pdata->mac_regs - 0x2000 + NS_LUT_ROMOTE3); + writereg(0X20000000, pdata->mac_regs - 0x2000 + NS_LUT_TARGET0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + NS_LUT_TARGET1); + writereg(0X00000000, pdata->mac_regs - 0x2000 + NS_LUT_TARGET2); + writereg(0X00000002, pdata->mac_regs - 0x2000 + NS_LUT_TARGET3); + writereg(0Xff020000, pdata->mac_regs - 0x2000 + NS_LUT_SOLICITED0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + NS_LUT_SOLICITED1); + writereg(0X00000001, pdata->mac_regs - 0x2000 + NS_LUT_SOLICITED2); + writereg(0Xff000002, pdata->mac_regs - 0x2000 + NS_LUT_SOLICITED3); + writereg(0X00e0fc69, pdata->mac_regs - 0x2000 + NS_LUT_MAC_ADDR); + writereg(0X00033381, pdata->mac_regs - 0x2000 + NS_LUT_MAC_ADDR_CTL); + + //NUD + writereg(0X20000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_ROMOTE0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_ROMOTE1); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_ROMOTE2); + writereg(0X00000001, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_ROMOTE3); + writereg(0X20000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_TARGET0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_TARGET1); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_TARGET2); + writereg(0X00000002, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_TARGET3); + writereg(0X20000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_SOLICITED0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_SOLICITED1); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_SOLICITED2); + writereg(0X00000002, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_SOLICITED3); + writereg(0X00e0fc69, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_MAC_ADDR); + writereg(0X00033382, pdata->mac_regs - 0x2000 + 0X38 * 2 + NS_LUT_MAC_ADDR_CTL); + + //DAD + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_ROMOTE0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_ROMOTE1); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_ROMOTE2); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_ROMOTE3); + writereg(0X20000000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_TARGET0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_TARGET1); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_TARGET2); + writereg(0X00000002, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_TARGET3); + writereg(0Xff020000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_SOLICITED0); + writereg(0X00000000, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_SOLICITED1); + writereg(0X00000001, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_SOLICITED2); + writereg(0Xff000002, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_SOLICITED3); + writereg(0X00e0fc69, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_MAC_ADDR); + writereg(0X00033381, pdata->mac_regs - 0x2000 + 0X38 * 3 + NS_LUT_MAC_ADDR_CTL); + + writereg(0X00000001, pdata->mac_regs - 0x2000 + NS_OF_GLB_CTL); +#endif + return 0; +} + +#ifdef FXGMAC_NS_OFFLOAD_ENABLED +static void fxgmac_update_ns_offload_ipv6addr(struct fxgmac_pdata *pdata, unsigned int param) +{ + struct net_device *netdev = pdata->netdev; + unsigned char addr_buf[5][16]; + + unsigned char * remote_addr = (unsigned char *)&addr_buf[0][0]; + unsigned char * solicited_addr = (unsigned char *)&addr_buf[1][0]; + unsigned char * target_addr1 = (unsigned char *)&addr_buf[2][0]; + //unsigned char * target_addr2 = (unsigned char *)&addr_buf[3][0]; + unsigned char * mac_addr = (unsigned char *)&addr_buf[4][0]; + + /* get ipv6 addr from net device */ + if (NULL == fxgmac_get_netdev_ip6addr(pdata, target_addr1, solicited_addr, (FXGMAC_NS_IFA_LOCAL_LINK | FXGMAC_NS_IFA_GLOBAL_UNICAST) & param)) + { + DPRINTK("%s, get net device ipv6 addr with err and ignore NS offload.\n", __FUNCTION__); + + return; + } + + DPRINTK("%s, Get net device binary IPv6 ok, local-link=%pI6\n", __FUNCTION__, target_addr1); + DPRINTK("%s, Get net device binary IPv6 ok, solicited =%pI6\n", __FUNCTION__, solicited_addr); + + memcpy(mac_addr, netdev->dev_addr, netdev->addr_len); + DPRINTK("%s, Get net device MAC addr ok, ns_tab idx=%d, %02x:%02x:%02x:%02x:%02x:%02x\n", + __FUNCTION__, pdata->expansion.ns_offload_tab_idx, mac_addr[0], mac_addr[1], + mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); + + memset(remote_addr, 0, 16); + fxgmac_set_ns_offload(pdata, pdata->expansion.ns_offload_tab_idx++, + remote_addr, solicited_addr, target_addr1, + target_addr1, mac_addr); + if(pdata->expansion.ns_offload_tab_idx >= 2) pdata->expansion.ns_offload_tab_idx = 0; + +} +#endif + +static int fxgmac_enable_ns_offload(struct fxgmac_pdata* pdata) +{ + writereg(pdata->pAdapter, 0X00000011, pdata->base_mem + NS_OF_GLB_CTL); + return 0; +} + + +static int fxgmac_disable_ns_offload(struct fxgmac_pdata* pdata) +{ + writereg(pdata->pAdapter, 0X00000000, pdata->base_mem + NS_OF_GLB_CTL); + return 0; +} + +static int fxgmac_check_wake_pattern_fifo_pointer(struct fxgmac_pdata* pdata) +{ + u32 regval; + int ret = 0; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_RWKFILTERST_POS, MAC_PMT_STA_RWKFILTERST_LEN,1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PMT_STA); + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + regval = FXGMAC_GET_REG_BITS(regval, MAC_PMT_STA_RWKPTR_POS, MAC_PMT_STA_RWKPTR_LEN); + if (regval != 0) { + DPRINTK("Remote fifo pointer is not 0\n"); + ret = -EINVAL; + } + return ret; +} + +static int fxgmac_set_wake_pattern_mask(struct fxgmac_pdata* pdata, u32 filter_index, u8 register_index,u32 Data) +{ + const u16 address_offset[16][3] = { + {0x1020, 0x1024, 0x1028}, + {0x102c, 0x1030, 0x1034}, + {0x1038, 0x103c, 0x1040}, + {0x1044, 0x1050, 0x1054}, + {0x1058, 0x105c, 0x1060}, + {0x1064, 0x1068, 0x106c}, + {0x1070, 0x1074, 0x1078}, + {0x107c, 0x1080, 0x1084}, + {0x1088, 0x108c, 0x1090}, + {0x1134, 0x113c, 0x1140}, + {0x1208, 0x1200, 0x1204}, + {0x1218, 0x1210, 0x1214}, + {0x1228, 0x1220, 0x1224}, + {0x1238, 0x1230, 0x1234}, + {0x1248, 0x1240, 0x1244}, + {0x1258, 0x1250, 0x1254}, + }; + if (filter_index > 15||register_index > 2) { + DbgPrintF(MP_TRACE, "%s - Remote mask pointer is over range, filter_index:%d, register_index:0x%x\n", + __FUNCTION__, filter_index, register_index); + return -1; + } + writereg(pdata->pAdapter, Data, pdata->base_mem + address_offset[filter_index][register_index]); + return 0; +} + +static u16 wol_crc16(u8* pucframe, u16 uslen) +{ + int i; + + union type16 { + u16 raw; + struct { + u16 bit_0 : 1; + u16 bit_1 : 1; + u16 bit_2 : 1; + u16 bit_3 : 1; + u16 bit_4 : 1; + u16 bit_5 : 1; + u16 bit_6 : 1; + u16 bit_7 : 1; + u16 bit_8 : 1; + u16 bit_9 : 1; + u16 bit_10 : 1; + u16 bit_11 : 1; + u16 bit_12 : 1; + u16 bit_13 : 1; + u16 bit_14 : 1; + u16 bit_15 : 1; + }bits; + }; + + union type8 { + u16 raw; + + struct { + u16 bit_0 : 1; + u16 bit_1 : 1; + u16 bit_2 : 1; + u16 bit_3 : 1; + u16 bit_4 : 1; + u16 bit_5 : 1; + u16 bit_6 : 1; + u16 bit_7 : 1; + }bits; + }; + + union type16 crc, crc_comb; + union type8 next_crc, rrpe_data; + next_crc.raw = 0; + crc.raw = 0xffff; + for (i = 0; i < uslen;i++) { + rrpe_data.raw = pucframe[i]; + next_crc.bits.bit_0 = crc.bits.bit_15 ^ rrpe_data.bits.bit_0; + next_crc.bits.bit_1 = crc.bits.bit_14 ^ next_crc.bits.bit_0 ^ rrpe_data.bits.bit_1; + next_crc.bits.bit_2 = crc.bits.bit_13 ^ next_crc.bits.bit_1 ^ rrpe_data.bits.bit_2; + next_crc.bits.bit_3 = crc.bits.bit_12 ^ next_crc.bits.bit_2 ^ rrpe_data.bits.bit_3; + next_crc.bits.bit_4 = crc.bits.bit_11 ^ next_crc.bits.bit_3 ^ rrpe_data.bits.bit_4; + next_crc.bits.bit_5 = crc.bits.bit_10 ^ next_crc.bits.bit_4 ^ rrpe_data.bits.bit_5; + next_crc.bits.bit_6 = crc.bits.bit_9 ^ next_crc.bits.bit_5 ^ rrpe_data.bits.bit_6; + next_crc.bits.bit_7 = crc.bits.bit_8 ^ next_crc.bits.bit_6 ^ rrpe_data.bits.bit_7; + + crc_comb.bits.bit_15 = crc.bits.bit_7 ^ next_crc.bits.bit_7; + crc_comb.bits.bit_14 = crc.bits.bit_6; + crc_comb.bits.bit_13 = crc.bits.bit_5; + crc_comb.bits.bit_12 = crc.bits.bit_4; + crc_comb.bits.bit_11 = crc.bits.bit_3; + crc_comb.bits.bit_10 = crc.bits.bit_2; + crc_comb.bits.bit_9 = crc.bits.bit_1 ^ next_crc.bits.bit_0; + crc_comb.bits.bit_8 = crc.bits.bit_0 ^ next_crc.bits.bit_1; + crc_comb.bits.bit_7 = next_crc.bits.bit_0 ^ next_crc.bits.bit_2; + crc_comb.bits.bit_6 = next_crc.bits.bit_1 ^ next_crc.bits.bit_3; + crc_comb.bits.bit_5 = next_crc.bits.bit_2 ^ next_crc.bits.bit_4; + crc_comb.bits.bit_4 = next_crc.bits.bit_3 ^ next_crc.bits.bit_5; + crc_comb.bits.bit_3 = next_crc.bits.bit_4 ^ next_crc.bits.bit_6; + crc_comb.bits.bit_2 = next_crc.bits.bit_5 ^ next_crc.bits.bit_7; + crc_comb.bits.bit_1 = next_crc.bits.bit_6; + crc_comb.bits.bit_0 = next_crc.bits.bit_7; + crc.raw = crc_comb.raw; + } + return crc.raw; +} + +static int fxgmac_set_wake_pattern( + struct fxgmac_pdata* pdata, + struct wol_bitmap_pattern* wol_pattern, + u32 pattern_cnt) +{ + u32 i, j, kp, km, mask_index; + int z; + u16 map_index; + u8 mask[MAX_PATTERN_SIZE]; + u32 regval = 0; + u32 total_cnt = 0, pattern_inherited_cnt = 0; + u8* ptdata, * ptmask; + (void)ptdata; + (void)ptmask; + + if (pattern_cnt > MAX_PATTERN_COUNT) { + DbgPrintF(MP_TRACE, "%s - Error: %d patterns, exceed %d, not supported!\n", + __FUNCTION__, pattern_cnt, MAX_PATTERN_COUNT); + return -1; + } + + /* Reset the FIFO head pointer. */ + if (fxgmac_check_wake_pattern_fifo_pointer(pdata)) { + DbgPrintF(MP_TRACE, "%s - Warning: the remote pattern array pointer is not be 0\n", __FUNCTION__); + return -1; + } + + for (i = 0; i < pattern_cnt; i++) { + memcpy(&pdata->pattern[i], wol_pattern + i, sizeof(wol_pattern[0])); + if (pattern_cnt + pattern_inherited_cnt < MAX_PATTERN_COUNT) + { + if (wol_pattern[i].pattern_offset || !(wol_pattern[i].mask_info[0] & 0x01)) { + memcpy(&pdata->pattern[pattern_cnt + pattern_inherited_cnt], + wol_pattern + i, + sizeof(wol_pattern[0])); + pattern_inherited_cnt++; + } + } + } + total_cnt = pattern_cnt + pattern_inherited_cnt; + + /* + * calculate the crc-16 of the mask pattern + * print the pattern and mask for debug purpose. + */ + for (i = 0; i < total_cnt; i++) { + /* Please program pattern[i] to NIC for pattern match wakeup. + * pattern_size, pattern_info, mask_info + */ + //save the mask pattern + mask_index = 0; + map_index = 0; + for (j = 0; j < pdata->pattern[i].mask_size; j++) { + for (z = 0; z < ((j == (MAX_PATTERN_SIZE / 8 - 1)) ? 7 : 8); z++) { + if (pdata->pattern[i].mask_info[j] & (0x01 << z)) { + mask[map_index] = pdata->pattern[i].pattern_info[pdata->pattern[i].pattern_offset + mask_index]; + map_index++; + } + mask_index++; + } + } + //calculate the crc-16 of the mask pattern + pdata->pattern[i].pattern_crc = wol_crc16(mask, map_index); + + // Print pattern match, for debug purpose. + DbgPrintF(MP_LOUD, "%s - Pattern[%d]:", __FUNCTION__, i); + for (kp = 0, km = 0; kp < sizeof(pdata->pattern[i].pattern_info); kp += 16, km += 2) { + ptdata = &pdata->pattern[i].pattern_info[kp]; + ptmask = &pdata->pattern[i].mask_info[km]; + DBGPRINT(MP_LOUD, ("\n %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x Mask %02x-%02x", + ptdata[0], ptdata[1], ptdata[2], ptdata[3], ptdata[4], ptdata[5], ptdata[6], ptdata[7], + ptdata[8], ptdata[9], ptdata[10], ptdata[11], ptdata[12], ptdata[13], ptdata[14], ptdata[15], + ptmask[0], ptmask[1])); + } + //fxgmac_dump_buffer(mask, map_index, 2); + DbgPrintF(MP_LOUD, "WritePatternToNic62 the %d patterns crc = %x mask length = %d, mask_offset=%x.\n", + i, pdata->pattern[i].pattern_crc, map_index, + pdata->pattern[i].pattern_offset); + memset(mask, 0, sizeof(mask)); + } + + // Write patterns by FIFO block. + for (i = 0; i < (total_cnt + 3) / 4; i++) { + // 1. Write the first 4Bytes of Filter. + writereg(pdata->pAdapter, + ((pdata->pattern[i * 4 + 0].mask_info[3] & 0x7f) << 24) | + (pdata->pattern[i * 4 + 0].mask_info[2] << 16) | + (pdata->pattern[i * 4 + 0].mask_info[1] << 8) | + (pdata->pattern[i * 4 + 0].mask_info[0] << 0), + pdata->mac_regs + MAC_RWK_PAC); + + writereg(pdata->pAdapter, + ((pdata->pattern[i * 4 + 1].mask_info[3] & 0x7f) << 24) | + (pdata->pattern[i * 4 + 1].mask_info[2] << 16) | + (pdata->pattern[i * 4 + 1].mask_info[1] << 8) | + (pdata->pattern[i * 4 + 1].mask_info[0] << 0), + pdata->mac_regs + MAC_RWK_PAC); + + writereg(pdata->pAdapter, + ((pdata->pattern[i * 4 + 2].mask_info[3] & 0x7f) << 24) | + (pdata->pattern[i * 4 + 2].mask_info[2] << 16) | + (pdata->pattern[i * 4 + 2].mask_info[1] << 8) | + (pdata->pattern[i * 4 + 2].mask_info[0] << 0), + pdata->mac_regs + MAC_RWK_PAC); + + writereg(pdata->pAdapter, + ((pdata->pattern[i * 4 + 3].mask_info[3] & 0x7f) << 24) | + (pdata->pattern[i * 4 + 3].mask_info[2] << 16) | + (pdata->pattern[i * 4 + 3].mask_info[1] << 8) | + (pdata->pattern[i * 4 + 3].mask_info[0] << 0), + pdata->mac_regs + MAC_RWK_PAC); + + // 2. Write the Filter Command. + regval = 0; + // Set filter enable bit. + regval |= ((i * 4 + 0) < total_cnt) ? (0x1 << 0) : 0x0; + regval |= ((i * 4 + 1) < total_cnt) ? (0x1 << 8) : 0x0; + regval |= ((i * 4 + 2) < total_cnt) ? (0x1 << 16) : 0x0; + regval |= ((i * 4 + 3) < total_cnt) ? (0x1 << 24) : 0x0; + // Set filter address type, 0- unicast, 1 - multicast. + regval |= (i * 4 + 0 >= total_cnt) ? 0x0 : + (i * 4 + 0 >= pattern_cnt) ? (0x1 << (3 + 0)) : + pdata->pattern[i * 4 + 0].pattern_offset ? 0x0 : + !(pdata->pattern[i * 4 + 0].mask_info[0] & 0x01) ? 0x0 : + (pdata->pattern[i * 4 + 0].pattern_info[0] & 0x01) ? (0x1 << (3 + 0)) : 0x0; + regval |= (i * 4 + 1 >= total_cnt) ? 0x0 : + (i * 4 + 1 >= pattern_cnt) ? (0x1 << (3 + 8)) : + pdata->pattern[i * 4 + 1].pattern_offset ? 0x0 : + !(pdata->pattern[i * 4 + 1].mask_info[0] & 0x01) ? 0x0 : + (pdata->pattern[i * 4 + 1].pattern_info[0] & 0x01) ? (0x1 << (3 + 8)) : 0x0; + regval |= (i * 4 + 2 >= total_cnt) ? 0x0 : + (i * 4 + 2 >= pattern_cnt) ? (0x1 << (3 + 16)) : + pdata->pattern[i * 4 + 2].pattern_offset ? 0x0 : + !(pdata->pattern[i * 4 + 2].mask_info[0] & 0x01) ? 0x0 : + (pdata->pattern[i * 4 + 2].pattern_info[0] & 0x01) ? (0x1 << (3 + 16)) : 0x0; + regval |= (i * 4 + 3 >= total_cnt) ? 0x0 : + (i * 4 + 3 >= pattern_cnt) ? (0x1 << (3 + 24)) : + pdata->pattern[i * 4 + 3].pattern_offset ? 0x0 : + !(pdata->pattern[i * 4 + 3].mask_info[0] & 0x01) ? 0x0 : + (pdata->pattern[i * 4 + 3].pattern_info[0] & 0x01) ? (0x1 << (3 + 24)) : 0x0; + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_RWK_PAC); + //DbgPrintF(MP_LOUD, "FilterCMD 0x%08x", regval); + + // 3. Write the mask offset. + writereg(pdata->pAdapter, + (pdata->pattern[i * 4 + 3].pattern_offset << 24) | + (pdata->pattern[i * 4 + 2].pattern_offset << 16) | + (pdata->pattern[i * 4 + 1].pattern_offset << 8) | + (pdata->pattern[i * 4 + 0].pattern_offset << 0), + pdata->mac_regs + MAC_RWK_PAC); + + // 4. Write the masked data CRC. + writereg(pdata->pAdapter, + (pdata->pattern[i * 4 + 1].pattern_crc << 16) | + (pdata->pattern[i * 4 + 0].pattern_crc << 0), + pdata->mac_regs + MAC_RWK_PAC); + writereg(pdata->pAdapter, + (pdata->pattern[i * 4 + 3].pattern_crc << 16) | + (pdata->pattern[i * 4 + 2].pattern_crc << 0), + pdata->mac_regs + MAC_RWK_PAC); + } + + for (i = 0; i < total_cnt; i++) { + fxgmac_set_wake_pattern_mask(pdata, i, 0, + ((pdata->pattern[i].mask_info[7] & 0x7f) << (24 + 1)) | + (pdata->pattern[i].mask_info[6] << (16 + 1)) | + (pdata->pattern[i].mask_info[5] << (8 + 1)) | + (pdata->pattern[i].mask_info[4] << (0 + 1)) | + ((pdata->pattern[i].mask_info[3] & 0x80) >> 7));//global manager regitster mask bit 31~62 + fxgmac_set_wake_pattern_mask(pdata, i, 1, + ((pdata->pattern[i].mask_info[11] & 0x7f) << (24 + 1)) | + (pdata->pattern[i].mask_info[10] << (16 + 1)) | + (pdata->pattern[i].mask_info[9] << (8 + 1)) | + (pdata->pattern[i].mask_info[8] << (0 + 1)) | + ((pdata->pattern[i].mask_info[7] & 0x80) >> 7));//global manager regitster mask bit 63~94 + fxgmac_set_wake_pattern_mask(pdata, i, 2, \ + ((pdata->pattern[i].mask_info[15] & 0x7f) << (24 + 1)) | + (pdata->pattern[i].mask_info[14] << (16 + 1)) | + (pdata->pattern[i].mask_info[13] << (8 + 1)) | + (pdata->pattern[i].mask_info[12] << (0 + 1)) | + ((pdata->pattern[i].mask_info[11] & 0x80) >> 7));//global manager regitster mask bit 95~126 + } + + return 0; +} + +static int fxgmac_enable_wake_pattern(struct fxgmac_pdata* pdata) +{ + u32 regval; + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_RWKFILTERST_POS, MAC_PMT_STA_RWKFILTERST_LEN,1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_RWKPKTEN_POS, MAC_PMT_STA_RWKPKTEN_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PMT_STA); + regval = readreg(pdata->pAdapter, pdata->base_mem + WOL_CTL); + regval = FXGMAC_SET_REG_BITS(regval, WOL_PKT_EN_POS, WOL_PKT_EN_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + WOL_CTL); + return 0; +} + +static int fxgmac_disable_wake_pattern(struct fxgmac_pdata* pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_RWKFILTERST_POS, MAC_PMT_STA_RWKFILTERST_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_RWKPKTEN_POS, MAC_PMT_STA_RWKPKTEN_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PMT_STA); + regval = readreg(pdata->pAdapter, pdata->base_mem + WOL_CTL); + regval = FXGMAC_SET_REG_BITS(regval, WOL_PKT_EN_POS, WOL_PKT_EN_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + WOL_CTL); + return 0; +} +static int fxgmac_enable_wake_magic_pattern(struct fxgmac_pdata* pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_MGKPKTEN_POS, MAC_PMT_STA_MGKPKTEN_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PMT_STA); + regval = readreg(pdata->pAdapter, pdata->base_mem + WOL_CTL); + regval = FXGMAC_SET_REG_BITS(regval, WOL_PKT_EN_POS, WOL_PKT_EN_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + WOL_CTL); + + /* Enable PME Enable Bit. */ + cfg_r32(pdata, REG_PM_STATCTRL, ®val); + regval = FXGMAC_SET_REG_BITS(regval, PM_CTRLSTAT_PME_EN_POS, PM_CTRLSTAT_PME_EN_LEN, 1); + cfg_w32(pdata, REG_PM_STATCTRL, regval); + + return 0; +} + +static int fxgmac_disable_wake_magic_pattern(struct fxgmac_pdata* pdata) +{ + u32 regval; + regval = readreg(pdata->pAdapter, pdata->base_mem + WOL_CTL); + regval = FXGMAC_SET_REG_BITS(regval, WOL_PKT_EN_POS, WOL_PKT_EN_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + WOL_CTL); + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_MGKPKTEN_POS, MAC_PMT_STA_MGKPKTEN_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PMT_STA); + return 0; +} + +#if FXGMAC_PM_WPI_READ_FEATURE_ENABLED +/* + * enable Wake packet indication. called to enable before sleep/hibernation + * and no needed to call disable for that, fxgmac_get_wake_packet_indication will clear to normal once done. + */ +static void fxgmac_enable_wake_packet_indication(struct fxgmac_pdata* pdata, int en) +{ + u32 val_wpi_crtl0; + + /* read-clear WoL event. */ + readreg(pdata->pAdapter, pdata->base_mem + MGMT_WOL_CTRL); + + /* get wake packet information */ + val_wpi_crtl0 = (u32)readreg(pdata->pAdapter, pdata->base_mem + MGMT_WPI_CTRL0); + + /* prepare to write packet data by write wpi_mode to 1 */ + val_wpi_crtl0 = FXGMAC_SET_REG_BITS(val_wpi_crtl0, + MGMT_WPI_CTRL0_WPI_MODE_POS, + MGMT_WPI_CTRL0_WPI_MODE_LEN, (en ? MGMT_WPI_CTRL0_WPI_MODE_WR : MGMT_WPI_CTRL0_WPI_MODE_NORMAL)); + writereg(pdata->pAdapter, val_wpi_crtl0, pdata->base_mem + MGMT_WPI_CTRL0); + + DbgPrintF(MP_TRACE, "%s - WPI pkt enable=%d, reg=%08x.\n", __FUNCTION__, en, val_wpi_crtl0); + + return; +} + +/* + * this function read Wake up packet after MDIS resume + * input: + * pdata + * wpi_buf container of a packet. + * buf_size size of the packet container. since HW limit to 14bits, ie 16KB all together. + * output: + * wake_reason from HW, we can indentify 1)magic packet, or 2)pattern(remote wake packet) or WAKE_REASON_HW_ERR indicates err + * packet_size length of the wake packet. 0 indicates exception. + * + */ +static void fxgmac_get_wake_packet_indication(struct fxgmac_pdata* pdata, int* wake_reason, u32* wake_pattern_number, u8* wpi_buf, u32 buf_size, u32* packet_size) +{ + u32 i, regval, val_wpi_crtl0, *dw_wpi_buf; + u32 data_len, data_len_dw, b_need_pkt = 0; + + *wake_reason = WAKE_REASON_NONE; + *packet_size = 0; + fxgmac_release_phy(pdata); +#if 1 + /* try to check wake reason. GMAC reg 20c0 only tells Magic or remote-pattern + * read from MGMT_WOL_CTRL, 1530 instead. + */ + regval = (u32)readreg(pdata->pAdapter, pdata->base_mem + MGMT_WOL_CTRL); + DbgPrintF(MP_TRACE, "%s - 0x1530=%x.\n", __FUNCTION__, regval); + if (!regval) { + DbgPrintF(MP_TRACE, "%s - nothing for WPI pkt.\n", __FUNCTION__); + return; + } + + if (regval & MGMT_WOL_CTRL_WPI_MGC_PKT) { + *wake_reason = WAKE_REASON_MAGIC; + b_need_pkt = 1; + } else if (regval & MGMT_WOL_CTRL_WPI_RWK_PKT) { + *wake_reason = WAKE_REASON_PATTERNMATCH; + b_need_pkt = 1; + *wake_pattern_number = 0; + + /* + * wake_pattern_number, HW should tell,,tbd + */ + for (i = 0;i < MAX_PATTERN_COUNT;i++) { + if (regval & ((u32)MGMT_WOL_CTRL_WPI_RWK_PKT_NUMBER << i)) { + *wake_pattern_number = i; + break; + } + } + //*wake_pattern_number = regval&MGMT_WOL_CTRL_WPI_RWK_PKT_NUMBER; + + } else if (regval & MGMT_WOL_CTRL_WPI_LINK_CHG) { + *wake_reason = WAKE_REASON_LINK; + } + +#else + /* for 20c0 */ + regval = (u32)readreg(pdata->mac_regs + MAC_PMT_STA); + DbgPrintF(MP_TRACE, "%s - 0x20c0=%x.\n", __FUNCTION__, regval); + if (FXGMAC_GET_REG_BITS(regval, + MAC_PMT_STA_MGKPRCVD_POS, + MAC_PMT_STA_MGKPRCVD_LEN)) { + *wake_reason = WAKE_REASON_MAGIC; + b_need_pkt = 1; + DbgPrintF(MP_TRACE, "%s - waken up by Magic.\n", __FUNCTION__); + } else if (FXGMAC_GET_REG_BITS(regval, + MAC_PMT_STA_RWKPRCVD_POS, + MAC_PMT_STA_RWKPRCVD_LEN)) { + *wake_reason = WAKE_REASON_PATTERNMATCH; + b_need_pkt = 1; + DbgPrintF(MP_TRACE, "%s - waken up by Pattern.\n", __FUNCTION__); + } +#endif + + if (!b_need_pkt) { + DbgPrintF(MP_TRACE, "%s - wake by link and no WPI pkt.\n", __FUNCTION__); + return; + } + + /* get wake packet information */ + val_wpi_crtl0 = (u32)readreg(pdata->pAdapter, pdata->base_mem + MGMT_WPI_CTRL0); + + if (val_wpi_crtl0 & MGMT_WPI_CTRL0_WPI_FAIL) { + *wake_reason = WAKE_REASON_HW_ERR; + DbgPrintF(MP_TRACE, "%s - WPI pkt fail from hw.\n", __FUNCTION__); + return; + } + + *packet_size = FXGMAC_GET_REG_BITS(val_wpi_crtl0, + MGMT_WPI_CTRL0_WPI_PKT_LEN_POS, + MGMT_WPI_CTRL0_WPI_PKT_LEN_LEN); + + if (0 == *packet_size) { + *wake_reason = WAKE_REASON_HW_ERR; + DbgPrintF(MP_TRACE, "%s - WPI pkt len is 0 from hw.\n", __FUNCTION__); + return; + } + + + DbgPrintF(MP_TRACE, "%s - WPI pkt len from hw, *packet_size=%u.\n", __FUNCTION__, *packet_size); + + if (buf_size < *packet_size) { + DbgPrintF(MP_WARN, "%s - too small buf_size=%u, WPI pkt len is %u.\n", __FUNCTION__, buf_size, *packet_size); + data_len = buf_size; + } else { + data_len = *packet_size; + } + + /* prepare to read packet data by write wpi_mode to 2 */ + val_wpi_crtl0 = FXGMAC_SET_REG_BITS(val_wpi_crtl0, + MGMT_WPI_CTRL0_WPI_MODE_POS, + MGMT_WPI_CTRL0_WPI_MODE_LEN, MGMT_WPI_CTRL0_WPI_MODE_RD); + writereg(pdata->pAdapter, val_wpi_crtl0, pdata->base_mem + MGMT_WPI_CTRL0); + + dw_wpi_buf = (u32*)wpi_buf; + data_len_dw = (data_len + 3) / 4; + + i = 0; + DbgPrintF(MP_TRACE, "%s - before retrieve, len=%d, len_dw=%d, reg_wpi_ctrl0=%08x.\n", + __FUNCTION__, data_len, data_len_dw, val_wpi_crtl0); + while ((0 == (val_wpi_crtl0 & MGMT_WPI_CTRL0_WPI_OP_DONE))) { + if (i < data_len_dw) { + regval = (u32)readreg(pdata->pAdapter, pdata->base_mem + MGMT_WPI_CTRL1_DATA); + /*dw_wpi_buf[i] = SWAP_BYTES_32(regval);*/ + dw_wpi_buf[i] = regval; + + //DbgPrintF(MP_TRACE, "%s - read data, reg=%x, data[%d]=%08x.\n", __FUNCTION__, MGMT_WPI_CTRL1_DATA, i, dw_wpi_buf[i]); + } else { + break; + } + + val_wpi_crtl0 = (u32)readreg(pdata->pAdapter, pdata->base_mem + MGMT_WPI_CTRL0); + i++; + } + if (*packet_size <= MAC_CRC_LENGTH) + { + DbgPrintF(MP_TRACE, "%s - Warning, WPI pkt len is less 4 from hw.\n", __FUNCTION__); + return; + } + *packet_size -= MAC_CRC_LENGTH; + + /* once read data complete and write wpi_mode to 0, normal */ + val_wpi_crtl0 = FXGMAC_SET_REG_BITS(val_wpi_crtl0, + MGMT_WPI_CTRL0_WPI_MODE_POS, + MGMT_WPI_CTRL0_WPI_MODE_LEN, MGMT_WPI_CTRL0_WPI_MODE_NORMAL); + writereg(pdata->pAdapter, val_wpi_crtl0, pdata->base_mem + MGMT_WPI_CTRL0); + + DbgPrintF(MP_TRACE, "%s - WPI done and back to normal mode, reg=%08x, read data=%dB.\n", __FUNCTION__, val_wpi_crtl0, i * 4); + + return; +} +#endif /* FXGMAC_PM_WPI_READ_FEATURE_ENABLED */ + +static int fxgmac_enable_wake_link_change(struct fxgmac_pdata* pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->base_mem + WOL_CTL); + regval = FXGMAC_SET_REG_BITS(regval, WOL_LINKCHG_EN_POS, WOL_LINKCHG_EN_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + WOL_CTL); + return 0; +} +static int fxgmac_disable_wake_link_change(struct fxgmac_pdata* pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->base_mem + WOL_CTL); + regval = FXGMAC_SET_REG_BITS(regval, WOL_LINKCHG_EN_POS, WOL_LINKCHG_EN_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + WOL_CTL); + return 0; +} +#endif // FXGMAC_POWER_MANAGEMENT + +static u32 fxgmac_get_ephy_state(struct fxgmac_pdata* pdata) +{ + u32 value; + value = readreg(pdata->pAdapter, pdata->base_mem + MGMT_EPHY_CTRL); + return value; +} + +static void fxgmac_enable_dma_interrupts(struct fxgmac_pdata *pdata) +{ +#ifndef DPDK + u32 dma_ch_isr, dma_ch_ier; + u32 regval; + struct fxgmac_channel *channel; + unsigned int i; + + //config interrupt to level signal + regval = (u32)readreg(pdata->pAdapter, pdata->mac_regs + DMA_MR); + regval = FXGMAC_SET_REG_BITS(regval, DMA_MR_INTM_POS, DMA_MR_INTM_LEN, DMA_MA_INTM_LEVLE_ENHANCE); + regval = FXGMAC_SET_REG_BITS(regval, DMA_MR_QUREAD_POS, DMA_MR_QUREAD_LEN, DMA_MR_QUREAD_EN); + writereg(pdata->pAdapter, regval, pdata->mac_regs + DMA_MR); + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + /* Clear all the interrupts which are set */ + dma_ch_isr = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + writereg(pdata->pAdapter, dma_ch_isr, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + + /* Clear all interrupt enable bits */ + dma_ch_ier = 0; + + /* Enable following interrupts + * NIE - Normal Interrupt Summary Enable + * AIE - Abnormal Interrupt Summary Enable + * FBEE - Fatal Bus Error Enable + */ + dma_ch_ier = FXGMAC_SET_REG_BITS(dma_ch_ier, + DMA_CH_IER_NIE_POS, + DMA_CH_IER_NIE_LEN, 1); + /* + dma_ch_ier = FXGMAC_SET_REG_BITS(dma_ch_ier, + DMA_CH_IER_AIE_POS, + DMA_CH_IER_AIE_LEN, 1); + */ + dma_ch_ier = FXGMAC_SET_REG_BITS(dma_ch_ier, + DMA_CH_IER_FBEE_POS, + DMA_CH_IER_FBEE_LEN, 1); + + if (channel->tx_ring) { + /* Enable the following Tx interrupts + * TIE - Transmit Interrupt Enable (unless using + * per channel interrupts) + */ + if (!pdata->per_channel_irq) + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, + DMA_CH_IER_TIE_POS, + DMA_CH_IER_TIE_LEN, + 1); + if (FXGMAC_IS_CHANNEL_WITH_TX_IRQ(i)) { + if (pdata->per_channel_irq) { + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, + DMA_CH_IER_TIE_POS, + DMA_CH_IER_TIE_LEN, + 1); + + /*dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, + DMA_CH_IER_TBUE_POS, + DMA_CH_IER_TBUE_LEN, + 1);*/ + } + } + } + if (channel->rx_ring) { + /* Enable following Rx interrupts + * RBUE - Receive Buffer Unavailable Enable + * RIE - Receive Interrupt Enable (unless using + * per channel interrupts) + */ + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, + DMA_CH_IER_RBUE_POS, + DMA_CH_IER_RBUE_LEN, + 1); + //2022-04-20 xiaojiang comment + //windows driver set the per_channel_irq to be zero, Linux driver also comment this, so comment it directly + //if (!pdata->per_channel_irq) + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, + DMA_CH_IER_RIE_POS, + DMA_CH_IER_RIE_LEN, + 1); + } + + writereg(pdata->pAdapter, dma_ch_ier, FXGMAC_DMA_REG(channel, DMA_CH_IER)); + } +#else + struct fxgmac_tx_queue *txq; + unsigned int dma_ch_isr, dma_ch_ier; + unsigned int i; + + for (i = 0; i < pdata->expansion.eth_dev->data->nb_tx_queues; i++) { + txq = pdata->expansion.eth_dev->data->tx_queues[i]; + if (!txq) { + DPRINTK("Tx queue not setup for port %d\n", + pdata->expansion.eth_dev->data->port_id); + return; + } + + /* Clear all the interrupts which are set */ + dma_ch_isr = FXGMAC_DMA_IOREAD(txq, DMA_CH_SR); + FXGMAC_DMA_IOWRITE(txq, DMA_CH_SR, dma_ch_isr); + + /* Clear all interrupt enable bits */ + dma_ch_ier = 0; + + /* Enable following interrupts + * NIE - Normal Interrupt Summary Enable + * AIE - Abnormal Interrupt Summary Enable + * FBEE - Fatal Bus Error Enable + */ + FXGMAC_SET_BITS(dma_ch_ier, DMA_CH_IER, NIE, 1);//0 fx 1 + FXGMAC_SET_BITS(dma_ch_ier, DMA_CH_IER, AIE, 1); + FXGMAC_SET_BITS(dma_ch_ier, DMA_CH_IER, FBEE, 1); + + /* Enable following Rx interrupts + * RBUE - Receive Buffer Unavailable Enable + * RIE - Receive Interrupt Enable (unless using + * per channel interrupts in edge triggered + * mode) + */ + FXGMAC_SET_BITS(dma_ch_ier, DMA_CH_IER, RBUE, 1);//0 fx 1 + FXGMAC_SET_BITS(dma_ch_ier, DMA_CH_IER, RIE, 0);// 0 fx 1 + + FXGMAC_DMA_IOWRITE(txq, DMA_CH_IER, dma_ch_ier); + } +#endif +} + +static void fxgmac_enable_mtl_interrupts(struct fxgmac_pdata *pdata) +{ + unsigned int i; + u32 mtl_q_isr, q_count; + + q_count = max(pdata->hw_feat.tx_q_cnt, pdata->hw_feat.rx_q_cnt); + for (i = 0; i < q_count; i++) { + /* Clear all the interrupts which are set */ + mtl_q_isr = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_ISR)); + writereg(pdata->pAdapter, mtl_q_isr, FXGMAC_MTL_REG(pdata, i, MTL_Q_ISR)); + + /* No MTL interrupts to be enabled */ + writereg(pdata->pAdapter, 0, FXGMAC_MTL_REG(pdata, i, MTL_Q_IER)); + } +} + +static void fxgmac_enable_mac_interrupts(struct fxgmac_pdata *pdata) +{ + u32 mac_ier = 0; + u32 regval; + + /* Enable Timestamp interrupt */ + mac_ier = FXGMAC_SET_REG_BITS(mac_ier, MAC_IER_TSIE_POS, + MAC_IER_TSIE_LEN, 1); + + writereg(pdata->pAdapter, mac_ier, pdata->mac_regs + MAC_IER); + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MMC_RIER); + regval = FXGMAC_SET_REG_BITS(regval, MMC_RIER_ALL_INTERRUPTS_POS, + MMC_RIER_ALL_INTERRUPTS_LEN, FXGMAC_MMC_IER_ALL_DEFAULT); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MMC_RIER); + regval = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TIER); + regval = FXGMAC_SET_REG_BITS(regval, MMC_TIER_ALL_INTERRUPTS_POS, + MMC_TIER_ALL_INTERRUPTS_LEN, FXGMAC_MMC_IER_ALL_DEFAULT); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MMC_TIER); +} + +static int fxgmac_set_fxgmii_2500_speed(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_PS_POS, + MAC_CR_PS_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_FES_POS, + MAC_CR_FES_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_DM_POS, + MAC_CR_DM_LEN , pdata->phy_duplex); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + return 0; +} + +static int fxgmac_set_fxgmii_1000_speed(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_PS_POS, + MAC_CR_PS_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_FES_POS, + MAC_CR_FES_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_DM_POS, + MAC_CR_DM_LEN , pdata->phy_duplex); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + return 0; +} + +static int fxgmac_set_fxgmii_100_speed(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_PS_POS, + MAC_CR_PS_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_FES_POS, + MAC_CR_FES_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_DM_POS, + MAC_CR_DM_LEN , pdata->phy_duplex); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + return 0; +} + +static int fxgmac_set_fxgmii_10_speed(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_PS_POS, + MAC_CR_PS_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_FES_POS, + MAC_CR_FES_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_DM_POS, + MAC_CR_DM_LEN , pdata->phy_duplex); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + return 0; +} + + /** + * fxgmac_check_phy_link - Get link/speed status + * @pdata: pointer to gmac structure + * @speed: pointer to link speed + * @link_up: true is link is up, false otherwise + * @link_up_wait_to_complete: bool used to wait for link up or not + * + * Reads the links register to determine if link is up and the current speed + **/ +static int fxgmac_check_phy_link(struct fxgmac_pdata *pdata, + u32 *speed, bool *link_up, + bool link_up_wait_to_complete) +{ + u16 link_reg = 0; + (void) link_up_wait_to_complete; + if (pdata->base_mem) { + link_reg = (u16)readreg(pdata->pAdapter, pdata->base_mem + MGMT_EPHY_CTRL); + + pdata->phy_duplex = !!(link_reg&0x4);//need check + + /* + * check register address 0x1004 + * b[6:5] ephy_pause + * b[4:3] ephy_speed 0b10 1000m 0b01 100m + * b[2] ephy_duplex + * b[1] ephy_link + * b[0] ephy_reset. should be set to 1 before use phy. + */ + + *link_up = false; + if (link_reg & MGMT_EPHY_CTRL_STA_EPHY_RELEASE) { + if (link_up) { + *link_up = (link_reg & MGMT_EPHY_CTRL_STA_EPHY_LINKUP) ? true : false; + } + if (speed) *speed = (link_reg & MGMT_EPHY_CTRL_STA_SPEED_MASK) >> MGMT_EPHY_CTRL_STA_SPEED_POS; + } + else { + DPRINTK("fxgmac_check_phy_link ethernet PHY not released link reg %d.\n", link_reg); + return -1; + } + }else { + DPRINTK("fxgmac_check_phy_link null base addr err link reg %d\n", link_reg); + return -1; + } + + return 0; +} + +static int fxgmac_config_mac_speed(struct fxgmac_pdata *pdata) +{ + switch (pdata->phy_speed) { + case SPEED_2500: + fxgmac_set_fxgmii_2500_speed(pdata); + break; + case SPEED_1000: + fxgmac_set_fxgmii_1000_speed(pdata); + break; + case SPEED_100: + fxgmac_set_fxgmii_100_speed(pdata); + break; + case SPEED_10: + fxgmac_set_fxgmii_10_speed(pdata); + break; + } + return 0; +} + +static int fxgmac_write_ephy_reg(struct fxgmac_pdata* pdata, u32 reg_id, u32 data) +{ + u32 regval; + u32 mdioctrl = reg_id * 0x10000 + 0x8000205; + int busy = 15; + + writereg(pdata->pAdapter, data, pdata->mac_regs + MAC_MDIO_DATA); + writereg(pdata->pAdapter, mdioctrl, pdata->mac_regs + MAC_MDIO_ADDRESS); + do { + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_MDIO_ADDRESS); + busy--; + }while((regval & MAC_MDIO_ADDRESS_BUSY) && (busy)); + + DPRINTK("fxgmac_write_ephy_reg id %d,", reg_id); + DPRINTK(" %s,", (regval & 0x1)?"err" : "ok"); + DPRINTK(" ctrl=0x%08x,", regval); + DPRINTK(" data=0x%08x\n", data); + + return (regval & MAC_MDIO_ADDRESS_BUSY) ? -ETIMEDOUT : 0; //-1 indicates err +} + +static int fxgmac_read_ephy_reg(struct fxgmac_pdata* pdata, u32 reg_id, u32 __far* data) +{ + u32 regval = 0, regret; + u32 mdioctrl = reg_id * 0x10000 + 0x800020d; + int busy = 15; + + writereg(pdata->pAdapter, mdioctrl, pdata->mac_regs + MAC_MDIO_ADDRESS); + do { + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_MDIO_ADDRESS); + busy--; + //DPRINTK("fxgmac_read_ephy_reg, check busy %d, ctrl=0x%08x\n", busy, regval); + }while((regval & MAC_MDIO_ADDRESS_BUSY) && (busy)); + + if (0 == (regval & MAC_MDIO_ADDRESS_BUSY)) { + regret = readreg(pdata->pAdapter, pdata->mac_regs + MAC_MDIO_DATA); + if(data) { + *data = regret; + //DPRINTK("fxgmac_read_ephy_reg ok, reg=0x%02x, ctrl=0x%08x, data=0x%08x\n", reg_id, regval, *data); + return 0; + }else { + return -ENOBUFS; + } + } + + DPRINTK("fxgmac_read_ephy_reg id=0x%02x err,", reg_id); + DPRINTK(" busy=%d,", busy); + DPRINTK(" ctrl=0x%08x\n", regval); + + return -ETIMEDOUT; +} + +static int fxgmac_write_ephy_mmd_reg(struct fxgmac_pdata* pdata, u32 reg_id, u32 mmd, u32 data) +{ + u32 regval; + u32 mdioctrl = (mmd << 16) + 0x8000207; + u32 regdata = (reg_id << 16) + data; + //for phy mmd reg r/w operation, set more delay time than phy mii reg r/w + int busy = 60; + + writereg(pdata->pAdapter, regdata, pdata->mac_regs + MAC_MDIO_DATA); + writereg(pdata->pAdapter, mdioctrl, pdata->mac_regs + MAC_MDIO_ADDRESS); + do { + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_MDIO_ADDRESS); + busy--; + } while ((regval & MAC_MDIO_ADDRESS_BUSY) && (busy)); + + DPRINTK("fxgmac_write_ephy_mmd_reg id %d,", reg_id); + DPRINTK(" mmd %d,", mmd); + DPRINTK(" %s,", (regval & 0x1) ? "err" : "ok"); + DPRINTK(" ctrl=0x%08x,", regval); + DPRINTK(" data=0x%08x\n", data); + //DbgPrintF(MP_TRACE, "fxgmac_write_ephy_mmd_reg id %d %s, ctrl=0x%08x, data=0x%08x busy %d", reg_id, (regval & 0x1) ? "err" : "ok", regval, data, busy); + + return (regval & MAC_MDIO_ADDRESS_BUSY) ? -1 : 0; //-1 indicates err +} + +/* +#if !defined(LINUX) && !defined(DPDK) +static int fxgmac_read_ephy_mmd_reg(struct fxgmac_pdata* pdata, u32 reg_id, u32 mmd, u32* data) +{ + u32 regval = 0, regret; + u32 mdioctrl = (mmd << 16) + 0x800020f; + u32 regdata = (reg_id << 16); + //for phy mmd reg r/w operation, set more delay time than phy mii reg r/w + int busy = 60; + + writereg(pdata->pAdapter, regdata, pdata->mac_regs + MAC_MDIO_DATA); + writereg(pdata->pAdapter, mdioctrl, pdata->mac_regs + MAC_MDIO_ADDRESS); + + do { + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_MDIO_ADDRESS); + busy--; + } while ((regval & MAC_MDIO_ADDRESS_BUSY) && (busy)); + + if (0 == (regval & MAC_MDIO_ADDRESS_BUSY)) { + regret = readreg(pdata->pAdapter, pdata->mac_regs + MAC_MDIO_DATA); + if (data) *data = (regret & 0xffff); + return regret; + } + + DPRINTK("fxgmac_read_ephy_mmd_reg id=0x%02x mmd %d err, busy=%d, ctrl=0x%08x\n", reg_id, mmd, busy, regval); + //DbgPrintF(MP_TRACE, "fxgmac_read_ephy_mmd_reg id=0x%02x err, busy=%d, ctrl=0x%08x\n", reg_id, busy, regval); + return -1; +} +#endif +*/ + +static void fxgmac_config_flow_control(struct fxgmac_pdata* pdata) +{ +#ifndef FXGMAC_NOT_REPORT_PHY_FC_CAPABILITY + u32 regval = 0; +#endif + + fxgmac_config_tx_flow_control(pdata); + fxgmac_config_rx_flow_control(pdata); + +#ifndef FXGMAC_NOT_REPORT_PHY_FC_CAPABILITY + fxgmac_read_ephy_reg(pdata, REG_MII_ADVERTISE, ®val); + //set auto negotiation advertisement pause ability + if (pdata->tx_pause || pdata->rx_pause) { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_PAUSE_POS, PHY_MII_ADVERTISE_PAUSE_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_ASYPAUSE_POS, PHY_MII_ADVERTISE_ASYPAUSE_LEN, 1); + } else { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_PAUSE_POS, PHY_MII_ADVERTISE_PAUSE_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_ASYPAUSE_POS, PHY_MII_ADVERTISE_ASYPAUSE_LEN, 0); + } + fxgmac_write_ephy_reg(pdata, REG_MII_ADVERTISE, regval); + //after change the auto negotiation advertisement need to soft reset + fxgmac_read_ephy_reg(pdata, REG_MII_BMCR, ®val); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_RESET_POS, PHY_CR_RESET_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_BMCR, regval); +#endif +} + +static int fxgmac_set_ephy_autoneg_advertise(struct fxgmac_pdata* pdata, struct fxphy_ag_adv phy_ag_adv) +{ + u32 regval = 0; + int ret = 0; + + ret = fxgmac_read_ephy_reg(pdata, REG_MII_BMCR, ®val); + if (ret < 0) + return ret; + + if (phy_ag_adv.auto_neg_en) { + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_AUTOENG_POS, PHY_CR_AUTOENG_LEN, 1); + } else { + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_AUTOENG_POS, PHY_CR_AUTOENG_LEN, 0); + } + + ret = fxgmac_write_ephy_reg(pdata, REG_MII_BMCR, regval); + if (ret < 0) + return ret; + + ret = fxgmac_read_ephy_reg(pdata, REG_MII_CTRL1000, ®val); + if (ret < 0) + return ret; + + if (phy_ag_adv.full_1000m) { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_CTRL1000_1000FULL_POS, PHY_MII_CTRL1000_1000FULL_LEN, 1); + } else { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_CTRL1000_1000FULL_POS, PHY_MII_CTRL1000_1000FULL_LEN, 0); + } + if (phy_ag_adv.half_1000m) { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_CTRL1000_1000HALF_POS, PHY_MII_CTRL1000_1000HALF_LEN, 1); + } else { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_CTRL1000_1000HALF_POS, PHY_MII_CTRL1000_1000HALF_LEN, 0); + } + + ret = fxgmac_write_ephy_reg(pdata, REG_MII_CTRL1000, regval); + if (ret < 0) + return ret; + + ret = fxgmac_read_ephy_reg(pdata, REG_MII_ADVERTISE, ®val); + if (ret < 0) + return ret; + + if (phy_ag_adv.full_100m) { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_100FULL_POS, PHY_MII_ADVERTISE_100FULL_LEN, 1); + } else { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_100FULL_POS, PHY_MII_ADVERTISE_100FULL_LEN, 0); + } + if (phy_ag_adv.half_100m) { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_100HALF_POS, PHY_MII_ADVERTISE_100HALF_LEN, 1); + } else { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_100HALF_POS, PHY_MII_ADVERTISE_100HALF_LEN, 0); + } + if (phy_ag_adv.full_10m) { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_10FULL_POS, PHY_MII_ADVERTISE_10FULL_LEN, 1); + } else { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_10FULL_POS, PHY_MII_ADVERTISE_10FULL_LEN, 0); + } + if (phy_ag_adv.half_10m) { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_10HALF_POS, PHY_MII_ADVERTISE_10HALF_LEN, 1); + } else { + regval = FXGMAC_SET_REG_BITS(regval, PHY_MII_ADVERTISE_10HALF_POS, PHY_MII_ADVERTISE_10HALF_LEN, 0); + } + + ret = fxgmac_write_ephy_reg(pdata, REG_MII_ADVERTISE, regval); + if (ret < 0) + return ret; + + //after change the auto negotiation advertisement need to soft reset + ret = fxgmac_read_ephy_reg(pdata, REG_MII_BMCR, ®val); + if (ret < 0) + return ret; + + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_RESET_POS, PHY_CR_RESET_LEN, 1); + ret = fxgmac_write_ephy_reg(pdata, REG_MII_BMCR, regval); + + return ret; +} + +static int fxgmac_phy_config(struct fxgmac_pdata* pdata) +{ + struct fxphy_ag_adv phy_ag_adv; + + if (pdata->phy_autoeng) { + phy_ag_adv.auto_neg_en = 1; + } else { + phy_ag_adv.auto_neg_en = (pdata->phy_speed == SPEED_1000M) ? 1 : 0; + } + switch (pdata->phy_speed) + { + case SPEED_1000: + phy_ag_adv.full_1000m = 1, phy_ag_adv.half_1000m = 0, phy_ag_adv.full_100m = 1, phy_ag_adv.half_100m = 1, phy_ag_adv.full_10m = 1, phy_ag_adv.half_10m = 1; + break; + + case SPEED_100: + phy_ag_adv.full_1000m = 0, phy_ag_adv.half_1000m = 0; + if (pdata->phy_duplex) { + phy_ag_adv.full_100m = 1; + } else { + phy_ag_adv.full_100m = 0; + } + phy_ag_adv.half_100m = 1, phy_ag_adv.full_10m = 1, phy_ag_adv.half_10m = 1; + break; + + case SPEED_10: + phy_ag_adv.full_1000m = 0, phy_ag_adv.half_1000m = 0; + phy_ag_adv.full_100m = 0, phy_ag_adv.half_100m = 0; + if (pdata->phy_duplex) { + phy_ag_adv.full_10m = 1; + } else { + phy_ag_adv.full_10m = 0; + } + phy_ag_adv.half_10m = 1; + break; + + default: + break; + } + return fxgmac_set_ephy_autoneg_advertise(pdata, phy_ag_adv); +} + +static void fxgmac_phy_green_ethernet(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + //GREEN + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_REG_PMA_DBG0_ADC); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_ENABLE_GIGA_POWER_SAVING_FOR_SHORT_CABLE); + + //CLD + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_REG_CLD_REG0); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_ENABLE_CLD_NP_WP); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_REG_CLD_REG1); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_ENABLE_CLD_GT_HT_BT); + + //after change green ethernet & CLD need to soft reset + fxgmac_read_ephy_reg(pdata, REG_MII_BMCR, ®val); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_RESET_POS, PHY_CR_RESET_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_BMCR, regval); +} + +static void fxgmac_phy_eee_feature(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + + regval = readreg(pdata->pAdapter, pdata->mac_regs + DMA_SBMR); + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_EN_LPI_POS, DMA_SBMR_EN_LPI_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_LPI_XIT_PKT_POS, DMA_SBMR_LPI_XIT_PKT_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_AALE_POS, DMA_SBMR_AALE_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + DMA_SBMR); + + //regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_IER); + //regval = FXGMAC_SET_REG_BITS(regval, MAC_LPIIE_POS, MAC_LPIIE_LEN, 1); + //writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_IER); + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_LPI_STA); + regval = FXGMAC_SET_REG_BITS(regval, MAC_LPIATE_POS, MAC_LPIATE_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_LPITXA_POS, MAC_LPITXA_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PLS_POS, MAC_PLS_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, MAC_LPIEN_POS, MAC_LPIEN_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_LPI_STA); + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_LPI_TIMER); + regval = FXGMAC_SET_REG_BITS(regval, MAC_LPIET_POS, MAC_LPIET_LEN, MAC_LPI_ENTRY_TIMER); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_LPI_TIMER); + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_LPI_CONTROL); + regval = FXGMAC_SET_REG_BITS(regval, MAC_TWT_POS, MAC_TWT_LEN, MAC_TWT_TIMER); + regval = FXGMAC_SET_REG_BITS(regval, MAC_LST_POS, MAC_LST_LEN, MAC_LST_TIMER); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_LPI_CONTROL); + + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_MS_TIC_COUNTER); + regval = FXGMAC_SET_REG_BITS(regval, MAC_MS_TIC_POS, MAC_MS_TIC_LEN, MAC_MS_TIC); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_MS_TIC_COUNTER); + + //usleep_range_ex(pdata->pAdapter, 1500, 1500); + + fxgmac_write_ephy_mmd_reg(pdata, REG_MMD_EEE_ABILITY_REG, 0x07, REG_MMD_EEE_ABILITY_VALUE); + + //after change EEE need to soft reset + fxgmac_read_ephy_reg(pdata, REG_MII_BMCR, ®val); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_RESET_POS, PHY_CR_RESET_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_BMCR, regval); +} + +static void fxgmac_reset_phy(struct fxgmac_pdata* pdata) +{ + u32 value = 0; + + value = FXGMAC_SET_REG_BITS(value, MGMT_EPHY_CTRL_RESET_POS, MGMT_EPHY_CTRL_RESET_LEN, MGMT_EPHY_CTRL_STA_EPHY_RESET); + writereg(pdata->pAdapter, value, pdata->base_mem + MGMT_EPHY_CTRL); + usleep_range_ex(pdata->pAdapter, 1500, 1500); +} + +void fxgmac_release_phy(struct fxgmac_pdata* pdata) +{ + u32 value = 0; + + value = FXGMAC_SET_REG_BITS(value, MGMT_EPHY_CTRL_RESET_POS, MGMT_EPHY_CTRL_RESET_LEN, MGMT_EPHY_CTRL_STA_EPHY_RELEASE); + writereg(pdata->pAdapter, value, pdata->base_mem + MGMT_EPHY_CTRL); + usleep_range_ex(pdata->pAdapter, 100, 150); + value = readreg(pdata->pAdapter, pdata->base_mem + MGMT_EPHY_CTRL); + DBGPRINT(MP_LOUD, ("0x1004: 0x%x\n", value)); +#ifdef AISC_MODE + fxgmac_read_ephy_reg(pdata, REG_MII_SPEC_CTRL, &value);// read phy specific control + value = FXGMAC_SET_REG_BITS(value, PHY_MII_SPEC_CTRL_CRS_ON_POS, PHY_MII_SPEC_CTRL_CRS_ON_LEN, 1);//set on crs on + fxgmac_write_ephy_reg(pdata, REG_MII_SPEC_CTRL, value);// phy specific control set on crs on + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_ANALOG_CFG3); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, &value); + // VGA bandwidth, default is 2 after reset. Set to 0 to mitigate unstable issue in 130m. + value = FXGMAC_SET_REG_BITS(value, MII_EXT_ANALOG_CFG3_ADC_START_CFG_POS, + MII_EXT_ANALOG_CFG3_ADC_START_CFG_LEN, MII_EXT_ANALOG_CFG3_ADC_START_CFG_DEFAULT); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, value); + +#if 0 + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_PMA_DEBUG_KCOEF); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, &value); + /* After reset, it's 0x10. We need change it to 0x20 to make it easier to linkup in gigabit mode with long cable. But this is has side effect.*/ + value = FXGMAC_SET_REG_BITS(value, MII_EXT_PMA_DEBUG_KCOEF_IPR_KCOEF_GE_LNG_POS, + MII_EXT_PMA_DEBUG_KCOEF_IPR_KCOEF_GE_LNG_LEN, MII_EXT_PMA_DEBUG_KCOEF_IPR_KCOEF_GE_LNG_DEFAULT); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, value); +#endif + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_ANALOG_CFG2); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_ANALOG_CFG2_VALUE); + + cfg_r32(pdata, REG_PCI_SUB_VENDOR_ID, &value); + if (AISTONEID_137D1D05_ADJUST_SI == value) { + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_ANALOG_CFG8); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_ANALOG_CFG8_137D1D05_VALUE); + } else { + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_ANALOG_CFG8); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_ANALOG_CFG8_VALUE); + } + + //http://redmine.motor-comm.com/issues/17830 + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_AFE_CONTROL_REGISTER3); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, &value); + value = FXGMAC_SET_REG_BITS(value, REG_MII_EXT_AFE_CONTROL_CLKDAC_AON_POS, REG_MII_EXT_AFE_CONTROL_CLKDAC_AON_LEN, REG_MII_EXT_AFE_CONTROL_CLKDAC_AON_ON); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, value); + + fxgmac_efuse_read_data(pdata, EFUSE_LED_ADDR, &value); + //led index use bit0~bit5 + value = FXGMAC_GET_REG_BITS(value, EFUSE_LED_POS, EFUSE_LED_LEN); + if (EFUSE_LED_COMMON_SOLUTION != value) { + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED0_CFG); + switch (value) { + case EFUSE_LED_SOLUTION1: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED0_CFG_VALUE_SOLUTION1); + break; + case EFUSE_LED_SOLUTION2: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED0_CFG_VALUE_SOLUTION2); + break; + case EFUSE_LED_SOLUTION3: + case EFUSE_LED_SOLUTION4: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED0_CFG_VALUE_SOLUTION3); + break; + default: + //default solution + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED0_CFG_VALUE_SOLUTION0); + break; + } + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED1_CFG); + switch (value) { + case EFUSE_LED_SOLUTION1: + case EFUSE_LED_SOLUTION4: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED1_CFG_VALUE_SOLUTION1); + break; + case EFUSE_LED_SOLUTION2: + case EFUSE_LED_SOLUTION3: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED1_CFG_VALUE_SOLUTION2); + break; + default: + //default solution + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED1_CFG_VALUE_SOLUTION0); + break; + } + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED2_CFG); + switch (value) { + case EFUSE_LED_SOLUTION1: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION0); + break; + case EFUSE_LED_SOLUTION2: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION2); + break; + case EFUSE_LED_SOLUTION3: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION3); + break; + case EFUSE_LED_SOLUTION4: + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION4); + break; + default: + //default solution + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION0); + break; + } + + if (EFUSE_LED_SOLUTION2 == value) { + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_BLINK_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED_BLINK_CFG_SOLUTION2); + } + } +#endif +} + +static void fxgmac_enable_phy_check(struct fxgmac_pdata* pdata) +{ + u32 value = 0; + //value = 0xa8d0; + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_PKG_CFG0); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, &value); + value = FXGMAC_SET_REG_BITS(value, REG_MII_EXT_PKG_CHECK_POS, REG_MII_EXT_PKG_CHECK_LEN, REG_MII_EXT_PKG_ENABLE_CHECK); + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_PKG_CFG0); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, value); +} + +static void fxgmac_disable_phy_check(struct fxgmac_pdata* pdata) +{ + u32 value = 0; + //value = 0x68d0; + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_PKG_CFG0); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, &value); + value = FXGMAC_SET_REG_BITS(value, REG_MII_EXT_PKG_CHECK_POS, REG_MII_EXT_PKG_CHECK_LEN, REG_MII_EXT_PKG_DISABLE_CHECK); + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_PKG_CFG0); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, value); +} + +static void fxgmac_setup_cable_loopback(struct fxgmac_pdata* pdata) +{ + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_SLEEP_CONTROL_REG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_SLEEP_REG_ENABLE_LOOPBACK); + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_LPBK_REG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_LPBK_REG_ENABLE_LOOPBACK); + + fxgmac_write_ephy_reg(pdata, REG_MII_BMCR, REG_MII_BMCR_ENABLE_LOOPBACK); +} + +static void fxgmac_clean_cable_loopback(struct fxgmac_pdata* pdata) +{ + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_SLEEP_CONTROL_REG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_SLEEP_REG_CLEAN_LOOPBACK); + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_LPBK_REG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_LPBK_REG_CLEAN_LOOPBACK); + + fxgmac_write_ephy_reg(pdata, REG_MII_BMCR, REG_MII_BMCR_DISABLE_LOOPBACK); +} + +static void fxgmac_disable_phy_sleep(struct fxgmac_pdata* pdata) +{ + u32 value = 0; + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_SLEEP_CONTROL_REG); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, &value); + + value = FXGMAC_SET_REG_BITS(value, MII_EXT_SLEEP_CONTROL1_EN_POS, MII_EXT_SLEEP_CONTROL1_EN_LEN, 0); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_SLEEP_CONTROL_REG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, value); +} + +static void fxgmac_enable_phy_sleep(struct fxgmac_pdata* pdata) +{ + u32 value = 0; + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_SLEEP_CONTROL_REG); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, &value); + + value = FXGMAC_SET_REG_BITS(value, MII_EXT_SLEEP_CONTROL1_EN_POS, MII_EXT_SLEEP_CONTROL1_EN_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_SLEEP_CONTROL_REG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, value); +} + +static void fxgmac_close_phy_led(struct fxgmac_pdata* pdata) +{ + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED0_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, 0x00); + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED1_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, 0x00); + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED2_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, 0x00); +} + +static void fxgmac_config_led_under_active(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + fxgmac_efuse_read_data(pdata, EFUSE_LED_ADDR, ®val); + //led index use bit0~bit5 + regval = FXGMAC_GET_REG_BITS(regval, EFUSE_LED_POS, EFUSE_LED_LEN); + if (EFUSE_LED_COMMON_SOLUTION == regval) { + DbgPrintF(MP_TRACE, "%s >>>", __FUNCTION__); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s0_led_setting[0]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED0_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s0_led_setting[1]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED1_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s0_led_setting[2]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED2_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s0_led_setting[3]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_BLINK_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s0_led_setting[4]); + } +} + +static void fxgmac_config_led_under_sleep(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + fxgmac_efuse_read_data(pdata, EFUSE_LED_ADDR, ®val); + //led index use bit0~bit5 + regval = FXGMAC_GET_REG_BITS(regval, EFUSE_LED_POS, EFUSE_LED_LEN); + if (EFUSE_LED_COMMON_SOLUTION == regval) { + DbgPrintF(MP_TRACE, "%s >>>", __FUNCTION__); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s3_led_setting[0]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED0_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s3_led_setting[1]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED1_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s3_led_setting[2]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED2_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s3_led_setting[3]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_BLINK_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s3_led_setting[4]); + } +} + +static void fxgmac_config_led_under_shutdown(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + fxgmac_efuse_read_data(pdata, EFUSE_LED_ADDR, ®val); + //led index use bit0~bit5 + regval = FXGMAC_GET_REG_BITS(regval, EFUSE_LED_POS, EFUSE_LED_LEN); + if (EFUSE_LED_COMMON_SOLUTION == regval) { + DbgPrintF(MP_TRACE, "%s >>>", __FUNCTION__); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s5_led_setting[0]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED0_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s5_led_setting[1]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED1_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s5_led_setting[2]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED2_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s5_led_setting[3]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_BLINK_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.s5_led_setting[4]); + } +} + +static void fxgmac_config_led_under_disable(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + fxgmac_efuse_read_data(pdata, EFUSE_LED_ADDR, ®val); + //led index use bit0~bit5 + regval = FXGMAC_GET_REG_BITS(regval, EFUSE_LED_POS, EFUSE_LED_LEN); + if (EFUSE_LED_COMMON_SOLUTION == regval) { + DbgPrintF(MP_TRACE, "%s >>>", __FUNCTION__); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.disable_led_setting[0]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED0_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.disable_led_setting[1]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED1_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.disable_led_setting[2]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED2_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.disable_led_setting[3]); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED_BLINK_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, pdata->led.disable_led_setting[4]); + } + else { + //http://redmine.motor-comm.com/issues/4101 + //for disable case,reset phy to close LED + fxgmac_reset_phy(pdata); + } +} + +static int fxgmac_enable_int(struct fxgmac_channel *channel, + enum fxgmac_int int_id) +{ + + u32 dma_ch_ier; + + dma_ch_ier = readreg(channel->pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_IER)); + + switch (int_id) { + case FXGMAC_INT_DMA_CH_SR_TI: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_TIE_POS, + DMA_CH_IER_TIE_LEN, 1); + break; + case FXGMAC_INT_DMA_CH_SR_TPS: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_TXSE_POS, + DMA_CH_IER_TXSE_LEN, 1); + break; + case FXGMAC_INT_DMA_CH_SR_TBU: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_TBUE_POS, + DMA_CH_IER_TBUE_LEN, 1); + break; + case FXGMAC_INT_DMA_CH_SR_RI: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_RIE_POS, + DMA_CH_IER_RIE_LEN, 1); + break; + case FXGMAC_INT_DMA_CH_SR_RBU: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_RBUE_POS, + DMA_CH_IER_RBUE_LEN, 1); + break; + case FXGMAC_INT_DMA_CH_SR_RPS: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_RSE_POS, + DMA_CH_IER_RSE_LEN, 1); + break; + case FXGMAC_INT_DMA_CH_SR_TI_RI: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_TIE_POS, + DMA_CH_IER_TIE_LEN, 1); + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_RIE_POS, + DMA_CH_IER_RIE_LEN, 1); + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_NIE_POS, + DMA_CH_IER_NIE_LEN, 1); + break; + case FXGMAC_INT_DMA_CH_SR_FBE: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_FBEE_POS, + DMA_CH_IER_FBEE_LEN, 1); + break; + case FXGMAC_INT_DMA_ALL: + dma_ch_ier |= channel->saved_ier; + break; + default: + return -1; + } + + writereg(channel->pdata->pAdapter, dma_ch_ier, FXGMAC_DMA_REG(channel, DMA_CH_IER)); + + return 0; +} + +static int fxgmac_disable_int(struct fxgmac_channel *channel, + enum fxgmac_int int_id) +{ + u32 dma_ch_ier; + + dma_ch_ier = readreg(channel->pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_IER)); + + switch (int_id) { + case FXGMAC_INT_DMA_CH_SR_TI: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_TIE_POS, + DMA_CH_IER_TIE_LEN, 0); + break; + case FXGMAC_INT_DMA_CH_SR_TPS: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_TXSE_POS, + DMA_CH_IER_TXSE_LEN, 0); + break; + case FXGMAC_INT_DMA_CH_SR_TBU: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_TBUE_POS, + DMA_CH_IER_TBUE_LEN, 0); + break; + case FXGMAC_INT_DMA_CH_SR_RI: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_RIE_POS, + DMA_CH_IER_RIE_LEN, 0); + break; + case FXGMAC_INT_DMA_CH_SR_RBU: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_RBUE_POS, + DMA_CH_IER_RBUE_LEN, 0); + break; + case FXGMAC_INT_DMA_CH_SR_RPS: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_RSE_POS, + DMA_CH_IER_RSE_LEN, 0); + break; + case FXGMAC_INT_DMA_CH_SR_TI_RI: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_TIE_POS, + DMA_CH_IER_TIE_LEN, 0); + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_RIE_POS, + DMA_CH_IER_RIE_LEN, 0); + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_NIE_POS, + DMA_CH_IER_NIE_LEN, 0); + break; + case FXGMAC_INT_DMA_CH_SR_FBE: + dma_ch_ier = FXGMAC_SET_REG_BITS( + dma_ch_ier, DMA_CH_IER_FBEE_POS, + DMA_CH_IER_FBEE_LEN, 0); + break; + case FXGMAC_INT_DMA_ALL: + channel->saved_ier = dma_ch_ier & FXGMAC_DMA_INTERRUPT_MASK; + dma_ch_ier &= ~FXGMAC_DMA_INTERRUPT_MASK; + break; + default: + return -1; + } + + writereg(channel->pdata->pAdapter, dma_ch_ier, FXGMAC_DMA_REG(channel, DMA_CH_IER)); + + return 0; +} + +static void fxgmac_enable_rx_tx_ints(struct fxgmac_pdata *pdata) +{ + struct fxgmac_channel *channel; + enum fxgmac_int int_id; + unsigned int i; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (channel->tx_ring && channel->rx_ring) + int_id = FXGMAC_INT_DMA_CH_SR_TI_RI; + else if (channel->tx_ring) + int_id = FXGMAC_INT_DMA_CH_SR_TI; + else if (channel->rx_ring) + int_id = FXGMAC_INT_DMA_CH_SR_RI; + else + continue; + + fxgmac_enable_int(channel, int_id); + } +} + +static void fxgmac_disable_rx_tx_ints(struct fxgmac_pdata *pdata) +{ + struct fxgmac_channel *channel; + enum fxgmac_int int_id; + unsigned int i; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (channel->tx_ring && channel->rx_ring) + int_id = FXGMAC_INT_DMA_CH_SR_TI_RI; + else if (channel->tx_ring) + int_id = FXGMAC_INT_DMA_CH_SR_TI; + else if (channel->rx_ring) + int_id = FXGMAC_INT_DMA_CH_SR_RI; + else + continue; + + fxgmac_disable_int(channel, int_id); + } +} + +static int fxgmac_dismiss_DMA_int(struct fxgmac_channel *channel, int int_id) +{ + u32 dma_ch_ier; + + (void)int_id; + dma_ch_ier = readreg(channel->pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_SR /*1160*/)); + writereg(channel->pdata->pAdapter, dma_ch_ier, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + + return 0; +} + +static void fxgmac_dismiss_MTL_Q_int(struct fxgmac_pdata *pdata) +{ + unsigned int i; + u32 mtl_q_isr, q_count; + + q_count = max(pdata->hw_feat.tx_q_cnt, pdata->hw_feat.rx_q_cnt); + for (i = 0; i < q_count; i++) { + /* Clear all the interrupts which are set */ + mtl_q_isr = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_ISR)); + writereg(pdata->pAdapter, mtl_q_isr, FXGMAC_MTL_REG(pdata, i, MTL_Q_ISR)); + } +} + +static int fxgmac_dismiss_MAC_int(struct fxgmac_pdata *pdata) +{ + u32 regval,regErrVal; + + /* all MAC interrupts in 0xb0 */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_ISR); + /* MAC tx/rx error interrupts in 0xb8 */ + regErrVal = readreg(pdata->pAdapter, pdata->mac_regs + MAC_TX_RX_STA); + (void)regval; + (void)regErrVal; +#if 0 //write clear + if(FXGMAC_GET_REG_BITS(readreg(pdata->mac_regs + MAC_CSR_SW_CTRL), + 0/*rcwe*/, + 1)) + { + writereg(regval, pdata->mac_regs + MAC_ISR); + writereg(regErrVal, pdata->mac_regs + MAC_TX_RX_STA); + } +#endif + return 0; +} + +static int fxgmac_dismiss_MAC_PMT_int(struct fxgmac_pdata *pdata) +{ + u32 regval; + + /* MAC PMT interrupts in 0xc0 */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + (void)regval; +#if 0 //write clear + if(FXGMAC_GET_REG_BITS(readreg(pdata->mac_regs + MAC_CSR_SW_CTRL), + 0/*rcwe*/, + 1)) + { + writereg(regval, pdata->mac_regs + MAC_PMT_STA); + } + +#endif + return 0; +} + +static int fxgmac_dismiss_MAC_LPI_int(struct fxgmac_pdata *pdata) +{ + u32 regval; + + /* MAC PMT interrupts in 0xc0 */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_LPI_STA); + (void)regval; +#if 0 //write clear + if(FXGMAC_GET_REG_BITS(readreg(pdata->mac_regs + MAC_CSR_SW_CTRL), + 0/*rcwe*/, + 1)) + { + writereg(regval, pdata->mac_regs + MAC_LPI_STA); + } + +#endif + return 0; +} + +static int fxgmac_dismiss_MAC_DBG_int(struct fxgmac_pdata *pdata) +{ + u32 regval; + + /* MAC PMT interrupts in 0xc0 */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_DBG_STA); +#if 1 //write clear + { + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_DBG_STA); + } + +#endif + return 0; +} + +static int fxgmac_dismiss_all_int(struct fxgmac_pdata *pdata) +{ + struct fxgmac_channel *channel; + unsigned int i; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + fxgmac_dismiss_DMA_int(channel, 0); + } + fxgmac_dismiss_MTL_Q_int(pdata); + fxgmac_dismiss_MAC_int(pdata); + fxgmac_dismiss_MAC_PMT_int(pdata); + fxgmac_dismiss_MAC_LPI_int(pdata); + fxgmac_dismiss_MAC_DBG_int(pdata); + + if (netif_msg_drv(pdata)) { DPRINTK("fxgmac_dismiss_all_int callin %d\n", i); } + + return 0; +} + +static void fxgmac_set_interrupt_moderation(struct fxgmac_pdata* pdata) +{ + u32 value = 0, time; +#if defined(FXGMAC_INTERRUPT_MODERATION_EXTERN) + // the Windows driver initializes it somewhere else + pdata->intr_mod_timer = pdata->intr_mod_timer; +#else + pdata->intr_mod_timer = INT_MOD_IN_US; +#endif + +#if defined(FXGMAC_INTERRUPT_TX_INTERVAL) + time = (pdata->intr_mod) ? pdata->tx_usecs : 0; +#else + time = (pdata->intr_mod) ? pdata->intr_mod_timer : 0; +#endif + value = FXGMAC_SET_REG_BITS(value, INT_MOD_TX_POS, INT_MOD_TX_LEN, time); + +#if defined(FXGMAC_INTERRUPT_RX_INTERVAL) + time = (pdata->intr_mod) ? pdata->rx_usecs : 0; +#endif + + value = FXGMAC_SET_REG_BITS(value, INT_MOD_RX_POS, INT_MOD_RX_LEN, time); + writereg(pdata->pAdapter, value, pdata->base_mem + INT_MOD); +} +static void fxgmac_enable_msix_rxtxinterrupt(struct fxgmac_pdata* pdata) +{ + u32 intid; + + for (intid = 0; intid < MSIX_TBL_RXTX_NUM; intid++) { + writereg(pdata->pAdapter, 0, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + intid * 16); + } +} +static void fxgmac_disable_msix_interrupt(struct fxgmac_pdata* pdata) +{ + u32 intid; + + for (intid = 0; intid < MSIX_TBL_MAX_NUM; intid++) { + writereg(pdata->pAdapter, 0x1, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + intid * 16); + } +} +static int fxgmac_enable_msix_rxtxphyinterrupt(struct fxgmac_pdata* pdata) +{ + u32 intid, regval = 0; + int ret = 0; +#if !(FXGMAC_EPHY_INTERRUPT_D0_OFF) + struct fxgmac_hw_ops* hw_ops = &pdata->hw_ops; +#endif + + for (intid = 0; intid < MSIX_TBL_RXTX_NUM; intid++) { + writereg(pdata->pAdapter, 0, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + intid * 16); + } + writereg(pdata->pAdapter, 0, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + MSI_ID_PHY_OTHER * 16); +#if !(FXGMAC_EPHY_INTERRUPT_D0_OFF) + hw_ops->read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL);// clear phy interrupt + regval = FXGMAC_SET_REG_BITS(0, PHY_INT_MASK_LINK_UP_POS, PHY_INT_MASK_LINK_UP_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, PHY_INT_MASK_LINK_DOWN_POS, PHY_INT_MASK_LINK_DOWN_LEN, 1); + ret = hw_ops->write_ephy_reg(pdata, REG_MII_INT_MASK, regval);//enable phy interrupt ASIC bit10 linkup bit11 linkdown + return ret; +#else + return 0; +#endif + +} +static void fxgmac_enable_msix_one_interrupt(struct fxgmac_pdata* pdata,u32 intid) +{ + writereg(pdata->pAdapter, 0, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + intid * 16); + //DbgPrintF(MP_LOUD, "%s - Ephy, MsgId %d is enabled.", __FUNCTION__, IntId); +} + +static void fxgmac_disable_msix_one_interrupt(struct fxgmac_pdata* pdata, u32 intid) +{ + writereg(pdata->pAdapter, 0x01, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + intid * 16); + //DbgPrintF(MP_LOUD, "%s - Ephy, MsgId %d is disabled.", __FUNCTION__, IntId); +} + +static bool fxgmac_enable_mgm_interrupt(struct fxgmac_pdata* pdata) +{ +#ifdef FXGMAC_MISC_NOT_ENABLED + writereg(pdata->pAdapter, 0x00200000, pdata->base_mem + MGMT_INT_CTRL0); +#else + writereg(pdata->pAdapter, 0xf0000000, pdata->base_mem + MGMT_INT_CTRL0); +#endif + return true; +} + +static bool fxgmac_enable_source_interrupt(struct fxgmac_pdata* pdata) +{ + u32 regval; + +#ifdef FXGMAC_MISC_NOT_ENABLED + writereg(pdata->pAdapter, 0x00200000, pdata->base_mem + MGMT_INT_CTRL0); +#endif + + regval = 0; + regval = FXGMAC_SET_REG_BITS(0, PHY_INT_MASK_LINK_UP_POS, PHY_INT_MASK_LINK_UP_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, PHY_INT_MASK_LINK_DOWN_POS, PHY_INT_MASK_LINK_DOWN_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_INT_MASK, regval);//enable phy interrupt + + fxgmac_enable_rx_tx_ints(pdata); + return true; +} + +static bool fxgmac_disable_mgm_interrupt(struct fxgmac_pdata* pdata) +{ + writereg(pdata->pAdapter, 0xffff0000, pdata->base_mem + MGMT_INT_CTRL0); + + return true; +} + +static bool fxgmac_disable_source_interrupt(struct fxgmac_pdata* pdata) +{ + unsigned int i, ti, ri, dma_ch_isr; + unsigned int dma_channel_status = 0, regval = 0; + struct fxgmac_channel* channel; + + for (i = 0; i < pdata->channel_count; i++) { + channel = pdata->channel_head + i; + + dma_ch_isr = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + + ti = FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_TI_POS, + DMA_CH_SR_TI_LEN); + ri = FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_RI_POS, + DMA_CH_SR_RI_LEN); + + if (!pdata->per_channel_irq && (ti || ri)) { + dma_channel_status |= (1 << i); + } + + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_TPS_POS, + DMA_CH_SR_TPS_LEN)) + pdata->stats.tx_process_stopped++; + + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_RPS_POS, + DMA_CH_SR_RPS_LEN)) + pdata->stats.rx_process_stopped++; + + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_TBU_POS, + DMA_CH_SR_TBU_LEN)) + pdata->stats.tx_buffer_unavailable++; + + /* for legacy interrupt, check rx buffer interrupt status, 20210923,yzhang */ + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_RBU_POS, + DMA_CH_SR_RBU_LEN)) + pdata->stats.rx_buffer_unavailable++; + + /* Restart the device on a Fatal Bus Error */ + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_FBE_POS, + DMA_CH_SR_FBE_LEN)) { + pdata->stats.fatal_bus_error++; + } + } + + fxgmac_read_ephy_reg(pdata, REG_MII_INT_STATUS, &pdata->mgmt_phy_val); + + if (!(dma_channel_status & 0x0f) && !(pdata->mgmt_phy_val & ((1 << PHY_INT_STAT_LINK_UP_POS) | (1 << PHY_INT_MASK_LINK_DOWN_POS)))) + { + return false; + } + + fxgmac_disable_rx_tx_ints(pdata); +#ifndef FXGMAC_MISC_NOT_ENABLED + regval = 0; + fxgmac_write_ephy_reg(pdata, REG_MII_INT_MASK, regval);//disable phy interrupt +#endif + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + } + + readreg(pdata->pAdapter, pdata->base_mem + MGMT_INT_CTRL0); + + return true; +} + +static int fxgmac_flush_tx_queues(struct fxgmac_pdata *pdata) +{ + unsigned int i, count; + u32 regval; + + for (i = 0; i < pdata->tx_q_count; i++) { + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + regval = FXGMAC_SET_REG_BITS(regval, MTL_Q_TQOMR_FTQ_POS, + MTL_Q_TQOMR_FTQ_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + DPRINTK("fxgmac_flush_tx_queues, reg=0x%p,", FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + DPRINTK(" val=0x%08x\n", regval); + } + + //2022-04-20 xiaojiang comment + //the following windows implement has some unreasonable part + //Take Linux implement method instead + /* Poll Until Poll Condition */ + /*for (i = 0; i < pdata->tx_q_count; i++) { + count = 2000; + regval = readreg(FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + regval = FXGMAC_GET_REG_BITS(regval, MTL_Q_TQOMR_FTQ_POS, + MTL_Q_TQOMR_FTQ_LEN); + while (--count && regval) { + usleep_range(pdata->pAdapter, 500, 600); + } + + DPRINTK("fxgmac_flush_tx_queues wait... reg=0x%p, val=0x%08x\n", FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR), regval); + + if (!count) + return -EBUSY; + }*/ + for (i = 0; i < pdata->tx_q_count; i++) { + count = 2000; + //regval = 1; //reset is not cleared.... + do { + usleep_range_ex(pdata->pAdapter, 40, 50); + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + regval = FXGMAC_GET_REG_BITS(regval, MTL_Q_TQOMR_FTQ_POS, + MTL_Q_TQOMR_FTQ_LEN); + + } while (--count && regval); + DPRINTK("fxgmac_flush_tx_queues wait... reg=0x%p,", FXGMAC_MTL_REG(pdata, i, MTL_Q_TQOMR)); + DPRINTK(" ... val=0x%08x\n", regval); + if (regval) {/*(!count)*/ + return -EBUSY; + } + } + + return 0; +} + +static void fxgmac_config_dma_bus(struct fxgmac_pdata *pdata) +{ + u32 regval; + //set no fix burst length + regval = readreg(pdata->pAdapter, pdata->mac_regs + DMA_SBMR); + /* Set enhanced addressing mode */ + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_EAME_POS, + DMA_SBMR_EAME_LEN, 1); + + /* Out standing read/write requests*/ + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_RD_OSR_LMT_POS, + DMA_SBMR_RD_OSR_LMT_LEN, 0x7); + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_WR_OSR_LMT_POS, + DMA_SBMR_WR_OSR_LMT_LEN, 0x7); + + /* Set the System Bus mode */ + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_FB_POS, + DMA_SBMR_FB_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_BLEN_4_POS, + DMA_SBMR_BLEN_4_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_BLEN_8_POS, + DMA_SBMR_BLEN_8_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_BLEN_16_POS, + DMA_SBMR_BLEN_16_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, DMA_SBMR_BLEN_32_POS, + DMA_SBMR_BLEN_32_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + DMA_SBMR); +} + +static void fxgmac_legacy_link_speed_setting(struct fxgmac_pdata* pdata) +{ + unsigned int i = 0; + u32 regval = 0; + + fxgmac_phy_config(pdata); + for (i = 0, regval = fxgmac_get_ephy_state(pdata); + (!(regval & MGMT_EPHY_CTRL_STA_EPHY_RELEASE) || !(regval & MGMT_EPHY_CTRL_STA_EPHY_LINKUP)) && (i < PHY_LINK_TIMEOUT); + regval = fxgmac_get_ephy_state(pdata), i++) + { + usleep_range_ex(pdata->pAdapter, 2000, 2000); + } + fxgmac_read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL); // clear phy interrupt. +} + +#if defined(FXGMAC_FIX_SHUT_DOWN_ISSUE) +static void fxgmac_link_speed_down_fix_shutdown_issue(struct fxgmac_pdata* pdata) +{ + LONGLONG tick_interval; + ULONG tick_inc; + LARGE_INTEGER tick_count; + unsigned int i = 0; + unsigned int regval = 0; + if ((ULONG)pdata->phy_speed != ((PMP_ADAPTER)pdata->pAdapter)->usLinkSpeed) + { + DbgPrintF(MP_TRACE, "%s change phy speed", __FUNCTION__); + pdata->phy_speed = ((PMP_ADAPTER)pdata->pAdapter)->usLinkSpeed; + + if (((PMP_ADAPTER)pdata->pAdapter)->RegParameter.LinkChgWol) + { + fxgmac_phy_config(pdata); + //sleep fixed value(6s) + for (i = 0; i < PHY_LINK_TIMEOUT; i++) + { + usleep_range_ex(pdata->pAdapter, 2000, 2000); + } + + fxgmac_read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL); // clear phy interrupt. + } + else + { + regval = fxgmac_get_ephy_state(pdata); + KeQueryTickCount(&tick_count); + tick_inc = KeQueryTimeIncrement(); + tick_interval = tick_count.QuadPart - ((PMP_ADAPTER)pdata->pAdapter)->D0_entry_tick_count.QuadPart; + tick_interval *= tick_inc; + tick_interval /= 10; + + /*DbgPrintF(MP_TRACE, "base tick %lld", ((PMP_ADAPTER)pdata->pAdapter)->D0_entry_tick_count.QuadPart); + DbgPrintF(MP_TRACE, "current tick %lld", tick_count.QuadPart); + DbgPrintF(MP_TRACE, "tick inc is %u", tick_inc); + DbgPrintF(MP_TRACE, "tick_interval is %lld", tick_interval); + DbgPrintF(MP_TRACE, "regval is 0x%x", regval);*/ + if (((regval & MGMT_EPHY_CTRL_STA_EPHY_RELEASE) && (regval & MGMT_EPHY_CTRL_STA_EPHY_LINKUP)) + || ((regval & MGMT_EPHY_CTRL_STA_EPHY_RELEASE) && !(regval & MGMT_EPHY_CTRL_STA_EPHY_LINKUP) && (tick_interval < RESUME_MAX_TIME)) + ) + { + fxgmac_legacy_link_speed_setting(pdata); + } + } + } +} +#endif + +static void fxgmac_pre_powerdown(struct fxgmac_pdata* pdata, bool phyloopback) +{ +#ifdef FXGMAC_LINK_SPEED_CHECK_PHY_LINK + u8 link; +#endif + u32 regval = 0; + int speed = SPEED_10; + (void)speed; + + fxgmac_disable_rx(pdata); + + /* HERE, WE NEED TO CONSIDER PHY CONFIG...TBD */ + DPRINTK("fxgmac_config_powerdown, phy and mac status update speed %d\n", speed); + //2022-11-09 xiaojiang comment + //for phy cable loopback,it can't configure phy speed, it will cause os resume again by link change although it has finished speed setting, + if (!phyloopback) { + if (!pdata->support_10m_link) { +#if defined(FXGMAC_LINK_SPEED_NOT_USE_LOCAL_VARIABLE) + if (SPEED_10 == ((PMP_ADAPTER)pdata->pAdapter)->usLinkSpeed) { + ((PMP_ADAPTER)pdata->pAdapter)->usLinkSpeed = SPEED_100; + } +#else + speed = SPEED_100; +#endif + } + +#if defined(FXGMAC_FIX_SHUT_DOWN_ISSUE) + fxgmac_link_speed_down_fix_shutdown_issue(pdata); +#elif defined(FXGMAC_LINK_SPEED_CHECK_PHY_LINK) + regval = fxgmac_get_ephy_state(pdata); + link = FXGMAC_GET_REG_BITS(regval, MGMT_EPHY_CTRL_STA_EPHY_LINKUP_POS, + MGMT_EPHY_CTRL_STA_EPHY_LINKUP_LEN); + if (link && (speed != pdata->phy_speed)) { + pdata->phy_autoeng = AUTONEG_ENABLE; + pdata->phy_speed = speed; + fxgmac_legacy_link_speed_setting(pdata); + } +#else + fxgmac_legacy_link_speed_setting(pdata); +#endif + } + + fxgmac_config_mac_speed(pdata); + + /* After enable OOB_WOL from efuse, mac will loopcheck phy status, and lead to panic sometimes. + So we should disable it from powerup, enable it from power down.*/ + regval = (u32)readreg(pdata->pAdapter, pdata->base_mem + OOB_WOL_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, OOB_WOL_CTRL_DIS_POS, OOB_WOL_CTRL_DIS_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + OOB_WOL_CTRL); + usleep_range_ex(pdata->pAdapter, 2000, 2000); + + //after enable OOB_WOL,recofigure mac addr again + fxgmac_set_mac_address(pdata, pdata->mac_addr); + //fxgmac_suspend_clock_gate(pdata); +} + +#ifdef FXGMAC_WOL_INTEGRATED_WOL_PARAMETER +static void fxgmac_config_powerdown(struct fxgmac_pdata *pdata, unsigned int wol) +#else +static void fxgmac_config_powerdown(struct fxgmac_pdata* pdata, unsigned int offloadcount, bool magic_en, bool remote_pattern_en) +#endif +{ + u32 regval = 0; + + fxgmac_disable_tx(pdata); + fxgmac_disable_rx(pdata); + + /* performs fxgmac power down sequence + * 1. set led + * 2. check wol. + * 3. check arp offloading + * 4. disable gmac rx + * 5. set gmac power down + */ + + //Close LED when entering the S3,S4,S5 except solution3 + fxgmac_efuse_read_data(pdata, EFUSE_LED_ADDR, ®val); + //led index use bit0~bit5 + regval = FXGMAC_GET_REG_BITS(regval, EFUSE_LED_POS, EFUSE_LED_LEN); + if (EFUSE_LED_COMMON_SOLUTION != regval) { + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED0_CFG); + if (EFUSE_LED_SOLUTION3 == regval) { + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, REG_MII_EXT_COMMON_LED0_CFG_VALUE_SLEEP_SOLUTION3); + } + else { + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, 0x00); + } + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED1_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, 0x00); + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_COMMON_LED2_CFG); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, 0x00); + } + +#if FXGMAC_WOL_FEATURE_ENABLED + fxgmac_config_wol(pdata, wol); +#endif +#if FXGMAC_AOE_FEATURE_ENABLED + /* use default arp offloading feature */ + fxgmac_update_aoe_ipv4addr(pdata, (u8 *)NULL); + fxgmac_enable_arp_offload(pdata); +#endif + +#if FXGMAC_NS_OFFLOAD_ENABLED + /* pls do not change the seq below */ + fxgmac_update_ns_offload_ipv6addr(pdata, FXGMAC_NS_IFA_GLOBAL_UNICAST); + fxgmac_update_ns_offload_ipv6addr(pdata, FXGMAC_NS_IFA_LOCAL_LINK); + fxgmac_enable_ns_offload(pdata); +#endif + +#if FXGMAC_PM_WPI_READ_FEATURE_ENABLED + fxgmac_enable_wake_packet_indication(pdata, 1); +#endif + /* Enable MAC Rx TX */ +#ifdef FXGMAC_WOL_INTEGRATED_WOL_PARAMETER + if (1) { +#else + if (magic_en || remote_pattern_en || offloadcount) { +#endif + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_RE_POS, MAC_CR_RE_LEN, 1); +#if defined(FXGMAC_AOE_FEATURE_ENABLED) || defined(FXGMAC_NS_OFFLOAD_ENABLED) + if(pdata->hw_feat.aoe) { +#else + if (offloadcount) { +#endif + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_TE_POS, MAC_CR_TE_LEN, 1); + } + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + } + + /* Enable fast link mode. - ECO to fix it.*/ +#if 0 + cfg_r32(pdata, REG_POWER_EIOS, ®val); + regval = FXGMAC_SET_REG_BITS(regval, POWER_EIOS_POS, POWER_EIOS_LEN, 1); + cfg_w32(pdata, REG_POWER_EIOS, regval); +#endif + + regval = readreg(pdata->pAdapter, pdata->base_mem + LPW_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, LPW_CTRL_ASPM_LPW_EN_POS, LPW_CTRL_ASPM_LPW_EN_LEN, 1); // Enable PCIE PM_L23. +#if 0 + regval = FXGMAC_SET_REG_BITS(regval, LPW_CTRL_ASPM_L0S_EN_POS, LPW_CTRL_ASPM_L0S_EN_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, LPW_CTRL_ASPM_L1_EN_POS, LPW_CTRL_ASPM_L1_EN_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, LPW_CTRL_L1SS_EN_POS, LPW_CTRL_L1SS_EN_LEN, 0); +#endif + writereg(pdata->pAdapter, regval, pdata->base_mem + LPW_CTRL); + + /* set gmac power down */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_PWRDWN_POS, MAC_PMT_STA_PWRDWN_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PMT_STA); + + DPRINTK("fxgmac_config_powerdown callout, reg=0x%08x\n", regval); +} + +static void fxgmac_config_powerup(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + + /* After enable OOB_WOL from efuse, mac will loopcheck phy status, and lead to panic sometimes. + So we should disable it from powerup, enable it from power down.*/ + regval = (u32)readreg(pdata->pAdapter, pdata->base_mem + OOB_WOL_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, OOB_WOL_CTRL_DIS_POS, OOB_WOL_CTRL_DIS_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + OOB_WOL_CTRL); + + /* clear wpi mode whether or not waked by WOL, write reset value */ + regval = (u32)readreg(pdata->pAdapter, pdata->base_mem + MGMT_WPI_CTRL0); + + regval = FXGMAC_SET_REG_BITS(regval, + MGMT_WPI_CTRL0_WPI_MODE_POS, + MGMT_WPI_CTRL0_WPI_MODE_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + MGMT_WPI_CTRL0); + /* read pmt_status register to De-assert the pmt_intr_o */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_PMT_STA); + /* whether or not waked up by WOL, write reset value */ + regval = FXGMAC_SET_REG_BITS(regval, MAC_PMT_STA_PWRDWN_POS, MAC_PMT_STA_PWRDWN_LEN, 0); + /* write register to synchronized always-on block */ + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_PMT_STA); + + /* Disable fast link mode*/ + cfg_r32(pdata, REG_POWER_EIOS, ®val); + regval = FXGMAC_SET_REG_BITS(regval, POWER_EIOS_POS, POWER_EIOS_LEN, 0); + cfg_w32(pdata, REG_POWER_EIOS, regval); + + fxgmac_pwr_clock_gate(pdata); +} + +#if FXGMAC_SANITY_CHECK_ENABLED +/* + * fxgmac_diag_sanity_check + * check if there is any error like tx q hang + * return: 0 normal and other fatal error + */ +static int fxgmac_diag_sanity_check(struct fxgmac_pdata *pdata) +{ + u32 reg_q_val, reg_tail_val; + static u32 reg_tail_pre = 0; + static int cnt = 0; + + reg_q_val = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, 0/* tx channe 0 */, 0x8/* 0x2d08 */)); + if (!(reg_q_val & 0x10)) { //tx q is empty + return 0; + } + reg_tail_val = readreg(pdata->pAdapter, FXGMAC_DMA_REG(pdata->channel_head, DMA_CH_TDTR_LO)); + if(reg_tail_pre != reg_tail_val) { + reg_tail_pre = reg_tail_val; + cnt = 0; + } else { + cnt++; + } + + if(cnt > 10) { + reg_q_val = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, 0/* tx channe 0 */, 0x8/* 0x2d08 */)); + if(reg_q_val & 0x10) { //double check + DPRINTK("fxgmac, WARNing, tx Q status is 0x%x and tail keeps unchanged for %d times, 0x%x\n", reg_q_val, cnt, reg_tail_val); + return 1; + } + } + + return 0; +} +#endif +static void fxgmac_pwr_clock_gate(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_SLEEP_CONTROL1); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, ®val); + // close pll in sleep mode + regval = FXGMAC_SET_REG_BITS(regval, MII_EXT_SLEEP_CONTROL1_PLLON_IN_SLP_POS, + MII_EXT_SLEEP_CONTROL1_PLLON_IN_SLP_LEN, 0); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, regval); + + /*regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_XST_OSC_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, MGMT_XST_OSC_CTRL_XST_OSC_SEL_POS, + MGMT_XST_OSC_CTRL_XST_OSC_SEL_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + MGMT_XST_OSC_CTRL); + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_XST_OSC_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, MGMT_XST_OSC_CTRL_EN_XST_POS, + MGMT_XST_OSC_CTRL_EN_XST_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + MGMT_XST_OSC_CTRL);*/ +} +static void fxgmac_pwr_clock_ungate(struct fxgmac_pdata* pdata) +{ + u32 regval = 0; + + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_ADDR, REG_MII_EXT_SLEEP_CONTROL1); + fxgmac_read_ephy_reg(pdata, REG_MII_EXT_DATA, ®val); + // keep pll in sleep mode + regval = FXGMAC_SET_REG_BITS(regval, MII_EXT_SLEEP_CONTROL1_PLLON_IN_SLP_POS, + MII_EXT_SLEEP_CONTROL1_PLLON_IN_SLP_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_EXT_DATA, regval); + + /*regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_XST_OSC_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, MGMT_XST_OSC_CTRL_EN_XST_POS, + MGMT_XST_OSC_CTRL_EN_XST_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + MGMT_XST_OSC_CTRL); + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_XST_OSC_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, MGMT_XST_OSC_CTRL_XST_OSC_SEL_POS, + MGMT_XST_OSC_CTRL_XST_OSC_SEL_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + MGMT_XST_OSC_CTRL);*/ +} +static unsigned char fxgmac_suspend_int(void* context) +// context - pointer to struct nic_pdata. +{ + //ULONG_PTR addr; + u32 intid; +#if FXGMAC_EPHY_INTERRUPT_D0_OFF + u32 regval = 0; +#endif + u32 val_mgmt_intcrtl0; + struct fxgmac_pdata* pdata = (struct fxgmac_pdata*)context; + + val_mgmt_intcrtl0 = (u32)readreg(pdata->pAdapter, pdata->base_mem + MGMT_INT_CTRL0); + //disable management interrupts. enable only pmt interrupts. + val_mgmt_intcrtl0 = FXGMAC_SET_REG_BITS(val_mgmt_intcrtl0, MGMT_INT_CTRL0_INT_MASK_POS, + MGMT_INT_CTRL0_INT_MASK_LEN, + MGMT_INT_CTRL0_INT_MASK_EX_PMT); + writereg(pdata->pAdapter, val_mgmt_intcrtl0, pdata->base_mem + MGMT_INT_CTRL0); + + for (intid = 0; intid < MSIX_TBL_MAX_NUM; intid++) { // disable all msix + writereg(pdata->pAdapter, 0x1, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + intid * 16); + } + + //enable pmt msix + writereg(pdata->pAdapter, 0x0, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + MSI_ID_PHY_OTHER * 16); + readreg(pdata->pAdapter, pdata->base_mem + MGMT_WOL_CTRL);// read clear wake up reason + //since Msix interrupt masked now, enable EPHY interrupt for case of link change wakeup + fxgmac_read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL); // clear phy interrupt +#if FXGMAC_EPHY_INTERRUPT_D0_OFF + regval = FXGMAC_SET_REG_BITS(0, PHY_INT_MASK_LINK_UP_POS, PHY_INT_MASK_LINK_UP_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, PHY_INT_MASK_LINK_DOWN_POS, PHY_INT_MASK_LINK_DOWN_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_INT_MASK, regval);//enable phy interrupt +#endif + + return true; +} +static int fxgmac_suspend_txrx(struct fxgmac_pdata* pdata) +{ + struct fxgmac_channel* channel; + unsigned int i; + u32 regval; + int busy = 15; + /* Prepare for Tx DMA channel stop */ + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) { + break; + } + fxgmac_prepare_tx_stop(pdata, channel); + } + + /* Disable each Tx DMA channel */ + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) { + break; + } + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_TCR_ST_POS, + DMA_CH_TCR_ST_LEN, 0); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_TCR)); + DBGPRINT(MP_TRACE, (" disable channel %d tx dma", i)); + } + + do { + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_DBG_STA); + busy--; + } while ((regval & MAC_DBG_STA_TX_BUSY) && (busy)); + + if (0 != (regval & MAC_DBG_STA_TX_BUSY)) { + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_DBG_STA); + DbgPrintF(MP_WARN, "warning !!!timed out waiting for Tx MAC to stop regval %x\n", regval); + return -1; + } + + busy = 15; + /* wait empty Tx queue */ + for (i = 0; i < pdata->tx_q_count; i++) { + do { + + regval = readreg(pdata->pAdapter, FXGMAC_MTL_REG(pdata, i, MTL_TXQ_DEG)); + busy--; + } while ((regval & MTL_TXQ_DEG_TX_BUSY) && (busy)); + if (0 != (regval & MTL_TXQ_DEG_TX_BUSY)) { + regval = readreg(pdata->pAdapter, pdata->mac_regs + MTL_TXQ_DEG); + DbgPrintF(MP_WARN, "warning !!!timed out waiting for tx queue %u to empty\n", + i); + return -1; + } + } + + /* Disable MAC TxRx */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_TE_POS, + MAC_CR_TE_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_RE_POS, + MAC_CR_RE_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + MAC_CR); + + /* Prepare for Rx DMA channel stop */ + for (i = 0; i < pdata->rx_q_count; i++) { + fxgmac_prepare_rx_stop(pdata, i); + } + /* Disable each Rx DMA channel */ + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->rx_ring) { + break; + } + + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_RCR_SR_POS, + DMA_CH_RCR_SR_LEN, 0); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_RCR)); + DBGPRINT(MP_TRACE, (" disable channel %d rx dma", i)); + } + return 0; +} +static void fxgmac_resume_int(struct fxgmac_pdata* pdata) +{ + u32 intid, regval = 0; + u32 val_mgmt_intcrtl0; + + val_mgmt_intcrtl0 = (u32)readreg(pdata->pAdapter, pdata->base_mem + MGMT_INT_CTRL0); + //disable management interrupts. enable only pmt interrupts. + val_mgmt_intcrtl0 = FXGMAC_SET_REG_BITS(val_mgmt_intcrtl0, MGMT_INT_CTRL0_INT_MASK_POS, + MGMT_INT_CTRL0_INT_MASK_LEN, + MGMT_INT_CTRL0_INT_MASK_DISABLE); + writereg(pdata->pAdapter, val_mgmt_intcrtl0, pdata->base_mem + MGMT_INT_CTRL0); + + for (intid = 0; intid < MSIX_TBL_RXTX_NUM; intid++) { + writereg(pdata->pAdapter, 0, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + intid * 16); + } + + for (intid = MSIX_TBL_RXTX_NUM; intid < MSIX_TBL_MAX_NUM; intid++) { // disable some msix + writereg(pdata->pAdapter, 0, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET + intid * 16); + } + +#if FXGMAC_EPHY_INTERRUPT_D0_OFF + fxgmac_write_ephy_reg(pdata, REG_MII_INT_MASK,0x0); //disable phy interrupt + fxgmac_read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL); // clear phy interrupt +#else + //hw_ops->read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL);// clear phy interrupt + regval = FXGMAC_SET_REG_BITS(0, PHY_INT_MASK_LINK_UP_POS, PHY_INT_MASK_LINK_UP_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, PHY_INT_MASK_LINK_DOWN_POS, PHY_INT_MASK_LINK_DOWN_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_INT_MASK, regval);//enable phy interrupt +#endif +} + +static void fxgmac_config_wol_wait_time(struct fxgmac_pdata *pdata) +{ + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->base_mem + WOL_CTL); + regval = FXGMAC_SET_REG_BITS(regval, WOL_WAIT_TIME_POS, WOL_WAIT_TIME_LEN, + FXGMAC_WOL_WAIT_TIME); + writereg(pdata->pAdapter, regval, pdata->base_mem + WOL_CTL); +} + +static int fxgmac_hw_init(struct fxgmac_pdata *pdata) +{ + struct fxgmac_desc_ops *desc_ops = &pdata->desc_ops; + int ret; + + if (netif_msg_drv(pdata)) { DPRINTK("fxgmac hw init call in\n"); } + + /* Flush Tx queues */ + ret = fxgmac_flush_tx_queues(pdata); + if (ret) { +#ifdef FXGMAC_FLUSH_TX_CHECK_ENABLED + dev_err(pdata->dev, "fxgmac_hw_init call flush tx queue err.\n"); + return ret; +#endif + } + + /* Initialize DMA related features */ + fxgmac_config_dma_bus(pdata); + fxgmac_config_osp_mode(pdata); + fxgmac_config_pblx8(pdata); + fxgmac_config_tx_pbl_val(pdata); + fxgmac_config_rx_pbl_val(pdata); + fxgmac_config_rx_coalesce(pdata); + fxgmac_config_tx_coalesce(pdata); + fxgmac_config_rx_buffer_size(pdata); + fxgmac_config_tso_mode(pdata); + fxgmac_config_sph_mode(pdata); + fxgmac_config_rss(pdata); + + desc_ops->tx_desc_init(pdata); + ret = desc_ops->rx_desc_init(pdata); + if (ret) { +#ifdef FXGMAC_RX_DESC_INIT_CHECK_ENABLED + dev_err(pdata->dev, "rx_desc_init err.\n"); + return ret; +#endif + } + + fxgmac_enable_dma_interrupts(pdata); + + /* Initialize MTL related features */ + fxgmac_config_mtl_mode(pdata); + fxgmac_config_queue_mapping(pdata); + fxgmac_config_tsf_mode(pdata, pdata->tx_sf_mode); + fxgmac_config_rsf_mode(pdata, pdata->rx_sf_mode); + fxgmac_config_tx_threshold(pdata, pdata->tx_threshold); + fxgmac_config_rx_threshold(pdata, pdata->rx_threshold); + fxgmac_config_tx_fifo_size(pdata); + fxgmac_config_rx_fifo_size(pdata); + fxgmac_config_flow_control_threshold(pdata); + fxgmac_config_rx_fep_disable(pdata); + fxgmac_config_rx_fup_enable(pdata); + fxgmac_enable_mtl_interrupts(pdata); + + /* Initialize MAC related features */ + fxgmac_config_mac_address(pdata); + fxgmac_config_crc_check(pdata); + fxgmac_config_rx_mode(pdata); + fxgmac_config_jumbo(pdata); + fxgmac_config_flow_control(pdata); + fxgmac_config_mac_speed(pdata); + fxgmac_config_checksum_offload(pdata); + fxgmac_config_vlan_support(pdata); + fxgmac_config_mmc(pdata); + fxgmac_enable_mac_interrupts(pdata); + + fxgmac_config_wol_wait_time(pdata); + + /* enable EPhy link change interrupt */ + fxgmac_read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL);// clear phy interrupt + ret = FXGMAC_SET_REG_BITS(0, PHY_INT_MASK_LINK_UP_POS, PHY_INT_MASK_LINK_UP_LEN, 1); + ret = FXGMAC_SET_REG_BITS(ret, PHY_INT_MASK_LINK_DOWN_POS, PHY_INT_MASK_LINK_DOWN_LEN, 1); + fxgmac_write_ephy_reg(pdata, REG_MII_INT_MASK, ret);//enable phy interrupt + + if (netif_msg_drv(pdata)) { DPRINTK("fxgmac hw init callout\n"); } + return 0; +} + +static void fxgmac_save_nonstick_reg(struct fxgmac_pdata* pdata) +{ + u32 i; + for (i = REG_PCIE_TRIGGER; i < MSI_PBA_REG; i += 4) { + pdata->reg_nonstick[(i - REG_PCIE_TRIGGER) >> 2] = readreg(pdata->pAdapter, pdata->base_mem + i); + } + +#if defined(UBOOT) + /* PCI config space info */ + dm_pci_read_config16(pdata->pdev, PCI_VENDOR_ID, &pdata->expansion.pci_venid); + dm_pci_read_config16(pdata->pdev, PCI_DEVICE_ID, &pdata->expansion.pci_devid); + dm_pci_read_config16(pdata->pdev, PCI_SUBSYSTEM_VENDOR_ID, &pdata->expansion.SubVendorID); + dm_pci_read_config16(pdata->pdev, PCI_SUBSYSTEM_ID, &pdata->expansion.SubSystemID); + + dm_pci_read_config8(pdata->pdev, PCI_REVISION_ID, &pdata->expansion.pci_revid); + //dm_pci_read_config16(pdata->pdev, PCI_COMMAND, &pdata->pci_cmd_word); + + DbgPrintF(MP_TRACE, "VenId is %x, Devid is %x, SubId is %x, SubSysId is %x, Revid is %x.\n", + pdata->expansion.pci_venid, pdata->expansion.pci_devid, pdata->expansion.SubVendorID, + pdata->expansion.SubSystemID, pdata->expansion.pci_revid); + +#elif !defined(UEFI) && !defined(PXE) && !defined(DPDK) && !defined(KDNET) + cfg_r32(pdata, REG_PCI_COMMAND, &pdata->expansion.cfg_pci_cmd); + cfg_r32(pdata, REG_CACHE_LINE_SIZE, &pdata->expansion.cfg_cache_line_size); + cfg_r32(pdata, REG_MEM_BASE, &pdata->expansion.cfg_mem_base); + cfg_r32(pdata, REG_MEM_BASE_HI, &pdata->expansion.cfg_mem_base_hi); + cfg_r32(pdata, REG_IO_BASE, &pdata->expansion.cfg_io_base); + cfg_r32(pdata, REG_INT_LINE, &pdata->expansion.cfg_int_line); + cfg_r32(pdata, REG_DEVICE_CTRL1, &pdata->expansion.cfg_device_ctrl1); + cfg_r32(pdata, REG_PCI_LINK_CTRL, &pdata->expansion.cfg_pci_link_ctrl); + cfg_r32(pdata, REG_DEVICE_CTRL2, &pdata->expansion.cfg_device_ctrl2); + cfg_r32(pdata, REG_MSIX_CAPABILITY, &pdata->expansion.cfg_msix_capability); + + DbgPrintF(MP_TRACE, "%s:\nCFG%02x-%02x\nCFG%02x-%02x\nCFG%02x-%02x\nCFG%02x-%02x\nCFG%02x-%02x\nCFG%02x-%02x\nCFG%02x-%02x\nCFG%02x-%02x\nCFG%02x-%02x\nCFG%02x-%02x\n", + __FUNCTION__, + REG_PCI_COMMAND, pdata->expansion.cfg_pci_cmd, + REG_CACHE_LINE_SIZE, pdata->expansion.cfg_cache_line_size, + REG_MEM_BASE, pdata->expansion.cfg_mem_base, + REG_MEM_BASE_HI, pdata->expansion.cfg_mem_base_hi, + REG_IO_BASE, pdata->expansion.cfg_io_base, + REG_INT_LINE, pdata->expansion.cfg_int_line, + REG_DEVICE_CTRL1, pdata->expansion.cfg_device_ctrl1, + REG_PCI_LINK_CTRL, pdata->expansion.cfg_pci_link_ctrl, + REG_DEVICE_CTRL2, pdata->expansion.cfg_device_ctrl2, + REG_MSIX_CAPABILITY, pdata->expansion.cfg_msix_capability); +#endif +} + +static void fxgmac_restore_nonstick_reg(struct fxgmac_pdata* pdata) +{ + u32 i; + for (i = REG_PCIE_TRIGGER; i < MSI_PBA_REG; i += 4) { + writereg(pdata->pAdapter, pdata->reg_nonstick[(i - REG_PCIE_TRIGGER) >> 2], pdata->base_mem + i); + } +} + +#if defined(FXGMAC_ESD_RESTORE_PCIE_CFG) +static void fxgmac_esd_restore_pcie_cfg(struct fxgmac_pdata* pdata) +{ + cfg_w32(pdata, REG_PCI_COMMAND, pdata->expansion.cfg_pci_cmd); + cfg_w32(pdata, REG_CACHE_LINE_SIZE, pdata->expansion.cfg_cache_line_size); + cfg_w32(pdata, REG_MEM_BASE, pdata->expansion.cfg_mem_base); + cfg_w32(pdata, REG_MEM_BASE_HI, pdata->expansion.cfg_mem_base_hi); + cfg_w32(pdata, REG_IO_BASE, pdata->expansion.cfg_io_base); + cfg_w32(pdata, REG_INT_LINE, pdata->expansion.cfg_int_line); + cfg_w32(pdata, REG_DEVICE_CTRL1, pdata->expansion.cfg_device_ctrl1); + cfg_w32(pdata, REG_PCI_LINK_CTRL, pdata->expansion.cfg_pci_link_ctrl); + cfg_w32(pdata, REG_DEVICE_CTRL2, pdata->expansion.cfg_device_ctrl2); + cfg_w32(pdata, REG_MSIX_CAPABILITY, pdata->expansion.cfg_msix_capability); +} +#endif + +static int fxgmac_hw_exit(struct fxgmac_pdata *pdata) +{ + //unsigned int count = 2000; + u32 regval; + u32 value = 0; +#if 1 +#ifdef FXGMAC_CHECK_DEV_STATE + if (pdata->expansion.dev_state == FXGMAC_DEV_OPEN) { +#endif + cfg_r32(pdata, REG_PCI_LINK_CTRL, ®val); + pdata->pcie_link_status = FXGMAC_GET_REG_BITS(regval, PCI_LINK_CTRL_ASPM_CONTROL_POS, PCI_LINK_CTRL_ASPM_CONTROL_LEN); + if (PCI_LINK_CTRL_L1_STATUS == (pdata->pcie_link_status & 0x02)) + { + regval = FXGMAC_SET_REG_BITS(regval, PCI_LINK_CTRL_ASPM_CONTROL_POS, PCI_LINK_CTRL_ASPM_CONTROL_LEN, 0); + cfg_w32(pdata, REG_PCI_LINK_CTRL, regval); + } +#ifdef FXGMAC_CHECK_DEV_STATE + } +#endif + + /* Issue a CHIP reset */ + regval = readreg(pdata->pAdapter, pdata->base_mem + SYS_RESET_REG); + DPRINTK("CHIP_RESET 0x%x\n", regval); + /* reg152c bit31 1->reset, self-clear, if read it again, it still set 1. */ + regval = FXGMAC_SET_REG_BITS(regval, SYS_RESET_POS, SYS_RESET_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + SYS_RESET_REG); + + usleep_range_ex(pdata->pAdapter, 9000, 10000); //usleep_range_ex(pdata->pAdapter, 10, 15); + + /* reg152c reset will reset trigger circuit and reload efuse patch 0x1004=0x16,need to release ephy reset again */ + value = FXGMAC_SET_REG_BITS(value, MGMT_EPHY_CTRL_RESET_POS, MGMT_EPHY_CTRL_RESET_LEN, MGMT_EPHY_CTRL_STA_EPHY_RELEASE); + writereg(pdata->pAdapter, value, pdata->base_mem + MGMT_EPHY_CTRL); + usleep_range_ex(pdata->pAdapter, 100, 150); + + fxgmac_restore_nonstick_reg(pdata); // reset will clear nonstick registers. +#else + /* Issue a software reset */ + regval = readreg(pdata->pAdapter, pdata->mac_regs + DMA_MR); DPRINTK("DMA_MR 0x%x\n", regval); + regval = FXGMAC_SET_REG_BITS(regval, DMA_MR_SWR_POS, + DMA_MR_SWR_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, DMA_MR_INTM_POS, + DMA_MR_INTM_LEN, 0); + writereg(pdata->pAdapter, regval, pdata->mac_regs + DMA_MR); + + usleep_range_ex(pdata->pAdapter, 10, 15); + + /* Poll Until Poll Condition */ + while (--count && + FXGMAC_GET_REG_BITS(readreg(pdata->pAdapter, pdata->mac_regs + DMA_MR), + DMA_MR_SWR_POS, DMA_MR_SWR_LEN)) { + usleep_range_ex(pdata->pAdapter, 500, 600); + } + + DPRINTK("Soft reset count %d\n", count); + if (!count) { + return -EBUSY; + } +#endif + return 0; +} + +static int fxgmac_set_gmac_register(struct fxgmac_pdata* pdata, IOMEM address, unsigned int data) +{ + if (address < pdata->base_mem) + { + return -1; + } + writereg(pdata->pAdapter, data, address); + return 0; +} + +static u32 fxgmac_get_gmac_register(struct fxgmac_pdata* pdata, IOMEM address) +{ + u32 regval = 0; + + if(address > pdata->base_mem) + { + regval = readreg(pdata->pAdapter, address); + } + return regval; +} + +static int fxgmac_pcie_init(struct fxgmac_pdata* pdata, bool ltr_en, bool aspm_l1ss_en, bool aspm_l1_en, bool aspm_l0s_en) +{ + //DbgPrintF(MP_TRACE, "%s ltr_en %d aspm_l1ss_en %d aspm_l1_en %d aspm_l0s_en %d", __FUNCTION__, ltr_en, aspm_l1ss_en, aspm_l1_en, aspm_l0s_en); + u32 regval = 0; + u32 deviceid = 0; + + cfg_r32(pdata, REG_PCI_LINK_CTRL, ®val); + if (PCI_LINK_CTRL_L1_STATUS == (pdata->pcie_link_status & 0x02) + && 0x00 == FXGMAC_GET_REG_BITS(regval, PCI_LINK_CTRL_ASPM_CONTROL_POS, PCI_LINK_CTRL_ASPM_CONTROL_LEN) + ) + { + regval = FXGMAC_SET_REG_BITS(regval, PCI_LINK_CTRL_ASPM_CONTROL_POS, PCI_LINK_CTRL_ASPM_CONTROL_LEN, pdata->pcie_link_status); + cfg_w32(pdata, REG_PCI_LINK_CTRL, regval); + } + + regval = FXGMAC_SET_REG_BITS(0, LTR_IDLE_ENTER_REQUIRE_POS, LTR_IDLE_ENTER_REQUIRE_LEN, LTR_IDLE_ENTER_REQUIRE); + regval = FXGMAC_SET_REG_BITS(regval, LTR_IDLE_ENTER_SCALE_POS, LTR_IDLE_ENTER_SCALE_LEN, LTR_IDLE_ENTER_SCALE); + regval = FXGMAC_SET_REG_BITS(regval, LTR_IDLE_ENTER_POS, LTR_IDLE_ENTER_LEN, LTR_IDLE_ENTER_USVAL); + regval = (regval << 16) + regval; /* snoopy + non-snoopy */ + writereg(pdata->pAdapter, regval, pdata->base_mem + LTR_IDLE_ENTER); + + regval = 0; + regval = FXGMAC_SET_REG_BITS(0, LTR_IDLE_EXIT_REQUIRE_POS, LTR_IDLE_EXIT_REQUIRE_LEN, LTR_IDLE_EXIT_REQUIRE); + regval = FXGMAC_SET_REG_BITS(regval, LTR_IDLE_EXIT_SCALE_POS, LTR_IDLE_EXIT_SCALE_LEN, LTR_IDLE_EXIT_SCALE); + regval = FXGMAC_SET_REG_BITS(regval, LTR_IDLE_EXIT_POS, LTR_IDLE_EXIT_LEN, LTR_IDLE_EXIT_USVAL); + regval = (regval << 16) + regval; /* snoopy + non-snoopy */ + writereg(pdata->pAdapter, regval, pdata->base_mem + LTR_IDLE_EXIT); + + regval = readreg(pdata->pAdapter, pdata->base_mem + LTR_CTRL); + if (ltr_en) { + regval = FXGMAC_SET_REG_BITS(regval, LTR_CTRL_EN_POS, LTR_CTRL_EN_LEN, 1); + regval = FXGMAC_SET_REG_BITS(regval, LTR_CTRL_IDLE_THRE_TIMER_POS, LTR_CTRL_IDLE_THRE_TIMER_LEN, LTR_CTRL_IDLE_THRE_TIMER_VAL); + } else { + regval = FXGMAC_SET_REG_BITS(regval, LTR_CTRL_EN_POS, LTR_CTRL_EN_LEN, 0); + } + writereg(pdata->pAdapter, regval, pdata->base_mem + LTR_CTRL); + + regval = readreg(pdata->pAdapter, pdata->base_mem + LPW_CTRL); + regval = FXGMAC_SET_REG_BITS(regval, LPW_CTRL_ASPM_L0S_EN_POS, LPW_CTRL_ASPM_L0S_EN_LEN, aspm_l0s_en ? 1 : 0); + regval = FXGMAC_SET_REG_BITS(regval, LPW_CTRL_ASPM_L1_EN_POS, LPW_CTRL_ASPM_L1_EN_LEN, aspm_l1_en ? 1 : 0); + regval = FXGMAC_SET_REG_BITS(regval, LPW_CTRL_L1SS_EN_POS, LPW_CTRL_L1SS_EN_LEN, aspm_l1ss_en ? 1 : 0); + writereg(pdata->pAdapter, regval, pdata->base_mem + LPW_CTRL); + + cfg_r32(pdata, REG_ASPM_CONTROL, ®val); + regval = FXGMAC_SET_REG_BITS(regval, ASPM_L1_IDLE_THRESHOLD_POS, ASPM_L1_IDLE_THRESHOLD_LEN, ASPM_L1_IDLE_THRESHOLD_1US); + cfg_w32(pdata, REG_ASPM_CONTROL, regval); + + regval = 0; + regval = FXGMAC_SET_REG_BITS(regval, PCIE_SERDES_PLL_AUTOOFF_POS, PCIE_SERDES_PLL_AUTOOFF_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + REG_PCIE_SERDES_PLL); + + /*fuxi nto adjust sigdet threshold*/ + cfg_r8(pdata, REG_PCI_REVID, ®val); + cfg_r16(pdata, REG_PCI_DEVICE_ID, &deviceid); + if (FXGMAC_REV_01 == regval && PCI_DEVICE_ID_FUXI == deviceid) + { + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_SIGDET); + regval = FXGMAC_SET_REG_BITS(regval, MGMT_SIGDET_POS, MGMT_SIGDET_LEN, MGMT_SIGDET_55MV); + writereg(pdata->pAdapter, regval, pdata->base_mem + MGMT_SIGDET); + + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_SIGDET_DEGLITCH); + regval = FXGMAC_SET_REG_BITS(regval, MGMT_SIGDET_DEGLITCH_DISABLE_POS, MGMT_SIGDET_DEGLITCH_DISABLE_LEN, 1); + writereg(pdata->pAdapter, regval, pdata->base_mem + MGMT_SIGDET_DEGLITCH); + } + + cfg_r16(pdata, REG_DEVICE_CTRL1, ®val); + if (PCI_DEVICE_ID_FUXI == deviceid && + (FXGMAC_GET_REG_BITS(regval, DEVICE_CTRL1_MPS_POS, DEVICE_CTRL1_MPS_LEN) > DEVICE_CTRL1_MPS_128B)) { + regval = FXGMAC_SET_REG_BITS(regval, DEVICE_CTRL1_MPS_POS, DEVICE_CTRL1_MPS_LEN, DEVICE_CTRL1_MPS_128B); + cfg_w16(pdata, REG_DEVICE_CTRL1, regval); + } + + return 0; +} + +static void fxgmac_clear_misc_int_status(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + u32 regval, i, q_count; + + /* clear phy interrupt status */ + hw_ops->read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL); + hw_ops->read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL); + /* clear other interrupt status of misc interrupt */ + regval = pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MAC_ISR); + if(regval) { + if(regval & (1 << MGMT_MAC_PHYIF_STA_POS)) + pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MAC_PHYIF_STA); + + if((regval & (1 << MGMT_MAC_AN_SR0_POS)) || + (regval & (1 << MGMT_MAC_AN_SR1_POS)) || + (regval & (1 << MGMT_MAC_AN_SR2_POS))) + pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MAC_AN_SR); + + if(regval & (1 << MGMT_MAC_PMT_STA_POS)) + pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MAC_PMT_STA); + + if(regval & (1 << MGMT_MAC_LPI_STA_POS)) + pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MAC_LPI_STA); + + if(regval & (1 << MGMT_MAC_MMC_STA_POS)) { + if(regval & (1 << MGMT_MAC_RX_MMC_STA_POS)) + hw_ops->rx_mmc_int(pdata); + + if(regval & (1 << MGMT_MAC_TX_MMC_STA_POS)) + hw_ops->tx_mmc_int(pdata); + + if(regval & (1 << MGMT_MMC_IPCRXINT_POS)) + pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MMC_IPCRXINT); + + } + + if((regval & (1 << MGMT_MAC_TX_RX_STA0_POS)) || (regval & (1 << MGMT_MAC_TX_RX_STA1_POS))) + pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MAC_TX_RX_STA); + + if(regval & (1 << MGMT_MAC_GPIO_SR_POS)) + pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MAC_GPIO_SR); + } + + /* MTL_Interrupt_Status, write 1 clear */ + regval = pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MTL_INT_SR); + pdata->hw_ops.set_gmac_register(pdata, pdata->mac_regs + MTL_INT_SR, regval); + + /* MTL_Q(#i)_Interrupt_Control_Status, write 1 clear */ + q_count = max(pdata->hw_feat.tx_q_cnt, pdata->hw_feat.rx_q_cnt); + for (i = 0; i < q_count; i++) { + /* Clear all the interrupts which are set */ + regval = pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MTL_Q_INT_CTL_SR + i * MTL_Q_INC); + pdata->hw_ops.set_gmac_register(pdata, pdata->mac_regs + MTL_Q_INT_CTL_SR + i * MTL_Q_INC, regval); + } + + /* MTL_ECC_Interrupt_Status, write 1 clear */ + regval = pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + MTL_ECC_INT_SR); + pdata->hw_ops.set_gmac_register(pdata, pdata->mac_regs + MTL_ECC_INT_SR, regval); + + /* DMA_ECC_Interrupt_Status, write 1 clear */ + regval = pdata->hw_ops.get_gmac_register(pdata, pdata->mac_regs + DMA_ECC_INT_SR); + pdata->hw_ops.set_gmac_register(pdata, pdata->mac_regs + DMA_ECC_INT_SR, regval); +} + +static void fxgmac_trigger_pcie(struct fxgmac_pdata* pdata, u32 code) +{ + writereg(pdata->pAdapter, code, pdata->base_mem + REG_PCIE_TRIGGER); +} + +void fxgmac_init_hw_ops(struct fxgmac_hw_ops *hw_ops) +{ + hw_ops->init = fxgmac_hw_init; + hw_ops->exit = fxgmac_hw_exit; + hw_ops->save_nonstick_reg = fxgmac_save_nonstick_reg; + hw_ops->restore_nonstick_reg = fxgmac_restore_nonstick_reg; +#if defined(FXGMAC_ESD_RESTORE_PCIE_CFG) + hw_ops->esd_restore_pcie_cfg = fxgmac_esd_restore_pcie_cfg; +#endif + + hw_ops->set_gmac_register = fxgmac_set_gmac_register; + hw_ops->get_gmac_register = fxgmac_get_gmac_register; + + hw_ops->tx_complete = fxgmac_tx_complete; + hw_ops->enable_tx = fxgmac_enable_tx; + hw_ops->disable_tx = fxgmac_disable_tx; + hw_ops->enable_rx = fxgmac_enable_rx; + hw_ops->disable_rx = fxgmac_disable_rx; + hw_ops->enable_channel_rx = fxgmac_enable_channel_rx; + + hw_ops->enable_int = fxgmac_enable_int; + hw_ops->disable_int = fxgmac_disable_int; + hw_ops->set_interrupt_moderation = fxgmac_set_interrupt_moderation; + hw_ops->enable_msix_rxtxinterrupt = fxgmac_enable_msix_rxtxinterrupt; + hw_ops->disable_msix_interrupt = fxgmac_disable_msix_interrupt; + hw_ops->enable_msix_rxtxphyinterrupt = fxgmac_enable_msix_rxtxphyinterrupt; + hw_ops->enable_msix_one_interrupt = fxgmac_enable_msix_one_interrupt; + hw_ops->disable_msix_one_interrupt = fxgmac_disable_msix_one_interrupt; + hw_ops->enable_mgm_interrupt = fxgmac_enable_mgm_interrupt; + hw_ops->disable_mgm_interrupt = fxgmac_disable_mgm_interrupt; + hw_ops->enable_source_interrupt = fxgmac_enable_source_interrupt; + hw_ops->disable_source_interrupt = fxgmac_disable_source_interrupt; + hw_ops->dismiss_all_int = fxgmac_dismiss_all_int; + hw_ops->clear_misc_int_status = fxgmac_clear_misc_int_status; + hw_ops->enable_rx_tx_ints = fxgmac_enable_rx_tx_ints; + hw_ops->disable_rx_tx_ints = fxgmac_disable_rx_tx_ints; + + hw_ops->set_mac_address = fxgmac_set_mac_address; + hw_ops->set_mac_hash = fxgmac_set_mc_addresses; + hw_ops->config_rx_mode = fxgmac_config_rx_mode; + hw_ops->enable_rx_csum = fxgmac_enable_rx_csum; + hw_ops->disable_rx_csum = fxgmac_disable_rx_csum; + + /* For MII speed configuration */ + hw_ops->config_mac_speed = fxgmac_config_mac_speed; + hw_ops->get_xlgmii_phy_status = fxgmac_check_phy_link; + + /* For descriptor related operation */ + hw_ops->is_last_desc = fxgmac_is_last_desc; + hw_ops->is_context_desc = fxgmac_is_context_desc; + + hw_ops->config_tso = fxgmac_config_tso_mode; +#if FXGMAC_SANITY_CHECK_ENABLED + hw_ops->diag_sanity_check = fxgmac_diag_sanity_check; +#endif + + /* For Flow Control */ + hw_ops->config_tx_flow_control = fxgmac_config_tx_flow_control; + hw_ops->config_rx_flow_control = fxgmac_config_rx_flow_control; + + /*For Jumbo Frames*/ + hw_ops->enable_jumbo = fxgmac_config_jumbo; + + /* For Vlan related config */ + hw_ops->enable_tx_vlan = fxgmac_enable_tx_vlan; + hw_ops->disable_tx_vlan = fxgmac_disable_tx_vlan; + hw_ops->enable_rx_vlan_stripping = fxgmac_enable_rx_vlan_stripping; + hw_ops->disable_rx_vlan_stripping = fxgmac_disable_rx_vlan_stripping; + hw_ops->enable_rx_vlan_filtering = fxgmac_enable_rx_vlan_filtering; + hw_ops->disable_rx_vlan_filtering = fxgmac_disable_rx_vlan_filtering; + hw_ops->update_vlan_hash_table = fxgmac_update_vlan_hash_table; + + /* For RX coalescing */ + hw_ops->config_rx_coalesce = fxgmac_config_rx_coalesce; + hw_ops->config_tx_coalesce = fxgmac_config_tx_coalesce; + hw_ops->usec_to_riwt = fxgmac_usec_to_riwt; + hw_ops->riwt_to_usec = fxgmac_riwt_to_usec; + + /* For RX and TX threshold config */ + hw_ops->config_rx_threshold = fxgmac_config_rx_threshold; + hw_ops->config_tx_threshold = fxgmac_config_tx_threshold; + + /* For RX and TX Store and Forward Mode config */ + hw_ops->config_rsf_mode = fxgmac_config_rsf_mode; + hw_ops->config_tsf_mode = fxgmac_config_tsf_mode; + + /* For TX DMA Operating on Second Frame config */ + hw_ops->config_osp_mode = fxgmac_config_osp_mode; + + /* For RX and TX PBL config */ + hw_ops->config_rx_pbl_val = fxgmac_config_rx_pbl_val; + hw_ops->get_rx_pbl_val = fxgmac_get_rx_pbl_val; + hw_ops->config_tx_pbl_val = fxgmac_config_tx_pbl_val; + hw_ops->get_tx_pbl_val = fxgmac_get_tx_pbl_val; + hw_ops->config_pblx8 = fxgmac_config_pblx8; + hw_ops->calculate_max_checksum_size = fxgmac_calculate_max_checksum_size; + + /* For MMC statistics support */ + hw_ops->tx_mmc_int = fxgmac_tx_mmc_int; + hw_ops->rx_mmc_int = fxgmac_rx_mmc_int; + hw_ops->read_mmc_stats = fxgmac_read_mmc_stats; + + /* For Receive Side Scaling */ + hw_ops->enable_rss = fxgmac_enable_rss; + hw_ops->disable_rss = fxgmac_disable_rss; + hw_ops->get_rss_options = fxgmac_read_rss_options; + hw_ops->set_rss_options = fxgmac_write_rss_options; + hw_ops->set_rss_hash_key = fxgmac_set_rss_hash_key; + hw_ops->set_rss_lookup_table = fxgmac_set_rss_lookup_table; + hw_ops->get_rss_hash_key = fxgmac_read_rss_hash_key; + hw_ops->write_rss_lookup_table = fxgmac_write_rss_lookup_table; + + /*For Power Management*/ +#if defined(FXGMAC_POWER_MANAGEMENT) + hw_ops->set_arp_offload = fxgmac_update_aoe_ipv4addr; + hw_ops->enable_arp_offload = fxgmac_enable_arp_offload; + hw_ops->disable_arp_offload = fxgmac_disable_arp_offload; + + hw_ops->set_ns_offload = fxgmac_set_ns_offload; + hw_ops->enable_ns_offload = fxgmac_enable_ns_offload; + hw_ops->disable_ns_offload = fxgmac_disable_ns_offload; + + hw_ops->enable_wake_magic_pattern = fxgmac_enable_wake_magic_pattern; + hw_ops->disable_wake_magic_pattern = fxgmac_disable_wake_magic_pattern; + + hw_ops->enable_wake_link_change = fxgmac_enable_wake_link_change; + hw_ops->disable_wake_link_change = fxgmac_disable_wake_link_change; + + hw_ops->check_wake_pattern_fifo_pointer = fxgmac_check_wake_pattern_fifo_pointer; + hw_ops->set_wake_pattern = fxgmac_set_wake_pattern; + hw_ops->enable_wake_pattern = fxgmac_enable_wake_pattern; + hw_ops->disable_wake_pattern = fxgmac_disable_wake_pattern; + hw_ops->set_wake_pattern_mask = fxgmac_set_wake_pattern_mask; +#if FXGMAC_PM_WPI_READ_FEATURE_ENABLED + hw_ops->enable_wake_packet_indication = fxgmac_enable_wake_packet_indication; + hw_ops->get_wake_packet_indication = fxgmac_get_wake_packet_indication; +#endif +#endif + + /*For phy write /read*/ + hw_ops->reset_phy = fxgmac_reset_phy; + hw_ops->release_phy = fxgmac_release_phy; + hw_ops->get_ephy_state = fxgmac_get_ephy_state; + hw_ops->write_ephy_reg = fxgmac_write_ephy_reg; + hw_ops->read_ephy_reg = fxgmac_read_ephy_reg; + hw_ops->set_ephy_autoneg_advertise = fxgmac_set_ephy_autoneg_advertise; + hw_ops->phy_config = fxgmac_phy_config; + hw_ops->close_phy_led = fxgmac_close_phy_led; + hw_ops->led_under_active = fxgmac_config_led_under_active; + hw_ops->led_under_sleep = fxgmac_config_led_under_sleep; + hw_ops->led_under_shutdown = fxgmac_config_led_under_shutdown; + hw_ops->led_under_disable = fxgmac_config_led_under_disable; + hw_ops->enable_phy_check = fxgmac_enable_phy_check; + hw_ops->disable_phy_check = fxgmac_disable_phy_check; + hw_ops->setup_cable_loopback = fxgmac_setup_cable_loopback; + hw_ops->clean_cable_loopback = fxgmac_clean_cable_loopback; + hw_ops->disable_phy_sleep = fxgmac_disable_phy_sleep; + hw_ops->enable_phy_sleep = fxgmac_enable_phy_sleep; + hw_ops->phy_green_ethernet = fxgmac_phy_green_ethernet; + hw_ops->phy_eee_feature = fxgmac_phy_eee_feature; + + /* For power management */ + hw_ops->pre_power_down = fxgmac_pre_powerdown; + hw_ops->config_power_down = fxgmac_config_powerdown; + hw_ops->config_power_up = fxgmac_config_powerup; + hw_ops->set_suspend_int = fxgmac_suspend_int; + hw_ops->set_resume_int = fxgmac_resume_int; + hw_ops->set_suspend_txrx = fxgmac_suspend_txrx; + hw_ops->set_pwr_clock_gate = fxgmac_pwr_clock_gate; + hw_ops->set_pwr_clock_ungate = fxgmac_pwr_clock_ungate; + + hw_ops->set_all_multicast_mode = fxgmac_set_all_multicast_mode; + hw_ops->config_multicast_mac_hash_table = fxgmac_config_multicast_mac_hash_table; + hw_ops->set_promiscuous_mode = fxgmac_set_promiscuous_mode; + hw_ops->enable_rx_broadcast = fxgmac_enable_rx_broadcast; + + /* efuse relevant operation. */ + hw_ops->read_mac_subsys_from_efuse = fxgmac_read_mac_subsys_from_efuse; + hw_ops->read_efuse_data = fxgmac_efuse_read_data; +#ifndef COMMENT_UNUSED_CODE_TO_REDUCE_SIZE + hw_ops->read_patch_from_efuse = fxgmac_read_patch_from_efuse; + hw_ops->read_patch_from_efuse_per_index = fxgmac_read_patch_from_efuse_per_index; /* read patch per index. */ + hw_ops->write_patch_to_efuse = fxgmac_write_patch_to_efuse; + hw_ops->write_patch_to_efuse_per_index = fxgmac_write_patch_to_efuse_per_index; + hw_ops->write_mac_subsys_to_efuse = fxgmac_write_mac_subsys_to_efuse; + hw_ops->efuse_load = fxgmac_efuse_load; + hw_ops->write_oob = fxgmac_efuse_write_oob; + hw_ops->write_led = fxgmac_efuse_write_led; + hw_ops->write_led_config = fxgmac_write_led_setting_to_efuse; + hw_ops->read_led_config = fxgmac_read_led_setting_from_efuse; +#endif + + /* */ + hw_ops->pcie_init = fxgmac_pcie_init; + hw_ops->trigger_pcie = fxgmac_trigger_pcie; +} diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-ioctl.c b/lede/package/kernel/yt6801/src/fuxi-gmac-ioctl.c new file mode 100644 index 0000000000..d85f0d1cab --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-ioctl.c @@ -0,0 +1,563 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" + +static void fxgmac_dbg_tx_pkt(struct fxgmac_pdata *pdata, u8 *pcmd_data) +{ + unsigned int pktLen = 0; + struct sk_buff *skb; + pfxgmac_test_packet pPkt; + u8 * pTx_data = NULL; + u8 * pSkb_data = NULL; + u32 offload_len = 0; + u8 ipHeadLen, tcpHeadLen, headTotalLen; + static u32 lastGsoSize = 806;//initial default value + //int i = 0; + + /* get fxgmac_test_packet */ + pPkt = (pfxgmac_test_packet)(pcmd_data + sizeof(struct ext_ioctl_data)); + pktLen = pPkt->length; + + /* get pkt data */ + pTx_data = (u8 *)pPkt + sizeof(fxgmac_test_packet); + + /* alloc sk_buff */ + skb = alloc_skb(pktLen, GFP_ATOMIC); + if (!skb){ + DPRINTK("alloc skb fail\n"); + return; + } + + /* copy data to skb */ + pSkb_data = skb_put(skb, pktLen); + memset(pSkb_data, 0, pktLen); + memcpy(pSkb_data, pTx_data, pktLen); + + /* set skb parameters */ + skb->dev = pdata->netdev; + skb->pkt_type = PACKET_OUTGOING; + skb->protocol = ntohs(ETH_P_IP); + skb->no_fcs = 1; + skb->ip_summed = CHECKSUM_PARTIAL; + if(skb->len > 1514){ + /* TSO packet */ + /* set tso test flag */ + pdata->expansion.fxgmac_test_tso_flag = true; + + /* get protocol head length */ + ipHeadLen = (pSkb_data[TEST_MAC_HEAD] & 0xF) * 4; + tcpHeadLen = (pSkb_data[TEST_MAC_HEAD + ipHeadLen + TEST_TCP_HEAD_LEN_OFFSET] >> 4 & 0xF) * 4; + headTotalLen = TEST_MAC_HEAD + ipHeadLen + tcpHeadLen; + offload_len = (pSkb_data[TEST_TCP_OFFLOAD_LEN_OFFSET] << 8 | + pSkb_data[TEST_TCP_OFFLOAD_LEN_OFFSET + 1]) & 0xFFFF; + /* set tso skb parameters */ + //skb->ip_summed = CHECKSUM_PARTIAL; + skb->transport_header = ipHeadLen + TEST_MAC_HEAD; + skb->network_header = TEST_MAC_HEAD; + skb->inner_network_header = TEST_MAC_HEAD; + skb->mac_len = TEST_MAC_HEAD; + + /* set skb_shinfo parameters */ + if(tcpHeadLen > TEST_TCP_FIX_HEAD_LEN){ + skb_shinfo(skb)->gso_size = (pSkb_data[TEST_TCP_MSS_OFFSET] << 8 | + pSkb_data[TEST_TCP_MSS_OFFSET + 1]) & 0xFFFF; + }else{ + skb_shinfo(skb)->gso_size = 0; + } + if(skb_shinfo(skb)->gso_size != 0){ + lastGsoSize = skb_shinfo(skb)->gso_size; + }else{ + skb_shinfo(skb)->gso_size = lastGsoSize; + } + //DPRINTK("offload_len is %d, skb_shinfo(skb)->gso_size is %d", offload_len, skb_shinfo(skb)->gso_size); + /* get segment size */ + if(offload_len % skb_shinfo(skb)->gso_size == 0){ + skb_shinfo(skb)->gso_segs = offload_len / skb_shinfo(skb)->gso_size; + pdata->expansion.fxgmac_test_last_tso_len = skb_shinfo(skb)->gso_size + headTotalLen; + }else{ + skb_shinfo(skb)->gso_segs = offload_len / skb_shinfo(skb)->gso_size + 1; + pdata->expansion.fxgmac_test_last_tso_len = offload_len % skb_shinfo(skb)->gso_size + headTotalLen; + } + pdata->expansion.fxgmac_test_tso_seg_num = skb_shinfo(skb)->gso_segs; + + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4 ; + skb_shinfo(skb)->frag_list = NULL; + skb->csum_start = skb_headroom(skb) + TEST_MAC_HEAD + ipHeadLen; + skb->csum_offset = skb->len - TEST_MAC_HEAD - ipHeadLen; + + pdata->expansion.fxgmac_test_packet_len = skb_shinfo(skb)->gso_size + headTotalLen; + }else { + /* set non-TSO packet parameters */ + pdata->expansion.fxgmac_test_packet_len = skb->len; + } + + /* send data */ + if(dev_queue_xmit(skb) != NET_XMIT_SUCCESS){ + DPRINTK("xmit data fail \n"); + } +} + +static void fxgmac_dbg_rx_pkt(struct fxgmac_pdata *pdata, u8 *pcmd_data) +{ + unsigned int totalLen = 0; + struct sk_buff *rx_skb; + struct ext_ioctl_data *pcmd; + fxgmac_test_packet pkt; + void* addr = 0; + u8 *rx_data = (u8*)kzalloc(FXGMAC_MAX_DBG_RX_DATA, GFP_KERNEL); + if (!rx_data) + return; + //int i; + + /* initial dest data region */ + pcmd = (struct ext_ioctl_data *)pcmd_data; + addr = pcmd->cmd_buf.buf; + while(pdata->expansion.fxgmac_test_skb_arr_in_index != pdata->expansion.fxgmac_test_skb_arr_out_index){ + /* get received skb data */ + rx_skb = pdata->expansion.fxgmac_test_skb_array[pdata->expansion.fxgmac_test_skb_arr_out_index]; + + if(rx_skb->len + sizeof(fxgmac_test_packet) + totalLen < 64000){ + pkt.length = rx_skb->len; + pkt.type = 0x80; + pkt.buf[0].offset = totalLen + sizeof(fxgmac_test_packet); + pkt.buf[0].length = rx_skb->len; + + /* get data from skb */ + //DPRINTK("FXG:rx_skb->len=%d", rx_skb->len); + memcpy(rx_data, rx_skb->data, rx_skb->len); + + /* update next pointer */ + if((pdata->expansion.fxgmac_test_skb_arr_out_index + 1) % FXGMAC_MAX_DBG_TEST_PKT == pdata->expansion.fxgmac_test_skb_arr_in_index) + { + pkt.next = NULL; + } + else + { + pkt.next = (pfxgmac_test_packet)(addr + totalLen + sizeof(fxgmac_test_packet) + pkt.length); + } + + /* copy data to user space */ + if(copy_to_user((void *)(addr + totalLen), (void*)(&pkt), sizeof(fxgmac_test_packet))) + { + DPRINTK("cppy pkt data to user fail..."); + } + //FXGMAC_PR("FXG:rx_skb->len=%d", rx_skb->len); + if(copy_to_user((void *)(addr + totalLen + sizeof(fxgmac_test_packet)), (void*)rx_data, rx_skb->len)) + { + DPRINTK("cppy data to user fail..."); + } + + /* update total length */ + totalLen += (sizeof(fxgmac_test_packet) + rx_skb->len); + + /* free skb */ + kfree_skb(rx_skb); + pdata->expansion.fxgmac_test_skb_array[pdata->expansion.fxgmac_test_skb_arr_out_index] = NULL; + + /* update gCurSkbOutIndex */ + pdata->expansion.fxgmac_test_skb_arr_out_index = (pdata->expansion.fxgmac_test_skb_arr_out_index + 1) % FXGMAC_MAX_DBG_TEST_PKT; + }else{ + DPRINTK("receive data more receive buffer... \n"); + break; + } + } + + if (rx_data) + kfree(rx_data); +#if 0 + pPkt = (pfxgmac_test_packet)buf; + DPRINTK("FXG: pPkt->Length is %d", pPkt->length); + DPRINTK("FXG: pPkt->Length is %d", pPkt->length); + DPRINTK("pPkt: %p, buf is %lx",pPkt, pcmd->cmd_buf.buf); + for(i = 0; i < 30; i++){ + DPRINTK("%x",*(((u8*)pPkt + sizeof(fxgmac_test_packet)) + i)); + } +#endif +} + +// Based on the current application scenario,we only use CMD_DATA for data. +// if you use other struct, you should recalculate in_total_size +long fxgmac_netdev_ops_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + bool ret = true; + int regval = 0; + struct fxgmac_pdata *pdata = file->private_data; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + FXGMAC_PDATA_OF_PLATFORM *ex = &pdata->expansion; + CMD_DATA ex_data; + struct ext_ioctl_data pcmd; + u8* data = NULL; + u8* buf = NULL; + int in_total_size, in_data_size, out_total_size; + int ioctl_cmd_size = sizeof(struct ext_ioctl_data); + u8 mac[ETH_ALEN] = {0}; + struct sk_buff *tmpskb; + + if (!arg) { + DPRINTK("[%s] command arg is %lx !\n", __func__, arg); + goto err; + } + + /* check device type */ + if (_IOC_TYPE(cmd) != IOC_MAGIC) { + DPRINTK("[%s] command type [%c] error!\n", __func__, _IOC_TYPE(cmd)); + goto err; + } + + /* check command number*/ + if (_IOC_NR(cmd) > IOC_MAXNR) { + DPRINTK("[%s] command number [%d] exceeded!\n", __func__, _IOC_NR(cmd)); + goto err; + } + + //buf = (u8*)kzalloc(FXGMAC_MAX_DBG_BUF_LEN, GFP_KERNEL); + if(copy_from_user(&pcmd, (void*)arg, ioctl_cmd_size)) { + DPRINTK("copy data from user fail... \n"); + goto err; + } + + in_total_size = pcmd.cmd_buf.size_in; + in_data_size = in_total_size - ioctl_cmd_size; + out_total_size = pcmd.cmd_buf.size_out; + + buf = (u8*)kzalloc(in_total_size, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + if(copy_from_user(buf, (void*)arg, in_total_size)) { + DPRINTK("copy data from user fail... \n"); + goto err; + } + data = buf + ioctl_cmd_size; + + if(arg != 0) { + switch(pcmd.cmd_type) { + /* ioctl diag begin */ + case FXGMAC_DFS_IOCTL_DIAG_BEGIN: + DPRINTK("Debugfs received diag begin command.\n"); +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED + pdata->expansion.lb_test_flag = 1; +#endif + if (netif_running(pdata->netdev)){ + fxgmac_restart_dev(pdata); + } + + /* release last loopback test abnormal exit buffer */ + while(ex->fxgmac_test_skb_arr_in_index != + ex->fxgmac_test_skb_arr_out_index) + { + tmpskb = ex->fxgmac_test_skb_array[ex->fxgmac_test_skb_arr_out_index]; + if(tmpskb) + { + kfree_skb(tmpskb); + ex->fxgmac_test_skb_array[ex->fxgmac_test_skb_arr_out_index] = NULL; + } + + ex->fxgmac_test_skb_arr_out_index = (ex->fxgmac_test_skb_arr_out_index + 1) % FXGMAC_MAX_DBG_TEST_PKT; + } + + /* init loopback test parameters */ + ex->fxgmac_test_skb_arr_in_index = 0; + ex->fxgmac_test_skb_arr_out_index = 0; + ex->fxgmac_test_tso_flag = false; + ex->fxgmac_test_tso_seg_num = 0; + ex->fxgmac_test_last_tso_len = 0; + ex->fxgmac_test_packet_len = 0; + break; + + /* ioctl diag end */ + case FXGMAC_DFS_IOCTL_DIAG_END: + DPRINTK("Debugfs received diag end command.\n"); + if (netif_running(pdata->netdev)){ + fxgmac_restart_dev(pdata); + } +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED + pdata->expansion.lb_test_flag = 0; +#endif + break; + + /* ioctl diag tx pkt */ + case FXGMAC_DFS_IOCTL_DIAG_TX_PKT: + fxgmac_dbg_tx_pkt(pdata, buf); + break; + + /* ioctl diag rx pkt */ + case FXGMAC_DFS_IOCTL_DIAG_RX_PKT: + fxgmac_dbg_rx_pkt(pdata, buf); + break; + + /* ioctl device reset */ + case FXGMAC_DFS_IOCTL_DEVICE_RESET: + DPRINTK("Debugfs received device reset command.\n"); + if (netif_running(pdata->netdev)){ + fxgmac_restart_dev(pdata); + } + break; + + case FXGMAC_EFUSE_LED_TEST: + DPRINTK("Debugfs received device led test command.\n"); + memcpy(&pdata->led, data, sizeof(struct led_setting)); + fxgmac_restart_dev(pdata); + break; + + case FXGMAC_EFUSE_UPDATE_LED_CFG: + DPRINTK("Debugfs received device led update command.\n"); + memcpy(&pdata->ledconfig, data, sizeof(struct led_setting)); + ret = hw_ops->write_led_config(pdata); + hw_ops->read_led_config(pdata); + hw_ops->led_under_active(pdata); + break; + + case FXGMAC_EFUSE_WRITE_LED: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + DPRINTK("FXGMAC_EFUSE_WRITE_LED, val = 0x%x\n", ex_data.val0); + ret = hw_ops->write_led(pdata, ex_data.val0); + break; + + case FXGMAC_EFUSE_WRITE_OOB: + DPRINTK("FXGMAC_EFUSE_WRITE_OOB.\n"); + ret = hw_ops->write_oob(pdata); + break; + + case FXGMAC_EFUSE_READ_REGIONABC: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + ret = hw_ops->read_efuse_data(pdata, ex_data.val0, &ex_data.val1); + /* + * DPRINTK("FXGMAC_EFUSE_READ_REGIONABC, address = 0x%x, val = 0x%x\n", + * ex_data.val0, + * ex_data.val1); + */ + if (ret) { + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + } + break; + + case FXGMAC_EFUSE_WRITE_PATCH_REG: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + /* + * DPRINTK("FXGMAC_EFUSE_WRITE_PATCH_REG, address = 0x%x, val = 0x%x\n", + * ex_data.val0, + * ex_data.val1); + */ + ret = hw_ops->write_patch_to_efuse(pdata, ex_data.val0, ex_data.val1); + break; + + case FXGMAC_EFUSE_READ_PATCH_REG: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + ret = hw_ops->read_patch_from_efuse(pdata, ex_data.val0, &ex_data.val1); + /* + * DPRINTK("FXGMAC_EFUSE_READ_PATCH_REG, address = 0x%x, val = 0x%x\n", + * ex_data.val0, ex_data.val1); + */ + if (ret) { + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + } + break; + + case FXGMAC_EFUSE_WRITE_PATCH_PER_INDEX: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + ret = hw_ops->write_patch_to_efuse_per_index(pdata, ex_data.val0, + ex_data.val1, + ex_data.val2); + /* + * DPRINTK("FXGMAC_EFUSE_WRITE_PATCH_PER_INDEX, index = %d, address = 0x%x, val = 0x%x\n", + * ex_data.val0, ex_data.val1, ex_data.val2); + */ + break; + + case FXGMAC_EFUSE_READ_PATCH_PER_INDEX: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + ret = hw_ops->read_patch_from_efuse_per_index(pdata,ex_data.val0, + &ex_data.val1, + &ex_data.val2); + /* + * DPRINTK("FXGMAC_EFUSE_READ_PATCH_PER_INDEX, address = 0x%x, val = 0x%x\n", + * ex_data.val1, ex_data.val2); + */ + if (ret) { + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + } + break; + + case FXGMAC_EFUSE_LOAD: + DPRINTK("FXGMAC_EFUSE_LOAD.\n"); + ret = hw_ops->efuse_load(pdata); + break; + + case FXGMAC_GET_MAC_DATA: + ret = hw_ops->read_mac_subsys_from_efuse(pdata, mac, NULL, NULL); + if (ret) { + memcpy(data, mac, ETH_ALEN); + out_total_size = ioctl_cmd_size + ETH_ALEN; + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + } + break; + + case FXGMAC_SET_MAC_DATA: + if (in_data_size != ETH_ALEN) + goto err; + memcpy(mac, data, ETH_ALEN); + ret = hw_ops->write_mac_subsys_to_efuse(pdata, mac, NULL, NULL); + if (ret) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) + eth_hw_addr_set(pdata->netdev, mac); +#else + memcpy(pdata->netdev->dev_addr, mac, ETH_ALEN); +#endif + + memcpy(pdata->mac_addr, mac, ETH_ALEN); + + hw_ops->set_mac_address(pdata, mac); + hw_ops->set_mac_hash(pdata); + } + break; + + case FXGMAC_GET_SUBSYS_ID: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + ret = hw_ops->read_mac_subsys_from_efuse(pdata, + NULL, + &ex_data.val0, + NULL); + if (ret) { + ex_data.val1 = 0xFFFF; // invalid value + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + } + break; + + case FXGMAC_SET_SUBSYS_ID: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + ret = hw_ops->write_mac_subsys_to_efuse(pdata, + NULL, + &ex_data.val0, + NULL); + break; + + case FXGMAC_GET_REG: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + ex_data.val1 = hw_ops->get_gmac_register(pdata, + (u8*)(pdata->base_mem + ex_data.val0)); + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + break; + + case FXGMAC_SET_REG: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + regval = hw_ops->set_gmac_register(pdata, + (u8*)(pdata->base_mem + ex_data.val0), + ex_data.val1); + ret = (regval == 0 ? true : false); + break; + + case FXGMAC_GET_PHY_REG: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + regval = hw_ops->read_ephy_reg(pdata, ex_data.val0, &ex_data.val1); + if (regval != -1) { + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + } + ret = (regval == -1 ? false : true); + break; + + case FXGMAC_SET_PHY_REG: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + regval = hw_ops->write_ephy_reg(pdata, ex_data.val0, ex_data.val1); + ret = (regval == 0 ? true : false); + break; + + case FXGMAC_GET_PCIE_LOCATION: + ex_data.val0 = pdata->pdev->bus->number; + ex_data.val1 = PCI_SLOT(pdata->pdev->devfn); + ex_data.val2 = PCI_FUNC(pdata->pdev->devfn); + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + break; + + case FXGMAC_GET_GSO_SIZE: + ex_data.val0 = pdata->netdev->gso_max_size; + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + break; + + case FXGMAC_SET_GSO_SIZE: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + pdata->netdev->gso_max_size = ex_data.val0; + break; + + case FXGMAC_SET_RX_MODERATION: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + regval = readreg(pdata->pAdapter, pdata->base_mem + INT_MOD); + regval = FXGMAC_SET_REG_BITS(regval, INT_MOD_RX_POS, INT_MOD_RX_LEN, ex_data.val0); + writereg(pdata->pAdapter, regval, pdata->base_mem + INT_MOD); + break; + + case FXGMAC_SET_TX_MODERATION: + memcpy(&ex_data, data, sizeof(CMD_DATA)); + regval = readreg(pdata->pAdapter, pdata->base_mem + INT_MOD); + regval = FXGMAC_SET_REG_BITS(regval, INT_MOD_TX_POS, INT_MOD_TX_LEN, ex_data.val0); + writereg(pdata->pAdapter, regval, pdata->base_mem + INT_MOD); + break; + + case FXGMAC_GET_TXRX_MODERATION: + regval = readreg(pdata->pAdapter, pdata->base_mem + INT_MOD); + ex_data.val0 = FXGMAC_GET_REG_BITS(regval, INT_MOD_RX_POS, INT_MOD_RX_LEN); + ex_data.val1 = FXGMAC_GET_REG_BITS(regval, INT_MOD_TX_POS, INT_MOD_TX_LEN); + memcpy(data, &ex_data, sizeof(CMD_DATA)); + out_total_size = ioctl_cmd_size + sizeof(CMD_DATA); + if (copy_to_user((void*)arg, (void*)buf, out_total_size)) + goto err; + break; + + default: + DPRINTK("Debugfs received invalid command: %x.\n", pcmd.cmd_type); + ret = false; + break; + } + } + + if (buf) + kfree(buf); + return ret ? FXGMAC_SUCCESS : FXGMAC_FAIL; + +err: + if (buf) + kfree(buf); + return FXGMAC_FAIL; +} diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-net.c b/lede/package/kernel/yt6801/src/fuxi-gmac-net.c new file mode 100644 index 0000000000..d5baa9caf0 --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-net.c @@ -0,0 +1,3510 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" + +static int fxgmac_one_poll_rx(struct napi_struct *, int); +static int fxgmac_one_poll_tx(struct napi_struct *, int); +static int fxgmac_all_poll(struct napi_struct *, int); +static int fxgmac_dev_read(struct fxgmac_channel *channel); + +/* define for centos 7.0 */ +#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,0)) && (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,8)) + +static inline void ____napi_schedule(struct softnet_data *sd, + struct napi_struct *napi) +{ + list_add_tail(&napi->poll_list, &sd->poll_list); + //__raise_softirq_irqoff(NET_RX_SOFTIRQ); + or_softirq_pending(1UL << NET_RX_SOFTIRQ); +} + +/** + * __napi_schedule_irqoff - schedule for receive + * @n: entry to schedule + * + * Variant of __napi_schedule() assuming hard irqs are masked + */ +void __napi_schedule_irqoff(struct napi_struct *n) +{ + ____napi_schedule(this_cpu_ptr(&softnet_data), n); +} + +/** + * napi_schedule_irqoff - schedule NAPI poll + * @n: napi context + * + * Variant of napi_schedule(), assuming hard irqs are masked. + */ +static inline void napi_schedule_irqoff(struct napi_struct *n) +{ + if (napi_schedule_prep(n)) + __napi_schedule_irqoff(n); +} +#endif + +void fxgmac_lock(struct fxgmac_pdata *pdata) +{ + mutex_lock(&pdata->expansion.mutex); +} + +void fxgmac_unlock(struct fxgmac_pdata *pdata) +{ + mutex_unlock(&pdata->expansion.mutex); +} + +#ifdef FXGMAC_ESD_CHECK_ENABLED +static void fxgmac_schedule_esd_work(struct fxgmac_pdata *pdata) +{ + set_bit(FXGMAC_FLAG_TASK_ESD_CHECK_PENDING, pdata->expansion.task_flags); + schedule_delayed_work(&pdata->expansion.esd_work, FXGMAC_ESD_INTERVAL); +} + +static void fxgmac_update_esd_stats(struct fxgmac_pdata *pdata) +{ + u32 value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TXEXCESSIVECOLLSIONFRAMES); + pdata->expansion.esd_stats.tx_abort_excess_collisions += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TXUNDERFLOWERROR_LO); + pdata->expansion.esd_stats.tx_dma_underrun += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TXCARRIERERRORFRAMES); + pdata->expansion.esd_stats.tx_lost_crs += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TXLATECOLLISIONFRAMES); + pdata->expansion.esd_stats.tx_late_collisions += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_RXCRCERROR_LO); + pdata->expansion.esd_stats.rx_crc_errors += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_RXALIGNERROR); + pdata->expansion.esd_stats.rx_align_errors += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_RXRUNTERROR); + pdata->expansion.esd_stats.rx_runt_errors += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TXSINGLECOLLISION_G); + pdata->expansion.esd_stats.single_collisions += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TXMULTIPLECOLLISION_G); + pdata->expansion.esd_stats.multi_collisions += value; + + value = readreg(pdata->pAdapter, pdata->mac_regs + MMC_TXDEFERREDFRAMES); + pdata->expansion.esd_stats.tx_deferred_frames += value; +} + +static void fxgmac_check_esd_work(struct fxgmac_pdata *pdata) +{ + FXGMAC_ESD_STATS *stats = &pdata->expansion.esd_stats; + int i = 0; + u32 regval; + + /* ESD test will make recv crc errors more than 4,294,967,xxx in one second. */ + if (stats->rx_crc_errors > FXGMAC_ESD_ERROR_THRESHOLD || + stats->rx_align_errors > FXGMAC_ESD_ERROR_THRESHOLD || + stats->rx_runt_errors > FXGMAC_ESD_ERROR_THRESHOLD || + stats->tx_abort_excess_collisions > FXGMAC_ESD_ERROR_THRESHOLD || + stats->tx_dma_underrun > FXGMAC_ESD_ERROR_THRESHOLD || + stats->tx_lost_crs > FXGMAC_ESD_ERROR_THRESHOLD || + stats->tx_late_collisions > FXGMAC_ESD_ERROR_THRESHOLD || + stats->single_collisions > FXGMAC_ESD_ERROR_THRESHOLD || + stats->multi_collisions > FXGMAC_ESD_ERROR_THRESHOLD || + stats->tx_deferred_frames > FXGMAC_ESD_ERROR_THRESHOLD) { + dev_info(pdata->dev, "%s - Error:\n", __func__); + dev_info(pdata->dev, "rx_crc_errors %ul.\n", stats->rx_crc_errors); + dev_info(pdata->dev, "rx_align_errors %ul.\n", stats->rx_align_errors); + dev_info(pdata->dev, "rx_runt_errors %ul.\n", stats->rx_runt_errors); + dev_info(pdata->dev, "tx_abort_excess_collisions %ul.\n", stats->tx_abort_excess_collisions); + dev_info(pdata->dev, "tx_dma_underrun %ul.\n", stats->tx_dma_underrun); + dev_info(pdata->dev, "tx_lost_crs %ul.\n", stats->tx_lost_crs); + dev_info(pdata->dev, "tx_late_collisions %ul.\n", stats->tx_late_collisions); + dev_info(pdata->dev, "single_collisions %ul.\n", stats->single_collisions); + dev_info(pdata->dev, "multi_collisions %ul.\n", stats->multi_collisions); + dev_info(pdata->dev, "tx_deferred_frames %ul.\n", stats->tx_deferred_frames); + + dev_info(pdata->dev, "esd error triggered, restart NIC...\n"); + cfg_r32(pdata, REG_PCI_COMMAND, ®val); + while ((regval == FXGMAC_PCIE_LINK_DOWN) && (i++ < FXGMAC_PCIE_RECOVER_TIMES)) { + usleep_range_ex(pdata->pAdapter, 200, 200); + cfg_r32(pdata, REG_PCI_COMMAND, ®val); + dev_info(pdata->dev, "pcie recovery link cost %d(200us)\n", i); + } + + if (regval == FXGMAC_PCIE_LINK_DOWN) { + dev_info(pdata->dev, "pcie link down, recovery failed.\n"); + return; + } + + if (regval & FXGMAC_PCIE_IO_MEM_MASTER_ENABLE) { + pdata->hw_ops.esd_restore_pcie_cfg(pdata); + cfg_r32(pdata, REG_PCI_COMMAND, ®val); + dev_info(pdata->dev, "pci command reg is %x after restoration.\n", regval); + fxgmac_restart_dev(pdata); + } + } + + memset(stats, 0, sizeof(FXGMAC_ESD_STATS)); +} + +static void fxgmac_esd_work(struct work_struct *work) +{ + struct fxgmac_pdata *pdata = container_of(work, + struct fxgmac_pdata, + expansion.esd_work.work); + + rtnl_lock(); + if (!netif_running(pdata->netdev) || + !test_and_clear_bit(FXGMAC_FLAG_TASK_ESD_CHECK_PENDING, pdata->expansion.task_flags)) + goto out_unlock; + + fxgmac_update_esd_stats(pdata); + fxgmac_check_esd_work(pdata); + fxgmac_schedule_esd_work(pdata); + +out_unlock: + rtnl_unlock(); +} + +static void fxgmac_cancel_esd_work(struct fxgmac_pdata *pdata) +{ + struct work_struct *work = &pdata->expansion.esd_work.work; + + if (!work->func) { + dev_info(pdata->dev, "work func is NULL.\n"); + return; + } + + cancel_delayed_work_sync(&pdata->expansion.esd_work); +} +#endif + +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED +static void fxgmac_schedule_loopback_work(struct fxgmac_pdata *pdata) +{ + schedule_delayed_work(&pdata->expansion.loopback_work, FXGMAC_LOOPBACK_CHECK_INTERVAL); +} + +static void fxgmac_loopback_work(struct work_struct *work) +{ + int ret; + u32 regval; + struct fxgmac_pdata *pdata = container_of(work, + struct fxgmac_pdata, + expansion.loopback_work.work); + + if (pdata->expansion.lb_test_flag || pdata->expansion.phy_link) + goto reschedule; + + if (!pdata->expansion.lb_cable_flag) { + ret = pdata->hw_ops.read_ephy_reg(pdata, REG_MII_STAT1000, ®val); + if (ret < 0) { + printk("%s:read ephy failed\n", __func__); + goto reschedule; + } + + // printk("%s: regval = 0x%x\n", __func__, regval); + regval = FXGMAC_GET_REG_BITS(regval, PHY_MII_STAT1000_CFG_ERROR_POS, + PHY_MII_STAT1000_CFG_ERROR_LEN); + if (regval == 1) { + pdata->expansion.lb_cable_detect_count++; + if (pdata->expansion.lb_cable_detect_count == FXGMAC_PHY_LOOPBACK_DETECT_THRESOLD) { + pdata->expansion.lb_cable_flag = 1; + pdata->hw_ops.setup_cable_loopback(pdata); + pdata->expansion.lb_cable_detect_count = 0; + } + } + } + +reschedule: + fxgmac_schedule_loopback_work(pdata); +} + +static void fxgmac_cancel_loopback_work(struct fxgmac_pdata *pdata) +{ + struct work_struct *work = &pdata->expansion.loopback_work.work; + + if (!work->func) { + dev_info(pdata->dev, "work func is NULL.\n"); + return; + } + + cancel_delayed_work_sync(&pdata->expansion.loopback_work); +} +#endif + +#ifdef FXGMAC_ASPM_ENABLED +void fxgmac_schedule_aspm_config_work(struct fxgmac_pdata *pdata) +{ + if (!pdata->expansion.aspm_work_active && + !pdata->expansion.aspm_en && + pdata->expansion.dev_state != FXGMAC_DEV_CLOSE) { + schedule_delayed_work(&pdata->expansion.aspm_config_work, FXGMAC_ASPM_INTERVAL); + pdata->expansion.aspm_work_active = true; + } +} + +static void fxgmac_aspm_config_work(struct work_struct *work) +{ + u32 pcie_low_power = PCIE_LP_ASPM_LTR | PCIE_LP_ASPM_L1SS | PCIE_LP_ASPM_L1; + struct fxgmac_pdata *pdata = container_of(work, + struct fxgmac_pdata, + expansion.aspm_config_work.work); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + if (pdata->expansion.aspm_work_active) { + hw_ops->pcie_init(pdata, pcie_low_power & PCIE_LP_ASPM_LTR, + pcie_low_power & PCIE_LP_ASPM_L1SS, + pcie_low_power & PCIE_LP_ASPM_L1, + pcie_low_power & PCIE_LP_ASPM_L0S); + //hw_ops->set_pwr_clock_gate(pdata); + pdata->expansion.aspm_en = true; + printk("NIC set aspm at link down\n"); + } + pdata->expansion.aspm_work_active = false; +} + +void fxgmac_cancel_aspm_config_work(struct fxgmac_pdata *pdata) +{ + struct work_struct *work = &pdata->expansion.aspm_config_work.work; + + if (!work->func) { + dev_info(pdata->dev, "work func is NULL.\n"); + return; + } + + cancel_delayed_work_sync(&pdata->expansion.aspm_config_work); +} + +bool fxgmac_aspm_action_linkup(struct fxgmac_pdata *pdata) +{ + if ((pdata->expansion.aspm_work_active || pdata->expansion.aspm_en) + && !pdata->expansion.lb_cable_flag) { + printk("cancel aspm work.\n"); + pdata->expansion.aspm_work_active = false; + fxgmac_cancel_aspm_config_work(pdata); + if (pdata->expansion.aspm_en) { + printk("reset from aspm.\n"); + pdata->expansion.aspm_en = false; + pdata->expansion.recover_from_aspm = true; + schedule_work(&pdata->expansion.restart_work); + return true; + } + pdata->expansion.aspm_en = false; + } + + return false; +} + +#endif + +unsigned int fxgmac_get_netdev_ip4addr(struct fxgmac_pdata *pdata) +{ + struct net_device *netdev = pdata->netdev; + struct in_ifaddr *ifa; + unsigned int ipval = 0xc0a801ca; //here just hard code to 192.168.1.202 + + rcu_read_lock(); + /* we only get the first IPv4 addr. */ + ifa = rcu_dereference(netdev->ip_ptr->ifa_list); + if(ifa) { + /* binary ipv4 addr with __be */ + ipval = (unsigned int)ifa->ifa_address; + + DPRINTK("%s, netdev %s IPv4 address %pI4, mask: %pI4\n",__FUNCTION__, ifa->ifa_label, &ifa->ifa_address, &ifa->ifa_mask); + } + // ifa = rcu_dereference(ifa->ifa_next); // more ipv4 addr + rcu_read_unlock(); + + return ipval; +} + +unsigned char * fxgmac_get_netdev_ip6addr(struct fxgmac_pdata *pdata, unsigned char *ipval, unsigned char *ip6addr_solicited, unsigned int ifa_flag) +{ + struct net_device *netdev = pdata->netdev; + struct inet6_dev *i6dev; + struct inet6_ifaddr *ifp; + unsigned char local_ipval[16] = {0}; + unsigned char solicited_ipval[16] = {0}; + struct in6_addr *addr_ip6 = (struct in6_addr *)local_ipval; + struct in6_addr *addr_ip6_solicited = (struct in6_addr *)solicited_ipval; + int err = -EADDRNOTAVAIL; + + //in6_pton("fe80::35c6:dd1b:9745:fc9b", -1, (u8*)ipval, -1, NULL); //here just hard code for default + if(ipval) { + addr_ip6 = (struct in6_addr *)ipval; + } + + if(ip6addr_solicited) { + addr_ip6_solicited = (struct in6_addr *)ip6addr_solicited; + } + + in6_pton("fe80::4808:8ffb:d93e:d753", -1, (u8*)addr_ip6, -1, NULL); //here just hard code for default + + if (ifa_flag & FXGMAC_NS_IFA_GLOBAL_UNICAST) + DPRINTK ("%s FXGMAC_NS_IFA_GLOBAL_UNICAST is set, %x\n", __FUNCTION__, ifa_flag); + + if (ifa_flag & FXGMAC_NS_IFA_LOCAL_LINK) + DPRINTK ("%s FXGMAC_NS_IFA_LOCAL_LINK is set, %x\n", __FUNCTION__, ifa_flag); + + rcu_read_lock(); + i6dev = __in6_dev_get(netdev); + if (i6dev != NULL) { + read_lock_bh(&i6dev->lock); + list_for_each_entry(ifp, &i6dev->addr_list, if_list) { + + /* here we need only the ll addr, use scope to filter out it. */ + if (((ifa_flag & FXGMAC_NS_IFA_GLOBAL_UNICAST) && (ifp->scope != IFA_LINK)) || ((ifa_flag & FXGMAC_NS_IFA_LOCAL_LINK) && (ifp->scope == IFA_LINK)/* && + !(ifp->flags & IFA_F_TENTATIVE)*/)) { + + memcpy(addr_ip6, &ifp->addr, 16); + addrconf_addr_solict_mult(addr_ip6, addr_ip6_solicited); + err = 0; + + //DPRINTK("%s, netdev %s IPv6 local-link address %pI6\n",__FUNCTION__, netdev->name, addr_ip6); + //DPRINTK("%s, netdev %s IPv6 solicited-node add %pI6\n",__FUNCTION__, netdev->name, addr_ip6_solicited); + break; + } + } + read_unlock_bh(&i6dev->lock); + } + rcu_read_unlock(); + + if(err) DPRINTK("%s get ipv6 addr failed, use default.\n", __FUNCTION__); + + //DPRINTK("%s, netdev %s IPv6 local-link address %pI6\n",__FUNCTION__, netdev->name, addr_ip6); + //DPRINTK("%s, netdev %s IPv6 solicited-node adr %pI6\n",__FUNCTION__, netdev->name, addr_ip6_solicited); + + return (err ? NULL : ipval); +} + +inline unsigned int fxgmac_tx_avail_desc(struct fxgmac_ring *ring) +{ + //return (ring->dma_desc_count - (ring->cur - ring->dirty)); + unsigned int avail; + + if (ring->dirty > ring->cur) + avail = ring->dirty - ring->cur; + else + avail = ring->dma_desc_count - ring->cur + ring->dirty; + + return avail; +} + +inline unsigned int fxgmac_rx_dirty_desc(struct fxgmac_ring *ring) +{ + //return (ring->cur - ring->dirty); + unsigned int dirty; + + if (ring->dirty <= ring->cur) + dirty = ring->cur - ring->dirty; + else + dirty = ring->dma_desc_count - ring->dirty + ring->cur; + + return dirty; +} + +static netdev_tx_t fxgmac_maybe_stop_tx_queue( + struct fxgmac_channel *channel, + struct fxgmac_ring *ring, + unsigned int count) +{ + struct fxgmac_pdata *pdata = channel->pdata; + + if (count > fxgmac_tx_avail_desc(ring)) { + if(netif_msg_tx_done(pdata)) { + netif_info(pdata, drv, pdata->netdev, + "Tx queue stopped, not enough descriptors available\n"); + } + + /* Avoid wrongly optimistic queue wake-up: tx poll thread must + * not miss a ring update when it notices a stopped queue. + */ + smp_wmb(); + netif_stop_subqueue(pdata->netdev, channel->queue_index); + ring->tx.queue_stopped = 1; + + /* Sync with tx poll: + * - publish queue status and cur ring index (write barrier) + * - refresh dirty ring index (read barrier). + * May the current thread have a pessimistic view of the ring + * status and forget to wake up queue, a racing tx poll thread + * can't. + */ + smp_mb(); + if (count <= fxgmac_tx_avail_desc(ring)) { + ring->tx.queue_stopped = 0; + netif_start_subqueue(pdata->netdev, channel->queue_index); + fxgmac_tx_start_xmit(channel, ring); + } else { + /* If we haven't notified the hardware because of xmit_more + * support, tell it now + */ + if (ring->tx.xmit_more) + fxgmac_tx_start_xmit(channel, ring); + if(netif_msg_tx_done(pdata)) DPRINTK("about stop tx q, ret BUSY\n"); + return NETDEV_TX_BUSY; + } + } + + return NETDEV_TX_OK; +} + +static void fxgmac_prep_vlan(struct sk_buff *skb, + struct fxgmac_pkt_info *pkt_info) +{ + if (skb_vlan_tag_present(skb)) + pkt_info->vlan_ctag = skb_vlan_tag_get(skb); +} + +static int fxgmac_prep_tso(struct fxgmac_pdata *pdata, struct sk_buff *skb, + struct fxgmac_pkt_info *pkt_info) +{ + int ret; + + if (!FXGMAC_GET_REG_BITS(pkt_info->attributes, + TX_PACKET_ATTRIBUTES_TSO_ENABLE_POS, + TX_PACKET_ATTRIBUTES_TSO_ENABLE_LEN)) + return 0; + + ret = skb_cow_head(skb, 0); + if (ret) + return ret; + + pkt_info->header_len = skb_transport_offset(skb) + tcp_hdrlen(skb); + pkt_info->tcp_header_len = tcp_hdrlen(skb); + pkt_info->tcp_payload_len = skb->len - pkt_info->header_len; + pkt_info->mss = skb_shinfo(skb)->gso_size; + + if(netif_msg_tx_done(pdata)){ + DPRINTK("header_len=%u\n", pkt_info->header_len); + DPRINTK("tcp_header_len=%u, tcp_payload_len=%u\n", + pkt_info->tcp_header_len, pkt_info->tcp_payload_len); + DPRINTK("mss=%u\n", pkt_info->mss); + } + /* Update the number of packets that will ultimately be transmitted + * along with the extra bytes for each extra packet + */ + pkt_info->tx_packets = skb_shinfo(skb)->gso_segs; + pkt_info->tx_bytes += (pkt_info->tx_packets - 1) * pkt_info->header_len; + + return 0; +} + +static int fxgmac_is_tso(struct sk_buff *skb) +{ + if (skb->ip_summed != CHECKSUM_PARTIAL) + return 0; + + if (!skb_is_gso(skb)) + return 0; + + return 1; +} + +static void fxgmac_prep_tx_pkt(struct fxgmac_pdata *pdata, + struct fxgmac_ring *ring, + struct sk_buff *skb, + struct fxgmac_pkt_info *pkt_info) +{ + skb_frag_t *frag; + unsigned int context_desc; + unsigned int len; + unsigned int i; + + pkt_info->skb = skb; + + context_desc = 0; + pkt_info->desc_count = 0; + + pkt_info->tx_packets = 1; + pkt_info->tx_bytes = skb->len; + if(netif_msg_tx_done(pdata)) + DPRINTK ("fxgmac_prep_tx_pkt callin,pkt desc cnt=%d,skb len=%d, skbheadlen=%d\n", pkt_info->desc_count, skb->len, skb_headlen(skb)); + + if (fxgmac_is_tso(skb)) { + /* TSO requires an extra descriptor if mss is different */ + if (skb_shinfo(skb)->gso_size != ring->tx.cur_mss) { + context_desc = 1; + pkt_info->desc_count++; + } + if(netif_msg_tx_done(pdata)) + DPRINTK("fxgmac_is_tso=%d, ip_summed=%d,skb gso=%d\n",((skb->ip_summed == CHECKSUM_PARTIAL) && (skb_is_gso(skb)))?1:0, skb->ip_summed, skb_is_gso(skb)?1:0); + + /* TSO requires an extra descriptor for TSO header */ + pkt_info->desc_count++; + + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + TX_PACKET_ATTRIBUTES_TSO_ENABLE_POS, + TX_PACKET_ATTRIBUTES_TSO_ENABLE_LEN, + 1); + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + TX_PACKET_ATTRIBUTES_CSUM_ENABLE_POS, + TX_PACKET_ATTRIBUTES_CSUM_ENABLE_LEN, + 1); + if(netif_msg_tx_done(pdata)) DPRINTK ("fxgmac_prep_tx_pkt,tso, pkt desc cnt=%d\n", pkt_info->desc_count); + } else if (skb->ip_summed == CHECKSUM_PARTIAL) + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + TX_PACKET_ATTRIBUTES_CSUM_ENABLE_POS, + TX_PACKET_ATTRIBUTES_CSUM_ENABLE_LEN, + 1); + + if (skb_vlan_tag_present(skb)) { + /* VLAN requires an extra descriptor if tag is different */ + if (skb_vlan_tag_get(skb) != ring->tx.cur_vlan_ctag) + /* We can share with the TSO context descriptor */ + if (!context_desc) { + context_desc = 1; + pkt_info->desc_count++; + } + + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + TX_PACKET_ATTRIBUTES_VLAN_CTAG_POS, + TX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN, + 1); + if(netif_msg_tx_done(pdata)) DPRINTK ("fxgmac_prep_tx_pkt,VLAN, pkt desc cnt=%d,vlan=0x%04x\n", pkt_info->desc_count, skb_vlan_tag_get(skb)); + } + + for (len = skb_headlen(skb); len;) { + pkt_info->desc_count++; + len -= min_t(unsigned int, len, FXGMAC_TX_MAX_BUF_SIZE); + } + + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + frag = &skb_shinfo(skb)->frags[i]; + for (len = skb_frag_size(frag); len; ) { + pkt_info->desc_count++; + len -= min_t(unsigned int, len, FXGMAC_TX_MAX_BUF_SIZE); + } + } + if(netif_msg_tx_done(pdata)) + DPRINTK ("fxgmac_prep_tx_pkt callout,pkt desc cnt=%d,skb len=%d, skbheadlen=%d,frags=%d\n", pkt_info->desc_count, skb->len, skb_headlen(skb), skb_shinfo(skb)->nr_frags); +} + +static int fxgmac_calc_rx_buf_size(struct net_device *netdev, unsigned int mtu) +{ + unsigned int rx_buf_size; + unsigned int max_mtu; + + /* On the Linux platform, the MTU size does not include the length + * of the MAC address and the length of the Type, but FXGMAC_JUMBO_PACKET_MTU include them. + */ + max_mtu = FXGMAC_JUMBO_PACKET_MTU - ETH_HLEN; + if (mtu > max_mtu) { + netdev_alert(netdev, "MTU exceeds maximum supported value\n"); + return -EINVAL; + } + + rx_buf_size = mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; + rx_buf_size = clamp_val(rx_buf_size, FXGMAC_RX_MIN_BUF_SIZE, PAGE_SIZE * 4 /* follow yonggang's suggestion */); + + rx_buf_size = (rx_buf_size + FXGMAC_RX_BUF_ALIGN - 1) & + ~(FXGMAC_RX_BUF_ALIGN - 1); + + return rx_buf_size; +} + +#ifndef FXGMAC_MISC_NOT_ENABLED +static int fxgmac_misc_poll(struct napi_struct *napi, int budget) +{ + struct fxgmac_pdata *pdata = container_of(napi, + struct fxgmac_pdata, + expansion.napi_misc); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + if (napi_complete_done(napi, 0)) + hw_ops->enable_msix_one_interrupt(pdata, MSI_ID_PHY_OTHER); +#else + napi_complete(napi); + hw_ops->enable_msix_one_interrupt(pdata, MSI_ID_PHY_OTHER); +#endif + return 0; +} + +static irqreturn_t fxgmac_misc_isr(int irq, void *data) +{ + struct fxgmac_pdata *pdata = data; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + u32 regval; + + regval = readreg(pdata->pAdapter, pdata->base_mem + MGMT_INT_CTRL0); + if (!(regval & MGMT_INT_CTRL0_INT_STATUS_MISC)) + return IRQ_HANDLED; + + hw_ops->disable_msix_one_interrupt(pdata, MSI_ID_PHY_OTHER); + hw_ops->clear_misc_int_status(pdata); + + napi_schedule_irqoff(&pdata->expansion.napi_misc); + + return IRQ_HANDLED; +} +#endif + +static irqreturn_t fxgmac_isr(int irq, void *data) +{ + unsigned int dma_ch_isr, dma_isr, mac_isr; + struct fxgmac_pdata *pdata = data; + struct fxgmac_channel *channel; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + unsigned int i; + u32 val; + + val = readreg(pdata->pAdapter, pdata->base_mem + MGMT_INT_CTRL0); + if (!(val & MGMT_INT_CTRL0_INT_STATUS_RXTX_MASK)) + return IRQ_NONE; + + dma_isr = readreg(pdata->pAdapter, pdata->mac_regs + DMA_ISR); + + for (i = 0; i < pdata->channel_count; i++) { + channel = pdata->channel_head + i; + dma_ch_isr = readl(FXGMAC_DMA_REG(channel, DMA_CH_SR)); + + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_TPS_POS, + DMA_CH_SR_TPS_LEN)) + pdata->stats.tx_process_stopped++; + + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_RPS_POS, + DMA_CH_SR_RPS_LEN)) + pdata->stats.rx_process_stopped++; + + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_TBU_POS, + DMA_CH_SR_TBU_LEN)) + pdata->stats.tx_buffer_unavailable++; + + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_RBU_POS, + DMA_CH_SR_RBU_LEN)) + pdata->stats.rx_buffer_unavailable++; + + /* Restart the device on a Fatal Bus Error */ + if (FXGMAC_GET_REG_BITS(dma_ch_isr, DMA_CH_SR_FBE_POS, + DMA_CH_SR_FBE_LEN)) { + pdata->stats.fatal_bus_error++; + schedule_work(&pdata->expansion.restart_work); + } + /* Clear all interrupt signals */ + writel(dma_ch_isr, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + } + + if (FXGMAC_GET_REG_BITS(dma_isr, DMA_ISR_MACIS_POS, + DMA_ISR_MACIS_LEN)) { + mac_isr = readl(pdata->mac_regs + MAC_ISR); +#ifndef FXGMAC_MISC_NOT_ENABLED + if (FXGMAC_GET_REG_BITS(mac_isr, MAC_ISR_MMCTXIS_POS, + MAC_ISR_MMCTXIS_LEN)) + hw_ops->tx_mmc_int(pdata); + + if (FXGMAC_GET_REG_BITS(mac_isr, MAC_ISR_MMCRXIS_POS, + MAC_ISR_MMCRXIS_LEN)) + hw_ops->rx_mmc_int(pdata); +#endif + /* Clear all interrupt signals */ + writel(mac_isr, (pdata->mac_regs + MAC_ISR)); + } + + hw_ops->disable_mgm_interrupt(pdata); + pdata->stats.mgmt_int_isr++; + + if (napi_schedule_prep(&pdata->expansion.napi)) { + pdata->stats.napi_poll_isr++; + /* Turn on polling */ + __napi_schedule_irqoff(&pdata->expansion.napi); + } + + return IRQ_HANDLED; + +} + +static irqreturn_t fxgmac_dma_isr(int irq, void *data) +{ + struct fxgmac_channel *channel = data; + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + u32 regval; + int message_id; + + if (irq == channel->expansion.dma_irq_tx) { + message_id = MSI_ID_TXQ0; + hw_ops->disable_msix_one_interrupt(pdata, message_id); + regval = 0; + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_SR_TI_POS, DMA_CH_SR_TI_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + napi_schedule_irqoff(&channel->expansion.napi_tx); + } else { + message_id = channel->queue_index; + hw_ops->disable_msix_one_interrupt(pdata, message_id); + regval = 0; + regval = readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + regval = FXGMAC_SET_REG_BITS(regval, DMA_CH_SR_RI_POS, DMA_CH_SR_RI_LEN, 1); + writereg(pdata->pAdapter, regval, FXGMAC_DMA_REG(channel, DMA_CH_SR)); + napi_schedule_irqoff(&channel->expansion.napi_rx); + } + + return IRQ_HANDLED; +} + + +#if FXGMAC_TX_HANG_TIMER_ENABLED +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) +static void fxgmac_tx_hang_timer_handler(struct timer_list *t) +#else +static void fxgmac_tx_hang_timer_handler(unsigned long data) +#endif +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) + struct fxgmac_channel *channel = from_timer(channel, t, expansion.tx_hang_timer); +#else + struct fxgmac_channel *channel = (struct fxgmac_channel *)data; +#endif + +#if FXGMAC_TX_HANG_CHECH_DIRTY + struct fxgmac_ring *ring = channel->tx_ring; +#endif + struct fxgmac_pdata *pdata = channel->pdata; + struct net_device *netdev = pdata->netdev; + unsigned int hw_reg_cur; + unsigned int regval; + +#if FXGMAC_TX_HANG_CHECH_DIRTY + hw_reg_cur = ring->dirty; +#else + hw_reg_cur = readl(FXGMAC_DMA_REG(channel, 0x44/* tx desc curr pointer reg */)); +#endif + if(hw_reg_cur == channel->expansion.tx_hang_hw_cur) { + + /* hw current desc still stucked */ + if(!pdata->tx_hang_restart_queuing) { + pdata->tx_hang_restart_queuing = 1; + DPRINTK("tx_hang_timer_handler: restart scheduled, at desc %u, queuing=%u.\n", channel->expansion.tx_hang_hw_cur, pdata->tx_hang_restart_queuing); + + netif_tx_stop_all_queues(netdev); + + /* Disable MAC Rx */ + regval = readl(pdata->mac_regs + MAC_CR); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_CST_POS, + MAC_CR_CST_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_ACS_POS, + MAC_CR_ACS_LEN, 0); + regval = FXGMAC_SET_REG_BITS(regval, MAC_CR_RE_POS, + MAC_CR_RE_LEN, 0); + writel(regval, pdata->mac_regs + MAC_CR); + + schedule_work(&pdata->expansion.restart_work); + } + } + + channel->expansion.tx_hang_timer_active = 0; +} + +static void fxgmac_tx_hang_timer_start(struct fxgmac_channel *channel) +{ + struct fxgmac_pdata *pdata = channel->pdata; + + /* Start the Tx hang timer */ + if (1 && !channel->expansion.tx_hang_timer_active) { + channel->expansion.tx_hang_timer_active = 1; + + /* FXGMAC_INIT_DMA_TX_USECS is desc3 polling period, we give 2 more checking period */ + mod_timer(&channel->expansion.tx_hang_timer, + jiffies + usecs_to_jiffies(FXGMAC_INIT_DMA_TX_USECS * 10)); + } +} +#endif + +#if 0 +static void fxgmac_init_timers(struct fxgmac_pdata *pdata) +{ + struct fxgmac_channel *channel; + unsigned int i; + + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) + break; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) + timer_setup(&channel->tx_timer, fxgmac_tx_timer, 0); +#else + setup_timer(&channel->tx_timer, fxgmac_tx_timer, (unsigned long)channel); +#endif +#if FXGMAC_TX_HANG_TIMER_ENABLED + channel->tx_hang_timer_active = 0; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) + timer_setup(&channel->tx_hang_timer, fxgmac_tx_hang_timer_handler, 0); +#else + setup_timer(&channel->tx_hang_timer, fxgmac_tx_hang_timer_handler, (unsigned long)channel); +#endif +#endif + } +} + +static void fxgmac_stop_timers(struct fxgmac_pdata *pdata) +{ + struct fxgmac_channel *channel; + unsigned int i; + + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) + break; + + del_timer_sync(&channel->tx_timer); +#if FXGMAC_TX_HANG_TIMER_ENABLED + del_timer_sync(&channel->tx_hang_timer); + channel->tx_hang_timer_active = 0; +#endif + } + } +} +#endif + +static void fxgmac_napi_enable(struct fxgmac_pdata *pdata, unsigned int add) +{ + struct fxgmac_channel *channel; + unsigned int i; + u32 tx_napi = 0, rx_napi = 0; + +#ifndef FXGMAC_MISC_NOT_ENABLED + u32 misc_napi = 0; + + misc_napi = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_NAPI_FREE_POS, + FXGMAC_FLAG_MISC_NAPI_FREE_LEN); +#endif + tx_napi = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_NAPI_FREE_POS, + FXGMAC_FLAG_TX_NAPI_FREE_LEN); + rx_napi = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_NAPI_FREE_POS, + FXGMAC_FLAG_RX_NAPI_FREE_LEN); + + if (pdata->per_channel_irq) { + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!FXGMAC_GET_REG_BITS(rx_napi, + i, FXGMAC_FLAG_PER_CHAN_RX_NAPI_FREE_LEN)) { + if (add) { +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) ||\ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,2) ) + netif_napi_add_weight(pdata->netdev, &channel->expansion.napi_rx, + fxgmac_one_poll_rx, NAPI_POLL_WEIGHT); +#else + netif_napi_add(pdata->netdev, &channel->expansion.napi_rx, + fxgmac_one_poll_rx, NAPI_POLL_WEIGHT); +#endif + } + napi_enable(&channel->expansion.napi_rx); + pdata->expansion.int_flags = + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_NAPI_FREE_POS + i, + FXGMAC_FLAG_PER_CHAN_RX_NAPI_FREE_LEN, + FXGMAC_NAPI_ENABLE); + } + + if (FXGMAC_IS_CHANNEL_WITH_TX_IRQ(i) && !tx_napi) { +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) ||\ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,2) ) + netif_napi_add_weight(pdata->netdev, &channel->expansion.napi_tx, + fxgmac_one_poll_tx, NAPI_POLL_WEIGHT); +#else + netif_napi_add(pdata->netdev, &channel->expansion.napi_tx, + fxgmac_one_poll_tx, NAPI_POLL_WEIGHT); +#endif + napi_enable(&channel->expansion.napi_tx); + pdata->expansion.int_flags = + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_NAPI_FREE_POS, + FXGMAC_FLAG_TX_NAPI_FREE_LEN, + FXGMAC_NAPI_ENABLE); + } + if(netif_msg_drv(pdata)) DPRINTK("napi_enable, msix ch%d napi enabled done,add=%d\n", i, add); + } + +#ifndef FXGMAC_MISC_NOT_ENABLED + /* for misc */ + if (!misc_napi) { +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) ||\ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,2) ) + netif_napi_add_weight(pdata->netdev, &pdata->expansion.napi_misc, + fxgmac_misc_poll, NAPI_POLL_WEIGHT); +#else + netif_napi_add(pdata->netdev, &pdata->expansion.napi_misc, + fxgmac_misc_poll, NAPI_POLL_WEIGHT); +#endif + napi_enable(&pdata->expansion.napi_misc); + pdata->expansion.int_flags = + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_NAPI_FREE_POS, + FXGMAC_FLAG_MISC_NAPI_FREE_LEN, + FXGMAC_NAPI_ENABLE); + } +#endif + } else { + i = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_NAPI_FREE_POS, + FXGMAC_FLAG_LEGACY_NAPI_FREE_LEN); + if (!i) { + if (add) { +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) ||\ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,2) ) + netif_napi_add_weight(pdata->netdev, &pdata->expansion.napi, + fxgmac_all_poll, NAPI_POLL_WEIGHT); +#else + netif_napi_add(pdata->netdev, &pdata->expansion.napi, + fxgmac_all_poll, NAPI_POLL_WEIGHT); +#endif + } + + napi_enable(&pdata->expansion.napi); + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_NAPI_FREE_POS, + FXGMAC_FLAG_LEGACY_NAPI_FREE_LEN, + FXGMAC_NAPI_ENABLE); + } + } +} + +static void fxgmac_napi_disable(struct fxgmac_pdata *pdata, unsigned int del) +{ + struct fxgmac_channel *channel; + unsigned int i; + u32 tx_napi = 0, rx_napi = 0; +#ifndef FXGMAC_MISC_NOT_ENABLED + u32 misc_napi = 0; +#endif + + if (pdata->per_channel_irq) { +#ifndef FXGMAC_MISC_NOT_ENABLED + misc_napi = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_NAPI_FREE_POS, + FXGMAC_FLAG_MISC_NAPI_FREE_LEN); +#endif + tx_napi = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_NAPI_FREE_POS, + FXGMAC_FLAG_TX_NAPI_FREE_LEN); + rx_napi = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_NAPI_FREE_POS, + FXGMAC_FLAG_RX_NAPI_FREE_LEN); + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (FXGMAC_GET_REG_BITS(rx_napi, + i, FXGMAC_FLAG_PER_CHAN_RX_NAPI_FREE_LEN)) { + napi_disable(&channel->expansion.napi_rx); + + if (del) { + netif_napi_del(&channel->expansion.napi_rx); + } + pdata->expansion.int_flags = + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_NAPI_FREE_POS + i, + FXGMAC_FLAG_PER_CHAN_RX_NAPI_FREE_LEN, + FXGMAC_NAPI_DISABLE); + } + + if (FXGMAC_IS_CHANNEL_WITH_TX_IRQ(i) && tx_napi) { + napi_disable(&channel->expansion.napi_tx); + netif_napi_del(&channel->expansion.napi_tx); + pdata->expansion.int_flags = + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_NAPI_FREE_POS, + FXGMAC_FLAG_TX_NAPI_FREE_LEN, + FXGMAC_NAPI_DISABLE); + } + if(netif_msg_drv(pdata)) DPRINTK("napi_disable, msix ch%d napi disabled done,del=%d\n", i, del); + } + +#ifndef FXGMAC_MISC_NOT_ENABLED + if (misc_napi) { + napi_disable(&pdata->expansion.napi_misc); + netif_napi_del(&pdata->expansion.napi_misc); + pdata->expansion.int_flags = + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_NAPI_FREE_POS, + FXGMAC_FLAG_MISC_NAPI_FREE_LEN, + FXGMAC_NAPI_DISABLE); + } +#endif + } + } else { + i = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_NAPI_FREE_POS, + FXGMAC_FLAG_LEGACY_NAPI_FREE_LEN); + if (i) { + napi_disable(&pdata->expansion.napi); + + if (del) + netif_napi_del(&pdata->expansion.napi); + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_NAPI_FREE_POS, + FXGMAC_FLAG_LEGACY_NAPI_FREE_LEN, + FXGMAC_NAPI_DISABLE); + + } + } +} + +static int fxgmac_request_irqs(struct fxgmac_pdata *pdata) +{ + struct net_device *netdev = pdata->netdev; + struct fxgmac_channel *channel; + unsigned int i; + int ret; + u32 msi, msix, need_free; + u32 tx = 0, rx = 0; +#ifndef FXGMAC_MISC_NOT_ENABLED + u32 misc = 0; +#endif + + msi = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MSI_POS, + FXGMAC_FLAG_MSI_LEN); + + msix = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MSIX_POS, + FXGMAC_FLAG_MSIX_LEN); + + need_free = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_IRQ_FREE_POS, + FXGMAC_FLAG_LEGACY_IRQ_FREE_LEN); + + if(!msix) { + if (!need_free) { + ret = devm_request_irq(pdata->dev, pdata->dev_irq, fxgmac_isr, + msi ? 0 : IRQF_SHARED, + netdev->name, pdata); + if (ret) { + netdev_alert(netdev, "error requesting irq %d, ret = %d\n", pdata->dev_irq, ret); + return ret; + } + + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_IRQ_FREE_POS, + FXGMAC_FLAG_LEGACY_IRQ_FREE_LEN, + FXGMAC_IRQ_ENABLE); + } + } + + if (!pdata->per_channel_irq) { + return 0; + } + + tx = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_IRQ_FREE_POS, + FXGMAC_FLAG_TX_IRQ_FREE_LEN); + rx = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_IRQ_FREE_POS, + FXGMAC_FLAG_RX_IRQ_FREE_LEN); + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) { + snprintf(channel->expansion.dma_irq_name, + sizeof(channel->expansion.dma_irq_name) - 1, + "%s-ch%d-Rx-%u", netdev_name(netdev), i, + channel->queue_index); + if(FXGMAC_IS_CHANNEL_WITH_TX_IRQ(i) && !tx) { + snprintf(channel->expansion.dma_irq_name_tx, + sizeof(channel->expansion.dma_irq_name_tx) - 1, + "%s-ch%d-Tx-%u", netdev_name(netdev), i, + channel->queue_index); + + ret = devm_request_irq(pdata->dev, channel->expansion.dma_irq_tx, + fxgmac_dma_isr, 0, + channel->expansion.dma_irq_name_tx, channel); + + if (ret) { + netdev_alert(netdev, "fxgmac_req_irqs, err with MSIx irq \ + request for ch %d tx, ret=%d\n", i, ret); + goto err_irq; + } + + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_IRQ_FREE_POS, + FXGMAC_FLAG_TX_IRQ_FREE_LEN, + FXGMAC_IRQ_ENABLE); + + if(netif_msg_drv(pdata)) + DPRINTK("fxgmac_req_irqs, MSIx irq_tx request ok, ch=%d, irq=%d,%s\n", + i, channel->expansion.dma_irq_tx, + channel->expansion.dma_irq_name_tx); + } + + if (!FXGMAC_GET_REG_BITS(rx, i, FXGMAC_FLAG_PER_CHAN_RX_IRQ_FREE_LEN)) { + ret = devm_request_irq(pdata->dev, channel->dma_irq, + fxgmac_dma_isr, 0, + channel->expansion.dma_irq_name, channel); + if (ret) { + netdev_alert(netdev, "error requesting irq %d\n", + channel->dma_irq); + goto err_irq; + } + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_IRQ_FREE_POS + i, + FXGMAC_FLAG_PER_CHAN_RX_IRQ_FREE_LEN, + FXGMAC_IRQ_ENABLE); + } + } + +#ifndef FXGMAC_MISC_NOT_ENABLED + misc = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_IRQ_FREE_POS, + FXGMAC_FLAG_MISC_IRQ_FREE_LEN); + if (!misc) { + snprintf(pdata->expansion.misc_irq_name, + sizeof(pdata->expansion.misc_irq_name) - 1, + "%s-misc", netdev_name(netdev)); + ret = devm_request_irq(pdata->dev, + pdata->expansion.misc_irq, + fxgmac_misc_isr, + 0, + pdata->expansion.misc_irq_name, + pdata); + if (ret) { + netdev_alert(netdev, + "error requesting misc irq %d, ret = %d\n", + pdata->expansion.misc_irq, + ret); + goto err_irq; + } + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_IRQ_FREE_POS, + FXGMAC_FLAG_MISC_IRQ_FREE_LEN, + FXGMAC_IRQ_ENABLE); + } +#endif + if(netif_msg_drv(pdata)) + DPRINTK("fxgmac_req_irqs, MSIx irq request ok, total=%d,%d~%d\n", + i, (pdata->channel_head)[0].dma_irq,(pdata->channel_head)[i-1].dma_irq); + return 0; + +err_irq: + netdev_alert(netdev, "fxgmac_req_irqs, err with MSIx irq request at %d, \ + ret=%d\n", i, ret); + + if (pdata->per_channel_irq) { + for (i--, channel--; i < pdata->channel_count; i--, channel--) { + if(FXGMAC_IS_CHANNEL_WITH_TX_IRQ(i) && tx) { + pdata->expansion.int_flags= + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_IRQ_FREE_POS, + FXGMAC_FLAG_TX_IRQ_FREE_LEN, + FXGMAC_IRQ_DISABLE); + devm_free_irq(pdata->dev, channel->expansion.dma_irq_tx, channel); + } + + if (FXGMAC_GET_REG_BITS(rx, i, FXGMAC_FLAG_PER_CHAN_RX_IRQ_FREE_LEN)) { + pdata->expansion.int_flags= + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_IRQ_FREE_POS + i, + FXGMAC_FLAG_PER_CHAN_RX_IRQ_FREE_LEN, + FXGMAC_IRQ_DISABLE); + devm_free_irq(pdata->dev, channel->dma_irq, channel); + } + } + +#ifndef FXGMAC_MISC_NOT_ENABLED + if (misc) { + pdata->expansion.int_flags= + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_IRQ_FREE_POS, + FXGMAC_FLAG_MISC_IRQ_FREE_LEN, + FXGMAC_IRQ_DISABLE); + devm_free_irq(pdata->dev, pdata->expansion.misc_irq, pdata); + } +#endif + } + return ret; +} + +static void fxgmac_free_irqs(struct fxgmac_pdata *pdata) +{ + struct fxgmac_channel *channel; + unsigned int i = 0; + u32 need_free, msix; + u32 tx = 0, rx = 0; +#ifndef FXGMAC_MISC_NOT_ENABLED + u32 misc = 0; +#endif + + msix = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MSIX_POS, + FXGMAC_FLAG_MSIX_LEN); + + need_free = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_IRQ_FREE_POS, + FXGMAC_FLAG_LEGACY_IRQ_FREE_LEN); + + if(!msix) { + if (need_free) { + devm_free_irq(pdata->dev, pdata->dev_irq, pdata); + pdata->expansion.int_flags = FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_IRQ_FREE_POS, + FXGMAC_FLAG_LEGACY_IRQ_FREE_LEN, + FXGMAC_IRQ_DISABLE); + } + } + + if (!pdata->per_channel_irq) + return; + +#ifndef FXGMAC_MISC_NOT_ENABLED + misc = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_IRQ_FREE_POS, + FXGMAC_FLAG_MISC_IRQ_FREE_LEN); +#endif + tx = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_IRQ_FREE_POS, + FXGMAC_FLAG_TX_IRQ_FREE_LEN); + rx = FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_IRQ_FREE_POS, + FXGMAC_FLAG_RX_IRQ_FREE_LEN); + + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + if(FXGMAC_IS_CHANNEL_WITH_TX_IRQ(i) && tx) { + pdata->expansion.int_flags= + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_TX_IRQ_FREE_POS, + FXGMAC_FLAG_TX_IRQ_FREE_LEN, + FXGMAC_IRQ_DISABLE); + devm_free_irq(pdata->dev, channel->expansion.dma_irq_tx, channel); + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_free_irqs, MSIx irq_tx clear done, ch=%d\n", i); + } + + if (FXGMAC_GET_REG_BITS(rx, i, FXGMAC_FLAG_PER_CHAN_RX_IRQ_FREE_LEN)) { + pdata->expansion.int_flags= + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_RX_IRQ_FREE_POS + i, + FXGMAC_FLAG_PER_CHAN_RX_IRQ_FREE_LEN, + FXGMAC_IRQ_DISABLE); + devm_free_irq(pdata->dev, channel->dma_irq, channel); + } + } + +#ifndef FXGMAC_MISC_NOT_ENABLED + if (misc) { + pdata->expansion.int_flags= + FXGMAC_SET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_MISC_IRQ_FREE_POS, + FXGMAC_FLAG_MISC_IRQ_FREE_LEN, + FXGMAC_IRQ_DISABLE); + devm_free_irq(pdata->dev, pdata->expansion.misc_irq, pdata); + } +#endif + } + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_free_irqs, MSIx rx irq clear done, total=%d\n", i); +} + +void fxgmac_free_tx_data(struct fxgmac_pdata *pdata) +{ + struct fxgmac_desc_ops *desc_ops = &pdata->desc_ops; + struct fxgmac_desc_data *desc_data; + struct fxgmac_channel *channel; + struct fxgmac_ring *ring; + unsigned int i, j; + + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + ring = channel->tx_ring; + if (!ring) + break; + + for (j = 0; j < ring->dma_desc_count; j++) { + desc_data = FXGMAC_GET_DESC_DATA(ring, j); + desc_ops->unmap_desc_data(pdata, desc_data); + } + } + } +} + +void fxgmac_free_rx_data(struct fxgmac_pdata *pdata) +{ + struct fxgmac_desc_ops *desc_ops = &pdata->desc_ops; + struct fxgmac_desc_data *desc_data; + struct fxgmac_channel *channel; + struct fxgmac_ring *ring; + unsigned int i, j; + + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + ring = channel->rx_ring; + if (!ring) + break; + + for (j = 0; j < ring->dma_desc_count; j++) { + desc_data = FXGMAC_GET_DESC_DATA(ring, j); + desc_ops->unmap_desc_data(pdata, desc_data); + } + } + } +} + +/* + * since kernel does not clear the MSI mask bits and + * this function clear MSI mask bits when MSI is enabled. + */ +static int fxgmac_disable_pci_msi_config(struct pci_dev *pdev) +{ + u16 pcie_cap_offset = 0; + u32 pcie_msi_mask_bits = 0; + int ret = 0; + + pcie_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_MSI); + if (pcie_cap_offset) { + ret = pci_read_config_dword(pdev, pcie_cap_offset, &pcie_msi_mask_bits); + if (ret) { + DPRINTK(KERN_ERR "read pci config space MSI cap. failed, %d\n", ret); + ret = -EFAULT; + } + } + + pcie_msi_mask_bits = FXGMAC_SET_REG_BITS(pcie_msi_mask_bits, + PCI_CAP_ID_MSI_ENABLE_POS, + PCI_CAP_ID_MSI_ENABLE_LEN, + 0); + ret = pci_write_config_dword(pdev, pcie_cap_offset, pcie_msi_mask_bits); + if (ret) { + DPRINTK(KERN_ERR "write pci config space MSI mask failed, %d\n", ret); + ret = -EFAULT; + } + + return ret; +} + +static int fxgmac_disable_pci_msix_config(struct pci_dev *pdev) +{ + u16 pcie_cap_offset = 0; + u32 pcie_msi_mask_bits = 0; + int ret = 0; + + pcie_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_MSIX); + if (pcie_cap_offset) { + ret = pci_read_config_dword(pdev, pcie_cap_offset, &pcie_msi_mask_bits); + if (ret) { + DPRINTK(KERN_ERR "read pci config space MSIX cap. failed, %d\n", ret); + ret = -EFAULT; + } + } + + pcie_msi_mask_bits = FXGMAC_SET_REG_BITS(pcie_msi_mask_bits, + PCI_CAP_ID_MSIX_ENABLE_POS, + PCI_CAP_ID_MSIX_ENABLE_LEN, + 0); + ret = pci_write_config_dword(pdev, pcie_cap_offset, pcie_msi_mask_bits); + if (ret) { + DPRINTK(KERN_ERR "write pci config space MSIX mask failed, %d\n", ret); + ret = -EFAULT; + } + + return ret; +} + +int fxgmac_start(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + unsigned int pcie_low_power = PCIE_LP_ASPM_LTR; + u8 deviceid; + int ret; + + if(netif_msg_drv(pdata)) DPRINTK("fxgmac start callin here.\n"); + + if (pdata->expansion.dev_state != FXGMAC_DEV_OPEN && + pdata->expansion.dev_state != FXGMAC_DEV_STOP && + pdata->expansion.dev_state != FXGMAC_DEV_RESUME) + return 0; + + /* must reset software again here, to avoid flushing tx queue error + * caused by the system only run probe + * when installing driver on the arm platform. + */ + hw_ops->exit(pdata); + + if (FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, + FXGMAC_FLAG_LEGACY_POS, + FXGMAC_FLAG_LEGACY_LEN)) { + /* + * we should disable msi and msix here when we use legacy interrupt,for two reasons: + * 1. Exit will restore msi and msix config regisiter, that may enable them. + * 2. When the driver that uses the msix interrupt by default is compiled + * into the OS, uninstall the driver through rmmod, and then install the + * driver that uses the legacy interrupt, at which time the msix enable + * will be turned on again by default after waking up from S4 on some platform. + * such as UOS platform. + */ + ret = fxgmac_disable_pci_msi_config(pdata->pdev); + ret |= fxgmac_disable_pci_msix_config(pdata->pdev); + if (ret) + return ret; + } + + hw_ops->reset_phy(pdata); + hw_ops->release_phy(pdata); + cfg_r8(pdata, REG_PCI_REVID, &deviceid); + hw_ops->pcie_init(pdata, + pcie_low_power & PCIE_LP_ASPM_LTR, + pcie_low_power & PCIE_LP_ASPM_L1SS, + (FXGMAC_REV_03 == deviceid) ? true : (pcie_low_power & PCIE_LP_ASPM_L1), + pcie_low_power & PCIE_LP_ASPM_L0S); +#ifdef FXGMAC_ASPM_ENABLED + if (pdata->expansion.aspm_work_active || pdata->expansion.aspm_en) { + printk("cancle aspm work.\n"); + fxgmac_cancel_aspm_config_work(pdata); + pdata->expansion.aspm_en = false; + pdata->expansion.aspm_work_active = false; + } +#endif + hw_ops->config_power_up(pdata); + hw_ops->dismiss_all_int(pdata); + + ret = hw_ops->init(pdata); + if (ret) { + DPRINTK("fxgmac hw init error.\n"); + return ret; + } + fxgmac_napi_enable(pdata, 1); + + ret = fxgmac_request_irqs(pdata); + if (ret) + goto err_napi; + + hw_ops->enable_mgm_interrupt(pdata); +#if FXGMAC_INT_MODERATION_ENABLED + hw_ops->set_interrupt_moderation(pdata); +#endif + + if (pdata->per_channel_irq) + hw_ops->enable_msix_rxtxinterrupt(pdata); + +#ifdef FXGMAC_ESD_CHECK_ENABLED + fxgmac_schedule_esd_work(pdata); +#endif + +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED + pdata->expansion.lb_cable_flag = 0; + fxgmac_schedule_loopback_work(pdata); +#endif + + if (pdata->expansion.recover_phy_state) + fxgmac_set_phy_link_ksettings(pdata); + + hw_ops->led_under_active(pdata); + pdata->expansion.dev_state = FXGMAC_DEV_START; + + if (!pdata->expansion.recover_from_aspm) { +#ifdef FXGMAC_ASPM_ENABLED + printk("start aspm work and phy timer.\n"); + fxgmac_schedule_aspm_config_work(pdata); + pdata->expansion.aspm_work_active = true; +#endif + fxgmac_phy_timer_init(pdata); + } + pdata->expansion.recover_from_aspm = false; + + return 0; + +err_napi: + if (!pdata->expansion.recover_from_aspm) + fxgmac_phy_timer_destroy(pdata); + + fxgmac_napi_disable(pdata, 1); + hw_ops->exit(pdata); + dev_err(pdata->dev, "fxgmac start callout with irq err.\n"); + return ret; +} + +void fxgmac_stop(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + struct net_device *netdev = pdata->netdev; + struct fxgmac_channel *channel; + struct netdev_queue *txq; + unsigned int i; + + if (pdata->expansion.dev_state != FXGMAC_DEV_START) + return; + + pdata->expansion.dev_state = FXGMAC_DEV_STOP; + netif_carrier_off(netdev); + netif_tx_stop_all_queues(netdev); + + if (!pdata->expansion.recover_from_aspm) + fxgmac_phy_timer_destroy(pdata); + +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED + fxgmac_cancel_loopback_work(pdata); +#endif + +#ifdef FXGMAC_ESD_CHECK_ENABLED + fxgmac_cancel_esd_work(pdata); +#endif + + hw_ops->disable_tx(pdata); + hw_ops->disable_rx(pdata); + + if (pdata->per_channel_irq) { + hw_ops->disable_msix_interrupt(pdata); + } + else { + hw_ops->disable_mgm_interrupt(pdata); + } + + fxgmac_free_irqs(pdata); + fxgmac_napi_disable(pdata, 1); + + channel = pdata->channel_head; + if (channel != NULL) { + for (i = 0; i < pdata->channel_count; i++, channel++) { + if (!channel->tx_ring) + continue; + + txq = netdev_get_tx_queue(netdev, channel->queue_index); + netdev_tx_reset_queue(txq); + } + } +} + +void fxgmac_restart_dev(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int ret; + + /* If not running, "restart" will happen on open */ + if (!netif_running(pdata->netdev) && + pdata->expansion.dev_state != FXGMAC_DEV_START) + return; + + fxgmac_lock(pdata); + fxgmac_stop(pdata); + hw_ops->led_under_shutdown(pdata); + + fxgmac_free_tx_data(pdata); + fxgmac_free_rx_data(pdata); + + ret = fxgmac_start(pdata); + if (ret) { + DPRINTK("fxgmac_restart_dev: fxgmac_start failed.\n"); + } + + fxgmac_unlock(pdata); +} + +static void fxgmac_restart(struct work_struct *work) +{ + struct fxgmac_pdata *pdata = container_of(work, + struct fxgmac_pdata, + expansion.restart_work); + + rtnl_lock(); + + fxgmac_restart_dev(pdata); + + rtnl_unlock(); +} + +void fxgmac_net_powerup(struct fxgmac_pdata *pdata) +{ + int ret; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_net_powerup callin\n"); + + /* signal that we are up now */ + pdata->expansion.powerstate = 0; //clear all bits as normal now + if (__test_and_set_bit(FXGMAC_POWER_STATE_UP, &pdata->expansion.powerstate)) { + return; /* do nothing if already up */ + } + + ret = fxgmac_start(pdata); + if (ret) { + DPRINTK("fxgmac_net_powerup: fxgmac_start error\n"); + return; + } + + // must call it after fxgmac_start,because it will be enable in fxgmac_start + hw_ops->disable_arp_offload(pdata); + + if(netif_msg_drv(pdata)) { + DPRINTK("fxgmac_net_powerup callout, powerstate=%ld.\n", pdata->expansion.powerstate); + } +} + +void fxgmac_net_powerdown(struct fxgmac_pdata *pdata, unsigned int wol) +{ + struct net_device *netdev = pdata->netdev; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + u32 val; + + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_net_powerdown callin here.\n"); + + /* signal that we are down to the interrupt handler */ + if (__test_and_set_bit(FXGMAC_POWER_STATE_DOWN, &pdata->expansion.powerstate)) + return; /* do nothing if already down */ + + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_net_powerdown continue with down process.\n"); + /* phy polling timer should detect the state of fxgmac and stop link status polling accordingly */ + + __clear_bit(FXGMAC_POWER_STATE_UP, &pdata->expansion.powerstate); + + /* Shut off incoming Tx traffic */ + netif_tx_stop_all_queues(netdev); + + /* call carrier off first to avoid false dev_watchdog timeouts */ + netif_carrier_off(netdev); + netif_tx_disable(netdev); + + /* Disable Rx */ + hw_ops->disable_rx(pdata); + + /* synchronize_rcu() needed for pending XDP buffers to drain */ + //if (adapter->xdp_ring[0]) 20210709 + synchronize_rcu(); + + fxgmac_stop(pdata); //some works are redundent in this call + +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED + val = pdata->expansion.lb_cable_flag; +#else + val = 0; +#endif + // must call it after software reset + hw_ops->pre_power_down(pdata, val); + + if(!test_bit(FXGMAC_POWER_STATE_DOWN, &pdata->expansion.powerstate)) { + netdev_err(pdata->netdev, + "fxgmac powerstate is %lu when config power to down.\n", pdata->expansion.powerstate); + } + + /* set mac to lowpower mode and enable wol accordingly */ + hw_ops->config_power_down(pdata, wol); + +#if 1 + //handle vfs if it is envolved + + //similar work as in restart() for that, we do need a resume laterly + fxgmac_free_tx_data(pdata); + fxgmac_free_rx_data(pdata); +#endif + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_net_powerdown callout, powerstate=%ld.\n", pdata->expansion.powerstate); +} + +static int fxgmac_open(struct net_device *netdev) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_desc_ops *desc_ops; + int ret; + + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_open callin\n"); + + fxgmac_lock(pdata); + pdata->expansion.dev_state = FXGMAC_DEV_OPEN; + desc_ops = &pdata->desc_ops; + + /* Calculate the Rx buffer size before allocating rings */ + //DPRINTK("fxgmac_open, b4 calc rx buf size, mtu,min,max=%d,%d,%d.\n", netdev->mtu, netdev->min_mtu, netdev->max_mtu); + ret = fxgmac_calc_rx_buf_size(netdev, netdev->mtu); + if (ret < 0) + goto unlock; + pdata->rx_buf_size = ret; + + /* Allocate the channels and rings */ + ret = desc_ops->alloc_channels_and_rings(pdata); + if (ret) + goto unlock; + + INIT_WORK(&pdata->expansion.restart_work, fxgmac_restart); + +#ifdef FXGMAC_ESD_CHECK_ENABLED + INIT_DELAYED_WORK(&pdata->expansion.esd_work, fxgmac_esd_work); +#endif + +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED + INIT_DELAYED_WORK(&pdata->expansion.loopback_work, fxgmac_loopback_work); +#endif + +#ifdef FXGMAC_ASPM_ENABLED + INIT_DELAYED_WORK(&pdata->expansion.aspm_config_work, fxgmac_aspm_config_work); +#endif + + ret = fxgmac_start(pdata); + if (ret) + goto err_channels_and_rings; + + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_open callout\n"); + + fxgmac_unlock(pdata); + + return 0; + +err_channels_and_rings: + desc_ops->free_channels_and_rings(pdata); + DPRINTK("fxgmac_open callout with channel alloc err\n"); +unlock: + fxgmac_unlock(pdata); + return ret; +} + +static int fxgmac_close(struct net_device *netdev) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_desc_ops *desc_ops = &pdata->desc_ops; + + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_close callin\n"); + + fxgmac_lock(pdata); + /* Stop the device */ + fxgmac_stop(pdata); + pdata->expansion.dev_state = FXGMAC_DEV_CLOSE; + + /* Free the channels and rings */ + desc_ops->free_channels_and_rings(pdata); + pdata->hw_ops.reset_phy(pdata); + fxgmac_phy_update_link(netdev); + +#ifdef FXGMAC_ASPM_ENABLED + fxgmac_cancel_aspm_config_work(pdata); + pdata->expansion.aspm_work_active = false; + pdata->expansion.recover_from_aspm = false; + pdata->expansion.aspm_en = false; + pdata->hw_ops.pcie_init(pdata, true, true, true, false); +#endif + + if(netif_msg_drv(pdata)) DPRINTK("fxgmac_close callout\n"); + + fxgmac_unlock(pdata); + return 0; +} + + +static void fxgmac_dump_state(struct fxgmac_pdata *pdata) +{ + struct fxgmac_channel *channel = pdata->channel_head; + struct fxgmac_stats *pstats = &pdata->stats; + struct fxgmac_ring *ring; + u32 i; + + ring = &channel->tx_ring[0]; + DPRINTK( "Tx descriptor info:\n"); + DPRINTK( "Tx cur = 0x%x\n", ring->cur); + DPRINTK( "Tx dirty = 0x%x\n", ring->dirty); + DPRINTK( "Tx dma_desc_head = %pad\n", &ring->dma_desc_head); + DPRINTK( "Tx desc_data_head = %pad\n", &ring->desc_data_head); + + for (i = 0; i < pdata->channel_count; i++, channel++) { + ring = &channel->rx_ring[0]; + DPRINTK( "Rx[%d] descriptor info:\n", i); + DPRINTK( "Rx cur = 0x%x\n", ring->cur); + DPRINTK( "Rx dirty = 0x%x\n", ring->dirty); + DPRINTK( "Rx dma_desc_head = %pad\n", + &ring->dma_desc_head); + DPRINTK( "Rx desc_data_head = %pad\n", + &ring->desc_data_head); + } + + DPRINTK( "Device Registers:\n"); + DPRINTK( "MAC_ISR = %08x\n", readreg(pdata->pAdapter, pdata->mac_regs + MAC_ISR)); + DPRINTK( "MAC_IER = %08x\n", readreg(pdata->pAdapter, pdata->mac_regs + MAC_IER)); + DPRINTK( "MMC_RISR = %08x\n", readreg(pdata->pAdapter, pdata->mac_regs + MMC_RISR)); + DPRINTK( "MMC_RIER = %08x\n", readreg(pdata->pAdapter, pdata->mac_regs + MMC_RIER)); + DPRINTK( "MMC_TISR = %08x\n", readreg(pdata->pAdapter, pdata->mac_regs + MMC_TISR)); + DPRINTK( "MMC_TIER = %08x\n", readreg(pdata->pAdapter, pdata->mac_regs + MMC_TIER)); + + DPRINTK( "EPHY_CTRL = %04x\n", readreg(pdata->pAdapter, pdata->base_mem + MGMT_EPHY_CTRL)); + DPRINTK( "MGMT_INT_CTRL0 = %04x\n", + readreg(pdata->pAdapter, pdata->base_mem + MGMT_INT_CTRL0)); + DPRINTK( "LPW_CTRL = %04x\n", readreg(pdata->pAdapter, pdata->base_mem + LPW_CTRL)); + DPRINTK( "MSIX_TBL_MASK = %04x\n", readreg(pdata->pAdapter, pdata->base_mem + MSIX_TBL_BASE_ADDR + MSIX_TBL_MASK_OFFSET)); + + DPRINTK( "Dump nonstick regs:\n"); + for ( i = REG_PCIE_TRIGGER; i < MSI_PBA_REG; i += 4) + DPRINTK( "[%d] = %04x\n", i / 4, readreg(pdata->pAdapter, pdata->base_mem + i)); + + pdata->hw_ops.read_mmc_stats(pdata); + + DPRINTK( "Dump TX counters:\n"); + DPRINTK( "tx_packets %lld\n", pstats->txframecount_gb); + DPRINTK( "tx_errors %lld\n", + pstats->txframecount_gb - pstats->txframecount_g); + DPRINTK( "tx_multicastframes_errors %lld\n", + pstats->txmulticastframes_gb - pstats->txmulticastframes_g); + DPRINTK( "tx_broadcastframes_errors %lld\n", + pstats->txbroadcastframes_gb - pstats->txbroadcastframes_g); + + DPRINTK( "txunderflowerror %lld\n", pstats->txunderflowerror); + DPRINTK( "txdeferredframes %lld\n", + pstats->txdeferredframes); + DPRINTK( "txlatecollisionframes %lld\n", + pstats->txlatecollisionframes); + DPRINTK( "txexcessivecollisionframes %lld\n", + pstats->txexcessivecollisionframes); + DPRINTK( "txcarriererrorframes %lld\n", + pstats->txcarriererrorframes); + DPRINTK( "txexcessivedeferralerror %lld\n", + pstats->txexcessivedeferralerror); + + DPRINTK( "txsinglecollision_g %lld\n", + pstats->txsinglecollision_g); + DPRINTK( "txmultiplecollision_g %lld\n", + pstats->txmultiplecollision_g); + DPRINTK( "txoversize_g %lld\n", pstats->txoversize_g); + + DPRINTK( "Dump RX counters:\n"); + DPRINTK( "rx_packets %lld\n", pstats->rxframecount_gb); + DPRINTK( "rx_errors %lld\n", + pstats->rxframecount_gb - pstats->rxbroadcastframes_g - + pstats->rxmulticastframes_g - pstats->rxunicastframes_g); + + DPRINTK( "rx_crc_errors %lld\n", pstats->rxcrcerror); + DPRINTK( "rxalignerror %lld\n", pstats->rxalignerror); + DPRINTK( "rxrunterror %lld\n", pstats->rxrunterror); + DPRINTK( "rxjabbererror %lld\n", pstats->rxjabbererror); + DPRINTK( "rx_length_errors %lld\n", pstats->rxlengtherror); + DPRINTK( "rxoutofrangetype %lld\n", pstats->rxoutofrangetype); + DPRINTK( "rx_fifo_errors %lld\n", pstats->rxfifooverflow); + DPRINTK( "rxwatchdogerror %lld\n", pstats->rxwatchdogerror); + DPRINTK( "rxreceiveerrorframe %lld\n", + pstats->rxreceiveerrorframe); + + DPRINTK( "rxbroadcastframes_g %lld\n", + pstats->rxbroadcastframes_g); + DPRINTK( "rxmulticastframes_g %lld\n", + pstats->rxmulticastframes_g); + DPRINTK( "rxundersize_g %lld\n", pstats->rxundersize_g); + DPRINTK( "rxoversize_g %lld\n", pstats->rxoversize_g); + DPRINTK( "rxunicastframes_g %lld\n", pstats->rxunicastframes_g); + DPRINTK( "rxcontrolframe_g %lld\n", pstats->rxcontrolframe_g); + + DPRINTK( "Dump Extra counters:\n"); + DPRINTK( "tx_tso_packets %lld\n", pstats->tx_tso_packets); + DPRINTK( "rx_split_header_packets %lld\n", + pstats->rx_split_header_packets); + DPRINTK( "tx_process_stopped %lld\n", pstats->tx_process_stopped); + DPRINTK( "rx_process_stopped %lld\n", pstats->rx_process_stopped); + DPRINTK( "tx_buffer_unavailable %lld\n", + pstats->tx_buffer_unavailable); + DPRINTK( "rx_buffer_unavailable %lld\n", + pstats->rx_buffer_unavailable); + DPRINTK( "fatal_bus_error %lld\n", pstats->fatal_bus_error); + DPRINTK( "napi_poll_isr %lld\n", pstats->napi_poll_isr); + DPRINTK( "napi_poll_txtimer %lld\n", pstats->napi_poll_txtimer); + DPRINTK( "ephy_poll_timer_cnt %lld\n", + pstats->ephy_poll_timer_cnt); + DPRINTK( "mgmt_int_isr %lld\n", pstats->mgmt_int_isr); +} + +#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4,0,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,8)))) +static void fxgmac_tx_timeout(struct net_device *netdev) +#else +static void fxgmac_tx_timeout(struct net_device *netdev, unsigned int unused) +#endif +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + netdev_warn(netdev, "tx timeout, device restarting\n"); + fxgmac_dump_state(pdata); +#if FXGMAC_TX_HANG_TIMER_ENABLED + if(!pdata->tx_hang_restart_queuing) + schedule_work(&pdata->expansion.restart_work); +#else + schedule_work(&pdata->expansion.restart_work); +#endif +} + +static netdev_tx_t fxgmac_xmit(struct sk_buff *skb, struct net_device *netdev) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_pkt_info *tx_pkt_info; + struct fxgmac_desc_ops *desc_ops; + struct fxgmac_channel *channel; + struct netdev_queue *txq; + struct fxgmac_ring *ring; + int ret; + + desc_ops = &pdata->desc_ops; + + //yzhang disabled + if(netif_msg_tx_done(pdata)) DPRINTK("xmit callin, skb->len=%d,q=%d\n", skb->len, skb->queue_mapping); + + channel = pdata->channel_head + skb->queue_mapping; + txq = netdev_get_tx_queue(netdev, channel->queue_index); + ring = channel->tx_ring; + tx_pkt_info = &ring->pkt_info; + + if (skb->len == 0) { + netif_err(pdata, tx_err, netdev, "empty skb received from stack\n"); + dev_kfree_skb_any(skb); + return NETDEV_TX_OK; + } + + /* Prepare preliminary packet info for TX */ + memset(tx_pkt_info, 0, sizeof(*tx_pkt_info)); + fxgmac_prep_tx_pkt(pdata, ring, skb, tx_pkt_info); + + /* Check that there are enough descriptors available */ + ret = fxgmac_maybe_stop_tx_queue(channel, ring, + tx_pkt_info->desc_count); + if (ret) + { + return ret; + } + + ret = fxgmac_prep_tso(pdata, skb, tx_pkt_info); + if (ret) { + netif_err(pdata, tx_err, netdev, "error processing TSO packet\n"); + dev_kfree_skb_any(skb); + return NETDEV_TX_OK; + } + fxgmac_prep_vlan(skb, tx_pkt_info); + + if (!desc_ops->map_tx_skb(channel, skb)) { + dev_kfree_skb_any(skb); + netif_err(pdata, tx_err, netdev, "xmit, map tx skb err\n"); + return NETDEV_TX_OK; + } + + /* Report on the actual number of bytes (to be) sent */ + netdev_tx_sent_queue(txq, tx_pkt_info->tx_bytes); + if(netif_msg_tx_done(pdata)) DPRINTK("xmit,before hw_xmit, byte len=%d\n", tx_pkt_info->tx_bytes); + + /* Configure required descriptor fields for transmission */ + fxgmac_dev_xmit(channel); + + if (netif_msg_pktdata(pdata)) + fxgmac_dbg_pkt(netdev, skb, true); + + /* Stop the queue in advance if there may not be enough descriptors */ + fxgmac_maybe_stop_tx_queue(channel, ring, FXGMAC_TX_MAX_DESC_NR); + + return NETDEV_TX_OK; +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,8))) +static void fxgmac_get_stats64(struct net_device *netdev, + struct rtnl_link_stats64 *s) +#else +static struct rtnl_link_stats64 * fxgmac_get_stats64(struct net_device *netdev, + struct rtnl_link_stats64 *s) +#endif +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_stats *pstats = &pdata->stats; + +#if FXGMAC_PM_FEATURE_ENABLED + /* 20210709 for net power down */ + if(!test_bit(FXGMAC_POWER_STATE_DOWN, &pdata->expansion.powerstate)) +#endif + { + //DPRINTK("get_stats64, ndo op, callin\n"); + pdata->hw_ops.read_mmc_stats(pdata); + + s->rx_packets = pstats->rxframecount_gb; + s->rx_bytes = pstats->rxoctetcount_gb; + s->rx_errors = pstats->rxframecount_gb - + pstats->rxbroadcastframes_g - + pstats->rxmulticastframes_g - + pstats->rxunicastframes_g; + s->multicast = pstats->rxmulticastframes_g; + s->rx_length_errors = pstats->rxlengtherror; + s->rx_crc_errors = pstats->rxcrcerror; + s->rx_fifo_errors = pstats->rxfifooverflow; + + s->tx_packets = pstats->txframecount_gb; + s->tx_bytes = pstats->txoctetcount_gb; + s->tx_errors = pstats->txframecount_gb - pstats->txframecount_g; + s->tx_dropped = netdev->stats.tx_dropped; + } + + +#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,8)) + return; +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) + return s; +#else + return; +#endif +} + +static int fxgmac_set_mac_address(struct net_device *netdev, void *addr) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + struct sockaddr *saddr = addr; + + if (!is_valid_ether_addr(saddr->sa_data)) + return -EADDRNOTAVAIL; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) + eth_hw_addr_set(netdev, saddr->sa_data); +#else + memcpy(netdev->dev_addr, saddr->sa_data, netdev->addr_len); +#endif + memcpy(pdata->mac_addr, saddr->sa_data, netdev->addr_len); + + hw_ops->set_mac_address(pdata, saddr->sa_data); + hw_ops->set_mac_hash(pdata); + + DPRINTK("fxgmac,set mac addr to %02x:%02x:%02x:%02x:%02x:%02x\n",netdev->dev_addr[0], netdev->dev_addr[1], netdev->dev_addr[2], + netdev->dev_addr[3], netdev->dev_addr[4], netdev->dev_addr[5]); + return 0; +} + +/* + * cmd = [0x89F0, 0x89FF] + * When using it, we must pay attention to the thread synchronization + * of this interface. Because it's an external call that isn't + * initiated by the OS. + */ +static int fxgmac_ioctl(struct net_device *netdev, + struct ifreq *ifr, int cmd) +{ + struct file f; + int ret = FXGMAC_SUCCESS; + struct fxgmac_pdata *pdata = netdev_priv(netdev); + + if (!netif_running(netdev) || + pdata->expansion.dev_state != FXGMAC_DEV_START) + return -ENODEV; + + f.private_data = pdata; + + switch (cmd) { + case FXGMAC_DEV_CMD: + ret = fxgmac_netdev_ops_ioctl(&f, FXGMAC_IOCTL_DFS_COMMAND, (unsigned long)(ifr->ifr_data)); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) ) +static int fxgmac_siocdevprivate(struct net_device *dev, + struct ifreq *ifr, + void __user *data, + int cmd) +{ + return fxgmac_ioctl(dev, ifr, cmd); +} +#endif + +static int fxgmac_change_mtu(struct net_device *netdev, int mtu) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + int ret, max_mtu; +#ifdef FXGMAC_DEBUG + int old_mtu = netdev->mtu; +#endif + + if (!netif_running(netdev)) { + DPRINTK("Can not set mtu because NIC is not open.\n"); + return -EPERM; + } + + /* On the Linux platform, the MTU size does not include the length + * of the MAC address and the length of the Type, but FXGMAC_JUMBO_PACKET_MTU include them. + */ + max_mtu = FXGMAC_JUMBO_PACKET_MTU - ETH_HLEN; + if (mtu > max_mtu) { + netdev_alert(netdev, "MTU exceeds maximum supported value\n"); + return -EINVAL; + } + + fxgmac_lock(pdata); + fxgmac_stop(pdata); + fxgmac_free_tx_data(pdata); + + /* + * We must unmap rx desc's dma before we change rx_buf_size. + * Becaues the size of the unmapped DMA is set according to rx_buf_size + */ + fxgmac_free_rx_data(pdata); + + ret = fxgmac_calc_rx_buf_size(netdev, mtu); + if (ret < 0) { + fxgmac_unlock(pdata); + return ret; + } + pdata->rx_buf_size = ret; + + pdata->jumbo = mtu > ETH_DATA_LEN ? 1 : 0; + netdev->mtu = mtu; + + fxgmac_start(pdata); + netdev_update_features(netdev); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + DPRINTK("fxgmac,set MTU from %d to %d. min, max=(%d,%d)\n",old_mtu, + netdev->mtu, netdev->min_mtu, netdev->max_mtu); +#else + DPRINTK("fxgmac,set MTU from %d to %d.\n",old_mtu, netdev->mtu); +#endif + fxgmac_unlock(pdata); + + return 0; +} + +static int fxgmac_vlan_rx_add_vid(struct net_device *netdev, + __be16 proto, + u16 vid) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + set_bit(vid, pdata->active_vlans); +#if FXGMAC_FILTER_SINGLE_VLAN_ENABLED + pdata->vlan = vid; + hw_ops->enable_rx_vlan_filtering(pdata); +#else + hw_ops->update_vlan_hash_table(pdata); +#endif + DPRINTK("fxgmac,add rx vlan %d\n", vid); + return 0; +} + +static int fxgmac_vlan_rx_kill_vid(struct net_device *netdev, + __be16 proto, + u16 vid) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + clear_bit(vid, pdata->active_vlans); +#if FXGMAC_FILTER_SINGLE_VLAN_ENABLED + pdata->vlan = 0; + hw_ops->disable_rx_vlan_filtering(pdata); +#else + hw_ops->update_vlan_hash_table(pdata); +#endif + + DPRINTK("fxgmac,del rx vlan %d\n", vid); + return 0; +} + +#ifdef CONFIG_NET_POLL_CONTROLLER +static void fxgmac_poll_controller(struct net_device *netdev) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_channel *channel; + unsigned int i; + + if (pdata->per_channel_irq) { + channel = pdata->channel_head; + for (i = 0; i < pdata->channel_count; i++, channel++) + fxgmac_dma_isr(channel->dma_irq, channel); + } else { + disable_irq(pdata->dev_irq); + fxgmac_isr(pdata->dev_irq, pdata); + enable_irq(pdata->dev_irq); + } +} +#endif /* CONFIG_NET_POLL_CONTROLLER */ + +static netdev_features_t fxgmac_fix_features(struct net_device *netdev, + netdev_features_t features) +{ + u32 fifo_size; + struct fxgmac_pdata* pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + fifo_size = hw_ops->calculate_max_checksum_size(pdata); + + if (netdev->mtu > fifo_size) { + features &= ~NETIF_F_IP_CSUM; + features &= ~NETIF_F_IPV6_CSUM; + } + + return features; +} + +static int fxgmac_set_features(struct net_device *netdev, + netdev_features_t features) +{ + netdev_features_t rxhash, rxcsum, rxvlan, rxvlan_filter, tso; + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int ret = 0; + + rxhash = pdata->expansion.netdev_features & NETIF_F_RXHASH; + rxcsum = pdata->expansion.netdev_features & NETIF_F_RXCSUM; + rxvlan = pdata->expansion.netdev_features & NETIF_F_HW_VLAN_CTAG_RX; + rxvlan_filter = pdata->expansion.netdev_features & NETIF_F_HW_VLAN_CTAG_FILTER; + tso = pdata->expansion.netdev_features & (NETIF_F_TSO | NETIF_F_TSO6); + + if ((features & (NETIF_F_TSO | NETIF_F_TSO6)) && !tso) { + DPRINTK("enable tso.\n"); + pdata->hw_feat.tso = 1; + hw_ops->config_tso(pdata); + } else if (!(features & (NETIF_F_TSO | NETIF_F_TSO6)) && tso) { + DPRINTK("disable tso.\n"); + pdata->hw_feat.tso = 0; + hw_ops->config_tso(pdata); + } + + if ((features & NETIF_F_RXHASH) && !rxhash) + ret = hw_ops->enable_rss(pdata); + else if (!(features & NETIF_F_RXHASH) && rxhash) + ret = hw_ops->disable_rss(pdata); + if (ret) + return ret; + + if ((features & NETIF_F_RXCSUM) && !rxcsum) + hw_ops->enable_rx_csum(pdata); + else if (!(features & NETIF_F_RXCSUM) && rxcsum) + hw_ops->disable_rx_csum(pdata); + + if ((features & NETIF_F_HW_VLAN_CTAG_RX) && !rxvlan) + hw_ops->enable_rx_vlan_stripping(pdata); + else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) && rxvlan) + hw_ops->disable_rx_vlan_stripping(pdata); + + if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) && !rxvlan_filter) + hw_ops->enable_rx_vlan_filtering(pdata); + else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) && rxvlan_filter) + hw_ops->disable_rx_vlan_filtering(pdata); + + pdata->expansion.netdev_features = features; + + DPRINTK("fxgmac,set features done,%llx\n", (u64)features); + return 0; +} + +static void fxgmac_set_rx_mode(struct net_device *netdev) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + hw_ops->config_rx_mode(pdata); +} + +static const struct net_device_ops fxgmac_netdev_ops = { + .ndo_open = fxgmac_open, + .ndo_stop = fxgmac_close, + .ndo_start_xmit = fxgmac_xmit, + .ndo_tx_timeout = fxgmac_tx_timeout, + .ndo_get_stats64 = fxgmac_get_stats64, + +#if(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,0)) + .ndo_change_mtu = fxgmac_change_mtu, +#elif (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,8)) + .ndo_change_mtu_rh74 = fxgmac_change_mtu, +#else + .ndo_change_mtu = fxgmac_change_mtu, +#endif + + .ndo_set_mac_address = fxgmac_set_mac_address, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = fxgmac_ioctl, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) ) + .ndo_siocdevprivate = fxgmac_siocdevprivate, +#endif + .ndo_vlan_rx_add_vid = fxgmac_vlan_rx_add_vid, + .ndo_vlan_rx_kill_vid = fxgmac_vlan_rx_kill_vid, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = fxgmac_poll_controller, +#endif + .ndo_set_features = fxgmac_set_features, + .ndo_fix_features = fxgmac_fix_features, + .ndo_set_rx_mode = fxgmac_set_rx_mode, +}; + +const struct net_device_ops *fxgmac_get_netdev_ops(void) +{ + return &fxgmac_netdev_ops; +} + +static void fxgmac_rx_refresh(struct fxgmac_channel *channel) +{ + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_ring *ring = channel->rx_ring; + struct fxgmac_desc_data *desc_data; + struct fxgmac_desc_ops *desc_ops = &pdata->desc_ops; +#if 0 + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; +#endif + + while (ring->dirty != ring->cur) { + desc_data = FXGMAC_GET_DESC_DATA(ring, ring->dirty); +#ifdef FXGMAC_ZERO_COPY + /* Reset desc_data values */ + desc_ops->unmap_desc_data(pdata, desc_data); + + if (desc_ops->map_rx_buffer(pdata, ring, desc_data)) + break; +#endif + desc_ops->rx_desc_reset(pdata, desc_data, ring->dirty); + ring->dirty = FXGMAC_GET_ENTRY(ring->dirty, ring->dma_desc_count); + } + + /* Make sure everything is written before the register write */ + wmb(); + + /* Update the Rx Tail Pointer Register with address of + * the last cleaned entry + */ + desc_data = FXGMAC_GET_DESC_DATA(ring, (ring->dirty - 1) & (ring->dma_desc_count - 1)); + writel(lower_32_bits(desc_data->dma_desc_addr), FXGMAC_DMA_REG(channel, DMA_CH_RDTR_LO)); +} + +static struct sk_buff *fxgmac_create_skb(struct fxgmac_pdata *pdata, + struct napi_struct *napi, + struct fxgmac_desc_data *desc_data, + unsigned int len) +{ + struct sk_buff *skb; +#ifndef FXGMAC_NOT_USE_PAGE_MAPPING + unsigned int copy_len; + u8 *packet; +#endif + +#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,0)) && (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,8)) + +/* just add fot compile + * centos 7.0 not support napi_alloc_skb, and porting it is hard + */ +#define napi_alloc_skb(a,b) NULL + skb = __netdev_alloc_skb_ip_align(pdata->netdev, len, GFP_ATOMIC); + if (!skb) { + netdev_err(pdata->netdev, "%s: Rx init fails; skb is NULL\n", __func__); + return NULL; + } + + dma_sync_single_for_cpu(pdata->dev, desc_data->rx.buf.dma_base, len, DMA_FROM_DEVICE); + skb_copy_to_linear_data(skb, desc_data->skb->data, len); + skb_put(skb, len); + dma_sync_single_for_device(pdata->dev, desc_data->rx.buf.dma_base, len, DMA_FROM_DEVICE); + + return skb; +#endif + +#ifdef FXGMAC_NOT_USE_PAGE_MAPPING +#ifdef FXGMAC_ZERO_COPY + dma_sync_single_for_cpu(pdata->dev, desc_data->rx.buf.dma_base, len, DMA_FROM_DEVICE); + skb = desc_data->skb; + desc_data->skb = NULL; + skb_put(skb, len); + dma_sync_single_for_device(pdata->dev, desc_data->rx.buf.dma_base, len, DMA_FROM_DEVICE); +#else + skb = __netdev_alloc_skb_ip_align(pdata->netdev, len, GFP_ATOMIC); + if (!skb) { + netdev_err(pdata->netdev, "%s: Rx init fails; skb is NULL\n", __func__); + return NULL; + } + + dma_sync_single_for_cpu(pdata->dev, desc_data->rx.buf.dma_base, len, DMA_FROM_DEVICE); + skb_copy_to_linear_data(skb, desc_data->skb->data, len); + skb_put(skb, len); + dma_sync_single_for_device(pdata->dev, desc_data->rx.buf.dma_base, len, DMA_FROM_DEVICE); +#endif + return skb; +#else + skb = napi_alloc_skb(napi, desc_data->rx.hdr.dma_len); + if (!skb) + return NULL; + + /* Start with the header buffer which may contain just the header + * or the header plus data + */ + dma_sync_single_range_for_cpu(pdata->dev, desc_data->rx.hdr.dma_base, + desc_data->rx.hdr.dma_off, + desc_data->rx.hdr.dma_len, + DMA_FROM_DEVICE); + + packet = page_address(desc_data->rx.hdr.pa.pages) + + desc_data->rx.hdr.pa.pages_offset; + copy_len = len; + copy_len = min(desc_data->rx.hdr.dma_len, copy_len); + skb_copy_to_linear_data(skb, packet, copy_len); + skb_put(skb, copy_len); + return skb; +#endif +} + +static int fxgmac_tx_poll(struct fxgmac_channel *channel) +{ + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_ring *ring = channel->tx_ring; + struct net_device *netdev = pdata->netdev; + unsigned int tx_packets = 0, tx_bytes = 0; + struct fxgmac_desc_data *desc_data; + struct fxgmac_dma_desc *dma_desc; + struct fxgmac_desc_ops *desc_ops; + struct fxgmac_hw_ops *hw_ops; + struct netdev_queue *txq; + int processed = 0; + unsigned int cur; + + static int fxgmac_restart_need = 0; + static u32 change_cnt = 0; + static u32 reg_cur_pre = 0xffffffff; + (void) reg_cur_pre; + (void) change_cnt; + (void) fxgmac_restart_need; + +#if FXGMAC_TX_HANG_TIMER_ENABLED + static u32 reg_cur = 0; +#endif + + desc_ops = &pdata->desc_ops; + hw_ops = &pdata->hw_ops; + + /* Nothing to do if there isn't a Tx ring for this channel */ + if (!ring){ + if(netif_msg_tx_done(pdata) && (channel->queue_index < pdata->tx_q_count)) DPRINTK("tx_poll, null point to ring %d\n", channel->queue_index); + return 0; + } + if((ring->cur != ring->dirty) && (netif_msg_tx_done(pdata))) + DPRINTK("tx_poll callin, ring_cur=%d,ring_dirty=%d,qIdx=%d\n", ring->cur, ring->dirty, channel->queue_index); + + cur = ring->cur; + + /* Be sure we get ring->cur before accessing descriptor data */ + smp_rmb(); + + txq = netdev_get_tx_queue(netdev, channel->queue_index); + + while (ring->dirty != cur) { + desc_data = FXGMAC_GET_DESC_DATA(ring, ring->dirty); + dma_desc = desc_data->dma_desc; + + if (!hw_ops->tx_complete(dma_desc)) { +#if FXGMAC_TRIGGER_TX_HANG + struct net_device *netdev = pdata->netdev; + #define FXGMAC_HANG_THRESHOLD 1 + //static u32 reg_tail = 0, reg_tail_pre = 0xffffffff; + + reg_cur = readl(FXGMAC_DMA_REG(channel, 0x44/* tx desc curr pointer reg */)); + + if(reg_cur != reg_cur_pre){ + reg_cur_pre = reg_cur; + change_cnt = 0; + } else { + change_cnt++; + } + + if (change_cnt > 2) + { + //change_cnt = 0; + + DPRINTK("after complete check, cur=%d, dirty=%d,qIdx=%d, hw desc cur=%#x, pre=%#x\n", ring->cur, ring->dirty, channel->queue_index, + reg_cur, reg_cur_pre); + + if((ring->cur > ring->dirty) && ((ring->cur - ring->dirty) > FXGMAC_HANG_THRESHOLD) ) { + DPRINTK("after complete check warning..., too many TBD occupied by HW, 0xdbbb, %d.\n", (ring->cur - ring->dirty)); + (* ((u32 *)(netdev->base_addr + 0x1000))) = 0xdbbb; + + if(!fxgmac_restart_need ) { + schedule_work(&pdata->expansion.restart_work); + fxgmac_restart_need = 1; + change_cnt = 0; + } + }else if((ring->cur < ring->dirty) && ((ring->cur + (ring->dma_desc_count - ring->dirty)) > FXGMAC_HANG_THRESHOLD) ) { + DPRINTK("after complete check warning..., too many TBD occupied by HW, 0xdb00, %d.\n", (ring->cur + (ring->dma_desc_count - ring->dirty))); + (* ((u32 *)(netdev->base_addr + 0x1000))) = 0xdb00; + + if(!fxgmac_restart_need ) { + schedule_work(&pdata->expansion.restart_work); + fxgmac_restart_need = 1; + change_cnt = 0; + } + } + } +#endif +#if FXGMAC_TX_HANG_TIMER_ENABLED + if((!pdata->tx_hang_restart_queuing) && (!channel->expansion.tx_hang_timer_active)) { + reg_cur = ring->dirty; + if(reg_cur_pre != reg_cur) { + reg_cur_pre = reg_cur; + change_cnt = 0; + }else { + change_cnt++; + } + + if (change_cnt > 4) + { +#if FXGMAC_TX_HANG_CHECH_DIRTY + channel->expansion.tx_hang_hw_cur = ring->dirty; +#else + channel->expansion.tx_hang_hw_cur = readl(FXGMAC_DMA_REG(channel, 0x44/* tx desc curr pointer reg */)); +#endif + /* double check for race conditione */ + if ((!pdata->tx_hang_restart_queuing) && (!channel->expansion.tx_hang_timer_active)) { + DPRINTK("tx_hang polling: start timer at desc %u, timer act=%u, queuing=%u, qidx=%u.\n", reg_cur, channel->expansion.tx_hang_timer_active, pdata->tx_hang_restart_queuing, channel->queue_index); + fxgmac_tx_hang_timer_start(channel); + } + } + }else if (pdata->tx_hang_restart_queuing) { + //if(netif_msg_drv(pdata)) DPRINTK("tx_hang_timer_handler: restart scheduled.\n"); + } +#endif + + break; + } + + reg_cur_pre = 0xffffffff; + fxgmac_restart_need = 0; + change_cnt = 0; + + /* Make sure descriptor fields are read after reading + * the OWN bit + */ + dma_rmb(); + + if (netif_msg_tx_done(pdata)) + fxgmac_dump_tx_desc(pdata, ring, ring->dirty, 1, 0); + + if (hw_ops->is_last_desc(dma_desc)) { + tx_packets += desc_data->tx.packets; + tx_bytes += desc_data->tx.bytes; + } + + /* Free the SKB and reset the descriptor for re-use */ + desc_ops->unmap_desc_data(pdata, desc_data); + desc_ops->tx_desc_reset(desc_data); + + processed++; + //ring->dirty++; + ring->dirty = FXGMAC_GET_ENTRY(ring->dirty, ring->dma_desc_count); + } + + if (!processed) + return 0; + + netdev_tx_completed_queue(txq, tx_packets, tx_bytes); + + smp_wmb(); + if ((ring->tx.queue_stopped == 1) && + (fxgmac_tx_avail_desc(ring) > FXGMAC_TX_DESC_MIN_FREE)) { + ring->tx.queue_stopped = 0; + netif_tx_wake_queue(txq); + } + + //yzhang comment out to reduce print + if(netif_msg_tx_done(pdata)){ + DPRINTK("tx_poll callout, processed=%d\n", processed); + } + + return processed; +} + +static int fxgmac_rx_poll(struct fxgmac_channel *channel, int budget) +{ + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_ring *ring = channel->rx_ring; + struct net_device *netdev = pdata->netdev; + unsigned int len, max_len; + unsigned int context_next, context; + struct fxgmac_desc_data *desc_data; + struct fxgmac_pkt_info *pkt_info; + unsigned int incomplete; + struct napi_struct *napi; + struct sk_buff *skb; + int packet_count = 0; + + /* Nothing to do if there isn't a Rx ring for this channel */ + if (!ring) + return 0; + + incomplete = 0; + context_next = 0; + + napi = (pdata->per_channel_irq) ? &channel->expansion.napi_rx : &pdata->expansion.napi; + + desc_data = FXGMAC_GET_DESC_DATA(ring, ring->cur); + pkt_info = &ring->pkt_info; + + while (packet_count < budget) { + memset(pkt_info, 0, sizeof(*pkt_info)); + skb = NULL; + len = 0; + + read_again: + desc_data = FXGMAC_GET_DESC_DATA(ring, ring->cur); + + if (fxgmac_rx_dirty_desc(ring) > FXGMAC_RX_DESC_MAX_DIRTY) + fxgmac_rx_refresh(channel); + + if (fxgmac_dev_read(channel)) + break; + + ring->cur = FXGMAC_GET_ENTRY(ring->cur, ring->dma_desc_count); + + incomplete = FXGMAC_GET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_INCOMPLETE_POS, + RX_PACKET_ATTRIBUTES_INCOMPLETE_LEN); + context_next = FXGMAC_GET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_POS, + RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_LEN); + context = FXGMAC_GET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_CONTEXT_POS, + RX_PACKET_ATTRIBUTES_CONTEXT_LEN); + + if (incomplete || context_next) + goto read_again; + + if (pkt_info->errors) { + netif_err(pdata, rx_err, netdev, "error in received packet\n"); + dev_kfree_skb(skb); + pdata->netdev->stats.rx_dropped++; + goto next_packet; + } + + if (!context) { + len = desc_data->rx.len; + + if (len == 0) { + if (net_ratelimit()) + netif_err(pdata, rx_err, netdev, + "A packet of length 0 was received\n"); + pdata->netdev->stats.rx_length_errors++; + pdata->netdev->stats.rx_dropped++; + goto next_packet; + } + + if (len && !skb) { + skb = fxgmac_create_skb(pdata, napi, desc_data, len); + if (unlikely(!skb)) { + if (net_ratelimit()) + netif_err(pdata, rx_err, netdev, "create skb failed\n"); + pdata->netdev->stats.rx_dropped++; + goto next_packet; + } + } + + max_len = netdev->mtu + ETH_HLEN; + if (!(netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && + skb->protocol == htons(ETH_P_8021Q)) + max_len += VLAN_HLEN; + if (len > max_len) { + if (net_ratelimit()) + netif_err(pdata, rx_err, netdev, + "len %d larger than max size %d\n", + len, max_len); + pdata->netdev->stats.rx_length_errors++; + pdata->netdev->stats.rx_dropped++; + dev_kfree_skb(skb); + goto next_packet; + } + } + + if (!skb) { + pdata->netdev->stats.rx_dropped++; + goto next_packet; + } + + if(netif_msg_pktdata(pdata)) + fxgmac_print_pkt(netdev, skb, false); + + skb_checksum_none_assert(skb); + if (netdev->features & NETIF_F_RXCSUM) + skb->ip_summed = CHECKSUM_UNNECESSARY; + + if (FXGMAC_GET_REG_BITS(pkt_info->attributes, + RX_PACKET_ATTRIBUTES_VLAN_CTAG_POS, + RX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN)) { + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), + pkt_info->vlan_ctag); + pdata->stats.rx_vlan_packets++; + } + + if (FXGMAC_GET_REG_BITS(pkt_info->attributes, + RX_PACKET_ATTRIBUTES_RSS_HASH_POS, + RX_PACKET_ATTRIBUTES_RSS_HASH_LEN)) + skb_set_hash(skb, pkt_info->rss_hash, + pkt_info->rss_hash_type); + + skb->dev = netdev; + skb->protocol = eth_type_trans(skb, netdev); + skb_record_rx_queue(skb, channel->queue_index); + + if(pdata->expansion.fxgmac_test_tso_flag) + { + /* tso test */ + if(pdata->expansion.fxgmac_test_tso_seg_num == 1) + { + /* last segment */ + if(pdata->expansion.fxgmac_test_last_tso_len == skb->len + FXGMAC_TEST_MAC_HEAD_LEN) + { + /* receive last segment, reset flag */ + pdata->expansion.fxgmac_test_tso_flag = false; + pdata->expansion.fxgmac_test_tso_seg_num = 0; + pdata->expansion.fxgmac_test_packet_len = 0; + pdata->expansion.fxgmac_test_last_tso_len = 0; + + /* process packet */ + if((pdata->expansion.fxgmac_test_skb_arr_in_index + 1) % FXGMAC_MAX_DBG_TEST_PKT != pdata->expansion.fxgmac_test_skb_arr_out_index){ + struct sk_buff *tmpskb = skb_copy(skb, GFP_ATOMIC); + skb_push(tmpskb, FXGMAC_TEST_MAC_HEAD_LEN); + + pdata->expansion.fxgmac_test_skb_array[pdata->expansion.fxgmac_test_skb_arr_in_index] = tmpskb; + pdata->expansion.fxgmac_test_skb_arr_in_index = (pdata->expansion.fxgmac_test_skb_arr_in_index + 1) % FXGMAC_MAX_DBG_TEST_PKT; + } + else{ + DPRINTK("loopback test buffer is full."); + } + } + } + else /* non last segment */ + { + if(pdata->expansion.fxgmac_test_packet_len == skb->len + FXGMAC_TEST_MAC_HEAD_LEN){ + /* receive a segment */ + pdata->expansion.fxgmac_test_tso_seg_num--; + + /* process packet */ + if((pdata->expansion.fxgmac_test_skb_arr_in_index + 1) % FXGMAC_MAX_DBG_TEST_PKT != pdata->expansion.fxgmac_test_skb_arr_out_index){ + struct sk_buff *tmpskb = skb_copy(skb, GFP_ATOMIC); + skb_push(tmpskb, FXGMAC_TEST_MAC_HEAD_LEN); + + pdata->expansion.fxgmac_test_skb_array[pdata->expansion.fxgmac_test_skb_arr_in_index] = tmpskb; + pdata->expansion.fxgmac_test_skb_arr_in_index = (pdata->expansion.fxgmac_test_skb_arr_in_index + 1) % FXGMAC_MAX_DBG_TEST_PKT; + } + else{ + DPRINTK("loopback test buffer is full."); + } + } + } + } + else if(pdata->expansion.fxgmac_test_packet_len != 0) + { + /* xsum and phy loopback test */ + if(pdata->expansion.fxgmac_test_packet_len == skb->len + FXGMAC_TEST_MAC_HEAD_LEN) + { + /* reset fxg_packet_len */ + pdata->expansion.fxgmac_test_packet_len = 0; + + if((pdata->expansion.fxgmac_test_skb_arr_in_index + 1) % FXGMAC_MAX_DBG_TEST_PKT != pdata->expansion.fxgmac_test_skb_arr_out_index){ + struct sk_buff *tmpskb = skb_copy(skb, GFP_ATOMIC); + skb_push(tmpskb, FXGMAC_TEST_MAC_HEAD_LEN); + + pdata->expansion.fxgmac_test_skb_array[pdata->expansion.fxgmac_test_skb_arr_in_index] = tmpskb; + pdata->expansion.fxgmac_test_skb_arr_in_index = (pdata->expansion.fxgmac_test_skb_arr_in_index + 1) % FXGMAC_MAX_DBG_TEST_PKT; + } + else{ + DPRINTK("loopback test buffer is full."); + } + } + } +#if 1 + napi_gro_receive(napi, skb); +#else + netif_receive_skb(skb); +#endif + +next_packet: + packet_count++; + + pdata->netdev->stats.rx_packets++; + pdata->netdev->stats.rx_bytes += len; + } + + //fxgmac_rx_refresh(channel); + + return packet_count; +} + +static int fxgmac_one_poll_tx(struct napi_struct *napi, int budget) +{ + struct fxgmac_channel *channel = container_of(napi, + struct fxgmac_channel, + expansion.napi_tx); + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + fxgmac_tx_poll(channel); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + if (napi_complete_done(napi, 0)) { + hw_ops->enable_msix_one_interrupt(pdata, MSI_ID_TXQ0); + } +#else + napi_complete(napi); + hw_ops->enable_msix_one_interrupt(pdata, MSI_ID_TXQ0); +#endif + return 0; + +} + +static int fxgmac_one_poll_rx(struct napi_struct *napi, int budget) +{ + struct fxgmac_channel *channel = container_of(napi, + struct fxgmac_channel, + expansion.napi_rx); + int processed = 0; + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + + processed = fxgmac_rx_poll(channel, budget); + if (processed < budget) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + /* if there no interrupt occurred when this interrupt running,struct napi's state is NAPIF_STATE_SCHED, + * napi_complete_done return true and we can enable irq,it will not cause unbalanced iqr issure. + * if there more interrupt occurred when this interrupt running,struct napi's state is NAPIF_STATE_SCHED | NAPIF_STATE_MISSED + * because napi_schedule_prep will make it. At this time napi_complete_done will return false and + * schedule poll again because of NAPIF_STATE_MISSED,it will cause unbalanced irq issure. + */ + if (napi_complete_done(napi, processed)) { + hw_ops->enable_msix_one_interrupt(pdata, channel->queue_index); + } +#else + napi_complete(napi); + hw_ops->enable_msix_one_interrupt(pdata, channel->queue_index); +#endif + } + + return processed; +} + +static int fxgmac_all_poll(struct napi_struct *napi, int budget) +{ + struct fxgmac_pdata *pdata = container_of(napi, + struct fxgmac_pdata, + expansion.napi); + struct fxgmac_channel *channel; + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int processed; + unsigned int i; + + //yzhang comment out + if(netif_msg_rx_status(pdata)){ + DPRINTK("rx all_poll callin budget=%d\n", budget); + } + + processed = 0; + do { + channel = pdata->channel_head; + /* Cleanup Tx ring first */ + /*since only 1 tx channel supported in this version, poll ch 0 always. */ + fxgmac_tx_poll(pdata->channel_head + 0); + for (i = 0; i < pdata->channel_count; i++, channel++) { + processed += fxgmac_rx_poll(channel, budget); + } + } while (false); + + /* If we processed everything, we are done */ + if (processed < budget) { + /* Turn off polling */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + if (napi_complete_done(napi, processed)) + hw_ops->enable_mgm_interrupt(pdata); +#else + napi_complete(napi); + hw_ops->enable_mgm_interrupt(pdata); +#endif + } + + if((processed) && (netif_msg_rx_status(pdata))) { //yzhang for debug + DPRINTK("rx all_poll callout received = %d\n", processed); + } + + return processed; +} + +void fxgmac_tx_start_xmit(struct fxgmac_channel *channel, + struct fxgmac_ring *ring) +{ + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_desc_data *desc_data; + + /* Make sure everything is written before the register write */ + wmb(); + + /* Issue a poll command to Tx DMA by writing address + * of next immediate free descriptor + */ + desc_data = FXGMAC_GET_DESC_DATA(ring, ring->cur); + + writereg(pdata->pAdapter, lower_32_bits(desc_data->dma_desc_addr), + FXGMAC_DMA_REG(channel, DMA_CH_TDTR_LO)); + + if(netif_msg_tx_done(pdata)) { + DPRINTK("tx_start_xmit: dump before wr reg, \ + dma base=0x%016llx,reg=0x%08x, \ + tx timer usecs=%u,tx_timer_active=%u\n", + desc_data->dma_desc_addr, + readreg(pdata->pAdapter, FXGMAC_DMA_REG(channel, DMA_CH_TDTR_LO)), + pdata->tx_usecs, channel->tx_timer_active); + } + + ring->tx.xmit_more = 0; +} + +void fxgmac_dev_xmit(struct fxgmac_channel *channel) +{ + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_ring *ring = channel->tx_ring; + unsigned int tso_context, vlan_context; + struct fxgmac_desc_data *desc_data; + struct fxgmac_dma_desc *dma_desc; + struct fxgmac_pkt_info *pkt_info; + unsigned int csum, tso, vlan; + int start_index = ring->cur; + int cur_index = ring->cur; + int i; + + if(netif_msg_tx_done(pdata)) DPRINTK("dev_xmit callin, desc cur=%d\n", cur_index); + + pkt_info = &ring->pkt_info; + csum = FXGMAC_GET_REG_BITS(pkt_info->attributes, + TX_PACKET_ATTRIBUTES_CSUM_ENABLE_POS, + TX_PACKET_ATTRIBUTES_CSUM_ENABLE_LEN); + tso = FXGMAC_GET_REG_BITS(pkt_info->attributes, + TX_PACKET_ATTRIBUTES_TSO_ENABLE_POS, + TX_PACKET_ATTRIBUTES_TSO_ENABLE_LEN); + vlan = FXGMAC_GET_REG_BITS(pkt_info->attributes, + TX_PACKET_ATTRIBUTES_VLAN_CTAG_POS, + TX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN); + + if (tso && (pkt_info->mss != ring->tx.cur_mss)) + tso_context = 1; + else + tso_context = 0; + + //if(tso && (netif_msg_tx_done(pdata))) + if((tso_context) && (netif_msg_tx_done(pdata))) { + //tso is initialized to start... + DPRINTK("fxgmac_dev_xmit,tso_%s tso=0x%x,pkt_mss=%d,cur_mss=%d\n",(pkt_info->mss)?"start":"stop", tso, pkt_info->mss, ring->tx.cur_mss); + } + + if (vlan && (pkt_info->vlan_ctag != ring->tx.cur_vlan_ctag)) + vlan_context = 1; + else + vlan_context = 0; + + if(vlan && (netif_msg_tx_done(pdata))) DPRINTK("fxgmac_dev_xmi:pkt vlan=%d, ring vlan=%d, vlan_context=%d\n", pkt_info->vlan_ctag, ring->tx.cur_vlan_ctag, vlan_context); + + desc_data = FXGMAC_GET_DESC_DATA(ring, cur_index); + dma_desc = desc_data->dma_desc; + + /* Create a context descriptor if this is a TSO pkt_info */ + if (tso_context || vlan_context) { + if (tso_context) { +#if 0 + netif_dbg(pdata, tx_queued, pdata->netdev, + "TSO context descriptor, mss=%u\n", + pkt_info->mss); +#else + if (netif_msg_tx_done(pdata)) DPRINTK("xlgamc dev xmit,construct tso context descriptor, mss=%u\n", + pkt_info->mss); +#endif + + /* Set the MSS size */ + dma_desc->desc2 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc2, + TX_CONTEXT_DESC2_MSS_POS, + TX_CONTEXT_DESC2_MSS_LEN, + pkt_info->mss); + + /* Mark it as a CONTEXT descriptor */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_CONTEXT_DESC3_CTXT_POS, + TX_CONTEXT_DESC3_CTXT_LEN, + 1); + + /* Indicate this descriptor contains the MSS */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_CONTEXT_DESC3_TCMSSV_POS, + TX_CONTEXT_DESC3_TCMSSV_LEN, + 1); + + ring->tx.cur_mss = pkt_info->mss; + } + + if (vlan_context) { + netif_dbg(pdata, tx_queued, pdata->netdev, + "VLAN context descriptor, ctag=%u\n", + pkt_info->vlan_ctag); + + /* Mark it as a CONTEXT descriptor */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_CONTEXT_DESC3_CTXT_POS, + TX_CONTEXT_DESC3_CTXT_LEN, + 1); + + /* Set the VLAN tag */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_CONTEXT_DESC3_VT_POS, + TX_CONTEXT_DESC3_VT_LEN, + pkt_info->vlan_ctag); + + /* Indicate this descriptor contains the VLAN tag */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_CONTEXT_DESC3_VLTV_POS, + TX_CONTEXT_DESC3_VLTV_LEN, + 1); + + ring->tx.cur_vlan_ctag = pkt_info->vlan_ctag; + } + + //cur_index++; + cur_index = FXGMAC_GET_ENTRY(cur_index, ring->dma_desc_count); + desc_data = FXGMAC_GET_DESC_DATA(ring, cur_index); + dma_desc = desc_data->dma_desc; + } + + /* Update buffer address (for TSO this is the header) */ + dma_desc->desc0 = cpu_to_le32(lower_32_bits(desc_data->skb_dma)); + dma_desc->desc1 = cpu_to_le32(upper_32_bits(desc_data->skb_dma)); + + /* Update the buffer length */ + dma_desc->desc2 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc2, + TX_NORMAL_DESC2_HL_B1L_POS, + TX_NORMAL_DESC2_HL_B1L_LEN, + desc_data->skb_dma_len); + + /* VLAN tag insertion check */ + if (vlan) { + dma_desc->desc2 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc2, + TX_NORMAL_DESC2_VTIR_POS, + TX_NORMAL_DESC2_VTIR_LEN, + TX_NORMAL_DESC2_VLAN_INSERT); + pdata->stats.tx_vlan_packets++; + } + + /* Timestamp enablement check */ + if (FXGMAC_GET_REG_BITS(pkt_info->attributes, + TX_PACKET_ATTRIBUTES_PTP_POS, + TX_PACKET_ATTRIBUTES_PTP_LEN)) + dma_desc->desc2 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc2, + TX_NORMAL_DESC2_TTSE_POS, + TX_NORMAL_DESC2_TTSE_LEN, + 1); + + /* Mark it as First Descriptor */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_FD_POS, + TX_NORMAL_DESC3_FD_LEN, + 1); + + /* Mark it as a NORMAL descriptor */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_CTXT_POS, + TX_NORMAL_DESC3_CTXT_LEN, + 0); + + /* Set OWN bit if not the first descriptor */ + if (cur_index != start_index) + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_OWN_POS, + TX_NORMAL_DESC3_OWN_LEN, + 1); + + if (tso) { + /* Enable TSO */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_TSE_POS, + TX_NORMAL_DESC3_TSE_LEN, 1); + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_TCPPL_POS, + TX_NORMAL_DESC3_TCPPL_LEN, + pkt_info->tcp_payload_len); + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_TCPHDRLEN_POS, + TX_NORMAL_DESC3_TCPHDRLEN_LEN, + pkt_info->tcp_header_len / 4); + + pdata->stats.tx_tso_packets++; + } else { + /* Enable CRC and Pad Insertion */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_CPC_POS, + TX_NORMAL_DESC3_CPC_LEN, 0); + + /* Enable HW CSUM */ + if (csum) + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_CIC_POS, + TX_NORMAL_DESC3_CIC_LEN, + 0x3); + + /* Set the total length to be transmitted */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_FL_POS, + TX_NORMAL_DESC3_FL_LEN, + pkt_info->length); + } + if(netif_msg_tx_done(pdata)) DPRINTK("dev_xmit before more descs, desc cur=%d, start=%d, desc=%#x,%#x,%#x,%#x\n", + cur_index, start_index, dma_desc->desc0, dma_desc->desc1, dma_desc->desc2, dma_desc->desc3); + + if (start_index <= cur_index) + i = cur_index - start_index + 1; + else + i = ring->dma_desc_count - start_index + cur_index; + + for (; i < pkt_info->desc_count; i++) { + cur_index = FXGMAC_GET_ENTRY(cur_index, ring->dma_desc_count); + + desc_data = FXGMAC_GET_DESC_DATA(ring, cur_index); + dma_desc = desc_data->dma_desc; + + /* Update buffer address */ + dma_desc->desc0 = + cpu_to_le32(lower_32_bits(desc_data->skb_dma)); + dma_desc->desc1 = + cpu_to_le32(upper_32_bits(desc_data->skb_dma)); + + /* Update the buffer length */ + dma_desc->desc2 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc2, + TX_NORMAL_DESC2_HL_B1L_POS, + TX_NORMAL_DESC2_HL_B1L_LEN, + desc_data->skb_dma_len); + + /* Set OWN bit */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_OWN_POS, + TX_NORMAL_DESC3_OWN_LEN, 1); + + /* Mark it as NORMAL descriptor */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_CTXT_POS, + TX_NORMAL_DESC3_CTXT_LEN, 0); + + /* Enable HW CSUM */ + if (csum) + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_CIC_POS, + TX_NORMAL_DESC3_CIC_LEN, + 0x3); + } + + /* Set LAST bit for the last descriptor */ + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_LD_POS, + TX_NORMAL_DESC3_LD_LEN, 1); + + dma_desc->desc2 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc2, + TX_NORMAL_DESC2_IC_POS, + TX_NORMAL_DESC2_IC_LEN, 1); + + /* Save the Tx info to report back during cleanup */ + desc_data->tx.packets = pkt_info->tx_packets; + desc_data->tx.bytes = pkt_info->tx_bytes; + + if(netif_msg_tx_done(pdata)) DPRINTK("dev_xmit last descs, desc cur=%d, desc=%#x,%#x,%#x,%#x\n", + cur_index, dma_desc->desc0, dma_desc->desc1, dma_desc->desc2, dma_desc->desc3); + + /* In case the Tx DMA engine is running, make sure everything + * is written to the descriptor(s) before setting the OWN bit + * for the first descriptor + */ + dma_wmb(); + + /* Set OWN bit for the first descriptor */ + desc_data = FXGMAC_GET_DESC_DATA(ring, start_index); + dma_desc = desc_data->dma_desc; + dma_desc->desc3 = FXGMAC_SET_REG_BITS_LE( + dma_desc->desc3, + TX_NORMAL_DESC3_OWN_POS, + TX_NORMAL_DESC3_OWN_LEN, 1); + + if(netif_msg_tx_done(pdata)) DPRINTK("dev_xmit first descs, start=%d, desc=%#x,%#x,%#x,%#x\n", + start_index, dma_desc->desc0, dma_desc->desc1, dma_desc->desc2, dma_desc->desc3); + + if (netif_msg_tx_queued(pdata)) + fxgmac_dump_tx_desc(pdata, ring, start_index, + pkt_info->desc_count, 1); + + /* Make sure ownership is written to the descriptor */ + smp_wmb(); + + //ring->cur = cur_index + 1; + ring->cur = FXGMAC_GET_ENTRY(cur_index, ring->dma_desc_count); + +#if 0 +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) ) + if (!ring->tx.xmit_more || netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev, + channel->queue_index))) +#elif ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,1) ) + if (!pkt_info->skb->xmit_more || + netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev, + channel->queue_index))) +#else + if (netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev, + channel->queue_index))) +#endif + { + fxgmac_tx_start_xmit(channel, ring); + } + else + ring->tx.xmit_more = 1; +#endif + + fxgmac_tx_start_xmit(channel, ring); + + /* yzhang for reduce debug output */ + if(netif_msg_tx_done(pdata)){ + DPRINTK("dev_xmit callout %s: descriptors %u to %u written\n", + channel->name, start_index & (ring->dma_desc_count - 1), + (ring->cur - 1) & (ring->dma_desc_count - 1)); + } +} + +extern void fxgmac_diag_get_rx_info(struct fxgmac_channel *channel); + +static void fxgmac_get_rx_tstamp(struct fxgmac_pkt_info *pkt_info, + struct fxgmac_dma_desc *dma_desc) +{ + //u32 tsa, tsd; + u64 nsec; +#if 0 + tsa = FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_CONTEXT_DESC3_TSA_POS, + RX_CONTEXT_DESC3_TSA_LEN); + tsd = FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_CONTEXT_DESC3_TSD_POS, + RX_CONTEXT_DESC3_TSD_LEN); + if (tsa && !tsd) { +#endif + nsec = le32_to_cpu(dma_desc->desc1); + nsec <<= 32; + nsec |= le32_to_cpu(dma_desc->desc0); + if (nsec != 0xffffffffffffffffULL) { + pkt_info->rx_tstamp = nsec; + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_RX_TSTAMP_POS, + RX_PACKET_ATTRIBUTES_RX_TSTAMP_LEN, + 1); + } + //} +} + +static int fxgmac_dev_read(struct fxgmac_channel *channel) +{ + struct fxgmac_pdata *pdata = channel->pdata; + struct fxgmac_ring *ring = channel->rx_ring; + struct net_device *netdev = pdata->netdev; + struct fxgmac_desc_data *desc_data; + struct fxgmac_dma_desc *dma_desc; + struct fxgmac_pkt_info *pkt_info; + u32 ipce, iphe, rxparser; + unsigned int err, etlt; + + //unsigned int i; + static unsigned int cnt_incomplete = 0; + + desc_data = FXGMAC_GET_DESC_DATA(ring, ring->cur); + dma_desc = desc_data->dma_desc; + pkt_info = &ring->pkt_info; + + /* Check for data availability */ + if (FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_OWN_POS, + RX_NORMAL_DESC3_OWN_LEN)) + return 1; + + /* Make sure descriptor fields are read after reading the OWN bit */ + dma_rmb(); + + if (netif_msg_rx_status(pdata)) + fxgmac_dump_rx_desc(pdata, ring, ring->cur); + + if (FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_CTXT_POS, + RX_NORMAL_DESC3_CTXT_LEN)) { + /* Timestamp Context Descriptor */ + fxgmac_get_rx_tstamp(pkt_info, dma_desc); + + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_CONTEXT_POS, + RX_PACKET_ATTRIBUTES_CONTEXT_LEN, + 1); + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_POS, + RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_LEN, + 0); + if(netif_msg_rx_status(pdata)) DPRINTK("dev_read context desc,ch=%s\n",channel->name); + return 0; + } + + /* Normal Descriptor, be sure Context Descriptor bit is off */ + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_CONTEXT_POS, + RX_PACKET_ATTRIBUTES_CONTEXT_LEN, + 0); + + /* Indicate if a Context Descriptor is next */ +#if 0 + if (FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_CDA_POS, + RX_NORMAL_DESC3_CDA_LEN)) + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_POS, + RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_LEN, + 1); +#endif + /* Get the header length */ + if (FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_FD_POS, + RX_NORMAL_DESC3_FD_LEN)) { + desc_data->rx.hdr_len = FXGMAC_GET_REG_BITS_LE(dma_desc->desc2, + RX_NORMAL_DESC2_HL_POS, + RX_NORMAL_DESC2_HL_LEN); + if (desc_data->rx.hdr_len) + pdata->stats.rx_split_header_packets++; + } + +#if 0 //(FXGMAC_RSS_FEATURE_ENABLED) //20210608 + /* Get the RSS hash */ + if (FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_RSV_POS, + RX_NORMAL_DESC3_RSV_LEN)) { + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_RSS_HASH_POS, + RX_PACKET_ATTRIBUTES_RSS_HASH_LEN, + 1); + + pkt_info->rss_hash = le32_to_cpu(dma_desc->desc1); + + l34t = FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_L34T_POS, + RX_NORMAL_DESC3_L34T_LEN); + switch (l34t) { + case RX_DESC3_L34T_IPV4_TCP: + case RX_DESC3_L34T_IPV4_UDP: + case RX_DESC3_L34T_IPV6_TCP: + case RX_DESC3_L34T_IPV6_UDP: + pkt_info->rss_hash_type = PKT_HASH_TYPE_L4; + break; + default: + pkt_info->rss_hash_type = PKT_HASH_TYPE_L3; + } + } +#endif + /* Get the pkt_info length */ + desc_data->rx.len = FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_PL_POS, + RX_NORMAL_DESC3_PL_LEN); + //DPRINTK("dev_read upon FD=1, pkt_len=%u\n",desc_data->rx.len); + + if (!FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_LD_POS, + RX_NORMAL_DESC3_LD_LEN)) { + /* Not all the data has been transferred for this pkt_info */ + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_INCOMPLETE_POS, + RX_PACKET_ATTRIBUTES_INCOMPLETE_LEN, + 1); + cnt_incomplete++; + if ((cnt_incomplete < 2) && netif_msg_rx_status(pdata)) + DPRINTK("dev_read NOT last desc,pkt incomplete yet,%u\n", cnt_incomplete); + + return 0; + } + if ((cnt_incomplete) && netif_msg_rx_status(pdata)) + DPRINTK("dev_read rx back to normal and incomplete cnt=%u\n", cnt_incomplete); + cnt_incomplete = 0; //when back to normal, reset cnt + + /* This is the last of the data for this pkt_info */ + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_INCOMPLETE_POS, + RX_PACKET_ATTRIBUTES_INCOMPLETE_LEN, + 0); + + /* Set checksum done indicator as appropriate */ + if (netdev->features & NETIF_F_RXCSUM) { + ipce = FXGMAC_GET_REG_BITS_LE(desc_data->dma_desc->desc1, + RX_NORMAL_DESC1_WB_IPCE_POS, + RX_NORMAL_DESC1_WB_IPCE_LEN); + iphe = FXGMAC_GET_REG_BITS_LE(desc_data->dma_desc->desc1, + RX_NORMAL_DESC1_WB_IPHE_POS, + RX_NORMAL_DESC1_WB_IPHE_LEN); + if (!ipce && !iphe) + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_CSUM_DONE_POS, + RX_PACKET_ATTRIBUTES_CSUM_DONE_LEN, + 1); + else + return 0; + } + + /* Check for errors (only valid in last descriptor) */ + err = FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_ES_POS, + RX_NORMAL_DESC3_ES_LEN); + /* b111: Incomplete parsing due to ECC error */ + rxparser = FXGMAC_GET_REG_BITS_LE(desc_data->dma_desc->desc2, + RX_NORMAL_DESC2_WB_RAPARSER_POS, + RX_NORMAL_DESC2_WB_RAPARSER_LEN); + if (err || rxparser == 0x7) { + pkt_info->errors = FXGMAC_SET_REG_BITS(pkt_info->errors, + RX_PACKET_ERRORS_FRAME_POS, + RX_PACKET_ERRORS_FRAME_LEN, 1); + return 0; + } + + etlt = FXGMAC_GET_REG_BITS_LE(dma_desc->desc3, + RX_NORMAL_DESC3_ETLT_POS, + RX_NORMAL_DESC3_ETLT_LEN); + if ((etlt == 0x4) && + (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) { + pkt_info->attributes = FXGMAC_SET_REG_BITS( + pkt_info->attributes, + RX_PACKET_ATTRIBUTES_VLAN_CTAG_POS, + RX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN, 1); + pkt_info->vlan_ctag = + FXGMAC_GET_REG_BITS_LE(dma_desc->desc0, + RX_NORMAL_DESC0_OVT_POS, + RX_NORMAL_DESC0_OVT_LEN); + netif_dbg(pdata, rx_status, netdev, "vlan-ctag=%#06x\n", + pkt_info->vlan_ctag); + } + + return 0; +} diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-pci.c b/lede/package/kernel/yt6801/src/fuxi-gmac-pci.c new file mode 100644 index 0000000000..b891d28297 --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-pci.c @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" + +/* declarations */ +static void fxgmac_shutdown(struct pci_dev *pdev); + +static int fxgmac_probe(struct pci_dev *pcidev, const struct pci_device_id *id) +{ + struct device *dev = &pcidev->dev; + struct fxgmac_resources res; + int i, ret; + + ret = pcim_enable_device(pcidev); + if (ret) { + dev_err(dev, "ERROR: fxgmac_probe failed to enable device\n"); + return ret; + } + + for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + if (pci_resource_len(pcidev, i) == 0) + continue; + + ret = pcim_iomap_regions(pcidev, BIT(i), FXGMAC_DRV_NAME); + if (ret) + { + dev_err(dev, "fxgmac_probe pcim_iomap_regions failed\n"); + return ret; + } + /* DPRINTK(KERN_INFO "fxgmac_probe iomap_region i=%#x,ret=%#x\n",(int)i,(int)ret); */ + break; + } + + pci_set_master(pcidev); + + memset(&res, 0, sizeof(res)); + res.irq = pcidev->irq; + res.addr = pcim_iomap_table(pcidev)[i]; + + return fxgmac_drv_probe(&pcidev->dev, &res); +} + +static void fxgmac_remove(struct pci_dev *pcidev) +{ + struct net_device *netdev; + struct fxgmac_pdata *pdata; + (void)pdata; + + netdev = dev_get_drvdata(&pcidev->dev); + pdata = netdev_priv(netdev); + + fxgmac_drv_remove(&pcidev->dev); + +#ifdef CONFIG_PCI_MSI + if(FXGMAC_GET_REG_BITS(pdata->expansion.int_flags, FXGMAC_FLAG_MSIX_POS, + FXGMAC_FLAG_MSIX_LEN)){ + pci_disable_msix(pcidev); + kfree(pdata->expansion.msix_entries); + pdata->expansion.msix_entries = NULL; + } +#endif + + DPRINTK("%s has been removed\n", netdev->name); +} + +/* for Power management, 20210628 */ +static int __fxgmac_shutdown(struct pci_dev *pdev, bool *enable_wake) +{ + struct net_device *netdev = dev_get_drvdata(&pdev->dev); + struct fxgmac_pdata *pdata = netdev_priv(netdev); + u32 wufc = pdata->expansion.wol; +#ifdef CONFIG_PM + int retval = 0; +#endif + + DPRINTK("fxpm,_fxgmac_shutdown, callin\n"); + + rtnl_lock(); + + /* for linux shutdown, we just treat it as power off wol can be ignored + * for suspend, we do need recovery by wol + */ + fxgmac_net_powerdown(pdata, (unsigned int)!!wufc); + netif_device_detach(netdev); + rtnl_unlock(); + +#ifdef CONFIG_PM + retval = pci_save_state(pdev); + if (retval) { + DPRINTK("fxpm,_fxgmac_shutdown, save pci state failed.\n"); + return retval; + } +#endif + + DPRINTK("fxpm,_fxgmac_shutdown, save pci state done.\n"); + + pci_wake_from_d3(pdev, !!wufc); + *enable_wake = !!wufc; + + pci_disable_device(pdev); + + DPRINTK("fxpm,_fxgmac_shutdown callout, enable wake=%d.\n", *enable_wake); + + return 0; +} + +static void fxgmac_shutdown(struct pci_dev *pdev) +{ + struct net_device *netdev = dev_get_drvdata(&pdev->dev); + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + bool wake; + + DPRINTK("fxpm, fxgmac_shutdown callin\n"); + + fxgmac_lock(pdata); + __fxgmac_shutdown(pdev, &wake); + hw_ops->led_under_shutdown(pdata); + + if (system_state == SYSTEM_POWER_OFF) { + pci_wake_from_d3(pdev, wake); + pci_set_power_state(pdev, PCI_D3hot); + } + DPRINTK("fxpm, fxgmac_shutdown callout, system power off=%d\n", (system_state == SYSTEM_POWER_OFF)? 1 : 0); + fxgmac_unlock(pdata); +} + +#ifdef CONFIG_PM +/* yzhang, 20210628 for PM */ +static int fxgmac_suspend(struct pci_dev *pdev, + pm_message_t __always_unused state) +{ + struct net_device *netdev = dev_get_drvdata(&pdev->dev); + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int retval = 0; + bool wake; + + DPRINTK("fxpm, fxgmac_suspend callin\n"); + + fxgmac_lock(pdata); + if (pdata->expansion.dev_state != FXGMAC_DEV_START) + goto unlock; + + if (netif_running(netdev)) { + #ifdef FXGMAC_ASPM_ENABLED + fxgmac_cancel_aspm_config_work(pdata); + pdata->expansion.aspm_en = false; + pdata->expansion.aspm_work_active = false; + pdata->expansion.recover_from_aspm = false; +#endif + retval = __fxgmac_shutdown(pdev, &wake); + if (retval) + goto unlock; + } else { + wake = !!(pdata->expansion.wol); + } + hw_ops->led_under_sleep(pdata); + + if (wake) { + pci_prepare_to_sleep(pdev); + } else { + pci_wake_from_d3(pdev, false); + pci_set_power_state(pdev, PCI_D3hot); + } + + pdata->expansion.recover_phy_state = 1; + pdata->expansion.dev_state = FXGMAC_DEV_SUSPEND; + DPRINTK("fxpm, fxgmac_suspend callout to %s\n", wake ? "sleep" : "D3hot"); + +unlock: + fxgmac_unlock(pdata); + return retval; +} + +static int fxgmac_resume(struct pci_dev *pdev) +{ + struct net_device *netdev = dev_get_drvdata(&pdev->dev); + struct fxgmac_pdata *pdata = netdev_priv(netdev); + u32 err = 0; + + DPRINTK("fxpm, fxgmac_resume callin\n"); + + fxgmac_lock(pdata); + if (pdata->expansion.dev_state != FXGMAC_DEV_SUSPEND) + goto unlock; + + pdata->expansion.dev_state = FXGMAC_DEV_RESUME; + + pci_set_power_state(pdev, PCI_D0); + pci_restore_state(pdev); + /* + * pci_restore_state clears dev->state_saved so call + * pci_save_state to restore it. + */ + pci_save_state(pdev); + + err = pci_enable_device_mem(pdev); + if (err) { + dev_err(pdata->dev, "fxgmac_resume, failed to enable PCI device from suspend\n"); + goto unlock; + } + smp_mb__before_atomic(); + __clear_bit(FXGMAC_POWER_STATE_DOWN, &pdata->expansion.powerstate); + pci_set_master(pdev); + + pci_wake_from_d3(pdev, false); + + rtnl_lock(); + err = 0; + if (!err && netif_running(netdev)) + fxgmac_net_powerup(pdata); + + if (!err) + netif_device_attach(netdev); + + rtnl_unlock(); + + DPRINTK("fxpm, fxgmac_resume callout\n"); +unlock: + fxgmac_unlock(pdata); + return err; +} +#endif + +static const struct pci_device_id fxgmac_pci_tbl[] = { + { PCI_DEVICE(0x1f0a, 0x6801) }, + { 0 } +}; +MODULE_DEVICE_TABLE(pci, fxgmac_pci_tbl); + +static struct pci_driver fxgmac_pci_driver = { + .name = FXGMAC_DRV_NAME, + .id_table = fxgmac_pci_tbl, + .probe = fxgmac_probe, + .remove = fxgmac_remove, +#ifdef CONFIG_PM + /* currently, we only use USE_LEGACY_PM_SUPPORT */ + .suspend = fxgmac_suspend, + .resume = fxgmac_resume, +#endif + .shutdown = fxgmac_shutdown, +}; + +module_pci_driver(fxgmac_pci_driver); + +MODULE_DESCRIPTION(FXGMAC_DRV_DESC); +MODULE_VERSION(FXGMAC_DRV_VERSION); +MODULE_AUTHOR("Motorcomm Electronic Tech. Co., Ltd."); +MODULE_LICENSE("GPL"); diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-phy.c b/lede/package/kernel/yt6801/src/fuxi-gmac-phy.c new file mode 100644 index 0000000000..b2e9455b98 --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-phy.c @@ -0,0 +1,373 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#include "fuxi-gmac.h" +#include "fuxi-gmac-reg.h" + +/* + * When in forced mode, set the speed, duplex, and auto-negotiation of the PHY + * all at once to avoid the problems caused by individual settings + * on some machines + */ +int fxgmac_phy_force_mode(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_ops* hw_ops = &pdata->hw_ops; + u32 regval = 0; + unsigned int high_bit = 0, low_bit = 0; + int ret = 0; + + switch (pdata->phy_speed) + { + case SPEED_1000: + high_bit = 1, low_bit = 0; + break; + case SPEED_100: + high_bit = 0, low_bit = 1; + break; + case SPEED_10: + high_bit = 0, low_bit = 0; + break; + default: + break; + } + + hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, ®val); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_AUTOENG_POS, PHY_CR_AUTOENG_LEN, pdata->phy_autoeng); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_SPEED_SEL_H_POS, PHY_CR_SPEED_SEL_H_LEN, high_bit); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_SPEED_SEL_L_POS, PHY_CR_SPEED_SEL_L_LEN, low_bit); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_DUPLEX_POS, PHY_CR_DUPLEX_LEN, pdata->phy_duplex); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_RESET_POS, PHY_CR_RESET_LEN, 1); + ret = hw_ops->write_ephy_reg(pdata, REG_MII_BMCR, regval); + return ret; +} + +int fxgmac_phy_force_speed(struct fxgmac_pdata *pdata, int speed) +{ + struct fxgmac_hw_ops* hw_ops = &pdata->hw_ops; + u32 regval = 0; + unsigned int high_bit = 0, low_bit = 0; + int ret = 0; + + switch (speed) + { + case SPEED_1000: + high_bit = 1, low_bit = 0; + break; + case SPEED_100: + high_bit = 0, low_bit = 1; + break; + case SPEED_10: + high_bit = 0, low_bit = 0; + break; + default: + break; + } + + hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, ®val); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_SPEED_SEL_H_POS, PHY_CR_SPEED_SEL_H_LEN, high_bit); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_SPEED_SEL_L_POS, PHY_CR_SPEED_SEL_L_LEN, low_bit); + ret = hw_ops->write_ephy_reg(pdata, REG_MII_BMCR, regval); + return ret; +} + +int fxgmac_phy_force_duplex(struct fxgmac_pdata *pdata, int duplex) +{ + struct fxgmac_hw_ops* hw_ops = &pdata->hw_ops; + u32 regval = 0; + int ret = 0; + + hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, ®val); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_DUPLEX_POS, PHY_CR_DUPLEX_LEN, (duplex ? 1 : 0)); + hw_ops->write_ephy_reg(pdata, REG_MII_BMCR, regval); + return ret; +} + +int fxgmac_phy_force_autoneg(struct fxgmac_pdata *pdata, int autoneg) +{ + struct fxgmac_hw_ops* hw_ops = &pdata->hw_ops; + u32 regval = 0; + int ret = 0; + + hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, ®val); + regval = FXGMAC_SET_REG_BITS(regval, PHY_CR_AUTOENG_POS, PHY_CR_AUTOENG_LEN, (autoneg? 1 : 0)); + ret = hw_ops->write_ephy_reg(pdata, REG_MII_BMCR, regval); + return ret; +} + +void fxgmac_set_phy_link_ksettings(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + pdata->phy_speed = pdata->expansion.pre_phy_speed; + pdata->phy_duplex = pdata->expansion.pre_phy_duplex; + pdata->phy_autoeng = pdata->expansion.pre_phy_autoneg; + + if (pdata->phy_autoeng || (!pdata->phy_autoeng && pdata->phy_speed == SPEED_1000)) + hw_ops->phy_config(pdata); + else + fxgmac_phy_force_mode(pdata); +} + +int fxgmac_ephy_soft_reset(struct fxgmac_pdata *pdata) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int ret; + volatile unsigned int val; + int busy = 15; + + ret = hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, (unsigned int *)&val); + if (0 > ret) + goto busy_exit; + + ret = hw_ops->write_ephy_reg(pdata, REG_MII_BMCR, (val | 0x8000)); + if (0 > ret) + goto busy_exit; + + do { + ret = hw_ops->read_ephy_reg(pdata, REG_MII_BMCR, (unsigned int *)&val); + busy--; + //DPRINTK("fxgmac_ephy_soft_reset, check busy=%d.\n", busy); + }while((ret == 0) && (0 != (val & 0x8000)) && (busy)); + + if(0 == (val & 0x8000)) return 0; + + DPRINTK("fxgmac_ephy_soft_reset, timeout, busy=%d.\n", busy); + return -EBUSY; + +busy_exit: + DPRINTK("fxgmac_ephy_soft_reset exit due to ephy reg access fail.\n"); + + return ret; +} + +/* this function used to double check the speed. for fiber, to correct there is no 10M */ +static int fxgmac_ephy_adjust_status(u32 lport, int val, int is_utp, int* speed, int* duplex) +{ + int speed_mode; + + *speed = -1; + *duplex = (val & BIT(FXGMAC_EPHY_DUPLEX_BIT)) >> FXGMAC_EPHY_DUPLEX_BIT; + speed_mode = (val & FXGMAC_EPHY_SPEED_MODE) >> FXGMAC_EPHY_SPEED_MODE_BIT; + switch (speed_mode) { + case 0: + if (is_utp) + *speed = SPEED_10M; + break; + case 1: + *speed = SPEED_100M; + break; + case 2: + *speed = SPEED_1000M; + break; + case 3: + break; + default: + break; + } + + return 0; +} + +/* + * this function for polling to get status of ephy link. + * output: + * speed: SPEED_10M, SPEED_100M, SPEED_1000M or -1; + * duplex: 0 or 1, see reg 0x11, bit YT8614_DUPLEX_BIT. + * ret_link: 0 or 1, link down or up. + * media: only valid when ret_link=1, (YT8614_SMI_SEL_SDS_SGMII + 1) for fiber; (YT8614_SMI_SEL_PHY + 1) for utp. -1 for link down. + */ +int fxgmac_ephy_status_get(struct fxgmac_pdata *pdata, int* speed, int* duplex, int* ret_link, int *media) +{ + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + int ret; + u16 reg; + volatile unsigned int val; + volatile int link; + int link_utp = 0, link_fiber = 0; + + reg = REG_MII_SPEC_STATUS; + ret = hw_ops->read_ephy_reg(pdata, reg, (unsigned int *)&val); + if (0 > ret) + goto busy_exit; + + link = val & (BIT(FXGMAC_EPHY_LINK_STATUS_BIT)); + if (link) { + link_utp = 1; + fxgmac_ephy_adjust_status(0, val, 1, speed, duplex); + } else { + link_utp = 0; + } + + if (link_utp || link_fiber) { + /* case of fiber of priority */ + if(link_utp) *media = (FXGMAC_EPHY_SMI_SEL_PHY + 1); + if(link_fiber) *media = (FXGMAC_EPHY_SMI_SEL_SDS_SGMII + 1); + + *ret_link = 1; + } else + { + *ret_link = 0; + *media = -1; + *speed= -1; + *duplex = -1; + } + + return 0; + +busy_exit: + DPRINTK("fxgmac_ephy_status_get exit due to ephy reg access fail.\n"); + + return ret; +} + +/* + * fxgmac_phy_update_link - update the phy link status + * @adapter: pointer to the device adapter structure + */ +void fxgmac_phy_update_link(struct net_device *netdev) +{ + struct fxgmac_pdata *pdata = netdev_priv(netdev); + struct fxgmac_hw_ops *hw_ops = &pdata->hw_ops; + u32 regval, cur_link, cur_speed; + + regval = hw_ops->get_ephy_state(pdata); + // We should make sure that PHY is done with the reset + if (!(regval & BIT(MGMT_EPHY_CTRL_RESET_POS)) && + (pdata->expansion.dev_state != FXGMAC_DEV_CLOSE)) { + pdata->expansion.phy_link = false; + return; + } + + cur_speed = FXGMAC_GET_REG_BITS(regval, + MGMT_EPHY_CTRL_STA_SPEED_POS, + MGMT_EPHY_CTRL_STA_SPEED_LEN); + pdata->phy_speed = (cur_speed == 2) ? SPEED_1000 : + (cur_speed == 1) ? SPEED_100 : SPEED_10; + pdata->phy_duplex = FXGMAC_GET_REG_BITS(regval, + MGMT_EPHY_CTRL_STA_EPHY_DUPLEX_POS, + MGMT_EPHY_CTRL_STA_EPHY_DUPLEX_LEN); + cur_link = FXGMAC_GET_REG_BITS(regval, + MGMT_EPHY_CTRL_STA_EPHY_LINKUP_POS, + MGMT_EPHY_CTRL_STA_EPHY_LINKUP_LEN); + if(pdata->expansion.phy_link != cur_link) { + hw_ops->read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL); + hw_ops->read_ephy_reg(pdata, REG_MII_INT_STATUS, NULL); + + if (cur_link) { +#ifdef FXGMAC_ASPM_ENABLED + if (fxgmac_aspm_action_linkup(pdata)) + return; +#endif + hw_ops->config_mac_speed(pdata); + hw_ops->enable_rx(pdata); + hw_ops->enable_tx(pdata); + hw_ops->read_ephy_reg(pdata, REG_MII_LPA, ®val); + if (FXGMAC_GET_REG_BITS(regval, PHY_MII_LINK_PARNTNER_10FULL_POS, PHY_MII_LINK_PARNTNER_10FULL_LEN) + || FXGMAC_GET_REG_BITS(regval, PHY_MII_LINK_PARNTNER_10HALF_POS, PHY_MII_LINK_PARNTNER_10HALF_LEN)) + { + pdata->support_10m_link = true; + } + pdata->expansion.pre_phy_speed = pdata->phy_speed; + pdata->expansion.pre_phy_duplex = pdata->phy_duplex; + pdata->expansion.pre_phy_autoneg = pdata->phy_autoeng; + netif_carrier_on(pdata->netdev); + if (netif_running(pdata->netdev)) + { + netif_tx_wake_all_queues(pdata->netdev); + dev_info(pdata->dev, "%s now is link up, mac_speed=%d.\n", + netdev_name(pdata->netdev), + pdata->phy_speed); + } + }else { + netif_carrier_off(pdata->netdev); + netif_tx_stop_all_queues(pdata->netdev); + pdata->phy_speed = SPEED_UNKNOWN; + pdata->phy_duplex = DUPLEX_UNKNOWN; + pdata->support_10m_link = false; + hw_ops->disable_rx(pdata); + hw_ops->disable_tx(pdata); +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED + if (pdata->expansion.lb_cable_flag) { + hw_ops->clean_cable_loopback(pdata); + pdata->expansion.lb_cable_flag = 0; + } +#endif + +#ifdef FXGMAC_ASPM_ENABLED + fxgmac_schedule_aspm_config_work(pdata); +#endif + dev_info(pdata->dev, "%s now is link down\n", netdev_name(pdata->netdev)); + } + pdata->expansion.phy_link = cur_link; + } +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) +static void fxgmac_phy_link_poll(struct timer_list *t) +#else +static void fxgmac_phy_link_poll(unsigned long data) +#endif +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) + struct fxgmac_pdata *pdata = from_timer(pdata, t, expansion.phy_poll_tm); +#else + struct fxgmac_pdata *pdata = (struct fxgmac_pdata*)data; +#endif + + if(NULL == pdata->netdev) + { + DPRINTK("fxgmac_phy_timer polling with NULL netdev %lx\n",(unsigned long)(pdata->netdev)); + return; + } + + pdata->stats.ephy_poll_timer_cnt++; + +#if FXGMAC_PM_FEATURE_ENABLED + if(!test_bit(FXGMAC_POWER_STATE_DOWN, &pdata->expansion.powerstate)) +#endif + { + mod_timer(&pdata->expansion.phy_poll_tm,jiffies + HZ / 2); + fxgmac_phy_update_link(pdata->netdev); + }else { + DPRINTK("fxgmac_phy_timer polling, powerstate changed, %ld, netdev=%lx, tm=%lx\n", pdata->expansion.powerstate, (unsigned long)(pdata->netdev), (unsigned long)&pdata->expansion.phy_poll_tm); + } + //DPRINTK("fxgmac_phy_timer polled,%d\n",cnt_polling); +} + +int fxgmac_phy_timer_init(struct fxgmac_pdata *pdata) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) + init_timer_key(&pdata->expansion.phy_poll_tm, NULL, 0, "fuxi_phy_link_update_timer", NULL); +#else + init_timer_key(&pdata->expansion.phy_poll_tm, 0, "fuxi_phy_link_update_timer", NULL); +#endif + pdata->expansion.phy_poll_tm.expires = jiffies + HZ / 2; + pdata->expansion.phy_poll_tm.function = (void *)(fxgmac_phy_link_poll); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)) + pdata->expansion.phy_poll_tm.data = (unsigned long)pdata; +#endif + add_timer(&pdata->expansion.phy_poll_tm); + + DPRINTK("fxgmac_phy_timer started, %lx\n", jiffies); + return 0; +} + +void fxgmac_phy_timer_destroy(struct fxgmac_pdata *pdata) +{ + del_timer_sync(&pdata->expansion.phy_poll_tm); + DPRINTK("fxgmac_phy_timer removed\n"); +} diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac-reg.h b/lede/package/kernel/yt6801/src/fuxi-gmac-reg.h new file mode 100644 index 0000000000..e563502bef --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac-reg.h @@ -0,0 +1,2046 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#ifndef __FXGMAC_GMAC_REG_H__ +#define __FXGMAC_GMAC_REG_H__ + +#define AISC_MODE + +#define FXGMAC_REV_01 0x01 // The first NTO version. +#define FXGMAC_REV_03 0x03 // ECO back on 07/2023. + +/* MAC register offsets */ +#define MAC_OFFSET 0x2000 +#define MAC_CR 0x0000 //The MAC Configuration Register +#define MAC_ECR 0x0004 +#define MAC_PFR 0x0008 +#define MAC_WTR 0x000c +#define MAC_HTR0 0x0010 +#define MAC_VLANTR 0x0050 +#define MAC_VLANHTR 0x0058 +#define MAC_VLANIR 0x0060 +#define MAC_IVLANIR 0x0064 +#define MAC_Q0TFCR 0x0070 +#define MAC_RFCR 0x0090 +#define MAC_RQC0R 0x00a0 +#define MAC_RQC1R 0x00a4 +#define MAC_RQC2R 0x00a8 +#define MAC_RQC3R 0x00ac +#define MAC_ISR 0x00b0 +#define MAC_IER 0x00b4 +#define MAC_TX_RX_STA 0x00b8 +#define MAC_PMT_STA 0x00c0 +#define MAC_RWK_PAC 0x00c4 // This is the FIFO address, the pointer will be increased automatically after writing. +#define MAC_LPI_STA 0x00d0 +#define MAC_LPI_CONTROL 0x00d4 +#define MAC_LPI_TIMER 0x00d8 +#define MAC_MS_TIC_COUNTER 0x00dc +#define MAC_AN_CR 0x00e0 +#define MAC_AN_SR 0x00e4 +#define MAC_AN_ADV 0x00e8 +#define MAC_AN_LPA 0x00ec +#define MAC_AN_EXP 0x00f0 +#define MAC_PHYIF_STA 0x00f8 +#define MAC_VR 0x0110 +#define MAC_DBG_STA 0x0114 +#define MAC_HWF0R 0x011c +#define MAC_HWF1R 0x0120 +#define MAC_HWF2R 0x0124 +#define MAC_HWF3R 0x0128 +#define MAC_MDIO_ADDRESS 0x0200 +#define MAC_MDIO_DATA 0x0204 +#define MAC_GPIOCR 0x0208 +#define MAC_GPIO_SR 0x020c +#define MAC_ARP_PROTO_ADDR 0x0210 +#define MAC_CSR_SW_CTRL 0x0230 + +#define MAC_MACA0HR 0x0300 // mac[5]->bit15:8, mac[4]->bit7:0 +#define MAC_MACA0LR 0x0304 // mac[0]->bit7:0, mac[1]->bit15:8, mac[2]->bit23:16, mac[3]->bit31:24 + +#define MAC_MACA1HR 0x0308 +#define MAC_MACA1HR_AE_POS 31 +#define MAC_MACA1HR_AE_LEN 1 + +#define MAC_MACA1LR 0x030c + + +#define MAC_RSSCR 0x3c80//TODO +#define MAC_RSSAR 0x3c88//TODO +#define MAC_RSSDR 0x3c8c//TODO + + +#define MAC_QTFCR_INC 4 +#define MAC_MACA_INC 4 +#define MAC_HTR_INC 4 +#define MAC_RQC2_INC 4 +#define MAC_RQC2_Q_PER_REG 4 + +/* MAC register entry bit positions and sizes */ +#define MAC_HWF0R_ADDMACADRSEL_POS 18 +#define MAC_HWF0R_ADDMACADRSEL_LEN 5 +#define MAC_HWF0R_ARPOFFSEL_POS 9 +#define MAC_HWF0R_ARPOFFSEL_LEN 1 +#define MAC_HWF0R_EEESEL_POS 13 +#define MAC_HWF0R_EEESEL_LEN 1 +#define MAC_HWF0R_ACTPHYIFSEL_POS 28 +#define MAC_HWF0R_ACTPHYIFSEL_LEN 3 +#define MAC_HWF0R_MGKSEL_POS 7 +#define MAC_HWF0R_MGKSEL_LEN 1 +#define MAC_HWF0R_MMCSEL_POS 8 +#define MAC_HWF0R_MMCSEL_LEN 1 +#define MAC_HWF0R_RWKSEL_POS 6 +#define MAC_HWF0R_RWKSEL_LEN 1 +#define MAC_HWF0R_RXCOESEL_POS 16 +#define MAC_HWF0R_RXCOESEL_LEN 1 +#define MAC_HWF0R_SAVLANINS_POS 27 +#define MAC_HWF0R_SAVLANINS_LEN 1 +#define MAC_HWF0R_SMASEL_POS 5 +#define MAC_HWF0R_SMASEL_LEN 1 +#define MAC_HWF0R_TSSEL_POS 12 +#define MAC_HWF0R_TSSEL_LEN 1 +#define MAC_HWF0R_TSSTSSEL_POS 25 +#define MAC_HWF0R_TSSTSSEL_LEN 2 +#define MAC_HWF0R_TXCOESEL_POS 14 +#define MAC_HWF0R_TXCOESEL_LEN 1 +#define MAC_HWF0R_VLHASH_POS 4 +#define MAC_HWF0R_VLHASH_LEN 1 +#define MAC_HWF1R_ADDR64_POS 14 +#define MAC_HWF1R_ADDR64_LEN 2 +#define MAC_HWF1R_ADVTHWORD_POS 13 +#define MAC_HWF1R_ADVTHWORD_LEN 1 +#define MAC_HWF1R_DBGMEMA_POS 19 +#define MAC_HWF1R_DBGMEMA_LEN 1 +#define MAC_HWF1R_DCBEN_POS 16 +#define MAC_HWF1R_DCBEN_LEN 1 +#define MAC_HWF1R_HASHTBLSZ_POS 24 +#define MAC_HWF1R_HASHTBLSZ_LEN 2 +#define MAC_HWF1R_L3L4FNUM_POS 27 +#define MAC_HWF1R_L3L4FNUM_LEN 4 +//#define MAC_HWF1R_NUMTC_POS 21 +//#define MAC_HWF1R_NUMTC_LEN 3 +//#define MAC_HWF1R_RSSEN_POS 20 +//#define MAC_HWF1R_RSSEN_LEN 1 +#define MAC_HWF1R_RAVSEL_POS 21 +#define MAC_HWF1R_RAVSEL_LEN 1 +#define MAC_HWF1R_AVSEL_POS 20 +#define MAC_HWF1R_AVSEL_LEN 1 +#define MAC_HWF1R_RXFIFOSIZE_POS 0 +#define MAC_HWF1R_RXFIFOSIZE_LEN 5 +#define MAC_HWF1R_SPHEN_POS 17 +#define MAC_HWF1R_SPHEN_LEN 1 +#define MAC_HWF1R_TSOEN_POS 18 +#define MAC_HWF1R_TSOEN_LEN 1 +#define MAC_HWF1R_TXFIFOSIZE_POS 6 +#define MAC_HWF1R_TXFIFOSIZE_LEN 5 +#define MAC_HWF2R_AUXSNAPNUM_POS 28 +#define MAC_HWF2R_AUXSNAPNUM_LEN 3 +#define MAC_HWF2R_PPSOUTNUM_POS 24 +#define MAC_HWF2R_PPSOUTNUM_LEN 3 +#define MAC_HWF2R_RXCHCNT_POS 12 +#define MAC_HWF2R_RXCHCNT_LEN 4 +#define MAC_HWF2R_RXQCNT_POS 0 +#define MAC_HWF2R_RXQCNT_LEN 4 +#define MAC_HWF2R_TXCHCNT_POS 18 +#define MAC_HWF2R_TXCHCNT_LEN 4 +#define MAC_HWF2R_TXQCNT_POS 6 +#define MAC_HWF2R_TXQCNT_LEN 4 +#define MAC_IER_TSIE_POS 12 +#define MAC_IER_TSIE_LEN 1 +#define MAC_ISR_MMCRXIS_POS 9 +#define MAC_ISR_MMCRXIS_LEN 1 +#define MAC_ISR_MMCTXIS_POS 10 +#define MAC_ISR_MMCTXIS_LEN 1 +#define MAC_ISR_PMTIS_POS 4 +#define MAC_ISR_PMTIS_LEN 1 +#define MAC_ISR_TSIS_POS 12 +#define MAC_ISR_TSIS_LEN 1 +#define MAC_MACA1HR_AE_POS 31 +#define MAC_MACA1HR_AE_LEN 1 +#define MAC_PFR_HMC_POS 2 +#define MAC_PFR_HMC_LEN 1 +#define MAC_PFR_HPF_POS 10 +#define MAC_PFR_HPF_LEN 1 +#define MAC_PFR_PM_POS 4 // Pass all Multicast. +#define MAC_PFR_PM_LEN 1 +#define MAC_PFR_DBF_POS 5 // Disable Broadcast Packets. +#define MAC_PFR_DBF_LEN 1 +#define MAC_PFR_HUC_POS 1 // Hash Unicast. 0x0 (DISABLE). compares the DA field with the values programmed in DA registers. +#define MAC_PFR_HUC_LEN 1 +#define MAC_PFR_PR_POS 0 // Enable Promiscuous Mode. +#define MAC_PFR_PR_LEN 1 +#define MAC_PFR_VTFE_POS 16 +#define MAC_PFR_VTFE_LEN 1 +#define MAC_Q0TFCR_PT_POS 16 +#define MAC_Q0TFCR_PT_LEN 16 +#define MAC_Q0TFCR_TFE_POS 1 +#define MAC_Q0TFCR_TFE_LEN 1 +#define MAC_CR_ARPEN_POS 31 +#define MAC_CR_ARPEN_LEN 1 +#define MAC_CR_ACS_POS 20 +#define MAC_CR_ACS_LEN 1 +#define MAC_CR_CST_POS 21 +#define MAC_CR_CST_LEN 1 +#define MAC_CR_IPC_POS 27 +#define MAC_CR_IPC_LEN 1 +#define MAC_CR_JE_POS 16 +#define MAC_CR_JE_LEN 1 +#define MAC_CR_LM_POS 12 +#define MAC_CR_LM_LEN 1 +#define MAC_CR_RE_POS 0 +#define MAC_CR_RE_LEN 1 +#define MAC_CR_PS_POS 15 +#define MAC_CR_PS_LEN 1 +#define MAC_CR_FES_POS 14 +#define MAC_CR_FES_LEN 1 +#define MAC_CR_DM_POS 13 +#define MAC_CR_DM_LEN 1 +#define MAC_CR_TE_POS 1 +#define MAC_CR_TE_LEN 1 +#define MAC_ECR_DCRCC_POS 16 +#define MAC_ECR_DCRCC_LEN 1 +#define MAC_ECR_HDSMS_POS 20 +#define MAC_ECR_HDSMS_LEN 3 +#define MAC_RFCR_PFCE_POS 8 +#define MAC_RFCR_PFCE_LEN 1 +#define MAC_RFCR_RFE_POS 0 +#define MAC_RFCR_RFE_LEN 1 +#define MAC_RFCR_UP_POS 1 +#define MAC_RFCR_UP_LEN 1 +#define MAC_RQC0R_RXQ0EN_POS 0 +#define MAC_RQC0R_RXQ0EN_LEN 2 +#define MAC_LPIIE_POS 5 +#define MAC_LPIIE_LEN 1 +#define MAC_LPIATE_POS 20 +#define MAC_LPIATE_LEN 1 +#define MAC_LPITXA_POS 19 +#define MAC_LPITXA_LEN 1 +#define MAC_PLS_POS 17 +#define MAC_PLS_LEN 1 +#define MAC_LPIEN_POS 16 +#define MAC_LPIEN_LEN 1 +#define MAC_LPI_ENTRY_TIMER 8 +#define MAC_LPIET_POS 3 +#define MAC_LPIET_LEN 17 +#define MAC_TWT_TIMER 0x10 +#define MAC_TWT_POS 0 +#define MAC_TWT_LEN 16 +#define MAC_LST_TIMER 2 +#define MAC_LST_POS 16 +#define MAC_LST_LEN 10 +#define MAC_MS_TIC 24 +#define MAC_MS_TIC_POS 0 +#define MAC_MS_TIC_LEN 12 + +/* RSS table */ +#define MAC_RSSAR_ADDRT_POS 2 +#define MAC_RSSAR_ADDRT_LEN 1 +#define MAC_RSSAR_CT_POS 1 +#define MAC_RSSAR_CT_LEN 1 +#define MAC_RSSAR_OB_POS 0 +#define MAC_RSSAR_OB_LEN 1 +#define MAC_RSSAR_RSSIA_POS 8 +#define MAC_RSSAR_RSSIA_LEN 8 + +/* RSS control and options */ +/* note, below options definitions are used only for pdata->options, + * not for register, so the position is not consistent with register. + * [0] ipv4 + * [1] tcpv4 + * [2] udpv4 + * [3] ipv6 + * [4] tcpv6 + * [5] udpv6 + */ +#define MAC_RSSCR_IP4TE_POS 0 +#define MAC_RSSCR_IP4TE_LEN 1 +#define MAC_RSSCR_IP6TE_POS 3 +#define MAC_RSSCR_IP6TE_LEN 1 +#define MAC_RSSCR_TCP4TE_POS 1 +#define MAC_RSSCR_TCP4TE_LEN 1 +#define MAC_RSSCR_UDP4TE_POS 2 +#define MAC_RSSCR_UDP4TE_LEN 1 +#define MAC_RSSCR_TCP6TE_POS 4 +#define MAC_RSSCR_TCP6TE_LEN 1 +#define MAC_RSSCR_UDP6TE_POS 5 +#define MAC_RSSCR_UDP6TE_LEN 1 + +/* RSS indirection table */ +#define MAC_RSSDR_DMCH_POS 0 +#define MAC_RSSDR_DMCH_LEN 2 + +#define MAC_VLANHTR_VLHT_POS 0 +#define MAC_VLANHTR_VLHT_LEN 16 +#define MAC_VLANIR_VLTI_POS 20 +#define MAC_VLANIR_VLTI_LEN 1 +#define MAC_VLANIR_CSVL_POS 19 +#define MAC_VLANIR_CSVL_LEN 1 +#define MAC_VLANIR_VLP_POS 18 +#define MAC_VLANIR_VLP_LEN 1 +#define MAC_VLANIR_VLC_POS 16 +#define MAC_VLANIR_VLC_LEN 2 +#define MAC_VLANIR_VLT_POS 0 +#define MAC_VLANIR_VLT_LEN 16 +#define MAC_VLANTR_DOVLTC_POS 20 +#define MAC_VLANTR_DOVLTC_LEN 1 +#define MAC_VLANTR_ERSVLM_POS 19 +#define MAC_VLANTR_ERSVLM_LEN 1 +#define MAC_VLANTR_ESVL_POS 18 +#define MAC_VLANTR_ESVL_LEN 1 +#define MAC_VLANTR_ETV_POS 16 +#define MAC_VLANTR_ETV_LEN 1 +#define MAC_VLANTR_EVLS_POS 21 +#define MAC_VLANTR_EVLS_LEN 2 +#define MAC_VLANTR_EVLRXS_POS 24 +#define MAC_VLANTR_EVLRXS_LEN 1 +#define MAC_VLANTR_VL_POS 0 +#define MAC_VLANTR_VL_LEN 16 +#define MAC_VLANTR_VTHM_POS 25 +#define MAC_VLANTR_VTHM_LEN 1 +#define MAC_VLANTR_VTIM_POS 17 +#define MAC_VLANTR_VTIM_LEN 1 +#define MAC_VR_DEVID_POS 16 +#define MAC_VR_DEVID_LEN 16 +#define MAC_VR_SVER_POS 0 +#define MAC_VR_SVER_LEN 8 +#define MAC_VR_USERVER_POS 8 +#define MAC_VR_USERVER_LEN 8 + +#define MAC_DBG_STA_TX_BUSY 0x70000 +#define MTL_TXQ_DEG_TX_BUSY 0x10 + +#define MAC_MDIO_ADDRESS_BUSY 1 //bit 0 + +#define MAC_MDIO_ADDR_GOC_POS 2 +#define MAC_MDIO_ADDR_GOC_LEN 2 +#define MAC_MDIO_ADDR_GB_POS 0 +#define MAC_MDIO_ADDR_GB_LEN 1 + +#define MAC_MDIO_DATA_RA_POS 16 +#define MAC_MDIO_DATA_RA_LEN 16 +#define MAC_MDIO_DATA_GD_POS 0 +#define MAC_MDIO_DATA_GD_LEN 16 + +/* bit definitions for PMT and WOL, 20210622 */ +#define MAC_PMT_STA_PWRDWN_POS 0 +#define MAC_PMT_STA_PWRDWN_LEN 1 +#define MAC_PMT_STA_MGKPKTEN_POS 1 +#define MAC_PMT_STA_MGKPKTEN_LEN 1 +#define MAC_PMT_STA_RWKPKTEN_POS 2 +#define MAC_PMT_STA_RWKPKTEN_LEN 1 +#define MAC_PMT_STA_MGKPRCVD_POS 5 +#define MAC_PMT_STA_MGKPRCVD_LEN 1 +#define MAC_PMT_STA_RWKPRCVD_POS 6 +#define MAC_PMT_STA_RWKPRCVD_LEN 1 +#define MAC_PMT_STA_GLBLUCAST_POS 9 +#define MAC_PMT_STA_GLBLUCAST_LEN 1 +#define MAC_PMT_STA_RWKPTR_POS 24 +#define MAC_PMT_STA_RWKPTR_LEN 4 +#define MAC_PMT_STA_RWKFILTERST_POS 31 +#define MAC_PMT_STA_RWKFILTERST_LEN 1 + +/* MMC register offsets */ +#define MMC_CR 0x0700 +#define MMC_RISR 0x0704 +#define MMC_TISR 0x0708 +#define MMC_RIER 0x070c +#define MMC_TIER 0x0710 +#define MMC_TXOCTETCOUNT_GB_LO 0x0714 +#define MMC_TXFRAMECOUNT_GB_LO 0x0718 +#define MMC_TXBROADCASTFRAMES_G_LO 0x071c +#define MMC_TXMULTICASTFRAMES_G_LO 0x0720 +#define MMC_TX64OCTETS_GB_LO 0x0724 +#define MMC_TX65TO127OCTETS_GB_LO 0x0728 +#define MMC_TX128TO255OCTETS_GB_LO 0x072c +#define MMC_TX256TO511OCTETS_GB_LO 0x0730 +#define MMC_TX512TO1023OCTETS_GB_LO 0x0734 +#define MMC_TX1024TOMAXOCTETS_GB_LO 0x0738 +#define MMC_TXUNICASTFRAMES_GB_LO 0x073c +#define MMC_TXMULTICASTFRAMES_GB_LO 0x0740 +#define MMC_TXBROADCASTFRAMES_GB_LO 0x0744 +#define MMC_TXUNDERFLOWERROR_LO 0x0748 +#define MMC_TXSINGLECOLLISION_G 0x074c +#define MMC_TXMULTIPLECOLLISION_G 0x0750 +#define MMC_TXDEFERREDFRAMES 0x0754 +#define MMC_TXLATECOLLISIONFRAMES 0x0758 +#define MMC_TXEXCESSIVECOLLSIONFRAMES 0x075c +#define MMC_TXCARRIERERRORFRAMES 0x0760 +#define MMC_TXOCTETCOUNT_G_LO 0x0764 +#define MMC_TXFRAMECOUNT_G_LO 0x0768 +#define MMC_TXEXCESSIVEDEFERRALERROR 0x076c +#define MMC_TXPAUSEFRAMES_LO 0x0770 +#define MMC_TXVLANFRAMES_G_LO 0x0774 +#define MMC_TXOVERSIZEFRAMES 0x0778 +#define MMC_RXFRAMECOUNT_GB_LO 0x0780 +#define MMC_RXOCTETCOUNT_GB_LO 0x0784 +#define MMC_RXOCTETCOUNT_G_LO 0x0788 +#define MMC_RXBROADCASTFRAMES_G_LO 0x078c +#define MMC_RXMULTICASTFRAMES_G_LO 0x0790 +#define MMC_RXCRCERROR_LO 0x0794 +#define MMC_RXALIGNERROR 0x0798 +#define MMC_RXRUNTERROR 0x079c +#define MMC_RXJABBERERROR 0x07a0 +#define MMC_RXUNDERSIZE_G 0x07a4 +#define MMC_RXOVERSIZE_G 0x07a8 +#define MMC_RX64OCTETS_GB_LO 0x07ac +#define MMC_RX65TO127OCTETS_GB_LO 0x07b0 +#define MMC_RX128TO255OCTETS_GB_LO 0x07b4 +#define MMC_RX256TO511OCTETS_GB_LO 0x07b8 +#define MMC_RX512TO1023OCTETS_GB_LO 0x07bc +#define MMC_RX1024TOMAXOCTETS_GB_LO 0x07c0 +#define MMC_RXUNICASTFRAMES_G_LO 0x07c4 +#define MMC_RXLENGTHERROR_LO 0x07c8 +#define MMC_RXOUTOFRANGETYPE_LO 0x07cc +#define MMC_RXPAUSEFRAMES_LO 0x07d0 +#define MMC_RXFIFOOVERFLOW_LO 0x07d4 +#define MMC_RXVLANFRAMES_GB_LO 0x07d8 +#define MMC_RXWATCHDOGERROR 0x07dc +#define MMC_RXRECEIVEERRORFRAME 0x07e0 +#define MMC_RXCONTROLFRAME_G 0x07e4 + +#define MMC_IPCRXINTMASK 0x800 +#define MMC_IPCRXINT 0x808 + +/* MMC register entry bit positions and sizes */ +#define MMC_CR_CR_POS 0 +#define MMC_CR_CR_LEN 1 +#define MMC_CR_CSR_POS 1 +#define MMC_CR_CSR_LEN 1 +#define MMC_CR_ROR_POS 2 +#define MMC_CR_ROR_LEN 1 +#define MMC_CR_MCF_POS 3 +#define MMC_CR_MCF_LEN 1 +//#define MMC_CR_MCT_POS 4 +//#define MMC_CR_MCT_LEN 2 +#define MMC_RIER_ALL_INTERRUPTS_POS 0 +#define MMC_RIER_ALL_INTERRUPTS_LEN 28 +#define MMC_RISR_RXFRAMECOUNT_GB_POS 0 +#define MMC_RISR_RXFRAMECOUNT_GB_LEN 1 +#define MMC_RISR_RXOCTETCOUNT_GB_POS 1 +#define MMC_RISR_RXOCTETCOUNT_GB_LEN 1 +#define MMC_RISR_RXOCTETCOUNT_G_POS 2 +#define MMC_RISR_RXOCTETCOUNT_G_LEN 1 +#define MMC_RISR_RXBROADCASTFRAMES_G_POS 3 +#define MMC_RISR_RXBROADCASTFRAMES_G_LEN 1 +#define MMC_RISR_RXMULTICASTFRAMES_G_POS 4 +#define MMC_RISR_RXMULTICASTFRAMES_G_LEN 1 +#define MMC_RISR_RXCRCERROR_POS 5 +#define MMC_RISR_RXCRCERROR_LEN 1 +#define MMC_RISR_RXALIGNERROR_POS 6 +#define MMC_RISR_RXALIGNERROR_LEN 1 +#define MMC_RISR_RXRUNTERROR_POS 7 +#define MMC_RISR_RXRUNTERROR_LEN 1 +#define MMC_RISR_RXJABBERERROR_POS 8 +#define MMC_RISR_RXJABBERERROR_LEN 1 +#define MMC_RISR_RXUNDERSIZE_G_POS 9 +#define MMC_RISR_RXUNDERSIZE_G_LEN 1 +#define MMC_RISR_RXOVERSIZE_G_POS 10 +#define MMC_RISR_RXOVERSIZE_G_LEN 1 +#define MMC_RISR_RX64OCTETS_GB_POS 11 +#define MMC_RISR_RX64OCTETS_GB_LEN 1 +#define MMC_RISR_RX65TO127OCTETS_GB_POS 12 +#define MMC_RISR_RX65TO127OCTETS_GB_LEN 1 +#define MMC_RISR_RX128TO255OCTETS_GB_POS 13 +#define MMC_RISR_RX128TO255OCTETS_GB_LEN 1 +#define MMC_RISR_RX256TO511OCTETS_GB_POS 14 +#define MMC_RISR_RX256TO511OCTETS_GB_LEN 1 +#define MMC_RISR_RX512TO1023OCTETS_GB_POS 15 +#define MMC_RISR_RX512TO1023OCTETS_GB_LEN 1 +#define MMC_RISR_RX1024TOMAXOCTETS_GB_POS 16 +#define MMC_RISR_RX1024TOMAXOCTETS_GB_LEN 1 +#define MMC_RISR_RXUNICASTFRAMES_G_POS 17 +#define MMC_RISR_RXUNICASTFRAMES_G_LEN 1 +#define MMC_RISR_RXLENGTHERROR_POS 18 +#define MMC_RISR_RXLENGTHERROR_LEN 1 +#define MMC_RISR_RXOUTOFRANGETYPE_POS 19 +#define MMC_RISR_RXOUTOFRANGETYPE_LEN 1 +#define MMC_RISR_RXPAUSEFRAMES_POS 20 +#define MMC_RISR_RXPAUSEFRAMES_LEN 1 +#define MMC_RISR_RXFIFOOVERFLOW_POS 21 +#define MMC_RISR_RXFIFOOVERFLOW_LEN 1 +#define MMC_RISR_RXVLANFRAMES_GB_POS 22 +#define MMC_RISR_RXVLANFRAMES_GB_LEN 1 +#define MMC_RISR_RXWATCHDOGERROR_POS 23 +#define MMC_RISR_RXWATCHDOGERROR_LEN 1 +#define MMC_RISR_RXERRORFRAMES_POS 24 +#define MMC_RISR_RXERRORFRAMES_LEN 1 +#define MMC_RISR_RXERRORCONTROLFRAMES_POS 25 +#define MMC_RISR_RXERRORCONTROLFRAMES_LEN 1 +#define MMC_RISR_RXLPIMICROSECOND_POS 26 //no counter register +#define MMC_RISR_RXLPIMICROSECOND_LEN 1 +#define MMC_RISR_RXLPITRANSITION_POS 27 //no counter register +#define MMC_RISR_RXLPITRANSITION_LEN 1 + +#define MMC_TIER_ALL_INTERRUPTS_POS 0 +#define MMC_TIER_ALL_INTERRUPTS_LEN 28 +#define MMC_TISR_TXOCTETCOUNT_GB_POS 0 +#define MMC_TISR_TXOCTETCOUNT_GB_LEN 1 +#define MMC_TISR_TXFRAMECOUNT_GB_POS 1 +#define MMC_TISR_TXFRAMECOUNT_GB_LEN 1 +#define MMC_TISR_TXBROADCASTFRAMES_G_POS 2 +#define MMC_TISR_TXBROADCASTFRAMES_G_LEN 1 +#define MMC_TISR_TXMULTICASTFRAMES_G_POS 3 +#define MMC_TISR_TXMULTICASTFRAMES_G_LEN 1 +#define MMC_TISR_TX64OCTETS_GB_POS 4 +#define MMC_TISR_TX64OCTETS_GB_LEN 1 +#define MMC_TISR_TX65TO127OCTETS_GB_POS 5 +#define MMC_TISR_TX65TO127OCTETS_GB_LEN 1 +#define MMC_TISR_TX128TO255OCTETS_GB_POS 6 +#define MMC_TISR_TX128TO255OCTETS_GB_LEN 1 +#define MMC_TISR_TX256TO511OCTETS_GB_POS 7 +#define MMC_TISR_TX256TO511OCTETS_GB_LEN 1 +#define MMC_TISR_TX512TO1023OCTETS_GB_POS 8 +#define MMC_TISR_TX512TO1023OCTETS_GB_LEN 1 +#define MMC_TISR_TX1024TOMAXOCTETS_GB_POS 9 +#define MMC_TISR_TX1024TOMAXOCTETS_GB_LEN 1 +#define MMC_TISR_TXUNICASTFRAMES_GB_POS 10 +#define MMC_TISR_TXUNICASTFRAMES_GB_LEN 1 +#define MMC_TISR_TXMULTICASTFRAMES_GB_POS 11 +#define MMC_TISR_TXMULTICASTFRAMES_GB_LEN 1 +#define MMC_TISR_TXBROADCASTFRAMES_GB_POS 12 +#define MMC_TISR_TXBROADCASTFRAMES_GB_LEN 1 +#define MMC_TISR_TXUNDERFLOWERROR_POS 13 +#define MMC_TISR_TXUNDERFLOWERROR_LEN 1 +#define MMC_TISR_TXSINGLECOLLISION_G_POS 14 +#define MMC_TISR_TXSINGLECOLLISION_G_LEN 1 +#define MMC_TISR_TXMULTIPLECOLLISION_G_POS 15 +#define MMC_TISR_TXMULTIPLECOLLISION_G_LEN 1 +#define MMC_TISR_TXDEFERREDFRAMES_POS 16 +#define MMC_TISR_TXDEFERREDFRAMES_LEN 1 +#define MMC_TISR_TXLATECOLLISIONFRAMES_POS 17 +#define MMC_TISR_TXLATECOLLISIONFRAMES_LEN 1 +#define MMC_TISR_TXEXCESSIVECOLLISIONFRAMES_POS 18 +#define MMC_TISR_TXEXCESSIVECOLLISIONFRAMES_LEN 1 +#define MMC_TISR_TXCARRIERERRORFRAMES_POS 19 +#define MMC_TISR_TXCARRIERERRORFRAMES_LEN 1 +#define MMC_TISR_TXOCTETCOUNT_G_POS 20 +#define MMC_TISR_TXOCTETCOUNT_G_LEN 1 +#define MMC_TISR_TXFRAMECOUNT_G_POS 21 +#define MMC_TISR_TXFRAMECOUNT_G_LEN 1 +#define MMC_TISR_TXEXCESSIVEDEFERRALFRAMES_POS 22 +#define MMC_TISR_TXEXCESSIVEDEFERRALFRAMES_LEN 1 +#define MMC_TISR_TXPAUSEFRAMES_POS 23 +#define MMC_TISR_TXPAUSEFRAMES_LEN 1 +#define MMC_TISR_TXVLANFRAMES_G_POS 24 +#define MMC_TISR_TXVLANFRAMES_G_LEN 1 +#define MMC_TISR_TXOVERSIZE_G_POS 25 +#define MMC_TISR_TXOVERSIZE_G_LEN 1 +#define MMC_TISR_TXLPIMICROSECOND_POS 26 //no counter register +#define MMC_TISR_TXLPIMICROSECOND_LEN 1 +#define MMC_TISR_TXLPITRANSITION_POS 27 //no counter register +#define MMC_TISR_TXLPITRANSITION_LEN 1 + +/* MTL register offsets */ +#define MTL_OMR 0x0c00 +#define MTL_FDCR 0x0c08 +#define MTL_FDSR 0x0c0c +#define MTL_FDDR 0x0c10 +#define MTL_INT_SR 0x0c20 +#define MTL_RQDCM0R 0x0c30 +#define MTL_ECC_INT_SR 0x0ccc + +#define MTL_RQDCM_INC 4 +#define MTL_RQDCM_Q_PER_REG 4 + +/* MTL register entry bit positions and sizes */ +#define MTL_OMR_ETSALG_POS 5 +#define MTL_OMR_ETSALG_LEN 2 +#define MTL_OMR_RAA_POS 2 +#define MTL_OMR_RAA_LEN 1 + +/* MTL queue register offsets + * Multiple queues can be active. The first queue has registers + * that begin at 0x0d00. Each subsequent queue has registers that + * are accessed using an offset of 0x40 from the previous queue. + */ +#define MTL_Q_BASE 0x0d00 +#define MTL_Q_INC 0x40 +#define MTL_Q_INT_CTL_SR 0x0d2c + +#define MTL_Q_TQOMR 0x00 +#define MTL_Q_TQUR 0x04 +#define MTL_Q_RQOMR 0x30 +#define MTL_Q_RQMPOCR 0x34 +#define MTL_Q_RQDR 0x38 +#define MTL_Q_RQCR 0x3c +#define MTL_Q_IER 0x2c +#define MTL_Q_ISR 0x2c //no isr register +#define MTL_TXQ_DEG 0x08 //transmit debug + +/* MTL queue register entry bit positions and sizes */ +#define MTL_Q_RQDR_PRXQ_POS 16 +#define MTL_Q_RQDR_PRXQ_LEN 14 +#define MTL_Q_RQDR_RXQSTS_POS 4 +#define MTL_Q_RQDR_RXQSTS_LEN 2 +#define MTL_Q_RQOMR_RFA_POS 8 +#define MTL_Q_RQOMR_RFA_LEN 6 +#define MTL_Q_RQOMR_RFD_POS 14 +#define MTL_Q_RQOMR_RFD_LEN 6 +#define MTL_Q_RQOMR_EHFC_POS 7 +#define MTL_Q_RQOMR_EHFC_LEN 1 +#define MTL_Q_RQOMR_RQS_POS 20 +#define MTL_Q_RQOMR_RQS_LEN 9 +#define MTL_Q_RQOMR_RSF_POS 5 +#define MTL_Q_RQOMR_RSF_LEN 1 +#define MTL_Q_RQOMR_FEP_POS 4 +#define MTL_Q_RQOMR_FEP_LEN 1 +#define MTL_Q_RQOMR_FUP_POS 3 +#define MTL_Q_RQOMR_FUP_LEN 1 +#define MTL_Q_RQOMR_RTC_POS 0 +#define MTL_Q_RQOMR_RTC_LEN 2 +#define MTL_Q_TQOMR_FTQ_POS 0 +#define MTL_Q_TQOMR_FTQ_LEN 1 +//#define MTL_Q_TQOMR_Q2TCMAP_POS 8 // no register +//#define MTL_Q_TQOMR_Q2TCMAP_LEN 3 // no register +#define MTL_Q_TQOMR_TQS_POS 16 +#define MTL_Q_TQOMR_TQS_LEN 7 +#define MTL_Q_TQOMR_TSF_POS 1 +#define MTL_Q_TQOMR_TSF_LEN 1 +#define MTL_Q_TQOMR_TTC_POS 4 +#define MTL_Q_TQOMR_TTC_LEN 3 +#define MTL_Q_TQOMR_TXQEN_POS 2 +#define MTL_Q_TQOMR_TXQEN_LEN 2 + +/* MTL queue register value */ +#define MTL_RSF_DISABLE 0x00 +#define MTL_RSF_ENABLE 0x01 +#define MTL_TSF_DISABLE 0x00 +#define MTL_TSF_ENABLE 0x01 +#define MTL_FEP_DISABLE 0x00 +#define MTL_FEP_ENABLE 0x01 + +#define MTL_RX_THRESHOLD_64 0x00 +#define MTL_RX_THRESHOLD_32 0x01 +#define MTL_RX_THRESHOLD_96 0x02 +#define MTL_RX_THRESHOLD_128 0x03 +#define MTL_TX_THRESHOLD_32 0x00 +#define MTL_TX_THRESHOLD_64 0x01 +#define MTL_TX_THRESHOLD_96 0x02 +#define MTL_TX_THRESHOLD_128 0x03 +#define MTL_TX_THRESHOLD_192 0x04 +#define MTL_TX_THRESHOLD_256 0x05 +#define MTL_TX_THRESHOLD_384 0x06 +#define MTL_TX_THRESHOLD_512 0x07 + +#define MTL_ETSALG_WRR 0x00 +#define MTL_ETSALG_WFQ 0x01 +#define MTL_ETSALG_DWRR 0x02 +#define MTL_ETSALG_SP 0x03 + +#define MTL_RAA_SP 0x00 +#define MTL_RAA_WSP 0x01 + +#define MTL_Q_DISABLED 0x00 +#define MTL_Q_EN_IF_AV 0x01 +#define MTL_Q_ENABLED 0x02 + +#define MTL_RQDCM0R_Q0MDMACH 0x0 +#define MTL_RQDCM0R_Q1MDMACH 0x00000100 +#define MTL_RQDCM0R_Q2MDMACH 0x00020000 +#define MTL_RQDCM0R_Q3MDMACH 0x03000000 +#define MTL_RQDCM1R_Q4MDMACH 0x00000004 +#define MTL_RQDCM1R_Q5MDMACH 0x00000500 +#define MTL_RQDCM1R_Q6MDMACH 0x00060000 +#define MTL_RQDCM1R_Q7MDMACH 0x07000000 +#define MTL_RQDCM2R_Q8MDMACH 0x00000008 +#define MTL_RQDCM2R_Q9MDMACH 0x00000900 +#define MTL_RQDCM2R_Q10MDMACH 0x000A0000 +#define MTL_RQDCM2R_Q11MDMACH 0x0B000000 + +#define MTL_RQDCM0R_Q0DDMACH 0x10 +#define MTL_RQDCM0R_Q1DDMACH 0x00001000 +#define MTL_RQDCM0R_Q2DDMACH 0x00100000 +#define MTL_RQDCM0R_Q3DDMACH 0x10000000 +#define MTL_RQDCM1R_Q4DDMACH 0x00000010 +#define MTL_RQDCM1R_Q5DDMACH 0x00001000 +#define MTL_RQDCM1R_Q6DDMACH 0x00100000 +#define MTL_RQDCM1R_Q7DDMACH 0x10000000 + + +/* MTL traffic class register offsets + * Multiple traffic classes can be active. The first class has registers + * that begin at 0x1100. Each subsequent queue has registers that + * are accessed using an offset of 0x80 from the previous queue. + */ +/* NO TRAFFIC CLASS REGISTER DESCRIPTION */ +#if 1 +#define MTL_TC_BASE MTL_Q_BASE +#define MTL_TC_INC MTL_Q_INC + +#define MTL_TC_TQDR 0x08 +#define MTL_TC_ETSCR 0x10 +#define MTL_TC_ETSSR 0x14 +#define MTL_TC_QWR 0x18 + +/* The Queue 0 Transmit Debug register gives the debug status of various blocks + * related to the Transmit queue + */ +#define MTL_TC_TQDR_TRCSTS_POS 1 +#define MTL_TC_TQDR_TRCSTS_LEN 2 +#define MTL_TC_TQDR_TXQSTS_POS 4 +#define MTL_TC_TQDR_TXQSTS_LEN 1 + +/* MTL traffic class register entry bit positions and sizes */ +#define MTL_TC_ETSCR_TSA_POS 0 +#define MTL_TC_ETSCR_TSA_LEN 2 +#define MTL_TC_QWR_QW_POS 0 +#define MTL_TC_QWR_QW_LEN 21 + +/* MTL traffic class register value */ +#define MTL_TSA_SP 0x00 +#define MTL_TSA_ETS 0x02 +#endif + +/* DMA register offsets */ +#define DMA_MR 0x1000 +#define DMA_SBMR 0x1004 +#define DMA_ISR 0x1008 +#define DMA_DSR0 0x100c +#define DMA_DSR1 0x1010 +#define DMA_DSR2 0x1014 +#define DMA_AXIARCR 0x1020 +#define DMA_AXIAWCR 0x1024 +#define DMA_AXIAWRCR 0x1028 +#define DMA_SAFE_ISR 0x1080 +#define DMA_ECC_IE 0x1084 +#define DMA_ECC_INT_SR 0x1088 + +/* DMA register entry bit positions and sizes */ +#define DMA_ISR_MACIS_POS 17 +#define DMA_ISR_MACIS_LEN 1 +#define DMA_ISR_MTLIS_POS 16 +#define DMA_ISR_MTLIS_LEN 1 +#define DMA_MR_SWR_POS 0 +#define DMA_MR_SWR_LEN 1 +#define DMA_MR_TXPR_POS 11 +#define DMA_MR_TXPR_LEN 1 +#define DMA_MR_INTM_POS 16 +#define DMA_MR_INTM_LEN 2 +#define DMA_MA_INTM_EDGE 0 +#define DMA_MA_INTM_LEVEL 1 +#define DMA_MA_INTM_LEVLE_ENHANCE 2 +#define DMA_MR_QUREAD_POS 19 +#define DMA_MR_QUREAD_LEN 1 +#define DMA_MR_QUREAD_EN 1 +#define DMA_MR_TNDF_POS 20 +#define DMA_MR_TNDF_LEN 2 +#define DMA_MR_RNDF_POS 22 +#define DMA_MR_RNDF_LEN 2 + +#define DMA_SBMR_EN_LPI_POS 31 +#define DMA_SBMR_EN_LPI_LEN 1 +#define DMA_SBMR_LPI_XIT_PKT_POS 30 +#define DMA_SBMR_LPI_XIT_PKT_LEN 1 +#define DMA_SBMR_WR_OSR_LMT_POS 24 +#define DMA_SBMR_WR_OSR_LMT_LEN 6 +#define DMA_SBMR_RD_OSR_LMT_POS 16 +#define DMA_SBMR_RD_OSR_LMT_LEN 8 +#define DMA_SBMR_AAL_POS 12 +#define DMA_SBMR_AAL_LEN 1 +#define DMA_SBMR_EAME_POS 11 +#define DMA_SBMR_EAME_LEN 1 +#define DMA_SBMR_AALE_POS 10 +#define DMA_SBMR_AALE_LEN 1 +#define DMA_SBMR_BLEN_4_POS 1 +#define DMA_SBMR_BLEN_4_LEN 1 +#define DMA_SBMR_BLEN_8_POS 2 +#define DMA_SBMR_BLEN_8_LEN 1 +#define DMA_SBMR_BLEN_16_POS 3 +#define DMA_SBMR_BLEN_16_LEN 1 +#define DMA_SBMR_BLEN_32_POS 4 +#define DMA_SBMR_BLEN_32_LEN 1 +#define DMA_SBMR_BLEN_64_POS 5 +#define DMA_SBMR_BLEN_64_LEN 1 +#define DMA_SBMR_BLEN_128_POS 6 +#define DMA_SBMR_BLEN_128_LEN 1 +#define DMA_SBMR_BLEN_256_POS 7 +#define DMA_SBMR_BLEN_256_LEN 1 +#define DMA_SBMR_FB_POS 0 +#define DMA_SBMR_FB_LEN 1 + +/* DMA register values */ +#define DMA_DSR_RPS_LEN 4 +#define DMA_DSR_TPS_LEN 4 +#define DMA_DSR_Q_LEN (DMA_DSR_RPS_LEN + DMA_DSR_TPS_LEN) +#define DMA_DSR0_TPS_START 12 +#define DMA_DSRX_FIRST_QUEUE 3 +#define DMA_DSRX_INC 4 +#define DMA_DSRX_QPR 4 // no definition +#define DMA_DSRX_TPS_START 4 +#define DMA_TPS_STOPPED 0x00 +#define DMA_TPS_SUSPENDED 0x06 + +/* DMA channel register offsets + * Multiple channels can be active. The first channel has registers + * that begin at 0x1100. Each subsequent channel has registers that + * are accessed using an offset of 0x80 from the previous channel. + */ +#define DMA_CH_BASE 0x1100 +#define DMA_CH_INC 0x80 + +#define DMA_CH_CR 0x00 +#define DMA_CH_TCR 0x04 +#define DMA_CH_RCR 0x08 +#define DMA_CH_TDLR_HI 0x10 +#define DMA_CH_TDLR_LO 0x14 +#define DMA_CH_RDLR_HI 0x18 +#define DMA_CH_RDLR_LO 0x1c +#define DMA_CH_TDTR_LO 0x20 +#define DMA_CH_RDTR_LO 0x28 +#define DMA_CH_TDRLR 0x2c +#define DMA_CH_RDRLR 0x30 +#define DMA_CH_IER 0x34 +#define DMA_CH_RIWT 0x38 +#define DMA_CH_CATDR_LO 0x44 +#define DMA_CH_CARDR_LO 0x4c +#define DMA_CH_CATBR_HI 0x50 +#define DMA_CH_CATBR_LO 0x54 +#define DMA_CH_CARBR_HI 0x58 +#define DMA_CH_CARBR_LO 0x5c +#define DMA_CH_SR 0x60 + +/* DMA channel register entry bit positions and sizes */ +#define DMA_CH_CR_PBLX8_POS 16 +#define DMA_CH_CR_PBLX8_LEN 1 +#define DMA_CH_CR_SPH_POS 24 +#define DMA_CH_CR_SPH_LEN 1 +#define DMA_CH_IER_AIE_POS 14 +#define DMA_CH_IER_AIE_LEN 1 +#define DMA_CH_IER_FBEE_POS 12 +#define DMA_CH_IER_FBEE_LEN 1 +#define DMA_CH_IER_NIE_POS 15 +#define DMA_CH_IER_NIE_LEN 1 +#define DMA_CH_IER_RBUE_POS 7 +#define DMA_CH_IER_RBUE_LEN 1 +#define DMA_CH_IER_RIE_POS 6 +#define DMA_CH_IER_RIE_LEN 1 +#define DMA_CH_IER_RSE_POS 8 +#define DMA_CH_IER_RSE_LEN 1 +#define DMA_CH_IER_TBUE_POS 2 +#define DMA_CH_IER_TBUE_LEN 1 +#define DMA_CH_IER_TIE_POS 0 +#define DMA_CH_IER_TIE_LEN 1 +#define DMA_CH_IER_TXSE_POS 1 +#define DMA_CH_IER_TXSE_LEN 1 +#define DMA_CH_RCR_PBL_POS 16 +#define DMA_CH_RCR_PBL_LEN 6 +#define DMA_CH_RCR_RBSZ_POS 1 +#define DMA_CH_RCR_RBSZ_LEN 14 +#define DMA_CH_RCR_SR_POS 0 +#define DMA_CH_RCR_SR_LEN 1 +#define DMA_CH_RIWT_RWT_POS 0 +#define DMA_CH_RIWT_RWT_LEN 8 +#define DMA_CH_SR_FBE_POS 12 +#define DMA_CH_SR_FBE_LEN 1 +#define DMA_CH_SR_RBU_POS 7 +#define DMA_CH_SR_RBU_LEN 1 +#define DMA_CH_SR_RI_POS 6 +#define DMA_CH_SR_RI_LEN 1 +#define DMA_CH_SR_RPS_POS 8 +#define DMA_CH_SR_RPS_LEN 1 +#define DMA_CH_SR_TBU_POS 2 +#define DMA_CH_SR_TBU_LEN 1 +#define DMA_CH_SR_TI_POS 0 +#define DMA_CH_SR_TI_LEN 1 +#define DMA_CH_SR_TPS_POS 1 +#define DMA_CH_SR_TPS_LEN 1 +#define DMA_CH_TCR_OSP_POS 4 +#define DMA_CH_TCR_OSP_LEN 1 +#define DMA_CH_TCR_PBL_POS 16 +#define DMA_CH_TCR_PBL_LEN 6 +#define DMA_CH_TCR_ST_POS 0 +#define DMA_CH_TCR_ST_LEN 1 +#define DMA_CH_TCR_TSE_POS 12 +#define DMA_CH_TCR_TSE_LEN 1 + +/* DMA channel register values */ +#define DMA_OSP_DISABLE 0x00 +#define DMA_OSP_ENABLE 0x01 +#define DMA_PBL_1 1 +#define DMA_PBL_2 2 +#define DMA_PBL_4 4 +#define DMA_PBL_8 8 +#define DMA_PBL_16 16 +#define DMA_PBL_32 32 +#define DMA_PBL_64 64 +#define DMA_PBL_128 128 +#define DMA_PBL_256 256 +#define DMA_PBL_X8_DISABLE 0x00 +#define DMA_PBL_X8_ENABLE 0x01 + +/* Descriptor/Packet entry bit positions and sizes */ +#define RX_PACKET_ERRORS_CRC_POS 2 +#define RX_PACKET_ERRORS_CRC_LEN 1 +#define RX_PACKET_ERRORS_FRAME_POS 3 +#define RX_PACKET_ERRORS_FRAME_LEN 1 +#define RX_PACKET_ERRORS_LENGTH_POS 0 +#define RX_PACKET_ERRORS_LENGTH_LEN 1 +#define RX_PACKET_ERRORS_OVERRUN_POS 1 +#define RX_PACKET_ERRORS_OVERRUN_LEN 1 + +#define RX_PACKET_ATTRIBUTES_CSUM_DONE_POS 0 +#define RX_PACKET_ATTRIBUTES_CSUM_DONE_LEN 1 +#define RX_PACKET_ATTRIBUTES_VLAN_CTAG_POS 1 +#define RX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN 1 +#define RX_PACKET_ATTRIBUTES_INCOMPLETE_POS 2 +#define RX_PACKET_ATTRIBUTES_INCOMPLETE_LEN 1 +#define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_POS 3 +#define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_LEN 1 +#define RX_PACKET_ATTRIBUTES_CONTEXT_POS 4 +#define RX_PACKET_ATTRIBUTES_CONTEXT_LEN 1 +#define RX_PACKET_ATTRIBUTES_RX_TSTAMP_POS 5 +#define RX_PACKET_ATTRIBUTES_RX_TSTAMP_LEN 1 +#define RX_PACKET_ATTRIBUTES_RSS_HASH_POS 6 +#define RX_PACKET_ATTRIBUTES_RSS_HASH_LEN 1 + +#define RX_NORMAL_DESC0_OVT_POS 0 +#define RX_NORMAL_DESC0_OVT_LEN 16 +#define RX_NORMAL_DESC2_HL_POS 0 +#define RX_NORMAL_DESC2_HL_LEN 10 +//#define RX_NORMAL_DESC3_CDA_POS 27// +#define RX_NORMAL_DESC3_CDA_LEN 1 +#define RX_NORMAL_DESC3_CTXT_POS 30 +#define RX_NORMAL_DESC3_CTXT_LEN 1 +#define RX_NORMAL_DESC3_ES_POS 15 +#define RX_NORMAL_DESC3_ES_LEN 1 +#define RX_NORMAL_DESC3_ETLT_POS 16 +#define RX_NORMAL_DESC3_ETLT_LEN 3 +#define RX_NORMAL_DESC3_FD_POS 29 +#define RX_NORMAL_DESC3_FD_LEN 1 +#define RX_NORMAL_DESC3_INTE_POS 30 +#define RX_NORMAL_DESC3_INTE_LEN 1 +//#define RX_NORMAL_DESC3_L34T_POS 20// +#define RX_NORMAL_DESC3_L34T_LEN 4 +#define RX_NORMAL_DESC3_RSV_POS 26 +#define RX_NORMAL_DESC3_RSV_LEN 1 +#define RX_NORMAL_DESC3_LD_POS 28 +#define RX_NORMAL_DESC3_LD_LEN 1 +#define RX_NORMAL_DESC3_OWN_POS 31 +#define RX_NORMAL_DESC3_OWN_LEN 1 +#define RX_NORMAL_DESC3_BUF2V_POS 25 +#define RX_NORMAL_DESC3_BUF2V_LEN 1 +#define RX_NORMAL_DESC3_BUF1V_POS 24 +#define RX_NORMAL_DESC3_BUF1V_LEN 1 +#define RX_NORMAL_DESC3_PL_POS 0 +#define RX_NORMAL_DESC3_PL_LEN 15 + +#define RX_NORMAL_DESC0_WB_IVT_POS 16 // Inner VLAN Tag. Valid only when Double VLAN tag processing and VLAN tag stripping are enabled. +#define RX_NORMAL_DESC0_WB_IVT_LEN 16 +#define RX_NORMAL_DESC0_WB_OVT_POS 0 // Outer VLAN Tag. +#define RX_NORMAL_DESC0_WB_OVT_LEN 16 +#define RX_NORMAL_DESC0_WB_OVT_VLANID_POS 0 // Outer VLAN ID. +#define RX_NORMAL_DESC0_WB_OVT_VLANID_LEN 12 +#define RX_NORMAL_DESC0_WB_OVT_CFI_POS 12 // Outer VLAN CFI. +#define RX_NORMAL_DESC0_WB_OVT_CFI_LEN 1 +#define RX_NORMAL_DESC0_WB_OVT_PRIO_POS 13 // Outer VLAN Priority. +#define RX_NORMAL_DESC0_WB_OVT_PRIO_LEN 3 + +#define RX_NORMAL_DESC1_WB_IPCE_POS 7 // IP Payload Error. +#define RX_NORMAL_DESC1_WB_IPCE_LEN 1 +#define RX_NORMAL_DESC1_WB_IPV6_POS 5 // IPV6 Header Present. +#define RX_NORMAL_DESC1_WB_IPV6_LEN 1 +#define RX_NORMAL_DESC1_WB_IPV4_POS 4 // IPV4 Header Present. +#define RX_NORMAL_DESC1_WB_IPV4_LEN 1 +#define RX_NORMAL_DESC1_WB_IPHE_POS 3 // IP Header Error. +#define RX_NORMAL_DESC1_WB_IPHE_LEN 1 +#define RX_NORMAL_DESC1_WB_PT_POS 0 // +#define RX_NORMAL_DESC1_WB_PT_LEN 3 + +#define RX_NORMAL_DESC2_WB_HF_POS 18 // Hash Filter Status. When this bit is set, it indicates that the packet passed the MAC address hash filter +#define RX_NORMAL_DESC2_WB_HF_LEN 1 + +/* Destination Address Filter Fail. When Flexible RX Parser is disabled, + * and this bit is set, it indicates that the packet failed + * the DA Filter in the MAC. + */ +#define RX_NORMAL_DESC2_WB_DAF_POS 17 +#define RX_NORMAL_DESC2_WB_DAF_LEN 1 +#define RX_NORMAL_DESC2_WB_RAPARSER_POS 11 +#define RX_NORMAL_DESC2_WB_RAPARSER_LEN 3 + +#define RX_NORMAL_DESC3_WB_LD_POS 28 +#define RX_NORMAL_DESC3_WB_LD_LEN 1 +#define RX_NORMAL_DESC3_WB_RS0V_POS 25 // When this bit is set, it indicates that the status in RDES0 is valid and it is written by the DMA. +#define RX_NORMAL_DESC3_WB_RS0V_LEN 1 + +/* When this bit is set, it indicates that a Cyclic Redundancy Check (CRC) + * Error occurred on the received packet.This field is valid only when the + * LD bit of RDES3 is set. + */ +#define RX_NORMAL_DESC3_WB_CE_POS 24 +#define RX_NORMAL_DESC3_WB_CE_LEN 1 + +/* + * When this bit is set, it indicates that the packet length exceeds the specified maximum + * Ethernet size of 1518, 1522, or 2000 bytes (9018 or 9022 bytes if jumbo packet enable is set). + * Note: Giant packet indicates only the packet length. It does not cause any packet truncation. + */ +#define RX_NORMAL_DESC3_WB_GP_POS 23 +#define RX_NORMAL_DESC3_WB_GP_LEN 1 + +/* + * When this bit is set, it indicates that the Receive Watchdog Timer has expired while receiving + * the current packet. The current packet is truncated after watchdog timeout. + */ +#define RX_NORMAL_DESC3_WB_RWT_POS 22 +#define RX_NORMAL_DESC3_WB_RWT_LEN 1 + +/* + * When this bit is set, it indicates that the received packet is damaged because of buffer + * overflow in Rx FIFO. + * Note: This bit is set only when the DMA transfers a partial packet to the application. This + * happens only when the Rx FIFO is operating in the threshold mode. In the store-and-forward + * mode, all partial packets are dropped completely in Rx FIFO. + */ +#define RX_NORMAL_DESC3_WB_OE_POS 21 +#define RX_NORMAL_DESC3_WB_OE_LEN 1 + +/* + * When this bit is set, it indicates that the gmii_rxer_i signal is asserted while the gmii_rxdv_i + * signal is asserted during packet reception. This error also includes carrier extension error in + * the GMII and half-duplex mode. Error can be of less or no extension, or error (rxd!= 0f) during + * extension + */ +#define RX_NORMAL_DESC3_WB_RE_POS 20 +#define RX_NORMAL_DESC3_WB_RE_LEN 1 + +/* + * When this bit is set, it indicates that the received packet has a non-integer multiple of bytes + * (odd nibbles). This bit is valid only in the MII Mode + */ +#define RX_NORMAL_DESC3_WB_DE_POS 19 +#define RX_NORMAL_DESC3_WB_DE_LEN 1 + +/* + * When this bit is set, it indicates the logical OR of the following bits: + * RDES3[24]: CRC Error + * RDES3[19]: Dribble Error + * RDES3[20]: Receive Error + * RDES3[22]: Watchdog Timeout + * RDES3[21]: Overflow Error + * RDES3[23]: Giant Packet + * RDES2[17]: Destination Address Filter Fail, when Flexible RX Parser is enabled + * RDES2[16]: SA Address Filter Fail, when Flexible RX Parser is enabled + * This field is valid only when the LD bit of RDES3 is set + */ +#define RX_NORMAL_DESC3_WB_ES_POS 15 +#define RX_NORMAL_DESC3_WB_ES_LEN 1 + +#define RX_DESC3_L34T_IPV4_TCP 1 +#define RX_DESC3_L34T_IPV4_UDP 2 +#define RX_DESC3_L34T_IPV4_ICMP 3 +#define RX_DESC3_L34T_IPV6_TCP 9 +#define RX_DESC3_L34T_IPV6_UDP 10 +#define RX_DESC3_L34T_IPV6_ICMP 11 + +#define RX_DESC1_PT_UDP 1 +#define RX_DESC1_PT_TCP 2 +#define RX_DESC1_PT_ICMP 3 +#define RX_DESC1_PT_AV_TAG_DATA 6 +#define RX_DESC1_PT_AV_TAG_CTRL 7 +#define RX_DESC1_PT_AV_NOTAG_CTRL 5 + + +//#define RX_CONTEXT_DESC3_TSA_POS 4// +#define RX_CONTEXT_DESC3_TSA_LEN 1 +//#define RX_CONTEXT_DESC3_TSD_POS 6// +#define RX_CONTEXT_DESC3_TSD_LEN 1 + +#define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_POS 0 +#define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_LEN 1 +#define TX_PACKET_ATTRIBUTES_TSO_ENABLE_POS 1 +#define TX_PACKET_ATTRIBUTES_TSO_ENABLE_LEN 1 +#define TX_PACKET_ATTRIBUTES_VLAN_CTAG_POS 2 +#define TX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN 1 +#define TX_PACKET_ATTRIBUTES_PTP_POS 3 +#define TX_PACKET_ATTRIBUTES_PTP_LEN 1 + +#define TX_CONTEXT_DESC2_MSS_POS 0 +#define TX_CONTEXT_DESC2_MSS_LEN 14 +#define TX_CONTEXT_DESC2_IVLTV_POS 16 // Inner VLAN Tag. +#define TX_CONTEXT_DESC2_IVLTV_LEN 16 + +#define TX_CONTEXT_DESC3_CTXT_POS 30 +#define TX_CONTEXT_DESC3_CTXT_LEN 1 +#define TX_CONTEXT_DESC3_TCMSSV_POS 26 +#define TX_CONTEXT_DESC3_TCMSSV_LEN 1 +#define TX_CONTEXT_DESC3_IVTIR_POS 18 +#define TX_CONTEXT_DESC3_IVTIR_LEN 2 +#define TX_CONTEXT_DESC3_IVTIR_INSERT 2 // Insert an inner VLAN tag with the tag value programmed in the MAC_Inner_VLAN_Incl register or context descriptor. +#define TX_CONTEXT_DESC3_IVLTV_POS 17 // Indicates that the Inner VLAN TAG, IVLTV field of context TDES2 is valid. +#define TX_CONTEXT_DESC3_IVLTV_LEN 1 +#define TX_CONTEXT_DESC3_VLTV_POS 16 // Indicates that the VT field of context TDES3 is valid. +#define TX_CONTEXT_DESC3_VLTV_LEN 1 +#define TX_CONTEXT_DESC3_VT_POS 0 +#define TX_CONTEXT_DESC3_VT_LEN 16 + +#define TX_NORMAL_DESC2_HL_B1L_POS 0 // Header Length or Buffer 1 Length. +#define TX_NORMAL_DESC2_HL_B1L_LEN 14 +#define TX_NORMAL_DESC2_IC_POS 31 // Interrupt on Completion. +#define TX_NORMAL_DESC2_IC_LEN 1 +#define TX_NORMAL_DESC2_TTSE_POS 30 // Transmit Timestamp Enable or External TSO Memory Write Enable. +#define TX_NORMAL_DESC2_TTSE_LEN 1 +#define TX_NORMAL_DESC2_VTIR_POS 14 //LAN Tag Insertion or Replacement. +#define TX_NORMAL_DESC2_VTIR_LEN 2 +#define TX_NORMAL_DESC2_VLAN_INSERT 0x2 + +#define TX_NORMAL_DESC3_TCPPL_POS 0 +#define TX_NORMAL_DESC3_TCPPL_LEN 18 +#define TX_NORMAL_DESC3_FL_POS 0 // Frame Length or TCP Payload Length. +#define TX_NORMAL_DESC3_FL_LEN 15 +#define TX_NORMAL_DESC3_CIC_POS 16 /* Checksum Insertion Control or TCP Payload Length. + 2'b00: Checksum Insertion Disabled. + 2'b01: Only IP header checksum calculation and insertion are enabled. + 2'b10: IP header checksum and payload checksum calculation and insertion are + enabled, but pseudo-header checksum is not calculated in hardware. + 2'b11: IP Header checksum and payload checksum calculation and insertion are + enabled, and pseudo - header checksum is calculated in hardware. */ +#define TX_NORMAL_DESC3_CIC_LEN 2 +#define TX_NORMAL_DESC3_TSE_POS 18 // TCP Segmentation Enable. +#define TX_NORMAL_DESC3_TSE_LEN 1 +#define TX_NORMAL_DESC3_TCPHDRLEN_POS 19 /* THL: TCP/UDP Header Length.If the TSE bit is set, this field contains + the length of the TCP / UDP header.The minimum value of this field must + be 5 for TCP header.The value must be equal to 2 for UDP header. This + field is valid only for the first descriptor.*/ +#define TX_NORMAL_DESC3_TCPHDRLEN_LEN 4 +#define TX_NORMAL_DESC3_CPC_POS 26 // CRC Pad Control. +#define TX_NORMAL_DESC3_CPC_LEN 2 +#define TX_NORMAL_DESC3_LD_POS 28 // Last Descriptor. +#define TX_NORMAL_DESC3_LD_LEN 1 +#define TX_NORMAL_DESC3_FD_POS 29 // First Descriptor. +#define TX_NORMAL_DESC3_FD_LEN 1 +#define TX_NORMAL_DESC3_CTXT_POS 30 // Context Type.This bit should be set to 1'b0 for normal descriptor. +#define TX_NORMAL_DESC3_CTXT_LEN 1 +#define TX_NORMAL_DESC3_OWN_POS 31 // Own Bit. +#define TX_NORMAL_DESC3_OWN_LEN 1 + +/* for ephy generic register definitions */ +#define FXGMAC_EPHY_REGS_LEN 32 //32 ethernet phy registers under spec + +#define REG_MII_BMCR 0x00 /* Basic mode control register */ +#define PHY_CR_RESET_POS 15 +#define PHY_CR_RESET_LEN 1 +#define PHY_CR_SPEED_SEL_H_POS 6 +#define PHY_CR_SPEED_SEL_H_LEN 1 +#define PHY_CR_SPEED_SEL_L_POS 13 +#define PHY_CR_SPEED_SEL_L_LEN 1 +#define PHY_CR_AUTOENG_POS 12 +#define PHY_CR_AUTOENG_LEN 1 +#define PHY_CR_POWER_POS 11 +#define PHY_CR_POWER_LEN 1 +#define PHY_CR_RE_AUTOENG_POS 9 +#define PHY_CR_RE_AUTOENG_LEN 1 +#define PHY_CR_DUPLEX_POS 8 +#define PHY_CR_DUPLEX_LEN 1 +#define REG_MII_BMCR_ENABLE_LOOPBACK 0x8140 +#define REG_MII_BMCR_DISABLE_LOOPBACK 0x9140 +#define REG_MII_BMSR 0x01 /* Basic mode status register */ +#define REG_MII_PHYSID1 0x02 /* PHYS ID 1 */ +#define REG_MII_PHYSID2 0x03 /* PHYS ID 2 */ +#define REG_MII_ADVERTISE 0x04 /* Advertisement control reg */ +#define PHY_MII_ADVERTISE_ASYPAUSE_POS 11 +#define PHY_MII_ADVERTISE_ASYPAUSE_LEN 1 +#define PHY_MII_ADVERTISE_PAUSE_POS 10 +#define PHY_MII_ADVERTISE_PAUSE_LEN 1 +#define PHY_MII_ADVERTISE_100FULL_POS 8 +#define PHY_MII_ADVERTISE_100FULL_LEN 1 +#define PHY_MII_ADVERTISE_100HALF_POS 7 +#define PHY_MII_ADVERTISE_100HALF_LEN 1 +#define PHY_MII_ADVERTISE_10FULL_POS 6 +#define PHY_MII_ADVERTISE_10FULL_LEN 1 +#define PHY_MII_ADVERTISE_10HALF_POS 5 +#define PHY_MII_ADVERTISE_10HALF_LEN 1 +#define REG_MII_LPA 0x05 /* Link partner ability reg */ +#define PHY_MII_LINK_PARNTNER_10FULL_POS 6 +#define PHY_MII_LINK_PARNTNER_10FULL_LEN 1 +#define PHY_MII_LINK_PARNTNER_10HALF_POS 5 +#define PHY_MII_LINK_PARNTNER_10HALF_LEN 1 +#define REG_MII_EXPANSION 0x06 /* Expansion register */ +#define REG_MII_NEXT_PAGE 0x07 /* Next page register */ +#define REG_MII_LPR_NEXT_PAGE 0x08 /* LPR next page register */ +#define REG_MII_CTRL1000 0x09 /* 1000BASE-T control */ +#define PHY_MII_CTRL1000_1000FULL_POS 9 +#define PHY_MII_CTRL1000_1000FULL_LEN 1 +#define PHY_MII_CTRL1000_1000HALF_POS 8 +#define PHY_MII_CTRL1000_1000HALF_LEN 1 +#define REG_MII_STAT1000 0x0a /* 1000BASE-T status */ +#define PHY_MII_STAT1000_CFG_ERROR_POS 15 +#define PHY_MII_STAT1000_CFG_ERROR_LEN 1 + +#define REG_MII_MMD_CTRL 0x0d /* MMD access control register */ +#define REG_MII_MMD_DATA 0x0e /* MMD access data register */ + +#define REG_MII_ESTATUS 0x0f /* Extended Status */ + +#define REG_MII_SPEC_CTRL 0x10 /* PHY specific func control */ +#define PHY_MII_SPEC_CTRL_CRS_ON_POS 3 +#define PHY_MII_SPEC_CTRL_CRS_ON_LEN 1 +#define REG_MII_SPEC_STATUS 0x11 /* PHY specific status */ +#define PHY_MII_SPEC_DUPLEX_POS 13 +#define PHY_MII_SPEC_DUPLEX_LEN 1 +#define REG_MII_INT_MASK 0x12 /* Interrupt mask register */ + +#ifdef AISC_MODE +#define PHY_INT_MASK_LINK_UP_POS 10 +#define PHY_INT_MASK_LINK_UP_LEN 1 +#define PHY_INT_MASK_LINK_DOWN_POS 11 +#define PHY_INT_MASK_LINK_DOWN_LEN 1 +#else //FPGA_MODE +#define PHY_INT_MASK_LINK_UP_POS 1 +#define PHY_INT_MASK_LINK_UP_LEN 1 +#define PHY_INT_MASK_LINK_DOWN_POS 0 +#define PHY_INT_MASK_LINK_DOWN_LEN 1 +#endif +#define REG_MII_INT_STATUS 0x13 /* Interrupt status register */ +#ifdef AISC_MODE +#define PHY_INT_STAT_LINK_UP_POS 10 +#define PHY_INT_STAT_LINK_UP_LEN 1 +#define PHY_INT_STAT_LINK_DOWN_POS 11 +#define PHY_INT_STAT_LINK_DOWN_LEN 1 +#else +#define PHY_INT_STAT_LINK_UP_POS 1 +#define PHY_INT_STAT_LINK_UP_LEN 1 +#define PHY_INT_STAT_LINK_DOWN_POS 0 +#define PHY_INT_STAT_LINK_DOWN_LEN 1 +#endif +#define REG_MII_DOWNG_CTRL 0x14 /* Speed auto downgrade control*/ +#define REG_MII_RERRCOUNTER 0x15 /* Receive error counter */ + +#define REG_MII_EXT_ADDR 0x1e /* Extended reg's address */ +#define REG_MII_EXT_DATA 0x1f /* Extended reg's date */ + +#define FXGMAC_EPHY_ID_MASK 0x0000ffff + +/* for ephy link capability + * Advertisement control register(0x04) + */ +#define FXGMAC_ADVERTISE_SLCT 0x001f /* Selector bits */ +#define FXGMAC_ADVERTISE_CSMA 0x0001 /* Only selector supported */ +//#define FXGMAC_ADVERTISE_1000FULL 0x0004 /* Try for 1000BASE-T full duplex */ +//#define FXGMAC_ADVERTISE_1000HALF 0x0008 /* Try for 1000BASE-T half duplex */ +#define FXGMAC_ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ +#define FXGMAC_ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ +#define FXGMAC_ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ +#define FXGMAC_ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ +#define FXGMAC_ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ +#define FXGMAC_ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */ +#define FXGMAC_ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymmetric pause */ +#define FXGMAC_ADVERTISE_RESV 0x1000 /* Unused... */ +#define FXGMAC_ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */ +#define FXGMAC_ADVERTISE_LPACK 0x4000 /* Ack link partners response */ +#define FXGMAC_ADVERTISE_NPAGE 0x8000 /* Next page bit */ + +/* 1000BASE-T Control register(0x09) */ +#define FXGMAC_ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */ +#define FXGMAC_ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */ + +#define REG_BIT_ADVERTISE_1000_CAP (FXGMAC_ADVERTISE_1000FULL | FXGMAC_ADVERTISE_1000HALF) +#define REG_BIT_ADVERTISE_100_10_CAP (FXGMAC_ADVERTISE_100FULL | FXGMAC_ADVERTISE_100HALF | FXGMAC_ADVERTISE_10FULL | FXGMAC_ADVERTISE_10HALF ) + +#ifndef SPEED_1000M +#define SPEED_1000M 1000 +#endif +#ifndef SPEED_100M +#define SPEED_100M 100 +#endif +#ifndef SPEED_10M +#define SPEED_10M 10 +#endif + +#ifndef SPEED_UNKNOWN +#define SPEED_UNKNOWN 0xffff +#endif + +#ifndef DUPLEX_FULL +#define DUPLEX_FULL 1 +#endif +#ifndef DUPLEX_HALF +#define DUPLEX_HALF 0 +#endif + +#ifndef BIT +#define BIT(n) (0x1<<(n)) +#endif + +#ifndef FXGMAC_EPHY_SPEED_MODE_BIT +#define FXGMAC_EPHY_SPEED_MODE 0xc000 +#define FXGMAC_EPHY_DUPLEX 0x2000 +#define FXGMAC_EPHY_SPEED_MODE_BIT 14 +#define FXGMAC_EPHY_DUPLEX_BIT 13 +#define FXGMAC_EPHY_LINK_STATUS_BIT 10 + +#endif + +#define FXGMAC_EPHY_SMI_SEL_PHY 0x0 +#define FXGMAC_EPHY_SMI_SEL_SDS_QSGMII 0x02 +#define FXGMAC_EPHY_SMI_SEL_SDS_SGMII 0x03 + +#define REG_MII_EXT_AFE_CONTROL_REGISTER3 0x12 +#define REG_MII_EXT_AFE_CONTROL_CLKDAC_AON_POS 13 +#define REG_MII_EXT_AFE_CONTROL_CLKDAC_AON_LEN 1 +#define REG_MII_EXT_AFE_CONTROL_CLKDAC_AON_ON 1 +#define REG_MII_EXT_ANALOG_CFG3 0x52 +#define MII_EXT_ANALOG_CFG3_ADC_START_CFG_POS 14 +#define MII_EXT_ANALOG_CFG3_ADC_START_CFG_LEN 2 +// VGA bandwidth, default is 2 after reset. Set to 0 to mitigate unstable issue in 130m. +#define MII_EXT_ANALOG_CFG3_ADC_START_CFG_DEFAULT 0x0 +#define MII_EXT_ANALOG_CFG3_ON_TIME_CFG_POS 12 +#define MII_EXT_ANALOG_CFG3_ON_TIME_CFG_LEN 2 +#define MII_EXT_ANALOG_CFG3_VGA_AMP_GAIN_CFG_POS 8 +#define MII_EXT_ANALOG_CFG3_VGA_AMP_GAIN_CFG_LEN 4 +#define MII_EXT_ANALOG_CFG3_VGA_IBIAS_CFG_POS 4 +#define MII_EXT_ANALOG_CFG3_VGA_IBIAS_CFG_LEN 3 +#define MII_EXT_ANALOG_CFG3_OCP_CFG_POS 2 +#define MII_EXT_ANALOG_CFG3_OCP_CFG_LEN 2 +#define MII_EXT_ANALOG_CFG3_VGA_LPF_CFG_POS 0 +#define MII_EXT_ANALOG_CFG3_VGA_LPF_CFG_LEN 2 + +#define REG_MII_EXT_PMA_DEBUG_KCOEF 0x78 +#define MII_EXT_PMA_DEBUG_KCOEF_IPR_KCOEF_GE_LNG_POS 8 +#define MII_EXT_PMA_DEBUG_KCOEF_IPR_KCOEF_GE_LNG_LEN 6 +// After reset, it's 0x10. We need change it to 0x20 to make it easier to linkup in gigabit mode with long cable. +#define MII_EXT_PMA_DEBUG_KCOEF_IPR_KCOEF_GE_LNG_DEFAULT 0x20 +#define MII_EXT_PMA_DEBUG_KCOEF_IPR_KCOEF_DEFAULT_POS 0 +#define MII_EXT_PMA_DEBUG_KCOEF_IPR_KCOEF_DEFAULT_LEN 6 + +#define REG_MII_EXT_LPBK_REG 0x0a +#define REG_MII_EXT_LPBK_REG_ENABLE_LOOPBACK 0x3a18 +#define REG_MII_EXT_LPBK_REG_CLEAN_LOOPBACK 0x3a08 +#define REG_MII_EXT_SLEEP_CONTROL_REG 0x27 +#define REG_MII_EXT_SLEEP_REG_ENABLE_LOOPBACK 0x6812 +#define REG_MII_EXT_SLEEP_REG_CLEAN_LOOPBACK 0xe812 + +#define REG_MII_EXT_ANALOG_CFG2 0x51 +#define REG_MII_EXT_ANALOG_CFG2_VALUE 0x4a9 +#define REG_MII_EXT_ANALOG_CFG8 0x57 +#define REG_MII_EXT_ANALOG_CFG8_VALUE 0x274c +#define REG_MII_EXT_ANALOG_CFG8_137D1D05_VALUE 0x264c + +#define REG_MII_EXT_COMMON_LED_CFG 0xa00b +#define REG_MII_EXT_COMMON_LED0_CFG 0xa00c +#define REG_MII_EXT_COMMON_LED0_CFG_VALUE_SOLUTION0 0x2600 +#define REG_MII_EXT_COMMON_LED0_CFG_VALUE_SOLUTION1 0x00 +#define REG_MII_EXT_COMMON_LED0_CFG_VALUE_SOLUTION2 0x20 +#define REG_MII_EXT_COMMON_LED0_CFG_VALUE_SOLUTION3 0x2600 +#define REG_MII_EXT_COMMON_LED1_CFG 0xa00d +#define REG_MII_EXT_COMMON_LED1_CFG_VALUE_SOLUTION0 0x1800 +#define REG_MII_EXT_COMMON_LED1_CFG_VALUE_SOLUTION1 0x00 +#define REG_MII_EXT_COMMON_LED1_CFG_VALUE_SOLUTION2 0x40 +#define REG_MII_EXT_COMMON_LED2_CFG 0xa00e +#define REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION0 0x00 +#define REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION2 0x07 +#define REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION3 0x20 +#define REG_MII_EXT_COMMON_LED2_CFG_VALUE_SOLUTION4 0x1800 +#define REG_MII_EXT_COMMON_LED_BLINK_CFG 0xa00f +#define REG_MII_EXT_COMMON_LED_BLINK_CFG_SOLUTION2 0x0f + +#define REG_MII_EXT_COMMON_LED0_CFG_VALUE_SLEEP_SOLUTION3 0x2600 + +#define REG_MII_EXT_PKG_CFG0 0xa0 +#define REG_MII_EXT_PKG_CHECK_POS 14 +#define REG_MII_EXT_PKG_CHECK_LEN 2 +#define REG_MII_EXT_PKG_ENABLE_CHECK 0x2 +#define REG_MII_EXT_PKG_DISABLE_CHECK 0x1 +#define REG_MII_EXT_SLEEP_CONTROL1 0x27 +#define MII_EXT_SLEEP_CONTROL1_EN_POS 15 +#define MII_EXT_SLEEP_CONTROL1_EN_LEN 1 +#define MII_EXT_SLEEP_CONTROL1_PLLON_IN_SLP_POS 14 +#define MII_EXT_SLEEP_CONTROL1_PLLON_IN_SLP_LEN 1 +#define REG_MII_EXT_PKG_RX_VALID0 0xa3 +#define REG_MII_EXT_REG_RX_VALID1 0xa4 +#define REG_MII_EXT_REG_RX_OS0 0xa5 +#define REG_MII_EXT_REG_RX_OS1 0xa6 +#define REG_MII_EXT_REG_RX_US0 0xa7 +#define REG_MII_EXT_REG_RX_US1 0xa8 +#define REG_MII_EXT_REG_RX_ERR 0xa9 +#define REG_MII_EXT_REG_RX_0S_BAD 0xaa +#define REG_MII_EXT_REG_RX_FRAGMENT 0xab +#define REG_MII_EXT_REG_RX_NOSFD 0xac +#define REG_MII_EXT_REG_TX_VALID0 0xad +#define REG_MII_EXT_REG_TX_VALID1 0xae +#define REG_MII_EXT_REG_TX_OS0 0xaf +#define REG_MII_EXT_REG_TX_OS1 0xb0 +#define REG_MII_EXT_REG_TX_US0 0xb1 +#define REG_MII_EXT_REG_TX_US1 0xb2 +#define REG_MII_EXT_REG_TX_ERR 0xb3 +#define REG_MII_EXT_REG_TX_OS_BAD 0xb4 +#define REG_MII_EXT_REG_TX_FRAGMENT 0xb5 +#define REG_MII_EXT_REG_TX_NOSFD 0xb6 +#define REG_MII_EXT_REG_PMA_DBG0_ADC 0x13 +#define REG_MII_EXT_ENABLE_GIGA_POWER_SAVING_FOR_SHORT_CABLE 0x3538 +#define REG_MII_EXT_REG_CLD_REG0 0x3a0 +#define REG_MII_EXT_ENABLE_CLD_NP_WP 0xeb24 +#define REG_MII_EXT_REG_CLD_REG1 0x3cc +#define REG_MII_EXT_ENABLE_CLD_GT_HT_BT 0x7001 +#define REG_MMD_EEE_ABILITY_REG 0x3c +#define REG_MMD_EEE_ABILITY_VALUE 0x06 + +/* Below registers don't belong to GMAC, it has zero offset, not 0x2000 offset. mem_base + REG_XXX. */ +/* When issue happens, driver write this register to trigger pcie sniffer. */ +#define REG_PCIE_TRIGGER 0x1000 +#define PCIE_TRIGGER_CODE_TX_HANG 0x00000002 +#define PCIE_TRIGGER_CODE_LINKDOWN 0x00000003 + + +#define MGMT_EPHY_CTRL 0x1004 +/* check register address 0x1004 +* b[6:5] ephy_pause +* b[4:3] ephy_speed 0b10 1000m 0b01 100m +* b[2] ephy_duplex +* b[1] ephy_link +* b[0] ephy_reset.0-reset, 1-unreset. Should be set to 1 before use phy. +*/ +#define MGMT_EPHY_CTRL_RESET_POS 0 +#define MGMT_EPHY_CTRL_RESET_LEN 1 +#define MGMT_EPHY_CTRL_STA_EPHY_RESET 0 // 0: reset state. +#define MGMT_EPHY_CTRL_STA_EPHY_RELEASE 1 // 1: release state. +#define MGMT_EPHY_CTRL_STA_EPHY_LINKUP 2 // 1: link up; 0: link down. +#define MGMT_EPHY_CTRL_STA_EPHY_LINKUP_POS 1 +#define MGMT_EPHY_CTRL_STA_EPHY_LINKUP_LEN 1 +#define MGMT_EPHY_CTRL_STA_EPHY_DUPLEX_POS 2 // ephy duplex +#define MGMT_EPHY_CTRL_STA_EPHY_DUPLEX_LEN 1 + +#define MGMT_EPHY_CTRL_STA_SPEED_POS 3 +#define MGMT_EPHY_CTRL_STA_SPEED_LEN 2 +#define MGMT_EPHY_CTRL_STA_SPEED_MASK 0x18 + +#define MGMT_EPHY_CTRL_ERROR_VALUE 0xffffffff + +#define MGMT_PCIE_EP_CTRL 0x1008 + +#define MGMT_PCIE_EP_CTRL_DBI_CS_EN_POS 0 +#define MGMT_PCIE_EP_CTRL_DBI_CS_EN_LEN 1 + +#define MGMT_PCIE_CFG_CTRL 0x8bc +#define PCIE_CFG_CTRL_DEFAULT_VAL 0x7ff40 + +#define MGMT_PCIE_CFG_CTRL_CS_EN_POS 0 +#define MGMT_PCIE_CFG_CTRL_CS_EN_LEN 1 + +/* power management */ +#define WOL_CTL 0x100c +#define WOL_PKT_EN_POS 1 //set means magic and remote packet wakeup enable +#define WOL_PKT_EN_LEN 1 +#define WOL_LINKCHG_EN_POS 0 //set means link change wakeup enable +#define WOL_LINKCHG_EN_LEN 1 +#define WOL_WAIT_TIME_POS 2 +#define WOL_WAIT_TIME_LEN 13 + +#define OOB_WOL_CTRL 0x1010 +#define OOB_WOL_CTRL_DIS_POS 0 +#define OOB_WOL_CTRL_DIS_LEN 1 + +#define MGMT_INT_CTRL0 0x1100 +/* b3:0 per rx ch interrupt + * b7:4 per tx ch interrupt + * b8 Safety interrupt signal for un-correctable error + * b9 Safety interrupt signal for correctable error + * b10 Interrupt signal to host system + * b11 Magic Packet Received or Remote Wake-up Packet Received + * b12 ethernet phy interrupt + */ + +/* MAC management registers bit positions and sizes */ +#define MGMT_INT_CTRL0_INT_MASK_POS 16 +#define MGMT_INT_CTRL0_INT_MASK_LEN 16 +#define MGMT_INT_CTRL0_INT_MASK_MASK 0xffff +#define MGMT_INT_CTRL0_INT_MASK_RXCH 0xf +#define MGMT_INT_CTRL0_INT_MASK_TXCH 0x10 +#define MGMT_INT_CTRL0_INT_MASK_EX_PMT 0xf7ff +#define MGMT_INT_CTRL0_INT_MASK_DISABLE 0xf000 + +#define MGMT_INT_CTRL0_INT_STATUS_POS 0 +#define MGMT_INT_CTRL0_INT_STATUS_LEN 16 +#define MGMT_INT_CTRL0_INT_STATUS_MASK 0xffff +#define MGMT_INT_CTRL0_INT_STATUS_RX 0x0001 +#define MGMT_INT_CTRL0_INT_STATUS_TX 0x0010 +#define MGMT_INT_CTRL0_INT_STATUS_TX_INVERSE 0xffef +#define MGMT_INT_CTRL0_INT_STATUS_MISC_INVERSE 0xffdf +#define MGMT_INT_CTRL0_INT_STATUS_MISC 0x0020 + +#define MGMT_INT_CTRL0_INT_MASK_RXCH_POS 16 +#define MGMT_INT_CTRL0_INT_STATUS_RXCH_POS 0 +#define MGMT_INT_CTRL0_INT_STATUS_RXCH_LEN 4 +#define MGMT_INT_CTRL0_INT_STATUS_RXCH_MASK 0xf +#define MGMT_INT_CTRL0_INT_STATUS_RXTX_LEN 5 +#define MGMT_INT_CTRL0_INT_STATUS_RXTX_MASK 0x1f +#define MGMT_INT_CTRL0_INT_STATUS_RXTXMISC_MASK 0x3f + +#define MGMT_INT_CTRL0_INT_MASK_TXCH_POS 20 +#define MGMT_INT_CTRL0_INT_STATUS_TXCH_POS 4 +#define MGMT_INT_CTRL0_INT_STATUS_TXCH_LEN 1 +#define MGMT_INT_CTRL0_INT_STATUS_TXCH_MASK 0x1 + +#define MGMT_MAC_PHYIF_STA_POS 0 +#define MGMT_MAC_AN_SR0_POS 1 +#define MGMT_MAC_AN_SR1_POS 2 +#define MGMT_MAC_AN_SR2_POS 3 +#define MGMT_MAC_PMT_STA_POS 4 +#define MGMT_MAC_LPI_STA_POS 5 +#define MGMT_MAC_MMC_STA_POS 8 +#define MGMT_MAC_RX_MMC_STA_POS 9 +#define MGMT_MAC_TX_MMC_STA_POS 10 +#define MGMT_MMC_IPCRXINT_POS 11 +#define MGMT_MAC_TX_RX_STA0_POS 13 +#define MGMT_MAC_TX_RX_STA1_POS 14 +#define MGMT_MAC_GPIO_SR_POS 15 + +/* Interrupt Ctrl1 */ +#define INT_CTRL1 0x1104 +#define INT_CTRL1_TMR_CNT_CFG_MAX_POS 0 /* Timer counter cfg max. Default 0x19, 1us. */ +#define INT_CTRL1_TMR_CNT_CFG_MAX_LEN 10 +#define INT_CTRL1_TMR_CNT_CFG_DEF_VAL 0x19 +#define INT_CTRL1_MSI_AIO_EN_POS 16 +#define INT_CTRL1_MSI_AIO_EN_LEN 1 + +/* Interrupt Moderation */ +#define INT_MOD 0x1108 +#define INT_MOD_TX_POS 16 +#define INT_MOD_TX_LEN 12 +#define INT_MOD_RX_POS 0 +#define INT_MOD_RX_LEN 12 +#define INT_MOD_IN_US 200 /*in us*/ + +/* PCIE LTR 2 working modes: + * Two working mode: + * 1. SW trigger + * LTR idle threshold timer set as 0, enable LTR enable will trigger one LTR message + * Note: PCIe cfg enable should set in initialization before enable LTR. + * 2. HW auto trigger + * LTR idle threshold timer set as one non-zero value, HW monitor system status, + * when system idle timer over threshold, HW send out LTR message + * system exit idle state, send out one LTR exit message. + */ +#define LTR_CTRL 0x1130 +#define LTR_CTRL_IDLE_THRE_TIMER_POS 16 +#define LTR_CTRL_IDLE_THRE_TIMER_LEN 14 /* in 8ns units*/ +#define LTR_CTRL_IDLE_THRE_TIMER_VAL 0x3fff +#define LTR_CTRL_EN_POS 0 +#define LTR_CTRL_EN_LEN 1 + +#define LTR_CTRL1 0x1134 /* LTR latency message, only for SW enable. */ +#define LTR_CTRL1_LTR_MSG_POS 0 +#define LTR_CTRL1_LTR_MSG_LEN 32 + +#define LTR_CTRL2 0x1138 +#define LTR_CTRL2_DBG_DATA_POS 0 +#define LTR_CTRL2_DBG_DATA_LEN 32 + +#define LTR_IDLE_ENTER 0x113c /* LTR_CTRL3, LTR latency message, only for System IDLE Start. */ +#define LTR_IDLE_ENTER_POS 0 +#define LTR_IDLE_ENTER_LEN 10 +#define LTR_IDLE_ENTER_USVAL 900 +#define LTR_IDLE_ENTER_SCALE_POS 10 +#define LTR_IDLE_ENTER_SCALE_LEN 5 +#define LTR_IDLE_ENTER_SCALE 2 /* 0-1ns, 1-32ns, 2-1024ns, 3-32,768ns, 4-1,048,576ns, 5-33,554,432ns, 110-111-Not Permitted.*/ +#define LTR_IDLE_ENTER_REQUIRE_POS 15 +#define LTR_IDLE_ENTER_REQUIRE_LEN 1 +#define LTR_IDLE_ENTER_REQUIRE 1 + +#define LTR_IDLE_EXIT 0x1140 /* LTR_CTRL4, LTR latency message, only for System IDLE End. */ +#define LTR_IDLE_EXIT_POS 0 +#define LTR_IDLE_EXIT_LEN 10 +#define LTR_IDLE_EXIT_USVAL 171 +#define LTR_IDLE_EXIT_SCALE_POS 10 +#define LTR_IDLE_EXIT_SCALE_LEN 5 +#define LTR_IDLE_EXIT_SCALE 2 +#define LTR_IDLE_EXIT_REQUIRE_POS 15 +#define LTR_IDLE_EXIT_REQUIRE_LEN 1 +#define LTR_IDLE_EXIT_REQUIRE 1 + +#define LPW_CTRL 0x1188 +#define LPW_CTRL_L1SS_EN_POS 22 +#define LPW_CTRL_L1SS_EN_LEN 1 +#define LPW_CTRL_L1SS_SEL_POS 21 /* 0 - up to both CFG0x158 and reg1188 L1ss setting. 1 - up to CFG0x158 L1ss setting. */ +#define LPW_CTRL_L1SS_SEL_LEN 1 +#define LPW_CTRL_L1SS_SEL_CFG 1 +#define LPW_CTRL_ASPM_L1_CPM_POS 19 /*L1.CPM mode enable bit. Default 0,set as 1 enable this mode. clkreq pin need to connect RC*/ +#define LPW_CTRL_ASPM_L1_CPM_LEN 1 +#define LPW_CTRL_ASPM_L0S_EN_POS 17 +#define LPW_CTRL_ASPM_L0S_EN_LEN 1 +#define LPW_CTRL_ASPM_L1_EN_POS 16 +#define LPW_CTRL_ASPM_L1_EN_LEN 1 +#define LPW_CTRL_ASPM_LPW_EN_POS 9 /* application ready to enter L23. */ +#define LPW_CTRL_ASPM_LPW_EN_LEN 1 +#define LPW_CTRL_SYS_CLK_125_SEL_POS 8 /* system 125M select: 125M or 62.5MHz. Default: 125MHz.*/ +#define LPW_CTRL_SYS_CLK_125_SEL_LEN 1 +#define LPW_CTRL_PCIE_RADM_CG_EN_POS 5 /* clock gating enable bit of PCIe Radm clock. Default 1; set as 1, enable gating.*/ +#define LPW_CTRL_PCIE_RADM_CG_EN_LEN 1 +#define LPW_CTRL_PCIE_CORE_CG_EN_POS 4 /* clock gating enable bit of PCIe Core clock. Default 1; set as 1, enable gating.*/ +#define LPW_CTRL_PCIE_CORE_CG_EN_LEN 1 +#define LPW_CTRL_PCIE_AXI_CG_EN_POS 3 /* clock gating enable bit of PCIe AXI clock.Default 1; set as 1, enable gating.*/ +#define LPW_CTRL_PCIE_AXI_CG_EN_LEN 1 +#define LPW_CTRL_GMAC_AXI_CG_EN_POS 2 /* clock gating enable bit of GMAC AXI clock. Default 1; set as 1, enable gating.*/ +#define LPW_CTRL_GMAC_AXI_CG_EN_LEN 1 +#define LPW_CTRL_MDIO2APB_CG_EN_POS 1 /* clock gating enable bit of MDIO2APB, default 1. Set as 1, enable clock gating feature. */ +#define LPW_CTRL_MDIO2APB_CG_EN_LEN 1 +#define LPW_CTRL_OTP_CLK_ON_POS 0 /* Turn on before SW OTP operation, default 1. */ +#define LPW_CTRL_OTP_CLK_ON_LEN 1 + +#define MSI_PBA_REG 0x1300 +#define SYS_RESET_REG 0x152c +#define SYS_RESET_POS 31 +#define SYS_RESET_LEN 1 + +#define REG_PCIE_PSM_STATE 0x1994 /* PCIe PHY power state. */ +#define PCIE_PSM_STATE_POS 0 +#define PCIE_PSM_STATE_LEN 4 +#define PCIE_PSM_STATE_P0 2 +#define PCIE_PSM_STATE_P0s 3 +#define PCIE_PSM_STATE_P1 4 +#define PCIE_PSM_STATE_P1_CPM 5 +#define PCIE_PSM_STATE_P1_1 6 +#define PCIE_PSM_STATE_P1_2 7 +#define PCIE_PSM_STATE_P2 8 + +#define REG_PCIE_SERDES_STATUS 0x1998 +#define PCIE_SERDES_STATUS_DRV_ON_POS 11 +#define PCIE_SERDES_STATUS_DRV_ON_LEN 1 +#define PCIE_SERDES_STATUS_RX_PD_POS 10 +#define PCIE_SERDES_STATUS_RX_PD_LEN 1 +#define PCIE_SERDES_STATUS_PI_PD_POS 9 +#define PCIE_SERDES_STATUS_PI_PD_LEN 1 +#define PCIE_SERDES_STATUS_SIGDET_ON_POS 8 +#define PCIE_SERDES_STATUS_SIGDET_ON_LEN 1 +#define PCIE_SERDES_STATUS_TX_VCM_POS 7 +#define PCIE_SERDES_STATUS_TX_VCM_LEN 1 +#define PCIE_SERDES_STATUS_RX_RT50_POS 6 +#define PCIE_SERDES_STATUS_RX_RT50_LEN 1 +#define PCIE_SERDES_STATUS_BEACON_ON_POS 5 +#define PCIE_SERDES_STATUS_BEACON_ON_LEN 1 +#define PCIE_SERDES_STATUS_PLL_ON_POS 4 +#define PCIE_SERDES_STATUS_PLL_ON_LEN 1 +#define PCIE_SERDES_STATUS_REFCLK_ON_POS 3 +#define PCIE_SERDES_STATUS_REFCLK_ON_LEN 1 +#define PCIE_SERDES_STATUS_LDO_ON_POS 2 +#define PCIE_SERDES_STATUS_LDO_ON_LEN 1 +#define PCIE_SERDES_STATUS_HW_EN_SDS_BIAS_POS 1 +#define PCIE_SERDES_STATUS_HW_EN_SDS_BIAS_LEN 1 +#define PCIE_SERDES_STATUS_HW_BIAS_ON_POS 0 +#define PCIE_SERDES_STATUS_HW_BIAS_ON_LEN 1 + +#define REG_PCIE_SERDES_PLL 0x199c +#define PCIE_SERDES_PLL_AUTOOFF_POS 0 +#define PCIE_SERDES_PLL_AUTOOFF_LEN 1 + +#define NS_OF_GLB_CTL 0x1B00 +#define NS_TPID_PRO 0x1B04 +#define NS_LUT_ROMOTE0 0x1B08 +#define NS_LUT_ROMOTE1 0X1B0C +#define NS_LUT_ROMOTE2 0X1B10 +#define NS_LUT_ROMOTE3 0X1B14 +#define NS_LUT_TARGET0 0X1B18 +#define NS_LUT_TARGET1 0X1B1C +#define NS_LUT_TARGET2 0X1B20 +#define NS_LUT_TARGET3 0X1B24 +#define NS_LUT_SOLICITED0 0X1B28 +#define NS_LUT_SOLICITED1 0X1B2C +#define NS_LUT_SOLICITED2 0X1B30 +#define NS_LUT_SOLICITED3 0X1B34 +#define NS_LUT_MAC_ADDR 0X1B38 +#define NS_LUT_MAC_ADDR_CTL 0X1B3C +#define NS_LUT_TARGET4 0X1B78 +#define NS_LUT_TARGET5 0X1B7c +#define NS_LUT_TARGET6 0X1B80 +#define NS_LUT_TARGET7 0X1B84 + +#define NS_OF_GLB_CTL_TX_CLK_EN_POS 2 +#define NS_OF_GLB_CTL_TX_CLK_EN_LEN 1 +#define NS_OF_GLB_CTL_RX_CLK_EN_POS 1 +#define NS_OF_GLB_CTL_RX_CLK_EN_LEN 1 +#define NS_OF_GLB_CTL_EN_POS 0 +#define NS_OF_GLB_CTL_EN_ELN 1 +#define NS_TPID_PRO_STPID_POS 16 +#define NS_TPID_PRO_STPID_LEN 16 +#define NS_TPID_PRO_CTPID_POS 0 +#define NS_TPID_PRO_CTPID_LEN 16 +#define NS_LUT_DST_CMP_TYPE_POS 19 +#define NS_LUT_DST_CMP_TYPE_LEN 1 +#define NS_LUT_DST_IGNORED_POS 18 +#define NS_LUT_DST_IGNORED_LEN 1 +#define NS_LUT_REMOTE_AWARED_POS 17 +#define NS_LUT_REMOTE_AWARED_LEN 1 +#define NS_LUT_TARGET_ISANY_POS 16 +#define NS_LUT_TARGET_ISANY_LEN 1 +#define NS_LUT_MAC_ADDR_LOW_POS 0 +#define NS_LUT_MAC_ADDR_LOW_LEN 16 + +/* RSS implementation registers, 20210817 */ + +/* 10 RSS key registers */ +#define MGMT_RSS_KEY0 0x1020 +#define MGMT_RSS_KEY9 0x1044 +#define MGMT_RSS_KEY_REG_INC 0x4 + +/* RSS control register */ +#define MGMT_RSS_CTRL 0x1048 +/* b31 enable + * b12:10 indirection table size. 2^(val+1) + * b9:8 default Queue NO. + * b7:0 hash type or options + */ + +/* RSS ctrl register bit definitions. + * [0] ipv4 + * [1] tcpv4 + * [2] udpv4 + * [3] ipv6 + * [4] tcpv6 + * [5] udpv6 + * [6] only ipv4 udp check IP hash + * [7] only ipv6 udp check IP hash + */ +#define MGMT_RSS_CTRL_OPT_POS 0 +#define MGMT_RSS_CTRL_OPT_LEN 8 +#define MGMT_RSS_CTRL_OPT_MASK 0xff +#define MGMT_RSS_CTRL_IPV4_EN 0x01 +#define MGMT_RSS_CTRL_TCPV4_EN 0x02 +#define MGMT_RSS_CTRL_UDPV4_EN 0x04 +#define MGMT_RSS_CTRL_IPV6_EN 0x08 +#define MGMT_RSS_CTRL_TCPV6_EN 0x10 +#define MGMT_RSS_CTRL_UDPV6_EN 0x20 +#define MGMT_RSS_CTRL_IPV4 0x0 +#define MGMT_RSS_CTRL_IPV4 0x0 + +#define MGMT_RSS_CTRL_DEFAULT_Q_POS 8 +#define MGMT_RSS_CTRL_DEFAULT_Q_LEN 2 +#define MGMT_RSS_CTRL_DEFAULT_Q_MASK 0x3 + +#define MGMT_RSS_CTRL_TBL_SIZE_POS 10 +#define MGMT_RSS_CTRL_TBL_SIZE_LEN 3 +#define MGMT_RSS_CTRL_TBL_SIZE_MASK 0x7 + +#define MAC_RSSCR_IP2TE_POS 1 +#define MAC_RSSCR_IP2TE_LEN 1 +#define MAC_RSSCR_RSSE_POS 31 +#define MAC_RSSCR_RSSE_LEN 1 + +/* rss indirection table (IDT) */ +#define MGMT_RSS_IDT 0x1050 +/* b0:1 entry0 + * b2:3 entry1 + * ... + */ +#define MGMT_RSS_IDT_REG_INC 4 +#define MGMT_RSS_IDT_ENTRY_PER_REG 16 +#define MGMT_RSS_IDT_ENTRY_MASK 0x3 +#define MAC_CRC_LENGTH 4 + + /* osc_ctrl */ +#define MGMT_XST_OSC_CTRL 0x1158 +#define MGMT_XST_OSC_CTRL_XST_OSC_SEL_POS 2 +#define MGMT_XST_OSC_CTRL_XST_OSC_SEL_LEN 1 +#define MGMT_XST_OSC_CTRL_EN_OSC_POS 1 +#define MGMT_XST_OSC_CTRL_EN_OSC_LEN 1 +#define MGMT_XST_OSC_CTRL_EN_XST_POS 0 +#define MGMT_XST_OSC_CTRL_EN_XST_LEN 1 + +#define MGMT_WPI_CTRL0 0x1160 +/* b1:0 wpi_mode "2b00: normal working mode; 2b01: WPI write mode, work in sleep mode; 2b10: WPI read mode, work after sleep before normal working mode;" + * b2 ram_op_done Each row ram read done, SW can start read after done; + * b3 wpi_op_done WPI read done for the total packet; + * b17:4 wpi_pkt_len WOL packet length, unit byte; + * b31 wpi_fail Error status in Sleep mode; + */ +#define MGMT_WPI_CTRL0_WPI_MODE_POS 0 +#define MGMT_WPI_CTRL0_WPI_MODE_LEN 2 +#define MGMT_WPI_CTRL0_WPI_MODE_NORMAL 0x00 // normal working mode. +#define MGMT_WPI_CTRL0_WPI_MODE_WR 0x01 // WPI write mode, work in sleep mode. +#define MGMT_WPI_CTRL0_WPI_MODE_RD 0x02 // WPI read mode, work after sleep before normal working mode. +#define MGMT_WPI_CTRL0_RAM_OP_DONE 0x4 +#define MGMT_WPI_CTRL0_WPI_OP_DONE 0x8 +#define MGMT_WPI_CTRL0_WPI_PKT_LEN_POS 4 +#define MGMT_WPI_CTRL0_WPI_PKT_LEN_LEN 14 +#define MGMT_WPI_CTRL0_WPI_FAIL 0x80000000 + +#define MGMT_WPI_CTRL1_DATA 0x1164 + +#define MGMT_WOL_CTRL 0x1530 +/* b0 link_chg_status 1: waken by link-change + * b1 mgk_pkt_status 1: waken by magic-packet + * b2 rwk_pkt_status 1: waken by remote patten packet + */ +#define MGMT_WOL_CTRL_WPI_LINK_CHG 1 +#define MGMT_WOL_CTRL_WPI_MGC_PKT 2 +#define MGMT_WOL_CTRL_WPI_RWK_PKT 4 +#define MGMT_WOL_CTRL_WPI_RWK_PKT_NUMBER 0x010000 + +#define MGMT_RMK_CTRL 0x1400 + +#define MGMT_SIGDET_DEGLITCH 0x17f0 +#define MGMT_SIGDET_DEGLITCH_DISABLE_POS 2 //sigdet deglitch disable ,active low +#define MGMT_SIGDET_DEGLITCH_DISABLE_LEN 1 +#define MGMT_SIGDET_DEGLITCH_TIME_WIN_POS 3 //sigdet deglitch time windows filter seltion +#define MGMT_SIGDET_DEGLITCH_TIME_WIN_LEN 2 +#define MGMT_SIGDET_DEGLITCH_TIME_WIN_10ns 0 +#define MGMT_SIGDET_DEGLITCH_TIME_WIN_20ns 1 +#define MGMT_SIGDET_DEGLITCH_TIME_WIN_30ns 2 +#define MGMT_SIGDET_DEGLITCH_TIME_WIN_40ns 3 + +#define MGMT_SIGDET 0x17f8 +#define MGMT_SIGDET_POS 13 +#define MGMT_SIGDET_LEN 3 +#define MGMT_SIGDET_55MV 7 +#define MGMT_SIGDET_50MV 6 +#define MGMT_SIGDET_45MV 5 //default value +#define MGMT_SIGDET_40MV 4 +#define MGMT_SIGDET_35MV 3 +#define MGMT_SIGDET_30MV 2 +#define MGMT_SIGDET_25MV 1 +#define MGMT_SIGDET_20MV 0 + +#define FXGMAC_MTL_REG(pdata, n, reg) \ + ((pdata)->mac_regs + MTL_Q_BASE + ((n) * MTL_Q_INC) + (reg)) + +#define FXGMAC_DMA_REG(channel, reg) ((channel)->dma_regs + (reg)) + +//#define RSS_Q_COUNT 4 +#define MSI_ID_RXQ0 0 +#define MSI_ID_RXQ1 1 +#define MSI_ID_RXQ2 2 +#define MSI_ID_RXQ3 3 +#define MSI_ID_TXQ0 4 + +#if 1//msi table modify to 6 0~3 rx 4 tx 5 phy/other +#define MSI_ID_PHY_OTHER 5 +//#define MSI_ID_TXQ2 6 +//#define MSI_ID_TXQ3 7 +//#define MSI_ID_SFTUE 8 +//#define MSI_ID_SFTCE 9 +//#define MSI_ID_SBD 10 +//#define MSI_ID_PMT 11 +//#define MSI_ID_PHY 12 + +#define MSIX_TBL_MAX_NUM 6 +#define MSIX_TBL_RXTX_NUM 5 + +#else +#define MSI_ID_TXQ1 5 +#define MSI_ID_TXQ2 6 +#define MSI_ID_TXQ3 7 +#define MSI_ID_SFTUE 8 +#define MSI_ID_SFTCE 9 +#define MSI_ID_SBD 10 +#define MSI_ID_PMT 11 +#define MSI_ID_PHY 12 + +#define MSIX_TBL_MAX_NUM 16 +#define MSIX_TBL_RXTX_NUM 8 +#endif +#define MSIX_TBL_BASE_ADDR 0x1200 +#define MSIX_TBL_MASK_OFFSET 0xc +#define MSIX_TBL_DATA_OFFSET 0x8 +#define MSIX_TBL_ADDR_OFFSET 0x0 + +/******************************************************************* + efuse entry. val31:0 -> offset15:0 + offset7:0 + offset15:8 + val7:0 + val15:8 + val23:16 + val31:24 +*******************************************************************/ +#define EFUSE_OP_CTRL_0 0x1500 +#define EFUSE_OP_WR_DATA_POS 16 +#define EFUSE_OP_WR_DATA_LEN 8 +#define EFUSE_OP_ADDR_POS 8 +#define EFUSE_OP_ADDR_LEN 8 +#define EFUSE_OP_START_POS 2 +#define EFUSE_OP_START_LEN 1 +#define EFUSE_OP_MODE_POS 0 +#define EFUSE_OP_MODE_LEN 2 +#define EFUSE_OP_MODE_ROW_WRITE 0x0 +#define EFUSE_OP_MODE_ROW_READ 0x1 +#define EFUSE_OP_MODE_AUTO_LOAD 0x2 +#define EFUSE_OP_MODE_READ_BLANK 0x3 + +#define EFUSE_OP_CTRL_1 0x1504 +#define EFUSE_OP_RD_DATA_POS 24 +#define EFUSE_OP_RD_DATA_LEN 8 +#define EFUSE_OP_BIST_ERR_ADDR_POS 16 +#define EFUSE_OP_BIST_ERR_ADDR_LEN 8 +#define EFUSE_OP_BIST_ERR_CNT_POS 8 +#define EFUSE_OP_BIST_ERR_CNT_LEN 8 +#define EFUSE_OP_PGM_PASS_POS 2 +#define EFUSE_OP_PGM_PASS_LEN 1 +#define EFUSE_OP_DONE_POS 1 +#define EFUSE_OP_DONE_LEN 1 + +//efuse layout refer to http://redmine.motor-comm.com/issues/3856 +#define EFUSE_FISRT_UPDATE_ADDR 255 +#define EFUSE_SECOND_UPDATE_ADDR 209 +#define FXGMAC_EFUSE_MAX_ENTRY 39 +#define FXGMAC_EFUSE_MAX_ENTRY_UNDER_LED_COMMON 24 +#define EFUSE_PATCH_ADDR_START_BYTE 0 +#define EFUSE_PATCH_DATA_START_BYTE 2 +#define EFUSE_REGION_A_B_LENGTH 18 +#define EFUSE_EACH_PATH_SIZE 6 + +#define EFUSE_REVID_REGISTER 0x0008 +#define EFUSE_SUBSYS_REGISTER 0x002c +#define MACA0LR_FROM_EFUSE 0x1520 //mac[5]->bit7:0, mac[4]->bit15:8, mac[3]->bit23:16, mac[2]->bit31:24. +#define MACA0HR_FROM_EFUSE 0x1524 //mac[1]->bit7:0, mac[0]->bit15:8. mac[6] = {00, 01, 02, 03, 04, 05} 00-01-02-03-04-05. + +#define EFUSE_LED_ADDR 0x00 +#define EFUSE_LED_POS 0 +#define EFUSE_LED_LEN 5 +#define EFUSE_OOB_ADDR 0x07 +#define EFUSE_OOB_POS 2 +#define EFUSE_OOB_LEN 1 +#define EFUSE_LED_SOLUTION0 0 +#define EFUSE_LED_SOLUTION1 1 +#define EFUSE_LED_SOLUTION2 2 +#define EFUSE_LED_SOLUTION3 3 +#define EFUSE_LED_SOLUTION4 4 +#define EFUSE_LED_COMMON_SOLUTION 0x1f + +/******************** Below for pcie configuration register. *********************/ +#define REG_PCI_VENDOR_ID 0x0 /* WORD reg */ +#define REG_PCI_DEVICE_ID 0x2 /* WORD reg */ +#define PCI_DEVICE_ID_FUXI 0x6801 + +#define REG_PCI_COMMAND 0x4 +#define PCI_COMMAND_IO_SPACE_POS 0 +#define PCI_COMMAND_IO_SPACE_LEN 1 +#define PCI_COMAMND_MEM_SPACE_POS 1 +#define PCI_COMAMND_MEM_SPACE_LEN 1 +#define PCI_COMMAND_MASTER_POS 2 +#define PCI_COMMAND_MASTER_LEN 1 +#define PCI_COMMAND_DIS_INT_POS 10 +#define PCI_COMMAND_DIS_INT_LEN 1 +#define PCI_COMMAND_INTX_STATUS_POS 19 +#define PCI_COMMAND_INTX_STATUS_LEN 1 + +#define REG_PCI_REVID 0x8 /* BYTE reg */ +#define REG_PCI_PROGRAM_INTF 0x9 /* BYTE reg PCI Class Program Interface */ +#define REG_PCI_SUB_CLASS 0xa /* BYTE reg */ +#define REG_PCI_BASE_CLASS 0xb /* BYTE reg */ +#define REG_CACHE_LINE_SIZE 0xc + + +#define REG_MEM_BASE 0x10 /* DWORD or QWORD reg */ +#define REG_MEM_BASE_HI 0x14 /* DWORD or QWORD reg */ + +#define REG_IO_BASE 0x20 /* DWORD reg */ + +#define REG_PCI_SUB_VENDOR_ID 0x2c /* WORD reg */ +#define REG_PCI_SUB_DEVICE_ID 0x2e /* WORD reg */ + +#define REG_INT_LINE 0x3c /* BYTE reg */ + +#define REG_PM_STATCTRL 0x44 /* WORD reg */ +#define PM_STATCTRL_PWR_STAT_POS 0 +#define PM_STATCTRL_PWR_STAT_LEN 2 +#define PM_STATCTRL_PWR_STAT_D3 3 +#define PM_STATCTRL_PWR_STAT_D0 0 +#define PM_CTRLSTAT_PME_EN_POS 8 +#define PM_CTRLSTAT_PME_EN_LEN 1 +#define PM_CTRLSTAT_DATA_SEL_POS 9 +#define PM_CTRLSTAT_DATA_SEL_LEN 4 +#define PM_CTRLSTAT_DATA_SCAL_POS 13 +#define PM_CTRLSTAT_DATA_SCAL_LEN 2 +#define PM_CTRLSTAT_PME_STAT_POS 15 +#define PM_CTRLSTAT_PME_STAT_LEN 1 + +#define REG_DEVICE_CTRL1 0x78 +#define DEVICE_CTRL1_MPS_POS 5 //MPS: max payload size +#define DEVICE_CTRL1_MPS_LEN 3 +#define DEVICE_CTRL1_MPS_128B 0 +#define DEVICE_CTRL1_MPS_256B 1 +#define DEVICE_CTRL1_MPS_512B 2 +#define DEVICE_CTRL1_MPS_1024B 3 +#define DEVICE_CTRL1_MPS_2048B 4 +#define DEVICE_CTRL1_MPS_4096B 5 +#define DEVICE_CTRL1_CONTROL_POS 0 +#define DEVICE_CTRL1_CONTROL_LEN 16 +#define DEVICE_CTRL1_STATUS_POS 16 +#define DEVICE_CTRL1_STATUS_LEN 16 + +#define REG_PCI_LINK_CTRL 0x80 +#define PCI_LINK_CTRL_CONTROL_POS 0 +#define PCI_LINK_CTRL_CONTROL_LEN 16 +#define PCI_LINK_CTRL_ASPM_CONTROL_POS 0 +#define PCI_LINK_CTRL_ASPM_CONTROL_LEN 2 +#define PCI_LINK_CTRL_L1_STATUS 2 +#define PCI_LINK_CTRL_CONTROL_CPM_POS 8 /*L1.CPM mode enable bit. Default 0,set as 1 enable this mode. clkreq pin need to connect RC*/ +#define PCI_LINK_CTRL_CONTROL_CPM_LEN 1 +#define PCI_LINK_CTRL_STATUS_POS 16 +#define PCI_LINK_CTRL_STATUS_LEN 16 + +#define REG_DEVICE_CTRL2 0x98 /* WORD reg */ +#define DEVICE_CTRL2_LTR_EN_POS 10 /* Enable from BIOS side. */ +#define DEVICE_CTRL2_LTR_EN_LEN 1 + +#define REG_MSIX_CAPABILITY 0xb0 + +/* ASPM L1ss PM Substates */ +#define REG_ASPM_L1SS_CAP 0x154 /* Capabilities Register */ +#define ASPM_L1SS_CAP_PCIPM_L1_2_POS 0 /* PCI-PM L1.2 Supported */ +#define ASPM_L1SS_CAP_PCIPM_L1_2_LEN 1 +#define ASPM_L1SS_CAP_PCIPM_L1_1_POS 1 /* PCI-PM L1.1 Supported */ +#define ASPM_L1SS_CAP_PCIPM_L1_1_LEN 1 +#define ASPM_L1SS_CAP_ASPM_L1_2_POS 2 /* ASPM L1.2 Supported */ +#define ASPM_L1SS_CAP_ASPM_L1_2_LEN 1 +#define ASPM_L1SS_CAP_ASPM_L1_1_POS 3 /* ASPM L1.1 Supported */ +#define ASPM_L1SS_CAP_ASPM_L1_1_LEN 1 +#define ASPM_L1SS_CAP_L1_PM_SS_POS 4 /* L1 PM Substates Supported */ +#define ASPM_L1SS_CAP_L1_PM_SS_LEN 1 +#define ASPM_L1SS_CAP_CM_RESTORE_TIME_POS 8 /* Port Common_Mode_Restore_Time */ +#define ASPM_L1SS_CAP_CM_RESTORE_TIME_LEN 8 +#define ASPM_L1SS_CAP_P_PWR_ON_SCALE_POS 16 /* Port T_POWER_ON scale */ +#define ASPM_L1SS_CAP_P_PWR_ON_SCALE_LEN 2 +#define ASPM_L1SS_CAP_P_PWR_ON_VALUE_POS 19 /* Port T_POWER_ON value */ +#define ASPM_L1SS_CAP_P_PWR_ON_VALUE_LEN 5 + +#define REG_ASPM_L1SS_CTRL1 0x158 +#define REG_ASPM_L1SS_CTRL1_VALUE 0x405e000f +#define ASPM_L1SS_CTRL1_L12_PCIPM_EN_POS 0 /* L1.2 in D3 state. */ +#define ASPM_L1SS_CTRL1_L12_PCIPM_EN_LEN 1 +#define ASPM_L1SS_CTRL1_L11_PCIPM_EN_POS 1 /* L1.1 in D3 state. */ +#define ASPM_L1SS_CTRL1_L11_PCIPM_EN_LEN 1 +#define ASPM_L1SS_CTRL1_L12_EN_POS 2 +#define ASPM_L1SS_CTRL1_L12_EN_LEN 1 +#define ASPM_L1SS_CTRL1_L11_EN_POS 3 +#define ASPM_L1SS_CTRL1_L11_EN_LEN 1 +#define ASPM_L1SS_CTRL1_CM_RESTORE_TIME_POS 8 /* Common_Mode_Restore_Time */ +#define ASPM_L1SS_CTRL1_CM_RESTORE_TIME_LEN 8 +#define ASPM_L1SS_CTRL1_LTR_L12_TH_VALUE_POS 16 /* LTR_L1.2_THRESHOLD_Value */ +#define ASPM_L1SS_CTRL1_LTR_L12_TH_VALUE_LEN 10 +#define ASPM_L1SS_CTRL1_L12_TH_SCALE_POS 29 /* LTR_L1.2_THRESHOLD_Scale */ +#define ASPM_L1SS_CTRL1_L12_TH_SCALE_LEN 3 + +#define REG_ASPM_L1SS_CTL2 0x15c /* Control 2 Register */ + +#define REG_ASPM_CONTROL 0x70c +#define ASPM_L1_IDLE_THRESHOLD_POS 27 +#define ASPM_L1_IDLE_THRESHOLD_LEN 3 +#define ASPM_L1_IDLE_THRESHOLD_1US 0 +#define ASPM_L1_IDLE_THRESHOLD_2US 1 +#define ASPM_L1_IDLE_THRESHOLD_4US 2 +#define ASPM_L1_IDLE_THRESHOLD_8US 3 /* default value after reset. */ +#define ASPM_L1_IDLE_THRESHOLD_16US 4 +#define ASPM_L1_IDLE_THRESHOLD_32US 5 +#define ASPM_L1_IDLE_THRESHOLD_64US 6 + +#define REG_POWER_EIOS 0x710 +#define POWER_EIOS_POS 7 +#define POWER_EIOS_LEN 1 + +#define AISTONEID_137D1D05_ADJUST_SI 0x137d1d05 + +#endif /* __FXGMAC_GMAC_REG_H__ */ diff --git a/lede/package/kernel/yt6801/src/fuxi-gmac.h b/lede/package/kernel/yt6801/src/fuxi-gmac.h new file mode 100644 index 0000000000..8e3df2a96f --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-gmac.h @@ -0,0 +1,951 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + +#ifndef __FXGMAC_GMAC_H__ +#define __FXGMAC_GMAC_H__ + +#include "fuxi-os.h" +#include "fuxi-errno.h" + +// For fpga before 20210507 +#define FXGMAC_FPGA_VER_B4_0507 0 +#define FXGMAC_FPGA_VER_20210507 1 + +#define FXGMAC_DRV_NAME "yt6801" + +#define FXGMAC_DRV_DESC "Motorcomm YT6801 Gigabit Ethernet Driver" + +#define FXGMAC_MAC_REGS_OFFSET 0x2000 + +#define FXGMAC_EPHY_INTERRUPT_D0_OFF 0 //1: in normal D0 state, turn off ephy link change interrupt. +#define FXGMAC_ALLOC_NEW_RECBUFFER 0 //1:when rec buffer is not enough,to create rbd and rec buffer ,but the rdb need to be continus with the initialized rdb,so close the feature + +#define RESUME_MAX_TIME 3000000 +#define PHY_LINK_TIMEOUT 3000 +#define ESD_RESET_MAXIMUM 0 + +#define REGWR_RETRY_MAXIMUM 2600 +#define PCIE_LINKDOWN_VALUE 0xFFFFFFFF + +#define FXGMAC_MSIX_Q_VECTORS 4 + +#define FXGMAC_IS_CHANNEL_WITH_TX_IRQ(chId) (0 == (chId) ? 1 : 0) + +/* flags for ipv6 NS offload address, local link or Global unicast */ +#define FXGMAC_NS_IFA_LOCAL_LINK 1 +#define FXGMAC_NS_IFA_GLOBAL_UNICAST 2 + +#define FXGMAX_ASPM_WAR_EN +/* Descriptor related parameters */ +#if FXGMAC_TX_HANG_TIMER_ENABLED +#define FXGMAC_TX_DESC_CNT 1024 +#else +#define FXGMAC_TX_DESC_CNT 256 //256 to make sure the tx ring is in the 4k range when FXGMAC_TX_HANG_TIMER_ENABLED is 0 +#endif +#define FXGMAC_TX_DESC_MIN_FREE (FXGMAC_TX_DESC_CNT >> 3) +#define FXGMAC_TX_DESC_MAX_PROC (FXGMAC_TX_DESC_CNT >> 1) +#define FXGMAC_RX_DESC_CNT 1024 +#define FXGMAC_RX_DESC_MAX_DIRTY (FXGMAC_RX_DESC_CNT >> 3) + +/* Descriptors required for maximum contiguous TSO/GSO packet */ +#define FXGMAC_TX_MAX_SPLIT ((GSO_MAX_SIZE / FXGMAC_TX_MAX_BUF_SIZE) + 1) + +/* Maximum possible descriptors needed for a SKB */ +#define FXGMAC_TX_MAX_DESC_NR (MAX_SKB_FRAGS + FXGMAC_TX_MAX_SPLIT + 2) + +#define FXGMAC_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1)) +#define FXGMAC_RX_MIN_BUF_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN) +#define FXGMAC_RX_BUF_ALIGN 64 + +/* Maximum Size for Splitting the Header Data + * Keep in sync with SKB_ALLOC_SIZE + * 3'b000: 64 bytes, 3'b001: 128 bytes + * 3'b010: 256 bytes, 3'b011: 512 bytes + * 3'b100: 1023 bytes , 3'b101'3'b111: Reserved + */ +#define FXGMAC_SPH_HDSMS_SIZE 3 +#define FXGMAC_SKB_ALLOC_SIZE 512 + +#define FXGMAC_MAX_FIFO 81920 + +#define FXGMAC_MAX_DMA_CHANNELS FXGMAC_MSIX_Q_VECTORS +#define FXGMAC_DMA_STOP_TIMEOUT 5 +#define FXGMAC_DMA_INTERRUPT_MASK 0x31c7 +#define FXGMAC_MAX_DMA_CHANNELS_PLUS_1TX (FXGMAC_MAX_DMA_CHANNELS + 1) + +/* Default coalescing parameters */ +#define FXGMAC_INIT_DMA_TX_USECS INT_MOD_IN_US +#define FXGMAC_INIT_DMA_TX_FRAMES 25 +#define FXGMAC_INIT_DMA_RX_USECS INT_MOD_IN_US /* 30 */ +#define FXGMAC_INIT_DMA_RX_FRAMES 25 +#define FXGMAC_MAX_DMA_RIWT 0xff +#define FXGMAC_MIN_DMA_RIWT 0x01 + +/* Flow control queue count */ +#define FXGMAC_MAX_FLOW_CONTROL_QUEUES 8 + +/* System clock is 125 MHz */ +#define FXGMAC_SYSCLOCK 125000000 + +/* Maximum MAC address hash table size (256 bits = 8 bytes) */ +#define FXGMAC_MAC_HASH_TABLE_SIZE 8 + +/* wol pattern settings */ +#define MAX_PATTERN_SIZE 128 // PATTERN length +#define MAX_PATTERN_COUNT 16 // pattern count +#define MAX_LPP_ARP_OFFLOAD_COUNT 1 +#define MAX_LPP_NS_OFFLOAD_COUNT 2 + +#define MAX_WPI_LENGTH_SIZE 1536 // WPI packet. +#define PM_WAKE_PKT_ALIGN 8 // try use 64 bit boundary... + +/* Receive Side Scaling */ +#define FXGMAC_RSS_HASH_KEY_SIZE 40 +#define FXGMAC_RSS_MAX_TABLE_SIZE 128 +#define FXGMAC_RSS_LOOKUP_TABLE_TYPE 0 +#define FXGMAC_RSS_HASH_KEY_TYPE 1 +#define MAX_MSI_COUNT 16 // Max Msi/Msix supported. + +#define FXGMAC_STD_PACKET_MTU 1500 +#define FXGMAC_JUMBO_PACKET_MTU 9014 + +#define NIC_MAX_TCP_OFFLOAD_SIZE 7300 +#define NIC_MIN_LSO_SEGMENT_COUNT 2 + +/* power management */ +#define FXGMAC_POWER_STATE_DOWN 0 +#define FXGMAC_POWER_STATE_UP 1 + +#define FXGMAC_DATA_WIDTH 128 + +#define FXGMAC_WOL_WAIT_TIME 2 // unit 1ms + +// Don't change the member variables or types, this inherits from Windows OS. +struct wol_bitmap_pattern +{ + u32 flags; + u32 pattern_size; + u32 mask_size; + u8 mask_info[MAX_PATTERN_SIZE / 8]; + u8 pattern_info[MAX_PATTERN_SIZE]; + u8 pattern_offset; + u16 pattern_crc; +}; + +struct led_setting +{ + u32 s0_led_setting[5]; + u32 s3_led_setting[5]; + u32 s5_led_setting[5]; + u32 disable_led_setting[5]; +}; + +typedef struct led_setting LED_SETTING; +typedef struct wol_bitmap_pattern WOL_BITMAP_PATTERN; + +typedef enum +{ + WAKE_REASON_NONE = 0, + WAKE_REASON_MAGIC, + WAKE_REASON_PATTERNMATCH, + WAKE_REASON_LINK, + WAKE_REASON_TCPSYNV4, + WAKE_REASON_TCPSYNV6, + WAKE_REASON_TBD, //for wake up method like Link-change, for that, GMAC cannot identify and need more checking. + WAKE_REASON_HW_ERR, +} WAKE_REASON; //note, maybe we should refer to NDIS_PM_WAKE_REASON_TYPE to avoid duplication definition.... + +/* Helper macro for descriptor handling + * Always use FXGMAC_GET_DESC_DATA to access the descriptor data + */ +#if 0 //No need to round +#define FXGMAC_GET_DESC_DATA(ring, idx) ({ \ + typeof(ring) _ring = (ring); \ + ((_ring)->desc_data_head + \ + ((idx) & ((_ring)->dma_desc_count - 1))); \ +}) +#endif + +#define FXGMAC_GET_DESC_DATA(ring, idx) ((ring)->desc_data_head + (idx)) +#define FXGMAC_GET_ENTRY(x, size) ((x + 1) & (size - 1)) + +struct fxgmac_pdata; + +enum fxgmac_int { + FXGMAC_INT_DMA_CH_SR_TI, + FXGMAC_INT_DMA_CH_SR_TPS, + FXGMAC_INT_DMA_CH_SR_TBU, + FXGMAC_INT_DMA_CH_SR_RI, + FXGMAC_INT_DMA_CH_SR_RBU, + FXGMAC_INT_DMA_CH_SR_RPS, + FXGMAC_INT_DMA_CH_SR_TI_RI, + FXGMAC_INT_DMA_CH_SR_FBE, + FXGMAC_INT_DMA_ALL, +}; + +struct fxgmac_stats { + /* MMC TX counters */ + u64 txoctetcount_gb; + u64 txframecount_gb; + u64 txbroadcastframes_g; + u64 txmulticastframes_g; + u64 tx64octets_gb; + u64 tx65to127octets_gb; + u64 tx128to255octets_gb; + u64 tx256to511octets_gb; + u64 tx512to1023octets_gb; + u64 tx1024tomaxoctets_gb; + u64 txunicastframes_gb; + u64 txmulticastframes_gb; + u64 txbroadcastframes_gb; + u64 txunderflowerror; + u64 txsinglecollision_g; + u64 txmultiplecollision_g; + u64 txdeferredframes; + u64 txlatecollisionframes; + u64 txexcessivecollisionframes; + u64 txcarriererrorframes; + u64 txoctetcount_g; + u64 txframecount_g; + u64 txexcessivedeferralerror; + u64 txpauseframes; + u64 txvlanframes_g; + u64 txoversize_g; + + /* MMC RX counters */ + u64 rxframecount_gb; + u64 rxoctetcount_gb; + u64 rxoctetcount_g; + u64 rxbroadcastframes_g; + u64 rxmulticastframes_g; + u64 rxcrcerror; + u64 rxalignerror; + u64 rxrunterror; + u64 rxjabbererror; + u64 rxundersize_g; + u64 rxoversize_g; + u64 rx64octets_gb; + u64 rx65to127octets_gb; + u64 rx128to255octets_gb; + u64 rx256to511octets_gb; + u64 rx512to1023octets_gb; + u64 rx1024tomaxoctets_gb; + u64 rxunicastframes_g; + u64 rxlengtherror; + u64 rxoutofrangetype; + u64 rxpauseframes; + u64 rxfifooverflow; + u64 rxvlanframes_gb; + u64 rxwatchdogerror; + u64 rxreceiveerrorframe; + u64 rxcontrolframe_g; + + /* Extra counters */ + u64 tx_tso_packets; + u64 rx_split_header_packets; + u64 tx_process_stopped; + u64 rx_process_stopped; + u64 tx_buffer_unavailable; + u64 rx_buffer_unavailable; + u64 fatal_bus_error; + u64 tx_vlan_packets; + u64 rx_vlan_packets; + u64 napi_poll_isr; + u64 napi_poll_txtimer; + u64 cnt_alive_txtimer; + + u64 ephy_poll_timer_cnt; + u64 mgmt_int_isr; +}; + +struct fxgmac_ring_buf { + struct sk_buff* skb; + DMA_ADDR_T skb_dma; + unsigned int skb_len; +}; + +/* Common Tx and Rx DMA hardware descriptor */ +struct fxgmac_dma_desc { + __le32 desc0; + __le32 desc1; + __le32 desc2; + __le32 desc3; +}; + +/* Page allocation related values */ +struct fxgmac_page_alloc { + struct page* pages; + unsigned int pages_len; + unsigned int pages_offset; + DMA_ADDR_T pages_dma; +}; + +/* Ring entry buffer data */ +struct fxgmac_buffer_data { + struct fxgmac_page_alloc pa; + struct fxgmac_page_alloc pa_unmap; + + DMA_ADDR_T dma_base; + unsigned long dma_off; + unsigned int dma_len; +}; + +/* Tx-related desc data */ +struct fxgmac_tx_desc_data { + unsigned int packets; /* BQL packet count */ + unsigned int bytes; /* BQL byte count */ +}; + +/* Rx-related desc data */ +struct fxgmac_rx_desc_data { + struct fxgmac_buffer_data hdr; /* Header locations */ + struct fxgmac_buffer_data buf; /* Payload locations */ + + unsigned short hdr_len; /* Length of received header */ + unsigned short len; /* Length of received packet */ +}; + +struct fxgmac_pkt_info { + struct sk_buff* skb; + + unsigned int attributes; + + unsigned int errors; + + /* descriptors needed for this packet */ + unsigned int desc_count; + unsigned int length; + + unsigned int tx_packets; + unsigned int tx_bytes; + + unsigned int header_len; + unsigned int tcp_header_len; + unsigned int tcp_payload_len; + unsigned short mss; + + unsigned short vlan_ctag; + + u64 rx_tstamp; + + u32 rss_hash; + RSS_HASH_TYPE rss_hash_type; +}; + +struct fxgmac_desc_data { + /* dma_desc: Virtual address of descriptor + * dma_desc_addr: DMA address of descriptor + */ + struct fxgmac_dma_desc* dma_desc; + DMA_ADDR_T dma_desc_addr; + + /* skb: Virtual address of SKB + * skb_dma: DMA address of SKB data + * skb_dma_len: Length of SKB DMA area + */ + struct sk_buff* skb; + DMA_ADDR_T skb_dma; + unsigned int skb_dma_len; + + /* Tx/Rx -related data */ + struct fxgmac_tx_desc_data tx; + struct fxgmac_rx_desc_data rx; + + unsigned int mapped_as_page; +#if 0 + /* Incomplete receive save location. If the budget is exhausted + * or the last descriptor (last normal descriptor or a following + * context descriptor) has not been DMA'd yet the current state + * of the receive processing needs to be saved. + */ + unsigned int state_saved; + struct { + struct sk_buff* skb; + unsigned int len; + unsigned int error; + } state; +#endif +}; + +struct fxgmac_ring { + /* Per packet related information */ + struct fxgmac_pkt_info pkt_info; + + /* Virtual/DMA addresses of DMA descriptor list and the total count */ + struct fxgmac_dma_desc *dma_desc_head; + DMA_ADDR_T dma_desc_head_addr; + unsigned int dma_desc_count; + + /* Array of descriptor data corresponding the DMA descriptor + * (always use the FXGMAC_GET_DESC_DATA macro to access this data) + */ + struct fxgmac_desc_data *desc_data_head; + + /* Page allocation for RX buffers */ + struct fxgmac_page_alloc rx_hdr_pa; + struct fxgmac_page_alloc rx_buf_pa; + + /* Ring index values + * cur - Tx: index of descriptor to be used for current transfer + * Rx: index of descriptor to check for packet availability + * dirty - Tx: index of descriptor to check for transfer complete + * Rx: index of descriptor to check for buffer reallocation + */ + unsigned int cur; + unsigned int dirty; + + /* Coalesce frame count used for interrupt bit setting */ + unsigned int coalesce_count; + + struct { + unsigned int xmit_more; + unsigned int queue_stopped; + unsigned short cur_mss; + unsigned short cur_vlan_ctag; + } tx; +} ____cacheline_aligned; + +struct fxgmac_channel { + char name[16]; + + /* Address of private data area for device */ + struct fxgmac_pdata* pdata; + + /* Queue index and base address of queue's DMA registers */ + unsigned int queue_index; + + IOMEM dma_regs; + + /* Per channel interrupt irq number */ + u32 dma_irq; + FXGMAC_CHANNEL_OF_PLATFORM expansion; + + u32 saved_ier; + + unsigned int tx_timer_active; + + struct fxgmac_ring *tx_ring; + struct fxgmac_ring *rx_ring; +} ____cacheline_aligned; + +struct fxphy_ag_adv { + u8 auto_neg_en : 1; + u8 full_1000m : 1; + u8 half_1000m : 1; + u8 full_100m : 1; + u8 half_100m : 1; + u8 full_10m : 1; + u8 half_10m : 1; +}; + +struct fxgmac_desc_ops { + int (*alloc_channels_and_rings)(struct fxgmac_pdata* pdata); + void (*free_channels_and_rings)(struct fxgmac_pdata* pdata); + int (*map_tx_skb)(struct fxgmac_channel* channel, + struct sk_buff* skb); + int (*map_rx_buffer)(struct fxgmac_pdata* pdata, + struct fxgmac_ring* ring, + struct fxgmac_desc_data* desc_data); + void (*unmap_desc_data)(struct fxgmac_pdata* pdata, + struct fxgmac_desc_data* desc_data); + void (*tx_desc_init)(struct fxgmac_pdata* pdata); + int (*rx_desc_init)(struct fxgmac_pdata* pdata); + /* For descriptor related operation */ + void (*tx_desc_init_channel)(struct fxgmac_channel* channel); + void (*rx_desc_init_channel)(struct fxgmac_channel* channel); + void (*tx_desc_reset)(struct fxgmac_desc_data* desc_data); + void (*rx_desc_reset)(struct fxgmac_pdata* pdata, + struct fxgmac_desc_data* desc_data, + unsigned int index); +}; + +struct fxgmac_hw_ops { + int (*init)(struct fxgmac_pdata* pdata); + int (*exit)(struct fxgmac_pdata* pdata); + void (*save_nonstick_reg)(struct fxgmac_pdata* pdata); + void (*restore_nonstick_reg)(struct fxgmac_pdata* pdata); + int (*set_gmac_register)(struct fxgmac_pdata* pdata, IOMEM address, unsigned int data); + u32 (*get_gmac_register)(struct fxgmac_pdata* pdata, IOMEM address); + void (*esd_restore_pcie_cfg)(struct fxgmac_pdata* pdata); + + int (*tx_complete)(struct fxgmac_dma_desc* dma_desc); + + void (*enable_tx)(struct fxgmac_pdata* pdata); + void (*disable_tx)(struct fxgmac_pdata* pdata); + void (*enable_rx)(struct fxgmac_pdata* pdata); + void (*disable_rx)(struct fxgmac_pdata* pdata); + void (*enable_channel_rx)(struct fxgmac_pdata* pdata, unsigned int queue); + void (*enable_rx_tx_ints)(struct fxgmac_pdata* pdata); + void (*disable_rx_tx_ints)(struct fxgmac_pdata* pdata); + + int (*enable_int)(struct fxgmac_channel* channel, + enum fxgmac_int int_id); + int (*disable_int)(struct fxgmac_channel* channel, + enum fxgmac_int int_id); + void (*set_interrupt_moderation)(struct fxgmac_pdata* pdata); + void (*enable_msix_rxtxinterrupt)(struct fxgmac_pdata* pdata); + void (*disable_msix_interrupt)(struct fxgmac_pdata* pdata); + int (*enable_msix_rxtxphyinterrupt)(struct fxgmac_pdata* pdata); + void (*enable_msix_one_interrupt)(struct fxgmac_pdata* pdata, u32 intid); + void (*disable_msix_one_interrupt)(struct fxgmac_pdata* pdata, u32 intid); + bool (*enable_mgm_interrupt)(struct fxgmac_pdata* pdata); + bool (*disable_mgm_interrupt)(struct fxgmac_pdata* pdata); + bool (*enable_source_interrupt)(struct fxgmac_pdata* pdata); + bool (*disable_source_interrupt)(struct fxgmac_pdata* pdata); + int (*dismiss_all_int)(struct fxgmac_pdata* pdata); + void (*clear_misc_int_status)(struct fxgmac_pdata* pdata); + + void (*dev_xmit)(struct fxgmac_channel* channel); + int (*dev_read)(struct fxgmac_channel* channel); + + int (*set_mac_address)(struct fxgmac_pdata* pdata, u8* addr); + int (*set_mac_hash)(struct fxgmac_pdata* pdata); + int (*config_rx_mode)(struct fxgmac_pdata* pdata); + int (*enable_rx_csum)(struct fxgmac_pdata* pdata); + int (*disable_rx_csum)(struct fxgmac_pdata* pdata); + void (*config_tso)(struct fxgmac_pdata *pdata); + + /* For MII speed configuration */ + int (*config_mac_speed)(struct fxgmac_pdata* pdata); + int (*get_xlgmii_phy_status)(struct fxgmac_pdata *pdata, u32 *speed, bool *link_up, bool link_up_wait_to_complete); + + /* For descriptor related operation */ + //void (*tx_desc_init)(struct fxgmac_channel* channel); + //void (*rx_desc_init)(struct fxgmac_channel* channel); + //void (*tx_desc_reset)(struct fxgmac_desc_data* desc_data); + //void (*rx_desc_reset)(struct fxgmac_pdata* pdata, + // struct fxgmac_desc_data* desc_data, + // unsigned int index); + int (*is_last_desc)(struct fxgmac_dma_desc* dma_desc); + int (*is_context_desc)(struct fxgmac_dma_desc* dma_desc); + + /* For Flow Control */ + int (*config_tx_flow_control)(struct fxgmac_pdata* pdata); + int (*config_rx_flow_control)(struct fxgmac_pdata* pdata); + + /* For Jumbo Frames */ + int (*config_mtu)(struct fxgmac_pdata* pdata); + int (*enable_jumbo)(struct fxgmac_pdata* pdata); + + /* For Vlan related config */ + int (*enable_tx_vlan)(struct fxgmac_pdata* pdata); + int (*disable_tx_vlan)(struct fxgmac_pdata* pdata); + int (*enable_rx_vlan_stripping)(struct fxgmac_pdata* pdata); + int (*disable_rx_vlan_stripping)(struct fxgmac_pdata* pdata); + int (*enable_rx_vlan_filtering)(struct fxgmac_pdata* pdata); + int (*disable_rx_vlan_filtering)(struct fxgmac_pdata* pdata); + int (*update_vlan_hash_table)(struct fxgmac_pdata* pdata); + + /* For RX coalescing */ + int (*config_rx_coalesce)(struct fxgmac_pdata* pdata); + int (*config_tx_coalesce)(struct fxgmac_pdata* pdata); + unsigned long (*usec_to_riwt)(struct fxgmac_pdata* pdata, + unsigned int usec); + unsigned long (*riwt_to_usec)(struct fxgmac_pdata* pdata, + unsigned int riwt); + + /* For RX and TX threshold config */ + int (*config_rx_threshold)(struct fxgmac_pdata* pdata, + unsigned int val); + int (*config_tx_threshold)(struct fxgmac_pdata* pdata, + unsigned int val); + + /* For RX and TX Store and Forward Mode config */ + int (*config_rsf_mode)(struct fxgmac_pdata* pdata, + unsigned int val); + int (*config_tsf_mode)(struct fxgmac_pdata* pdata, + unsigned int val); + + /* For TX DMA Operate on Second Frame config */ + int (*config_osp_mode)(struct fxgmac_pdata* pdata); + + /* For RX and TX PBL config */ + u32 (*calculate_max_checksum_size)(struct fxgmac_pdata* pdata); + int (*config_rx_pbl_val)(struct fxgmac_pdata* pdata); + u32 (*get_rx_pbl_val)(struct fxgmac_pdata* pdata); + int (*config_tx_pbl_val)(struct fxgmac_pdata* pdata); + u32 (*get_tx_pbl_val)(struct fxgmac_pdata* pdata); + int (*config_pblx8)(struct fxgmac_pdata* pdata); + + /* For MMC statistics */ + void (*rx_mmc_int)(struct fxgmac_pdata* pdata); + void (*tx_mmc_int)(struct fxgmac_pdata* pdata); + void (*read_mmc_stats)(struct fxgmac_pdata* pdata); + bool (*update_stats_counters)(struct fxgmac_pdata* pdata, bool ephy_check_en); + + /* For Receive Side Scaling */ + int (*enable_rss)(struct fxgmac_pdata* pdata); + int (*disable_rss)(struct fxgmac_pdata* pdata); + u32 (*get_rss_options)(struct fxgmac_pdata* pdata); + int (*set_rss_options)(struct fxgmac_pdata* pdata); + int (*set_rss_hash_key)(struct fxgmac_pdata* pdata, const u8* key); + int (*set_rss_lookup_table)(struct fxgmac_pdata* pdata, const u32* table); + + /*For Offload*/ +#ifdef FXGMAC_POWER_MANAGEMENT + void (*set_arp_offload)(struct fxgmac_pdata* pdata, unsigned char* ip_addr); + int (*enable_arp_offload)(struct fxgmac_pdata* pdata); + int (*disable_arp_offload)(struct fxgmac_pdata* pdata); + + /*NS offload*/ + int (*set_ns_offload)( + struct fxgmac_pdata* pdata, + unsigned int index, + unsigned char* remote_addr, + unsigned char* solicited_addr, + unsigned char* target_addr1, + unsigned char* target_addr2, + unsigned char* mac_addr); + int (*enable_ns_offload)(struct fxgmac_pdata* pdata); + int (*disable_ns_offload)(struct fxgmac_pdata* pdata); + + int (*enable_wake_magic_pattern)(struct fxgmac_pdata* pdata); + int (*disable_wake_magic_pattern)(struct fxgmac_pdata* pdata); + + int (*enable_wake_link_change)(struct fxgmac_pdata* pdata); + int (*disable_wake_link_change)(struct fxgmac_pdata* pdata); + + int (*check_wake_pattern_fifo_pointer)(struct fxgmac_pdata* pdata); + int (*set_wake_pattern)(struct fxgmac_pdata* pdata, struct wol_bitmap_pattern* wol_pattern, u32 pattern_cnt); + int (*enable_wake_pattern)(struct fxgmac_pdata* pdata);//int XlgmacEnableArpload(struct fxgmac_pdata* pdata,unsigned char *ip_addr) + int (*disable_wake_pattern)(struct fxgmac_pdata* pdata); + int (*set_wake_pattern_mask)(struct fxgmac_pdata* pdata, u32 filter_index, u8 register_index, u32 Data); +#if FXGMAC_PM_WPI_READ_FEATURE_ENABLED + void (*get_wake_packet_indication)(struct fxgmac_pdata* pdata, int* wake_reason, u32* wake_pattern_number, u8* wpi_buf, u32 buf_size, u32* packet_size); + void (*enable_wake_packet_indication)(struct fxgmac_pdata* pdata, int en); +#endif +#endif + + void (*reset_phy)(struct fxgmac_pdata* pdata); + /*for release phy,phy write and read, and provide clock to GMAC. */ + void (*release_phy)(struct fxgmac_pdata* pdata); + void (*enable_phy_check)(struct fxgmac_pdata* pdata); + void (*disable_phy_check)(struct fxgmac_pdata* pdata); + void (*setup_cable_loopback)(struct fxgmac_pdata* pdata); + void (*clean_cable_loopback)(struct fxgmac_pdata* pdata); + void (*disable_phy_sleep)(struct fxgmac_pdata* pdata); + void (*enable_phy_sleep)(struct fxgmac_pdata* pdata); + void (*phy_green_ethernet)(struct fxgmac_pdata* pdata); + void (*phy_eee_feature)(struct fxgmac_pdata* pdata); + u32 (*get_ephy_state)(struct fxgmac_pdata* pdata); + int (*write_ephy_reg)(struct fxgmac_pdata* pdata, u32 val, u32 data); + int (*read_ephy_reg)(struct fxgmac_pdata* pdata, u32 val, u32 __far* data); + int (*set_ephy_autoneg_advertise)(struct fxgmac_pdata* pdata, struct fxphy_ag_adv phy_ag_adv); + int (*phy_config)(struct fxgmac_pdata* pdata); + void (*close_phy_led)(struct fxgmac_pdata* pdata); + void (*led_under_active)(struct fxgmac_pdata* pdata); + void (*led_under_sleep)(struct fxgmac_pdata* pdata); + void (*led_under_shutdown)(struct fxgmac_pdata* pdata); + void (*led_under_disable)(struct fxgmac_pdata* pdata); + + /* For power management */ + void (*pre_power_down)(struct fxgmac_pdata* pdata, bool phyloopback); + int (*diag_sanity_check)(struct fxgmac_pdata *pdata); + int (*write_rss_lookup_table)(struct fxgmac_pdata *pdata); + int (*get_rss_hash_key)(struct fxgmac_pdata *pdata, u8 *key_buf); +#ifdef FXGMAC_WOL_INTEGRATED_WOL_PARAMETER + void (*config_power_down)(struct fxgmac_pdata *pdata, unsigned int wol); +#else + void (*config_power_down)(struct fxgmac_pdata* pdata, unsigned int offloadcount, bool magic_en, bool remote_pattern_en); +#endif + void (*config_power_up)(struct fxgmac_pdata* pdata); + unsigned char (*set_suspend_int)(void* pdata); + void (*set_resume_int)(struct fxgmac_pdata* pdata); + int (*set_suspend_txrx)(struct fxgmac_pdata* pdata); + void (*set_pwr_clock_gate)(struct fxgmac_pdata* pdata); + void (*set_pwr_clock_ungate)(struct fxgmac_pdata* pdata); + + /* for multicast address list */ + int (*set_all_multicast_mode)(struct fxgmac_pdata* pdata, unsigned int enable); + void (*config_multicast_mac_hash_table)(struct fxgmac_pdata* pdata, unsigned char* pmc_mac, int b_add); + + /* for packet filter-promiscuous and broadcast */ + int (*set_promiscuous_mode)(struct fxgmac_pdata* pdata, unsigned int enable); + int (*enable_rx_broadcast)(struct fxgmac_pdata* pdata, unsigned int enable); + + /* efuse relevant operation. */ + bool (*read_patch_from_efuse_per_index)(struct fxgmac_pdata* pdata, u8 index, u32 __far* offset, u32 __far* value); /* read patch per index. */ + bool (*read_mac_subsys_from_efuse)(struct fxgmac_pdata* pdata, u8* mac_addr, u32* subsys, u32* revid); + bool (*read_efuse_data)(struct fxgmac_pdata* pdata, u32 offset, u32 __far* value); +#ifndef COMMENT_UNUSED_CODE_TO_REDUCE_SIZE + bool (*read_patch_from_efuse)(struct fxgmac_pdata* pdata, u32 offset, u32* value); /* read patch per index. */ + bool (*write_patch_to_efuse)(struct fxgmac_pdata* pdata, u32 offset, u32 value); + bool (*write_patch_to_efuse_per_index)(struct fxgmac_pdata* pdata, u8 index, u32 offset, u32 value); + bool (*write_mac_subsys_to_efuse)(struct fxgmac_pdata* pdata, u8* mac_addr, u32* subsys, u32* revid); + bool (*read_mac_addr_from_efuse)(struct fxgmac_pdata* pdata, u8* mac_addr); + bool (*write_mac_addr_to_efuse)(struct fxgmac_pdata* pdata, u8* mac_addr); + bool (*efuse_load)(struct fxgmac_pdata* pdata); + bool (*write_oob)(struct fxgmac_pdata* pdata); + bool (*write_led)(struct fxgmac_pdata* pdata, u32 value); + bool (*read_led_config)(struct fxgmac_pdata* pdata); + bool (*write_led_config)(struct fxgmac_pdata* pdata); +#endif + + int (*pcie_init)(struct fxgmac_pdata* pdata, bool ltr_en, bool aspm_l1ss_en, bool aspm_l1_en, bool aspm_l0s_en); + void (*trigger_pcie)(struct fxgmac_pdata* pdata, u32 code); // To trigger pcie sniffer for analysis. +}; + +/* This structure contains flags that indicate what hardware features + * or configurations are present in the device. + */ +struct fxgmac_hw_features { + /* HW Version */ + u32 version; + + /* HW Feature Register0 */ + u32 phyifsel; /* PHY interface support */ + u32 vlhash; /* VLAN Hash Filter */ + u32 sma; /* SMA(MDIO) Interface */ + u32 rwk; /* PMT remote wake-up packet */ + u32 mgk; /* PMT magic packet */ + u32 mmc; /* RMON module */ + u32 aoe; /* ARP Offload */ + u32 ts; /* IEEE 1588-2008 Advanced Timestamp */ + u32 eee; /* Energy Efficient Ethernet */ + u32 tx_coe; /* Tx Checksum Offload */ + u32 rx_coe; /* Rx Checksum Offload */ + u32 addn_mac; /* Additional MAC Addresses */ + u32 ts_src; /* Timestamp Source */ + u32 sa_vlan_ins;/* Source Address or VLAN Insertion */ + + /* HW Feature Register1 */ + u32 rx_fifo_size; /* MTL Receive FIFO Size */ + u32 tx_fifo_size; /* MTL Transmit FIFO Size */ + u32 adv_ts_hi; /* Advance Timestamping High Word */ + u32 dma_width; /* DMA width */ + u32 dcb; /* DCB Feature */ + u32 sph; /* Split Header Feature */ + u32 tso; /* TCP Segmentation Offload */ + u32 dma_debug; /* DMA Debug Registers */ + u32 rss; /* Receive Side Scaling */ + u32 tc_cnt; /* Number of Traffic Classes */ + u32 avsel; /* AV Feature Enable */ + u32 ravsel; /* Rx Side Only AV Feature Enable */ + u32 hash_table_size;/* Hash Table Size */ + u32 l3l4_filter_num;/* Number of L3-L4 Filters */ + + /* HW Feature Register2 */ + u32 rx_q_cnt; /* Number of MTL Receive Queues */ + u32 tx_q_cnt; /* Number of MTL Transmit Queues */ + u32 rx_ch_cnt; /* Number of DMA Receive Channels */ + u32 tx_ch_cnt; /* Number of DMA Transmit Channels */ + u32 pps_out_num; /* Number of PPS outputs */ + u32 aux_snap_num; /* Number of Aux snapshot inputs */ + + /* HW Feature Register3 */ + u32 hwfr3; +}; + +struct fxgmac_resources { + IOMEM addr; + int irq; +}; + +struct fxgmac_pdata { + struct net_device *netdev; + struct device *dev; + PCI_DEV *pdev; + void *pAdapter; + + struct fxgmac_hw_ops hw_ops; + struct fxgmac_desc_ops desc_ops; + + /* Device statistics */ + struct fxgmac_stats stats; + + u32 msg_enable; + u32 reg_nonstick[0x300 >> 2]; + + /* MAC registers base */ + IOMEM mac_regs; + IOMEM base_mem; + + /* Hardware features of the device */ + struct fxgmac_hw_features hw_feat; + + /* Rings for Tx/Rx on a DMA channel */ + struct fxgmac_channel *channel_head; + unsigned int channel_count; + unsigned int tx_ring_count; + unsigned int rx_ring_count; + unsigned int tx_desc_count; + unsigned int rx_desc_count; + unsigned int tx_q_count; + unsigned int rx_q_count; + + /* Tx/Rx common settings */ + unsigned int pblx8; + + /* Tx settings */ + unsigned int tx_sf_mode; + unsigned int tx_threshold; + unsigned int tx_pbl; + unsigned int tx_osp_mode; +#if FXGMAC_TX_HANG_TIMER_ENABLED + /* for tx hang checking. 20211227 */ + unsigned int tx_hang_restart_queuing; +#endif + + /* Rx settings */ + unsigned int rx_sf_mode; + unsigned int rx_threshold; + unsigned int rx_pbl; + + /* Tx coalescing settings */ + unsigned int tx_usecs; + unsigned int tx_frames; + + /* Rx coalescing settings */ + unsigned long rx_riwt; + unsigned int rx_usecs; + unsigned int rx_frames; + + /* Current Rx buffer size */ + unsigned int rx_buf_size; + + /* Flow control settings */ + unsigned int tx_pause; + unsigned int rx_pause; + + /* Jumbo frames */ + unsigned int mtu; + unsigned int jumbo; + + /* CRC checking */ + unsigned int crc_check; + + /* MSIX */ + unsigned int msix; + + /* RSS */ + unsigned int rss; + + /* VlanID */ + unsigned int vlan; + unsigned int vlan_exist; + unsigned int vlan_filter; + unsigned int vlan_strip; + + /* Interrupt Moderation */ + unsigned int intr_mod; + unsigned int intr_mod_timer; + + /* Device interrupt number */ + int dev_irq; + unsigned int per_channel_irq; + u32 channel_irq[FXGMAC_MAX_DMA_CHANNELS_PLUS_1TX]; // change type from int to u32 to match MSIx, p_msix_entry.vector; + + /* Netdev related settings */ + unsigned char mac_addr[ETH_ALEN]; + + /* Filtering support */ +#if FXGMAC_FILTER_MULTIPLE_VLAN_ENABLED + unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; +#endif + + /* Device clocks */ + unsigned long sysclk_rate; + + /* Receive Side Scaling settings */ + u8 rss_key[FXGMAC_RSS_HASH_KEY_SIZE]; + u32 rss_table[FXGMAC_RSS_MAX_TABLE_SIZE]; + u32 rss_options; + + int phy_speed; + int phy_duplex; + int phy_autoeng; + +#ifndef COMMENT_UNUSED_CODE_TO_REDUCE_SIZE + char drv_name[32]; + char drv_ver[32]; + + struct wol_bitmap_pattern pattern[MAX_PATTERN_COUNT]; +#endif + + struct led_setting led; + struct led_setting ledconfig; + + FXGMAC_PDATA_OF_PLATFORM expansion; + + u32 pcie_link_status; + u32 mgmt_phy_val; + + u32 support_10m_link; +}; + +#if 1 +#define FXGMAC_FLAG_MSI_CAPABLE (u32)(1 << 0) +#define FXGMAC_FLAG_MSI_ENABLED (u32)(1 << 1) +#define FXGMAC_FLAG_MSIX_CAPABLE (u32)(1 << 2) +#define FXGMAC_FLAG_MSIX_ENABLED (u32)(1 << 3) +#define FXGMAC_FLAG_LEGACY_ENABLED (u32)(1 << 4) + +#define FXGMAC_FLAG_INTERRUPT_POS 0 +#define FXGMAC_FLAG_INTERRUPT_LEN 5 + +#define FXGMAC_FLAG_MSI_POS 1 +#define FXGMAC_FLAG_MSI_LEN 1 +#define FXGMAC_FLAG_MSIX_POS 3 +#define FXGMAC_FLAG_MSIX_LEN 1 +#define FXGMAC_FLAG_LEGACY_POS 4 +#define FXGMAC_FLAG_LEGACY_LEN 1 +#define FXGMAC_FLAG_LEGACY_IRQ_FREE_POS 31 +#define FXGMAC_FLAG_LEGACY_IRQ_FREE_LEN 1 +#define FXGMAC_FLAG_LEGACY_NAPI_FREE_POS 30 +#define FXGMAC_FLAG_LEGACY_NAPI_FREE_LEN 1 +#define FXGMAC_FLAG_MISC_IRQ_FREE_POS 29 +#define FXGMAC_FLAG_MISC_IRQ_FREE_LEN 1 +#define FXGMAC_FLAG_MISC_NAPI_FREE_POS 28 +#define FXGMAC_FLAG_MISC_NAPI_FREE_LEN 1 +#define FXGMAC_FLAG_TX_IRQ_FREE_POS 27 +#define FXGMAC_FLAG_TX_IRQ_FREE_LEN 1 +#define FXGMAC_FLAG_TX_NAPI_FREE_POS 26 +#define FXGMAC_FLAG_TX_NAPI_FREE_LEN 1 +#define FXGMAC_FLAG_RX_IRQ_FREE_POS 22 +#define FXGMAC_FLAG_RX_IRQ_FREE_LEN 4 +#define FXGMAC_FLAG_PER_CHAN_RX_IRQ_FREE_LEN 1 +#define FXGMAC_FLAG_RX_NAPI_FREE_POS 18 +#define FXGMAC_FLAG_RX_NAPI_FREE_LEN 4 +#define FXGMAC_FLAG_PER_CHAN_RX_NAPI_FREE_LEN 1 +#endif + +#ifndef FXGMAC_FAKE_4_TX_QUEUE_ENABLED +#define FXGMAC_FAKE_4_TX_QUEUE_ENABLED 0 +#endif + +void fxgmac_init_desc_ops(struct fxgmac_desc_ops *desc_ops); +void fxgmac_init_hw_ops(struct fxgmac_hw_ops *hw_ops); +const struct net_device_ops *fxgmac_get_netdev_ops(void); +const struct ethtool_ops *fxgmac_get_ethtool_ops(void); +void fxgmac_dump_tx_desc(struct fxgmac_pdata *pdata, + struct fxgmac_ring *ring, + unsigned int idx, + unsigned int count, + unsigned int flag); +void fxgmac_dump_rx_desc(struct fxgmac_pdata *pdata, + struct fxgmac_ring *ring, + unsigned int idx); +void fxgmac_dbg_pkt(struct net_device *netdev, + struct sk_buff *skb, bool tx_rx); +void fxgmac_get_all_hw_features(struct fxgmac_pdata *pdata); +void fxgmac_print_all_hw_features(struct fxgmac_pdata *pdata); +int fxgmac_drv_probe(struct device *dev, + struct fxgmac_resources *res); +int fxgmac_drv_remove(struct device *dev); + +#endif /* __FXGMAC_GMAC_H__ */ diff --git a/lede/package/kernel/yt6801/src/fuxi-os.h b/lede/package/kernel/yt6801/src/fuxi-os.h new file mode 100644 index 0000000000..bd6a8a723b --- /dev/null +++ b/lede/package/kernel/yt6801/src/fuxi-os.h @@ -0,0 +1,825 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Copyright (c) 2021 Motor-comm Corporation. All rights reserved. + * + * 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, see . + * + */ + + +#ifndef __FXGMAC_OS_H__ +#define __FXGMAC_OS_H__ + +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_PCI_MSI +#include +#endif + +#define LINUX + +#ifndef LINUX_VERSION_CODE +#include +#else +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#endif + +#ifndef RHEL_MAJOR + +//must used like : if ( RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(a,b) ) +#ifndef RHEL_RELEASE_VERSION +#define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b)) +#define RHEL_RELEASE_CODE (0) +#endif + +#include +#else +#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,8)) +#include +#endif +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)) +#include +#endif + +#include "fuxi-dbg.h" + +struct fxgmac_ring; +struct fxgmac_pdata; +struct fxgmac_channel; + +#define FXGMAC_DRV_VERSION "1.0.30" + +#ifdef CONFIG_PCI_MSI +/* undefined for legacy interrupt mode */ +/* #undef CONFIG_PCI_MSI */ +#endif + +#define FXGMAC_INT_MODERATION_ENABLED 1 + +#define PCIE_LP_ASPM_L0S 1 +#define PCIE_LP_ASPM_L1 2 +#define PCIE_LP_ASPM_L1SS 4 +#define PCIE_LP_ASPM_LTR 8 + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0)) +/* + * There are multiple 16-bit CRC polynomials in common use, but this is + * *the* standard CRC-32 polynomial, first popularized by Ethernet. + * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0 + */ +#define CRC32_POLY_LE 0xedb88320 +#define CRC32_POLY_BE 0x04c11db7 + +/* + * This is the CRC32c polynomial, as outlined by Castagnoli. + * x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+ + * x^8+x^6+x^0 + */ +#define CRC32C_POLY_LE 0x82F63B78 +#endif + +#define FXGMAC_FAIL -1 +#define FXGMAC_SUCCESS 0 +#define FXGMAC_DEV_CMD (SIOCDEVPRIVATE + 1) +#define FXGMAC_IOCTL_DFS_COMMAND _IOWR('M', 0x80, struct ext_ioctl_data) + +#define FXGMAC_MAX_DBG_TEST_PKT 150 +#define FXGMAC_MAX_DBG_BUF_LEN 64000 +#define FXGMAC_MAX_DBG_RX_DATA 1600 +#define FXGMAC_NETDEV_OPS_BUF_LEN 256 + +#define FXGMAC_TEST_MAC_HEAD_LEN 14 + +#define FXGMAC_PM_WPI_READ_FEATURE_ENABLED 1 + +#define RSS_Q_COUNT 4 + +/* #define FXGMAC_TX_INTERRUPT_ENABLED 1 */ +#define FXGMAC_TX_HANG_TIMER_ENABLED 0 +/* 1 to trigger(write reg 0x1000) for sniffer stop */ +#define FXGMAC_TRIGGER_TX_HANG 0 + +/* driver feature configuration */ +#if FXGMAC_TX_HANG_TIMER_ENABLED +/* 0: check hw current desc; 1: check software dirty */ +#define FXGMAC_TX_HANG_CHECH_DIRTY 0 +#endif + +#define FXGMAC_DMA_BIT_MASK64 64 +#define FXGMAC_DMA_BIT_MASK32 32 + +#ifdef CONFIG_PCI_MSI +/* should be same as FXGMAC_MAX_DMA_CHANNELS + 1 tx_irq */ +#define FXGMAC_MAX_MSIX_Q_VECTORS (FXGMAC_MSIX_Q_VECTORS + 1) +#define FXGMAC_MSIX_CH0RXDIS_ENABLED 0 //set to 1 for ch0 unbalance fix; +#define FXGMAC_MSIX_INTCTRL_EN 1 + +#ifdef FXGMAC_MISC_NOT_ENABLED +#define FXGMAC_MISC_INT_NUM 0 +#else +#define FXGMAC_MISC_INT_NUM 1 +#endif +#define FXGMAC_MSIX_INT_NUMS (FXGMAC_MAX_MSIX_Q_VECTORS + FXGMAC_MISC_INT_NUM) +#else +#define FXGMAC_MSIX_CH0RXDIS_ENABLED 0 /* NO modification needed! for non-MSI, set to 0 always */ +#define FXGMAC_MSIX_INTCTRL_EN 0 +#endif + +/* RSS features */ +#ifdef FXGMAC_ONE_CHANNEL +#define FXGMAC_RSS_FEATURE_ENABLED 0 /* 1:enable rss ; 0: rss not included. */ +#else +#define FXGMAC_RSS_FEATURE_ENABLED 1 /* 1:enable rss ; 0: rss not included. */ +#endif +#define FXGMAC_RSS_HASH_KEY_LINUX 1 /* 0:hard to default rss key ;1: normal hash key process from Linux. */ + +/* WOL features */ +#define FXGMAC_WOL_FEATURE_ENABLED 1 /* 1:enable wol ; 0: wol not included. */ +/* since wol upon link will cause issue, disabled it always. */ +#define FXGMAC_WOL_UPON_EPHY_LINK 1 /* 1:enable ephy link change wol ; 0: ephy link change wol is not supported. */ + +/* Pause features */ +#define FXGMAC_PAUSE_FEATURE_ENABLED 1 /* 1:enable flow control/pause framce ; 0: flow control/pause frame not included. */ + +/* ARP offload engine (AOE) */ +#define FXGMAC_AOE_FEATURE_ENABLED 1 /* 1:enable arp offload engine ; 0: aoe is not included. */ + +/* NS offload engine */ +#define FXGMAC_NS_OFFLOAD_ENABLED 1 /* 1:enable NS offload for IPv6 ; 0: NS is not included. */ + +/* for fpga ver after, which needs release phy before set of MAC tx/rx */ +#define FXGMAC_TXRX_EN_AFTER_PHY_RELEASE 1 /* 1:release ephy before mac tx/rx bits are set. */ + +/* power management features */ +#define FXGMAC_PM_FEATURE_ENABLED 1 /* 1:enable PM ; 0: PM not included. */ + +/* sanity check */ +#define FXGMAC_SANITY_CHECK_ENABLED 0 /* 1:enable health checking ; */ + +/* vlan id filter */ +#define FXGMAC_FILTER_SINGLE_VLAN_ENABLED 0 + +/* Linux driver implement VLAN HASH Table feature to support mutliple VLAN feautre */ +#define FXGMAC_FILTER_MULTIPLE_VLAN_ENABLED 1 + +/* Linux driver implement MAC HASH Table feature */ +#define FXGMAC_MAC_HASH_TABLE 1 + +/* Linux driver implement write multiple mac addr */ +#define FXGMAC_FILTER_MULTIPLE_MAC_ADDR_ENABLED 1 + +/* Linux driver disable MISC Interrupt */ +#define FXGMAC_MISC_INT_HANDLE_FEATURE_ENABLED 1 + +#define FXGMAC_ESD_RESTORE_PCIE_CFG + +#define FXGMAC_WOL_INTEGRATED_WOL_PARAMETER + +#define FXGMAC_LINK_SPEED_CHECK_PHY_LINK + +#define FXGMAC_FLUSH_TX_CHECK_ENABLED + +#define FXGMAC_POWER_MANAGEMENT + +#define FXGMAC_INTERRUPT_TX_INTERVAL + +#define FXGMAC_INTERRUPT_RX_INTERVAL + +#define FXGMAC_WAIT_TX_STOP + +#define FXGMAC_WAIT_RX_STOP_BY_PRXQ_RXQSTS + +#define FXGMAC_USE_DEFAULT_RSS_KEY_TBALE + +#define FXGMAC_MISC_NOT_ENABLED + +#define FXGMAC_RX_VLAN_FILTERING_ENABLED (pdata->netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER) + +#define FXGMAC_NETDEV_PR_MODE_ENABLED ((pdata->netdev->flags & IFF_PROMISC) != 0) +#define FXGMAC_NETDEV_AM_MODE_ENABLED ((pdata->netdev->flags & IFF_ALLMULTI) != 0) +#define FXGMAC_NETDEV_MU_MODE_ENABLED ((pdata->netdev->flags & IFF_MULTICAST) != 0) +#define FXGMAC_NETDEV_BD_MODE_ENABLED ((pdata->netdev->flags & IFF_BROADCAST) != 0) + +#define FXGMAC_RX_CHECKSUM_ENABLED (pdata->netdev->features & NETIF_F_RXCSUM) + +#define TEST_MAC_HEAD 14 +#define TEST_TCP_HEAD_LEN_OFFSET 12 +#define TEST_TCP_OFFLOAD_LEN_OFFSET 48 +#define TEST_TCP_FIX_HEAD_LEN 24 +#define TEST_TCP_MSS_OFFSET 56 + +#define DF_MAX_NIC_NUM 16 + +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &(((TYPE*)0)->MEMBER)) +#endif + +#define ETH_IS_ZEROADDRESS(Address) \ + ((((u8*)(Address))[0] == ((u8)0x00)) \ + && (((u8*)(Address))[1] == ((u8)0x00)) \ + && (((u8*)(Address))[2] == ((u8)0x00)) \ + && (((u8*)(Address))[3] == ((u8)0x00)) \ + && (((u8*)(Address))[4] == ((u8)0x00)) \ + && (((u8*)(Address))[5] == ((u8)0x00))) + +/* centos 7 define start */ +#ifndef dma_rmb +#define dma_rmb() barrier() +#endif + +#ifndef dma_wmb +#define dma_wmb() barrier() +#endif + +#ifndef smp_mb__before_atomic +#define smp_mb__before_atomic() barrier() +#endif + +#ifndef smp_mb__after_atomic +#define smp_mb__after_atomic() barrier() +#endif + +#ifndef skb_vlan_tag_present +#define skb_vlan_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) +#endif + +#ifndef skb_vlan_tag_get +#define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) +#endif + +#ifndef GENMASK +/* Create a contiguous bitmask starting at bit position @l and ending at + * position @h. For example + * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. + */ +#define GENMASK(h, l) \ + (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#endif + +#ifndef ETH_RSS_HASH_TOP +#define __ETH_RSS_HASH_BIT(bit) ((u32)1 << (bit)) +#define __ETH_RSS_HASH(name) __ETH_RSS_HASH_BIT(ETH_RSS_HASH_##name##_BIT) + +#define ETH_RSS_HASH_TOP __ETH_RSS_HASH(TOP) +#endif + +/* centos 7 needs set these definitions to 0 + * 1. FXGMAC_RSS_FEATURE_ENABLED + * 2. FXGMAC_RSS_HASH_KEY_LINUX + * 3. FXGMAC_PAUSE_FEATURE_ENABLED + * #undef CONFIG_PCI_MSI + */ +#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,0)) && (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,8)) + +#define strscpy strlcpy + +#undef FXGMAC_RSS_FEATURE_ENABLED +#define FXGMAC_RSS_FEATURE_ENABLED 0 + +#undef FXGMAC_RSS_HASH_KEY_LINUX +#define FXGMAC_RSS_HASH_KEY_LINUX 0 + +#undef FXGMAC_PAUSE_FEATURE_ENABLED +#define FXGMAC_PAUSE_FEATURE_ENABLED 0 + +#undef CONFIG_PCI_MSI +#endif + +/* centos 7 define end */ + + /* read from 8bit register via pci config space */ +#define cfg_r8(_pdata, reg, pdat) pci_read_config_byte((_pdata)->pdev, (reg), (u8 *)(pdat)) + + /* read from 16bit register via pci config space */ +#define cfg_r16(_pdata, reg, pdat) pci_read_config_word((_pdata)->pdev, (reg), (u16 *)(pdat)) + + /* read from 32bit register via pci config space */ +#define cfg_r32(_pdata, reg, pdat) pci_read_config_dword((_pdata)->pdev, (reg), (u32 *)(pdat)) + +/* write to 8bit register via pci config space */ +#define cfg_w8(_pdata, reg, val) pci_write_config_byte((_pdata)->pdev, (reg), (u8)(val)) + +/* write to 16bit register via pci config space */ +#define cfg_w16(_pdata, reg, val) pci_write_config_word((_pdata)->pdev, (reg), (u16)(val)) + +/* write to 32bit register via pci config space */ +#define cfg_w32(_pdata, reg, val) pci_write_config_dword((_pdata)->pdev, (reg), (u32)(val)) + +#define readreg(pAdapter, addr) (readl(addr)) +#define writereg(pAdapter, val, addr) (writel(val, addr)) +#define usleep_range_ex(pAdapter, a, b) (usleep_range(a, b)) +#define _CR(Record, TYPE, Field) ((TYPE *) ((char *) (Record) - (char *) &(((TYPE *) 0)->Field))) + +#define FXGMAC_GET_REG_BITS(var, pos, len) ({ \ + typeof(pos) _pos = (pos); \ + typeof(len) _len = (len); \ + ((var) & GENMASK(_pos + _len - 1, _pos)) >> (_pos); \ +}) + +#define FXGMAC_GET_REG_BITS_LE(var, pos, len) ({ \ + typeof(pos) _pos = (pos); \ + typeof(len) _len = (len); \ + typeof(var) _var = le32_to_cpu((var)); \ + ((_var) & GENMASK(_pos + _len - 1, _pos)) >> (_pos); \ +}) + +#define FXGMAC_SET_REG_BITS(var, pos, len, val) ({ \ + typeof(var) _var = (var); \ + typeof(pos) _pos = (pos); \ + typeof(len) _len = (len); \ + typeof(val) _val = (val); \ + _val = (_val << _pos) & GENMASK(_pos + _len - 1, _pos); \ + _var = (_var & ~GENMASK(_pos + _len - 1, _pos)) | _val; \ +}) + +#define FXGMAC_SET_REG_BITS_LE(var, pos, len, val) ({ \ + typeof(var) _var = (var); \ + typeof(pos) _pos = (pos); \ + typeof(len) _len = (len); \ + typeof(val) _val = (val); \ + _val = (_val << _pos) & GENMASK(_pos + _len - 1, _pos); \ + _var = (_var & ~GENMASK(_pos + _len - 1, _pos)) | _val; \ + cpu_to_le32(_var); \ +}) + +#define STR_FORMAT "%s" + +#define DbgPrintF(level, fmt, ...) +#define DBGPRINT(Level, Fmt) +#define DBGPRINT_RAW(Level, Fmt) +#define DBGPRINT_S(Status, Fmt) +#define DBGPRINT_UNICODE(Level, UString) +#define Dump(p,cb,fAddress,ulGroup) + +#undef ASSERT +#define ASSERT(x) + +#define DbgPrintOidName(_Oid) +#define DbgPrintAddress(_pAddress) + +// #define fxgmac_dump_buffer(_skb, _len, _tx_rx) +#define DumpLine(_p, _cbLine, _fAddress, _ulGroup ) + +#ifndef __far +#define __far +#endif + +#ifndef FXGMAC_DEBUG +/* #define FXGMAC_DEBUG */ +#endif + +/* For debug prints */ +#ifdef FXGMAC_DEBUG +#define FXGMAC_PR(fmt, args...) \ + pr_alert("[%s,%d]:" fmt, __func__, __LINE__, ## args) + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)) +/* + * If you want to continue a line, you NEED to use KERN_CONT. + * That has always been true. It hasn't always been enforced, though. + * If you do two printk's and the second one doesn't say "I'm a continuation", + * the printk logic assumes you're just confused and wanted two lines. + */ +#define DPRINTK(fmt, args...) \ + printk(KERN_CONT fmt, ## args) +#else +#define DPRINTK printk +#endif + +#else +#define FXGMAC_PR(x...) do { } while (0) +#define DPRINTK(x...) +#endif + +#define IOC_MAGIC 'M' +#define IOC_MAXNR (0x80 + 5) + +#define FXGMAC_DFS_IOCTL_DEVICE_INACTIVE 0x10001 +#define FXGMAC_DFS_IOCTL_DEVICE_RESET 0x10002 +#define FXGMAC_DFS_IOCTL_DIAG_BEGIN 0x10003 +#define FXGMAC_DFS_IOCTL_DIAG_END 0x10004 +#define FXGMAC_DFS_IOCTL_DIAG_TX_PKT 0x10005 +#define FXGMAC_DFS_IOCTL_DIAG_RX_PKT 0x10006 + +#define FXGMAC_EFUSE_UPDATE_LED_CFG 0x10007 +#define FXGMAC_EFUSE_WRITE_LED 0x10008 +#define FXGMAC_EFUSE_WRITE_PATCH_REG 0x10009 +#define FXGMAC_EFUSE_WRITE_PATCH_PER_INDEX 0x1000A +#define FXGMAC_EFUSE_WRITE_OOB 0x1000B +#define FXGMAC_EFUSE_LOAD 0x1000C +#define FXGMAC_EFUSE_READ_REGIONABC 0x1000D +#define FXGMAC_EFUSE_READ_PATCH_REG 0x1000E +#define FXGMAC_EFUSE_READ_PATCH_PER_INDEX 0x1000F +#define FXGMAC_EFUSE_LED_TEST 0x10010 + +#define FXGMAC_GET_MAC_DATA 0x10011 +#define FXGMAC_SET_MAC_DATA 0x10012 +#define FXGMAC_GET_SUBSYS_ID 0x10013 +#define FXGMAC_SET_SUBSYS_ID 0x10014 +#define FXGMAC_GET_REG 0x10015 +#define FXGMAC_SET_REG 0x10016 +#define FXGMAC_GET_PHY_REG 0x10017 +#define FXGMAC_SET_PHY_REG 0x10018 +#define FXGMAC_EPHY_STATISTICS 0x10019 +#define FXGMAC_GET_STATISTICS 0x1001A +#define FXGMAC_GET_PCIE_LOCATION 0x1001B + +#define FXGMAC_GET_GSO_SIZE 0x1001C +#define FXGMAC_SET_GSO_SIZE 0x1001D +#define FXGMAC_SET_RX_MODERATION 0x1001E +#define FXGMAC_SET_TX_MODERATION 0x1001F +#define FXGMAC_GET_TXRX_MODERATION 0x10020 + +#define MAX_PKT_BUF 1 +#define FXGAMC_MAX_DATA_SIZE (1024 * 4 + 16) + +#ifndef PCI_CAP_ID_MSI +#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ +#endif + +#ifndef PCI_CAP_ID_MSIX +#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ +#endif + +#define PCI_CAP_ID_MSI_ENABLE_POS 0x10 +#define PCI_CAP_ID_MSI_ENABLE_LEN 0x1 +#define PCI_CAP_ID_MSIX_ENABLE_POS 0x1F +#define PCI_CAP_ID_MSIX_ENABLE_LEN 0x1 + +#define FXGMAC_IRQ_ENABLE 0x1 +#define FXGMAC_IRQ_DISABLE 0x0 +#define FXGMAC_NAPI_ENABLE 0x1 +#define FXGMAC_NAPI_DISABLE 0x0 + +#ifndef fallthrough + +#ifdef __has_attribute +#if __has_attribute(__fallthrough__) +# define fallthrough __attribute__((__fallthrough__)) +#else +# define fallthrough do {} while (0) /* fallthrough */ +#endif + +#else +# define fallthrough do {} while (0) /* fallthrough */ +#endif + +#endif + +#define PHY_POWER_DOWN 1 +#define PHY_POWER_UP 0 + +#define FXGMAC_MMC_IER_ALL_DEFAULT 0 + +/* #define FXGMAC_ESD_CHECK_ENABLED */ +#ifdef FXGMAC_ESD_CHECK_ENABLED +#define FXGMAC_ESD_INTERVAL (5 * HZ) +#define FXGMAC_ESD_ERROR_THRESHOLD (u64)4000000000 +#define FXGMAC_PCIE_LINK_DOWN 0xFFFFFFFF +#define FXGMAC_PCIE_RECOVER_TIMES 5000 +#define FXGMAC_PCIE_IO_MEM_MASTER_ENABLE 0x7 +#endif + +//#define FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED +#define FXGMAC_LOOPBACK_CHECK_INTERVAL (5 * HZ) +#define FXGMAC_PHY_LOOPBACK_DETECT_THRESOLD 2 +#endif + +//#define FXGMAC_ASPM_ENABLED +#ifdef FXGMAC_ASPM_ENABLED +#define FXGMAC_CHECK_DEV_STATE +#define FXGMAC_ASPM_INTERVAL (20 * HZ) +#endif + +#ifndef BIT +#define BIT(n) (0x1<<(n)) +#endif + +#define UDP_RSS_FLAGS (BIT(MAC_RSSCR_UDP4TE_POS) | \ + BIT(MAC_RSSCR_UDP6TE_POS)) + +#define MF90_SUB_VENTOR_ID 0x17aa +#define MF90_SUB_DEVICE_ID 0x3509 + +#pragma pack(1) +/* it's better to make this struct's size to 128byte. */ +struct pattern_packet{ + u8 ether_daddr[ETH_ALEN]; + u8 ether_saddr[ETH_ALEN]; + u16 ether_type; + + __be16 ar_hrd; /* format of hardware address */ + __be16 ar_pro; /* format of protocol */ + unsigned char ar_hln; /* length of hardware address */ + unsigned char ar_pln; /* length of protocol address */ + __be16 ar_op; /* ARP opcode (command) */ + unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ + unsigned char ar_sip[4]; /* sender IP address */ + unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ + unsigned char ar_tip[4]; /* target IP address */ + + u8 reverse[86]; +}; +#pragma pack() + +typedef dma_addr_t DMA_ADDR_T; +typedef enum pkt_hash_types RSS_HASH_TYPE; +typedef void __iomem* IOMEM; +typedef struct pci_dev PCI_DEV; + +struct ext_command_buf { + void* buf; + u32 size_in; + u32 size_out; +}; + +struct ext_command_mac { + u32 num; + union { + u32 val32; + u16 val16; + u8 val8; + }; +}; + +struct ext_command_mii { + u16 dev; + u16 num; + u16 val; +}; + +struct ext_ioctl_data { + u32 cmd_type; + struct ext_command_buf cmd_buf; +}; + +typedef struct _fxgmac_test_buf { + u8* addr; + u32 offset; + u32 length; +} fxgmac_test_buf, *pfxgmac_test_buf; + +typedef struct _fxgmac_test_packet { + struct _fxgmac_test_packet * next; + u32 length; /* total length of the packet(buffers) */ + u32 type; /* packet type, vlan, ip checksum, TSO, etc. */ + + fxgmac_test_buf buf[MAX_PKT_BUF]; + fxgmac_test_buf sGList[MAX_PKT_BUF]; + u16 vlanID; + u16 mss; + u32 hash; + u16 cpuNum; + u16 xsum; /* rx, ip-payload checksum */ + u16 csumStart; /* custom checksum offset to the mac-header */ + u16 csumPos; /* custom checksom position (to the mac_header) */ + void* upLevelReserved[4]; + void* lowLevelReserved[4]; +} fxgmac_test_packet, *pfxgmac_test_packet; + +typedef struct fxgmac_channel_of_platform +{ + char dma_irq_name[IFNAMSIZ + 32]; + + u32 dma_irq_tx; //for MSIx to match the type of struct msix_entry.vector + char dma_irq_name_tx[IFNAMSIZ + 32]; + + /* Netdev related settings */ + struct napi_struct napi_tx; + + /* Netdev related settings */ + struct napi_struct napi_rx; + struct timer_list tx_timer; + +#if FXGMAC_TX_HANG_TIMER_ENABLED + unsigned int tx_hang_timer_active; + struct timer_list tx_hang_timer; + unsigned int tx_hang_hw_cur; +#endif +}FXGMAC_CHANNEL_OF_PLATFORM; + +typedef struct per_regisiter_info +{ + unsigned int size; + unsigned int address; + unsigned int value; + unsigned char data[FXGAMC_MAX_DATA_SIZE]; +}PER_REG_INFO; + +/* + * for FXGMAC_EFUSE_WRITE_PATCH_PER_INDEX,val0 is index, val1 is offset, + * val2 is value + */ +typedef struct ext_command_data { + u32 val0; + u32 val1; + u32 val2; +}CMD_DATA; + +enum fxgmac_task_flag { + FXGMAC_FLAG_TASK_DOWN = 0, + FXGMAC_FLAG_TASK_RESET_PENDING, + FXGMAC_FLAG_TASK_ESD_CHECK_PENDING, + FXGMAC_FLAG_TASK_LINKCHG_CHECK_PENDING, + FXGMAC_FLAG_TASK_MAX +}; + +typedef struct fxgmac_esd_stats { + u32 tx_abort_excess_collisions; + u32 tx_dma_underrun; + u32 tx_lost_crs; + u32 tx_late_collisions; + u32 rx_crc_errors; + u32 rx_align_errors; + u32 rx_runt_errors; + u32 single_collisions; + u32 multi_collisions; + u32 tx_deferred_frames; +}FXGMAC_ESD_STATS; + +typedef enum fxgmac_dev_state { + FXGMAC_DEV_OPEN = 0x0, + FXGMAC_DEV_CLOSE = 0x1, + FXGMAC_DEV_STOP = 0x2, + FXGMAC_DEV_START = 0x3, + FXGMAC_DEV_SUSPEND = 0x4, + FXGMAC_DEV_RESUME = 0x5, + FXGMAC_DEV_PROBE = 0xFF, +}DEV_STATE; + +typedef struct fxgmac_pdata_of_platform +{ + u32 cfg_pci_cmd; + u32 cfg_cache_line_size; + u32 cfg_mem_base; + u32 cfg_mem_base_hi; + u32 cfg_io_base; + u32 cfg_int_line; + u32 cfg_device_ctrl1; + u32 cfg_pci_link_ctrl; + u32 cfg_device_ctrl2; + u32 cfg_msix_capability; + + int pre_phy_speed; + int pre_phy_duplex; + int pre_phy_autoneg; + + struct work_struct restart_work; +#ifdef FXGMAC_ESD_CHECK_ENABLED + struct delayed_work esd_work; + FXGMAC_ESD_STATS esd_stats; + DECLARE_BITMAP(task_flags, FXGMAC_FLAG_TASK_MAX); +#endif + +#ifdef FXGMAC_EPHY_LOOPBACK_DETECT_ENABLED + struct delayed_work loopback_work; + u32 lb_test_flag; // for tool + u32 lb_cable_flag; // for driver + u32 lb_cable_detect_count; // for driver +#endif + +#ifdef FXGMAC_ASPM_ENABLED + struct delayed_work aspm_config_work; + bool aspm_en; + bool aspm_work_active; +#endif + bool recover_from_aspm; + + u32 int_flags; /* legacy, msi or msix */ + int misc_irq; +#ifdef CONFIG_PCI_MSI + struct msix_entry *msix_entries; +#endif + + /* power management and wol*/ + u32 wol; + unsigned long powerstate; + /*for ns-offload table. 2 entries supported. */ + unsigned int ns_offload_tab_idx; + netdev_features_t netdev_features; + struct napi_struct napi; +#ifndef FXGMAC_MISC_NOT_ENABLED + struct napi_struct napi_misc; +#endif + u8 recover_phy_state; + char misc_irq_name[IFNAMSIZ + 32]; + bool phy_link; + bool fxgmac_test_tso_flag; + u32 fxgmac_test_tso_seg_num; + u32 fxgmac_test_last_tso_len; + u32 fxgmac_test_packet_len; + volatile u32 fxgmac_test_skb_arr_in_index; + volatile u32 fxgmac_test_skb_arr_out_index; + /* CMD_DATA ex_cmd_data; */ + /* PER_REG_INFO per_reg_data; */ + struct sk_buff *fxgmac_test_skb_array[FXGMAC_MAX_DBG_TEST_PKT]; + DEV_STATE dev_state; + struct mutex mutex; + struct timer_list phy_poll_tm; +}FXGMAC_PDATA_OF_PLATFORM; + +void fxgmac_restart_dev(struct fxgmac_pdata *pdata); +long fxgmac_netdev_ops_ioctl(struct file *file, unsigned int cmd, + unsigned long arg); + +int fxgmac_init(struct fxgmac_pdata *pdata, bool save_private_reg); +/* for phy interface */ +#if 0 +int fxgmac_ephy_autoneg_ability_get(struct fxgmac_pdata *pdata, + unsigned int *cap_mask); +#endif + +int fxgmac_ephy_status_get(struct fxgmac_pdata *pdata, int* speed, + int* duplex, int* ret_link, int *media); +int fxgmac_ephy_soft_reset(struct fxgmac_pdata *pdata); +int fxgmac_phy_force_mode(struct fxgmac_pdata *pdata); +int fxgmac_phy_force_speed(struct fxgmac_pdata *pdata, int speed); +int fxgmac_phy_force_duplex(struct fxgmac_pdata *pdata, int duplex); +int fxgmac_phy_force_autoneg(struct fxgmac_pdata *pdata, int autoneg); +//void fxgmac_act_phy_link(struct fxgmac_pdata *pdata); +int fxgmac_phy_timer_init(struct fxgmac_pdata *pdata); +void fxgmac_phy_timer_destroy(struct fxgmac_pdata *pdata); +void fxgmac_phy_update_link(struct net_device *netdev); + +unsigned int fxgmac_get_netdev_ip4addr(struct fxgmac_pdata *pdata); +unsigned char * fxgmac_get_netdev_ip6addr(struct fxgmac_pdata *pdata, + unsigned char *ipval, + unsigned char *ip6addr_solicited, + unsigned int ifa_flag); + +#if FXGMAC_PM_FEATURE_ENABLED +void fxgmac_net_powerdown(struct fxgmac_pdata *pdata, unsigned int wol); +void fxgmac_net_powerup(struct fxgmac_pdata *pdata); +#endif + +inline unsigned int fxgmac_tx_avail_desc(struct fxgmac_ring *ring); +inline unsigned int fxgmac_rx_dirty_desc(struct fxgmac_ring *ring); +int fxgmac_start(struct fxgmac_pdata *pdata); +void fxgmac_stop(struct fxgmac_pdata *pdata); +void fxgmac_free_rx_data(struct fxgmac_pdata *pdata); +void fxgmac_free_tx_data(struct fxgmac_pdata *pdata); + +void fxgmac_tx_start_xmit(struct fxgmac_channel *channel, struct fxgmac_ring *ring); +void fxgmac_dev_xmit(struct fxgmac_channel *channel); +void fxgmac_config_wol(struct fxgmac_pdata *pdata, int en); +void fxgmac_print_pkt(struct net_device *netdev, struct sk_buff *skb, bool tx_rx); + +void fxgmac_lock(struct fxgmac_pdata * pdata); +void fxgmac_unlock(struct fxgmac_pdata * pdata); + +void fxgmac_set_phy_link_ksettings(struct fxgmac_pdata *pdata); + +#ifdef FXGMAC_ASPM_ENABLED +void fxgmac_schedule_aspm_config_work(struct fxgmac_pdata *pdata); +void fxgmac_cancel_aspm_config_work(struct fxgmac_pdata *pdata); +bool fxgmac_aspm_action_linkup(struct fxgmac_pdata *pdata); +#endif + +#endif /* __FXGMAC_OS_H__ */ + diff --git a/lede/package/kernel/yt6801/src/motorcomm b/lede/package/kernel/yt6801/src/motorcomm new file mode 100644 index 0000000000..51c7a128ab --- /dev/null +++ b/lede/package/kernel/yt6801/src/motorcomm @@ -0,0 +1,49 @@ +#!/bin/sh +# +# yt6801 initramfs-tools hook script +# +# Installs copies of firmware files for the yt6801 driver +# to the early initramfs + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +prereqs) + prereqs + exit 0 + ;; +esac + +. /usr/share/initramfs-tools/hook-functions + +# +# Copy yt6801 driver to /lib/modules/ to be seen +# by mkinitramfs tool during initrd.img creation +# +copy_yt6801_driver() { + local dir="/lib/modules/$version/kernel/kylin/yt6801" + + mkdir -p $dir + cp -a $dir/yt6801.ko $dir +} + +# +# Remove yt6801 driver at /lib/modules/ location +# +clean_yt6801_driver() { + local dir="/lib/modules/$version/kernel/kylin/yt6801" + + rm -rf $dir +# if [ -z "$(ls -A $dir)" ]; then +# rm -rf $dir +# fi +} + +copy_yt6801_driver +manual_add_modules yt6801 +#clean_yt6801_driver diff --git a/lede/target/linux/loongarch64/Makefile b/lede/target/linux/loongarch64/Makefile index 950880e22b..c128c61779 100644 --- a/lede/target/linux/loongarch64/Makefile +++ b/lede/target/linux/loongarch64/Makefile @@ -10,14 +10,14 @@ BOARDNAME:=Loongson LoongArch FEATURES:=audio display ext4 pcie boot-part rootfs-part rtc usb targz SUBTARGETS:=generic -KERNEL_PATCHVER:=6.6 -KERNEL_TESTING_PATCHVER:=6.12 +KERNEL_PATCHVER:=6.12 +KERNEL_TESTING_PATCHVER:=6.6 KERNELNAME:=vmlinuz.efi dtbs include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ - partx-utils blkid e2fsprogs grub2-efi-loongarch64 + partx-utils blkid e2fsprogs grub2-efi-loongarch64 kmod-yt6801 $(eval $(call BuildTarget)) diff --git a/mihomo/adapter/outbound/mieru.go b/mihomo/adapter/outbound/mieru.go index 8ef9cfd758..bfdf0e519f 100644 --- a/mihomo/adapter/outbound/mieru.go +++ b/mihomo/adapter/outbound/mieru.go @@ -5,6 +5,7 @@ import ( "fmt" "net" "strconv" + "strings" "sync" CN "github.com/metacubex/mihomo/common/net" @@ -30,8 +31,8 @@ type MieruOption struct { BasicOption Name string `proxy:"name"` Server string `proxy:"server"` - Port int `proxy:"port,omitempty"` - PortRange string `proxy:"port-range,omitempty"` + Port string `proxy:"port,omitempty"` + PortRange string `proxy:"port-range,omitempty"` // deprecated Transport string `proxy:"transport"` UDP bool `proxy:"udp,omitempty"` UserName string `proxy:"username"` @@ -123,13 +124,19 @@ func NewMieru(option MieruOption) (*Mieru, error) { } // Client is started lazily on the first use. + // Use the first port to construct the address. var addr string - if option.Port != 0 { - addr = net.JoinHostPort(option.Server, strconv.Itoa(option.Port)) + var portStr string + if option.Port != "" { + portStr = option.Port } else { - beginPort, _, _ := beginAndEndPortFromPortRange(option.PortRange) - addr = net.JoinHostPort(option.Server, strconv.Itoa(beginPort)) + portStr = option.PortRange } + firstPort, err := getFirstPort(portStr) + if err != nil { + return nil, fmt.Errorf("failed to get first port from port string %q: %w", portStr, err) + } + addr = net.JoinHostPort(option.Server, strconv.Itoa(firstPort)) outbound := &Mieru{ Base: &Base{ name: option.Name, @@ -183,54 +190,62 @@ func buildMieruClientConfig(option MieruOption) (*mieruclient.ClientConfig, erro } transportProtocol := mierupb.TransportProtocol_TCP.Enum() - var server *mierupb.ServerEndpoint - if net.ParseIP(option.Server) != nil { - // server is an IP address - if option.PortRange != "" { - server = &mierupb.ServerEndpoint{ - IpAddress: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - PortRange: proto.String(option.PortRange), + + portBindings := make([]*mierupb.PortBinding, 0) + if option.Port != "" { + parts := strings.Split(option.Port, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if strings.Contains(part, "-") { + _, _, err := beginAndEndPortFromPortRange(part) + if err == nil { + portBindings = append(portBindings, &mierupb.PortBinding{ + PortRange: proto.String(part), Protocol: transportProtocol, - }, - }, - } - } else { - server = &mierupb.ServerEndpoint{ - IpAddress: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - Port: proto.Int32(int32(option.Port)), - Protocol: transportProtocol, - }, - }, - } - } - } else { - // server is a domain name - if option.PortRange != "" { - server = &mierupb.ServerEndpoint{ - DomainName: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - PortRange: proto.String(option.PortRange), - Protocol: transportProtocol, - }, - }, - } - } else { - server = &mierupb.ServerEndpoint{ - DomainName: proto.String(option.Server), - PortBindings: []*mierupb.PortBinding{ - { - Port: proto.Int32(int32(option.Port)), - Protocol: transportProtocol, - }, - }, + }) + } else { + return nil, err + } + } else { + p, err := strconv.Atoi(part) + if err != nil { + return nil, fmt.Errorf("invalid port value: %s", part) + } + portBindings = append(portBindings, &mierupb.PortBinding{ + Port: proto.Int32(int32(p)), + Protocol: transportProtocol, + }) } } } + if option.PortRange != "" { + parts := strings.Split(option.PortRange, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if _, _, err := beginAndEndPortFromPortRange(part); err == nil { + portBindings = append(portBindings, &mierupb.PortBinding{ + PortRange: proto.String(part), + Protocol: transportProtocol, + }) + } + } + } + + var server *mierupb.ServerEndpoint + if net.ParseIP(option.Server) != nil { + // server is an IP address + server = &mierupb.ServerEndpoint{ + IpAddress: proto.String(option.Server), + PortBindings: portBindings, + } + } else { + // server is a domain name + server = &mierupb.ServerEndpoint{ + DomainName: proto.String(option.Server), + PortBindings: portBindings, + } + } + config := &mieruclient.ClientConfig{ Profile: &mierupb.ClientProfile{ ProfileName: proto.String(option.Name), @@ -259,31 +274,9 @@ func validateMieruOption(option MieruOption) error { if option.Server == "" { return fmt.Errorf("server is empty") } - if option.Port == 0 && option.PortRange == "" { - return fmt.Errorf("either port or port-range must be set") + if option.Port == "" && option.PortRange == "" { + return fmt.Errorf("port must be set") } - if option.Port != 0 && option.PortRange != "" { - return fmt.Errorf("port and port-range cannot be set at the same time") - } - if option.Port != 0 && (option.Port < 1 || option.Port > 65535) { - return fmt.Errorf("port must be between 1 and 65535") - } - if option.PortRange != "" { - begin, end, err := beginAndEndPortFromPortRange(option.PortRange) - if err != nil { - return fmt.Errorf("invalid port-range format") - } - if begin < 1 || begin > 65535 { - return fmt.Errorf("begin port must be between 1 and 65535") - } - if end < 1 || end > 65535 { - return fmt.Errorf("end port must be between 1 and 65535") - } - if begin > end { - return fmt.Errorf("begin port must be less than or equal to end port") - } - } - if option.Transport != "TCP" { return fmt.Errorf("transport must be TCP") } @@ -306,8 +299,36 @@ func validateMieruOption(option MieruOption) error { return nil } +func getFirstPort(portStr string) (int, error) { + if portStr == "" { + return 0, fmt.Errorf("port string is empty") + } + parts := strings.Split(portStr, ",") + firstPart := parts[0] + + if strings.Contains(firstPart, "-") { + begin, _, err := beginAndEndPortFromPortRange(firstPart) + if err != nil { + return 0, err + } + return begin, nil + } + + port, err := strconv.Atoi(firstPart) + if err != nil { + return 0, fmt.Errorf("invalid port format: %s", firstPart) + } + return port, nil +} + func beginAndEndPortFromPortRange(portRange string) (int, int, error) { var begin, end int _, err := fmt.Sscanf(portRange, "%d-%d", &begin, &end) + if err != nil { + return 0, 0, fmt.Errorf("invalid port range format: %w", err) + } + if begin > end { + return 0, 0, fmt.Errorf("begin port is greater than end port: %s", portRange) + } return begin, end, err } diff --git a/mihomo/adapter/outbound/mieru_test.go b/mihomo/adapter/outbound/mieru_test.go index 086b791044..2b7976e4c7 100644 --- a/mihomo/adapter/outbound/mieru_test.go +++ b/mihomo/adapter/outbound/mieru_test.go @@ -1,22 +1,51 @@ package outbound -import "testing" +import ( + "reflect" + "testing" + + mieruclient "github.com/enfein/mieru/v3/apis/client" + mierupb "github.com/enfein/mieru/v3/pkg/appctl/appctlpb" + "google.golang.org/protobuf/proto" +) func TestNewMieru(t *testing.T) { + transportProtocol := mierupb.TransportProtocol_TCP.Enum() testCases := []struct { option MieruOption wantBaseAddr string + wantConfig *mieruclient.ClientConfig }{ { option: MieruOption{ Name: "test", Server: "1.2.3.4", - Port: 10000, + Port: "10000", Transport: "TCP", UserName: "test", Password: "test", }, wantBaseAddr: "1.2.3.4:10000", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + IpAddress: proto.String("1.2.3.4"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10000), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, { option: MieruOption{ @@ -28,28 +57,212 @@ func TestNewMieru(t *testing.T) { Password: "test", }, wantBaseAddr: "[2001:db8::1]:10001", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + IpAddress: proto.String("2001:db8::1"), + PortBindings: []*mierupb.PortBinding{ + { + PortRange: proto.String("10001-10002"), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, { option: MieruOption{ Name: "test", Server: "example.com", - Port: 10003, + Port: "10003", Transport: "TCP", UserName: "test", Password: "test", }, wantBaseAddr: "example.com:10003", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10003), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10004,10005", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10004", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10004), + Protocol: transportProtocol, + }, + { + Port: proto.Int32(10005), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10006-10007,11000", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10006", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + PortRange: proto.String("10006-10007"), + Protocol: transportProtocol, + }, + { + Port: proto.Int32(11000), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, + }, + { + option: MieruOption{ + Name: "test", + Server: "example.com", + Port: "10008", + PortRange: "10009-10010", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + wantBaseAddr: "example.com:10008", + wantConfig: &mieruclient.ClientConfig{ + Profile: &mierupb.ClientProfile{ + ProfileName: proto.String("test"), + User: &mierupb.User{ + Name: proto.String("test"), + Password: proto.String("test"), + }, + Servers: []*mierupb.ServerEndpoint{ + { + DomainName: proto.String("example.com"), + PortBindings: []*mierupb.PortBinding{ + { + Port: proto.Int32(10008), + Protocol: transportProtocol, + }, + { + PortRange: proto.String("10009-10010"), + Protocol: transportProtocol, + }, + }, + }, + }, + }, + }, }, } for _, testCase := range testCases { mieru, err := NewMieru(testCase.option) if err != nil { - t.Error(err) + t.Fatal(err) } + config, err := mieru.client.Load() + if err != nil { + t.Fatal(err) + } + config.Dialer = nil if mieru.addr != testCase.wantBaseAddr { t.Errorf("got addr %q, want %q", mieru.addr, testCase.wantBaseAddr) } + if !reflect.DeepEqual(config, testCase.wantConfig) { + t.Errorf("got config %+v, want %+v", config, testCase.wantConfig) + } + } +} + +func TestNewMieruError(t *testing.T) { + testCases := []MieruOption{ + { + Name: "test", + Server: "example.com", + Port: "invalid", + PortRange: "invalid", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + { + Name: "test", + Server: "example.com", + Port: "", + PortRange: "", + Transport: "TCP", + UserName: "test", + Password: "test", + }, + } + + for _, option := range testCases { + _, err := NewMieru(option) + if err == nil { + t.Errorf("expected error for option %+v, but got nil", option) + } } } @@ -63,6 +276,7 @@ func TestBeginAndEndPortFromPortRange(t *testing.T) { {"1-10", 1, 10, false}, {"1000-2000", 1000, 2000, false}, {"65535-65535", 65535, 65535, false}, + {"2000-1000", 0, 0, true}, {"1", 0, 0, true}, {"1-", 0, 0, true}, {"-10", 0, 0, true}, diff --git a/mihomo/component/tls/reality.go b/mihomo/component/tls/reality.go index cd6a47538e..fe1135f3c4 100644 --- a/mihomo/component/tls/reality.go +++ b/mihomo/component/tls/reality.go @@ -24,7 +24,6 @@ import ( "github.com/metacubex/randv2" utls "github.com/metacubex/utls" - "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/hkdf" "golang.org/x/net/http2" ) @@ -107,13 +106,8 @@ func GetRealityConn(ctx context.Context, conn net.Conn, fingerprint UClientHello if err != nil { return nil, err } - var aeadCipher cipher.AEAD - if utls.AesgcmPreferred(hello.CipherSuites) { - aesBlock, _ := aes.NewCipher(authKey) - aeadCipher, _ = cipher.NewGCM(aesBlock) - } else { - aeadCipher, _ = chacha20poly1305.New(authKey) - } + aesBlock, _ := aes.NewCipher(authKey) + aeadCipher, _ := cipher.NewGCM(aesBlock) aeadCipher.Seal(hello.SessionId[:0], hello.Random[20:], hello.SessionId[:16], hello.Raw) copy(hello.Raw[39:], hello.SessionId) //log.Debugln("REALITY hello.sessionId: %v", hello.SessionId) diff --git a/mihomo/docs/config.yaml b/mihomo/docs/config.yaml index b2d86c2318..574188182a 100644 --- a/mihomo/docs/config.yaml +++ b/mihomo/docs/config.yaml @@ -1024,8 +1024,8 @@ proxies: # socks5 - name: mieru type: mieru server: 1.2.3.4 - port: 2999 - # port-range: 2090-2099 #(不可同时填写 port 和 port-range) + port: 2999 # 支持使用 ports 格式,例如 2999,3999 或 2999-3010,3950,3995-3999 + # port-range: 2090-2099 # 已废弃,请使用 port transport: TCP # 只支持 TCP udp: true # 支持 UDP over TCP username: user diff --git a/mihomo/go.mod b/mihomo/go.mod index e7f0316dd0..d807b73219 100644 --- a/mihomo/go.mod +++ b/mihomo/go.mod @@ -22,7 +22,7 @@ require ( github.com/metacubex/chacha v0.1.5 github.com/metacubex/fswatch v0.1.1 github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 - github.com/metacubex/kcp-go v0.0.0-20250922034656-df9a2b90cdf7 + github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 github.com/metacubex/randv2 v0.2.0 github.com/metacubex/restls-client-go v0.1.7 @@ -37,7 +37,7 @@ require ( github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 - github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 + github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f github.com/miekg/dns v1.1.63 // lastest version compatible with golang1.20 github.com/mroth/weightedrand/v2 v2.1.0 diff --git a/mihomo/go.sum b/mihomo/go.sum index f27f5bafb5..5bd6da5110 100644 --- a/mihomo/go.sum +++ b/mihomo/go.sum @@ -112,8 +112,8 @@ github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvO github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759/go.mod h1:UHOv2xu+RIgLwpXca7TLrXleEd4oR3sPatW6IF8wU88= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301 h1:N5GExQJqYAH3gOCshpp2u/J3CtNYzMctmlb0xK9wtbQ= github.com/metacubex/gvisor v0.0.0-20250919004547-6122b699a301/go.mod h1:8LpS0IJW1VmWzUm3ylb0e2SK5QDm5lO/2qwWLZgRpBU= -github.com/metacubex/kcp-go v0.0.0-20250922034656-df9a2b90cdf7 h1:vGsrjQxlepSfkMALzJuvDzd+wp6NvKXpoyPuPb4SYCE= -github.com/metacubex/kcp-go v0.0.0-20250922034656-df9a2b90cdf7/go.mod h1:HIJZW4QMhbBqXuqC1ly6Hn0TEYT2SzRw58ns1yGhXTs= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b h1:z7JLKjugnQ1qvDOAD8yMA5C8AlJY3bG+VrrgRntRlUY= +github.com/metacubex/kcp-go v0.0.0-20250923001605-1ba6f691c45b/go.mod h1:HIJZW4QMhbBqXuqC1ly6Hn0TEYT2SzRw58ns1yGhXTs= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 h1:1Qpuy+sU3DmyX9HwI+CrBT/oLNJngvBorR2RbajJcqo= github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793/go.mod h1:RjRNb4G52yAgfR+Oe/kp9G4PJJ97Fnj89eY1BFO3YyA= github.com/metacubex/quic-go v0.54.1-0.20250730114134-a1ae705fe295 h1:8JVlYuE8uSJAvmyCd4TjvDxs57xjb0WxEoaWafK5+qs= @@ -145,8 +145,8 @@ github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 h1:T6qCCfolRDAVJKea github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 h1:Ui+/2s5Qz0lSnDUBmEL12M5Oi/PzvFxGTNohm8ZcsmE= github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 h1:5OGzQvoE5yuOe8AsZsFwhf32ZxKmKN9G+k06AVd+6jY= -github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2/go.mod h1:GN/CB3TRwQ9LYquYpIFynDkvMTYmkjwI7+mkUIoHj88= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e h1:t9IxEaxSRp3YJ1ewQV4oGkKaJaMeSoUWjOV0boLVQo8= +github.com/metacubex/utls v1.8.1-0.20250923145048-0a5bbc90dd3e/go.mod h1:kncGGVhFaoGn5M3pFe3SXhZCzsbCJayNOH4UEqTKTko= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f h1:FGBPRb1zUabhPhDrlKEjQ9lgIwQ6cHL4x8M9lrERhbk= github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f/go.mod h1:oPGcV994OGJedmmxrcK9+ni7jUEMGhR+uVQAdaduIP4= github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 h1:lhlqpYHopuTLx9xQt22kSA9HtnyTDmk5XjjQVCGHe2E= @@ -206,7 +206,6 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/tiendc/go-deepcopy v1.6.1 h1:uVRTItFeNHkMcLueHS7OCsxgxT9P8MzGB/taUa2Y4Tk= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= diff --git a/mihomo/transport/kcptun/client.go b/mihomo/transport/kcptun/client.go index af84133e36..46731ca962 100644 --- a/mihomo/transport/kcptun/client.go +++ b/mihomo/transport/kcptun/client.go @@ -2,8 +2,6 @@ package kcptun import ( "context" - "crypto/rand" - "encoding/binary" "net" "sync" "time" @@ -11,6 +9,7 @@ import ( "github.com/metacubex/mihomo/log" "github.com/metacubex/kcp-go" + "github.com/metacubex/randv2" "github.com/metacubex/smux" ) @@ -60,8 +59,7 @@ func (c *Client) createConn(ctx context.Context, dial DialFn) (*smux.Session, er } config := c.config - var convid uint32 - binary.Read(rand.Reader, binary.LittleEndian, &convid) + convid := randv2.Uint32() kcpconn, err := kcp.NewConn4(convid, addr, c.block, config.DataShard, config.ParityShard, true, conn) if err != nil { return nil, err diff --git a/mihomo/transport/vless/encryption/client.go b/mihomo/transport/vless/encryption/client.go index 9c029ed73c..bcfce08ed8 100644 --- a/mihomo/transport/vless/encryption/client.go +++ b/mihomo/transport/vless/encryption/client.go @@ -7,23 +7,12 @@ import ( "errors" "io" "net" - "runtime" "sync" "time" "github.com/metacubex/blake3" + utls "github.com/metacubex/utls" "github.com/metacubex/utls/mlkem" - "golang.org/x/sys/cpu" -) - -var ( - // Keep in sync with crypto/tls/cipher_suites.go. - hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ && cpu.X86.HasSSE41 && cpu.X86.HasSSSE3 - hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL - hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCTR && cpu.S390X.HasGHASH - hasGCMAsmPPC64 = runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" - - HasAESGCMHardwareSupport = hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X || hasGCMAsmPPC64 ) type ClientInstance struct { @@ -77,7 +66,7 @@ func (i *ClientInstance) Handshake(conn net.Conn) (*CommonConn, error) { if i.NfsPKeys == nil { return nil, errors.New("uninitialized") } - c := NewCommonConn(conn, HasAESGCMHardwareSupport) + c := NewCommonConn(conn, utls.HasAESGCMHardwareSupport()) ivAndRealysLength := 16 + i.RelaysLength pfsKeyExchangeLength := 18 + 1184 + 32 + 16 diff --git a/mihomo/transport/vless/encryption/client_test.go b/mihomo/transport/vless/encryption/client_test.go new file mode 100644 index 0000000000..793d01919e --- /dev/null +++ b/mihomo/transport/vless/encryption/client_test.go @@ -0,0 +1,21 @@ +package encryption + +import ( + "fmt" + "runtime" + "testing" + + utls "github.com/metacubex/utls" +) + +func TestHasAESGCMHardwareSupport(t *testing.T) { + fmt.Println("HasAESGCMHardwareSupport:", utls.HasAESGCMHardwareSupport()) + + if runtime.GOARCH == "arm64" && runtime.GOOS == "darwin" { + // It should be supported starting from Apple Silicon M1 + // https://github.com/golang/go/blob/go1.25.0/src/internal/cpu/cpu_arm64_darwin.go#L26-L30 + if !utls.HasAESGCMHardwareSupport() { + t.Errorf("For ARM64 Darwin platforms (excluding iOS), AES GCM hardware acceleration should always be available.") + } + } +} diff --git a/openwrt-packages/UnblockNeteaseMusic/Makefile b/openwrt-packages/UnblockNeteaseMusic/Makefile index 1ff919b676..8ac09ff31d 100644 --- a/openwrt-packages/UnblockNeteaseMusic/Makefile +++ b/openwrt-packages/UnblockNeteaseMusic/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=UnblockNeteaseMusic -PKG_VERSION:=0.27.10 +PKG_VERSION:=0.28.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/UnblockNeteaseMusic/server/tar.gz/v${PKG_VERSION}? -PKG_HASH:=49fc91f83485f29c4ac0f4867ebd473778639ac3f7ec526786577a10ca189b53 +PKG_HASH:=0a1e843ffaa7b8ce65cc221daec07b63754473f0430019acb228f5b254602318 PKG_SOURCE_SUBDIR:=$(PKG_NAME) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) diff --git a/openwrt-packages/luci-app-unblockneteasemusic/root/etc/init.d/unblockneteasemusic b/openwrt-packages/luci-app-unblockneteasemusic/root/etc/init.d/unblockneteasemusic index 8c8c51113e..789fc1fe6d 100755 --- a/openwrt-packages/luci-app-unblockneteasemusic/root/etc/init.d/unblockneteasemusic +++ b/openwrt-packages/luci-app-unblockneteasemusic/root/etc/init.d/unblockneteasemusic @@ -163,7 +163,7 @@ start_service() { ipset create "acl_neteasemusic_http" hash:ip ipset create "acl_neteasemusic_https" hash:ip - ipset create "neteasemusic" hash:ip + ipset create "neteasemusic" hash:ip timeout 7200 config_foreach append_filter_client "acl_rule" local netease_music_ips="$(wget -qO- "http://httpdns.n.netease.com/httpdns/v2/d?domain=music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com" |jsonfilter -e '@.data.*.ip.*')" diff --git a/openwrt-passwall/luci-app-passwall/Makefile b/openwrt-passwall/luci-app-passwall/Makefile index 0b91928e74..84ff929b8b 100644 --- a/openwrt-passwall/luci-app-passwall/Makefile +++ b/openwrt-passwall/luci-app-passwall/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=25.9.19 +PKG_VERSION:=25.9.23 PKG_RELEASE:=1 PKG_CONFIG_DEPENDS:= \ diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua index c5be76f3cc..a604594b36 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua @@ -130,6 +130,11 @@ if #hysteria2_type > 0 then end end +if #ss_type > 0 or #trojan_type > 0 or #vmess_type > 0 or #vless_type > 0 or #hysteria2_type > 0 then + o.description = string.format("%s", + translate("The configured type also applies to the core specified when manually importing nodes.")) +end + o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node.")) o.default = "" o:value("", translate("Auto")) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm index 833ce34070..e5f9242f6c 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm +++ b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm @@ -1336,16 +1336,13 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ dom_prefix = "xray_" opt.set('type', "Xray"); } - opt.set(dom_prefix + 'protocol', "vless"); + var m = parseNodeUrl(ssrurl); var password = m.passwd; if (password === "") { s.innerHTML = "<%:Invalid Share URL Format%>"; return false; } - opt.set(dom_prefix + 'uuid', password); - opt.set(dom_prefix + 'address', unbracketIP(m.hostname)); - opt.set(dom_prefix + 'port', m.port || "443"); var queryParam = {}; if (m.search.length > 1) { var query = m.search.replace('/?', '?').split('?') @@ -1358,6 +1355,16 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ } } + queryParam.type = queryParam.type.toLowerCase(); + if (["xhttp", "kcp", "mkcp"].includes(queryParam.type) && vless_type !== "xray" && has_xray) { + dom_prefix = "xray_" + opt.set('type', "Xray"); + } + opt.set(dom_prefix + 'protocol', "vless"); + opt.set(dom_prefix + 'uuid', password); + opt.set(dom_prefix + 'address', unbracketIP(m.hostname)); + opt.set(dom_prefix + 'port', m.port || "443"); + opt.set(dom_prefix + 'encryption', queryParam.encryption || "none"); if (queryParam.security) { if (queryParam.security == "tls") { @@ -1397,7 +1404,6 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ } - queryParam.type = queryParam.type.toLowerCase(); if (queryParam.type === "kcp") { queryParam.type = "mkcp"; } diff --git a/openwrt-passwall/luci-app-passwall/po/zh-cn/passwall.po b/openwrt-passwall/luci-app-passwall/po/zh-cn/passwall.po index 75b11e1a36..83cc18e5c8 100644 --- a/openwrt-passwall/luci-app-passwall/po/zh-cn/passwall.po +++ b/openwrt-passwall/luci-app-passwall/po/zh-cn/passwall.po @@ -1986,3 +1986,6 @@ msgstr "客户端版本" msgid "Random version will be used if empty." msgstr "如留空,则使用随机版本。" + +msgid "The configured type also applies to the core specified when manually importing nodes." +msgstr "配置的类型同样适用于手动导入节点时所指定的核心程序。" diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/app.sh b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/app.sh index 110b3e75a4..2bd4245fc8 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/app.sh @@ -2280,8 +2280,8 @@ get_config() { RESOLVFILE=/tmp/resolv.conf.d/resolv.conf.auto [ -f "${RESOLVFILE}" ] && [ -s "${RESOLVFILE}" ] || RESOLVFILE=/tmp/resolv.conf.auto - ISP_DNS=$(cat $RESOLVFILE 2>/dev/null | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | sort -u | grep -v 0.0.0.0 | grep -v 127.0.0.1) - ISP_DNS6=$(cat $RESOLVFILE 2>/dev/null | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | awk -F % '{print $1}' | awk -F " " '{print $2}'| sort -u | grep -v -Fx ::1 | grep -v -Fx ::) + ISP_DNS=$(cat $RESOLVFILE 2>/dev/null | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -v -E '^(0\.0\.0\.0|127\.0\.0\.1)$' | awk '!seen[$0]++') + ISP_DNS6=$(cat $RESOLVFILE 2>/dev/null | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | awk -F % '{print $1}' | awk -F " " '{print $2}' | grep -v -Fx ::1 | grep -v -Fx :: | awk '!seen[$0]++') DEFAULT_DNS=$(uci show dhcp.@dnsmasq[0] | grep "\.server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' '\n' | grep -v "\/" | head -2 | sed ':label;N;s/\n/,/;b label') [ -z "${DEFAULT_DNS}" ] && [ "$(echo $ISP_DNS | tr ' ' '\n' | wc -l)" -le 2 ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',' | sed 's/,$//') diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnlist b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnlist index b4ea2d9828..9dbd34378d 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnlist +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnlist @@ -51,7 +51,6 @@ 007card.vip 007gameapp10.com 007manhua.com -007qu.com 007shoes.com 007swz.com 007szx.com @@ -300,7 +299,6 @@ 028desite.com 028f.com 028hema.com -028ip.com 028kuaidai.com 028ltzx.com 028office.com @@ -765,7 +763,6 @@ 0793.tv 07938.com 0794zp.com -0795jz.com 0797122.com 0797auto.com 0797ayzp.com @@ -825,7 +822,6 @@ 0898hq.com 0898mmf.com 0898uf.com -0898xbfc.com 089u.com 08an.com 08ar.com @@ -843,7 +839,6 @@ 0912fdj.com 0912job.com 0913ss.com -0914cn.com 0915home.com 0916001.com 0917.com @@ -871,9 +866,9 @@ 0991dj.com 0991net.com 0992.cc +099913.com 09game.com 09ge.com -09k.net 09p9z7d1h8.com 09shijue.com 0a2d.com @@ -1053,7 +1048,6 @@ 100try.com 100tv.com 100txy.com -100u.com 100vr.com 100wa.com 100web.store @@ -1074,7 +1068,6 @@ 100yiyao.net 100zd.com 100zhuang.com -100zhuoyue.com 100zp.com 101.com 1010-0000.com @@ -1240,6 +1233,7 @@ 1156dns.com 115800.com 115cdn.com +115cdn.de 115cdn.net 115cloud.com 115cloud.net @@ -1677,7 +1671,6 @@ 1527ego.com 15311223344.com 153g.net -154.com 1545ts.com 155.com 155155155.xyz @@ -1732,7 +1725,6 @@ 16177.net 1617k.com 1618.com -161gg.com 1624.win 1626.com 163.cm @@ -2003,7 +1995,6 @@ 178zhaopin.com 179.com 179179.com -1794game.com 1797.cc 17986.net 17989.com @@ -2088,7 +2079,6 @@ 17kss.com 17kuxun.com 17kxgame.com -17kzj.com 17kzy.com 17l18w9s1z.com 17lai.org @@ -2245,7 +2235,6 @@ 1866.tv 18665348887.com 186688.com -18680.net 1872001.com 1873game.com 1874.cool @@ -2334,7 +2323,6 @@ 190757.com 190cai.com 19183.live.streamtheworld.com -1919.com 19196.com 1919game.net 191game.com @@ -2438,7 +2426,6 @@ 1ding.xyz 1domedia.com 1drv.ws -1dufish.com 1dw9r53h79.com 1f11.com 1fangchan.com @@ -2509,7 +2496,6 @@ 1mishu.com 1mit.com 1mjz.com -1mm8.com 1mmbie336689.com 1mmed.com 1more.com @@ -2653,13 +2639,13 @@ 2022cdnpl.com 2023.com 2023game.com -2024789.com 2024qq.com 2025.net 202wan.com 203328.com 2048sj.com 2049baby.com +204cloud.com 2050life.com 206zz.com 207xz.com @@ -2669,6 +2655,7 @@ 20fl.com 20g0.com 20images10.com +20images21.com 20images7.com 20ju.com 20kf.com @@ -2724,7 +2711,6 @@ 21cctm.com 21ccvn.com 21cd.com -21ce.cc 21cloudbox.com 21cn.com 21cn.net @@ -2752,7 +2738,6 @@ 21eline.com 21epub.com 21etm.com -21etn.com 21fid.com 21food.com 21fv52efm1.com @@ -2760,7 +2745,6 @@ 21good.com 21hifi.com 21hospital.com -21hulian.com 21hyzs.com 21ic.com 21icsearch.com @@ -2890,7 +2874,6 @@ 231083.com 231122.com 2317.com -231867.com 2321111.com 232232.xyz 2323u.com @@ -2935,6 +2918,7 @@ 2366.com 23673.com 236z.com +2375sj.com 237y.com 238000.net 238090.com @@ -2950,7 +2934,6 @@ 23job.net 23ks.com 23luke.com -23mf.com 23mofang.com 23qb.com 23qb.net @@ -3003,7 +2986,6 @@ 250340.com 251400.com 2523.com -252300.net 25285577.com 253.com 253669vqx.com @@ -3013,7 +2995,6 @@ 2541.com 254254.com 254game.com -255400.com 255616.com 255star.com 256app.com @@ -3074,7 +3055,6 @@ 26595.com 265g.com 265h.com -265o.com 266.com 266.la 266wan.com @@ -3122,7 +3102,6 @@ 27tj.com 27ws.com 27xuexiao.com -27ying.com 28.com 281010.com 28123.com @@ -3144,7 +3123,6 @@ 288idc.com 289.com 2898.com -28awe.com 28beiduo.com 28gl.com 28gua.com @@ -3494,7 +3472,6 @@ 332831.com 333-555.com 333.com -333056.com 33315.com 333232.xyz 333333.com @@ -3743,7 +3720,6 @@ 360lion.com 360lj.com 360lnk.com -360longyan.com 360loushi.com 360midi.com 360mkt.com @@ -4072,7 +4048,6 @@ 3856.cc 385k.cc 38735.vip -387764.com 388155.com 388g.com 3892222.com @@ -4485,7 +4460,6 @@ 41113.com 41188.com 411au.com -41324.com 413xkyd.com 414500.net 417628.org @@ -4562,7 +4536,6 @@ 43yl.com 43zhubao.com 4417.com -442.com 4444.cc 4444448.com 44460.com @@ -4621,7 +4594,6 @@ 46ny920931.com 46ps.com 46xs.com -47291.com 47295.com 4735.com 47365.com @@ -4636,7 +4608,6 @@ 47gs.com 47oupy0408.com 47rq.com -47test.com 47zu.com 48.com 4805555.com @@ -4710,7 +4681,6 @@ 4hmodel.com 4hou.com 4hpy.com -4humanknowledge.com 4inlook.com 4jplus.com 4juo2.com @@ -4906,7 +4876,6 @@ 517xc.com 51802.com 5184.com -5184edu.com 5184pass.com 5185.cc 51864.com @@ -5017,7 +4986,6 @@ 51daima.com 51daka.com 51dangpu.com -51daquan.com 51daxueedu.com 51dc.com 51dcgg.com @@ -5220,7 +5188,6 @@ 51lepai.com 51lesheng.com 51lg.com -51lianying.com 51lingji.com 51liucheng.com 51losangeles.com @@ -5479,7 +5446,6 @@ 51y5.com 51yabei.com 51yajk.com -51yangsheng.com 51yanwang.com 51yey.com 51yhdai.com @@ -5566,7 +5532,6 @@ 520link.com 520love520.com 520lpy.com -520meiwen.com 520mingmei.com 520mojing.com 520ok.net @@ -5647,7 +5612,6 @@ 52article.com 52asus.com 52audio.com -52ayw.com 52bar.com 52bishe.com 52bjd.com @@ -5771,6 +5735,7 @@ 52ml.net 52mqbiao.com 52mtc.com +52muban.com 52muyou.com 52myqq.com 52nail.com @@ -5825,7 +5790,6 @@ 52svn.com 52swine.com 52t1.com -52tat.org 52tc.co 52tc.info 52tesla.com @@ -5918,8 +5882,6 @@ 537images22.com 537images41.com 537images42.com -537images5.com -537images7.com 538618.com 53920.net 5395.com @@ -5976,7 +5938,6 @@ 54pictu.com 54qj.com 54read.com -54seaman.com 54traveler.com 54tup.com 54watch.com @@ -6089,7 +6050,6 @@ 56885.net 569.com 5694.com -5698415.com 56a.com 56admin.com 56ads.com @@ -6235,7 +6195,6 @@ 58display.com 58dns.me 58dns.org -58duihuan.com 58eventer.com 58fkb.com 58food.com @@ -6289,7 +6248,6 @@ 58youxi.com 58yuesao.com 58z.net -58zhuiju.com 59.com 5909.net 590m.com @@ -6470,7 +6428,6 @@ 5iops.com 5ipatent.com 5ipkwan.com -5ips.net 5isanguo.com 5isohu.com 5iucn.com @@ -6560,7 +6517,6 @@ 5uu8.com 5uyk.com 5v13.com -5w.com 5w123.com 5w5.com 5w52.com @@ -6575,7 +6531,6 @@ 5xiaobo.com 5xini.com 5xmjm.com -5xw.net 5xyouse.com 5y6s.com 5yang.cc @@ -6623,7 +6578,6 @@ 603ee.com 6046.net 605-zy.com -605339.com 60593.com 605dns.com 605zy.co @@ -6700,6 +6654,7 @@ 61mami.com 61mc.com 61n1le.com +61ok.com 61psy.com 61sheji.com 61sou.com @@ -6713,7 +6668,6 @@ 62669.com 626x.com 628.com -628c4.com 62923.vip 629973.com 62dns.com @@ -6764,7 +6718,6 @@ 648sy.com 64ba.com 64dns.com -64ee.com 64foot.com 64gua.com 64ma.com @@ -6831,7 +6784,6 @@ 6668dns.com 666gps.com 666idc.com -666j.com 666kuaishou.com 666kuaishou.net 666pic.com @@ -6863,7 +6815,6 @@ 669play.com 669ye.com 669zw.com -66a.net 66call.com 66d6.com 66ds.net @@ -6962,7 +6913,6 @@ 688dns.com 688wz.net 68955.com -6895588.com 68978.net 6899wan.com 68apk.com @@ -7088,7 +7038,6 @@ 6pifa.net 6pingm.com 6puppy.xyz -6q8a8.com 6r8c86z4jh.icu 6ren.com 6rencn.com @@ -7298,12 +7247,12 @@ 7415.com 7428.net 743388.com +743forever.com 744zy.com 745998.xyz 7474.com 7477.com 747wan.com -749282.vip 74955.net 74966.net 74977.net @@ -7336,6 +7285,7 @@ 76107448.com 7618.com 761a.com +7633sqw.com 7651.com 766.com 7663.com @@ -7386,7 +7336,6 @@ 77521.com 77545.com 7756.org -77585.club 775jia.net 776577.com 7766.info @@ -7432,7 +7381,6 @@ 77itv.com 77l.com 77lux.com -77mh.app 77music.com 77nt.com 77nt.info @@ -7482,7 +7430,6 @@ 78tp.com 78v.com 78yx.net -78zw.com 79-79.com 79.com 793360.com @@ -7496,8 +7443,6 @@ 798ydh.com 798zb.tv 799.net -79932.co -7999.com 7999.tv 79999.net 799job.com @@ -7534,7 +7479,6 @@ 7ed.net 7edown.com 7ee.com -7eka.com 7eo8cc932r.com 7fei.com 7fgame.com @@ -7665,7 +7609,6 @@ 80-go.com 80.hk 80000.cc -800086.com 800423.com 800535.com 8006506.com @@ -7688,7 +7631,6 @@ 800buy.com 800cdn.com 800du.com -800fa.com 800hr.com 800jcw.com 800li.net @@ -7710,7 +7652,6 @@ 802203.com 80351.com 805481.com -80579.com 80585.com 805m.com 807.com @@ -7946,7 +7887,6 @@ 8684.com 8686c.com 8688g.com -86909.com 86933.com 869d.com 869v.com @@ -8003,7 +7943,6 @@ 87188718.com 872.cc 872872.com -87573.org 87654321.xyz 8767.com 876web.com @@ -8026,7 +7965,6 @@ 880.net 8800.org 880022.com -8800808.com 8801.net 880303.xyz 880331.net @@ -8046,7 +7984,6 @@ 88360.com 8838sl.com 883dai.com -8842777.com 884358.com 8844.com 88453392.com @@ -8256,7 +8193,6 @@ 8tool.club 8tupian.com 8tupian.net -8twan.com 8u18.com 8u58.com 8u7q5l9gox.com @@ -8364,7 +8300,6 @@ 9188.com 918canyin.com 918dxs.com -918haoma.com 918ka.cc 918rc.com 919.com @@ -8521,6 +8456,7 @@ 91up.com 91vpn.com 91vps.com +91vrchat.com 91vst.com 91waijiao.com 91waitang.com @@ -8531,11 +8467,12 @@ 91weimi.com 91wenmi.com 91wenwen.net +91wink.com 91wllm.com -91wri.com 91wujia.com 91wutong.com 91wzg.com +91xch.com 91xcm.com 91xfw.com 91xiake.com @@ -8609,19 +8546,16 @@ 92jzh.com 92kaifa.com 92kk.com -92ku.com 92le.com 92lm.com 92lucky.com 92mp.com -92mtnnn.com 92nas.com 92ni.com 92oz46nne1.com 92scj.com 92shuoshuo.com 92sucai.com -92tianjin.com 92to.com 92txt.cc 92u93e.com @@ -8669,7 +8603,6 @@ 93sem.com 93soso.com 93trf.com -93ty.com 93tyy.com 93wgames.com 93yo.com @@ -8881,7 +8814,6 @@ 9718game.com 9724.com 97576.com -975bl.com 97616.net 976186.cc 97654.com @@ -8915,7 +8847,6 @@ 97rp.com 97rx.com 97shenghuo.com -97sp.cc 97ting.com 97ui.com 97uimg.com @@ -8991,7 +8922,6 @@ 99193.com 991kang.com 991quka.com -9920102.com 9928.tv 993207.com 9935china-air.com @@ -9028,6 +8958,7 @@ 998jk.com 998jx.com 998law.com +998tool.com 9991.com 999120.net 999125.com @@ -9111,13 +9042,11 @@ 99n.me 99pdf.com 99ppt.com -99pto.com 99qh.com 99qibang.com 99qimingzi.com 99qumingzi.com 99read.com -99read.xyz 99shi.com 99shou.com 99sj.com @@ -9130,7 +9059,6 @@ 99tongxuelu.com 99uri.com 99weiqi.com -99wenku.com 99wj.com 99wuxian.com 99xr.com @@ -9289,7 +9217,6 @@ 9w1an.com 9w9.com 9wan8.com -9wanjia.com 9wee.net 9wuli.com 9wwx.com @@ -9410,7 +9337,6 @@ aafxw.com aai07251mu.com aai07260mu.com aakss.com -aakvtsad.shop aaltosemi.com aamets.com aamev.com @@ -9503,7 +9429,6 @@ abesmoke.com abhouses.com abiaogw.com abiechina.com -abiestem.com abifsey.com abitcg.com abite.com @@ -9614,8 +9539,6 @@ acg18s.com acg4.com acg6.com acgaa.xyz -acgaf.com -acgaf.gay acgdb.com acgist.com acglivefan.com @@ -9658,7 +9581,6 @@ acmsearch.com acmturc.com acnow.net aco-musical.com -acobt.tech acoloo.com acoolread.com acpf-cn.org @@ -9867,6 +9789,7 @@ adwep.com adwery.com adwintech.com adwke.com +adx.pw adx666.com adxflow.com adxliangmei.com @@ -9896,7 +9819,6 @@ aecichina.com aecname.com aeconomic.com aecsian.com -aeeboo.com aeenergy.com aeenets.com aeespace.com @@ -9952,7 +9874,6 @@ afdsc.com afdvr.cc afdvr.com afengblog.com -afengseo.com afengsoft.com afenxi.com affann.com @@ -10514,12 +10435,10 @@ aijiajiankang.com aijianji.com aijiatui.com aijiayou.com -aijieneng.com aijingu.com aijishu.com aijiuku.com aijizhang.net -aiju.com aijuhome.com aijunwang.com aik.com @@ -10615,7 +10534,6 @@ aipai.com aipaike.com aipaixt.asia aipaiyinghua.com -aipapi.com aipark.com aiparkvip.com aipay.cloud @@ -10713,7 +10631,6 @@ aiseminar.com aisenseinc.com aishangba.info aishangba.org -aishanghaibao11.com aishangyangyu.com aisharenet.com aishengji.com @@ -10750,7 +10667,6 @@ aisy.com aitangyou.com aitansuo.com aitaotu.com -aitaxinxi.xyz aitcfw.com aite.xyz aitecar.com @@ -11525,7 +11441,6 @@ amaxchina.com amayad.com amazfit.com amazingsys.com -ambassador-sh.com ambassadorchina.com amberbj.com amberedu.com @@ -11570,6 +11485,7 @@ amindbox.com aminglinux.com amishii.com amishow.com +amiyabot.com amo-solar.com amo9.com amobbs.com @@ -11596,7 +11512,6 @@ amswater.com amtbbs.org amtf18.com amtjt.com -amtk.com amtron-ic.com amuletj.com amuletor.com @@ -11932,7 +11847,7 @@ antmoe.com antom.com antpcdn.com antpedia.com -antquan.com +antplay888.com antriver.com antrol.com antsdaq.com @@ -12031,7 +11946,6 @@ anywood.com anyxz.com anzerclub.com anzext.com -anzeyun.com anzhen.org anzhengshipin.com anzhi.com @@ -12148,7 +12062,6 @@ aotian.com aoto.com aotoso.com aotrip.net -aotutu.com aotuzuche.com aotxland.com aoun.ltd @@ -12237,6 +12150,7 @@ apickup.com apicloud.com apifabric.net apifox.com +apifoxmock.com apigwtencent.com apilyzy.com apim.work @@ -12289,7 +12203,6 @@ apodaenvi.com apollo-platform.com apollo-share.com apollo.auto -apollocode.net apollopump.com apollotop.com apous.com @@ -12360,7 +12273,6 @@ appnode.com appol.com appollochina.com appotronics.com -apppoo.com appqv.com appresource.net approvebook.com @@ -12596,7 +12508,6 @@ artexamcq.com artfinace.com artfoxlive.com artgogo.com -artgoin.com arthals.ink arthing.org arthome163.com @@ -12667,7 +12578,6 @@ aschina.org aschip.com aschtj.com asciima.com -ascn.site asczwa.com asczxcefsv.com asd.red @@ -13106,7 +13016,6 @@ avicnews.com avicsec.com avicsgt.com avicui.com -avidbird.com avilive.com avinex.com avischina.com @@ -13316,7 +13225,6 @@ axmro.com axmw.com axnsc.com axq66.com -axqbs.com axqqq.com axqswm.net axs8.com @@ -13331,10 +13239,10 @@ axxsw.org axybio.com axyxt.com axzchou.com -axzhaofang.com ay-china.com ay-health.com ay001.com +ay001.net ay2fy.com ay57.com ay5y.com @@ -13387,10 +13295,8 @@ ayudasalud.com ayump.com ayunlian.com ayuren.com -ayuwoe.com ayuyun.com ayw.ink -ayxbk.com ayxz.com ayzzxx.com az009.com @@ -13504,7 +13410,6 @@ b6522.com b7av.com b7l.cc b8kk.com -b8th-hzvac3.com b8yx.com b9ad.com ba-li.com @@ -13582,7 +13487,6 @@ bafangwy.com bag198.com bagb2b.com bagevent.com -bageyalu.com bags163.com bagschangedmylife.com bagsnet.com @@ -13655,7 +13559,6 @@ baidu-nj.com baidu-tech.com baidu-wenxue.com baidu.cc -baidu.cm baidu.com baidu.com.hk baidu.hk @@ -13673,7 +13576,6 @@ baiducloudapi.com baiducontent.com baidudaquan.com baidudw.com -baidufcjx.com baidufe.com baidufree.com baiduhtml5.com @@ -13685,7 +13587,6 @@ baidupcs.com baidupcs.net baidupeixun.com baidusmartapps.com -baidusobing.com baidustat.com baidusx.cc baidusx.com @@ -13741,7 +13642,6 @@ baihui.com baihui.live baihui168.com baihuibio.com -baihuikucun.com baihuillq.com baihuiyaoye.com baiila.com @@ -13936,7 +13836,6 @@ baiyunairport.com baiyunholding.com baiyunhuojia.com baiyunmh.com -baiyunpiaopiao.com baiyunpump.com baiyunxitong.com baiyyy.com @@ -13958,7 +13857,6 @@ baka.plus bakaxl.com bakbitionb.com bakclass.com -bakehr.net bakingerp.com baklib.com bakpower.com @@ -14106,7 +14004,6 @@ bankoftianjin.com bankoftieling.com bankofvolc.com bankofyk.com -bankpublish.com banksteel.com bankyellowriver.com banlikanban.com @@ -14243,7 +14140,6 @@ baojinling.com baojule.com baojun.net baojunev.com -baokan.name baokan.tv baokang.com baokanhuicui.com @@ -14534,7 +14430,6 @@ bbtkid.com bbtpress.com bbtree.com bbtwatch.com -bbtydc.com bbugifts.com bbunion.com bbw-portnet.com @@ -14544,7 +14439,6 @@ bbwfish.com bbwgw.com bbwhy.com bbwict.com -bbwnt.com bbwoils.com bbwotc.com bbwport.com @@ -14734,7 +14628,6 @@ bdszh.vip bdtianchang.com bdtic.com bdtjrcv.com -bdtjs.org bdtm.net bdtsc.com bduapp.com @@ -14790,6 +14683,7 @@ bearyboard.com bearychat.com beastush.com beasure.com +beatbeatone.com beats-digital.com beatsbydre.com beaucare.org @@ -14852,7 +14746,6 @@ beicaiyuan.com beicdn.com beichende.com beicity.com -beidahuang.net beidasoft.com beidd.com beidian.com @@ -14935,7 +14828,6 @@ beijingrc.com beijingrc.net beijingrenyi.com beijingsanchi.com -beijingsheying.net beijingtaixie.com beijingtoon.com beijingtrucks.com @@ -15043,7 +14935,6 @@ bendiso.com bendiw.cc bendizhidao.com benduo.net -benellimotor.com benewake.com benfuip.com bengbufan.com @@ -15458,7 +15349,6 @@ bhxxpt.com bhxz.net bhybskq.com bhyby.com -bhycjdyp.com bhyintan.com bhyueda.com bhzck.club @@ -15667,7 +15557,6 @@ bijiao.org bijiasso.com bijiatu.com bijienetworks.com -bijikang.com bijingdi.com bijirim.com bijixia.net @@ -15715,6 +15604,7 @@ biliimg.com biliintl.co biliintl.com bilimanga.net +bilinl.com bilinovel.com biliplus.com biliui.com @@ -15903,13 +15793,12 @@ biqufu.com biqugao.cc biquge.info biquge.la +biquge123.com biquge365.com biquge8.com biquge9.cc biquge99.cc -biqugeabc.com biqugeg.com -biqugegg.cc biqugena.com biquges.com biqugesk.org @@ -16065,7 +15954,6 @@ bizcn.com bizcn.net bizcn666.com bizconfstreaming.com -bizhi3.com bizhi360.com bizhi88.com bizhigq.com @@ -16097,7 +15985,6 @@ bj-fm.com bj-fxh.com bj-git.com bj-hengdeli.com -bj-hzzs.com bj-ipcf.org bj-jzgg.com bj-klws.com @@ -16105,7 +15992,6 @@ bj-kpn.com bj-nego.com bj-pr.com bj-px.com -bj-ranqi.com bj-sea.com bj-shouqi.com bj-syc.com @@ -16249,7 +16135,6 @@ bjfpw.com bjfqy.com bjfriendshiphotel.com bjfsali.com -bjfyw.org bjfzst.com bjgas.com bjgasgh.com @@ -16316,7 +16201,6 @@ bjhzzs.com bjiab.com bjiae.net bjiaep.com -bjias.com bjicpark.com bjicrm.com bjidc.net @@ -16377,7 +16261,6 @@ bjkswy.com bjktaz.com bjktwe.com bjkxgroup.com -bjkzcs.com bjl777.com bjlacc.com bjlangbo.com @@ -16424,7 +16307,6 @@ bjnkzx.com bjnsr.com bjnxgbyy.com bjota.com -bjoutai.com bjp321.com bjpag.com bjpcyd.com @@ -16453,7 +16335,6 @@ bjqykc.com bjqzhd.com bjqzzh.net bjraee.com -bjranqigz.com bjrc.com bjrcb.com bjrdhx.com @@ -16481,7 +16362,6 @@ bjsdcm.net bjsdeyy.com bjsdfz.com bjsdgroup.com -bjsdkj.com bjsdr.org bjsfdr.com bjsfrj.com @@ -16607,7 +16487,6 @@ bjxx8.com bjxxw.com bjxyjf.com bjxyjy.com -bjxyzgt.com bjxzlou.com bjxzxw.com bjyah.com @@ -16654,7 +16533,6 @@ bjzgh.org bjzgh12351.org bjzghd.com bjzhaxikj.net -bjzhcc.com bjzhiborui.com bjzhishi.com bjzhongyi.com @@ -16693,6 +16571,7 @@ bjzzdb.com bjzzrx.com bjzzschool.com bk-cdn.com +bk-cdn01.com bk3r.com bk41.net bk5u.com @@ -16721,7 +16600,6 @@ bkpcn.com bkqq.com bkrgame.com bkscc.com -bkt123.com bktencent.com bktsj.com bkuax.com @@ -16744,7 +16622,6 @@ blackshow.me blackswancake.com blackxl.org blakat.cc -blastracshotblastmachines.com blazefire.com blazefire.net blazor.zone @@ -16787,7 +16664,6 @@ bllzgqbyp.com blm.net blmpb.com bln8.com -blnovel.com blockchain.hk blockchain123.com blockchainlabs.org @@ -16890,7 +16766,6 @@ blueskystudy.com blueskyxn.com blueslc.tech bluesoleil.com -bluestar-pc.com bluestep.cc bluetime.com bluetowngroup.com @@ -16966,7 +16841,6 @@ bmtrip.com bmw8033.com bmwallpaper.com bmwnc.com -bmwsteelart.com bmxinfang.com bmzxw.com bn21.com @@ -17101,7 +16975,6 @@ bohailife.net bohaishibei.com bohaisports.com bohaiyun.com -bohanzhubao.com bohaoclub.com bohe.com bohejiasuqi.com @@ -17211,7 +17084,6 @@ booea.com booen.co booeoo.com boohee.com -book-os.com book118.com book1993.com bookabc.net @@ -17428,9 +17300,7 @@ bpteach.com bpxxfw.com bpxxvo.com bq04.com -bqatj.com bqfy.com -bqg3.com bqg8.cc bqg8.la bqgwap.com @@ -17545,7 +17415,6 @@ bs2005.com bsagit.com bsbgjj.com bsbkjt.com -bsbxyy.com bsbydd.com bscabank.com bsccdn.com @@ -17675,7 +17544,6 @@ btdog.com btdos.com btdy.com btechina.com -btedu.net btei6pis99.com btgame.com btgcjs.com @@ -17758,7 +17626,6 @@ bucuoba.com budao.com budao24.com budarts.com -budget-backpackers.com budhano.com budiankj.com budikeji.com @@ -17860,7 +17727,6 @@ buxiugangban.net buy-bar.com buy-copi888.com buy-copys888.com -buy-ics.com buy0596.com buyanshufa.com buyaocha.com @@ -18228,7 +18094,6 @@ bzd6688.com bzddrive.com bzfar.com bzfpms.com -bzfscl.com bzfwq.com bzfwy.com bzfwzs.com @@ -18266,11 +18131,9 @@ bzszyy123.com bzt120.com bztdxxl.com bzvtc.com -bzw315.com bzwater.com bzwz.com bzwzw.com -bzx1688.com bzxinwen.com bzxz.net bzxzk.net @@ -18287,7 +18150,6 @@ c-canyin.com c-china.com c-cpp.com c-ctrip.com -c-deepblue.com c-discover.com c-estbon.com c-fehong.com @@ -18423,7 +18285,6 @@ cad8.net cad888.com cada.cc caddcc.com -cadeer.net cadenzayueqi.com cadforex.com cadict.net @@ -18443,7 +18304,6 @@ caeri-te.com caes.store caexpo.com caexpo.org -caf-china.com cafachine.com cafagame.com cafamuseum.org @@ -18565,7 +18425,6 @@ caipiaogu.com caipintu.com caipopo.com caipucaipu.com -caipucn.com caiqizhe.com cairenhui.com cairongquan.com @@ -18586,6 +18445,7 @@ caitun.com caituyou.com caiu8.com caiweiming.com +caiwennews.com caiwu51.com caiwuchina.com caixin.com @@ -18607,7 +18467,6 @@ caizhihr.com caj11.com cake400.com cake6.com -calab88.com calawei.com calb-tech.com calccn.com @@ -18692,7 +18551,6 @@ cang.com cangdu.org cangfengzhe.com canghaimachine.com -cangjiaohui.com canglanghospital.com cangmang.xyz cangoonline.com @@ -18805,7 +18663,6 @@ capjoy.com cappdr.org capsuleshanghai.com captain-cro.com -capture7.com capturetheflag.fun capvision.com capwhale.com @@ -18974,7 +18831,6 @@ catweiqi.com catyun.cc caua1988.com caua99.com -caufuyu.com caup.net caupd.com caupdbj.com @@ -19063,7 +18919,6 @@ cc-uavia.com cc.co cc0808.com cc11bh.com -cc128.com cc1588.com cc55k.com cc707.com @@ -19143,7 +18998,6 @@ cccwaf.com cccwww.com cccyun.cc ccd86.com -ccdby.com ccdma.org ccdol.com cce-china.com @@ -19185,7 +19039,6 @@ cchaosheng.com cchc-hyd.com cchccc.com cchcch.com -cchckj.com cchengr.com cchezhan.com cchfound.org @@ -19234,6 +19087,7 @@ ccit360.com ccita.net ccitimes.com cciup.com +ccj88.com ccjec.com ccjhdljs.com ccjkwjjedu.com @@ -19250,6 +19104,7 @@ cckefu1.com cckefu3.com cckggroup.com ccknbc.cc +cckyedu.com cclawer.com cclawnet.com cclbook.com @@ -19291,6 +19146,7 @@ ccnt.com ccoalnews.com ccoaonline.com ccoco.vip +ccode.cc ccoi.ren cconn.cc ccoop.net @@ -19348,6 +19204,7 @@ ccqtgb.com ccqtm.com ccqyj.com ccrate.cc +ccrc.com ccrfmed.com ccrgt.com ccrice.com @@ -19433,6 +19290,7 @@ ccutu.com ccv160.com ccv168.com ccview.net +ccvui.com ccwcw.com ccwcyw.com ccwifi.cc @@ -19523,7 +19381,6 @@ cdchuandong.com cdcitypark.com cdcoslm.com cdcxhl.com -cdcxsd.com cdcyts.com cddayun.com cddc56.com @@ -19625,6 +19482,7 @@ cdmaria.com cdmcaac.com cdmddyf.com cdmfund.org +cdmgiml.com cdmhwh.com cdmjwater.com cdmmlxs.com @@ -19654,6 +19512,7 @@ cdn.show cdn.vin cdn.zampdsp.com cdn08.com +cdn1.vip cdn1008.com cdn1218.com cdn16.com @@ -19674,6 +19533,7 @@ cdn50.com cdn56.com cdn60.com cdn778.com +cdn86.com cdn86.net cdn90.com cdn90.net @@ -19701,6 +19561,7 @@ cdnddd.net cdndm.com cdndm5.com cdndm5.net +cdndns.vip cdndns1.com cdndns2.com cdndns2.net @@ -19866,7 +19727,6 @@ cdsxlc.com cdt-ec.com cdt-md.com cdt-re.com -cdtaishan.com cdtianda.com cdtkdw.com cdtlev.com @@ -19891,20 +19751,17 @@ cdyee.com cdyestar.com cdyfy.com cdygdq.com -cdyishi.com cdyj56.com cdylzx.net cdynt.com cdyou.net cdyrjygs.com cdysxx.com -cdysxxe.com cdysxy.com cdyushun.com cdyywz.com cdyzhotel.com cdzdgw.com -cdzdhx.com cdzgh.com cdzgzs.com cdzhsj.com @@ -20097,7 +19954,6 @@ ceppea.net ceppedu.com ceprei.com ceprei.org -ceprintdesign.com cer.net ceracdn.net ceradir.com @@ -20276,7 +20132,6 @@ cgke.com cgkjvip.com cgksw.com cgktudr.xyz -cgllt.com cglw.com cglzw.net cgmama.com @@ -20646,7 +20501,6 @@ charmdeer.com charmingglobe.com charmkeytextile.com charmsunfund.com -charsesdneyse.com chartboost-china.com chaseyanyu.net chashebao.com @@ -20671,6 +20525,7 @@ chaxinyu.net chaxun.biz chaxunchina.com chaxunfapiao.com +chaxunjiao.com chayanfamily.com chayangge.com chaye.com @@ -20693,7 +20548,6 @@ chbpp.com chce-expo.com chcedo.com chceg.com -chcihe.com chcmu.com chcnav.com chcoin.com @@ -20844,6 +20698,7 @@ cheng-sen.com cheng.xin chengaizixun.com chengan-web.com +chengan.tech chengbanggroup.com chengcai.net chengchuanren.com @@ -20921,7 +20776,6 @@ chengxiangqian.com chengxiangzhineng.com chengxiaoliu.com chengxingjicj.com -chengxinlinghang.com chengxinyouxuan.com chengxuan.com chengyangyang.com @@ -20931,7 +20785,6 @@ chengyouyun.com chengyuanwenquan.com chengyucidian.net chengyun.com -chengyushangba.com chengyuwan.com chengyuwb.com chengyuxi.com @@ -20993,9 +20846,9 @@ chenyifaer67373.com chenyistyle.com chenyongqi.com chenyou123.com +chenyu.me chenyudong.com chenyuemz.com -chenyuzw.com chenyyds.com chenzao.com chenzhicheng.com @@ -21038,6 +20891,7 @@ chetxia.com chetxt.com chevip.com chevlen.com +cheweiguanjia.com chewen.com chewulin.com chexian9.com @@ -21106,7 +20960,6 @@ chiefmore.com chiefpharma.com chieftin.org chietom.com -chifeikeji.com chihao.com chihe.so chihealbio.com @@ -21122,7 +20975,6 @@ childrentheatre.org chileaf.com chili3d.com chillyroom.com -chiluyingxiao.com chilwee.com chimbusco.com chimelong.com @@ -21245,7 +21097,6 @@ china-hxzb.com china-hzd.com china-iace.com china-ida.com -china-indium.com china-inse.com china-invests.net china-ipif.com @@ -21344,7 +21195,6 @@ china-tje.com china-tongyu.com china-topplus.com china-tops.com -china-touch.com china-tower.com china-toy-edu.org china-toy-expo.com @@ -21458,7 +21308,6 @@ chinabancai.com chinabaoan.com chinabaogao.com chinabaokan.com -chinabaoke.net chinabashan.com chinabattery.org chinabbtravel.com @@ -21570,7 +21419,6 @@ chinacosco.com chinacourt.org chinacpda.com chinacpda.org -chinacpx.com chinacqme.com chinacqpgx.com chinacqsb.com @@ -21862,7 +21710,6 @@ chinakingo.com chinakinzo.com chinaklb.com chinakong.com -chinakongzi.net chinakongzi.org chinakqn.com chinakshx.com @@ -21885,7 +21732,6 @@ chinalawyeryn.com chinaleather.com chinaleather.org chinaledger.com -chinaleeper.com chinalep.org chinalibs.net chinalicensing.org @@ -21900,7 +21746,6 @@ chinalive.com chinaliyou.com chinalm.org chinalonghu.com -chinalongshu.com chinalowcarb.com chinalpharm.com chinalsjt.com @@ -21999,14 +21844,12 @@ chinapbw.com chinapcd.com chinape168.com chinapearlk.com -chinapeelingmachine.com chinapeier.com chinapelletizer.com chinapeople.com chinapet.com chinapet.net chinapharm.net -chinaphotar.com chinaphper.com chinapilotage.org chinapipe.net @@ -22053,7 +21896,6 @@ chinarenzhi.com chinaresin.com chinarespiratory.org chinarjw.com -chinarootdesign.com chinarta.com chinartlaw.com chinaruiji.com @@ -22080,7 +21922,6 @@ chinaseed114.com chinasexq.com chinasg.com chinashadt.com -chinashaodong.com chinashenglu.com chinashengmao.com chinashj.com @@ -22665,7 +22506,6 @@ chuangyebaba.com chuangyehai.com chuangyejia.com chuangyetv.com -chuangyichong.com chuangyijisu.com chuangyimao.com chuangyiqifu.com @@ -22710,7 +22550,6 @@ chuban.cc chubanyun.me chubaodai.com chubaohui.com -chubh.com chucheng.wiki chuchujie.com chuchujue.com @@ -22718,7 +22557,6 @@ chuchur.com chufaba.me chufw.com chuge8.com -chugeyun.com chugou360.com chuguo78.com chuguohao.com @@ -23102,7 +22940,6 @@ ciwork.net cixcomputing.com cixibank.com cixiedu.net -cixiucn.com cixtech.com cixuanfuw.com ciyagroup.com @@ -23133,7 +22970,6 @@ cjdcw.com cjdg.com cjdropshipping.com cjdsp.com -cjdx1.com cjeduw.com cjftb.com cjhospital.com @@ -23268,7 +23104,6 @@ cl-power.com cl0438.com cl0579.com cl2009.com -cl8239.com cl868.com clady.cc clam-itc.com @@ -23293,13 +23128,11 @@ clawchat.com clayidols.com clb6.net clboss.com -clbpay.com clbu.club clbug.com clbz666.com clcgq.com clcindex.com -clckblog.space clclibrary.com clcoolyun.com clcwwyj.com @@ -23366,7 +23199,6 @@ cloopen.com cloopen.net cloopm.com closertb.site -clotfun.xyz clothes178.com clothjob.com clothr.com @@ -23483,13 +23315,13 @@ cloudjining.com cloudjiujiang.com cloudkirin.com cloudkunming.com -cloudleft.com cloudleshan.com cloudlijiang.com cloudlishui.com cloudluohe.com cloudluoyang.com cloudlvs.com +cloudmaster.hk cloudmeishan.com cloudmes.io cloudminds.com @@ -23600,7 +23432,6 @@ clxlb.com clxsbj.com clxsczx.com clyiyuan.com -clyric.com clz.me clzd.com clzd.fun @@ -23627,7 +23458,6 @@ cmanuf.com cmastd.com cmb-leasing.com cmbajia.com -cmbbao.com cmbchina.biz cmbchina.com cmbchina.net @@ -23724,6 +23554,7 @@ cmltzz.com cmmaap.com cmmchn.com cmmim.com +cmnetech.com cmnxt.com cmo2o.com cmoc.com @@ -23797,7 +23628,6 @@ cn-comfort.com cn-cr.com cn-east-2.myhuaweicloud.com cn-east-3.myhuaweicloud.com -cn-ebara.com cn-elite.com cn-em.com cn-ferment.com @@ -23860,6 +23690,7 @@ cn.bing.net cn.download.nvidia.com cn.mm.bing.net cn.net +cn.online.standardchartered.com cn.pool.ntp.org cn.vc cn.widevine.com @@ -23949,7 +23780,6 @@ cnbeinuo.com cnbeta.com cnbetacdn.com cnbfjt.com -cnbhd.xyz cnbian.com cnbidding.com cnbio.net @@ -24166,7 +23996,6 @@ cnfish.com cnfisher.com cnfjwz.com cnfla.com -cnflcy.com cnflyinghorse.com cnfol.com cnfolimg.com @@ -24425,7 +24254,6 @@ cnmcl.net cnmdy.com cnmec.biz cnmeiwei.com -cnmetalarts.com cnmf.net cnmhg.com cnmia.org @@ -24679,7 +24507,6 @@ cnthinkers.com cntjq.net cntle.com cntlfs.com -cntlxd.com cntofu.com cntopgear.com cntoplead.com @@ -24704,7 +24531,6 @@ cnur.com cnuschool.org cnutcon.com cnuuu.com -cnv168.com cnvcs.com cnvf.com cnvfq.com @@ -24727,7 +24553,6 @@ cnweiming.com cnweisou.com cnwenshi.net cnwest.com -cnwgps.com cnwhc.com cnwindows.com cnwinenews.com @@ -24928,7 +24753,6 @@ codesdq.com codesocang.com codesoft.hk codess.cc -codetc.com codewd.com codeweblog.com codewoody.com @@ -25005,7 +24829,6 @@ coinsky.com coinvs.com coinyue.com coirliner.com -cojrvjp.com cokll.com cokutau.com colahotpot.com @@ -25053,6 +24876,7 @@ combiosz.com combocn.com combofin.com combomen.com +combosm.com combpm.com combss.com comdeep.com @@ -25062,7 +24886,6 @@ comebt.com comefilm.com comeken.com comeorg.com -comercn.com comestuff.com comet.cc cometagame.com @@ -25133,6 +24956,7 @@ congmiqq.com congrongfund.com congtoo.com congtoukaishi.com +congwuku.com congyicn.com congzao.com congzhi.com @@ -25556,7 +25380,6 @@ cqcsskyy.com cqcy.com cqcyhuagong.com cqcyxyxh.com -cqcyyjy.com cqczx.com cqdahan.com cqdai.com @@ -26120,7 +25943,6 @@ cqzgzdh.com cqzhihaolaw.com cqzhongxingyuan.com cqzhqyjt.com -cqzhsw.com cqzikao.com cqzike.com cqzk.net @@ -26208,7 +26030,6 @@ crct.com crctrust.com crdyf.com cre.net -cre021.com cread.com creality.com crealitycloud.com @@ -26332,7 +26153,6 @@ crsc.cc crscm.com crsky.com crsn168.com -crsyjt.com crtc-hr.com crtdri.com crtg.com @@ -26397,7 +26217,6 @@ cscdf.org cscec.com cscec1b-bj.com cscec1b.net -cscec5b3.com cscec7b.com cscec81.com cscec8bud.com @@ -26522,7 +26341,6 @@ csluye.com cslxzx.com cslyrc.com csmadik.com -csmaliya.com csmall.com csmama.net csmar.com @@ -26633,8 +26451,6 @@ cswamp.com cswef.org csweigou.com csweiwei.com -cswf888.com -cswfgg.com cswqvzh.com cswszy.com csxbank.com @@ -26800,7 +26616,6 @@ ctoclub.com ctongonline.com ctoutiao.com ctpdd.com -ctqcw.com ctracer.net ctrcw.net ctrip-ttd.hk @@ -26819,7 +26634,6 @@ ctripgslb.net ctripins.com ctripqa.com ctripteam.com -ctrlqq.com cts010.com ctsbw.com ctsec.com @@ -26991,6 +26805,7 @@ cvtoutiao.com cvtvcn.com cwag.com cwbaike.com +cwbgp.space cwbpsi.com cwcec.com cwddd.com @@ -27124,7 +26939,6 @@ cxyxwl.com cxyyls.com cxyym.com cxz.com -cxz3d.com cxzg.com cxzntc.com cxzuqiu.com @@ -27277,7 +27091,6 @@ cyzs97.com cyzwb.com cyzywl.com cyzzzz.com -cz-huachang.com cz-toshiba.com cz-yk.com cz121.com @@ -27287,7 +27100,6 @@ cz89.com czb365.com czbanbantong.com czbank.com -czbanker.com czbcpaint.com czbq.net czbsfx.com @@ -27602,7 +27414,6 @@ dadiwang.com dadiyimao.com dadongwu.com dadou.com -dadunet.com daduoduo.com daduofa.com dadushixiecheng.com @@ -27972,7 +27783,6 @@ dantuvc.com danxia.com danxin.net danyang.com -danyantrade.com danzhaoedu.com danzhaowang.com danzhou8.com @@ -28147,7 +27957,6 @@ datahubtrack.com datahuif.com dataie.com dataing.com -datalearner.com datang.com datang.net datangnxp.com @@ -28186,7 +27995,6 @@ datk.anythinktech.com datongjianshe.com datongtaxi.com datuc.com -datwy.com daugres.com dauteen.com dav01.com @@ -28387,7 +28195,6 @@ dbkan.com dbkuaizi.com dblgf.com dbljj.com -dbm-sh.com dbmailserver.com dbmaiyan7.com dbmall.com @@ -28581,7 +28388,6 @@ ddyjapp.com ddyqh.com ddyun.com ddyun123.com -ddyvip.com ddyylczz.com ddyylczzs.com ddz.com @@ -28662,7 +28468,6 @@ deehon.com deemos.com deep-os.com deep56.com -deepbluenetwork.com deepcloudsdp.com deepcoin.red deepcool.com @@ -28720,7 +28525,6 @@ dehongtech.com dehsm.com dehua.net dehuaca.com -dehuichaoshi.com dehuigroup.com dehuisk.com dehuiyuan.com @@ -28986,7 +28790,6 @@ dfcx-bj.com dfdaily.com dfdd-toubiaole.com dfdinsin.com -dfdjy.net dfdtt.com dfedu.com dfev.net @@ -29079,6 +28882,7 @@ dgaiia.com dgbaineng.com dgbgw.com dgbia.com +dgbyxny.com dgcct.com dgchenghe.com dgcia.com @@ -29161,7 +28965,6 @@ dgt-factory.com dgtianbao.xin dgtle.com dgtn1718.org -dgtowin.com dgtpcj.com dgtungwah.com dgtuoyue.com @@ -29248,7 +29051,6 @@ dhrcbank.com dhrest.com dhrest2.com dhs-sports.com -dhsky.org dhsrmyy.com dhszyy.net dht5867.com @@ -29629,7 +29431,6 @@ dingdiange.org dingdiann.com dingdiann.net dingdiansk.com -dingdianxs.com dingdianxs.la dingdianzw.com dingding.com @@ -29726,7 +29527,6 @@ dious-f.com dipephoto.com dipont.com dippstar.com -diqi.sh diqiuw.com diqua.com dir001.com @@ -29760,7 +29560,6 @@ ditan.com ditan360.com ditian-tech.com ditianshanhe.com -ditiee.com ditiefuli.com ditiezu.com ditiezu.net @@ -29932,7 +29731,6 @@ dkjiaoyang.com dkjmy.com dkjmyq.com dklogs.net -dkmbn.com dkmol.net dkntgc.com dksgames.com @@ -30033,7 +29831,6 @@ dlvalve.com dlw-lighting.com dlw360.com dlw666.com -dlwanbao.com dlwang.vip dlwjdh.com dlwmkj.com @@ -30043,7 +29840,6 @@ dlxk.com dlxmicro.com dlxww.com dly56.com -dlyiliang.com dlyy365.com dlzb.com dlzbxx.com @@ -30119,6 +29915,7 @@ dmu-1.com dmvideo.mobi dmvideo.net dmvideo.org +dmvvv.com dmxs.net dmyouxi.com dmyy.cc @@ -30126,7 +29923,6 @@ dmzfa.com dmzgame.com dmzj.com dmzlcn.com -dmzlpf.com dmzx.com dmzzbjb.net dmzzkz.com @@ -30203,7 +29999,6 @@ dnsfamily.com dnsfast.online dnsff.com dnsfox.net -dnsfwq.com dnsgtm.com dnsguest.com dnsgulf.net @@ -30228,7 +30023,6 @@ dnsoray.net dnsour.com dnspai.com dnspig.com -dnsplus.co dnspod.com dnspod.mobi dnspod.net @@ -30333,8 +30127,6 @@ dodo.link dodo8.com dodobook.net dodoca.com -dodocha.com -dododv.com dodoeasy.com dodoedu.com dodoh5.com @@ -30399,7 +30191,6 @@ dom-3d.net domabio.com domaingz.com domaintescil.com -domengle.com domesticmedia.cc domesticmedia.co domesticmedia.com @@ -30482,6 +30273,7 @@ dongfeng.net dongfengem.com dongfengtc.com dongfengtrucks.com +dongfou.com dongfund.com donggaoshiye.com dongge.com @@ -30619,7 +30411,6 @@ doorzo.app doorzo.net doosunggroup.com doov5g.com -doowinfintec.com dooya.com dopic.net dopo-online.net @@ -30730,12 +30521,12 @@ doumi.com doumiip.com doumistatic.com doumobsix.site -dounanhuahua.com douniwan.org doupai.cc doupay.com doupocangqiong1.com douqi.com +douqq.com doushen.com doushisan.com dousonvalve.com @@ -30996,6 +30787,7 @@ driverchina.com driverdevelop.com drivergenius.com driverzeng.com +driverzj.com drivethelife.com drjou.cc drjy6688.com @@ -31144,7 +30936,6 @@ dtnews.net dtrcb.com dtrcw.net dts007.com -dtsmndu.com dtssyy.com dtstack.com dtstatic.com @@ -31154,7 +30945,6 @@ dttt.net dtuosh.com dtuyun.com dtwave.com -dtxmw.com dtxn.net dtxww.com dtxxjq.com @@ -31254,7 +31044,6 @@ duiyou360.com duiz.net duizhuang.com dujiabieshu.com -dujiaoshou.org dujin.org dujixiao.com dujiza.com @@ -31297,13 +31086,11 @@ dunhuang.com dunhuangtour.com dunjiaodu.com dunkhome.com -dunkun.com dunstanhardcastle.com dunsuan.com dunwang.com dunzhiwang.com duoao.com -duobei.com duobeiyun.net duobiyi.com duocaipaint.com @@ -31529,7 +31316,6 @@ dwidc.com dwinput.com dwion.com dwjkgl.com -dwjoy.com dwjpwf.com dwjxz.com dwmoniqi.com @@ -31565,12 +31351,14 @@ dxdlw.com dxe520.com dxecs.com dxf6.com +dxfbk.com dxfblog.com dxgg.co dxguanxian.org dxhuafu.net dxinzf.com dxjs.com +dxjt2013.com dxlfile.com dxm-cdn.com dxm-int.com @@ -31792,7 +31580,6 @@ dzfang.com dzfc.com dzfjsm.com dzfwjd.com -dzfxh.com dzglsb.net dzgxq.com dzh.link @@ -31907,6 +31694,7 @@ e-kays.com e-length.com e-lining.com e-mallchina.com +e-map.ne.jp e-nci.com e-nebula.com e-net.hk @@ -31950,7 +31738,6 @@ e22a.com e23dns.net e24c.com e253.com -e28ac.com e2capp.com e2edesign.com e2esoft.com @@ -32092,7 +31879,6 @@ eastforever.com eastftp.net eastfu.com easthc.com -easthideschina.com easthome.com eastib.com easticloud.com @@ -32156,7 +31942,6 @@ easygovm.com easyhaitao.com easyhin.com easyidc.com -easylaa.com easylabplus.com easyliao.net easylinkin.com @@ -32326,7 +32111,6 @@ echinacities.com echinagov.com echinatobacco.com echo-isoftstone.com -echo.cool echo188.com echoing.tech echoteen.com @@ -32582,7 +32366,6 @@ ee-nav.com ee123.net ee1234.com ee68.com -ee77777.com ee99.net eeban.com eebbk.com @@ -32644,7 +32427,6 @@ eevision.com eeworld.com eeworm.com eexiaoshuo.com -eexing.com eeyd.com eeyxs.com eeyys.com @@ -32661,7 +32443,6 @@ efashionchina.com efashioncloud.com efchina.org efe.cc -efengji.org efengqing.com efesco.com eff-soft.com @@ -32818,9 +32599,7 @@ einkcn.com einsteintiles.com eintone.com eiot.com -eismowe.com eisoo.com -ej-travel.com ejamad.com ejc56.com ejcms.com @@ -32938,7 +32717,6 @@ elianmeng.vip eliansy.com elianwiz.com elicht.com -elichtmedia.com elikeme.com elikeme.net elimautism.org @@ -33005,7 +32783,6 @@ emao.net emaozi.com emapgis.com emas-poc.com -emasmr.com ematong.com emaup.com emax.cc @@ -33020,7 +32797,6 @@ embedu.org embedunion.com embedway.com embest-tech.com -embroidery-patternmaking.com embryform.com embryochina.com embsky.com @@ -33218,7 +32994,6 @@ enuomachinery.net envi-ch.com envisioncn.com enwing-tech.com -enwto.com enxicled.com enyamusical.com enzj.com @@ -33346,7 +33121,6 @@ eqxiu.mobi eqxiul.com eqxiuzhan.com eqyn.com -eqz.cc er07.com er8gmvwi54p5x1.com eraclean.com @@ -33484,7 +33258,6 @@ eshufa.com eshuizong.com eshukan.com eshzp.com -esie-expo.com esilk.net esinidc.com esipark.com @@ -33567,7 +33340,6 @@ et-api.com et-fine.com et001.com et59.com -etagrfid.com etagri.com etang.com etao.com @@ -33591,6 +33363,7 @@ etest8.com eteste.com etf.group etf88.com +etfcjz.com etfiber.net etg56.com ethainan.com @@ -33795,12 +33568,10 @@ evpartner.com evpowergroup.com evqvxuq.com evtcn.com -evtrust.com evv1.com evzhidao.com evzs.com ew-wirestripping.com -ew480.com ew80.com ew80.net ew80yun.com @@ -34051,6 +33822,7 @@ ezcname.com ezcpt.com ezcun.com ezdnscenter.com +ezeeship.com ezeroshop.com ezfuns.com ezhangdan.com @@ -34068,7 +33840,6 @@ ezhun.com ezhupei.com ezindie.com eziot.com -ezitong.com ezjhw.com ezlippi.com ezliushao.com @@ -34122,7 +33893,6 @@ f3322.net f3322.org f3knp1j.xyz f41g.com -f4h90.cyou f526.cc f52o04oylrbmfw.com f537.com @@ -34254,7 +34024,6 @@ famens.com famens.vip famensi.com famicn.com -famige.com family-marathon.com familyincloud.com familykoloro.com @@ -34606,7 +34375,6 @@ fatiao.pro fatieku.com fatier.com fatoan.com -fattireelectricbikefactory.com fatu.cc fatvg.com faussefrance.com @@ -34732,7 +34500,6 @@ fcnes.com fcnode.net fcpawn.com fcpiao.com -fcport.com fcpowerup.com fcqjc.com fcrc114.com @@ -34786,7 +34553,6 @@ fdleckwai.com fdlt.net fdmhmm.com fdooo.com -fdpx.com fdqc.com fdren.com fdrobot.com @@ -34897,6 +34663,7 @@ feigo.fun feihe.com feihe168.com feiheair.com +feihengip.com feihonghb.com feihongtec.com feihu.me @@ -34909,7 +34676,6 @@ feijipan.com feijiu.net feijiuzs.com feijix.com -feijizu.com feijs.com feikework.com feikongbao.com @@ -35010,6 +34776,7 @@ feiyunxiazai.com feiyuteam.com feizan.com feizhaojun.com +feizhiyi.com feizhu.com feizhuke.com feizhupan.com @@ -35108,7 +34875,6 @@ fengli.com fengli.su fengliankeji.com fenglichem.com -fengligroup.com fenglingroup.com fenglinjiu.com fenglinlab.com @@ -35236,7 +35002,6 @@ fevermi.com fevte.com feydj.com feyer-tc.com -ff112222.com ff14.cloud ff54.ink ff63.com @@ -35321,7 +35086,6 @@ fhtlw.com fhtre.com fhwlgs.com fhwzx.com -fhy2008.com fhycedu.com fhycs.com fhyx.com @@ -35454,7 +35218,6 @@ firm-lithium.com first-panel.com first-swg.com firstarpc.com -firstcityfashion.com firstdrs.com firstfood-cn.com firstgw.com @@ -35635,7 +35398,6 @@ fjq.icu fjqfkg.com fjqionghai.com fjqjsw.com -fjrcjc.com fjrclh.com fjrcw.com fjrmyy.com @@ -35766,6 +35528,7 @@ fleetlogd.com fleety.com flexifont.com fleyun.com +flfc5999.com flgame.net flhimalayandn.com fliggy.com @@ -35777,14 +35540,12 @@ flip.fun fliplus.com flirtybag.com flleasing.com -flm-tj.com flmgr.net flml.cc floatingislandapps.com floatmaze.com flockypet.com flomoapp.com -flooc.com floorb2b.com florentiavillage.com flourish-fs.com @@ -35974,6 +35735,7 @@ fofcn.tech fofen.com fofhc.com fofstudio.net +fofuai.com fogcloud.io foguanghui.org fohohr.com @@ -36201,7 +35963,6 @@ fqgyljt.com fqhospital.com fqis.xin fqjob.net -fqkf.com fqlook.com fqnovel-op.com fqnovel.com @@ -36229,7 +35990,6 @@ franceqz.com francissoung.com franckfw.com francochinois.com -frank-china.com frankenman.group frankyrobot.com franzsandner.com @@ -36416,7 +36176,6 @@ fsdaton.com fsdxzhpt.com fsecity.com fseig.com -fsemouse.com fseport.com fsesa.com fsfsfz.com @@ -36463,7 +36222,6 @@ fsmama.com fsmcled.com fsmeeting.com fsmi818.com -fsnewage.com fsoet.com fsohu.com fsoptronics.com @@ -36497,17 +36255,16 @@ fswchina.com fswk.com fsxchina.com fsxinquan.com -fsxshjz.com fsxsj.net fsxzygz.com fsy6.com -fsyage.com fsyanhe.com fsygroup.com fsyhlz.com fsylr.com fsyq.net fsysyy.com +fsytss.com fsyule.net fsyuncai.com fsyxg.com @@ -36520,7 +36277,6 @@ ft.tech ft12.com ft22.com ft3e.com -ft77.com ft98.com fta.dell.com ftaapj.dell.com @@ -36621,7 +36377,6 @@ fuhai360.com fuhaikj.com fuhancapital.com fuhanziben.com -fuhaodaquan.org fuhaoku.com fuhefu.com fuheng.org @@ -36655,10 +36410,10 @@ fuliansheng.com fuliao.com fuliaotech.com fuliba.com +fulicat.com fulimin.org fulin.org fuling.com -fulingwx.com fulinpm.com fulinsujiao.com fulinxiuxian.com @@ -36750,7 +36505,6 @@ furderdriving.com furenchina.com furenkeji.com furielec.com -furniture-channel.com furongedu.com furrychina.com furuijiaju.vip @@ -36804,7 +36558,6 @@ fuwucms.com fuwuqinet.com fuwuqu.com fuxila.com -fuxin-sh.com fuxinbank.com fuxinews.com fuxinghf.com @@ -37114,6 +36867,7 @@ fzthinking.com fzwater.com fzwcn.com fzwhzn.com +fzwqq.com fzwtqx.com fzwtxx.com fzwxxcx.com @@ -37344,7 +37098,6 @@ gamewifi.net gamexdd.com gamexhb.com gamexun.com -gameyc.com gameyiming.com gameyisi.com gameyj.com @@ -37366,7 +37119,6 @@ gangguan8.com gangguana.com ganghaowang.com gangjiajieli.com -ganglongline.com gangpaibao.com gangqinpu.com gangqinxiansheng.com @@ -37467,6 +37219,7 @@ gaohaipeng.com gaohangip.com gaoheconsult.com gaohr.com +gaohuasec.com gaoimg.com gaojer.com gaoji.ren @@ -37475,6 +37228,7 @@ gaojihealth.com gaojima.com gaojipro.com gaojitui.com +gaojiua.com gaokao.com gaokao365.com gaokao789.com @@ -37544,7 +37298,6 @@ gaoxincarbon.com gaoxinedu.com gaoxinedu.net gaoxinjy.com -gaoxinkc.com gaoxitech.com gaoyawang.com gaoyizaixian.com @@ -37589,7 +37342,6 @@ gastronomy.gov.mo gaszx.com gate-dhgames.com gateface.com -gatewang.com gateweb3.cc gateweb3.io gather-dns.com @@ -37649,7 +37401,6 @@ gc39.com gc73.com gc91.com gcable.tv -gcademy.net gccdn.net gccgz.com gcchina.com @@ -37770,17 +37521,14 @@ gdbita.com gdbljd.com gdbmh.com gdbsjd.com -gdbyhtl.net gdbzkz.com gdbzkz.org gdcaa.com gdcaia.com -gdcamis.com gdcaward.com gdcayyebh.com gdccaa.com gdcci.com -gdcct.com gdccus.org gdcdsh.com gdceg.com @@ -38026,7 +37774,6 @@ gdpdd.com gdpengquan.com gdpia.com gdpingzheng.com -gdpntv.com gdprm.com gdprm.net gdpysc.com @@ -38185,7 +37932,6 @@ gdxsn.com gdxueyin.com gdxy.vip gdxych.com -gdxycy.com gdybkjjt.com gdyd.com gdydgj.com @@ -38253,7 +37999,6 @@ gdzzjc.com gdzzw.net gdzzz.com ge-garden.net -ge-stralen.com ge100.com ge3rge43r6.com geality.com @@ -38377,7 +38122,6 @@ geiniwan.com geisnic.com geizan.cc gelaha.com -gelgcn.com gelicang.net gelics.com geline.net @@ -38403,7 +38147,6 @@ gemled-tech.com gempharmatech.com gempoll.com gemuedu.com -genban.org genchim.com gendan5.com gendantong.com @@ -39108,7 +38851,6 @@ ghed119.com ghedu.com ghgglobal.com ghglzx.com -ghgo.xyz ghgy.com ghhyjc.com ghibliwiki.org @@ -39139,7 +38881,6 @@ ghostwin7win8.com ghostxp2.com ghostxpsp3.net ghostxx.com -ghp.ci ghparking.com ghpepower.com ghproxy.com @@ -39154,7 +38895,6 @@ ghsd16888.com ghsense.com ghsmc.com ghsmpwalmart.com -ghsuliao.com ght-china.com ght120.com ghtech.com @@ -39239,7 +38979,6 @@ giordano.com giorgiomorandihotels.com giraff3.com girdear.net -girigirilove.com girl13.com girls-frontline.com girlsfighters.com @@ -39312,6 +39051,7 @@ gjsc.info gjsj.com gjsun.com gjtmu.com +gjtool.com gjtt.net gjw.com gjw123.com @@ -39343,7 +39083,6 @@ gkgdsw.com gkgzj.com gkhxtc.com gki88.com -gkjfq.com gkjzy.com gkket.com gkkxd.com @@ -39356,7 +39095,6 @@ gkmwb.com gkong.com gkoo.net gkoudai.com -gkpass.com gkqcw.com gkrpgtee.com gkshanghai.com @@ -39431,7 +39169,6 @@ glclcsy.com glcszy.com gldaewoo.com gldjc.com -gldxjc.com gleasy.com glecan.com glelec.com @@ -39595,13 +39332,13 @@ glowapp.fun glowapp.vip glpenhui.com glplyf.com -glqcxh.com glqh.com glqshb.com glquanji.com glrcjob.com glrcw.com glreading.com +glredu.com glriverside.com glrmyy.com glruixin.com @@ -39700,7 +39437,6 @@ gmaxbiopharm.com gmbbs.net gmbuluo.com gmcc.net -gmcchina.net gmcinnov.com gmcmonline.com gmdeng.com @@ -39747,7 +39483,6 @@ gmsyun.com gmt-china.org gmt-cn.com gmtacoa.com -gmtgx.com gmtv.cc gmtzy.com gmugmu.com @@ -40031,7 +39766,6 @@ gongpingjia.com gongqiu.biz gongshang120.com gongshiku.com -gongsi.gs gongsibao.com gongsijiaoyi.com gongsizhang.com @@ -40142,8 +39876,8 @@ goodwillresource.com goodwyee.com goodyoungtea.com goodzuji.com -goodzuo.com goofish.com +googoc.com googol-power.com googolpark.com googvv.com @@ -40324,7 +40058,6 @@ gpmycez.com gpnewtech.com gpowersoft.com gppapp.com -gppdt.com gpqnrc.com gps009.net gps123.org @@ -40338,6 +40071,7 @@ gpsoo.net gpspw.net gpsrcw.com gpsspg.com +gpstool.com gpsuu.com gpszlsc.com gpticket.org @@ -40419,7 +40153,6 @@ grass98.com grassmoon.net graueneko.xyz gravity-engine.com -gray-ice.com grcbank.com grchina.com grcwzx.com @@ -40443,7 +40176,6 @@ greatssp.com greatstargroup.com greatstartools.com greatwallmusic.com -greatwallqd.com greatwuyi.com gredmedic.com gree-jd.com @@ -40461,7 +40193,6 @@ greencharm.com greenchengjian.com greencompute.org greendh.com -greenhua.com greenism.net greenits.net greenjk.com @@ -40575,6 +40306,7 @@ gsdpw.com gsdswz.com gsdtfx.com gsdyjsgs.com +gseen.com gsensebot.com gsfilter.net gsflcp.com @@ -40596,7 +40328,6 @@ gsi24.com gsicpa.net gsidy.com gsjb.com -gsjie.com gsjkjt.com gsjqtv.com gsjt-cn.com @@ -40612,8 +40343,6 @@ gslbdns.com gslbdns.net gslmw.net gslnjyjt.com -gslsj.com -gsmgw.com gsmpers.com gsmuban.com gsmxjy.com @@ -40940,10 +40669,7 @@ guangxilonghua.com guangximinhang.com guangxinengyuan.com guangxipubeihuaheng.com -guangxiqimei.com -guangxiqingrun.com guangxircw.com -guangxisanhe.com guangxishangfu.com guangxishuizhiyangzhigongsi.com guangxisichujiadao.com @@ -41139,7 +40865,6 @@ guimengning.com guimengshangeng.com guinsoft.com guipeibao.com -guipeng168.com guipin.com guiqingkeji.com guiququ.com @@ -41207,7 +40932,6 @@ gumpmall.com gundambattle.com gunshitech.com gunsuo.com -gunxueqiu.com guo-kai.com guo68.com guo7.com @@ -41377,9 +41101,7 @@ guozhangroup.com guozhanjiaoyu.com guozhen.net guozhenyi.com -guozhijun.com guozhivip.com -guozhoutrade.com guozhuan.com guozhuangxincai.com guozi.org @@ -41418,7 +41140,6 @@ gushiwen.org gushufang.com gusspro.com gusucaishui.com -gususoft.com gusuwang.com guteke.com gutlighting.com @@ -41526,7 +41247,6 @@ gx-lc.com gx-newmedia.com gx-royalpartners.com gx-stbd.com -gx-vlink.com gx-wl.com gx-xc.com gx-xjyx.com @@ -41848,7 +41568,6 @@ gxfcq.com gxfcw.com gxfengjie.com gxfenglei.com -gxfengsu.com gxfengxiang.com gxfengxingjq.com gxffjt.com @@ -41924,7 +41643,6 @@ gxgeek.com gxgentle.com gxgf.net gxgfsh.com -gxgfsj.com gxggcmc.com gxggdq.com gxggfhsmy.com @@ -42062,7 +41780,6 @@ gxhealth.xin gxheda.com gxhefei.com gxheguan.com -gxhejia.com gxhengda.com gxheyumaoyi.com gxhezhixin.com @@ -42605,7 +42322,6 @@ gxmiao.com gxmiaoshu.com gxminglian.com gxmingshi.com -gxmingyun.com gxmj.org gxmjyy.com gxmjzs.com @@ -42770,7 +42486,6 @@ gxqiyuan.com gxqkcm.com gxqljt.com gxqllc.com -gxqlled.com gxqlt.com gxqmk.com gxqnjc.com @@ -42866,7 +42581,6 @@ gxscsw.com gxscyg.com gxsd.net gxsdem.com -gxsdkj.com gxsdpx.com gxsdy.com gxseal.com @@ -42904,7 +42618,6 @@ gxshjz.com gxshny.com gxshoufeng.com gxshouji.com -gxshrf.com gxshtf.com gxshua.com gxshuairun.com @@ -43025,7 +42738,6 @@ gxtongyin.com gxtongzhu.com gxtopart.com gxtp2021.com -gxtrgs.com gxtrwhy.com gxtskq.com gxtslr.com @@ -43257,7 +42969,6 @@ gxyete.com gxyfck.com gxyfkj.com gxyfm.com -gxyfqxcx.com gxyfxc.com gxyglw.com gxygys.com @@ -43314,7 +43025,6 @@ gxyongzhitai.com gxyos.com gxyoupinzhi.com gxypdc.com -gxypjj.com gxypjy.com gxypnh.com gxyqjc.com @@ -43531,7 +43241,6 @@ gyhht.com gyhimalayanul.com gyhj.org gyhm.cc -gyhsz120.com gyidc.net gyii.com gyip.net @@ -43634,6 +43343,7 @@ gz-notary.com gz-shanguang.com gz-spi.com gz-tencentclb.cloud +gz-tencentclb.com gz-tencentclb.work gz-wx.com gz-xinghe.com @@ -43673,7 +43383,6 @@ gzbl.com gzblssly.com gzboji.com gzbookcenter.com -gzbote.com gzbt020.com gzbus.com gzbxyy120.com @@ -43738,7 +43447,6 @@ gzdqyy.com gzdryy.com gzdsw.com gzdtc.com -gzdtcy168.com gzdtg.com gzduguo.com gzdysx.com @@ -43796,7 +43504,6 @@ gzhakj.com gzhand.com gzhangcha.com gzhatao.com -gzhatu.com gzhbchy.com gzhc365.com gzhclw.com @@ -43986,7 +43693,6 @@ gzpy120.net gzpydlc.com gzpyxz.net gzqbd.com -gzqdedu.com gzqgdg.com gzqiche.com gzqixun-tech.com @@ -44009,6 +43715,7 @@ gzrobot.com gzrobots.com gzrqhyxh.com gzrrj.com +gzrskh.com gzrsksxxw.com gzrtnet.com gzrycl.com @@ -44182,7 +43889,6 @@ gzyiagu.com gzyilongprinting.com gzyitsy.com gzylhyzx.com -gzyocg.com gzyouai.com gzyowin.com gzyqtlxs.com @@ -44313,6 +44019,7 @@ h5taotao.com h5tpl.com h5uc.com h5util.com +h5video.shop h5wap.com h5war.com h5youxi.com @@ -44386,7 +44093,6 @@ haha365.com haha9911.com hahack.com hahaertong.com -hahaha365.com hahait.com hahajing.com hahasou.com @@ -44472,13 +44178,13 @@ haihuishou.com haiintelligent.com haijia.org haijianchuxing.com -haijiangzx.com haijianstock.com haijiaonet.com haijiaoshi.com haijiasu.com haijizq.com haijob.com +haijt.com haijudoc.com haijunda.com haikegroup.com @@ -44642,7 +44348,6 @@ haiwu.com haixiachina.com haixiahuagong.com haixiangkuajing.com -haixianlai.net haixin.com haixin5.com haixindichan.com @@ -44709,6 +44414,7 @@ halsplastics.com haluan2u.com haluoha.com haluolinks.com +halvie.com hamdl.com hamedal.com haminol.com @@ -44747,14 +44453,12 @@ handsfree.work handu.com handuyishe.com handyfriendship.com -hanenyunxiao.com hanergy.com hanex.cc hanfakg.com hanfan.cc hanfei.net hanfeiyl.com -hanfengcars.com hanfugong.com hanganxian.com hangbohaorun.com @@ -44820,7 +44524,6 @@ hangzhouzehe.com hanhai.net hanhaiqikan.com hanhanfx.com -hanhanmanhua.com hanhe-cable.com hanhongchina.com hanhoo.com @@ -44911,7 +44614,6 @@ hanwa-ch.com hanweb.com hanwei1234.com hanweimetal.com -hanweiqizhong.com hanwenzhongyi.com hanximeng.com hanxinsheng.com @@ -44953,7 +44655,6 @@ hao123.com hao123.com.sg hao123.net hao123.ph -hao123.sh hao12306.com hao123img.com hao123n.com @@ -45125,7 +44826,6 @@ haolaoshi.tv haolawyer.com haole.com haoled9999.com -haoledi.com haolexiang.com haolidayiliao.com haolietou.com @@ -45324,7 +45024,6 @@ haozjj.com haozke.com haozongjie.com haozu.com -haozujiaju.com haozuojia.com hapco-cn.com hapg-hitachi.com @@ -45423,7 +45122,6 @@ hatlonely.com hatoem.com hatro.cc hatter.ink -hatx.net haval-global.com have.ink havefun.im @@ -45522,7 +45220,6 @@ hbcjxx.com hbclgg.com hbcljyc.com hbclqcw.com -hbclzq.com hbcoal.com hbcof.com hbcofco.com @@ -45690,7 +45387,6 @@ hbltyh.com hbltzb.com hbltzx.com hblxxx.com -hblykj.com hblynk.com hbm360.com hbmajiang.com @@ -45724,7 +45420,6 @@ hbpx.net hbqcxy.com hbqingteng.com hbqmys.com -hbqnb.com hbqndc.com hbqtgg.com hbqydz.com @@ -45840,6 +45535,7 @@ hbwsrc.net hbwuxue.com hbwuye.com hbww.org +hbxcw.com hbxdf.com hbxfywj.com hbxgzls.com @@ -45870,10 +45566,8 @@ hbynet.net hbyouyunyouke.com hbyoyo.com hbyqtl.com -hbyscn.com hbysfhm.com hbyt56.com -hbyuandadl.com hbyuanhao.com hbyunxi.net hbyunyang.net @@ -45970,7 +45664,6 @@ hcpharm.com hcqixinhb.com hcqxbj.com hcrlm.com -hcs360.com hcschengtou.com hcsd123.com hcsdhgjzx.com @@ -46066,7 +45759,6 @@ hdhjtz.com hdhome.org hdhosp.com hdhospital.com -hdhsjt.com hdhui.com hditec.com hdj.me @@ -46180,6 +45872,7 @@ healthych.com healthydigitallife.com healzentx.com heanyo.com +hearfly.com hearstchina.com heart-game.com heartide.com @@ -46195,7 +45888,6 @@ hebbc.org hebbr.com hebca.com hebcar.com -hebdtp.com hebecc.com hebeeb.com hebei.cm @@ -46305,7 +45997,6 @@ hefagear.com hefei.cc hefeifc.com hefeimarathon.com -hefeitv.com heflc.com hefls.net hegii.com @@ -46354,7 +46045,6 @@ heiheiyuyin.com heihekeji.com heijiao.net heijiaovip.com -heijin.org heike07.com heilanhome.com heilei.com @@ -46457,7 +46147,6 @@ hellohuohu.com helloimg.com helloinstruments.com hellojava.com -hellokang.net hellokid.com hellokidvip.com hellololi.com @@ -46525,7 +46214,6 @@ henaninfo.com henanjianling.com henanjiqiren.com henanjubao.com -henanjuchuang.com henanrc.com henansha.com henanshengtang.com @@ -46598,7 +46286,6 @@ hengtai-law.com hengtaiboyuan.com hengtiansoft.com hengtianyun.com -hengtong-sd.com hengtonggf.com hengtonggroup.com hengtonglog.com @@ -46686,7 +46373,6 @@ herta.space herton.net hertzhu.com heryipharma.com -hescna.com heshanghuitong.com heshdity.com heshecasa.com @@ -46698,6 +46384,7 @@ heson10.com hesongwang.com hesppe.com hessianhealth.com +hestudio.net heta.tech hetaigroup.net hetaixin.com @@ -46813,6 +46500,7 @@ hezeribao.com hezeswjt.com hezhidongli.com hezhong-china.com +hezhongyihua.com hezhou520.com hezhoubbs.com hezhouhuatong.com @@ -46947,7 +46635,6 @@ hg12333.com hg2693.com hg5177.com hg568.com -hg80022.com hg87.com hg8880.org hg9895.com @@ -47007,7 +46694,6 @@ hgyys.com hgzcjt.com hgzk.com hgzkb.com -hgzkj.com hgzrt.com hgzxgz.com hgzxgz.net @@ -47020,7 +46706,6 @@ hh-medic.com hh-pcbs.com hh-pmp.com hh-post.com -hh-wi.com hh.global hh010.com hh88hh.com @@ -47311,7 +46996,6 @@ hilonggroup.com hiloong.com hilqq.com hiluluke.com -hilunwen.com hima.auto himado.com himaker.com @@ -47550,7 +47234,6 @@ hkance.com hkance.xyz hkanews.com hkaohua.com -hkbaike.com.hk hkbchina.com hkca.club hkcd.com @@ -47634,7 +47317,6 @@ hl-brushes.com hl-cat.com hl-epay.com hl-hengsheng.com -hl-plastic.com hl-sl.com hl95.com hl95001.com @@ -47781,10 +47463,8 @@ hm5988.com hmadgz.com hmarathon.com hmbzfjt.com -hmchairs.com hmchina.com hmcl.net -hmdcell.com hmdx.net hmedu.com hmeili.com @@ -48087,7 +47767,6 @@ hnpwholesale.com.au hnqczy.com hnqfseed.com hnqinshi.com -hnqjbh.com hnqlhj.com hnqljj.com hnqljt.com @@ -48209,7 +47888,6 @@ hnwngp.com hnwsbz.com hnwtqx.com hnwtv.com -hnwuxie.com hnwwsjzx.com hnwxw.net hnwyxx.com @@ -48260,7 +47938,6 @@ hnyyyfsyy.com hnyyyz.com hnyzfwlkj.com hnyzzy.com -hnzckjw.com hnzdjsj.com hnzfcgxh.com hnzfgjj.com @@ -48521,7 +48198,6 @@ hongruike.com hongsanban.com hongsat.com hongsegs.com -hongsehuoxian.com hongsejiqing.com hongsenlin.com hongshan.com @@ -48795,7 +48471,6 @@ houdao.net houdask.com houdewl.com houdong999.com -houdunwang.com houdy.com houfaka.com houfangyiyao.com @@ -48866,12 +48541,10 @@ hp.com hp123.com hp888.com hpbgb.com -hpbjy.com hpblog.net hpc.cloud hpccake.com hpccube.com -hpcssc.com hpculturegroup.com hpearx.com hpeft.com @@ -48880,7 +48553,6 @@ hpgamestream.com hpglw.com hpgzf.com hph123.com -hphuishou.com hphwa.com hpicorp.net hpigc.com @@ -49047,7 +48719,6 @@ hrexam.com hrfc.net hrflc.com hrfoods.com -hrgrobotics.com hrgsmz.com hrgxyy.com hrhuiyi.com @@ -49062,7 +48733,6 @@ hro-cosmetics.com hroot.co hroot.com hrpackage.com -hrqxy.com hrrsj.com hrs100.com hrsalon.org @@ -49119,7 +48789,6 @@ hsddyy.com hsdfzp.com hsdjxh.org hsdjz.com -hsdprefabcontainerhouse.com hseda.com hsehome.com hsehome.org @@ -49143,7 +48812,6 @@ hshsxkj.com hshton.com hshuiyi.com hshw.com -hshy.net hsjk.com hsjkaoyan.com hsjpgzx.com @@ -49229,7 +48897,6 @@ hsyunyi.com hsyyf.me hsyymusic.com hsyzg.net -hszhizhen.net hszk.org hszq6.com hszq8.com @@ -49301,7 +48968,6 @@ htjob.net htjs.net htjsq.com htjsq.mobi -htjxsbfw.com htjy.net htkaoyan.com htknow.com @@ -49513,6 +49179,7 @@ huairen588.com huairougreatwallmarathon.com huairtv.com huairui59.com +huaitao.vip huaixin88.com huaiyangnews.com huaji.com @@ -49698,6 +49365,7 @@ huansengifts.com huanshoulv.com huante.com huantest.com +huanting.cc huantour.com huanuomenye.com huanwen.com @@ -49806,8 +49474,10 @@ huategas.com huatengsci.com huati.cc huatian-hotel.com +huatian.net huatianxiangsu.com huatong-logistics.com +huatongcloud.com huatu.com huatugz.com huatuo007.com @@ -49894,7 +49564,6 @@ huaxingchem.com huaxinhz.com huaxinorthop.com huaxinpark.com -huaxinzhuji.com huaxiong.com huaxirc.com huaxj.net @@ -49995,7 +49664,6 @@ hubeiyongtai.com hubeizhengao.com hubiao168.com hubing.online -hubinlu.com hubsound.com hubstudio.vip hubulab.com @@ -50169,6 +49837,7 @@ huiliangapp.com huilianyi.com huililong.com huilintyre.com +huilinwang.com huilitc.com huiliu.net huiliubao.com @@ -50272,7 +49941,6 @@ huiwang.net huiweikeji.com huiwenda.com huiwenjidian.com -huiwo.com huiwww.com huixiang360.com huixianginvest.com @@ -50306,6 +49974,7 @@ huiyijh.com huiyinxun.com huiyizhuo.com huiyou.com +huiyou027.com huiyouhotels.com huiyuandao.com huiyuanjia.net @@ -50425,10 +50094,10 @@ hundsun.com hundun.net hundx.com hunger-valley.com -hunheji.org hunli100.com hunlian100.com hunlihu.com +hunlihu1.com hunlihunli.com hunliji.com hunlimama.com @@ -50625,7 +50294,6 @@ huuhoo.com huuing.com huwaibbs.com huwaizb.com -huwangne.com huwatech.club huway.com huweihuang.com @@ -50751,7 +50419,6 @@ hwyton.com hwyxxx.com hwzn.com hwzyjt.com -hx-gifts.com hx-parking.com hx-qt.com hx-r.com @@ -50859,7 +50526,6 @@ hxqcgf.com hxqcjt.com hxqgczx.com hxqnj.org -hxqssc.com hxqtedu.com hxr100.com hxrc.com @@ -51047,6 +50713,7 @@ hyswcn.com hyswjt.net hysyyl.com hysz.net +hyt01.com hyt368.com hytbj.com hytcshare.com @@ -51375,7 +51042,6 @@ hznetwk.com hznewface.com hznews.com hznkg.com -hznlxs.com hznrkj.com hznsh.com hzntjt.com @@ -51476,7 +51142,6 @@ hztssy.com hztuoliang.com hztvmg.com hztx.com -hztx2020.com hztygd.com hztzkj.net hzvillas.com @@ -51489,7 +51154,6 @@ hzwentou.com hzwer.com hzwf.link hzwgc.com -hzwhbcyxh.com hzwindpower.com hzwlt.com hzwluo.com @@ -51633,7 +51297,6 @@ i0766.com i0898.org i11r.com i121.net -i133.com i1608.com i16949.com i171.com @@ -51764,9 +51427,7 @@ ib-china.com ibaba88.com ibabyjoy.com ibadboy.net -ibaiji.org ibailve.com -ibaimahu.com ibaiqiu.com ibaitiao.com ibaizhu.com @@ -51876,7 +51537,6 @@ ic-mag.com ic-valley.com ic2china.com ic37.com -ic5.cc ic71.com ic72.com ic98.com @@ -52186,7 +51846,6 @@ idaasksyun.com idachu.com idacn.org idadt.com -idaguang.com idailycar.com idaima.com idangyang.com @@ -52494,6 +52153,7 @@ ifindever.com ifintechnews.com ifireeye.com ifireflygame.com +ifish7.com ifitbox.com ifjing.com ifkeji.com @@ -52523,7 +52183,6 @@ ifmtech.com ifmzjt7.com ifnews.com ifnfn.com -ifone360.com ifonelab.net ifonts.com iforce-ad.com @@ -52563,7 +52222,6 @@ igaokaopai.com igaosheng.com igarwin.com igbill.com -igdcc.com igdzc.com igea-un.org igeak.com @@ -52733,7 +52391,6 @@ iiaq.net iiast.com iibechina.com iibq.com -iic6o.com iicall.com iicats.com iicha.com @@ -52745,7 +52402,6 @@ iidx.fun iieii.com iiesz.com iieye.cc -iigs9.com iii80.com iiiaaa.com iiiddd.com @@ -52854,6 +52510,7 @@ ikeguang.com ikeled.com ikemeng.com ikepu.com +ikgambwqeqnv.com ikhimalayaniq.com ikj123.com ikj168.com @@ -52936,7 +52593,6 @@ ilixiangguo.com iliyu.com ilkeji.com illl.xyz -illumpaper.com ilmgq.com ilohas.com iloli.bid @@ -52945,7 +52601,6 @@ ilongre.com ilongterm.com ilonhoo.com iloveanan.com -ilovebarcode.com ilovechao.com ilovefishc.com ilovey.live @@ -53096,8 +52751,8 @@ imglefeng.com imglink.win imgmarket.net imgmg.com -imgnvd.com imgo.tv +imgs.ovh imgscdn.com imgse.com imgsha.com @@ -53114,12 +52769,12 @@ imhuchao.com imiaomeng.com imibaby.net imibao.com -imicang.com imicome.com imifun.com imigu.com imiker.com imile-inc.com +imile.com imitui.com imixpark.com imjiayin.com @@ -53381,6 +53036,7 @@ initialview.com initkk.com initpp.com initroot.com +initrr.com initvv.com initxx.com inja.com @@ -53462,7 +53118,6 @@ insagee.com insarticle.com inshion.com inshotapp.com -insidestuffs.com insigma-elec.com insistence.tech insmoin.com @@ -53490,7 +53145,6 @@ int-agri.com int2018.com int800.com intaek.com -intcache.net intcredo.com intdmp.com intecheye.com @@ -53508,7 +53162,6 @@ inter-credit.net inter-rock.com inter1908.net interactivebrokers.hk -interarknet.com interchinawater.com interface003.com intergreat.com @@ -53560,10 +53213,10 @@ invoee.com invzible.com inwaishe.com inwatch.cc +inwuoo.com inxedu.com inxni.com inyota.com -inyutech.com inzone-auto.com inzotek.com ioa365.com @@ -53650,6 +53303,7 @@ ip.istatmenus.app ip.la ip008.com ip138.com +ip159.com ip192.com ip33.com ip3366.net @@ -53694,7 +53348,6 @@ ipcodm.com ipcorecatalog.com ipctest.com ipcwifi.com -ipcxz.com ipdaili.com ipdatacloud.com ipddz.com @@ -53840,7 +53493,6 @@ iqujing.com iqunix.com iqunix.store iqupdate.com -iqushai.com iqxbf.com iqxedu.com iqyun.cc @@ -54138,7 +53790,6 @@ itany.com itany.org itanzi.com itao.com -itaocow.com itaogw.com itaoke.org itaokecms.com @@ -54304,6 +53955,7 @@ itrus.com itruscloud.com itrusign.com itry.com +its-mo.com its114.com itsapu.com itsdz.com @@ -54348,7 +54000,6 @@ ityears.com ityg.com itying.com ityizu.com -itykc.com itylq.com ityouknow.com ityxb.com @@ -54413,13 +54064,11 @@ ivsky.com ivtfx.com ivu4e.com ivvajob.com -ivvui.com ivweb.io ivwen.com ivxiaoyuan.com ivy-school.org ivybaby.me -ivycoffee.com ivydad.com ivykit.com ivypha.com @@ -54444,7 +54093,6 @@ iwatani-gz.com iwatch365.com iwatertech.com iway-tech.com -iwc999.com iwcoo.com iwebad.com iwebchoice.com @@ -54804,7 +54452,6 @@ javaeye.com javamilk.org javanav.com javascriptcn.com -javashuo.com javatang.com javawind.net javaxxz.com @@ -54819,7 +54466,6 @@ jayce.icu jayfc.com jayfu.tk jayjw.com -jayumovie.com jayxhj.com jaz581.com jazlxs.com @@ -54895,7 +54541,6 @@ jccpay.com jccsoc.com jccug.com jcdd.com -jce8.com jcebid.com jcecom.com jcedu.org @@ -54969,7 +54614,6 @@ jcsfs.com jcsjt.com jcsrsj.com jcssolar.com -jcstem.com jcsy66.com jcszhtc.com jctmj.net @@ -54998,7 +54642,6 @@ jczh100.com jczhijia.com jczhiyao.com jcznzb.com -jczqw.com jd-88.com jd-app.com jd-bbs.com @@ -55099,7 +54742,6 @@ jddj.com jddmoto.com jddtv.com jddyl.com -jddzdq.net jdedu.net jdemall.com jdf999.com @@ -55118,7 +54760,6 @@ jdfzm.com jdgogo.com jdgslb.com jdgslb.net -jdgwdq.com jdgzf.net jdh.com jdh.healthcare @@ -55146,7 +54787,6 @@ jdlgw.com jdlhb.com jdlhpt.com jdlingyu.com -jdmk.xyz jdmwk.com jdmy.com jdnews.net @@ -55190,7 +54830,6 @@ jdx.com jdxc.net jdxfw.com jdxlt.com -jdxpsb.com jdxs.com jdxsr.com jdxyydf.com @@ -55302,7 +54941,6 @@ jewellery.gold jewellworld.com jewelryseeds.com jewelryshanghai.com -jewetek.com jexus.org jeyi.com jeywatch.com @@ -55323,7 +54961,6 @@ jfcjt.com jfcoo.com jfdaily.com jfedu.net -jfewle.com jfgjwl.com jfgou.com jfh.com @@ -55370,7 +55007,6 @@ jgfarm.com jgg.hk jgg09.com jggame.net -jggjj.com jghstar.com jgjapp.com jgjsoft.com @@ -55389,7 +55025,6 @@ jguo.com jgxb120.com jgxzy.com jgy.com -jgyb.net jgyee.com jgyljt.com jgyllh.com @@ -55644,7 +55279,6 @@ jiandaopay.com jiandaoyun.com jiandati.com jiandiao.com -jiane86.com jianeryi.com jianfc.com jianfei.com @@ -55685,7 +55319,6 @@ jiangnan-group.com jiangongdata.com jiangongw.com jiangpaipinpai.com -jiangping.fyi jiangpinjiangxin.com jiangqiaomuye.com jiangque.com @@ -55768,7 +55401,6 @@ jianliyuan.com jianloubao.com jianlow.com jianlu365.com -jianlw.com jianmaidi.com jianmao.net jianmeicao.com @@ -55855,7 +55487,6 @@ jiaobu365.com jiaobuser.com jiaochengzhijia.com jiaoda306.com -jiaodaseo.com jiaodian.pub jiaodj.com jiaodong.net @@ -55883,7 +55514,6 @@ jiaotu.men jiaow.com jiaoya.com jiaoyf.com -jiaoyian.com jiaoyibao.com jiaoyimao.com jiaoyin.com @@ -55905,7 +55535,6 @@ jiapuvip.com jiaqiangban.com jiaqianglian.com jiaqianlee.com -jiaqilixiang.xyz jiaren.org jiarendress.com jiarenrecycle.com @@ -56018,7 +55647,6 @@ jidacheng.com jidaihome.com jidanpu.com jidantuoshebei.com -jidaola.com jide.com jidekan.com jideos.com @@ -56039,12 +55667,10 @@ jiebaogroup.com jiebide.xin jiecang.com jiecangtubemotors.com -jiecao.com jiechengcehui.com jiechengcloud.com jiechikeji.com jiechuang.com -jiededy.com jiediankeji.com jiefadg.com jiefanglinli.net @@ -56063,7 +55689,6 @@ jiehuigroup.com jiehun021.com jiehun027.com jiejichengshi.com -jiejiecup.com jiejing.fun jiekenmould.com jiekon.com @@ -56141,6 +55766,7 @@ jifenapp.com jifencity.com jifenfu.net jifengkj.com +jifengyun.com jifenh.com jifenyi.com jifenyouhuidui.com @@ -56197,6 +55823,8 @@ jike.info jike800.com jikecdn.com jikedata.com +jikedingyue.com +jikedog.com jikefan.com jikegou.net jikeiot.cloud @@ -56213,7 +55841,6 @@ jikipedia.com jilaihuyu.com jilailawyer.com jilaoshi.com -jileniao.net jiletaotao.com jili20.com jiliguala.com @@ -56282,7 +55909,6 @@ jinbifun.com jinbilianmeng.com jinbitou.net jinbondt.com -jinbumao.com jincaicaiwu.com jincao.com jincaocw.com @@ -56525,6 +56151,7 @@ jinhongchina.com jinhonggroup.com jinhongnl.com jinhu.me +jinhuapp.com jinhuatv.com jinhuawatch.com jinhuazhe.com @@ -56716,7 +56343,6 @@ jintouwangdai.com jintuituiapp88.com jinwaimai.com jinweitec.com -jinwin.net jinwucdn.com jinxiang114.com jinxianglian.net @@ -56819,7 +56445,6 @@ jisuanla.com jisuanzt.com jisuapi.com jisuchou.com -jisuclouds.com jisuim.com jisuimage.com jisuimg.com @@ -57203,7 +56828,6 @@ jjzyy.com jk-bms.com jk-px.com jk.com -jk123.net jk126.com jk13.net jk169.net @@ -57211,7 +56835,6 @@ jk2h.com jk37du.com jk3a.com jk51.com -jk520.net jk725.com jk90.com jkangbao.com @@ -57225,6 +56848,7 @@ jkcn365.com jkcorkpads.com jkcsjd.com jkd.com +jkd360.com jkdsz.com jkelec.com jkh-ym.com @@ -57363,7 +56987,6 @@ jlonline.com jlpay.com jlq.com jlqsugar.com -jlrcom.com jlriza.com jlrtvu.com jlscjrkf.com @@ -57387,7 +57010,6 @@ jlsw.cc jlswansen.com jlsyqzyy.com jlszlyy.com -jlszykj.com jlt01.com jltchina.com jltq.com @@ -57475,7 +57097,6 @@ jmwater.com jmwww.net jmxckj.com jmxiangyi.com -jmxingtang.com jmxlmc.com jmxw.net jmycapacitor.com @@ -57542,7 +57163,6 @@ jnjingxin.com jnjj.com jnjpkj.com jnjszl.com -jnjtsc.com jnkason.com jnky.com jnlab.com @@ -57824,7 +57444,6 @@ joyu.com joyuai.com joyugas.com joyulf.com -joyuyx.com joyware.com joywellsemi.com joywii.net @@ -57850,7 +57469,6 @@ jpddc.com jpedo.com jpeen.com jperation.com -jpfans.com jpfmor.com jpg.cm jpghd.com @@ -57889,7 +57507,6 @@ jpwindow.com jpwky.com jpwxapp.com jpxm.com -jpxs.org jpxue.com jpxww.com jpyoo.com @@ -57957,7 +57574,6 @@ jrmianban.com jrnba.cc jrntv.com jrpengze.com -jrptweb.org jrqiwen.com jrqzw.net jrsncn.com @@ -58120,7 +57736,6 @@ jsepa.com jser.io jsessh.com jsexpressway.com -jsf666.com jsfish.net jsfj.net jsfls.com @@ -58286,7 +57901,6 @@ jskjgc.com jskjgroup.com jsklcy.com jskly.com -jskmmy.com jskoso.com jskpcg.org jskuajing.com @@ -58325,7 +57939,6 @@ jsmodeling.com jsmolfa.com jsmrmf.com jsmsg.com -jsmuseum.com jsmxgs.com jsmxw.com jsnaier.com @@ -58562,6 +58175,7 @@ jsycport.com jsycsy.com jsyczls.com jsyd139.com +jsydns15.com jsyes123.com jsyf88.com jsyfxcl.com @@ -58656,7 +58270,6 @@ jtfengtou.com jtfulfillment.com jtg2g.com jtggame.com -jtggb.com jtgloble.com jtgzfw.com jthcsx.com @@ -58688,7 +58301,6 @@ jtnsh.com jto8.com jtpipeline.com jtrauto.com -jtrhc.fun jtrobots.com jtso.net jtsp98.com @@ -58718,7 +58330,6 @@ juanyunkeji.com juaq.com jubaihuijia.com jubaiye.com -jubaopay.com jubaozang.com juben108.com juben68.com @@ -58805,18 +58416,15 @@ jujiangkk.com jujiangktz.com jujiaobaby.com jujiaonet.com -jujiaozs.com jujias.com jujie.com jujienet.com jujin8.com jujinpcb.com jujinwater.com -jujiu8.com jujoy.com jujumao.com jukan.net -jukandiannews.com juke200.com jukebao.com jukejia.com @@ -58831,7 +58439,6 @@ julanling.com julecn.com julefun.com juli-china.com -julialabarge.com juliandianqi.com juliang8.com juliangcili.com @@ -58960,7 +58567,6 @@ juntec.com juntu.com juntuan.net junwu262.com -junxianhr.com junxinmed.com junyao.tech junyi-auto.com @@ -59286,7 +58892,6 @@ jxnjy.com jxnongjiayuan.com jxnxs.com jxnyc.net -jxorg.com jxpdf.com jxphone.com jxphyz.com @@ -59357,7 +58962,6 @@ jxtyzx.org jxtzw.com jxunicom.com jxveg.org -jxw123.com jxw12328.com jxwan.com jxwmanage.com @@ -59392,7 +58996,6 @@ jxzikao.net jxzl.cc jxzxtec.com jxzyx.com -jy-dengju.com jy-leasing.com jy-mach.com jy-sz.net @@ -59459,7 +59062,6 @@ jyjxtech.com jykm88.com jykss.com jykuaidi.com -jyl1688.com jyl88.com jylight.cc jylink.com @@ -59524,11 +59126,11 @@ jywlcm.com jywmgs.com jywxq.com jyxdyzx.com -jyy010.com jyykyy.com jyyun.com jyzb01.com jyzc.com +jyzhongg.com jyzz666.com jyzzdq.com jyzzx.com @@ -59570,7 +59172,6 @@ jzgc-school.com jzgchy.com jzgcjsysjzz.com jzgcjszz.com -jzgcsl.com jzgczz.com jzgede.com jzggzy.com @@ -59587,10 +59188,8 @@ jzj2009.com jzj9999.com jzjgift.com jzjt.com -jzkelida.com jzking.com jzkjjt.com -jzkoo.net jzlt100.com jzmbti.com jzmjtjn.xyz @@ -59602,7 +59201,6 @@ jznygf.com jznyjt.com jzongguan.com jzpat.com -jzpbuy.com jzptt.com jzpu.com jzpx.net @@ -59688,7 +59286,6 @@ k8008.com k8azeicxy4idx.com k8k8k8.com k8ser.com -k8sj.com k8smeetup.com k8stech.net k913.com @@ -59718,6 +59315,7 @@ kafeng.com kagirl.net kah8.com kahaozhushou.com +kahuodong.com kai-asia-hk.com kai-lun.net kai-ying.com @@ -59756,7 +59354,6 @@ kaigongyi.com kaiguo.com kaihei.co kaihu51.com -kaihuacar.com kaihuaeva.com kaihuia.com kaijia-smt.com @@ -59775,6 +59372,7 @@ kaimanhua.com kaimen360.com kaimg.com kaimitech.com +kaipai.com kaipanla.com kaipuyun.com kaipuyun.net @@ -59845,7 +59443,6 @@ kaizhan.com kajicam.com kajishou.com kaka.com -kaka3.com kaka996.com kakacl.net kakalili.com @@ -60077,7 +59674,6 @@ kaopujinfu.com kaopuyun.com kaopuyun.net kaoqin.com -kaoqinjiweb.com kaoqintong.net kaoqinyi.com kaoruo.com @@ -60090,11 +59686,11 @@ kaoshibaike.com kaoshibao.com kaoshibb.com kaoshidian.com +kaoshixing.com kaoshizixun.com kaosite.com kaostedu.com kaotipai.com -kaotop.com kaowana.com kaowang.com kaowx.com @@ -60253,7 +59849,6 @@ kdweibo.com kdzs.com kdzwy.com kdzxedu.com -kdzyy.net ke-chuang.com ke.com ke51.com @@ -60306,7 +59901,6 @@ keduxinxi.com kedwyz.com keede.com keejuu.com -keem6.com keen-dental.com keenbow.com keenonrobot.com @@ -60340,7 +59934,6 @@ kehanedu.com kehaohao.com kehou.com kehu51.com -kehua360.com kehuaapp.com kehuan-upward.com kehuda.com @@ -60399,11 +59992,9 @@ kelete.com keliangtek.com kelibiao.com kelikt.com -kelilens.com kelimotor.com kelinpower.com kelinsoft.com -kelkjj.com kelon.com kelong-chemical.com kelong-powder.com @@ -60634,7 +60225,6 @@ kiaic.com kiana.love kiapmyf.xyz kibinggroup.com -kickoffo.site kicontech.com kid17.com kiddopal.com @@ -60767,7 +60357,6 @@ kingsunsoft.com kingtaifook.com kingtroldata.com kingtysin.com -kinguid.com kingview.com kingwisoft.com kingyield.com @@ -60792,6 +60381,7 @@ kinzhan.com kinzoncap.com kiomodesign.com kira.cool +kirakuapp.com kirgen.com kiriko-china.com kirin-tech.com @@ -60900,7 +60490,6 @@ kk1bie336689.com kk30.com kk30.net kk3g.net -kk888888kk.com kkabc.com kkapp.com kkcache.net @@ -61048,7 +60637,6 @@ kmgdgs.com kmgg88.com kmguolv.com kmgybsr.com -kmhdjz.com kmhpc.net kmhwtz.com kmhybz.com @@ -61088,7 +60676,6 @@ kmw.com kmwatersupply.com kmway.com kmwx.net -kmxg.net kmxkh.com kmxqt.com kmxyj.com @@ -61113,7 +60700,6 @@ knfeco.com knight-un.com knightedge.com knightli.com -knightyoung.asia kninebox.com knj-nanjing.com knn-nj.com @@ -61128,6 +60714,7 @@ knowhowedu.com knowingclouds.com knowingcloudvip.com knowingyun.com +knowlink-assets.com knownpcb.com knownsec.com knowsafe.com @@ -61190,7 +60777,6 @@ kongapi.com kongbugushi.com kongdao.com kongduan.com -kongfou.net kongfz.com kongge.com kongjianjia.com @@ -61340,7 +60926,6 @@ kqalevel.com kqapi.com kqgeo.com kqgyl.com -kqidong.com kqj123.com kqjtj.com kqjtj.net @@ -61523,7 +61108,6 @@ ktlstbg.com ktmap.com ktmv.com ktmwan.net -ktokib.com ktovztie.com ktplay.com ktrcn.com @@ -61691,7 +61275,6 @@ kuaiwan.com kuaiwenyun.com kuaixiazai.com kuaixue.com -kuaixun360.com kuaiyan.com kuaiyankanshu.org kuaiyiad.com @@ -61731,7 +61314,6 @@ kuajinzhifu.com kuakao.com kuakao.net kuake8.com -kuamarketer.com kuaming.com kuandaige.com kuanfans.com @@ -61748,7 +61330,6 @@ kuangming.com kuangshitech.com kuangshun.com kuangstudy.com -kuangwan.tv kuangxiangit.com kuangyeyuan.com kuangyi.com @@ -62032,7 +61613,6 @@ kwaiying.com kwaiymx64war5a7f.com kwaizt.com kwangfeng.com -kwgaewsl.shop kwggroupholdings.com kwimgs.com kwinbon.com @@ -62102,10 +61682,8 @@ kxx2.com kxxsc.com kxxxl.com kxyyf.com -ky-cable.com ky-express.com ky.live -ky0ip30.com ky393834.com ky5yx.com ky6yx.com @@ -62177,7 +61755,6 @@ kzmyhome.com kzrcw.com kzread.com kzrqicae.com -kztpms.com kztsjj.com kzwr.com kzwx.net @@ -62222,7 +61799,6 @@ labno3.com labpyx.com labuladong.online labview.help -labworld.cc labxing.com labzj.com lacaoshi.com @@ -62254,7 +61830,6 @@ lagoujobs.com laguaba.com laguke.com lahuashanbx.com -lahuobao56.com lahuolaozao.com lai-ai.com laianbbs.com @@ -62467,7 +62042,6 @@ langrenclub.com langrensha.net langruiyun.com langsajiasi.com -langsheng-eco.com langsong.site langtao.cc langtaojin.com @@ -62564,7 +62138,6 @@ lansurcn.com lantaochina.com lantiangufen.com lantianyu.net -lanting123.com lantinglou.com lantumap.com lantushiji.com @@ -62723,7 +62296,6 @@ lapin365.com laplace-semi.com lapulace.com laravel-admin.org -laravel-china.org laravelacademy.org larenla.com large.net @@ -62762,7 +62334,6 @@ laruence.com lasashengdi.com laschina.org lascn.net -laser-dhc.com laser568.com laserfair.com laserjg.com @@ -62793,6 +62364,7 @@ lavaradio.com lavdrzv.xyz law-lib.com law-star.com +law-wei.com law01.net law6888.com lawasst.com @@ -62948,6 +62520,7 @@ lcfby.com lcfcw.com lcfgjs.com lcfile.com +lcftech.com lcfw.co lcgdbzz.org lcgjcj.com @@ -63030,6 +62603,7 @@ ldgjj.com ldgslb.com ldhrd.com ldhxbj.com +ldhy.click ldj-edujy.com ldjt-china.com ldkftz.com @@ -63183,7 +62757,6 @@ ledctl.com lede.com ledguhon.com ledhyzm.com -ledianduo.com ledianyun.com lediaocha.com ledmary.com @@ -63205,7 +62778,6 @@ leeleo.vip leenzee.com leenzhu.com leeon.me -leepoint.net leesdog.space leeshen.net leesoar.com @@ -63351,6 +62923,7 @@ lemonpiggy.com lemonplus.asia lemonsay.com lemonttt.com +lemonvp.com lemonyd.com lemote.com lempstack.com @@ -63799,7 +63372,6 @@ lianhecang.com lianhejiaju.com lianhengtec.com lianhepaimai.com -lianhjz.com lianhuangroup.com lianjia.com lianjianode.xyz @@ -63817,7 +63389,6 @@ lianku.xin liankuaiche.com lianli168.com lianlian.com -lianlianchem.com lianlianlvyou.com lianlianpay-inc.com lianlianpay.com @@ -63856,7 +63427,6 @@ lianwo8.com lianwwl.com lianxianjia.com lianxinapp.com -lianxing.org lianxinkj.com lianyi.com lianyins.com @@ -63880,7 +63450,6 @@ liaogx.com liaoing.com liaoji.com liaojiu.net -liaokeyu.com liaokong.com liaoliao.com liaoningmoduo.com @@ -63889,6 +63458,7 @@ liaosam.com liaoshenrc.com liaotiantu.com liaowei.net +liaoworking.com liaoxiwenhua.com liaoxuefeng.com liaoyuanchats.com @@ -64098,7 +63668,6 @@ lihuasoft.net lihui.net lihuia.com lihun66.com -lihunlawer.com liigou.com lijiabaijc.com lijiabrasstube.com @@ -64120,6 +63689,7 @@ likamao.com likangwei.com like.video like996.icu +likeaboat2023.com likeacg.com likebuy.com likecha.com @@ -64198,7 +63768,6 @@ linfan.com linfeicloud.com linfen365.com linfeng.tech -linfenshenzhou.com linfenwater.net ling-shi.com lingangholding.com @@ -64249,6 +63818,7 @@ linglonglife.com linglongtech.com lingmao.tech lingmeijie.com +lingmeng888.com lingmovie.com lingnanpass.com lingo-ace.com @@ -64298,6 +63868,7 @@ lingxingkj.com lingxiuwenlv.com lingxmall.com lingy.cc +lingyanghuyu.com lingyi.org lingyifang.com lingyihanhua.com @@ -64420,7 +63991,6 @@ linovel.net linovelib.com linoya.com linpx.com -linqijin.com linqujob.com linqumarathon.com linruanwangluo.com @@ -64597,7 +64167,6 @@ litten.me little-star.love little-sun.com littleboy.net -littlefoxgroup.com littlehero.xyz littleqiu.net littleroost.net @@ -64728,7 +64297,6 @@ liuyuechuan.com liuyunliumeng.com liuyuntian.com liuzaoqi.com -liuzekang.com liuzhihang.com liuzhixiang.com liuzhiyugzs.com @@ -64738,7 +64306,6 @@ liuzhoukaichuang.com liuzhourm.com liuzhousteel.com liuzhuni.com -liuzi.net liuzitang.com liuziyoudu.com liuzongyang.com @@ -64890,9 +64457,7 @@ lizikeji.vip lizilaw.com liziqiche.com lizitongxue.com -liziwl.com liziwu.net -lizixin.cool liziyuan.com lizq.host lj-audio.com @@ -65018,7 +64583,6 @@ llsserver.com llssite.com llsttapp.com llsun.com -lltllt.com lltoken.com lltskb.com llumar-cn.com @@ -65047,7 +64611,6 @@ lmbus.com lmdk01.com lmdouble.com lmengcity.com -lmfdt.com lmjd2.app lmjtgs.com lmjx.net @@ -65172,7 +64735,6 @@ lnzzpf.com lo97.com loac.cc loadingbay.com -loan163.com loansliml.com local-ip.online localizecdn.com @@ -65331,7 +64893,6 @@ longhuvip.com longi.com longigroup.com longjcun.com -longjiaowan.com longjiazuo.com longjisteel.com longjisz.com @@ -65446,8 +65007,6 @@ lookao.com lookbaby.com lookbravo.com lookchem.com -lookcss.com -lookedu.net lookfor.one lookgame.com looking-car.com @@ -65505,7 +65064,6 @@ lotusair.net lotusdata.com lotusfr.com lotut.com -lou86.com loubobooo.com louding.com loudseas.com @@ -65533,7 +65091,6 @@ loveabc.net lovean.com loveapp.com lovebizhi.com -lovebuy99.com lovedword.com loveforvenus.com lovefree.cc @@ -65559,7 +65116,6 @@ loveota.com loveota.net lovepd.com loverdoor.com -loveroise.com lovesec.com loveshang.com lovesoo.org @@ -65582,7 +65138,6 @@ loyi.net loyo.cc loystnetwork.com lp.fyi -lp006.com lp023.com lp025.com lp91.com @@ -65620,7 +65175,6 @@ lqbby.com lqbj.com lqbj66.com lqfeather.com -lqgrdj.com lqhualang.com lqjob88.com lqjt.com @@ -65732,7 +65286,6 @@ lsmaps.com lsmtjy.com lsmzt.cc lsnm.com -lsoli.com lsoos.com lspjy.com lsplayer.com @@ -65886,7 +65439,6 @@ luchengas.com luchentech.com luchenwater.com luchuang.com -luchuanquan.com luciaz.me lucifer.ren lucifr.com @@ -66010,7 +65562,6 @@ lunlunapp.com lunwenf.com lunwengo.net lunwenlib.com -lunwenschool.com lunwenstudy.com lunwentong.com lunwenxiazai.com @@ -66105,7 +65656,6 @@ lushangroups.com lushaojun.com lushifu.net lushu.com -lushuyu.site lusongsong.com luspet.com lussac.net @@ -66123,7 +65673,6 @@ lutongnet.com luv66.com luwei.me luweiwater.com -luwoff.com luxe.cc luxe.co luxemon.com @@ -66209,7 +65758,6 @@ lvfapiao.com lvgangss.com lvgou.com lvgset.com -lvguang.net lvguo.net lvjhx.com lvjiaoya121.com @@ -66238,7 +65786,6 @@ lvneng.com lvnengliang.com lvpai114.com lvpin100.com -lvping.com lvpu-chem.com lvqingqichangjia.com lvrdn.com @@ -66345,7 +65892,6 @@ lxbio.net lxbtrip.com lxccl.com lxcdns.com -lxcsc.com lxcvc.com lxdas.com lxdfs.com @@ -66510,6 +66056,8 @@ lyhomestayinn.com lyhuadu.com lyhx.net lyia.org +lyihub.com +lyilife.com lyjiuzhou.com lyjj.net lyjksw.com @@ -66601,6 +66149,7 @@ lyyzedu.com lyz810.com lyzaix.com lyzb.com +lyzb33.app lyzfgjj.com lyzggs.com lyzhanlang.com @@ -66791,12 +66340,10 @@ lztb.com lztdzy.com lzteli.com lztlcyxx.com -lztv.tv lztvnet.com lztx123.com lztxw.com lztzgroup.com -lzw.me lzweidaoyou.com lzwg.com lzwi.fun @@ -67004,7 +66551,6 @@ madio.net madisonboom.com madissonline.com madmalls.com -madouer.com madouvip.com madsrevolution.net maemo.cc @@ -67156,7 +66702,6 @@ maitao.com maitaowang.com maitegao.com maitewang.com -maitianquan.com maitix.com maitix.net maitu.cc @@ -67252,7 +66797,6 @@ malong.com malsmiles.com maltm.com mama100.com -mamabaobao.com mamacn.com mamahao.com mamahuo.com @@ -67311,6 +66855,7 @@ mangpielb.com mangren.com mangrovetek.com mangrovetreeresort.com +mangtian.com mangtuhuyu.com manguo42.com mangxia.com @@ -67332,6 +66877,7 @@ manjiwang.com mankebao.com mankewenxue.cc manlaxy.com +manli.ltd manlinggame.com manlinwood.com manluoni.com @@ -67396,7 +66942,6 @@ maogua.com maogumaogu.com maogx.win maoha.com -maohaha.com maohongdz.com maojiaoque.com maojiuxs.com @@ -67405,6 +66950,7 @@ maoken.com maoln.com maolog.com maolvtv.com +maomao365.com maomaoche.com maomaoxue.com maomaoyuanma.com @@ -67755,6 +67301,7 @@ mc-ccpit.com mc-dj.com mc-f.com mc-test.com +mc-user.com mc-xborder.com mc.cc mc1314.com @@ -67783,7 +67330,6 @@ mcearnmore.com mcecy.com mceebbs.com mcfound.net -mcfsji.com mcfun.tv mcfxw.com mcgsjt.com @@ -67839,6 +67385,7 @@ mcwizrd.com mcwshop.com mcx666.com mcxzs.com +mcy003.org mcyhfl.com mcypls.com mcyz.com @@ -67852,7 +67399,6 @@ md-store.com.tw md5ma.com md6v3pq.com mdapp.tv -mdaxue.com mdbchina.com mdbimg.com mdclub.org @@ -68194,6 +67740,7 @@ meishesdk.com meishi.cc meishi13.com meishichina.com +meishiffx.online meishij.net meishijr.com meishilife.com @@ -68224,6 +67771,7 @@ meitu-int.com meitu-mobile.com meitu.com meitu.net +meituaccount.com meituan.com meituan.net meitubase.com @@ -68255,6 +67803,7 @@ meitupic.com meitupingzi.com meituriji.com meiturom.com +meitushijie.com meitushop.com meitushouji.com meitusnap.com @@ -68294,7 +67843,6 @@ meiyanstatic.com meiyatour.com meiye.art meiyedana.com -meiyejob.com meiyes.com meiyi.ai meiyinji.vip @@ -68438,7 +67986,6 @@ mereith.com mergeek.com merklechina.com merkpd.com -merlinexh.com merlinmedicine.com mero-db.com merries-china.com @@ -68453,7 +68000,6 @@ mesou.net mesowe.com mesresearch.com messecloud.com -mesule.com met.red met169.com meta-stone.com @@ -68505,7 +68051,6 @@ meu95otw4967t.com meuicat.com meutu.com mevionchina.com -mevyyk.com mew.fun mewx.art mexicopanama.com @@ -68536,7 +68081,6 @@ mfexcel.com mfg-magnets.com mfgchn.com mfhcd.com -mficp.com mfinetech.com mfisp.com mfjl.wiki @@ -68769,7 +68313,6 @@ mice-gz.org micecn.com michael-j.net michaelapp.com -michelleventon.com michoi.com michong.com michplay.com @@ -68811,6 +68354,7 @@ microxiang.com microyan.com microzuji.com mictormedical.com +micu.hk micw.com micyjz.com mid-link.net @@ -68877,6 +68421,7 @@ migames.com migelab.com miglioriorologi.com migood.net +migu.store migucloud.com migufm.com migufun.com @@ -68897,6 +68442,7 @@ mihoyocloud.com mihoyogift.com mihoyomall.com mihua.net +mihuachat.com mihuangame.com mihuashi.com mihuatown.com @@ -69085,6 +68631,7 @@ mingpian.biz mingpian.net mingqi.co mingqian666.com +mingqu.xyz mingr.com mingren888.com mingricctv.com @@ -69107,7 +68654,6 @@ mingxigu.com mingxingku.com mingxinglai.com mingxuan.store -mingxuanxz.com mingya.mobi mingyafeng.com mingyang100.com @@ -69177,7 +68723,6 @@ minkave.com minking.cc minleai.com minli.com -minlida.com minmetals.com minor-tech.com minovapharma.com @@ -69199,7 +68744,6 @@ mintmuse.com mintrust.com mints-id.com minunix.com -minxindai.com minxing365.com minxiwang.com minxue.net @@ -69246,7 +68790,6 @@ mirmzhy.com mirreal.net mirrorcast.tv mirrorchyan.com -mirrorcn.com misaka.center misall.com miscd.com @@ -69559,7 +69102,6 @@ mnancheng.com mnbvbqw.com mnbvdfg.com mnbvtgv.com -mnclighting.com mndqlib.net mnengine.com mnihyc.com @@ -69577,6 +69119,7 @@ moa06240ju.com moa06250ju.com moage.com mob55.com +mobai.sbs mobaibox.com moban.com mobanhao.com @@ -69799,7 +69342,6 @@ mokamrp.com mokatyper.com mokayuedu.com moke.com -moke9.com mokeyjay.com moko.cc mokxing.com @@ -70009,7 +69551,6 @@ motilive.com motimaster.com motimo.com motisky.com -motnt.com moto-one.com.hk moto8.com moto8.net @@ -70085,7 +69626,6 @@ moziqing.com mozouyan.com mp.cc mp17.com -mp3-switch.com mp4ba.com mp4cn.com mpaascloud.com @@ -70112,7 +69652,6 @@ mpnbenefitsrtl.download.prss.microsoft.com mpnbenefitsrtluat.download.prss.microsoft.com mpoa.vip mpopkart.com -mpronnn.com mpserverless.com mpsoft.net mpxiaomi.net @@ -70141,7 +69680,6 @@ mr-ping.com mr77.com mr91.com mrbanana.com -mrbcq.com mrbird.cc mrbook114.com mrcrm.com @@ -70201,7 +69739,6 @@ msd-facing.com msddp.com msdn.download.prss.microsoft.com msdn.hk -msdn.im msdnxitong.com msdpmarathon.com msdprc.com @@ -70367,7 +69904,6 @@ much001.com muchangqing.com muchcloud.com muchong.com -muchrank.com muchunkang.com mudanauto.com mudgj.com @@ -70406,7 +69942,6 @@ mulangbrand.com mulanlake.com mulazim.com mulightapp.com -mulingyuer.com mulinsen.com mulinyun.com multi-parking.com @@ -70417,6 +69952,7 @@ mumayi.com mumbuy365.com mumingfang.com mumunv.com +mumuplayer.com mumuxili.com mundane.ink mungerlab.net @@ -70468,7 +70004,6 @@ mutean.com mutian.net mutianyugreatwall.com mutieffect.com -mutoe.com mutouxb.com mutouyu.com mutualhunter.com @@ -70507,7 +70042,6 @@ muzisoft.com muziyueqiu.com muzuhui.com mvashanghai.org -mvcat.com mvhere.com mvmaster.com mvoicer.com @@ -70538,7 +70072,6 @@ mwkhjc.com mwquicio.com mwrf.net mwrfabc.com -mwsbwcl.com mwstore.com mwtee.com mwtg.vip @@ -70557,7 +70090,6 @@ mxbc.com mxbc.net mxbiao.com mxbsy.com -mxceyjj.com mxchip.com mxddp.com mxde.com @@ -70627,6 +70159,7 @@ my089.com my120.org my147.com my1616.net +my22.art my22.fun my22.info my2852.com @@ -70707,6 +70240,7 @@ mycosresearch.net mycoss.com mycoss.net mycoss.org +mycplife.com mycqgc.com mycreate.net mycyjg.com @@ -70723,7 +70257,6 @@ mydidadi.com mydigi.net mydigit.net mydigitex.com -mydiyclub.com mydnns.com mydns114.net mydns8.com @@ -70794,7 +70327,6 @@ myimis.com myip.la myiplay.com myir-tech.com -myiroom.com myirtech.com myitit.com myityun.com @@ -70804,7 +70336,6 @@ myjiedian.com myjob.com myjob500.com myjoy777.com -myjql.com myjujing.com myk3.com mykarry.com @@ -70812,6 +70343,7 @@ mykd.cc mykeeta.com mykqyy.com mykscdn.com +mykuaidi.com mykuaiji.com mylbabao.com mylguoji.com @@ -71079,13 +70611,11 @@ n3sd.com n459.com n5w.com n63.com -n7433.com n802.com n8soft.com n9z.net na-mexico-1.myhuaweicloud.com na.ci -na2sib.com naaln.com nabluemedia.com naboyi.com @@ -71128,6 +70658,7 @@ naitta.com naiveadmin.com naiveblue.com naiwch.com +naixi.com naixuecha.com naiyouxuexi.com najingtech.com @@ -71142,7 +70673,6 @@ nalanchuanmei.com nalanxi.com nalati.com nalichi.com -name1688.com name2012.com name321.net nameidi.com @@ -71227,7 +70757,6 @@ nanjingtianqi114.com nanjingttym.com nanjingxinxu.com nanjingyinuo.com -nanjingzyhb.com nanjix.net nanjixiong.com nankaimba.org @@ -71388,7 +70917,6 @@ nb-bailing.com nb-jf.com nb-jiale.com nb-medicalsystem.com -nb0817.com nb160.com nb591.com nba.com @@ -71676,6 +71204,7 @@ necgokr2-724.acs.wecandeo.com necool.com nedfon.co nedigitals.com +neeca.net neefood.com neegle.net neeinn.com @@ -71693,6 +71222,7 @@ neihancommunity.com neihancommunity.net neihandiantai.com neihanfly.com +neihang.net neihanshequ.com neimaowang.com neimenggugames.com @@ -71813,7 +71343,6 @@ netpi.me netpoint25.com netposa.com netqd.com -netreds.com netsmell.com netspreading.com netstatic.net @@ -71993,7 +71522,6 @@ newxing.com newxitong.com newxue.com newyanshamall.com -newyiben.com newyifagroup.com newyishi.com newyorkluxurywatch.com @@ -72209,7 +71737,6 @@ nics365.com nicsbuy.com nicwind.com nidecms.com -nidekash.com nidiandaojia.com nie.io nieapps.com @@ -72289,7 +71816,6 @@ ningkekeji.com ninglutech.com ningma.com ningmengdou.com -ningmengsdfysdn.com ningmengyun.com ningshing.com ningtingche.com @@ -72414,7 +71940,6 @@ nj-kejin.com nj-kk.com nj-maici.com nj-nanhuai.com -nj-netgalaxy.com nj-newhope.com nj-qiyiguo.net nj-reagent.com @@ -72751,7 +72276,6 @@ njrzkj.com njsadz.com njsanhui.com njsbz.net -njsc-trade.com njsdjt.com njsdyy.com njsech.com @@ -72829,7 +72353,6 @@ njwcjx.com njwds.com njweixiao.com njweiyi6.com -njwljd.com njwmbj.com njwpdi.com njwqqx.com @@ -72874,7 +72397,6 @@ njyouwin.com njypk.com njyqhj.com njyqmj.com -njyshb.com njyspharma.com njysw.com njytian.com @@ -73020,8 +72542,6 @@ nn-jinlun.com nn-tct.com nn.com nn11001.com -nn11022.com -nn11661.com nn11771.com nn12333.com nn1yy.com @@ -73054,7 +72574,6 @@ nnboyi.com nnbsjyk.com nnbtl.com nnbupin.com -nnbvr.com nnbyg.com nncbre.com nncc626.com @@ -73207,7 +72726,6 @@ nnkj77.com nnkqfs.com nnkxnz.com nnlanfang.com -nnlbsh.com nnlfcm.com nnlghbkj.com nnlgjt.com @@ -73229,7 +72747,6 @@ nnmhzc.com nnminghe.com nnmingyuanyun.com nnmjm.com -nnmov.com nnmsjdgs.com nnmutong.com nnmwsy.com @@ -73344,7 +72861,6 @@ nnxqy.com nnxsypco.com nnxt.net nnxxzl.com -nnyarun.com nnybf.com nnybskq.com nnych.com @@ -73475,7 +72991,6 @@ nongnet.com nongpin88.com nongplay.com nongshang.com -nongtongyi.com nongxinyin.com nongyao001.com nongye.tv @@ -73601,7 +73116,6 @@ nowre.com nows.fun nowscore.com nowtop.net -nowwon.xyz nowxz.com noxagile.duapp.com noxgroup.com @@ -73653,7 +73167,6 @@ nrbbearing.com nrdzqwd.com nrec.com nrenba.com -nresm.com nri-beijing.com nrisc.com nrmchina.com @@ -73732,6 +73245,7 @@ nsydt.com nsynu.com nszmz.com nszxsyxx.com +nszynd66ggbcx.com nt.app nt.cc nt56.net @@ -73928,7 +73442,6 @@ nwdlink.com nweon.com nwncd.com nwshotel.com -nwswn.com nx-sc.com nx.cm nx5.com @@ -73942,7 +73455,6 @@ nxengine.com nxez.com nxgangyi.com nxgjbyy.com -nxgqt.org nxgtjt.com nxgyzb.com nxhongshanhe.com @@ -74010,7 +73522,6 @@ nync.com nypd520.com nyq.ink nyrmyy.com -nyrsksw.com nysenba.com nysgjgs.com nyshipyard.com @@ -74101,7 +73612,6 @@ oahelp.net oaimai.com oait360.com oak-amc.com -oaklandjs.com oaloft.com oaloft.net oalur.com @@ -74119,7 +73629,6 @@ obagame.com obai.cc obaku.com obatsipilisjos.com -obd2sale.com obd2top.com obeishi.com obesu.com @@ -74266,7 +73775,6 @@ offside.hk ofgame.net ofidc.com ofo.com -ofo2025.com ofopp.com ofpay.com ofpay365.com @@ -74528,7 +74036,6 @@ onedict.com onedns.net oneflys.com onefoot365.com -onegg.site onegobrand.com onegreen.net onehome.me @@ -74550,7 +74057,6 @@ onenice.tech oneniceapp.com onenoter.com oneonewrite.com -onephper.com oneplus.com oneplus.net oneplus6666.com @@ -74815,7 +74321,6 @@ opython.com oqrstu.com oqss.com or-sun.com -or77.net oracle-tencent.com oracle-tencent.net oracle.com @@ -74976,7 +74481,6 @@ osredm.com osrelease.download.prss.microsoft.com oss-cn-beijing-aliyuncs.com oss.link -oss.so ossdshxh.com osslan.com osuxrq.com @@ -75148,7 +74652,6 @@ ourwebpic.info ourwebpic.net ourwebpic.org ourwebpicvip.com -ourxun.com ouryao.com ousaikj.com oushangstyle.com @@ -75156,7 +74659,6 @@ oushidiban.net oushinet.com oushisheng.com oushivoyages.com -oushiyimulayou.com ousweixin.com outes.com outfit7.com @@ -75361,7 +74863,6 @@ paibaohy.com paichen.net paichi.com paidai.com -paidai.org paidui.com paiduidai.com paigepian.com @@ -75370,7 +74871,6 @@ paihang360.com paihang8.com paihb.com paihotels.cc -paike360.com paikew.com paiky.com paiky.net @@ -75380,7 +74880,6 @@ paimaprint.com paiming.net paintinghere.org paints.market -paiorg.com paipai.com paipai123.com paipaibang.com @@ -75642,7 +75141,6 @@ parkbees.com parketech.com parkicloud.com parking520.com -parkingadsaas.com parkinginfoweb.com parkingjet.com parkingos.club @@ -75849,7 +75347,6 @@ pddim.com pddpic.com pddugc.com pddxfd.com -pddzj.com pdeepmatrix.com pdf.la pdf00.com @@ -75857,7 +75354,6 @@ pdf1122.com pdfangchan.com pdfbianji.com pdfdo.com -pdfdowell.com pdffsy.com pdfjia.com pdflibr.com @@ -75868,7 +75364,6 @@ pdgzf.com pdhr.com pdidc.com pdie-expo.com -pdim.gs pdinvestmentgroup.com pdlib.com pdlnn.com @@ -75985,7 +75480,6 @@ pengboguandao.com pengchengenergy.com pengchenglx.com pengfei.com -pengfei.tech penghh.fun penghui88.com penging.com @@ -76083,7 +75577,6 @@ petope.com petpcb.com petpetin.com petrexchina.com -petrobest.com petroren.com petrostaroil.com petrvet.com @@ -76098,7 +75591,6 @@ pf178.com pfcexpress.com pfhoo.com pfinno.com -pfmcchina.org pfmmedicalchina.com pft12301.cc pftianshanno.com @@ -76129,6 +75621,7 @@ pgsql.tech pgxqw.net pgxxw.com pgy6.com +pgyapi.com pgyer.cc pgyer.com pgyer.im @@ -76208,7 +75701,6 @@ photo889.com photocnc.com photocome.com photohn.com -photoint.net photoncounts.com photonpay.com photops.com @@ -76241,7 +75733,6 @@ phpkaiyuancms.com phpks.com phplife.net phpor.net -phprnu.com phpsong.com phpspider.org phpstat.net @@ -76385,7 +75876,6 @@ pimax.com pimei.com pimspeak.com pin-color.net -pin-qu.com pin0312.com pin18pin.com pin2eat.com @@ -76501,7 +75991,6 @@ pinpai.biz pinpai1.com pinpai37.com pinpai9999.com -pinpaidadao.com pinpaihuoyuan.com pinpailiu.com pinpaime.com @@ -76582,7 +76071,6 @@ pizkutam.shop pj-666.com pj-road.com pj.com -pj00001.com pj39800.com pj57.com pjbest.com @@ -76621,7 +76109,6 @@ pkma.cc pkmer.net pko123.com pkoplink.com -pkpk.com pkpk999.com pkpky.com pkpmjc.com @@ -76689,6 +76176,7 @@ platinumchina.com play-analytics.com play-cdn10.com play-cdn11.com +play-cdn13.com play-cdn14.com play-cdn16.com play-cdn20.com @@ -76719,7 +76207,6 @@ playpangu.com playsm.com playtai.com playtai.net -playuav.com playwonderful.com playwxgame.com playyx.com @@ -76827,7 +76314,6 @@ pngbag.com pngsucai.com pniao.com pnol.net -pnshicha.com pnst8.com pntagkyy.com pntagsyy.com @@ -76863,7 +76349,6 @@ poemschina.com pohaier.com pohover.com poikm.com -poinesttia.com point-memory.com poiuytw.com poizon-inner.com @@ -76998,6 +76483,7 @@ postgres.fun postgresqlchina.com postjson.com postpony.com +postxin.com posyn.com poszjia.com potalapalace.com @@ -77040,6 +76526,7 @@ powerleadercdn.com powerleaderidc.com powerliber.com powerlong.com +powerlongmuseum.com powerma.net powermaxcorp.com powerpigs.net @@ -77091,6 +76578,7 @@ ppdd.com ppdesk.com ppdqk.com ppduck.com +ppdys.vip ppfeng.com ppforging.com ppfu3m.com @@ -77163,7 +76651,6 @@ ppter8.com ppthi-hoo.com pptianliao.com pptiyu.com -pptjia.com pptkj.net pptmall.net pptmao.com @@ -77227,7 +76714,6 @@ prcee.org prcfe.com prcvalve.com precise-test.com -precise2.net precision-biotech.com precision-biz.com preludeid.com @@ -77259,6 +76745,7 @@ printhome.com printhr.com printidea.art printlake.com +privateapi.xyz privatehd.to privatess.win privspace.net @@ -77356,7 +76843,6 @@ psd8.com psdee.com psdiv.com pse-meti.com -pse345.com psfjz.com psiexpo.com psjia.com @@ -77411,16 +76897,15 @@ pthxuexi.com pthxx.com pthxxw.com ptimg.org +pting.club ptkckj.com ptkill.com -ptlhzx.com ptmezkgg.com ptnrjt.com ptools.fun ptorch.com ptotour.com ptpcp.com -ptqxw.com ptrcw.com pts-testing.com ptshare.org @@ -77447,7 +76932,6 @@ puaas.com puai999.com puaihospital.net puamap.com -puasu.com puata.info pubbcsapp.com pubchn.com @@ -77468,7 +76952,6 @@ pubyun.com pubyun.net pubyun.org pucijiankang.com -pucms.com pudding.cc pudetouzi.com pudie.net @@ -77479,7 +76962,6 @@ pudutech.com puduzhai.com puem.org puer10000.com -puercha.cc puercn.com puerlife.org puersai.com @@ -77796,6 +77278,7 @@ qaynak.com qazasd.com qazdsa.com qazso.com +qaztool.com qazwobdu.com qazxsdc.com qbangmang.com @@ -77827,7 +77310,6 @@ qc-hr.com qc-shanghaipathology.com qc101.com qc188.com -qc1h.com qc6.com qc99.com qcaipiao.com @@ -77921,6 +77403,7 @@ qcxzls.com qcy.com qcymall.com qcyoung.com +qcyuns.com qczb.app qd-dy.com qd-metro.com @@ -77963,7 +77446,6 @@ qdeastsea.net qdedu.net qderzhong.net qdexam.com -qdf0605.com qdfik.com qdfnscy.com qdfuer.com @@ -78109,7 +77591,6 @@ qfedu.com qfeiche.com qfiee.com qfihdr.com -qflyw.net qfns1.com qfpay.com qfpq.com @@ -78146,7 +77627,6 @@ qgqy.com qgren.com qgswvza.com qgsydw.com -qgtong.com qgtql.com qgvps.com qgw.tm @@ -78250,7 +77730,6 @@ qhtibetan.com qhtui.com qhtycp.com qhtyzx.com -qhwgz.com qhwmw.com qhwptyn.com qhwww.com @@ -78293,7 +77772,6 @@ qiancha.cc qianchenglvdong.com qianchengriben.com qianchiyun.com -qianchuan.ltd qiancipai.com qiandai.com qiandao.com @@ -78305,7 +77783,6 @@ qiandaqian.com qiandaren.com qiandd.com qiandeups.com -qiandianyf.com qianduan.com qianduanheidong.com qiandunvpn.com @@ -78369,7 +77846,6 @@ qianlht.com qianliao.net qianliao.tv qianliaowang.com -qianlidianji.com qianliht.com qianliii.com qianlima.com @@ -78497,7 +77973,6 @@ qibazaixian.com qibingdaojia.com qibingwang.com qibo168.com -qibobang.com qiboleqipai.com qibosoft.com qibox.com @@ -78757,6 +78232,7 @@ qingdaoren.com qingdaoshenghao.com qingdelan.com qingdou.net +qingdou.vip qingdouw.com qingf001.com qingfanqie.com @@ -78806,7 +78282,7 @@ qingline.net qinglingvip.com qinglinong.com qinglm.com -qinglongwood.com +qinglue.com qinglue.net qinglvpin.com qingly.ink @@ -79199,7 +78675,6 @@ qjjmw.com qjmotor.com qjnice.com qjrc.com -qjrcj.com qjren.com qjsalia.com qjsalib.com @@ -79229,7 +78704,6 @@ qkisp.com qkkj88.com qkkjbj.com qkkjd.com -qkl123.com qkl234.com qknode.com qknown.com @@ -79360,15 +78834,11 @@ qnssl.com qntz.cc qnvipmall.com qnvipxd.com -qnvod.net qnw.cc qnydns.com qnydns.net -qnyglobal.com -qnzhdf.com qnzrmyy.com qnzyy.com -qoaao.com qolai.com qooboo.com qoocc.com @@ -79512,7 +78982,6 @@ qqqooo.com qqrain.com qqread.com qqrer.com -qqride.com qqrizhi.com qqro.com qqscb.com @@ -79542,7 +79011,6 @@ qqtouxiangzq.com qqts.net qqtu8.cc qqtu8.com -qqtxt.cc qqtz.com qquanquan.com qqumall.com @@ -79814,7 +79282,6 @@ quartzhy.com quasarchs.com quazero.com quba360.com -qubaidu.net qubaike.com qubaobei.com qubiankeji.com @@ -80091,7 +79558,6 @@ quguonet.com quhaidiao.com quheqihuo.com quhua.com -quhuangye.com quhuaxue.com quhuhao.com quhuichang.net @@ -80190,7 +79656,6 @@ qunxingvc.com qunxinzdh.com qunyaninfo.com qunyingkeji.com -qunyouxuan.com qunzh.com qunzhuquan.com qunzou.com @@ -80244,6 +79709,7 @@ quxianchang.com quxiang.work quxianzhuan.com quxingdong.com +quxintiaodong.com quxiu.com quxuan.com quyangyizhong.com @@ -80368,7 +79834,6 @@ qy.com qy.net qy266.com qy57.com -qy58w.com qy6.com qy7v7nn96e.com qyaninfo.com @@ -80379,7 +79844,6 @@ qycn.com qycn.net qycn.org qycname.com -qycs168.com qycylinder.com qyd-rf.com qydimg.com @@ -80460,7 +79924,6 @@ qzbhgyl.com qzbhzy.com qzbuxi.com qzbwjx.com -qzbykq.com qzccbank.com qzchuxing.com qzcia.com @@ -80494,7 +79957,6 @@ qzhrkj.com qzhsjc.com qzhslw.com qzhxshipping.com -qzhyyljg.com qzimg.com qzj2.com qzjcd.com @@ -80503,7 +79965,6 @@ qzjhscl.com qzjhsd.com qzjianwo.com qzjkw.net -qzjlw.com qzjxzs.com qzjy029.com qzjycc.com @@ -80532,7 +79993,6 @@ qzone.cc qzone.com qzoneapp.com qzonei.com -qzp666.com qzqcfw.com qzqcw.com qzqiye.com @@ -80605,7 +80065,6 @@ r220.cc r2coding.com r2yx.com r302.cc -r3lhl.com r435.com r51.net r5g.cc @@ -81008,7 +80467,6 @@ redianyuansu.com redianyule.com redianzixun.com rediao.com -redicecn.com redidc.com redirector.bdn.dev redirector.c.youtubeeducation.com @@ -81265,7 +80723,6 @@ revefrance.com revenuads.com reviosky.com revolut.ltd -revy.asia rew65.com rewnat.xyz reworlder.com @@ -81319,7 +80776,6 @@ rgrcb.com rgsgnj.com rgslb.com rgtjf.com -rgtygroup.com rgxw.com rgyh6t.com rgzbgroup.hk @@ -81338,6 +80794,7 @@ rhexe.com rhhz.net rhine-inc.com rhinosgamestwhk.com +rhinoxky.com rhkj.com rhky.com rhnewmaterials.com @@ -81492,6 +80949,7 @@ rj889.net rjaaa.com rjcopy.com rjdk.org +rjdownd.com rjetech.com rjeye.com rjfc110.com @@ -81558,7 +81016,6 @@ rmjiaju.com rmjtxw.com rmnof.com rmny.tech -rmoxl.com rmrbwc.com rmrun.com rmsznet.com @@ -81581,7 +81038,6 @@ rnhospital.com rnhy.net rnmachine.com rnmgn.net -rnw7f6jfk8.vip ro.com ro50.com ro8qwpaikd4kx.com @@ -81643,7 +81099,6 @@ roffar.com roguelike.com roguelitegames.com rohm-chip.com -rohs-china.com roidmi.com roii.cc roiland.com @@ -81768,7 +81223,6 @@ rootzhushou.com roouoo.com ropefitting.com ropinsite.com -roqwq.com ror-game.com rorotoo.com ros-lab.com @@ -81839,7 +81293,6 @@ rpfbzjam.shop rpfieldcdn.com rpg99.com rpgmoba.com -rphbnm.com rpo5156.com rq.run rqb99.com @@ -81934,7 +81387,6 @@ rsscc.com rssdtec.com rssforever.com rssso.com -rstex.net rsttest.com rsty77.com rsuedu.com @@ -82054,7 +81506,6 @@ ruguoapp.com ruguojiaoyu.com ruhaivip.com ruhnn.com -ruhousw.com rui.plus ruian.com ruianchayuan.com @@ -82117,7 +81568,6 @@ ruipai.com ruipengkeji.com ruipengpet.com ruipupharma.com -ruisaier.com ruiscz.com ruisheng.cc ruishengseal.com @@ -82142,7 +81592,6 @@ ruixiangbest.com ruixiangdy.com ruixin-eht.com ruixing.cc -ruixingkuaiji.com ruixueys.com ruixuncw.com ruixunidc.com @@ -82195,7 +81644,6 @@ runhengfdc.com runhuayou.biz runjf.com runjian.com -runjiandianqi.com runjiapp.com runkodo.com runkunoptics.com @@ -82271,6 +81719,7 @@ ruu6373.com ruubypay.com ruvar.com ruvisas.com +ruwen5.org ruxiaoyi.com ruyig.com ruyigou.com @@ -82537,6 +81986,7 @@ sailingyun.com sailipaint.com sailongmetal.com sailungroup.com +sailunkeji.com sailuntire.com sailway-china.com saiminprecision.com @@ -82555,7 +82005,6 @@ saiqi.mobi sairaicc.com sairui020.com saisaiwa.com -saisreetravels.com saitenm.com saiterobot.com saivsi.com @@ -82586,7 +82035,6 @@ salogs.com salonglong.com salongweb.com salutecc.asia -sam-jeong.net sam-tec.com samanhua.net samanlehua.com @@ -82723,7 +82171,6 @@ sankumao.com sanlan123.com sanlei.net sanlengbio.com -sanlian-cn.com sanlian-group.com sanlian-machine.com sanlian-sh.com @@ -82797,6 +82244,7 @@ sanyastar.com sanyasx.com sanyawater.com sanyecao.com +sanyegame.com sanyenet.com sanyewu.com sanyexin.com @@ -82807,7 +82255,6 @@ sanyibao.com sanyichemical.com sanyipos.com sanyouco.com -sanyougame.com sanyoumed.com sanyoutj.com sanyuanbaobao.com @@ -82827,7 +82274,6 @@ sanzinfo.com sanzkf.com sao-ma.com sao.ren -saogai.com saohua.com saoic.com saolife.com @@ -83397,7 +82843,6 @@ scxdf.com scxinkang.com scxjyw.com scxsls.com -scxsrh.com scyanzu.com scyarui.com scybjc.com @@ -83978,7 +83423,6 @@ sealeadbattery.com sealien.net sealimg.com sealos.run -sealui.com sealyun.com seamanhome.com seamaty.com @@ -84027,7 +83471,6 @@ secdriver.com secec.com secfree.com secisland.com -secist.com secjia.com seclover.com secoo.com @@ -84088,7 +83531,6 @@ seekwavetech.com seelishi.com seelvyou.com seemmo.com -seemoread.com seemse.com seentao.com seepomotor.com @@ -84241,7 +83683,6 @@ senyao1718.com senyou.com senyuanhi.com senyuanzhonggong.com -seo-820.com seo-lv.com seo.tm seo1158.com @@ -84340,6 +83781,7 @@ sf-zs.net sf007.com sf024.com sf0jm.xyz +sf2021.com sf34.com sf888.net sfacg.com @@ -84455,7 +83897,6 @@ sgmw.com sgmwlu.com sgmwsales.com sgnet.cc -sgnongkang.com sgou.com sgpjbg.com sgplink.xyz @@ -84509,7 +83950,6 @@ sh-datastone.com sh-deem.com sh-delixi.com sh-desu.com -sh-dgvalve.com sh-dongbiao.com sh-eastwes.com sh-edi.com @@ -84739,7 +84179,6 @@ shangdiguo.com shangdixinxi.com shangdu.com shangdu.info -shangeedu.com shangeyun.com shangfang56.com shangfenbao.com @@ -84822,7 +84261,6 @@ shanghaixuejia.com shanghaiyinyang.com shanghaiyk.com shanghaiyouxi.com -shanghaiyuqiang.com shanghaizhaxinhospital.com shanghaizhenji.com shanghcat.com @@ -85378,7 +84816,6 @@ shenmadsp.com shenmapay.com shenmayouxi.com shenmeipharm.com -shenmezhidexia.com shenmikj.com shenmo.com shenmojiaoyu.com @@ -85497,7 +84934,6 @@ shfamily.com shfangshui.com shfayy.com shfcw.com -shfeikuang.com shffjt.com shfft.co shfft.com @@ -85662,7 +85098,6 @@ shijie2.com shijiebang.com shijiechaoshi.com shijieditu.net -shijiehuarenbao.com shijiemap.com shijieminghua.com shijiemingren.com @@ -85677,7 +85112,6 @@ shijihulian.com shijiong.com shijiqingqing.com shijiretailo2o.com -shijitailai.com shijiudao.com shijiufang.com shijqq.com @@ -85818,7 +85252,6 @@ shitac.net shitairen.com shiti.net shitianxia.vip -shitibaodian.com shitoc.com shitou.com shitouboy.com @@ -85918,7 +85351,6 @@ shjtos.com shjtw.com shjtxx.net shjus.com -shjustdo.com shjvguan.com shjx-group.com shjy18.com @@ -85995,7 +85427,6 @@ shmog.org shmondial.com shms-expo.com shmtu.net -shmulan.com shmusic.org shmusicschool.com shmylike.com @@ -86199,11 +85630,9 @@ shppa.net shps518.com shpsncp.com shpyedu.com -shqcplw.com shqec.com shqi7.net shqianbin.com -shqianshuibeng.com shqinghe.com shqingzao.com shqipai.org @@ -86570,7 +85999,6 @@ shunderen.com shunfalighting.com shunfangw.com shunfeng.cc -shunfengche.org shunguang.com shunhaiwang.com shunhejieshui.com @@ -86583,7 +86011,6 @@ shunlitm.com shunmi.com shunnengnet.com shunnengoil.com -shunong.com shunqi.com shunscom.com shunshikj.com @@ -86596,7 +86023,6 @@ shunyagroup.com shunygroup.com shunyoubio.com shunyuwater.com -shuo66.com shuoba.com shuoba.me shuoba.org @@ -86623,7 +86049,6 @@ shuozhiwu.com shupackaging.com shupaiyun.com shupeng.com -shupin.net shuq.net shuqi.com shuqiaozt.com @@ -86656,6 +86081,7 @@ shuwenxianyun.com shuwulou.com shuxiangmenhu.com shuxiangmuye.com +shuxiayun.com shuxinsp.com shuxinyc.com shuxuehua.com @@ -86815,7 +86241,6 @@ shzfsy.com shzfzz.net shzgauto.com shzgd.org -shzgh.org shzgt56.com shzh.net shzhanling.com @@ -87032,7 +86457,6 @@ simengqifu.com simglo.com simhaoka.com simiam.com -simiao.net simici3.com simicloud.com simij.com @@ -87141,7 +86565,6 @@ sino-customs.com sino-epa.com sino-flexography.com sino-foldingcarton.com -sino-garments.com sino-gps.com sino-heavymach.com sino-info.net @@ -87308,7 +86731,6 @@ sinovationmed.com sinovationventures.com sinovdc.com sinovel.com -sinovio.net sinovoice.com sinowaycarbon.com sinowbs.com @@ -87453,7 +86875,6 @@ sj33.net sj3g.com sj51.net sj6rgxtjg3tmb.com -sj84.com sj998.com sjawards.com sjaz.com @@ -87552,7 +86973,6 @@ sjy-art.org sjy2.com sjycbl.com sjyhotel.com -sjyj100.com sjyl.com sjysz.com sjyt.net @@ -87768,7 +87188,6 @@ slashdevslashnetslashtun.net slatic.net slbauto.com slbiop.com -slbrucite.com slcad.com slchos.com slcyber.icu @@ -88273,6 +87692,7 @@ softbank.best softbanks.net softbar.com softbingo.net +softdownd.com softgostop.com softhome.cc softjinzhou.com @@ -88306,7 +87726,6 @@ sogou.net sogoucdn.com sogoucdndl.com sogouimecdn.com -sogouspider.com sogouw.com sogowan.com sogw.cc @@ -88370,7 +87789,6 @@ soldierstory-toys.com solelybio.com solepic.com soletower.com -soli.so soliao.com solidigm-asdf.com solidigm-zxcv.com @@ -88755,6 +88173,7 @@ specchemind.com specialcdnstatus.com spectorfilm.com spectreax.com +sped-ssss-pppp-eeee-dddd.com speechless.pw speed-hz.com speedaf.com @@ -88943,6 +88362,7 @@ srgnmsrg.com srgow.com sriappalam.com sribs.com +sric.fun srichina.org srici.com sritsoft.com @@ -89021,13 +88441,10 @@ ssfei.com ssffx.com ssgedm.com ssgeek.com -ssggg.com ssgsemi.com -ssgxwq.com ssgz.com sshce.com sshr.net -sshzhuangshipin.com ssia.cc ssidc.net ssidc.org @@ -89123,7 +88540,6 @@ ssydt.com ssyer.com ssyssf.com ssywh.com -ssyxdeli.com ssyxlx.com ssyxmall.com ssyzx.net @@ -89156,7 +88572,6 @@ staidson.com standard-groups.com standardcn.com standardshop.net -standatrans.com standteam.net stanlyview.com staofchina.com @@ -89194,7 +88609,6 @@ staringos.com starkai.com starlakelab.com starlink.uno -starlott.com starlu.com starm.cc starmily.com @@ -89238,7 +88652,6 @@ starwaycomm.com starworldgames.com starworldmacau.com starwsn.com -starxiiient.com starxn.com staryea.com stat-nba.com @@ -89264,6 +88677,7 @@ stay-bullish.com staybrowser.com staycu.com stbieshu.com +stboy.com stbs100.com stc2002.com stcaimcu.com @@ -89406,6 +88820,7 @@ streamcomputing.com streamipcf.akamaized.net streamlakeapi.com streffy.com +strinova.com strong-light.com strong-study.com strongfc.com @@ -89464,10 +88879,8 @@ stxsw.com styadmin.com stylecdn.com stylechina.com -stylecho.com stylemafiadaily.com styles-sys.com -styst.net styuanhua.com stzc.com stzzx.com @@ -89482,7 +88895,6 @@ suanfazu.com suanguaju.com suanjiayun.com suanjuzi.com -suanlitou.com suanpin.com suansheng.com suanst.com @@ -89564,6 +88976,7 @@ sufangxu.com sufeinet.com sufoma.com sufont.com +sufycdn.com sugaov.com sugar5.club sugarall365.com @@ -89588,7 +89001,6 @@ suibao-jiaozhu.com suibao.com suibiji.com suibo.org -suigo.net suiji123.com suijinetworks.com suijunlaowu.com @@ -89742,7 +89154,6 @@ sunhepower.com sunhongs.com sunhospital.net sunhuhotel.com -sunhwee.com suninf.net suninfo.com suning.com @@ -89937,7 +89348,6 @@ supercare168.com supercarrier8.com supercell.com supercodepower.com -supercopy2020.com supercrm.com superepoxyresin.com superfix.com @@ -90092,7 +89502,6 @@ suzhousj.com suzhouyabao.com suzip.com suzport.com -suzu365.com suzuki-china.com suzuki-shanghai.com svconcloud.com @@ -90105,7 +89514,6 @@ svimeng.com svinsight.com svip51.com svipdog.com -svipduihuan.com svipgulr.com sviping.com svk3o97xmyid93.com @@ -90137,7 +89545,6 @@ swanpowerstrip.com swanrov.com swaqds.com swarma.net -swarma.org swat-js.com swatou.com swbbsc.com @@ -90282,7 +89689,6 @@ sxetcedu.com sxfl.org sxfoundation.com sxfu.org -sxfyjzzs.com sxgbs.com sxgdtv.com sxggec.com @@ -90452,7 +89858,6 @@ sxxl.com sxxrmyy.com sxxsmjh.com sxxt.net -sxxtong.com sxxw.net sxxyfw.com sxxynews.com @@ -90492,7 +89897,6 @@ sy17.com sy1994.com sy1z.com sy2k.com -sy2mc.com sy2z.com sy3.com sy76.com @@ -90653,7 +90057,6 @@ sysmaster.online sysmini.com sysmls.com sysnfj.com -sysokean.com sysshine.com systedata.com systoon.com @@ -90761,7 +90164,6 @@ sz-lcsc.com sz-lzyy.com sz-map.com sz-matro.com -sz-meicheng.com sz-mtr.com sz-myjs.com sz-news.com @@ -90899,7 +90301,6 @@ szcmer.com szcnpiec.com szcogo.com szcompare.com -szcopper.com szcp.com szcsot.com szcssx.com @@ -91055,7 +90456,6 @@ szhmjp.com szhmkeji.com szhnsz.com szhntxh.com -szhoiyan.com szhome.com szhomeimg.com szhongshe.com @@ -91087,7 +90487,6 @@ szhxbiz.com szhytrip.com szhzsd.com szhzzl.com -szhzzy.com szicbe.com szicc.net szicpa.org @@ -91150,7 +90549,6 @@ szjuyou.com szjxgroup.com szjxj.com szjy.cc -szjydzkj.com szjyos.com szjys.net szjys1888.com @@ -91389,6 +90787,7 @@ szsnk.com szsnking.com szsoa.org szsolutia.com +szsongmao.com szsorch.com szsptk.com szsq.net @@ -91413,7 +90812,6 @@ szsupvan.com szswgcjc.com szswjc.com szswjs.com -szsyqcn.com szsyyxh.org szszjt.com szszlm.com @@ -91734,7 +91132,6 @@ taida-china.com taida100.com taidao.net taidaxincai.com -taidhotel.com taidichina.com taidu.com taiduhome.com @@ -91794,6 +91191,7 @@ taikongmedia.com taikoohui.com taikoyc.com taikr.com +tailgdd.com tailingood.com tailixiangjiao.com taillkang.com @@ -91921,6 +91319,7 @@ tangdouedn.com tangdoufdn.com tangdouhdn.com tangdouimg.com +tangdouz.com tangeche.com tangfc.com tanggu11g.com @@ -91933,6 +91332,7 @@ tangkabj.com tanglei.name tangmi.net tangmingint.com +tangoic.com tangongye.com tangpai.cc tangping.com @@ -92030,7 +91430,6 @@ taobaotesting.com taobeihai.com taobiaozu.com taobizhong.com -taobz.com taoc.cc taocange.com taocdn.com @@ -92078,6 +91477,7 @@ taohaowan.com taohhui.com taohua.com taohuang.com +taohuaqizhi.com taohuazu.net taohuazu.pw taohui.pub @@ -92161,7 +91561,6 @@ taoxiangyoushu.com taoxiaolu.com taoxie.com taoxie.com.tw -taoxuemei.com taoxv.com taoyi-support.com taoyi120.net @@ -92277,7 +91676,6 @@ tblk.me tbmcas.com tbmkt.com tbnimg.com -tbnrm.com tboxn.com tbpark.com tbq168.com @@ -92333,13 +91731,13 @@ tcdnvod.com tcdnvodbak.com tcdnvp.com tcdushi.com -tcdxt.com tcecps.org tceic.com tceratronix.com tcfhty.com tcfmglobal.com tcgcardgame.com +tcgdxyb.xyz tcggkj.com tcgke.com tcgsw.com @@ -92391,6 +91789,7 @@ tcnews.cc tcnvmms.com tcomall.com tcp.hk +tcp.pub tcping8.com tcqmj.com tcrcb.com @@ -92434,7 +91833,6 @@ td-sf.com td-tech.com td22.com td300321.com -td518.com td776.com td96.com td98.com @@ -92536,7 +91934,6 @@ teandy.com teapic.com teapottravel.com teatreexy.com -teawang.com tebaidu.com tebiao.net tebie6.com @@ -92808,7 +92205,6 @@ tensafe.com tenshi.cc tensorchip.com tensorflownews.com -tensornews.net tenstars.net tensuntrans.com tensynchina.com @@ -93017,7 +92413,6 @@ thecodeway.com thedatasys.com thederma.com theduapp.com -theessentiallifestyle.com thefastcdns.com thefastfile.com thefastimg.com @@ -93103,6 +92498,7 @@ thinkcmf.com thinkdid.com thinkdream.com thinkeridea.com +thinkerride.com thinkerx.com thinkindrupal.com thinkive.com @@ -93386,7 +92782,6 @@ tiantianfm.com tiantianfunds.com tiantianleshuiguo.com tiantianquce.com -tiantianqutao.com tiantiantiaosheng.com tiantianxieye.com tiantianxuexi.com @@ -93589,7 +92984,6 @@ tijox.net tijox.org tik2019.com tikersport.com -tiko.ink tiktoknewaccount.com tiktokrow-cdn.com tikuol.com @@ -93647,6 +93041,7 @@ tinetcloud.com tinfinite.com tinfo.com ting22.com +ting27.com ting55.com ting89.com tingbook.com @@ -93743,7 +93138,6 @@ titansci.com titapark.com titianshanfz.com tititxt.com -title-cn.com titloteka.com titussb.com tivitv.com @@ -93767,7 +93161,6 @@ tizoinfo.com tj-fch.com tj-guangxin.com tj-hcdz.com -tj-htjh.com tj-kingdee.com tj-model.com tj-un.com @@ -93819,7 +93212,6 @@ tjgcs.com tjgdjt.com tjgg88.com tjghw.com -tjgkw.org tjgmcg.com tjgportnet.com tjgtgd.com @@ -93893,7 +93285,6 @@ tjwf.com tjwj88.com tjwmschool.net tjxdzhonda.com -tjxinshunda.com tjxinyu.com tjxiqi.com tjxunlei888.com @@ -93927,7 +93318,6 @@ tkchina.com tkckjr.com tkcn.cc tkd-suzhou.com -tkddns.xyz tkfff.com tkgame.com tkhealthcare.com @@ -93959,7 +93349,6 @@ tl4su.com tl50.com tl88.net tlang.com -tlbaby.com tlbapm.com tlby120.com tlbyx.com @@ -94096,7 +93485,6 @@ tnedu.com tnettms.com tnfn.net tngcjx.com -tngdigital.com.my tnodenow.com tnong.com tnsou.com @@ -94173,7 +93561,6 @@ tokeimall080.com tokeisuisukopi.com token-ad.com token-sensor.com -tokenet.site tokenglish.com tokensky.net tokimekiclub.org @@ -94267,7 +93654,6 @@ tongrentangkj.com tongrentangzyyy.com tongsha.com tongshanbank.com -tongshengjixie.com tongshiling.net tongshilu.com tongshuai.com @@ -94310,7 +93696,6 @@ tongyi.com tongyicm.com tongyidrying.com tongyiplastic.com -tongyipumps.com tongyist.com tongyonggroup.com tongyongpe.net @@ -94349,6 +93734,7 @@ toodaylab.com toodudu.com tool.la tool.lu +tool56.com tool77.com tooleemesse.com toolgg.com @@ -95049,10 +94435,8 @@ tsrnjs.com tsrqjt.com tsrqjtfc.com tsruifeng.com -tsshunxin.com tssns.net tsstorry.com -tsstyb.com tssyedu.com tssyjt.com tst98.com @@ -95190,7 +94574,6 @@ ttwqw.com ttwx.com ttwxh.com ttxgu.com -ttxjj.com ttxn.com ttxs123.net ttxs7.com @@ -95208,6 +94591,7 @@ ttyongche.com ttyqm.com ttysq.com ttyuyin.com +ttyy800.vip ttzcw.com ttzubao.com ttzw365.com @@ -95246,6 +94630,7 @@ tuanyanan.com tuanyougou.com tuanyuan520.com tuanyx.com +tuanziai.com tubachina.com tubanginfo.com tubangzhu.com @@ -95351,7 +94736,6 @@ tuituifang.com tuituisoft.com tuituitang.com tuiwen.net -tuixue.online tuiyi.cc tuizx.com tujia.com @@ -95417,12 +94801,12 @@ tuo-pan.com tuoaa.com tuobeng.net tuocad.com +tuodan.tech tuodangclub.com tuodanlab.com tuodanyy.com tuohuangzu.com tuojiebiotech.com -tuojuncn.com tuojunedu.com tuolajieightscore.com tuoluowang.com @@ -95579,7 +94963,6 @@ tvmao.com tvmcloud.com tvmining.com tvniao.com -tvnwang.cc tvoao.com tvos.com tvt.im @@ -95706,7 +95089,6 @@ txttgj.com txttool.com txtyxg.com txvat.com -txvlog.com txwb.com txweekly.com txwestart.com @@ -95767,7 +95149,6 @@ tyfc.xyz tyfo.com tygameworld.com tygckj.com -tyguocao.com tyh120.com tyhjzx.com tyi365.com @@ -95859,7 +95240,6 @@ tzfdc.com tzfeilu.com tzfeize.xyz tzfile.com -tzfpa.com tzgcjie.com tzggzj.com tzgjjt.com @@ -95867,11 +95247,8 @@ tzgkuci.com tzgsjc.com tzhledu.net tzhospital.com -tzhuaya.com tzhwcc.com -tzjizhou.com tzjob.com -tzjufeng.com tzjxl.com tzjyjt.com tzjzsw.com @@ -95986,6 +95363,7 @@ u9time.com u9u8.com u9u9.com u9wan.com +uabkrsj.xyz uaff7j.com uahh.site uakwezgc.com @@ -96051,6 +95429,7 @@ ucancs.com ucanrobot.com ucantech.com ucantech.net +ucany.net ucarinc.com ucassc.com ucb6.com @@ -96156,7 +95535,6 @@ uepei.com ueram.com ueren.com uestcedu.com -uestcgxcd.com uestcliuxue.com uetianshanyp.com ueuz.com @@ -96191,6 +95569,7 @@ ugapi.com ugapk.com ugbb.com ugdesk.com +ugdocker.link uggame.com uggd.com ugirls.tv @@ -96317,7 +95696,6 @@ ukvisacenterd.com ukworldsale.com ulab360.com ulanzou.com -ulaojiu.com ulapia.com ule.com ule.hk @@ -96613,6 +95991,7 @@ upchinapro.com upchinaproduct.com upd.kaspersky.com update.microsoft.com +update2.cyou update8.com updeals.com updf.com @@ -96660,7 +96039,6 @@ uptom.com uptougu.com upu-opt.com upupbug.com -upupmo.com upupoo.com upupview.com upupw.net @@ -96837,7 +96215,6 @@ uu11441.com uu11661.com uu1314.com uu178.com -uu32500.com uu37.com uu375.com uu38.com @@ -96856,7 +96233,6 @@ uucnn.com uucqrdmk.com uueasy.com uuedutech.com -uufbacad.shop uufund.com uufuns.com uug22.com @@ -96945,7 +96321,6 @@ uwn.com uwntek.com uworter.com uwparking.com -uwsa4.com ux18.com ux87.com uxacn.com @@ -96976,11 +96351,11 @@ uyanip.com uyanke.com uycnr.com uyesee.com -uyess.com uyhjnm.com uyi2.com uyiban.com uyiqggpa.com +uymfybcf.shop uyou.com uyouii.cool uyouqu.com @@ -97017,7 +96392,6 @@ v15cdn.com v15i.com v1h5.com v1kf.com -v1l1b.com v1lady.com v1pin.com v1tv.cc @@ -97301,7 +96675,6 @@ venustrain.com vephp.com veqxiu.net ver.cc -verdareto.com vergilisme.com verify5.com verisilicon.com @@ -97516,7 +96889,6 @@ vingoostation.com vinjn.com vinkdong.com vinlion.com -vinnywang.com vinsondata.com violetgo.com violinstudy.net @@ -97716,7 +97088,6 @@ vjifen.com vjread.com vjshi.com vjtchina.com -vjzogyz.com vk6.me vk6oqcevmd1a.com vk8.co @@ -97772,7 +97143,6 @@ vmdo.net vmecum.com vmengblog.com vmeti.com -vmgikpw.com vmic.xyz vmicloud.com vmkj.net @@ -98008,6 +97378,7 @@ vqskrzmq.com vqu.show vqudo.com vqudochina.com +vqyzdzcg.shop vr-cat.com vr186.com vr2.tv @@ -98222,7 +97593,6 @@ w123w.com w18.net w1989.com w218.com -w24so.com w2985nq.xyz w2bc.com w2gou.com @@ -98381,13 +97751,11 @@ waluer.com walvax.com wamawama.com wamila.com -wamkio.com wan-ka.com wan.cc wan.com wan1234.com wan123x.com -wan160.com wan25.com wan32.com wan5d.com @@ -98675,7 +98043,6 @@ wanlitong.com wanlongdianqi.com wanlongjituan.com wanmaco.com -wanmadajian.com wanmei.com wanmei.net wanmeidapei.com @@ -98732,7 +98099,6 @@ wantgame.net wantiangroup.com wantiku.com wantong-tech.net -wantouzi.net wantowan.com wantquotes.net wantuju.com @@ -99117,7 +98483,6 @@ webanktcftp.net webankwealth.com webankwealthcdn.net webankwyd.com -webarch.org webarcx.com webcamx666.com webdns263.com @@ -99332,7 +98697,6 @@ weigangqin.com weigaogroup.com weigaoholding.com weigaoyaoye.com -weigay.com weige2006.com weige55.com weighment.com @@ -99361,6 +98725,7 @@ weihuo.site weihz.net weii.cc weiixxin.com +weijia1999.com weijiancloud.com weijianmen.com weijingzhijia.com @@ -99431,7 +98796,6 @@ weimibio.com weimingchem.com weimingcq.com weimingedu.com -weimingfj.com weimingkids.com weimingxt.com weimisystem.com @@ -99497,6 +98861,7 @@ weishi024.com weishi100.com weishigz.com weishipin.com +weishishuyuan.com weisiliang.com weismarts.com weistang.com @@ -99542,12 +98907,10 @@ weixin-001.com weixin.com weixin12315.com weixinbang.com -weixinbianjiqi.com weixinbiaoqing.com weixinbridge.com weixincall.com weixindadang.com -weixinduihuan.com weixingate.com weixingmap.com weixingon.com @@ -99592,7 +98955,6 @@ weiye.me weiyes.com weiyi.com weiyi.link -weiyichina.org weiyiqibj.com weiyitec.com weiyituku.com @@ -99685,7 +99047,6 @@ weme.fun wemechat.com wemeche.com wemediacn.com -wemiquan.com wemomo.com wemorefun.com wems.net @@ -99761,6 +99122,7 @@ wenjuan.ltd wenjuan.net wenjuan.pub wenjuanba.com +wenjuanbang.com wenjuanshow.com wenjuntech.com wenkaoba.com @@ -99836,7 +99198,6 @@ wenxue100.com wenxue360.com wenxueapp.com wenxuedu.com -wenxuee.com wenxuefan.net wenxuem.com wenxuemm.com @@ -100260,7 +99621,6 @@ whitecat.com whitecdnx.com whitegem.net whitemedia-china.com -whiterose-sy.com whiteswanhotels.com whitjy.com whizen.com @@ -100425,7 +99785,6 @@ whthgy.com whtime.net whtmhh.com whtongyun.com -whtongzhou.net whtonhe.com whtpgbyy.com whtpi.com @@ -100482,7 +99841,6 @@ whxcepc.com whxcy.com whxh.com whxhdn.com -whxinhuo.com whxlv.com whxrjt.com whxsdn.com @@ -100495,6 +99853,7 @@ whycan.com whycw.com whyec.com whyenjoy.com +whyesi.fun whyestar.com whyicheng.com whyimingkeji.com @@ -100532,7 +99891,6 @@ whzhjty.com whzhongxin.net whzhongzhi.com whzhtd.com -whzhuoyuan.com whzhzxmr.com whzjyy.com whzjzxy.com @@ -100548,7 +99906,6 @@ whzxzls.com whzydz.com whzys.com whzzhb.com -wi98a.com wibaidu.com wicep.com wicp.net @@ -100679,6 +100036,7 @@ windows10.pro windows10zj.com windows11.pro windows7en.com +windowstool.net windowsupdate.microsoft.com windowszj.com windpayer.com @@ -100747,7 +100105,6 @@ winsenseos.com winshang.com winshangdata.com winsing.net -winsome-jewelry.com winspay.com winstandard.com winstoncc.com @@ -100948,7 +100305,6 @@ wkcdn.com wkcmall.com wkcw.net wkddkyy.com -wkderp.com wkdty.com wkene.com wkepu.com @@ -101178,7 +100534,6 @@ woa.com woaanc.com woaap.com woai310.com -woaide.com woaidu.org woaifanyi.com woaihaoyouxi.com @@ -101264,7 +100619,6 @@ wol.tv wolai.com wolai.ren wolaidai.com -wolaidu1.com wolansw.com wolegou.net wolei-tech.com @@ -101401,8 +100755,6 @@ worksoho.com worktile.com worktilemail.com workyun.com -world-audio.com -world-fireworks.com world-machining.com world-pet.org world3dmodel.com @@ -101465,7 +100817,6 @@ wotucdn.com wotula.com wouju.com wouu.net -wow-mall.net wow.fun wowamazingthings.com wowbbs.com @@ -101914,7 +101265,6 @@ wuhexxg.com wuhongsheng.com wuht.net wuhu.cc -wuhuagongshui.com wuhuashe.com wuhubtv.com wuhues.com @@ -101941,6 +101291,7 @@ wujieyouth.com wujiit.com wujijiasu.com wujinimg.com +wujinpp.com wujintool.com wujinwater.com wujiok.com @@ -102240,7 +101591,6 @@ wwwfkw.com wwwic.net wwwimages.adobe.com wwwimages2.adobe.com -wwwruhecom.com wwxrmyy.com wwxxg.com wx-api.net @@ -102709,7 +102059,6 @@ x-cloud.cc x-cmd.com x-droners.com x-imagine.com -x-inc.org x-jishu.com x-kicks.com x-mol.com @@ -102749,7 +102098,6 @@ x4dp.com x586di.com x5dj.com x5zs.com -x6485f.cc x64go.com x64pro.com x66597.com @@ -102765,6 +102113,7 @@ x81zw.co x81zw2.com x821.com x86android.com +x86pi.com x8ds.com x8sb.com x9393.com @@ -102816,7 +102165,6 @@ xagmsm.com xaguanggu.com xagxp.com xagxyz.com -xahb.com xahc971.com xahdwzhs.com xahhp.com @@ -102933,7 +102281,6 @@ xbauto.com xbb8.com xbbaoan.com xbceo.com -xbcf518.com xbcjy.com xbcpsjk.com xbd61.com @@ -103018,7 +102365,6 @@ xcdngyc.vip xcdntp.vip xcdssy.com xcedu.net -xcetv.com xcex.net xcexe.com xcfuer.com @@ -103091,7 +102437,6 @@ xcvmbyte.com xcvvs.com xcwhjj.com xcx-x.com -xcxbaba.com xcxd-inc.com xcxjpd.com xcxvs.com @@ -103126,7 +102471,6 @@ xdcdn.net xdcg100.com xddpay.com xde.com -xde6.net xdebike.com xdf99.com xdfckjz.com @@ -103315,7 +102659,6 @@ xfzllht.com xg-techgroup.com xg1234.com xg38.com -xgaij.com xgamevip.com xgantt.net xgate.com @@ -103339,7 +102682,6 @@ xgiu.com xgj-info.com xgjdyjjt.com xgjgas.com -xgjiefu.com xgjjw.com xgkwx.com xglgift.com @@ -103370,7 +102712,6 @@ xgz.cc xgzbwdj.com xgzdhj.com xgzrs.com -xgzx.org xh-arch.com xh-health.com xh-silicone.com @@ -103416,7 +102757,6 @@ xhily.com xhintech.com xhj.com xhj.info -xhj365.com xhjaty.com xhjianglong.com xhjingling.com @@ -103450,6 +102790,7 @@ xhslink.com xhslw.com xhsmlt.com xhsrmyy.com +xhsxmt.com xhsyqx.com xhsyww.com xhtheme.com @@ -103573,7 +102914,6 @@ xiangbinmeigui.com xiangbojiubo.com xiangboshu.net xiangbosoft.com -xiangchengjob.com xiangcoin.com xiangcun.cc xiangcun.com @@ -103659,6 +102999,7 @@ xiangyue.life xiangyueedu.com xiangyuezhongxue.com xiangyujiankang.com +xiangyuncdn.com xiangyungx.com xiangyuyaoye.com xiangzhan.com @@ -103782,6 +103123,7 @@ xiaobot.net xiaobu.tech xiaobu121.com xiaobuwq.com +xiaocanapp.com xiaocanhulian.com xiaocantech.com xiaocaoo.com @@ -103789,7 +103131,6 @@ xiaocaoyun.com xiaoce.fun xiaocen.com xiaochamao.com -xiaochangxian.com xiaoche001.com xiaocheng.com xiaochengxu029.com @@ -103811,7 +103152,6 @@ xiaodaozhi.com xiaodapei.com xiaodengvip.com xiaodian.com -xiaodian.in xiaodian.so xiaodianweb.com xiaodigu.com @@ -103994,7 +103334,6 @@ xiaomashijia.com xiaomaxitong.com xiaomayi.co xiaomayi.net -xiaomayics.com xiaomazhixing.com xiaomei.cc xiaomeiti.com @@ -104074,7 +103413,6 @@ xiaoqiqiao.com xiaoqiweb.com xiaoquba.com xiaoqueshe.com -xiaoqugang.com xiaoquyijia.com xiaorizi.me xiaorui.cc @@ -104119,7 +103457,6 @@ xiaotiancai.com xiaoting.com xiaotongqq.com xiaotud.com -xiaotut.com xiaotuzhan.com xiaou2014.com xiaoupan.com @@ -104232,7 +103569,6 @@ xiaozhu158.com xiaozhu2.com xiaozhua.com xiaozhuangzhuang.com -xiaozhulanjuwei.com xiaozhustatic1.com xiaozhustatic2.com xiaozhustatic3.com @@ -104284,7 +103620,6 @@ xibojiaoyu.com xibsteel.com xibu168.com xibujuece.com -xibumaker.com xiburongmei.com xicaijing.com xicaishe.com @@ -104304,7 +103639,6 @@ xidibuy.com xidie.com xidiglobal.com xidong.net -xidongv.com xiduobaby.com xie22.com xie56.xyz @@ -104367,7 +103701,6 @@ xifengjiuzhaoshang.com xifu120.com xifumi.com xigaogen.com -xigeweb.com xiggua.com xigo.tv xigou100.com @@ -104425,7 +103758,6 @@ xilichi.com xilinjie.com xilinsi.org xilinx-ic.com -xilinzj.com xilipy.com xilish.com xilitang.com @@ -104549,7 +103881,6 @@ xinfuyun.net xing-bei.com xing-su.com xing73.com -xing800.com xingames.com xinganghulan.cc xingb.net @@ -104561,7 +103892,6 @@ xingcheshixian.com xingchiauto.com xingchuangcar.com xingchuangtiandi.com -xingdajt.com xingdatrip.com xingdong.co xingdongliu.com @@ -104588,7 +103918,6 @@ xinghai365.com xinghaigroup.com xinghan.vip xinghangdao.com -xinghanmuye.com xinghantec.com xinghaoyun8.com xinghejoy.com @@ -104612,10 +103941,8 @@ xingkec.com xingkeqi.com xingketech.com xingkong.link -xingkong.run xingkongfy.xyz xingkongmt.com -xingkoo.com xingkupai.com xinglai.com xinglan.co @@ -104924,7 +104251,6 @@ xinss.com xinss.net xinstall.com xinstatic.com -xinsuyang.xyz xinszy.com xintaikeji.com xintairen.com @@ -105059,7 +104385,6 @@ xinzhiguanwangyun.com xinzhongqi.net xinzhou.org xinzlkj.com -xinzuhe.com xinzuojia.com xinzushenghuo.com xiolift.com @@ -105068,7 +104393,6 @@ xiongbagk.com xiongbeng.com xiongbingtianxia.com xiongchuan.com -xiongdacn.com xiongf.com xiongfengcl.com xiongfenggroup.com @@ -105256,6 +104580,7 @@ xiyoucdn.com xiyouchat.com xiyouji.com xiyoulink.net +xiyoulinux.com xiyoupark.com xiyouquan.com xiyousdk.com @@ -105357,7 +104682,6 @@ xjjnjp.org xjjqd154.com xjjsws.com xjjt.com -xjkangjia.com xjks.net xjlxw.com xjlytz.com @@ -105366,7 +104690,6 @@ xjmachine.com xjmg.com xjmtx.com xjmty.com -xjmw.net xjnnet.net xjnzm.com xjoycity.com @@ -105462,7 +104785,6 @@ xkyn.net xkyy.com xkzzz.com xl-ai.com -xl-clean.com xl-edu.net xl-ele.com xl-lcd.com @@ -105723,7 +105045,6 @@ xmzmy.com xmzs.org xmzyark.com xmzzy.net -xn--0lqv73m.com xn--0lqwsu2w.com xn--15q53an56b23i4nu0jb.com xn--1bs9ye16ez8b.com @@ -105741,7 +105062,6 @@ xn--3bs781ecijtrt.com xn--3bsp13hurlcwb.com xn--3bsx54la62v.com xn--3bsz0pskmp89skv3a0zd724b1py.net -xn--3lqv74e.com xn--48s50dpwnbh95ah07i.com xn--4gq0d69oba129b9wd94ey8bs83ji3c3q7hoka.org xn--4gq1d760bszbgdv5p12rhq5bx2yc.net @@ -105843,11 +105163,11 @@ xn--g2xt1d91f2xk.com xn--glr604k.com xn--gmqr9gdtrhuf56g.com xn--h0tn34c.cc -xn--h6qq3whvbw6a42x4ij.com xn--husx9zj2eepau0se83d.com xn--hutn94av9amzg.net xn--i6q33br88fkud.com xn--igt225itqf.com +xn--it-if7c19g5s4bps5c.com xn--jh1a128b.com xn--jhqx3hjuanvm9zbb084ayucqwxhuqzew60ae3xve1fnwybs8a.com xn--jor0b302fdhgwnccw8g.com @@ -105935,7 +105255,6 @@ xn--xhqx10kr8o.com xn--xkr26fp82clgt.com xn--xkr999cp4fv97a.com xn--xkrs9ba41r.com -xn--xys863bov4ac4h.com xn--y6q834d2k3al4h.com xn--y8jhmm6gn.moe xn--yet74fr8g.com @@ -106061,7 +105380,6 @@ xqbase.com xqblog.com xqce.com xqckg.com -xqcwm123.com xqdgroup.com xqdjkwz.com xqfunds.com @@ -106157,7 +105475,6 @@ xsgongju.com xsgrq.com xsgtvacct.com xsh520.com -xshdchem.com xshengyan.com xshenshu.com xshhotels.com @@ -106267,7 +105584,6 @@ xtaike.com xtal.cc xtao.me xtbank.com -xtbaoziji.com xtc-edu.com xtcaq.com xtcfjt.com @@ -106279,6 +105595,7 @@ xtep.com xthinking.net xthtc.com xthyjt.com +xtiai.com xtianlang.com xtibet.com xtingcloud.com @@ -106298,7 +105615,6 @@ xtomp.com xtong-solar.com xtongs.com xtoobmo.xyz -xtowork.com xtqarzip.com xtransfer.com xtrapowercn.com @@ -106336,7 +105652,6 @@ xuanceo.com xuancheng.org xuanchuanyi.com xuandan.com -xuandashi.com xuandecarpet.com xuanfengge.com xuanhaikuwan.com @@ -106362,6 +105677,7 @@ xuanshu.org xuansiwei.com xuantaikeji.com xuanteng.org +xuanwifi.com xuanwonainiu.com xuanwu88.com xuanwumobile.com @@ -106380,7 +105696,6 @@ xuanyouwang.com xuanyuanhuangdi.org xuanyuans.com xuanyuanzjy.com -xuanyucttw.com xuanyusong.com xuanyutech.com xuanzhi.com @@ -106489,10 +105804,8 @@ xueqiu360.com xuerong.com xuesai.net xuesax.com -xueseo.com xueshanlinghu.com xuesheng.com -xuesheng360.com xueshiyun.com xueshu.com xueshu5.com @@ -106575,7 +105888,6 @@ xuexiwa.com xuexizhiwang.com xuexizoo.com xuexun.com -xueya8.com xueyanshe.com xueyiyun.com xueyou.org @@ -106630,7 +105942,6 @@ xunbin.com xunbo.net xunchabing.com xunchanggroup.com -xuncheng.cc xundasemi.com xundayun.com xundekai.com @@ -106667,7 +105978,6 @@ xunkids.com xunlanchina.com xunlei.com xunlei.net -xunleige.com xunleioa.com xunleisvipp.com xunlew.com @@ -106739,7 +106049,6 @@ xussb.com xusss.com xutour.com xuvol.com -xuwdui.com xuweidj.com xuwenliang.com xuxian.com @@ -106786,7 +106095,6 @@ xwamp.com xwan.com xwb8.com xwbank.com -xwcool.com xwcx6.com xwcx666.com xwcxgroup.com @@ -106823,7 +106131,6 @@ xwy-powder.com xwylhh.com xwyun.net xwzc.net -xwzw5.com xwzxldfx.com xx-industrial.com xx-motor.com @@ -106976,7 +106283,6 @@ xybsyw.com xybtv.com xybygc.com xybygw.com -xyc-edu.com xycad.com xycaogen.com xycareer.com @@ -107008,7 +106314,6 @@ xyffsb.com xyffvip.com xyfinechem.com xyfish.com -xyfnz.com xyfsy.com xyg100.com xygdcm.com @@ -107133,6 +106438,7 @@ xyyh.xyz xyyksy.com xyykt.org xyyl.com +xyyuan.fun xyyuedu.com xyyx82.com xyyxcm.co @@ -107153,7 +106459,6 @@ xyzkj.xyz xyzmdzs.com xyzmovie.net xyzop.com -xyzpw.net xyzs.com xyzshouji.com xyzspeaker.com @@ -107167,7 +106472,6 @@ xz.com xz325.com xz3733.com xz3z.com -xz5jin.com xz5u.com xz6.com xz6699.com @@ -107324,7 +106628,6 @@ y5news.com y5store.com y617.com y66b1pi5re.com -y6kky.com y70qeg6506.com y77.cc y78r.com @@ -107520,13 +106823,13 @@ yangtianb.com yangtong.com yangtse-automobile.com yangtse.com -yangtze-elevator.com yangwajia.com yangwang.pw yangwangauto.com yangwc.com yangwenlong.org yangwenqing.com +yangxi.tech yangxiang.com yangxiangdb.com yangxingzhen.com @@ -107573,7 +106876,6 @@ yanjinews.com yanjingge.com yanjiubaogao.com yanjiuchubanshe.com -yanjiyou.net yanjob.com yanjun7858.com yankay.com @@ -107592,6 +106894,7 @@ yanpk.com yanqiao.com yanqingshan.com yanqueai.com +yanrongyun.com yanshanmuyuan.com yanshanpump.com yanshaoutlets.com @@ -107723,14 +107026,12 @@ yaoxun.net yaoyaola.net yaoyedan.net yaoying.vip -yaoyitang.com yaoyouke.com yaozh.com yaozhigong.com yaozhizhu.com yaozs.com yaozui.com -yapodong.com yapp.com yaqilian.com yaqjyj.com @@ -107816,6 +107117,7 @@ ybc1024.com ybc35.com ybccb.com ybccode.com +ybcheck.com ybcjmarathon.com ybcnjg.com ybcxjd.com @@ -107874,7 +107176,6 @@ yc-gc.com yc-petronas.com yc-yinhe.com yc-zj.com -yc-zyg.com yc0917.com yc123.com yc123.net @@ -107894,7 +107195,6 @@ ycbiz.net ycbright.com ycbus.com ycc.ink -yccar.com yccdl.net ycclny.com yccn.cc @@ -108484,7 +107784,6 @@ yh999999.com yhachina.com yhadmob.com yham.net -yhbimg.com yhc-card.com yhcangchu.com yhchj.com @@ -108548,11 +107847,9 @@ yhsport.com yhstjt.com yhtclb.com yhthing.com -yhtj2014.com yhtools.cc yhtx.tv yhtzx.net -yhuimall.com yhurl.com yhwch.com yhwins.com @@ -108715,7 +108012,6 @@ yiduqiang.com yiduwater.com yiec.com yiernews.com -yieryouxin.com yiexi.com yifabao.com yifajingren.com @@ -108950,6 +108246,7 @@ yimudoor.com yimutian.com yimuymc.com yinbaitu.com +yinban.com yinbangbroker.com yinbaor.com yinbian.cc @@ -109009,7 +108306,6 @@ yinghecloud.com yingheedu.com yingheying.com yinghezhong.com -yinghuahao.net yinghuaonline.com yinghuasuan.com yinghuiiot.com @@ -109055,6 +108351,7 @@ yingsoft.com yingsoo.com yingsun.net yingsx.com +yingt.fun yingtai.com yingtaigroup.com yingtaoai.com @@ -109094,7 +108391,6 @@ yingyudengji.com yingyuecl.com yingyuehe.com yingyushijie.com -yingyuweb.com yingyuxiaoshuo.com yingzaocms.com yingzhongshare.com @@ -109241,9 +108537,7 @@ yiqingyuan.com yiqinzi.com yiqioffice.com yiqipaipingtai.com -yiqisese.com yiqishai.com -yiqishangmao.com yiqishanyuan.com yiqiso.com yiqisooimg.com @@ -109259,7 +108553,6 @@ yiqixiegushi.com yiqiyoo.com yiqiyou.com yiquan-keji.com -yiquanhs.com yiquanseo.com yiquhai.com yiqujing.com @@ -109419,7 +108712,6 @@ yixingart.com yixingauto.com yixingguanchang.com yixinli.xin -yixinqiye.com yixintui.com yixinu.com yixiu.cloud @@ -109764,7 +109056,6 @@ ylscw.net ylsdeyy.com ylsdyyy.com ylsfqyy.com -ylsgmr.com ylsgzx.com ylsmtnozzle.com ylssgg.com @@ -109774,7 +109065,6 @@ ylstatic.com ylstcgz.com ylstudy.com ylsw.net -ylsxyjy.com ylt2008.com yltapi.com yltender.com @@ -109806,7 +109096,6 @@ ylxzgz.com ylydmt.com ylyk.com ylyun.com -ylywave.com ylyz.com ylzbsj.com ylzbtech.com @@ -109994,7 +109283,6 @@ ynsyy.com ynszfw.com ynszk.com ynszlyy.com -yntcbc.com yntz.cc yntz.net ynu.icu @@ -110007,7 +109295,6 @@ ynxcbc.com ynxdfpr.com ynxingexinxi.com ynxinhua.com -ynxinshili.com ynxiu.com ynxr.com ynxrmyy.com @@ -110075,7 +109362,6 @@ yogorobot.com yoher.com yohipay.com yoho.org -yohoblk.com yohoboys.com yohobuy.com yohogirls.com @@ -110323,7 +109609,6 @@ youganghangmoguan.com yougaoji.com yougaoyx.com yougenet.com -yougewenhua.xyz youginorg.com yougou.com yougu.tv @@ -110408,7 +109693,6 @@ youlishipin.com youloft.com youlong123.com youlongciqing.com -youlongteng.com youlu.com youlu.net youlu6.com @@ -110514,6 +109798,7 @@ youshop04.com youshop10.com youshu.cc youshuge.com +youshujian.com yousi.com youstong.com youtaidoors.com @@ -110791,7 +110076,6 @@ yqh.com yqh1969.com yqh5.com yqhlm.com -yqhouseware.com yqhzz.com yqjtgs.com yqk889.com @@ -110967,12 +110251,10 @@ ystzzy.com ysug.com ysupan.com ysw1950.com -ysw365.com ysw68.com yswebportal.cc yswh.com yswlgame.com -yswliot.com yswswkj.com yswu.net yswyyds.com @@ -110985,12 +110267,10 @@ ysxyhtz.com ysxzls.com ysys.com ysyycv.com -yszgnn.com yszpwatch.com yszx99.com yszxx.net yszyun.com -yszzlt.com yt-ma.com yt-shoes.com yt-taili.com @@ -111098,7 +110378,6 @@ ytxinyan.com ytxsc.com ytxww.com ytyaoye.com -ytygame.com ytyhdyy.com ytyz.net ytyz.org @@ -111116,7 +110395,6 @@ yuan2808.com yuan7i.com yuanabsorber.com yuanbaobaoxian.com -yuanbaohui.com yuanbaokc.com yuanbaotaoche.com yuanbei.biz @@ -111232,7 +110510,6 @@ yuanzipower.com yuanziyan.com yuanzun.fun yuaoq.com -yuaowuliu.com yuapt.com yubaike.com yubangweb.com @@ -111249,12 +110526,10 @@ yuchaipg.com yuchaizm.com yuchenpharm.com yuchenw.com -yuchichem.com yuchofoodmachine.com yuchuan.org yuchuantech.com yuci998.com -yucne.com yucoolgame.com yucui.org yucunkeji.com @@ -111457,7 +110732,6 @@ yuhx.com yui06161shga.com yui06171shga.com yuiapi.com -yuike.com yujia.com yujiahui.com yujianpay.com @@ -111472,7 +110746,6 @@ yujunjie.com yujunren.com yujzw.com yukaiprecision.com -yukapril.com yukeinfo.com yukexinchem.com yukicat.net @@ -111801,6 +111074,7 @@ yunqishi8.com yunqiyqh.com yunque360.com yunquna.com +yunrang.fun yunrenshi.net yunrg.com yunrongu.com @@ -112024,6 +111298,7 @@ yuwan-game.com yuwang.com yuwangcn.com yuwanjianshe.com +yuwanyouxi.com yuweikuijianzhan.com yuweitek.com yuweiyanwo.com @@ -112047,7 +111322,6 @@ yuxicorrosion.com yuxinews.com yuxingqiu.com yuxinoulogistics.com -yuxinqinhang.com yuxipark.com yuxitech.com yuxungs.com @@ -112097,7 +111371,6 @@ yuzua.com yuzundaojia.com yvv.in yvzfgigpiwmofux.com -yw020.com yw11.com yw160.com yw2005.com @@ -112241,7 +111514,6 @@ yxintent.com yxit.net yxixy.com yxjia.com -yxjidi.com yxjjdby.com yxjkhb.com yxjob.net @@ -112331,7 +111603,6 @@ yy591.com yy6.fun yy845.com yy960.com -yy99998.com yyarea.com yyblly.com yybnet.net @@ -112401,7 +111672,6 @@ yyming2.com yymoban.com yynetwk.com yynykj.com -yyos2.com yyouren.com yyoz.com yypf-china.com @@ -112455,6 +111725,7 @@ yyyeee.com yyyg.com yyyisp.com yyylll.com +yyymvp.com yyyncp.com yyyqm.com yyyvvv.com @@ -112530,7 +111801,6 @@ yzfcdn.com yzfchat.com yzfdc.net yzfjy.com -yzforex.com yzfrkf.com yzftpx.com yzfybj.com @@ -112665,7 +111935,6 @@ yzzxxz.com yzzy-online.com yzzy20-play.com yzzyimages.com -yzzzn.com z-bank.com z-henergy.com z-inn.com @@ -112715,7 +111984,6 @@ zabxib.com zac1993.com zachina.org zack.asia -zackku.com zacveh.com zaduonews.com zaecu.com @@ -112741,7 +112009,6 @@ zaiguahao.com zaih.com zaihuangshi.com zaijia.com -zaijiamaicai.com zaijiawan.com zailaboratory.com zailingtech.com @@ -112844,6 +112111,7 @@ zaucyih.com zawomkv.com zaxdcredit.com zaxisparts.com +zaxline.com zaxzn.com zaysz.com zazhidang.com @@ -112870,7 +112138,6 @@ zbchem.com zbcyrq.com zbdedu.com zbdzy.com -zbesa.com zbfilm.com zbgala.com zbgarden.cc @@ -113094,7 +112361,6 @@ zddr.com zddream.com zdeqs.com zdevo.com -zdexe.com zdfans.com zdfdc.com zdfei.com @@ -113162,7 +112428,6 @@ ze-introduce.com ze-invite.com ze-mp.com ze-wx.com -ze13.com zeaho.com zealer.com zeali.net @@ -113318,7 +112583,6 @@ zg-gyt.com zg-import.com zg-imsoft.com zg-seastar.com -zg-tianzi.com zg114jy.com zg114w.com zg114zs.com @@ -113520,7 +112784,6 @@ zgnjm.com zgnnwdkj.com zgnt.cc zgnt.net -zgnuan.com zgnwp.com zgny.com zgnyw.net @@ -113551,7 +112814,6 @@ zgrcjyw.com zgrd.org zgrdnews.com zgrlm.com -zgrmw.com zgruisai.com zgrzbj.com zgsclp.com @@ -113646,12 +112908,10 @@ zgxytc.com zgxyzx.net zgxzcj.com zgxzhjx.com -zgyaohua.com zgybsfxh.com zgycgc.com zgyeda.com zgyey.com -zgygsy.com zgygw.com zgyhbc.com zgyhys.org @@ -113688,7 +112948,6 @@ zgzpsjz.com zgzsa.com zgzsrc.com zgzszy.com -zgzxhg.com zgzy.net zgzypyw.com zgzyxxzs.com @@ -113740,7 +112999,6 @@ zhanbanji.com zhanbuba.com zhanchenyouqi.com zhanchily.com -zhanchuang1407.com zhandao.net zhandaren.com zhandian88.com @@ -114006,7 +113264,6 @@ zhcsgc.com zhctv.com zhcw.com zhcyanshi.com -zhdba.com zhdfg.com zhdgps.com zhdhq.com @@ -114019,7 +113276,6 @@ zhdxbj.com zhe.com zhe800.com zhe900.com -zhe97.com zhebei.com zhebeipharm.com zhebumai.com @@ -114056,7 +113312,6 @@ zhelixin.com zheliyin.com zhen-ao.com zhen.com -zhen22.com zhenai.com zhenaihn.com zhenandl.com @@ -114066,7 +113321,6 @@ zhenbi.com zhenbizi.com zhenbon.com zhenchu.cc -zhendagroup.com zhending-chicken.com zhendong365.com zhendonggames.com @@ -114264,7 +113518,6 @@ zhibaimeixue.com zhibeidy.com zhibiaow.com zhibitouzi.com -zhibo.me zhibo.tv zhibo8.cc zhibo8.com @@ -114389,7 +113642,6 @@ zhijiashe.com zhijidoc.com zhijie-edu.com zhijieguo.com -zhijiehuanyu.com zhijieketang.com zhijin.com zhijinwang.com @@ -114410,7 +113662,6 @@ zhil.cloud zhilandaren.com zhilehuo.com zhileiqiye.com -zhileng.com zhilepin.com zhilian-nb.com zhilian.com @@ -114502,7 +113753,6 @@ zhishif.com zhishifanli.com zhishifenzi.com zhishinn.com -zhishiq.com zhishisoft.com zhishiu.com zhishiv.com @@ -114584,6 +113834,7 @@ zhiyuanshijie.com zhiyuanxinglvye.com zhiyuanyun.com zhiyuanzhongyi.com +zhiyuapp.com zhiyueit.com zhiyuequan.com zhiyun-cn.com @@ -114698,7 +113949,6 @@ zhongcetech.com zhongche.com zhongchebaolian.com zhongchewuliu.com -zhongchoujia.com zhongchouke.com zhongchuang365.com zhongchuangwenhua.com @@ -114806,7 +114056,6 @@ zhongmingjiaoyu.net zhongnakeji.com zhongnengrecycling.com zhongnice.com -zhongniu.com zhongnongjimu.com zhongp.com zhongpaiwang.com @@ -114893,7 +114142,6 @@ zhongyapeicui.com zhongyasmart.com zhongyejy.com zhongyf.com -zhongyi1985.com zhongyi6.com zhongyi9999.com zhongyibaodian.com @@ -114984,6 +114232,7 @@ zhpecc.com zhpharm-sh.com zhqgtjxh.com zhqyue.com +zhrct.com zhrczp.com zhrtc.com zhsapphire.com @@ -115188,7 +114437,6 @@ zhuluyy.com zhumanggroup.com zhumanggroup.net zhumaweb.com -zhumengqinziyou.com zhumengwl.com zhumingepc.com zhumiquan.com @@ -115204,7 +114452,6 @@ zhundaoyun.com zhuneijs.com zhuniangjia.com zhuniu.com -zhunkua.net zhunnai.com zhunshitianqi.com zhunter.com @@ -115227,7 +114474,6 @@ zhuolaoshi.com zhuolaoshi.net zhuoligk.com zhuomaiyun.com -zhuomajidian.com zhuomiles.com zhuomogroup.com zhuoquapp.com @@ -115405,7 +114651,6 @@ zigaokj.com zige365.com zigeer.com zigonggroup.com -zigongyinuo.com ziguhonglan.com zihai0351.com zihai0535.com @@ -115535,7 +114780,6 @@ ziwanyouxi.com ziweicn.com ziweifu.com ziweihuan.com -ziwojianding.net ziwoyou.net ziwufang.com ziwuyunjiao.com @@ -115566,7 +114810,6 @@ ziyimall.com ziying.site ziyou.com ziyou.studio -ziyouad.com ziyoufa.com ziyouma.net ziyouwu.com @@ -115964,7 +115207,6 @@ zjlljt.com zjlottery.com zjlsbz.com zjlsedu.org -zjlskd.com zjlvjie.com zjlxjs.com zjlxtx.com @@ -116089,7 +115331,6 @@ zjskgr.com zjskjt.com zjslep.com zjslzh.com -zjsmhg.com zjsms.com zjspas.com zjssjt.com @@ -116254,7 +115495,6 @@ zjzhongtian.com zjzj.net zjzj.org zjzjjx.com -zjznk.com zjzoneng.com zjzramc.com zjzrzyjy.com @@ -116576,7 +115816,6 @@ zntcexpo.com zntschool.com zntvrom.com zntx.cc -zntzdj.com znum.com znwb.com znxdxs.com @@ -116626,6 +115865,7 @@ zonafs.com zonboapp.com zonci.com zone-king.com +zone.id zone139.com zoneben.com zoneidc.com @@ -116790,7 +116030,6 @@ zqins.com zqjcedu.com zqjiese.com zqjinneng.com -zqjjr.com zqkjy.com zqlian.com zqlx.com @@ -116873,7 +116112,6 @@ zsaxi.com zsb2c.com zsbbk.com zsbeike.com -zsbk.net zsboai.com zsbqgz.com zsbsoft.com @@ -116939,11 +116177,9 @@ zsimc.com zsincer.com zsite.com zsj18.com -zsjcxh.com zsjdxh.org zsjhsjy.com zsjhx.com -zsjinqi.com zsjjob.com zsjjyp.com zsjuchuang.com @@ -117316,7 +116552,6 @@ zuzuche.com zuzuqueen.com zviewcloud.com zving.com -zvr1f.com zvryuq7xg31x5g.com zvstapp.com zvsts.com @@ -117385,7 +116620,6 @@ zwyll.com zwzdiy.cc zwzrent.com zwzsh.net -zwzyd.com zwzyzx.com zx-tour.com zx-xcx.com @@ -117570,7 +116804,6 @@ zyfchina.com zyfj.com zyfsz.net zygames.com -zygg.cc zygj.net zygjtzjt.com zygs.com @@ -117687,7 +116920,6 @@ zyzl120.com zyzw.com zz-hh.com zz-invest.com -zz-zigzag.com zz.ci zz123456789.xyz zz2024.com @@ -117718,7 +116950,6 @@ zzc9.com zzccom.com zzccp.com zzcdnx.com -zzcdsl.com zzcjby.com zzcjxy.com zzcm1.com @@ -117742,6 +116973,7 @@ zzfeilu.com zzfly.net zzfreshair.com zzfriend.com +zzfxfz.com zzgcjyzx.com zzgd.tv zzgdapp.com @@ -117751,7 +116983,6 @@ zzgkyy.com zzgtjtgs.com zzguest.com zzguifan.com -zzh789.com zzhaofang.com zzhaoz.com zzhbgs.com @@ -117813,6 +117044,7 @@ zzqss.com zzquan9.com zzqudu.com zzqxs.com +zzqz2024.com zzqzz.com zzrc.net zzrcw.net diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute index 42e018d405..a111f3db49 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute @@ -53,6 +53,7 @@ 101.198.0.0/22 101.198.160.0/19 101.198.192.0/19 +101.198.4.0/24 101.199.112.0/24 101.199.128.0/23 101.199.196.0/22 @@ -89,6 +90,8 @@ 101.248.0.0/15 101.251.0.0/22 101.251.128.0/19 +101.251.160.0/20 +101.251.176.0/22 101.251.192.0/18 101.251.80.0/20 101.254.0.0/20 @@ -207,7 +210,7 @@ 103.126.101.0/24 103.126.102.0/23 103.126.124.0/22 -103.126.18.0/23 +103.126.19.0/24 103.13.12.0/24 103.13.244.0/22 103.130.160.0/23 @@ -253,6 +256,7 @@ 103.145.92.0/24 103.146.126.0/23 103.147.124.0/24 +103.149.111.0/24 103.149.181.0/24 103.149.242.0/24 103.149.244.0/22 @@ -264,6 +268,7 @@ 103.150.212.0/24 103.150.24.0/23 103.151.148.0/23 +103.151.179.0/24 103.151.216.0/23 103.151.228.0/23 103.151.5.0/24 @@ -281,6 +286,7 @@ 103.154.30.0/23 103.154.41.0/24 103.155.110.0/23 +103.155.120.0/23 103.155.76.0/23 103.156.174.0/23 103.156.186.0/23 @@ -311,8 +317,8 @@ 103.175.197.0/24 103.177.28.0/23 103.179.78.0/23 -103.18.186.0/24 103.180.108.0/23 +103.181.164.0/23 103.181.234.0/24 103.183.122.0/23 103.183.124.0/23 @@ -387,7 +393,7 @@ 103.21.140.0/22 103.21.176.0/22 103.210.160.0/22 -103.210.170.0/23 +103.210.171.0/24 103.211.220.0/22 103.211.44.0/22 103.212.1.0/24 @@ -655,6 +661,7 @@ 103.42.8.0/22 103.43.132.0/24 103.43.134.0/23 +103.43.175.0/24 103.43.184.0/22 103.43.240.0/23 103.44.144.0/22 @@ -685,7 +692,7 @@ 103.49.196.0/24 103.49.198.0/23 103.5.192.0/22 -103.50.36.0/22 +103.50.38.0/24 103.51.62.0/23 103.52.100.0/22 103.52.104.0/23 @@ -744,6 +751,7 @@ 103.71.232.0/22 103.71.68.0/22 103.72.113.0/24 +103.72.120.0/22 103.72.172.0/24 103.73.116.0/22 103.73.136.0/21 @@ -768,7 +776,7 @@ 103.78.60.0/22 103.79.120.0/22 103.79.200.0/22 -103.79.228.0/23 +103.79.228.0/24 103.79.24.0/22 103.8.220.0/22 103.8.32.0/22 @@ -957,6 +965,7 @@ 110.218.192.0/20 110.218.224.0/20 110.218.32.0/20 +110.219.128.0/17 110.219.64.0/22 110.219.68.0/24 110.228.0.0/14 @@ -1028,7 +1037,6 @@ 111.235.178.0/23 111.235.180.0/23 111.235.182.0/24 -111.67.192.0/20 111.72.0.0/13 111.85.0.0/16 112.0.0.0/10 @@ -1220,7 +1228,8 @@ 115.175.64.0/19 115.182.0.0/15 115.190.0.0/17 -115.190.128.0/19 +115.190.128.0/18 +115.190.192.0/20 115.192.0.0/11 115.224.0.0/12 115.24.0.0/14 @@ -1229,6 +1238,7 @@ 115.32.0.0/19 115.32.32.0/21 115.32.56.0/21 +115.32.64.0/20 115.44.0.0/14 115.48.0.0/12 115.84.0.0/18 @@ -1419,7 +1429,8 @@ 118.178.0.0/16 118.180.0.0/14 118.184.0.0/22 -118.184.104.0/22 +118.184.105.0/24 +118.184.106.0/23 118.184.128.0/17 118.184.30.0/24 118.184.40.0/21 @@ -1427,7 +1438,6 @@ 118.184.52.0/24 118.184.64.0/24 118.184.66.0/23 -118.184.69.0/24 118.184.76.0/22 118.184.81.0/24 118.184.82.0/23 @@ -1474,8 +1484,7 @@ 118.192.70.0/24 118.192.96.0/19 118.193.128.0/23 -118.193.138.0/24 -118.193.144.0/23 +118.193.144.0/24 118.193.152.0/22 118.193.160.0/23 118.193.162.0/24 @@ -1488,8 +1497,8 @@ 118.194.240.0/21 118.194.32.0/19 118.195.0.0/16 -118.196.0.0/19 -118.196.32.0/20 +118.196.0.0/18 +118.196.64.0/19 118.199.0.0/16 118.202.0.0/15 118.212.0.0/15 @@ -1588,7 +1597,6 @@ 119.255.128.0/17 119.255.63.0/24 119.27.160.0/19 -119.27.64.0/18 119.28.28.0/24 119.29.0.0/16 119.3.0.0/16 @@ -1985,11 +1993,7 @@ 124.172.0.0/15 124.192.0.0/15 124.196.0.0/24 -124.196.10.0/23 124.196.12.0/23 -124.196.17.0/24 -124.196.18.0/23 -124.196.20.0/24 124.196.25.0/24 124.196.26.0/23 124.196.28.0/24 @@ -2002,12 +2006,9 @@ 124.196.56.0/23 124.196.58.0/24 124.196.66.0/24 -124.196.72.0/24 -124.196.76.0/23 -124.196.78.0/24 +124.196.77.0/24 124.196.80.0/22 124.196.84.0/24 -124.196.9.0/24 124.200.0.0/16 124.202.0.0/16 124.203.176.0/20 @@ -2030,7 +2031,6 @@ 124.40.128.0/18 124.42.0.0/16 124.47.0.0/18 -124.6.64.0/18 124.64.0.0/15 124.66.0.0/17 124.67.0.0/16 @@ -2190,8 +2190,7 @@ 150.138.0.0/15 150.158.0.0/16 150.223.0.0/16 -150.242.120.0/24 -150.242.122.0/23 +150.242.120.0/22 150.242.156.0/22 150.242.168.0/22 150.242.184.0/22 @@ -2205,7 +2204,6 @@ 150.242.96.0/22 150.255.0.0/16 151.241.174.0/24 -151.242.65.0/24 152.104.128.0/17 152.136.0.0/16 153.0.0.0/16 @@ -2221,6 +2219,7 @@ 154.208.160.0/21 154.208.172.0/23 154.213.4.0/23 +154.218.6.0/23 154.223.168.0/24 154.223.179.0/24 154.223.180.0/24 @@ -2232,11 +2231,14 @@ 154.8.128.0/17 154.91.158.0/23 155.117.164.0/24 +155.117.188.0/24 155.126.176.0/23 156.107.160.0/24 156.107.170.0/24 156.107.179.0/24 156.107.181.0/24 +156.227.1.0/24 +156.227.24.0/22 156.230.11.0/24 156.231.163.0/24 156.236.116.0/24 @@ -2315,10 +2317,6 @@ 167.148.46.0/24 167.189.0.0/16 167.220.244.0/22 -168.159.144.0/21 -168.159.152.0/22 -168.159.156.0/23 -168.159.158.0/24 168.160.0.0/17 168.160.152.0/24 168.160.158.0/23 @@ -2366,6 +2364,7 @@ 175.42.0.0/15 175.44.0.0/16 175.46.0.0/15 +178.219.5.0/24 178.253.239.0/24 180.129.128.0/17 180.130.0.0/16 @@ -2449,7 +2448,7 @@ 182.61.128.0/19 182.61.192.0/22 182.61.200.0/21 -182.61.216.0/21 +182.61.208.0/20 182.61.224.0/19 182.80.0.0/13 182.88.0.0/14 @@ -2479,14 +2478,12 @@ 185.75.173.0/24 185.75.174.0/24 188.131.128.0/17 -192.102.204.0/22 192.140.160.0/19 192.140.208.0/21 192.144.128.0/17 192.163.11.0/24 192.232.97.0/24 192.55.46.0/24 -192.55.68.0/22 193.112.0.0/16 193.119.10.0/23 193.119.12.0/23 @@ -2494,6 +2491,7 @@ 193.119.17.0/24 193.119.19.0/24 193.119.20.0/23 +193.119.22.0/24 193.119.25.0/24 193.119.28.0/24 193.119.30.0/24 @@ -2507,7 +2505,6 @@ 194.138.245.0/24 194.15.39.0/24 195.114.203.0/24 -198.175.100.0/22 198.208.112.0/23 198.208.17.0/24 198.208.19.0/24 @@ -2573,7 +2570,6 @@ 202.153.48.0/20 202.158.160.0/19 202.160.140.0/22 -202.164.0.0/20 202.164.25.0/24 202.168.160.0/19 202.170.128.0/19 @@ -2688,7 +2684,7 @@ 203.119.26.0/23 203.119.28.0/22 203.119.33.0/24 -203.119.80.0/23 +203.119.80.0/24 203.119.83.0/24 203.12.204.0/23 203.12.91.0/24 @@ -2932,7 +2928,6 @@ 203.83.56.0/21 203.86.0.0/19 203.86.112.0/24 -203.86.116.0/24 203.86.254.0/23 203.86.43.0/24 203.86.44.0/23 @@ -3223,7 +3218,7 @@ 211.97.0.0/17 211.97.128.0/19 211.97.160.0/21 -211.97.190.0/24 +211.97.176.0/20 211.97.192.0/18 211.98.0.0/16 211.99.128.0/18 @@ -3233,6 +3228,7 @@ 211.99.32.0/19 211.99.64.0/18 211.99.8.0/21 +212.100.186.0/24 212.129.128.0/17 212.64.0.0/17 218.0.0.0/11 @@ -3537,7 +3533,6 @@ 223.240.0.0/13 223.248.0.0/14 223.252.194.0/24 -223.252.196.0/24 223.252.199.0/24 223.252.200.0/23 223.252.202.0/24 @@ -3601,6 +3596,7 @@ 36.213.192.0/20 36.213.208.0/23 36.213.210.0/24 +36.221.0.0/17 36.248.0.0/14 36.255.116.0/22 36.255.128.0/22 @@ -3620,6 +3616,7 @@ 36.56.0.0/13 36.96.0.0/12 38.111.220.0/23 +38.211.199.0/24 39.104.0.0/14 39.108.0.0/16 39.128.0.0/10 @@ -3661,7 +3658,8 @@ 42.240.12.0/24 42.240.128.0/17 42.240.16.0/24 -42.240.20.0/24 +42.240.20.0/23 +42.240.22.0/24 42.240.8.0/22 42.242.0.0/15 42.244.0.0/14 @@ -3681,7 +3679,6 @@ 42.83.189.0/24 42.83.190.0/24 42.83.200.0/23 -42.83.255.0/24 42.84.0.0/14 42.88.0.0/13 42.96.128.0/17 @@ -3741,7 +3738,8 @@ 43.229.216.0/22 43.229.48.0/22 43.230.136.0/22 -43.230.220.0/22 +43.230.221.0/24 +43.230.222.0/23 43.230.72.0/22 43.231.144.0/20 43.231.160.0/21 @@ -3887,8 +3885,7 @@ 45.116.208.0/22 45.116.32.0/22 45.116.52.0/22 -45.117.68.0/24 -45.117.70.0/23 +45.117.68.0/22 45.117.8.0/22 45.119.105.0/24 45.119.116.0/22 @@ -3934,7 +3931,7 @@ 45.248.8.0/22 45.249.208.0/23 45.249.212.0/22 -45.250.152.0/24 +45.250.152.0/23 45.250.180.0/23 45.250.184.0/22 45.250.188.0/24 @@ -4194,6 +4191,7 @@ 66.102.248.0/22 66.102.252.0/24 66.102.254.0/23 +66.92.248.0/24 68.79.0.0/18 69.163.104.0/24 69.163.106.0/24 @@ -4207,6 +4205,7 @@ 71.132.0.0/18 71.136.64.0/18 71.137.0.0/18 +74.122.24.0/24 77.107.118.0/24 8.128.32.0/19 8.128.64.0/19 @@ -4228,7 +4227,7 @@ 8.150.64.0/23 8.152.0.0/13 8.160.0.0/15 -8.162.0.0/19 +8.162.0.0/18 8.163.0.0/16 8.164.0.0/16 81.173.18.0/23 @@ -4236,9 +4235,7 @@ 81.173.28.0/24 81.68.0.0/14 82.156.0.0/15 -82.206.108.0/24 84.247.114.0/24 84.54.2.0/23 85.237.205.0/24 -89.149.17.0/24 94.191.0.0/17 diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 index 18154cd717..68e936be55 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 @@ -30,6 +30,7 @@ 2400:5f60::/32 2400:6000::/32 2400:6460:300::/40 +2400:6460:500::/40 2400:6460::/39 2400:6600::/32 2400:6e60:1301::/48 @@ -162,7 +163,6 @@ 2401:7e00::/32 2401:800::/32 2401:8be0::/48 -2401:8d00:10::/48 2401:8d00:12::/48 2401:8d00:14::/48 2401:8d00:4::/48 @@ -204,10 +204,11 @@ 2401:f860:86::/47 2401:f860:88::/47 2401:f860:90::/46 -2401:f860:94::/48 -2401:f860:c::/48 -2401:f860:e::/48 +2401:f860:94::/47 +2401:f860:a::/47 +2401:f860:c::/46 2401:f860:f100::/40 +2401:f860:f6::/48 2401:fa00:40::/43 2402:1440::/32 2402:2000::/32 @@ -349,7 +350,7 @@ 2404:e280::/47 2404:e5c0::/32 2404:e8c0::/32 -2404:f4c0:f000::/44 +2404:f4c0::/32 2405:1480:1000::/48 2405:1480:2000::/48 2405:1480:3000::/47 @@ -452,7 +453,8 @@ 2406:840:fda0::/43 2406:840:fdc0::/44 2406:840:fdd1::/48 -2406:840:fde1::/48 +2406:840:fde5::/48 +2406:840:fde6::/47 2406:840:fe27::/48 2406:840:fe90::/46 2406:840:fe94::/48 @@ -473,7 +475,7 @@ 2406:840:fed1::/48 2406:840:fed8::/48 2406:840:fedb::/48 -2406:840:fedc::/48 +2406:840:fedc::/47 2406:840:fedf::/48 2406:840:fef0::/48 2406:840:fef3::/48 @@ -575,6 +577,7 @@ 2408:8181:a000::/40 2408:8181:a220::/44 2408:8181:e000::/40 +2408:8182:6000::/40 2408:8182:c000::/40 2408:8183:4000::/40 2408:8183:8000::/40 @@ -1100,7 +1103,6 @@ 240a:4020:883a::/48 240a:4021:83a::/48 240a:4021:883a::/48 -240a:4083::/35 240a:4084:2000::/35 240a:4088:a000::/35 240a:408c:2000::/35 @@ -1118,7 +1120,6 @@ 240a:4090:5200::/40 240a:4090:7000::/39 240a:4090:7200::/40 -240a:4090:a000::/35 240a:4093::/35 240a:4094:2000::/35 240a:409c:2000::/35 @@ -1171,6 +1172,7 @@ 240a:41f2::/31 240a:420a::/31 240a:4224:9000::/44 +240a:4224:a000::/44 240a:4224:d000::/44 240a:4224:e000::/44 240a:4230::/31 @@ -1197,8 +1199,10 @@ 240e::/20 2602:2e0:ff::/48 2602:f7ee:ee::/48 +2602:f92a:a478::/48 +2602:f92a:d1ff::/48 +2602:f92a:dead::/48 2602:f92a:e100::/44 -2602:f92a:f000::/48 2602:f93b:400::/38 2602:f9ba:10c::/48 2602:f9ba:a8::/48 @@ -1224,6 +1228,7 @@ 2620:57:4004::/48 2804:1e48:9001::/48 2804:1e48:9002::/48 +2a01:f100:100::/48 2a01:f100:1f8::/48 2a01:ffc7:100::/40 2a03:5840:126::/48 @@ -1316,6 +1321,7 @@ 2a0e:aa07:e162::/48 2a0e:aa07:e16a::/48 2a0e:aa07:e1a0::/44 +2a0e:aa07:e1e1::/48 2a0e:aa07:e1e2::/47 2a0e:aa07:e1e4::/47 2a0e:aa07:e1e6::/48 @@ -1356,15 +1362,18 @@ 2a0f:7803:fe82::/48 2a0f:7804:f650::/44 2a0f:7804:f9f0::/44 +2a0f:7807::/32 2a0f:7d07::/32 2a0f:85c1:ba5::/48 2a0f:85c1:ca0::/44 2a0f:85c1:ce1::/48 +2a0f:85c1:cf1::/48 2a0f:9400:6110::/48 2a0f:9400:7700::/48 2a0f:ac00::/29 2a0f:ea47:fc1d::/48 2a10:2f00:15a::/48 +2a10:67c2:2::/48 2a10:ccc0:d00::/46 2a10:ccc0:d0a::/47 2a10:ccc0:d0c::/47 @@ -1387,12 +1396,16 @@ 2a13:a5c7:2102::/48 2a13:a5c7:2121::/48 2a13:a5c7:2301::/48 +2a13:a5c7:2302::/48 2a13:a5c7:23c0::/42 +2a13:a5c7:2600::/40 2a13:a5c7:2801::/48 2a13:a5c7:2803::/48 2a13:a5c7:3108::/48 2a13:a5c7:31a0::/43 -2a13:a5c7:3307::/48 +2a13:a5c7:3301::/48 +2a13:a5c7:3304::/48 +2a13:a5c7:3306::/47 2a13:aac4:f000::/44 2a14:4c41::/32 2a14:67c1:20::/44 @@ -1410,14 +1423,12 @@ 2a14:67c1:a040::/47 2a14:67c1:a061::/48 2a14:67c1:a064::/48 -2a14:67c1:a090::/46 -2a14:67c1:a094::/47 -2a14:67c1:a096::/48 +2a14:67c1:a090::/45 2a14:67c1:a099::/48 2a14:67c1:a100::/43 2a14:67c1:a125::/48 -2a14:67c1:a127::/48 2a14:67c1:a144::/48 +2a14:67c1:a150::/44 2a14:67c1:b000::/48 2a14:67c1:b065::/48 2a14:67c1:b066::/48 @@ -1441,10 +1452,10 @@ 2a14:67c1:b581::/48 2a14:67c1:b582::/48 2a14:67c1:b588::/47 -2a14:67c1:b590::/48 +2a14:67c1:b590::/47 2a14:67c1:b599::/48 2a14:67c5:1900::/40 -2a14:7580:72f::/48 +2a14:7580:740::/44 2a14:7580:750::/47 2a14:7580:9200::/40 2a14:7580:9400::/39 @@ -1458,6 +1469,7 @@ 2a14:7580:fe00::/40 2a14:7580:fff4::/48 2a14:7580:fff7::/48 +2a14:7580:fffa::/48 2a14:7581:3100::/40 2a14:7581:3400::/47 2a14:7581:9010::/44 @@ -1484,9 +1496,20 @@ 2a14:7581:bcd::/48 2a14:7581:bff::/48 2a14:7581:ffb::/48 +2a14:7581:ffd::/48 2a14:7583:f201::/48 2a14:7583:f203::/48 -2a14:7583:f300::/40 +2a14:7583:f300::/46 +2a14:7583:f304::/48 +2a14:7583:f4fe::/48 +2a14:7583:f500::/48 +2a14:7583:f701::/48 +2a14:7583:f702::/47 +2a14:7583:f704::/47 +2a14:7583:f707::/48 +2a14:7583:f708::/48 +2a14:7583:f743::/48 +2a14:7583:f764::/48 2a14:7584::/36 2a14:7c0:4a01::/48 2c0f:f7a8:8011::/48 diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/gfwlist b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/gfwlist index 1d4885deca..45ad5e8186 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/gfwlist +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/gfwlist @@ -138,6 +138,7 @@ abematv.akamaized.net abitno.linpie.com ablwang.com aboluowang.com +about.gitlab.com about.me abplive.com abs.edu @@ -734,6 +735,8 @@ brutaltgp.com bsky.app bsky.network bsky.social +bt4g.org +bt4gprx.com bt95.com btaia.com btbit.net @@ -1898,6 +1901,7 @@ gaopi.net gardennetworks.com gardennetworks.org gartlive.com +garudalinux.org gate.io gatecoin.com gather.com @@ -2700,6 +2704,7 @@ iphone4hongkong.com iphonetaiwan.org iphonix.fr ipicture.ru +ipify.org ipjetable.net ipobar.com ipoock.com @@ -3176,6 +3181,7 @@ mcadforums.com mcaf.ee mcfog.com mcreasite.com +mcusercontent.com md-t.org me.me me.ns.ci @@ -3550,6 +3556,7 @@ ninecommentaries.com ninjacloak.com ninjaproxy.ninja nintendium.com +nirsoft.net nitter.cc nitter.net niu.moe @@ -4368,6 +4375,7 @@ simplecd.org simpleproductivityblog.com simpleswap.io simplex.chat +sina.com.hk sinchew.com.my singaporepools.com.sg singfortibet.com @@ -4667,11 +4675,13 @@ taiwantt.org.tw taiwanus.net taiwanyes.ning.com talk853.com +talkatone.com talkboxapp.com talkcc.com talkonly.net tanc.org tangren.us +tanks.gg taoism.net tapanwap.com tapatalk.com @@ -5141,7 +5151,6 @@ ubddns.org uberproxy.net uc-japan.org uchicago.edu -uderzo.it udn.com udn.com.tw udnbkk.com @@ -5378,6 +5387,7 @@ vpnvip.com vpnworldwide.com vporn.com vpser.net +vpsxb.net vraiesagesse.net vrchat.com vrmtr.com diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/subscribe.lua index e3af7413b3..a0a5fd82f9 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -1122,6 +1122,9 @@ local function processData(szType, content, add_mode, add_from) if not params.type then params.type = "tcp" end params.type = string.lower(params.type) + if ({ xhttp=true, kcp=true, mkcp=true })[params.type] and result.type ~= "Xray" and has_xray then + result.type = "Xray" + end if result.type == "sing-box" and params.type == "raw" then params.type = "tcp" elseif result.type == "Xray" and params.type == "tcp" then diff --git a/openwrt-passwall2/luci-app-passwall2/Makefile b/openwrt-passwall2/luci-app-passwall2/Makefile index ef30315bf6..501d071b89 100644 --- a/openwrt-passwall2/luci-app-passwall2/Makefile +++ b/openwrt-passwall2/luci-app-passwall2/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 -PKG_VERSION:=25.9.20 +PKG_VERSION:=25.9.24 PKG_RELEASE:=1 PKG_CONFIG_DEPENDS:= \ diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua index 11b3f173ea..ffa58a986a 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua @@ -124,6 +124,11 @@ if #hysteria2_type > 0 then end end +if #ss_type > 0 or #trojan_type > 0 or #vmess_type > 0 or #vless_type > 0 or #hysteria2_type > 0 then + o.description = string.format("%s", + translate("The configured type also applies to the core specified when manually importing nodes.")) +end + o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node.")) o.default = "" o:value("", translate("Auto")) diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua index b4c811fd6b..b0af935ce1 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua @@ -122,7 +122,7 @@ function o.custom_write(self, section, value) else result = { value } end - api.uci:set_list(appname, section, "balancing_node", result) + m.uci:set_list(appname, section, "balancing_node", result) end o = s:option(ListValue, _n("balancingStrategy"), translate("Balancing Strategy")) diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua index c8dc18c7b9..518cbf908b 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua @@ -132,7 +132,7 @@ function o.custom_write(self, section, value) else result = { value } end - api.uci:set_list(appname, section, "urltest_node", result) + m.uci:set_list(appname, section, "urltest_node", result) end o = s:option(Value, _n("urltest_url"), translate("Probe URL")) diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm b/openwrt-passwall2/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm index db2dde9e77..493231728f 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm @@ -793,6 +793,7 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ if (ssrurl === null || ssrurl === "") { return false; } + ssrurl = ssrurl.replace(/&/gi, '&').replace(/\s*#\s*/, '#').trim(); //一些奇葩的链接用"&"当做"&","#"前后带空格 s.innerHTML = ""; var ssu = ssrurl.split('://'); var event = document.createEvent("HTMLEvents"); @@ -870,6 +871,8 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ if (userInfoSplitIndex !== -1) { method = userInfo.substr(0, userInfoSplitIndex); password = userInfo.substr(userInfoSplitIndex + 1); + } else { + password = url0.substr(0, sipIndex); //一些链接用明文uuid做密码 } } else { // base64(method:pass@host:port) @@ -908,14 +911,14 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ pluginOpts = pluginParams.join(";"); } - if (ss_type == "sing-box" && has_singbox) { - dom_prefix = "singbox_" - opt.set('type', "sing-box"); - opt.set(dom_prefix + 'protocol', "shadowsocks"); - } else if (ss_type == "xray" && has_xray) { + if (has_xray && ((ss_type !== "xray" && ss_type !== "sing-box" && queryParam.type) || ss_type == "xray")) { dom_prefix = "xray_" opt.set('type', "Xray"); opt.set(dom_prefix + 'protocol', "shadowsocks"); + } else if (has_singbox && ((ss_type !== "xray" && ss_type !== "sing-box" && queryParam.type) || ss_type == "sing-box")) { + dom_prefix = "singbox_" + opt.set('type', "sing-box"); + opt.set(dom_prefix + 'protocol', "shadowsocks"); } else if (ss_type == "shadowsocks-rust") { dom_prefix = "ssrust_" opt.set('type', "SS-Rust"); @@ -928,10 +931,14 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ opt.set('type', "SS"); } } - if (ss_type !== "xray") { - method = method.toLowerCase() === "chacha20-poly1305" ? "chacha20-ietf-poly1305" : method; - method = method.toLowerCase() === "xchacha20-poly1305" ? "xchacha20-ietf-poly1305" : method; - } + + const _method = (method || "none").toLowerCase(); + const mapping = { + "chacha20-poly1305": "chacha20-ietf-poly1305", + "xchacha20-poly1305": "xchacha20-ietf-poly1305", + }; + method = mapping[_method] || _method; + opt.set(dom_prefix + 'address', unbracketIP(server)); opt.set(dom_prefix + 'port', port); opt.set(dom_prefix + 'password', password || ""); @@ -1324,16 +1331,13 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ dom_prefix = "xray_" opt.set('type', "Xray"); } - opt.set(dom_prefix + 'protocol', "vless"); + var m = parseNodeUrl(ssrurl); var password = m.passwd; if (password === "") { s.innerHTML = "<%:Invalid Share URL Format%>"; return false; } - opt.set(dom_prefix + 'uuid', password); - opt.set(dom_prefix + 'address', unbracketIP(m.hostname)); - opt.set(dom_prefix + 'port', m.port || "443"); var queryParam = {}; if (m.search.length > 1) { var query = m.search.replace('/?', '?').split('?') @@ -1346,6 +1350,16 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ } } + queryParam.type = queryParam.type.toLowerCase(); + if (["xhttp", "kcp", "mkcp"].includes(queryParam.type) && vless_type !== "xray" && has_xray) { + dom_prefix = "xray_" + opt.set('type', "Xray"); + } + opt.set(dom_prefix + 'protocol', "vless"); + opt.set(dom_prefix + 'uuid', password); + opt.set(dom_prefix + 'address', unbracketIP(m.hostname)); + opt.set(dom_prefix + 'port', m.port || "443"); + opt.set(dom_prefix + 'encryption', queryParam.encryption || "none"); if (queryParam.security) { if (queryParam.security == "tls") { @@ -1385,7 +1399,6 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ } - queryParam.type = queryParam.type.toLowerCase(); if (queryParam.type === "kcp" || queryParam.type === "mkcp") { queryParam.type = "mkcp"; } diff --git a/openwrt-passwall2/luci-app-passwall2/po/zh-cn/passwall2.po b/openwrt-passwall2/luci-app-passwall2/po/zh-cn/passwall2.po index 13d4d3613b..4d2711f592 100644 --- a/openwrt-passwall2/luci-app-passwall2/po/zh-cn/passwall2.po +++ b/openwrt-passwall2/luci-app-passwall2/po/zh-cn/passwall2.po @@ -1833,3 +1833,6 @@ msgstr "客户端版本" msgid "Random version will be used if empty." msgstr "如留空,则使用随机版本。" + +msgid "The configured type also applies to the core specified when manually importing nodes." +msgstr "配置的类型同样适用于手动导入节点时所指定的核心程序。" diff --git a/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua b/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua index af71e71cfc..4507b0bd52 100755 --- a/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua +++ b/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua @@ -688,8 +688,13 @@ local function processData(szType, content, add_mode, add_from) else userinfo = base64Decode(hostInfo[1]) end - local method = userinfo:sub(1, userinfo:find(":") - 1) - local password = userinfo:sub(userinfo:find(":") + 1, #userinfo) + local method, password + if userinfo:find(":") then + method = userinfo:sub(1, userinfo:find(":") - 1) + password = userinfo:sub(userinfo:find(":") + 1, #userinfo) + else + password = hostInfo[1] --一些链接用明文uuid做密码 + end -- 判断密码是否经过url编码 local function isURLEncodedPassword(pwd) @@ -704,12 +709,20 @@ local function processData(szType, content, add_mode, add_from) if isURLEncodedPassword(password) and decoded then password = decoded end + + local _method = (method or "none"):lower() + method = (_method == "chacha20-poly1305" and "chacha20-ietf-poly1305") or + (_method == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or _method + result.method = method result.password = password - if result.type ~= "Xray" then - result.method = (method:lower() == "chacha20-poly1305" and "chacha20-ietf-poly1305") or - (method:lower() == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or method + if has_xray and (result.type ~= 'Xray' and result.type ~= 'sing-box' and params.type) then + result.type = 'Xray' + result.protocol = 'shadowsocks' + elseif has_singbox and (result.type ~= 'Xray' and result.type ~= 'sing-box' and params.type) then + result.type = 'sing-box' + result.protocol = 'shadowsocks' end if result.plugin then @@ -1115,6 +1128,9 @@ local function processData(szType, content, add_mode, add_from) if not params.type then params.type = "tcp" end params.type = string.lower(params.type) + if ({ xhttp=true, kcp=true, mkcp=true })[params.type] and result.type ~= "Xray" and has_xray then + result.type = "Xray" + end if result.type == "sing-box" and params.type == "raw" then params.type = "tcp" elseif result.type == "Xray" and params.type == "tcp" then @@ -1810,9 +1826,9 @@ local function parse_link(raw, add_mode, add_from, cfgid) else -- ssd 外的格式 if add_mode == "1" then - nodes = split(raw:gsub(" ", "\n"), "\n") + nodes = split(raw, "\n") else - nodes = split(base64Decode(raw):gsub(" ", "\n"), "\n") + nodes = split(base64Decode(raw):gsub("\r\n", "\n"), "\n") end end @@ -1830,7 +1846,8 @@ local function parse_link(raw, add_mode, add_from, cfgid) local link = api.trim(dat[2]:gsub("#.*$", "")) result = processData(dat[1], base64Decode(link), add_mode, add_from) else - result = processData(dat[1], dat[2], add_mode, add_from) + local link = dat[2]:gsub("&", "&"):gsub("%s*#%s*", "#") -- 一些奇葩的链接用"&"当做"&","#"前后带空格 + result = processData(dat[1], link, add_mode, add_from) end end else diff --git a/shadowsocks-rust/Cargo.lock b/shadowsocks-rust/Cargo.lock index a7e464dc6c..3850f11656 100644 --- a/shadowsocks-rust/Cargo.lock +++ b/shadowsocks-rust/Cargo.lock @@ -554,7 +554,7 @@ dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -1592,7 +1592,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.0", "system-configuration", "tokio", "tower-service", @@ -1942,9 +1942,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.175" +version = "0.2.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" [[package]] name = "libloading" @@ -1953,7 +1953,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.53.3", ] [[package]] @@ -2678,7 +2678,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.5.10", + "socket2 0.6.0", "thiserror 2.0.16", "tokio", "tracing", @@ -2715,7 +2715,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.10", + "socket2 0.6.0", "tracing", "windows-sys 0.60.2", ] @@ -3167,9 +3167,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.223" +version = "1.0.226" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a505d71960adde88e293da5cb5eda57093379f64e61cf77bf0e6a63af07a7bac" +checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd" dependencies = [ "serde_core", "serde_derive", @@ -3196,18 +3196,18 @@ dependencies = [ [[package]] name = "serde_core" -version = "1.0.223" +version = "1.0.226" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20f57cbd357666aa7b3ac84a90b4ea328f1d4ddb6772b430caa5d9e1309bb9e9" +checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.223" +version = "1.0.226" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d428d07faf17e306e699ec1e91996e5a165ba5d6bce5b5155173e91a8a01a56" +checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33" dependencies = [ "proc-macro2", "quote", @@ -3310,7 +3310,7 @@ dependencies = [ "tokio-tfo", "trait-variant", "url", - "windows-sys 0.60.2", + "windows-sys 0.61.0", ] [[package]] @@ -3428,7 +3428,7 @@ dependencies = [ "trait-variant", "tun", "webpki-roots 1.0.2", - "windows-sys 0.60.2", + "windows-sys 0.61.0", "zstd", ] @@ -4358,7 +4358,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.60.2", ] [[package]] @@ -4376,7 +4376,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -4397,7 +4397,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -4409,7 +4409,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -4441,6 +4441,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -4448,7 +4454,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4457,7 +4463,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" dependencies = [ - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -4468,7 +4474,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4488,7 +4494,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4527,6 +4533,15 @@ dependencies = [ "windows-targets 0.53.3", ] +[[package]] +name = "windows-sys" +version = "0.61.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" +dependencies = [ + "windows-link 0.2.0", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -4564,7 +4579,7 @@ version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "windows-link", + "windows-link 0.1.3", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", @@ -4581,7 +4596,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] diff --git a/sing-box/.github/workflows/lint.yml b/sing-box/.github/workflows/lint.yml index e1485b38ff..6449686cab 100644 --- a/sing-box/.github/workflows/lint.yml +++ b/sing-box/.github/workflows/lint.yml @@ -32,7 +32,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v8 with: - version: latest + version: v2.4.0 args: --timeout=30m install-mode: binary verify: false diff --git a/sing-box/Makefile b/sing-box/Makefile index baeac70940..4997d7eaca 100644 --- a/sing-box/Makefile +++ b/sing-box/Makefile @@ -38,7 +38,7 @@ fmt: @gci write --custom-order -s standard -s "prefix(github.com/sagernet/)" -s "default" . fmt_install: - go install -v mvdan.cc/gofumpt@latest + go install -v mvdan.cc/gofumpt@v0.8.0 go install -v github.com/daixiang0/gci@latest lint: @@ -49,7 +49,7 @@ lint: GOOS=freebsd golangci-lint run ./... lint_install: - go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest + go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0 proto: @go run ./cmd/internal/protogen diff --git a/sing-box/docs/changelog.md b/sing-box/docs/changelog.md index 9a47766dae..5ad219d9f7 100644 --- a/sing-box/docs/changelog.md +++ b/sing-box/docs/changelog.md @@ -2,7 +2,7 @@ icon: material/alert-decagram --- -#### 1.13.0-alpha.17 +#### 1.13.0-alpha.18 * Fixes and improvements diff --git a/sing-box/experimental/libbox/service_pause.go b/sing-box/experimental/libbox/service_pause.go index 791684ecd4..9c888454f8 100644 --- a/sing-box/experimental/libbox/service_pause.go +++ b/sing-box/experimental/libbox/service_pause.go @@ -12,9 +12,7 @@ type iOSPauseFields struct { func (s *BoxService) Pause() { s.pauseManager.DevicePause() - if !C.IsIos { - s.instance.Router().ResetNetwork() - } else { + if C.IsIos { if s.endPauseTimer == nil { s.endPauseTimer = time.AfterFunc(time.Minute, s.pauseManager.DeviceWake) } else { @@ -26,7 +24,6 @@ func (s *BoxService) Pause() { func (s *BoxService) Wake() { if !C.IsIos { s.pauseManager.DeviceWake() - s.instance.Router().ResetNetwork() } } diff --git a/sing-box/go.mod b/sing-box/go.mod index debf2ef746..f2c07d61b3 100644 --- a/sing-box/go.mod +++ b/sing-box/go.mod @@ -27,7 +27,7 @@ require ( github.com/sagernet/gomobile v0.1.8 github.com/sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1 github.com/sagernet/quic-go v0.54.0-sing-box-mod.2 - github.com/sagernet/sing v0.8.0-beta.2 + github.com/sagernet/sing v0.8.0-beta.4 github.com/sagernet/sing-mux v0.3.3 github.com/sagernet/sing-quic v0.6.0-beta.2 github.com/sagernet/sing-shadowsocks v0.2.8 diff --git a/sing-box/go.sum b/sing-box/go.sum index 3e9411db1d..06d793fd57 100644 --- a/sing-box/go.sum +++ b/sing-box/go.sum @@ -159,8 +159,8 @@ github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/l github.com/sagernet/quic-go v0.54.0-sing-box-mod.2 h1:g3pJ8R8cMEt1le5YslP0x3MbT1ZAmAaE+wT095eLb8k= github.com/sagernet/quic-go v0.54.0-sing-box-mod.2/go.mod h1:OV+V5kEBb8kJS7k29MzDu6oj9GyMc7HA07sE1tedxz4= github.com/sagernet/sing v0.6.9/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak= -github.com/sagernet/sing v0.8.0-beta.2 h1:3khO2eE5LMylD/v47+pnVMtFzl6lBY2v/b/V+79qpsE= -github.com/sagernet/sing v0.8.0-beta.2/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak= +github.com/sagernet/sing v0.8.0-beta.4 h1:W26GdjiVbLgi8rNw8qD15KbKXEmE5uoOIe5uP/CLJl4= +github.com/sagernet/sing v0.8.0-beta.4/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak= github.com/sagernet/sing-mux v0.3.3 h1:YFgt9plMWzH994BMZLmyKL37PdIVaIilwP0Jg+EcLfw= github.com/sagernet/sing-mux v0.3.3/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA= github.com/sagernet/sing-quic v0.6.0-beta.2 h1:RHBespnerWt/PIPKpZZ3v+k4jKrQmb2MTxwTmjrBLm8= diff --git a/sing-box/transport/v2raywebsocket/conn.go b/sing-box/transport/v2raywebsocket/conn.go index 009cadd87b..cb788fc91d 100644 --- a/sing-box/transport/v2raywebsocket/conn.go +++ b/sing-box/transport/v2raywebsocket/conn.go @@ -291,7 +291,7 @@ func wrapWsError(err error) error { } var closedErr wsutil.ClosedError if errors.As(err, &closedErr) { - if closedErr.Code == ws.StatusNormalClosure { + if closedErr.Code == ws.StatusNormalClosure || closedErr.Code == ws.StatusNoStatusRcvd { err = io.EOF } } diff --git a/small/luci-app-fchomo/root/usr/share/fchomo/firewall_post.ut b/small/luci-app-fchomo/root/usr/share/fchomo/firewall_post.ut index 0753edaa25..80ddf84e01 100644 --- a/small/luci-app-fchomo/root/usr/share/fchomo/firewall_post.ut +++ b/small/luci-app-fchomo/root/usr/share/fchomo/firewall_post.ut @@ -218,6 +218,7 @@ chain {{ inchain }} { {%- function render_acl_dport(inchain, outchain, l4proto): %} chain {{ inchain }} { {#- DNS hijack #} + {# Always redirect port 53 #} meta l4proto { tcp, udp } th dport 53 counter goto {{ outchain }} comment "!{{ cfgname }}: DNS hijack (router)" {% if ((l4proto === 'tcp' || !l4proto) && routing_tcpport): %} diff --git a/small/luci-app-passwall/Makefile b/small/luci-app-passwall/Makefile index 0b91928e74..84ff929b8b 100644 --- a/small/luci-app-passwall/Makefile +++ b/small/luci-app-passwall/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=25.9.19 +PKG_VERSION:=25.9.23 PKG_RELEASE:=1 PKG_CONFIG_DEPENDS:= \ diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua index c5be76f3cc..a604594b36 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua @@ -130,6 +130,11 @@ if #hysteria2_type > 0 then end end +if #ss_type > 0 or #trojan_type > 0 or #vmess_type > 0 or #vless_type > 0 or #hysteria2_type > 0 then + o.description = string.format("%s", + translate("The configured type also applies to the core specified when manually importing nodes.")) +end + o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node.")) o.default = "" o:value("", translate("Auto")) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index 9f27a34334..f25b2c0a5e 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -119,7 +119,7 @@ function o.custom_write(self, section, value) else result = { value } end - api.uci:set_list(appname, section, "balancing_node", result) + m.uci:set_list(appname, section, "balancing_node", result) end o = s:option(ListValue, _n("balancingStrategy"), translate("Balancing Strategy")) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index 4c6b2f51d9..11028f2be7 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -126,7 +126,7 @@ function o.custom_write(self, section, value) else result = { value } end - api.uci:set_list(appname, section, "urltest_node", result) + m.uci:set_list(appname, section, "urltest_node", result) end o = s:option(Value, _n("urltest_url"), translate("Probe URL")) diff --git a/small/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm b/small/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm index 4922f4e260..e5f9242f6c 100644 --- a/small/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm +++ b/small/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm @@ -797,6 +797,7 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ if (ssrurl === null || ssrurl === "") { return false; } + ssrurl = ssrurl.replace(/&/gi, '&').replace(/\s*#\s*/, '#').trim(); //一些奇葩的链接用"&"当做"&","#"前后带空格 s.innerHTML = ""; var ssu = ssrurl.split('://'); var event = document.createEvent("HTMLEvents"); @@ -874,6 +875,8 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ if (userInfoSplitIndex !== -1) { method = userInfo.substr(0, userInfoSplitIndex); password = userInfo.substr(userInfoSplitIndex + 1); + } else { + password = url0.substr(0, sipIndex); //一些链接用明文uuid做密码 } } else { // base64(method:pass@host:port) @@ -912,14 +915,14 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ pluginOpts = pluginParams.join(";"); } - if (ss_type == "sing-box" && has_singbox) { - dom_prefix = "singbox_" - opt.set('type', "sing-box"); - opt.set(dom_prefix + 'protocol', "shadowsocks"); - } else if (ss_type == "xray" && has_xray) { + if (has_xray && ((ss_type !== "xray" && ss_type !== "sing-box" && queryParam.type) || ss_type == "xray")) { dom_prefix = "xray_" opt.set('type', "Xray"); opt.set(dom_prefix + 'protocol', "shadowsocks"); + } else if (has_singbox && ((ss_type !== "xray" && ss_type !== "sing-box" && queryParam.type) || ss_type == "sing-box")) { + dom_prefix = "singbox_" + opt.set('type', "sing-box"); + opt.set(dom_prefix + 'protocol', "shadowsocks"); } else if (ss_type == "shadowsocks-rust") { dom_prefix = "ssrust_" opt.set('type', "SS-Rust"); @@ -932,10 +935,14 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ opt.set('type', "SS"); } } - if (ss_type !== "xray") { - method = method.toLowerCase() === "chacha20-poly1305" ? "chacha20-ietf-poly1305" : method; - method = method.toLowerCase() === "xchacha20-poly1305" ? "xchacha20-ietf-poly1305" : method; - } + + const _method = (method || "none").toLowerCase(); + const mapping = { + "chacha20-poly1305": "chacha20-ietf-poly1305", + "xchacha20-poly1305": "xchacha20-ietf-poly1305", + }; + method = mapping[_method] || _method; + opt.set(dom_prefix + 'address', unbracketIP(server)); opt.set(dom_prefix + 'port', port); opt.set(dom_prefix + 'password', password || ""); @@ -1329,16 +1336,13 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ dom_prefix = "xray_" opt.set('type', "Xray"); } - opt.set(dom_prefix + 'protocol', "vless"); + var m = parseNodeUrl(ssrurl); var password = m.passwd; if (password === "") { s.innerHTML = "<%:Invalid Share URL Format%>"; return false; } - opt.set(dom_prefix + 'uuid', password); - opt.set(dom_prefix + 'address', unbracketIP(m.hostname)); - opt.set(dom_prefix + 'port', m.port || "443"); var queryParam = {}; if (m.search.length > 1) { var query = m.search.replace('/?', '?').split('?') @@ -1351,6 +1355,16 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ } } + queryParam.type = queryParam.type.toLowerCase(); + if (["xhttp", "kcp", "mkcp"].includes(queryParam.type) && vless_type !== "xray" && has_xray) { + dom_prefix = "xray_" + opt.set('type', "Xray"); + } + opt.set(dom_prefix + 'protocol', "vless"); + opt.set(dom_prefix + 'uuid', password); + opt.set(dom_prefix + 'address', unbracketIP(m.hostname)); + opt.set(dom_prefix + 'port', m.port || "443"); + opt.set(dom_prefix + 'encryption', queryParam.encryption || "none"); if (queryParam.security) { if (queryParam.security == "tls") { @@ -1390,7 +1404,6 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ } - queryParam.type = queryParam.type.toLowerCase(); if (queryParam.type === "kcp") { queryParam.type = "mkcp"; } diff --git a/small/luci-app-passwall/po/zh-cn/passwall.po b/small/luci-app-passwall/po/zh-cn/passwall.po index 75b11e1a36..83cc18e5c8 100644 --- a/small/luci-app-passwall/po/zh-cn/passwall.po +++ b/small/luci-app-passwall/po/zh-cn/passwall.po @@ -1986,3 +1986,6 @@ msgstr "客户端版本" msgid "Random version will be used if empty." msgstr "如留空,则使用随机版本。" + +msgid "The configured type also applies to the core specified when manually importing nodes." +msgstr "配置的类型同样适用于手动导入节点时所指定的核心程序。" diff --git a/small/luci-app-passwall/root/usr/share/passwall/app.sh b/small/luci-app-passwall/root/usr/share/passwall/app.sh index 110b3e75a4..2bd4245fc8 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/small/luci-app-passwall/root/usr/share/passwall/app.sh @@ -2280,8 +2280,8 @@ get_config() { RESOLVFILE=/tmp/resolv.conf.d/resolv.conf.auto [ -f "${RESOLVFILE}" ] && [ -s "${RESOLVFILE}" ] || RESOLVFILE=/tmp/resolv.conf.auto - ISP_DNS=$(cat $RESOLVFILE 2>/dev/null | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | sort -u | grep -v 0.0.0.0 | grep -v 127.0.0.1) - ISP_DNS6=$(cat $RESOLVFILE 2>/dev/null | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | awk -F % '{print $1}' | awk -F " " '{print $2}'| sort -u | grep -v -Fx ::1 | grep -v -Fx ::) + ISP_DNS=$(cat $RESOLVFILE 2>/dev/null | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -v -E '^(0\.0\.0\.0|127\.0\.0\.1)$' | awk '!seen[$0]++') + ISP_DNS6=$(cat $RESOLVFILE 2>/dev/null | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | awk -F % '{print $1}' | awk -F " " '{print $2}' | grep -v -Fx ::1 | grep -v -Fx :: | awk '!seen[$0]++') DEFAULT_DNS=$(uci show dhcp.@dnsmasq[0] | grep "\.server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' '\n' | grep -v "\/" | head -2 | sed ':label;N;s/\n/,/;b label') [ -z "${DEFAULT_DNS}" ] && [ "$(echo $ISP_DNS | tr ' ' '\n' | wc -l)" -le 2 ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',' | sed 's/,$//') diff --git a/small/luci-app-passwall/root/usr/share/passwall/rules/chnlist b/small/luci-app-passwall/root/usr/share/passwall/rules/chnlist index b4ea2d9828..9dbd34378d 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/rules/chnlist +++ b/small/luci-app-passwall/root/usr/share/passwall/rules/chnlist @@ -51,7 +51,6 @@ 007card.vip 007gameapp10.com 007manhua.com -007qu.com 007shoes.com 007swz.com 007szx.com @@ -300,7 +299,6 @@ 028desite.com 028f.com 028hema.com -028ip.com 028kuaidai.com 028ltzx.com 028office.com @@ -765,7 +763,6 @@ 0793.tv 07938.com 0794zp.com -0795jz.com 0797122.com 0797auto.com 0797ayzp.com @@ -825,7 +822,6 @@ 0898hq.com 0898mmf.com 0898uf.com -0898xbfc.com 089u.com 08an.com 08ar.com @@ -843,7 +839,6 @@ 0912fdj.com 0912job.com 0913ss.com -0914cn.com 0915home.com 0916001.com 0917.com @@ -871,9 +866,9 @@ 0991dj.com 0991net.com 0992.cc +099913.com 09game.com 09ge.com -09k.net 09p9z7d1h8.com 09shijue.com 0a2d.com @@ -1053,7 +1048,6 @@ 100try.com 100tv.com 100txy.com -100u.com 100vr.com 100wa.com 100web.store @@ -1074,7 +1068,6 @@ 100yiyao.net 100zd.com 100zhuang.com -100zhuoyue.com 100zp.com 101.com 1010-0000.com @@ -1240,6 +1233,7 @@ 1156dns.com 115800.com 115cdn.com +115cdn.de 115cdn.net 115cloud.com 115cloud.net @@ -1677,7 +1671,6 @@ 1527ego.com 15311223344.com 153g.net -154.com 1545ts.com 155.com 155155155.xyz @@ -1732,7 +1725,6 @@ 16177.net 1617k.com 1618.com -161gg.com 1624.win 1626.com 163.cm @@ -2003,7 +1995,6 @@ 178zhaopin.com 179.com 179179.com -1794game.com 1797.cc 17986.net 17989.com @@ -2088,7 +2079,6 @@ 17kss.com 17kuxun.com 17kxgame.com -17kzj.com 17kzy.com 17l18w9s1z.com 17lai.org @@ -2245,7 +2235,6 @@ 1866.tv 18665348887.com 186688.com -18680.net 1872001.com 1873game.com 1874.cool @@ -2334,7 +2323,6 @@ 190757.com 190cai.com 19183.live.streamtheworld.com -1919.com 19196.com 1919game.net 191game.com @@ -2438,7 +2426,6 @@ 1ding.xyz 1domedia.com 1drv.ws -1dufish.com 1dw9r53h79.com 1f11.com 1fangchan.com @@ -2509,7 +2496,6 @@ 1mishu.com 1mit.com 1mjz.com -1mm8.com 1mmbie336689.com 1mmed.com 1more.com @@ -2653,13 +2639,13 @@ 2022cdnpl.com 2023.com 2023game.com -2024789.com 2024qq.com 2025.net 202wan.com 203328.com 2048sj.com 2049baby.com +204cloud.com 2050life.com 206zz.com 207xz.com @@ -2669,6 +2655,7 @@ 20fl.com 20g0.com 20images10.com +20images21.com 20images7.com 20ju.com 20kf.com @@ -2724,7 +2711,6 @@ 21cctm.com 21ccvn.com 21cd.com -21ce.cc 21cloudbox.com 21cn.com 21cn.net @@ -2752,7 +2738,6 @@ 21eline.com 21epub.com 21etm.com -21etn.com 21fid.com 21food.com 21fv52efm1.com @@ -2760,7 +2745,6 @@ 21good.com 21hifi.com 21hospital.com -21hulian.com 21hyzs.com 21ic.com 21icsearch.com @@ -2890,7 +2874,6 @@ 231083.com 231122.com 2317.com -231867.com 2321111.com 232232.xyz 2323u.com @@ -2935,6 +2918,7 @@ 2366.com 23673.com 236z.com +2375sj.com 237y.com 238000.net 238090.com @@ -2950,7 +2934,6 @@ 23job.net 23ks.com 23luke.com -23mf.com 23mofang.com 23qb.com 23qb.net @@ -3003,7 +2986,6 @@ 250340.com 251400.com 2523.com -252300.net 25285577.com 253.com 253669vqx.com @@ -3013,7 +2995,6 @@ 2541.com 254254.com 254game.com -255400.com 255616.com 255star.com 256app.com @@ -3074,7 +3055,6 @@ 26595.com 265g.com 265h.com -265o.com 266.com 266.la 266wan.com @@ -3122,7 +3102,6 @@ 27tj.com 27ws.com 27xuexiao.com -27ying.com 28.com 281010.com 28123.com @@ -3144,7 +3123,6 @@ 288idc.com 289.com 2898.com -28awe.com 28beiduo.com 28gl.com 28gua.com @@ -3494,7 +3472,6 @@ 332831.com 333-555.com 333.com -333056.com 33315.com 333232.xyz 333333.com @@ -3743,7 +3720,6 @@ 360lion.com 360lj.com 360lnk.com -360longyan.com 360loushi.com 360midi.com 360mkt.com @@ -4072,7 +4048,6 @@ 3856.cc 385k.cc 38735.vip -387764.com 388155.com 388g.com 3892222.com @@ -4485,7 +4460,6 @@ 41113.com 41188.com 411au.com -41324.com 413xkyd.com 414500.net 417628.org @@ -4562,7 +4536,6 @@ 43yl.com 43zhubao.com 4417.com -442.com 4444.cc 4444448.com 44460.com @@ -4621,7 +4594,6 @@ 46ny920931.com 46ps.com 46xs.com -47291.com 47295.com 4735.com 47365.com @@ -4636,7 +4608,6 @@ 47gs.com 47oupy0408.com 47rq.com -47test.com 47zu.com 48.com 4805555.com @@ -4710,7 +4681,6 @@ 4hmodel.com 4hou.com 4hpy.com -4humanknowledge.com 4inlook.com 4jplus.com 4juo2.com @@ -4906,7 +4876,6 @@ 517xc.com 51802.com 5184.com -5184edu.com 5184pass.com 5185.cc 51864.com @@ -5017,7 +4986,6 @@ 51daima.com 51daka.com 51dangpu.com -51daquan.com 51daxueedu.com 51dc.com 51dcgg.com @@ -5220,7 +5188,6 @@ 51lepai.com 51lesheng.com 51lg.com -51lianying.com 51lingji.com 51liucheng.com 51losangeles.com @@ -5479,7 +5446,6 @@ 51y5.com 51yabei.com 51yajk.com -51yangsheng.com 51yanwang.com 51yey.com 51yhdai.com @@ -5566,7 +5532,6 @@ 520link.com 520love520.com 520lpy.com -520meiwen.com 520mingmei.com 520mojing.com 520ok.net @@ -5647,7 +5612,6 @@ 52article.com 52asus.com 52audio.com -52ayw.com 52bar.com 52bishe.com 52bjd.com @@ -5771,6 +5735,7 @@ 52ml.net 52mqbiao.com 52mtc.com +52muban.com 52muyou.com 52myqq.com 52nail.com @@ -5825,7 +5790,6 @@ 52svn.com 52swine.com 52t1.com -52tat.org 52tc.co 52tc.info 52tesla.com @@ -5918,8 +5882,6 @@ 537images22.com 537images41.com 537images42.com -537images5.com -537images7.com 538618.com 53920.net 5395.com @@ -5976,7 +5938,6 @@ 54pictu.com 54qj.com 54read.com -54seaman.com 54traveler.com 54tup.com 54watch.com @@ -6089,7 +6050,6 @@ 56885.net 569.com 5694.com -5698415.com 56a.com 56admin.com 56ads.com @@ -6235,7 +6195,6 @@ 58display.com 58dns.me 58dns.org -58duihuan.com 58eventer.com 58fkb.com 58food.com @@ -6289,7 +6248,6 @@ 58youxi.com 58yuesao.com 58z.net -58zhuiju.com 59.com 5909.net 590m.com @@ -6470,7 +6428,6 @@ 5iops.com 5ipatent.com 5ipkwan.com -5ips.net 5isanguo.com 5isohu.com 5iucn.com @@ -6560,7 +6517,6 @@ 5uu8.com 5uyk.com 5v13.com -5w.com 5w123.com 5w5.com 5w52.com @@ -6575,7 +6531,6 @@ 5xiaobo.com 5xini.com 5xmjm.com -5xw.net 5xyouse.com 5y6s.com 5yang.cc @@ -6623,7 +6578,6 @@ 603ee.com 6046.net 605-zy.com -605339.com 60593.com 605dns.com 605zy.co @@ -6700,6 +6654,7 @@ 61mami.com 61mc.com 61n1le.com +61ok.com 61psy.com 61sheji.com 61sou.com @@ -6713,7 +6668,6 @@ 62669.com 626x.com 628.com -628c4.com 62923.vip 629973.com 62dns.com @@ -6764,7 +6718,6 @@ 648sy.com 64ba.com 64dns.com -64ee.com 64foot.com 64gua.com 64ma.com @@ -6831,7 +6784,6 @@ 6668dns.com 666gps.com 666idc.com -666j.com 666kuaishou.com 666kuaishou.net 666pic.com @@ -6863,7 +6815,6 @@ 669play.com 669ye.com 669zw.com -66a.net 66call.com 66d6.com 66ds.net @@ -6962,7 +6913,6 @@ 688dns.com 688wz.net 68955.com -6895588.com 68978.net 6899wan.com 68apk.com @@ -7088,7 +7038,6 @@ 6pifa.net 6pingm.com 6puppy.xyz -6q8a8.com 6r8c86z4jh.icu 6ren.com 6rencn.com @@ -7298,12 +7247,12 @@ 7415.com 7428.net 743388.com +743forever.com 744zy.com 745998.xyz 7474.com 7477.com 747wan.com -749282.vip 74955.net 74966.net 74977.net @@ -7336,6 +7285,7 @@ 76107448.com 7618.com 761a.com +7633sqw.com 7651.com 766.com 7663.com @@ -7386,7 +7336,6 @@ 77521.com 77545.com 7756.org -77585.club 775jia.net 776577.com 7766.info @@ -7432,7 +7381,6 @@ 77itv.com 77l.com 77lux.com -77mh.app 77music.com 77nt.com 77nt.info @@ -7482,7 +7430,6 @@ 78tp.com 78v.com 78yx.net -78zw.com 79-79.com 79.com 793360.com @@ -7496,8 +7443,6 @@ 798ydh.com 798zb.tv 799.net -79932.co -7999.com 7999.tv 79999.net 799job.com @@ -7534,7 +7479,6 @@ 7ed.net 7edown.com 7ee.com -7eka.com 7eo8cc932r.com 7fei.com 7fgame.com @@ -7665,7 +7609,6 @@ 80-go.com 80.hk 80000.cc -800086.com 800423.com 800535.com 8006506.com @@ -7688,7 +7631,6 @@ 800buy.com 800cdn.com 800du.com -800fa.com 800hr.com 800jcw.com 800li.net @@ -7710,7 +7652,6 @@ 802203.com 80351.com 805481.com -80579.com 80585.com 805m.com 807.com @@ -7946,7 +7887,6 @@ 8684.com 8686c.com 8688g.com -86909.com 86933.com 869d.com 869v.com @@ -8003,7 +7943,6 @@ 87188718.com 872.cc 872872.com -87573.org 87654321.xyz 8767.com 876web.com @@ -8026,7 +7965,6 @@ 880.net 8800.org 880022.com -8800808.com 8801.net 880303.xyz 880331.net @@ -8046,7 +7984,6 @@ 88360.com 8838sl.com 883dai.com -8842777.com 884358.com 8844.com 88453392.com @@ -8256,7 +8193,6 @@ 8tool.club 8tupian.com 8tupian.net -8twan.com 8u18.com 8u58.com 8u7q5l9gox.com @@ -8364,7 +8300,6 @@ 9188.com 918canyin.com 918dxs.com -918haoma.com 918ka.cc 918rc.com 919.com @@ -8521,6 +8456,7 @@ 91up.com 91vpn.com 91vps.com +91vrchat.com 91vst.com 91waijiao.com 91waitang.com @@ -8531,11 +8467,12 @@ 91weimi.com 91wenmi.com 91wenwen.net +91wink.com 91wllm.com -91wri.com 91wujia.com 91wutong.com 91wzg.com +91xch.com 91xcm.com 91xfw.com 91xiake.com @@ -8609,19 +8546,16 @@ 92jzh.com 92kaifa.com 92kk.com -92ku.com 92le.com 92lm.com 92lucky.com 92mp.com -92mtnnn.com 92nas.com 92ni.com 92oz46nne1.com 92scj.com 92shuoshuo.com 92sucai.com -92tianjin.com 92to.com 92txt.cc 92u93e.com @@ -8669,7 +8603,6 @@ 93sem.com 93soso.com 93trf.com -93ty.com 93tyy.com 93wgames.com 93yo.com @@ -8881,7 +8814,6 @@ 9718game.com 9724.com 97576.com -975bl.com 97616.net 976186.cc 97654.com @@ -8915,7 +8847,6 @@ 97rp.com 97rx.com 97shenghuo.com -97sp.cc 97ting.com 97ui.com 97uimg.com @@ -8991,7 +8922,6 @@ 99193.com 991kang.com 991quka.com -9920102.com 9928.tv 993207.com 9935china-air.com @@ -9028,6 +8958,7 @@ 998jk.com 998jx.com 998law.com +998tool.com 9991.com 999120.net 999125.com @@ -9111,13 +9042,11 @@ 99n.me 99pdf.com 99ppt.com -99pto.com 99qh.com 99qibang.com 99qimingzi.com 99qumingzi.com 99read.com -99read.xyz 99shi.com 99shou.com 99sj.com @@ -9130,7 +9059,6 @@ 99tongxuelu.com 99uri.com 99weiqi.com -99wenku.com 99wj.com 99wuxian.com 99xr.com @@ -9289,7 +9217,6 @@ 9w1an.com 9w9.com 9wan8.com -9wanjia.com 9wee.net 9wuli.com 9wwx.com @@ -9410,7 +9337,6 @@ aafxw.com aai07251mu.com aai07260mu.com aakss.com -aakvtsad.shop aaltosemi.com aamets.com aamev.com @@ -9503,7 +9429,6 @@ abesmoke.com abhouses.com abiaogw.com abiechina.com -abiestem.com abifsey.com abitcg.com abite.com @@ -9614,8 +9539,6 @@ acg18s.com acg4.com acg6.com acgaa.xyz -acgaf.com -acgaf.gay acgdb.com acgist.com acglivefan.com @@ -9658,7 +9581,6 @@ acmsearch.com acmturc.com acnow.net aco-musical.com -acobt.tech acoloo.com acoolread.com acpf-cn.org @@ -9867,6 +9789,7 @@ adwep.com adwery.com adwintech.com adwke.com +adx.pw adx666.com adxflow.com adxliangmei.com @@ -9896,7 +9819,6 @@ aecichina.com aecname.com aeconomic.com aecsian.com -aeeboo.com aeenergy.com aeenets.com aeespace.com @@ -9952,7 +9874,6 @@ afdsc.com afdvr.cc afdvr.com afengblog.com -afengseo.com afengsoft.com afenxi.com affann.com @@ -10514,12 +10435,10 @@ aijiajiankang.com aijianji.com aijiatui.com aijiayou.com -aijieneng.com aijingu.com aijishu.com aijiuku.com aijizhang.net -aiju.com aijuhome.com aijunwang.com aik.com @@ -10615,7 +10534,6 @@ aipai.com aipaike.com aipaixt.asia aipaiyinghua.com -aipapi.com aipark.com aiparkvip.com aipay.cloud @@ -10713,7 +10631,6 @@ aiseminar.com aisenseinc.com aishangba.info aishangba.org -aishanghaibao11.com aishangyangyu.com aisharenet.com aishengji.com @@ -10750,7 +10667,6 @@ aisy.com aitangyou.com aitansuo.com aitaotu.com -aitaxinxi.xyz aitcfw.com aite.xyz aitecar.com @@ -11525,7 +11441,6 @@ amaxchina.com amayad.com amazfit.com amazingsys.com -ambassador-sh.com ambassadorchina.com amberbj.com amberedu.com @@ -11570,6 +11485,7 @@ amindbox.com aminglinux.com amishii.com amishow.com +amiyabot.com amo-solar.com amo9.com amobbs.com @@ -11596,7 +11512,6 @@ amswater.com amtbbs.org amtf18.com amtjt.com -amtk.com amtron-ic.com amuletj.com amuletor.com @@ -11932,7 +11847,7 @@ antmoe.com antom.com antpcdn.com antpedia.com -antquan.com +antplay888.com antriver.com antrol.com antsdaq.com @@ -12031,7 +11946,6 @@ anywood.com anyxz.com anzerclub.com anzext.com -anzeyun.com anzhen.org anzhengshipin.com anzhi.com @@ -12148,7 +12062,6 @@ aotian.com aoto.com aotoso.com aotrip.net -aotutu.com aotuzuche.com aotxland.com aoun.ltd @@ -12237,6 +12150,7 @@ apickup.com apicloud.com apifabric.net apifox.com +apifoxmock.com apigwtencent.com apilyzy.com apim.work @@ -12289,7 +12203,6 @@ apodaenvi.com apollo-platform.com apollo-share.com apollo.auto -apollocode.net apollopump.com apollotop.com apous.com @@ -12360,7 +12273,6 @@ appnode.com appol.com appollochina.com appotronics.com -apppoo.com appqv.com appresource.net approvebook.com @@ -12596,7 +12508,6 @@ artexamcq.com artfinace.com artfoxlive.com artgogo.com -artgoin.com arthals.ink arthing.org arthome163.com @@ -12667,7 +12578,6 @@ aschina.org aschip.com aschtj.com asciima.com -ascn.site asczwa.com asczxcefsv.com asd.red @@ -13106,7 +13016,6 @@ avicnews.com avicsec.com avicsgt.com avicui.com -avidbird.com avilive.com avinex.com avischina.com @@ -13316,7 +13225,6 @@ axmro.com axmw.com axnsc.com axq66.com -axqbs.com axqqq.com axqswm.net axs8.com @@ -13331,10 +13239,10 @@ axxsw.org axybio.com axyxt.com axzchou.com -axzhaofang.com ay-china.com ay-health.com ay001.com +ay001.net ay2fy.com ay57.com ay5y.com @@ -13387,10 +13295,8 @@ ayudasalud.com ayump.com ayunlian.com ayuren.com -ayuwoe.com ayuyun.com ayw.ink -ayxbk.com ayxz.com ayzzxx.com az009.com @@ -13504,7 +13410,6 @@ b6522.com b7av.com b7l.cc b8kk.com -b8th-hzvac3.com b8yx.com b9ad.com ba-li.com @@ -13582,7 +13487,6 @@ bafangwy.com bag198.com bagb2b.com bagevent.com -bageyalu.com bags163.com bagschangedmylife.com bagsnet.com @@ -13655,7 +13559,6 @@ baidu-nj.com baidu-tech.com baidu-wenxue.com baidu.cc -baidu.cm baidu.com baidu.com.hk baidu.hk @@ -13673,7 +13576,6 @@ baiducloudapi.com baiducontent.com baidudaquan.com baidudw.com -baidufcjx.com baidufe.com baidufree.com baiduhtml5.com @@ -13685,7 +13587,6 @@ baidupcs.com baidupcs.net baidupeixun.com baidusmartapps.com -baidusobing.com baidustat.com baidusx.cc baidusx.com @@ -13741,7 +13642,6 @@ baihui.com baihui.live baihui168.com baihuibio.com -baihuikucun.com baihuillq.com baihuiyaoye.com baiila.com @@ -13936,7 +13836,6 @@ baiyunairport.com baiyunholding.com baiyunhuojia.com baiyunmh.com -baiyunpiaopiao.com baiyunpump.com baiyunxitong.com baiyyy.com @@ -13958,7 +13857,6 @@ baka.plus bakaxl.com bakbitionb.com bakclass.com -bakehr.net bakingerp.com baklib.com bakpower.com @@ -14106,7 +14004,6 @@ bankoftianjin.com bankoftieling.com bankofvolc.com bankofyk.com -bankpublish.com banksteel.com bankyellowriver.com banlikanban.com @@ -14243,7 +14140,6 @@ baojinling.com baojule.com baojun.net baojunev.com -baokan.name baokan.tv baokang.com baokanhuicui.com @@ -14534,7 +14430,6 @@ bbtkid.com bbtpress.com bbtree.com bbtwatch.com -bbtydc.com bbugifts.com bbunion.com bbw-portnet.com @@ -14544,7 +14439,6 @@ bbwfish.com bbwgw.com bbwhy.com bbwict.com -bbwnt.com bbwoils.com bbwotc.com bbwport.com @@ -14734,7 +14628,6 @@ bdszh.vip bdtianchang.com bdtic.com bdtjrcv.com -bdtjs.org bdtm.net bdtsc.com bduapp.com @@ -14790,6 +14683,7 @@ bearyboard.com bearychat.com beastush.com beasure.com +beatbeatone.com beats-digital.com beatsbydre.com beaucare.org @@ -14852,7 +14746,6 @@ beicaiyuan.com beicdn.com beichende.com beicity.com -beidahuang.net beidasoft.com beidd.com beidian.com @@ -14935,7 +14828,6 @@ beijingrc.com beijingrc.net beijingrenyi.com beijingsanchi.com -beijingsheying.net beijingtaixie.com beijingtoon.com beijingtrucks.com @@ -15043,7 +14935,6 @@ bendiso.com bendiw.cc bendizhidao.com benduo.net -benellimotor.com benewake.com benfuip.com bengbufan.com @@ -15458,7 +15349,6 @@ bhxxpt.com bhxz.net bhybskq.com bhyby.com -bhycjdyp.com bhyintan.com bhyueda.com bhzck.club @@ -15667,7 +15557,6 @@ bijiao.org bijiasso.com bijiatu.com bijienetworks.com -bijikang.com bijingdi.com bijirim.com bijixia.net @@ -15715,6 +15604,7 @@ biliimg.com biliintl.co biliintl.com bilimanga.net +bilinl.com bilinovel.com biliplus.com biliui.com @@ -15903,13 +15793,12 @@ biqufu.com biqugao.cc biquge.info biquge.la +biquge123.com biquge365.com biquge8.com biquge9.cc biquge99.cc -biqugeabc.com biqugeg.com -biqugegg.cc biqugena.com biquges.com biqugesk.org @@ -16065,7 +15954,6 @@ bizcn.com bizcn.net bizcn666.com bizconfstreaming.com -bizhi3.com bizhi360.com bizhi88.com bizhigq.com @@ -16097,7 +15985,6 @@ bj-fm.com bj-fxh.com bj-git.com bj-hengdeli.com -bj-hzzs.com bj-ipcf.org bj-jzgg.com bj-klws.com @@ -16105,7 +15992,6 @@ bj-kpn.com bj-nego.com bj-pr.com bj-px.com -bj-ranqi.com bj-sea.com bj-shouqi.com bj-syc.com @@ -16249,7 +16135,6 @@ bjfpw.com bjfqy.com bjfriendshiphotel.com bjfsali.com -bjfyw.org bjfzst.com bjgas.com bjgasgh.com @@ -16316,7 +16201,6 @@ bjhzzs.com bjiab.com bjiae.net bjiaep.com -bjias.com bjicpark.com bjicrm.com bjidc.net @@ -16377,7 +16261,6 @@ bjkswy.com bjktaz.com bjktwe.com bjkxgroup.com -bjkzcs.com bjl777.com bjlacc.com bjlangbo.com @@ -16424,7 +16307,6 @@ bjnkzx.com bjnsr.com bjnxgbyy.com bjota.com -bjoutai.com bjp321.com bjpag.com bjpcyd.com @@ -16453,7 +16335,6 @@ bjqykc.com bjqzhd.com bjqzzh.net bjraee.com -bjranqigz.com bjrc.com bjrcb.com bjrdhx.com @@ -16481,7 +16362,6 @@ bjsdcm.net bjsdeyy.com bjsdfz.com bjsdgroup.com -bjsdkj.com bjsdr.org bjsfdr.com bjsfrj.com @@ -16607,7 +16487,6 @@ bjxx8.com bjxxw.com bjxyjf.com bjxyjy.com -bjxyzgt.com bjxzlou.com bjxzxw.com bjyah.com @@ -16654,7 +16533,6 @@ bjzgh.org bjzgh12351.org bjzghd.com bjzhaxikj.net -bjzhcc.com bjzhiborui.com bjzhishi.com bjzhongyi.com @@ -16693,6 +16571,7 @@ bjzzdb.com bjzzrx.com bjzzschool.com bk-cdn.com +bk-cdn01.com bk3r.com bk41.net bk5u.com @@ -16721,7 +16600,6 @@ bkpcn.com bkqq.com bkrgame.com bkscc.com -bkt123.com bktencent.com bktsj.com bkuax.com @@ -16744,7 +16622,6 @@ blackshow.me blackswancake.com blackxl.org blakat.cc -blastracshotblastmachines.com blazefire.com blazefire.net blazor.zone @@ -16787,7 +16664,6 @@ bllzgqbyp.com blm.net blmpb.com bln8.com -blnovel.com blockchain.hk blockchain123.com blockchainlabs.org @@ -16890,7 +16766,6 @@ blueskystudy.com blueskyxn.com blueslc.tech bluesoleil.com -bluestar-pc.com bluestep.cc bluetime.com bluetowngroup.com @@ -16966,7 +16841,6 @@ bmtrip.com bmw8033.com bmwallpaper.com bmwnc.com -bmwsteelart.com bmxinfang.com bmzxw.com bn21.com @@ -17101,7 +16975,6 @@ bohailife.net bohaishibei.com bohaisports.com bohaiyun.com -bohanzhubao.com bohaoclub.com bohe.com bohejiasuqi.com @@ -17211,7 +17084,6 @@ booea.com booen.co booeoo.com boohee.com -book-os.com book118.com book1993.com bookabc.net @@ -17428,9 +17300,7 @@ bpteach.com bpxxfw.com bpxxvo.com bq04.com -bqatj.com bqfy.com -bqg3.com bqg8.cc bqg8.la bqgwap.com @@ -17545,7 +17415,6 @@ bs2005.com bsagit.com bsbgjj.com bsbkjt.com -bsbxyy.com bsbydd.com bscabank.com bsccdn.com @@ -17675,7 +17544,6 @@ btdog.com btdos.com btdy.com btechina.com -btedu.net btei6pis99.com btgame.com btgcjs.com @@ -17758,7 +17626,6 @@ bucuoba.com budao.com budao24.com budarts.com -budget-backpackers.com budhano.com budiankj.com budikeji.com @@ -17860,7 +17727,6 @@ buxiugangban.net buy-bar.com buy-copi888.com buy-copys888.com -buy-ics.com buy0596.com buyanshufa.com buyaocha.com @@ -18228,7 +18094,6 @@ bzd6688.com bzddrive.com bzfar.com bzfpms.com -bzfscl.com bzfwq.com bzfwy.com bzfwzs.com @@ -18266,11 +18131,9 @@ bzszyy123.com bzt120.com bztdxxl.com bzvtc.com -bzw315.com bzwater.com bzwz.com bzwzw.com -bzx1688.com bzxinwen.com bzxz.net bzxzk.net @@ -18287,7 +18150,6 @@ c-canyin.com c-china.com c-cpp.com c-ctrip.com -c-deepblue.com c-discover.com c-estbon.com c-fehong.com @@ -18423,7 +18285,6 @@ cad8.net cad888.com cada.cc caddcc.com -cadeer.net cadenzayueqi.com cadforex.com cadict.net @@ -18443,7 +18304,6 @@ caeri-te.com caes.store caexpo.com caexpo.org -caf-china.com cafachine.com cafagame.com cafamuseum.org @@ -18565,7 +18425,6 @@ caipiaogu.com caipintu.com caipopo.com caipucaipu.com -caipucn.com caiqizhe.com cairenhui.com cairongquan.com @@ -18586,6 +18445,7 @@ caitun.com caituyou.com caiu8.com caiweiming.com +caiwennews.com caiwu51.com caiwuchina.com caixin.com @@ -18607,7 +18467,6 @@ caizhihr.com caj11.com cake400.com cake6.com -calab88.com calawei.com calb-tech.com calccn.com @@ -18692,7 +18551,6 @@ cang.com cangdu.org cangfengzhe.com canghaimachine.com -cangjiaohui.com canglanghospital.com cangmang.xyz cangoonline.com @@ -18805,7 +18663,6 @@ capjoy.com cappdr.org capsuleshanghai.com captain-cro.com -capture7.com capturetheflag.fun capvision.com capwhale.com @@ -18974,7 +18831,6 @@ catweiqi.com catyun.cc caua1988.com caua99.com -caufuyu.com caup.net caupd.com caupdbj.com @@ -19063,7 +18919,6 @@ cc-uavia.com cc.co cc0808.com cc11bh.com -cc128.com cc1588.com cc55k.com cc707.com @@ -19143,7 +18998,6 @@ cccwaf.com cccwww.com cccyun.cc ccd86.com -ccdby.com ccdma.org ccdol.com cce-china.com @@ -19185,7 +19039,6 @@ cchaosheng.com cchc-hyd.com cchccc.com cchcch.com -cchckj.com cchengr.com cchezhan.com cchfound.org @@ -19234,6 +19087,7 @@ ccit360.com ccita.net ccitimes.com cciup.com +ccj88.com ccjec.com ccjhdljs.com ccjkwjjedu.com @@ -19250,6 +19104,7 @@ cckefu1.com cckefu3.com cckggroup.com ccknbc.cc +cckyedu.com cclawer.com cclawnet.com cclbook.com @@ -19291,6 +19146,7 @@ ccnt.com ccoalnews.com ccoaonline.com ccoco.vip +ccode.cc ccoi.ren cconn.cc ccoop.net @@ -19348,6 +19204,7 @@ ccqtgb.com ccqtm.com ccqyj.com ccrate.cc +ccrc.com ccrfmed.com ccrgt.com ccrice.com @@ -19433,6 +19290,7 @@ ccutu.com ccv160.com ccv168.com ccview.net +ccvui.com ccwcw.com ccwcyw.com ccwifi.cc @@ -19523,7 +19381,6 @@ cdchuandong.com cdcitypark.com cdcoslm.com cdcxhl.com -cdcxsd.com cdcyts.com cddayun.com cddc56.com @@ -19625,6 +19482,7 @@ cdmaria.com cdmcaac.com cdmddyf.com cdmfund.org +cdmgiml.com cdmhwh.com cdmjwater.com cdmmlxs.com @@ -19654,6 +19512,7 @@ cdn.show cdn.vin cdn.zampdsp.com cdn08.com +cdn1.vip cdn1008.com cdn1218.com cdn16.com @@ -19674,6 +19533,7 @@ cdn50.com cdn56.com cdn60.com cdn778.com +cdn86.com cdn86.net cdn90.com cdn90.net @@ -19701,6 +19561,7 @@ cdnddd.net cdndm.com cdndm5.com cdndm5.net +cdndns.vip cdndns1.com cdndns2.com cdndns2.net @@ -19866,7 +19727,6 @@ cdsxlc.com cdt-ec.com cdt-md.com cdt-re.com -cdtaishan.com cdtianda.com cdtkdw.com cdtlev.com @@ -19891,20 +19751,17 @@ cdyee.com cdyestar.com cdyfy.com cdygdq.com -cdyishi.com cdyj56.com cdylzx.net cdynt.com cdyou.net cdyrjygs.com cdysxx.com -cdysxxe.com cdysxy.com cdyushun.com cdyywz.com cdyzhotel.com cdzdgw.com -cdzdhx.com cdzgh.com cdzgzs.com cdzhsj.com @@ -20097,7 +19954,6 @@ ceppea.net ceppedu.com ceprei.com ceprei.org -ceprintdesign.com cer.net ceracdn.net ceradir.com @@ -20276,7 +20132,6 @@ cgke.com cgkjvip.com cgksw.com cgktudr.xyz -cgllt.com cglw.com cglzw.net cgmama.com @@ -20646,7 +20501,6 @@ charmdeer.com charmingglobe.com charmkeytextile.com charmsunfund.com -charsesdneyse.com chartboost-china.com chaseyanyu.net chashebao.com @@ -20671,6 +20525,7 @@ chaxinyu.net chaxun.biz chaxunchina.com chaxunfapiao.com +chaxunjiao.com chayanfamily.com chayangge.com chaye.com @@ -20693,7 +20548,6 @@ chbpp.com chce-expo.com chcedo.com chceg.com -chcihe.com chcmu.com chcnav.com chcoin.com @@ -20844,6 +20698,7 @@ cheng-sen.com cheng.xin chengaizixun.com chengan-web.com +chengan.tech chengbanggroup.com chengcai.net chengchuanren.com @@ -20921,7 +20776,6 @@ chengxiangqian.com chengxiangzhineng.com chengxiaoliu.com chengxingjicj.com -chengxinlinghang.com chengxinyouxuan.com chengxuan.com chengyangyang.com @@ -20931,7 +20785,6 @@ chengyouyun.com chengyuanwenquan.com chengyucidian.net chengyun.com -chengyushangba.com chengyuwan.com chengyuwb.com chengyuxi.com @@ -20993,9 +20846,9 @@ chenyifaer67373.com chenyistyle.com chenyongqi.com chenyou123.com +chenyu.me chenyudong.com chenyuemz.com -chenyuzw.com chenyyds.com chenzao.com chenzhicheng.com @@ -21038,6 +20891,7 @@ chetxia.com chetxt.com chevip.com chevlen.com +cheweiguanjia.com chewen.com chewulin.com chexian9.com @@ -21106,7 +20960,6 @@ chiefmore.com chiefpharma.com chieftin.org chietom.com -chifeikeji.com chihao.com chihe.so chihealbio.com @@ -21122,7 +20975,6 @@ childrentheatre.org chileaf.com chili3d.com chillyroom.com -chiluyingxiao.com chilwee.com chimbusco.com chimelong.com @@ -21245,7 +21097,6 @@ china-hxzb.com china-hzd.com china-iace.com china-ida.com -china-indium.com china-inse.com china-invests.net china-ipif.com @@ -21344,7 +21195,6 @@ china-tje.com china-tongyu.com china-topplus.com china-tops.com -china-touch.com china-tower.com china-toy-edu.org china-toy-expo.com @@ -21458,7 +21308,6 @@ chinabancai.com chinabaoan.com chinabaogao.com chinabaokan.com -chinabaoke.net chinabashan.com chinabattery.org chinabbtravel.com @@ -21570,7 +21419,6 @@ chinacosco.com chinacourt.org chinacpda.com chinacpda.org -chinacpx.com chinacqme.com chinacqpgx.com chinacqsb.com @@ -21862,7 +21710,6 @@ chinakingo.com chinakinzo.com chinaklb.com chinakong.com -chinakongzi.net chinakongzi.org chinakqn.com chinakshx.com @@ -21885,7 +21732,6 @@ chinalawyeryn.com chinaleather.com chinaleather.org chinaledger.com -chinaleeper.com chinalep.org chinalibs.net chinalicensing.org @@ -21900,7 +21746,6 @@ chinalive.com chinaliyou.com chinalm.org chinalonghu.com -chinalongshu.com chinalowcarb.com chinalpharm.com chinalsjt.com @@ -21999,14 +21844,12 @@ chinapbw.com chinapcd.com chinape168.com chinapearlk.com -chinapeelingmachine.com chinapeier.com chinapelletizer.com chinapeople.com chinapet.com chinapet.net chinapharm.net -chinaphotar.com chinaphper.com chinapilotage.org chinapipe.net @@ -22053,7 +21896,6 @@ chinarenzhi.com chinaresin.com chinarespiratory.org chinarjw.com -chinarootdesign.com chinarta.com chinartlaw.com chinaruiji.com @@ -22080,7 +21922,6 @@ chinaseed114.com chinasexq.com chinasg.com chinashadt.com -chinashaodong.com chinashenglu.com chinashengmao.com chinashj.com @@ -22665,7 +22506,6 @@ chuangyebaba.com chuangyehai.com chuangyejia.com chuangyetv.com -chuangyichong.com chuangyijisu.com chuangyimao.com chuangyiqifu.com @@ -22710,7 +22550,6 @@ chuban.cc chubanyun.me chubaodai.com chubaohui.com -chubh.com chucheng.wiki chuchujie.com chuchujue.com @@ -22718,7 +22557,6 @@ chuchur.com chufaba.me chufw.com chuge8.com -chugeyun.com chugou360.com chuguo78.com chuguohao.com @@ -23102,7 +22940,6 @@ ciwork.net cixcomputing.com cixibank.com cixiedu.net -cixiucn.com cixtech.com cixuanfuw.com ciyagroup.com @@ -23133,7 +22970,6 @@ cjdcw.com cjdg.com cjdropshipping.com cjdsp.com -cjdx1.com cjeduw.com cjftb.com cjhospital.com @@ -23268,7 +23104,6 @@ cl-power.com cl0438.com cl0579.com cl2009.com -cl8239.com cl868.com clady.cc clam-itc.com @@ -23293,13 +23128,11 @@ clawchat.com clayidols.com clb6.net clboss.com -clbpay.com clbu.club clbug.com clbz666.com clcgq.com clcindex.com -clckblog.space clclibrary.com clcoolyun.com clcwwyj.com @@ -23366,7 +23199,6 @@ cloopen.com cloopen.net cloopm.com closertb.site -clotfun.xyz clothes178.com clothjob.com clothr.com @@ -23483,13 +23315,13 @@ cloudjining.com cloudjiujiang.com cloudkirin.com cloudkunming.com -cloudleft.com cloudleshan.com cloudlijiang.com cloudlishui.com cloudluohe.com cloudluoyang.com cloudlvs.com +cloudmaster.hk cloudmeishan.com cloudmes.io cloudminds.com @@ -23600,7 +23432,6 @@ clxlb.com clxsbj.com clxsczx.com clyiyuan.com -clyric.com clz.me clzd.com clzd.fun @@ -23627,7 +23458,6 @@ cmanuf.com cmastd.com cmb-leasing.com cmbajia.com -cmbbao.com cmbchina.biz cmbchina.com cmbchina.net @@ -23724,6 +23554,7 @@ cmltzz.com cmmaap.com cmmchn.com cmmim.com +cmnetech.com cmnxt.com cmo2o.com cmoc.com @@ -23797,7 +23628,6 @@ cn-comfort.com cn-cr.com cn-east-2.myhuaweicloud.com cn-east-3.myhuaweicloud.com -cn-ebara.com cn-elite.com cn-em.com cn-ferment.com @@ -23860,6 +23690,7 @@ cn.bing.net cn.download.nvidia.com cn.mm.bing.net cn.net +cn.online.standardchartered.com cn.pool.ntp.org cn.vc cn.widevine.com @@ -23949,7 +23780,6 @@ cnbeinuo.com cnbeta.com cnbetacdn.com cnbfjt.com -cnbhd.xyz cnbian.com cnbidding.com cnbio.net @@ -24166,7 +23996,6 @@ cnfish.com cnfisher.com cnfjwz.com cnfla.com -cnflcy.com cnflyinghorse.com cnfol.com cnfolimg.com @@ -24425,7 +24254,6 @@ cnmcl.net cnmdy.com cnmec.biz cnmeiwei.com -cnmetalarts.com cnmf.net cnmhg.com cnmia.org @@ -24679,7 +24507,6 @@ cnthinkers.com cntjq.net cntle.com cntlfs.com -cntlxd.com cntofu.com cntopgear.com cntoplead.com @@ -24704,7 +24531,6 @@ cnur.com cnuschool.org cnutcon.com cnuuu.com -cnv168.com cnvcs.com cnvf.com cnvfq.com @@ -24727,7 +24553,6 @@ cnweiming.com cnweisou.com cnwenshi.net cnwest.com -cnwgps.com cnwhc.com cnwindows.com cnwinenews.com @@ -24928,7 +24753,6 @@ codesdq.com codesocang.com codesoft.hk codess.cc -codetc.com codewd.com codeweblog.com codewoody.com @@ -25005,7 +24829,6 @@ coinsky.com coinvs.com coinyue.com coirliner.com -cojrvjp.com cokll.com cokutau.com colahotpot.com @@ -25053,6 +24876,7 @@ combiosz.com combocn.com combofin.com combomen.com +combosm.com combpm.com combss.com comdeep.com @@ -25062,7 +24886,6 @@ comebt.com comefilm.com comeken.com comeorg.com -comercn.com comestuff.com comet.cc cometagame.com @@ -25133,6 +24956,7 @@ congmiqq.com congrongfund.com congtoo.com congtoukaishi.com +congwuku.com congyicn.com congzao.com congzhi.com @@ -25556,7 +25380,6 @@ cqcsskyy.com cqcy.com cqcyhuagong.com cqcyxyxh.com -cqcyyjy.com cqczx.com cqdahan.com cqdai.com @@ -26120,7 +25943,6 @@ cqzgzdh.com cqzhihaolaw.com cqzhongxingyuan.com cqzhqyjt.com -cqzhsw.com cqzikao.com cqzike.com cqzk.net @@ -26208,7 +26030,6 @@ crct.com crctrust.com crdyf.com cre.net -cre021.com cread.com creality.com crealitycloud.com @@ -26332,7 +26153,6 @@ crsc.cc crscm.com crsky.com crsn168.com -crsyjt.com crtc-hr.com crtdri.com crtg.com @@ -26397,7 +26217,6 @@ cscdf.org cscec.com cscec1b-bj.com cscec1b.net -cscec5b3.com cscec7b.com cscec81.com cscec8bud.com @@ -26522,7 +26341,6 @@ csluye.com cslxzx.com cslyrc.com csmadik.com -csmaliya.com csmall.com csmama.net csmar.com @@ -26633,8 +26451,6 @@ cswamp.com cswef.org csweigou.com csweiwei.com -cswf888.com -cswfgg.com cswqvzh.com cswszy.com csxbank.com @@ -26800,7 +26616,6 @@ ctoclub.com ctongonline.com ctoutiao.com ctpdd.com -ctqcw.com ctracer.net ctrcw.net ctrip-ttd.hk @@ -26819,7 +26634,6 @@ ctripgslb.net ctripins.com ctripqa.com ctripteam.com -ctrlqq.com cts010.com ctsbw.com ctsec.com @@ -26991,6 +26805,7 @@ cvtoutiao.com cvtvcn.com cwag.com cwbaike.com +cwbgp.space cwbpsi.com cwcec.com cwddd.com @@ -27124,7 +26939,6 @@ cxyxwl.com cxyyls.com cxyym.com cxz.com -cxz3d.com cxzg.com cxzntc.com cxzuqiu.com @@ -27277,7 +27091,6 @@ cyzs97.com cyzwb.com cyzywl.com cyzzzz.com -cz-huachang.com cz-toshiba.com cz-yk.com cz121.com @@ -27287,7 +27100,6 @@ cz89.com czb365.com czbanbantong.com czbank.com -czbanker.com czbcpaint.com czbq.net czbsfx.com @@ -27602,7 +27414,6 @@ dadiwang.com dadiyimao.com dadongwu.com dadou.com -dadunet.com daduoduo.com daduofa.com dadushixiecheng.com @@ -27972,7 +27783,6 @@ dantuvc.com danxia.com danxin.net danyang.com -danyantrade.com danzhaoedu.com danzhaowang.com danzhou8.com @@ -28147,7 +27957,6 @@ datahubtrack.com datahuif.com dataie.com dataing.com -datalearner.com datang.com datang.net datangnxp.com @@ -28186,7 +27995,6 @@ datk.anythinktech.com datongjianshe.com datongtaxi.com datuc.com -datwy.com daugres.com dauteen.com dav01.com @@ -28387,7 +28195,6 @@ dbkan.com dbkuaizi.com dblgf.com dbljj.com -dbm-sh.com dbmailserver.com dbmaiyan7.com dbmall.com @@ -28581,7 +28388,6 @@ ddyjapp.com ddyqh.com ddyun.com ddyun123.com -ddyvip.com ddyylczz.com ddyylczzs.com ddz.com @@ -28662,7 +28468,6 @@ deehon.com deemos.com deep-os.com deep56.com -deepbluenetwork.com deepcloudsdp.com deepcoin.red deepcool.com @@ -28720,7 +28525,6 @@ dehongtech.com dehsm.com dehua.net dehuaca.com -dehuichaoshi.com dehuigroup.com dehuisk.com dehuiyuan.com @@ -28986,7 +28790,6 @@ dfcx-bj.com dfdaily.com dfdd-toubiaole.com dfdinsin.com -dfdjy.net dfdtt.com dfedu.com dfev.net @@ -29079,6 +28882,7 @@ dgaiia.com dgbaineng.com dgbgw.com dgbia.com +dgbyxny.com dgcct.com dgchenghe.com dgcia.com @@ -29161,7 +28965,6 @@ dgt-factory.com dgtianbao.xin dgtle.com dgtn1718.org -dgtowin.com dgtpcj.com dgtungwah.com dgtuoyue.com @@ -29248,7 +29051,6 @@ dhrcbank.com dhrest.com dhrest2.com dhs-sports.com -dhsky.org dhsrmyy.com dhszyy.net dht5867.com @@ -29629,7 +29431,6 @@ dingdiange.org dingdiann.com dingdiann.net dingdiansk.com -dingdianxs.com dingdianxs.la dingdianzw.com dingding.com @@ -29726,7 +29527,6 @@ dious-f.com dipephoto.com dipont.com dippstar.com -diqi.sh diqiuw.com diqua.com dir001.com @@ -29760,7 +29560,6 @@ ditan.com ditan360.com ditian-tech.com ditianshanhe.com -ditiee.com ditiefuli.com ditiezu.com ditiezu.net @@ -29932,7 +29731,6 @@ dkjiaoyang.com dkjmy.com dkjmyq.com dklogs.net -dkmbn.com dkmol.net dkntgc.com dksgames.com @@ -30033,7 +29831,6 @@ dlvalve.com dlw-lighting.com dlw360.com dlw666.com -dlwanbao.com dlwang.vip dlwjdh.com dlwmkj.com @@ -30043,7 +29840,6 @@ dlxk.com dlxmicro.com dlxww.com dly56.com -dlyiliang.com dlyy365.com dlzb.com dlzbxx.com @@ -30119,6 +29915,7 @@ dmu-1.com dmvideo.mobi dmvideo.net dmvideo.org +dmvvv.com dmxs.net dmyouxi.com dmyy.cc @@ -30126,7 +29923,6 @@ dmzfa.com dmzgame.com dmzj.com dmzlcn.com -dmzlpf.com dmzx.com dmzzbjb.net dmzzkz.com @@ -30203,7 +29999,6 @@ dnsfamily.com dnsfast.online dnsff.com dnsfox.net -dnsfwq.com dnsgtm.com dnsguest.com dnsgulf.net @@ -30228,7 +30023,6 @@ dnsoray.net dnsour.com dnspai.com dnspig.com -dnsplus.co dnspod.com dnspod.mobi dnspod.net @@ -30333,8 +30127,6 @@ dodo.link dodo8.com dodobook.net dodoca.com -dodocha.com -dododv.com dodoeasy.com dodoedu.com dodoh5.com @@ -30399,7 +30191,6 @@ dom-3d.net domabio.com domaingz.com domaintescil.com -domengle.com domesticmedia.cc domesticmedia.co domesticmedia.com @@ -30482,6 +30273,7 @@ dongfeng.net dongfengem.com dongfengtc.com dongfengtrucks.com +dongfou.com dongfund.com donggaoshiye.com dongge.com @@ -30619,7 +30411,6 @@ doorzo.app doorzo.net doosunggroup.com doov5g.com -doowinfintec.com dooya.com dopic.net dopo-online.net @@ -30730,12 +30521,12 @@ doumi.com doumiip.com doumistatic.com doumobsix.site -dounanhuahua.com douniwan.org doupai.cc doupay.com doupocangqiong1.com douqi.com +douqq.com doushen.com doushisan.com dousonvalve.com @@ -30996,6 +30787,7 @@ driverchina.com driverdevelop.com drivergenius.com driverzeng.com +driverzj.com drivethelife.com drjou.cc drjy6688.com @@ -31144,7 +30936,6 @@ dtnews.net dtrcb.com dtrcw.net dts007.com -dtsmndu.com dtssyy.com dtstack.com dtstatic.com @@ -31154,7 +30945,6 @@ dttt.net dtuosh.com dtuyun.com dtwave.com -dtxmw.com dtxn.net dtxww.com dtxxjq.com @@ -31254,7 +31044,6 @@ duiyou360.com duiz.net duizhuang.com dujiabieshu.com -dujiaoshou.org dujin.org dujixiao.com dujiza.com @@ -31297,13 +31086,11 @@ dunhuang.com dunhuangtour.com dunjiaodu.com dunkhome.com -dunkun.com dunstanhardcastle.com dunsuan.com dunwang.com dunzhiwang.com duoao.com -duobei.com duobeiyun.net duobiyi.com duocaipaint.com @@ -31529,7 +31316,6 @@ dwidc.com dwinput.com dwion.com dwjkgl.com -dwjoy.com dwjpwf.com dwjxz.com dwmoniqi.com @@ -31565,12 +31351,14 @@ dxdlw.com dxe520.com dxecs.com dxf6.com +dxfbk.com dxfblog.com dxgg.co dxguanxian.org dxhuafu.net dxinzf.com dxjs.com +dxjt2013.com dxlfile.com dxm-cdn.com dxm-int.com @@ -31792,7 +31580,6 @@ dzfang.com dzfc.com dzfjsm.com dzfwjd.com -dzfxh.com dzglsb.net dzgxq.com dzh.link @@ -31907,6 +31694,7 @@ e-kays.com e-length.com e-lining.com e-mallchina.com +e-map.ne.jp e-nci.com e-nebula.com e-net.hk @@ -31950,7 +31738,6 @@ e22a.com e23dns.net e24c.com e253.com -e28ac.com e2capp.com e2edesign.com e2esoft.com @@ -32092,7 +31879,6 @@ eastforever.com eastftp.net eastfu.com easthc.com -easthideschina.com easthome.com eastib.com easticloud.com @@ -32156,7 +31942,6 @@ easygovm.com easyhaitao.com easyhin.com easyidc.com -easylaa.com easylabplus.com easyliao.net easylinkin.com @@ -32326,7 +32111,6 @@ echinacities.com echinagov.com echinatobacco.com echo-isoftstone.com -echo.cool echo188.com echoing.tech echoteen.com @@ -32582,7 +32366,6 @@ ee-nav.com ee123.net ee1234.com ee68.com -ee77777.com ee99.net eeban.com eebbk.com @@ -32644,7 +32427,6 @@ eevision.com eeworld.com eeworm.com eexiaoshuo.com -eexing.com eeyd.com eeyxs.com eeyys.com @@ -32661,7 +32443,6 @@ efashionchina.com efashioncloud.com efchina.org efe.cc -efengji.org efengqing.com efesco.com eff-soft.com @@ -32818,9 +32599,7 @@ einkcn.com einsteintiles.com eintone.com eiot.com -eismowe.com eisoo.com -ej-travel.com ejamad.com ejc56.com ejcms.com @@ -32938,7 +32717,6 @@ elianmeng.vip eliansy.com elianwiz.com elicht.com -elichtmedia.com elikeme.com elikeme.net elimautism.org @@ -33005,7 +32783,6 @@ emao.net emaozi.com emapgis.com emas-poc.com -emasmr.com ematong.com emaup.com emax.cc @@ -33020,7 +32797,6 @@ embedu.org embedunion.com embedway.com embest-tech.com -embroidery-patternmaking.com embryform.com embryochina.com embsky.com @@ -33218,7 +32994,6 @@ enuomachinery.net envi-ch.com envisioncn.com enwing-tech.com -enwto.com enxicled.com enyamusical.com enzj.com @@ -33346,7 +33121,6 @@ eqxiu.mobi eqxiul.com eqxiuzhan.com eqyn.com -eqz.cc er07.com er8gmvwi54p5x1.com eraclean.com @@ -33484,7 +33258,6 @@ eshufa.com eshuizong.com eshukan.com eshzp.com -esie-expo.com esilk.net esinidc.com esipark.com @@ -33567,7 +33340,6 @@ et-api.com et-fine.com et001.com et59.com -etagrfid.com etagri.com etang.com etao.com @@ -33591,6 +33363,7 @@ etest8.com eteste.com etf.group etf88.com +etfcjz.com etfiber.net etg56.com ethainan.com @@ -33795,12 +33568,10 @@ evpartner.com evpowergroup.com evqvxuq.com evtcn.com -evtrust.com evv1.com evzhidao.com evzs.com ew-wirestripping.com -ew480.com ew80.com ew80.net ew80yun.com @@ -34051,6 +33822,7 @@ ezcname.com ezcpt.com ezcun.com ezdnscenter.com +ezeeship.com ezeroshop.com ezfuns.com ezhangdan.com @@ -34068,7 +33840,6 @@ ezhun.com ezhupei.com ezindie.com eziot.com -ezitong.com ezjhw.com ezlippi.com ezliushao.com @@ -34122,7 +33893,6 @@ f3322.net f3322.org f3knp1j.xyz f41g.com -f4h90.cyou f526.cc f52o04oylrbmfw.com f537.com @@ -34254,7 +34024,6 @@ famens.com famens.vip famensi.com famicn.com -famige.com family-marathon.com familyincloud.com familykoloro.com @@ -34606,7 +34375,6 @@ fatiao.pro fatieku.com fatier.com fatoan.com -fattireelectricbikefactory.com fatu.cc fatvg.com faussefrance.com @@ -34732,7 +34500,6 @@ fcnes.com fcnode.net fcpawn.com fcpiao.com -fcport.com fcpowerup.com fcqjc.com fcrc114.com @@ -34786,7 +34553,6 @@ fdleckwai.com fdlt.net fdmhmm.com fdooo.com -fdpx.com fdqc.com fdren.com fdrobot.com @@ -34897,6 +34663,7 @@ feigo.fun feihe.com feihe168.com feiheair.com +feihengip.com feihonghb.com feihongtec.com feihu.me @@ -34909,7 +34676,6 @@ feijipan.com feijiu.net feijiuzs.com feijix.com -feijizu.com feijs.com feikework.com feikongbao.com @@ -35010,6 +34776,7 @@ feiyunxiazai.com feiyuteam.com feizan.com feizhaojun.com +feizhiyi.com feizhu.com feizhuke.com feizhupan.com @@ -35108,7 +34875,6 @@ fengli.com fengli.su fengliankeji.com fenglichem.com -fengligroup.com fenglingroup.com fenglinjiu.com fenglinlab.com @@ -35236,7 +35002,6 @@ fevermi.com fevte.com feydj.com feyer-tc.com -ff112222.com ff14.cloud ff54.ink ff63.com @@ -35321,7 +35086,6 @@ fhtlw.com fhtre.com fhwlgs.com fhwzx.com -fhy2008.com fhycedu.com fhycs.com fhyx.com @@ -35454,7 +35218,6 @@ firm-lithium.com first-panel.com first-swg.com firstarpc.com -firstcityfashion.com firstdrs.com firstfood-cn.com firstgw.com @@ -35635,7 +35398,6 @@ fjq.icu fjqfkg.com fjqionghai.com fjqjsw.com -fjrcjc.com fjrclh.com fjrcw.com fjrmyy.com @@ -35766,6 +35528,7 @@ fleetlogd.com fleety.com flexifont.com fleyun.com +flfc5999.com flgame.net flhimalayandn.com fliggy.com @@ -35777,14 +35540,12 @@ flip.fun fliplus.com flirtybag.com flleasing.com -flm-tj.com flmgr.net flml.cc floatingislandapps.com floatmaze.com flockypet.com flomoapp.com -flooc.com floorb2b.com florentiavillage.com flourish-fs.com @@ -35974,6 +35735,7 @@ fofcn.tech fofen.com fofhc.com fofstudio.net +fofuai.com fogcloud.io foguanghui.org fohohr.com @@ -36201,7 +35963,6 @@ fqgyljt.com fqhospital.com fqis.xin fqjob.net -fqkf.com fqlook.com fqnovel-op.com fqnovel.com @@ -36229,7 +35990,6 @@ franceqz.com francissoung.com franckfw.com francochinois.com -frank-china.com frankenman.group frankyrobot.com franzsandner.com @@ -36416,7 +36176,6 @@ fsdaton.com fsdxzhpt.com fsecity.com fseig.com -fsemouse.com fseport.com fsesa.com fsfsfz.com @@ -36463,7 +36222,6 @@ fsmama.com fsmcled.com fsmeeting.com fsmi818.com -fsnewage.com fsoet.com fsohu.com fsoptronics.com @@ -36497,17 +36255,16 @@ fswchina.com fswk.com fsxchina.com fsxinquan.com -fsxshjz.com fsxsj.net fsxzygz.com fsy6.com -fsyage.com fsyanhe.com fsygroup.com fsyhlz.com fsylr.com fsyq.net fsysyy.com +fsytss.com fsyule.net fsyuncai.com fsyxg.com @@ -36520,7 +36277,6 @@ ft.tech ft12.com ft22.com ft3e.com -ft77.com ft98.com fta.dell.com ftaapj.dell.com @@ -36621,7 +36377,6 @@ fuhai360.com fuhaikj.com fuhancapital.com fuhanziben.com -fuhaodaquan.org fuhaoku.com fuhefu.com fuheng.org @@ -36655,10 +36410,10 @@ fuliansheng.com fuliao.com fuliaotech.com fuliba.com +fulicat.com fulimin.org fulin.org fuling.com -fulingwx.com fulinpm.com fulinsujiao.com fulinxiuxian.com @@ -36750,7 +36505,6 @@ furderdriving.com furenchina.com furenkeji.com furielec.com -furniture-channel.com furongedu.com furrychina.com furuijiaju.vip @@ -36804,7 +36558,6 @@ fuwucms.com fuwuqinet.com fuwuqu.com fuxila.com -fuxin-sh.com fuxinbank.com fuxinews.com fuxinghf.com @@ -37114,6 +36867,7 @@ fzthinking.com fzwater.com fzwcn.com fzwhzn.com +fzwqq.com fzwtqx.com fzwtxx.com fzwxxcx.com @@ -37344,7 +37098,6 @@ gamewifi.net gamexdd.com gamexhb.com gamexun.com -gameyc.com gameyiming.com gameyisi.com gameyj.com @@ -37366,7 +37119,6 @@ gangguan8.com gangguana.com ganghaowang.com gangjiajieli.com -ganglongline.com gangpaibao.com gangqinpu.com gangqinxiansheng.com @@ -37467,6 +37219,7 @@ gaohaipeng.com gaohangip.com gaoheconsult.com gaohr.com +gaohuasec.com gaoimg.com gaojer.com gaoji.ren @@ -37475,6 +37228,7 @@ gaojihealth.com gaojima.com gaojipro.com gaojitui.com +gaojiua.com gaokao.com gaokao365.com gaokao789.com @@ -37544,7 +37298,6 @@ gaoxincarbon.com gaoxinedu.com gaoxinedu.net gaoxinjy.com -gaoxinkc.com gaoxitech.com gaoyawang.com gaoyizaixian.com @@ -37589,7 +37342,6 @@ gastronomy.gov.mo gaszx.com gate-dhgames.com gateface.com -gatewang.com gateweb3.cc gateweb3.io gather-dns.com @@ -37649,7 +37401,6 @@ gc39.com gc73.com gc91.com gcable.tv -gcademy.net gccdn.net gccgz.com gcchina.com @@ -37770,17 +37521,14 @@ gdbita.com gdbljd.com gdbmh.com gdbsjd.com -gdbyhtl.net gdbzkz.com gdbzkz.org gdcaa.com gdcaia.com -gdcamis.com gdcaward.com gdcayyebh.com gdccaa.com gdcci.com -gdcct.com gdccus.org gdcdsh.com gdceg.com @@ -38026,7 +37774,6 @@ gdpdd.com gdpengquan.com gdpia.com gdpingzheng.com -gdpntv.com gdprm.com gdprm.net gdpysc.com @@ -38185,7 +37932,6 @@ gdxsn.com gdxueyin.com gdxy.vip gdxych.com -gdxycy.com gdybkjjt.com gdyd.com gdydgj.com @@ -38253,7 +37999,6 @@ gdzzjc.com gdzzw.net gdzzz.com ge-garden.net -ge-stralen.com ge100.com ge3rge43r6.com geality.com @@ -38377,7 +38122,6 @@ geiniwan.com geisnic.com geizan.cc gelaha.com -gelgcn.com gelicang.net gelics.com geline.net @@ -38403,7 +38147,6 @@ gemled-tech.com gempharmatech.com gempoll.com gemuedu.com -genban.org genchim.com gendan5.com gendantong.com @@ -39108,7 +38851,6 @@ ghed119.com ghedu.com ghgglobal.com ghglzx.com -ghgo.xyz ghgy.com ghhyjc.com ghibliwiki.org @@ -39139,7 +38881,6 @@ ghostwin7win8.com ghostxp2.com ghostxpsp3.net ghostxx.com -ghp.ci ghparking.com ghpepower.com ghproxy.com @@ -39154,7 +38895,6 @@ ghsd16888.com ghsense.com ghsmc.com ghsmpwalmart.com -ghsuliao.com ght-china.com ght120.com ghtech.com @@ -39239,7 +38979,6 @@ giordano.com giorgiomorandihotels.com giraff3.com girdear.net -girigirilove.com girl13.com girls-frontline.com girlsfighters.com @@ -39312,6 +39051,7 @@ gjsc.info gjsj.com gjsun.com gjtmu.com +gjtool.com gjtt.net gjw.com gjw123.com @@ -39343,7 +39083,6 @@ gkgdsw.com gkgzj.com gkhxtc.com gki88.com -gkjfq.com gkjzy.com gkket.com gkkxd.com @@ -39356,7 +39095,6 @@ gkmwb.com gkong.com gkoo.net gkoudai.com -gkpass.com gkqcw.com gkrpgtee.com gkshanghai.com @@ -39431,7 +39169,6 @@ glclcsy.com glcszy.com gldaewoo.com gldjc.com -gldxjc.com gleasy.com glecan.com glelec.com @@ -39595,13 +39332,13 @@ glowapp.fun glowapp.vip glpenhui.com glplyf.com -glqcxh.com glqh.com glqshb.com glquanji.com glrcjob.com glrcw.com glreading.com +glredu.com glriverside.com glrmyy.com glruixin.com @@ -39700,7 +39437,6 @@ gmaxbiopharm.com gmbbs.net gmbuluo.com gmcc.net -gmcchina.net gmcinnov.com gmcmonline.com gmdeng.com @@ -39747,7 +39483,6 @@ gmsyun.com gmt-china.org gmt-cn.com gmtacoa.com -gmtgx.com gmtv.cc gmtzy.com gmugmu.com @@ -40031,7 +39766,6 @@ gongpingjia.com gongqiu.biz gongshang120.com gongshiku.com -gongsi.gs gongsibao.com gongsijiaoyi.com gongsizhang.com @@ -40142,8 +39876,8 @@ goodwillresource.com goodwyee.com goodyoungtea.com goodzuji.com -goodzuo.com goofish.com +googoc.com googol-power.com googolpark.com googvv.com @@ -40324,7 +40058,6 @@ gpmycez.com gpnewtech.com gpowersoft.com gppapp.com -gppdt.com gpqnrc.com gps009.net gps123.org @@ -40338,6 +40071,7 @@ gpsoo.net gpspw.net gpsrcw.com gpsspg.com +gpstool.com gpsuu.com gpszlsc.com gpticket.org @@ -40419,7 +40153,6 @@ grass98.com grassmoon.net graueneko.xyz gravity-engine.com -gray-ice.com grcbank.com grchina.com grcwzx.com @@ -40443,7 +40176,6 @@ greatssp.com greatstargroup.com greatstartools.com greatwallmusic.com -greatwallqd.com greatwuyi.com gredmedic.com gree-jd.com @@ -40461,7 +40193,6 @@ greencharm.com greenchengjian.com greencompute.org greendh.com -greenhua.com greenism.net greenits.net greenjk.com @@ -40575,6 +40306,7 @@ gsdpw.com gsdswz.com gsdtfx.com gsdyjsgs.com +gseen.com gsensebot.com gsfilter.net gsflcp.com @@ -40596,7 +40328,6 @@ gsi24.com gsicpa.net gsidy.com gsjb.com -gsjie.com gsjkjt.com gsjqtv.com gsjt-cn.com @@ -40612,8 +40343,6 @@ gslbdns.com gslbdns.net gslmw.net gslnjyjt.com -gslsj.com -gsmgw.com gsmpers.com gsmuban.com gsmxjy.com @@ -40940,10 +40669,7 @@ guangxilonghua.com guangximinhang.com guangxinengyuan.com guangxipubeihuaheng.com -guangxiqimei.com -guangxiqingrun.com guangxircw.com -guangxisanhe.com guangxishangfu.com guangxishuizhiyangzhigongsi.com guangxisichujiadao.com @@ -41139,7 +40865,6 @@ guimengning.com guimengshangeng.com guinsoft.com guipeibao.com -guipeng168.com guipin.com guiqingkeji.com guiququ.com @@ -41207,7 +40932,6 @@ gumpmall.com gundambattle.com gunshitech.com gunsuo.com -gunxueqiu.com guo-kai.com guo68.com guo7.com @@ -41377,9 +41101,7 @@ guozhangroup.com guozhanjiaoyu.com guozhen.net guozhenyi.com -guozhijun.com guozhivip.com -guozhoutrade.com guozhuan.com guozhuangxincai.com guozi.org @@ -41418,7 +41140,6 @@ gushiwen.org gushufang.com gusspro.com gusucaishui.com -gususoft.com gusuwang.com guteke.com gutlighting.com @@ -41526,7 +41247,6 @@ gx-lc.com gx-newmedia.com gx-royalpartners.com gx-stbd.com -gx-vlink.com gx-wl.com gx-xc.com gx-xjyx.com @@ -41848,7 +41568,6 @@ gxfcq.com gxfcw.com gxfengjie.com gxfenglei.com -gxfengsu.com gxfengxiang.com gxfengxingjq.com gxffjt.com @@ -41924,7 +41643,6 @@ gxgeek.com gxgentle.com gxgf.net gxgfsh.com -gxgfsj.com gxggcmc.com gxggdq.com gxggfhsmy.com @@ -42062,7 +41780,6 @@ gxhealth.xin gxheda.com gxhefei.com gxheguan.com -gxhejia.com gxhengda.com gxheyumaoyi.com gxhezhixin.com @@ -42605,7 +42322,6 @@ gxmiao.com gxmiaoshu.com gxminglian.com gxmingshi.com -gxmingyun.com gxmj.org gxmjyy.com gxmjzs.com @@ -42770,7 +42486,6 @@ gxqiyuan.com gxqkcm.com gxqljt.com gxqllc.com -gxqlled.com gxqlt.com gxqmk.com gxqnjc.com @@ -42866,7 +42581,6 @@ gxscsw.com gxscyg.com gxsd.net gxsdem.com -gxsdkj.com gxsdpx.com gxsdy.com gxseal.com @@ -42904,7 +42618,6 @@ gxshjz.com gxshny.com gxshoufeng.com gxshouji.com -gxshrf.com gxshtf.com gxshua.com gxshuairun.com @@ -43025,7 +42738,6 @@ gxtongyin.com gxtongzhu.com gxtopart.com gxtp2021.com -gxtrgs.com gxtrwhy.com gxtskq.com gxtslr.com @@ -43257,7 +42969,6 @@ gxyete.com gxyfck.com gxyfkj.com gxyfm.com -gxyfqxcx.com gxyfxc.com gxyglw.com gxygys.com @@ -43314,7 +43025,6 @@ gxyongzhitai.com gxyos.com gxyoupinzhi.com gxypdc.com -gxypjj.com gxypjy.com gxypnh.com gxyqjc.com @@ -43531,7 +43241,6 @@ gyhht.com gyhimalayanul.com gyhj.org gyhm.cc -gyhsz120.com gyidc.net gyii.com gyip.net @@ -43634,6 +43343,7 @@ gz-notary.com gz-shanguang.com gz-spi.com gz-tencentclb.cloud +gz-tencentclb.com gz-tencentclb.work gz-wx.com gz-xinghe.com @@ -43673,7 +43383,6 @@ gzbl.com gzblssly.com gzboji.com gzbookcenter.com -gzbote.com gzbt020.com gzbus.com gzbxyy120.com @@ -43738,7 +43447,6 @@ gzdqyy.com gzdryy.com gzdsw.com gzdtc.com -gzdtcy168.com gzdtg.com gzduguo.com gzdysx.com @@ -43796,7 +43504,6 @@ gzhakj.com gzhand.com gzhangcha.com gzhatao.com -gzhatu.com gzhbchy.com gzhc365.com gzhclw.com @@ -43986,7 +43693,6 @@ gzpy120.net gzpydlc.com gzpyxz.net gzqbd.com -gzqdedu.com gzqgdg.com gzqiche.com gzqixun-tech.com @@ -44009,6 +43715,7 @@ gzrobot.com gzrobots.com gzrqhyxh.com gzrrj.com +gzrskh.com gzrsksxxw.com gzrtnet.com gzrycl.com @@ -44182,7 +43889,6 @@ gzyiagu.com gzyilongprinting.com gzyitsy.com gzylhyzx.com -gzyocg.com gzyouai.com gzyowin.com gzyqtlxs.com @@ -44313,6 +44019,7 @@ h5taotao.com h5tpl.com h5uc.com h5util.com +h5video.shop h5wap.com h5war.com h5youxi.com @@ -44386,7 +44093,6 @@ haha365.com haha9911.com hahack.com hahaertong.com -hahaha365.com hahait.com hahajing.com hahasou.com @@ -44472,13 +44178,13 @@ haihuishou.com haiintelligent.com haijia.org haijianchuxing.com -haijiangzx.com haijianstock.com haijiaonet.com haijiaoshi.com haijiasu.com haijizq.com haijob.com +haijt.com haijudoc.com haijunda.com haikegroup.com @@ -44642,7 +44348,6 @@ haiwu.com haixiachina.com haixiahuagong.com haixiangkuajing.com -haixianlai.net haixin.com haixin5.com haixindichan.com @@ -44709,6 +44414,7 @@ halsplastics.com haluan2u.com haluoha.com haluolinks.com +halvie.com hamdl.com hamedal.com haminol.com @@ -44747,14 +44453,12 @@ handsfree.work handu.com handuyishe.com handyfriendship.com -hanenyunxiao.com hanergy.com hanex.cc hanfakg.com hanfan.cc hanfei.net hanfeiyl.com -hanfengcars.com hanfugong.com hanganxian.com hangbohaorun.com @@ -44820,7 +44524,6 @@ hangzhouzehe.com hanhai.net hanhaiqikan.com hanhanfx.com -hanhanmanhua.com hanhe-cable.com hanhongchina.com hanhoo.com @@ -44911,7 +44614,6 @@ hanwa-ch.com hanweb.com hanwei1234.com hanweimetal.com -hanweiqizhong.com hanwenzhongyi.com hanximeng.com hanxinsheng.com @@ -44953,7 +44655,6 @@ hao123.com hao123.com.sg hao123.net hao123.ph -hao123.sh hao12306.com hao123img.com hao123n.com @@ -45125,7 +44826,6 @@ haolaoshi.tv haolawyer.com haole.com haoled9999.com -haoledi.com haolexiang.com haolidayiliao.com haolietou.com @@ -45324,7 +45024,6 @@ haozjj.com haozke.com haozongjie.com haozu.com -haozujiaju.com haozuojia.com hapco-cn.com hapg-hitachi.com @@ -45423,7 +45122,6 @@ hatlonely.com hatoem.com hatro.cc hatter.ink -hatx.net haval-global.com have.ink havefun.im @@ -45522,7 +45220,6 @@ hbcjxx.com hbclgg.com hbcljyc.com hbclqcw.com -hbclzq.com hbcoal.com hbcof.com hbcofco.com @@ -45690,7 +45387,6 @@ hbltyh.com hbltzb.com hbltzx.com hblxxx.com -hblykj.com hblynk.com hbm360.com hbmajiang.com @@ -45724,7 +45420,6 @@ hbpx.net hbqcxy.com hbqingteng.com hbqmys.com -hbqnb.com hbqndc.com hbqtgg.com hbqydz.com @@ -45840,6 +45535,7 @@ hbwsrc.net hbwuxue.com hbwuye.com hbww.org +hbxcw.com hbxdf.com hbxfywj.com hbxgzls.com @@ -45870,10 +45566,8 @@ hbynet.net hbyouyunyouke.com hbyoyo.com hbyqtl.com -hbyscn.com hbysfhm.com hbyt56.com -hbyuandadl.com hbyuanhao.com hbyunxi.net hbyunyang.net @@ -45970,7 +45664,6 @@ hcpharm.com hcqixinhb.com hcqxbj.com hcrlm.com -hcs360.com hcschengtou.com hcsd123.com hcsdhgjzx.com @@ -46066,7 +45759,6 @@ hdhjtz.com hdhome.org hdhosp.com hdhospital.com -hdhsjt.com hdhui.com hditec.com hdj.me @@ -46180,6 +45872,7 @@ healthych.com healthydigitallife.com healzentx.com heanyo.com +hearfly.com hearstchina.com heart-game.com heartide.com @@ -46195,7 +45888,6 @@ hebbc.org hebbr.com hebca.com hebcar.com -hebdtp.com hebecc.com hebeeb.com hebei.cm @@ -46305,7 +45997,6 @@ hefagear.com hefei.cc hefeifc.com hefeimarathon.com -hefeitv.com heflc.com hefls.net hegii.com @@ -46354,7 +46045,6 @@ heiheiyuyin.com heihekeji.com heijiao.net heijiaovip.com -heijin.org heike07.com heilanhome.com heilei.com @@ -46457,7 +46147,6 @@ hellohuohu.com helloimg.com helloinstruments.com hellojava.com -hellokang.net hellokid.com hellokidvip.com hellololi.com @@ -46525,7 +46214,6 @@ henaninfo.com henanjianling.com henanjiqiren.com henanjubao.com -henanjuchuang.com henanrc.com henansha.com henanshengtang.com @@ -46598,7 +46286,6 @@ hengtai-law.com hengtaiboyuan.com hengtiansoft.com hengtianyun.com -hengtong-sd.com hengtonggf.com hengtonggroup.com hengtonglog.com @@ -46686,7 +46373,6 @@ herta.space herton.net hertzhu.com heryipharma.com -hescna.com heshanghuitong.com heshdity.com heshecasa.com @@ -46698,6 +46384,7 @@ heson10.com hesongwang.com hesppe.com hessianhealth.com +hestudio.net heta.tech hetaigroup.net hetaixin.com @@ -46813,6 +46500,7 @@ hezeribao.com hezeswjt.com hezhidongli.com hezhong-china.com +hezhongyihua.com hezhou520.com hezhoubbs.com hezhouhuatong.com @@ -46947,7 +46635,6 @@ hg12333.com hg2693.com hg5177.com hg568.com -hg80022.com hg87.com hg8880.org hg9895.com @@ -47007,7 +46694,6 @@ hgyys.com hgzcjt.com hgzk.com hgzkb.com -hgzkj.com hgzrt.com hgzxgz.com hgzxgz.net @@ -47020,7 +46706,6 @@ hh-medic.com hh-pcbs.com hh-pmp.com hh-post.com -hh-wi.com hh.global hh010.com hh88hh.com @@ -47311,7 +46996,6 @@ hilonggroup.com hiloong.com hilqq.com hiluluke.com -hilunwen.com hima.auto himado.com himaker.com @@ -47550,7 +47234,6 @@ hkance.com hkance.xyz hkanews.com hkaohua.com -hkbaike.com.hk hkbchina.com hkca.club hkcd.com @@ -47634,7 +47317,6 @@ hl-brushes.com hl-cat.com hl-epay.com hl-hengsheng.com -hl-plastic.com hl-sl.com hl95.com hl95001.com @@ -47781,10 +47463,8 @@ hm5988.com hmadgz.com hmarathon.com hmbzfjt.com -hmchairs.com hmchina.com hmcl.net -hmdcell.com hmdx.net hmedu.com hmeili.com @@ -48087,7 +47767,6 @@ hnpwholesale.com.au hnqczy.com hnqfseed.com hnqinshi.com -hnqjbh.com hnqlhj.com hnqljj.com hnqljt.com @@ -48209,7 +47888,6 @@ hnwngp.com hnwsbz.com hnwtqx.com hnwtv.com -hnwuxie.com hnwwsjzx.com hnwxw.net hnwyxx.com @@ -48260,7 +47938,6 @@ hnyyyfsyy.com hnyyyz.com hnyzfwlkj.com hnyzzy.com -hnzckjw.com hnzdjsj.com hnzfcgxh.com hnzfgjj.com @@ -48521,7 +48198,6 @@ hongruike.com hongsanban.com hongsat.com hongsegs.com -hongsehuoxian.com hongsejiqing.com hongsenlin.com hongshan.com @@ -48795,7 +48471,6 @@ houdao.net houdask.com houdewl.com houdong999.com -houdunwang.com houdy.com houfaka.com houfangyiyao.com @@ -48866,12 +48541,10 @@ hp.com hp123.com hp888.com hpbgb.com -hpbjy.com hpblog.net hpc.cloud hpccake.com hpccube.com -hpcssc.com hpculturegroup.com hpearx.com hpeft.com @@ -48880,7 +48553,6 @@ hpgamestream.com hpglw.com hpgzf.com hph123.com -hphuishou.com hphwa.com hpicorp.net hpigc.com @@ -49047,7 +48719,6 @@ hrexam.com hrfc.net hrflc.com hrfoods.com -hrgrobotics.com hrgsmz.com hrgxyy.com hrhuiyi.com @@ -49062,7 +48733,6 @@ hro-cosmetics.com hroot.co hroot.com hrpackage.com -hrqxy.com hrrsj.com hrs100.com hrsalon.org @@ -49119,7 +48789,6 @@ hsddyy.com hsdfzp.com hsdjxh.org hsdjz.com -hsdprefabcontainerhouse.com hseda.com hsehome.com hsehome.org @@ -49143,7 +48812,6 @@ hshsxkj.com hshton.com hshuiyi.com hshw.com -hshy.net hsjk.com hsjkaoyan.com hsjpgzx.com @@ -49229,7 +48897,6 @@ hsyunyi.com hsyyf.me hsyymusic.com hsyzg.net -hszhizhen.net hszk.org hszq6.com hszq8.com @@ -49301,7 +48968,6 @@ htjob.net htjs.net htjsq.com htjsq.mobi -htjxsbfw.com htjy.net htkaoyan.com htknow.com @@ -49513,6 +49179,7 @@ huairen588.com huairougreatwallmarathon.com huairtv.com huairui59.com +huaitao.vip huaixin88.com huaiyangnews.com huaji.com @@ -49698,6 +49365,7 @@ huansengifts.com huanshoulv.com huante.com huantest.com +huanting.cc huantour.com huanuomenye.com huanwen.com @@ -49806,8 +49474,10 @@ huategas.com huatengsci.com huati.cc huatian-hotel.com +huatian.net huatianxiangsu.com huatong-logistics.com +huatongcloud.com huatu.com huatugz.com huatuo007.com @@ -49894,7 +49564,6 @@ huaxingchem.com huaxinhz.com huaxinorthop.com huaxinpark.com -huaxinzhuji.com huaxiong.com huaxirc.com huaxj.net @@ -49995,7 +49664,6 @@ hubeiyongtai.com hubeizhengao.com hubiao168.com hubing.online -hubinlu.com hubsound.com hubstudio.vip hubulab.com @@ -50169,6 +49837,7 @@ huiliangapp.com huilianyi.com huililong.com huilintyre.com +huilinwang.com huilitc.com huiliu.net huiliubao.com @@ -50272,7 +49941,6 @@ huiwang.net huiweikeji.com huiwenda.com huiwenjidian.com -huiwo.com huiwww.com huixiang360.com huixianginvest.com @@ -50306,6 +49974,7 @@ huiyijh.com huiyinxun.com huiyizhuo.com huiyou.com +huiyou027.com huiyouhotels.com huiyuandao.com huiyuanjia.net @@ -50425,10 +50094,10 @@ hundsun.com hundun.net hundx.com hunger-valley.com -hunheji.org hunli100.com hunlian100.com hunlihu.com +hunlihu1.com hunlihunli.com hunliji.com hunlimama.com @@ -50625,7 +50294,6 @@ huuhoo.com huuing.com huwaibbs.com huwaizb.com -huwangne.com huwatech.club huway.com huweihuang.com @@ -50751,7 +50419,6 @@ hwyton.com hwyxxx.com hwzn.com hwzyjt.com -hx-gifts.com hx-parking.com hx-qt.com hx-r.com @@ -50859,7 +50526,6 @@ hxqcgf.com hxqcjt.com hxqgczx.com hxqnj.org -hxqssc.com hxqtedu.com hxr100.com hxrc.com @@ -51047,6 +50713,7 @@ hyswcn.com hyswjt.net hysyyl.com hysz.net +hyt01.com hyt368.com hytbj.com hytcshare.com @@ -51375,7 +51042,6 @@ hznetwk.com hznewface.com hznews.com hznkg.com -hznlxs.com hznrkj.com hznsh.com hzntjt.com @@ -51476,7 +51142,6 @@ hztssy.com hztuoliang.com hztvmg.com hztx.com -hztx2020.com hztygd.com hztzkj.net hzvillas.com @@ -51489,7 +51154,6 @@ hzwentou.com hzwer.com hzwf.link hzwgc.com -hzwhbcyxh.com hzwindpower.com hzwlt.com hzwluo.com @@ -51633,7 +51297,6 @@ i0766.com i0898.org i11r.com i121.net -i133.com i1608.com i16949.com i171.com @@ -51764,9 +51427,7 @@ ib-china.com ibaba88.com ibabyjoy.com ibadboy.net -ibaiji.org ibailve.com -ibaimahu.com ibaiqiu.com ibaitiao.com ibaizhu.com @@ -51876,7 +51537,6 @@ ic-mag.com ic-valley.com ic2china.com ic37.com -ic5.cc ic71.com ic72.com ic98.com @@ -52186,7 +51846,6 @@ idaasksyun.com idachu.com idacn.org idadt.com -idaguang.com idailycar.com idaima.com idangyang.com @@ -52494,6 +52153,7 @@ ifindever.com ifintechnews.com ifireeye.com ifireflygame.com +ifish7.com ifitbox.com ifjing.com ifkeji.com @@ -52523,7 +52183,6 @@ ifmtech.com ifmzjt7.com ifnews.com ifnfn.com -ifone360.com ifonelab.net ifonts.com iforce-ad.com @@ -52563,7 +52222,6 @@ igaokaopai.com igaosheng.com igarwin.com igbill.com -igdcc.com igdzc.com igea-un.org igeak.com @@ -52733,7 +52391,6 @@ iiaq.net iiast.com iibechina.com iibq.com -iic6o.com iicall.com iicats.com iicha.com @@ -52745,7 +52402,6 @@ iidx.fun iieii.com iiesz.com iieye.cc -iigs9.com iii80.com iiiaaa.com iiiddd.com @@ -52854,6 +52510,7 @@ ikeguang.com ikeled.com ikemeng.com ikepu.com +ikgambwqeqnv.com ikhimalayaniq.com ikj123.com ikj168.com @@ -52936,7 +52593,6 @@ ilixiangguo.com iliyu.com ilkeji.com illl.xyz -illumpaper.com ilmgq.com ilohas.com iloli.bid @@ -52945,7 +52601,6 @@ ilongre.com ilongterm.com ilonhoo.com iloveanan.com -ilovebarcode.com ilovechao.com ilovefishc.com ilovey.live @@ -53096,8 +52751,8 @@ imglefeng.com imglink.win imgmarket.net imgmg.com -imgnvd.com imgo.tv +imgs.ovh imgscdn.com imgse.com imgsha.com @@ -53114,12 +52769,12 @@ imhuchao.com imiaomeng.com imibaby.net imibao.com -imicang.com imicome.com imifun.com imigu.com imiker.com imile-inc.com +imile.com imitui.com imixpark.com imjiayin.com @@ -53381,6 +53036,7 @@ initialview.com initkk.com initpp.com initroot.com +initrr.com initvv.com initxx.com inja.com @@ -53462,7 +53118,6 @@ insagee.com insarticle.com inshion.com inshotapp.com -insidestuffs.com insigma-elec.com insistence.tech insmoin.com @@ -53490,7 +53145,6 @@ int-agri.com int2018.com int800.com intaek.com -intcache.net intcredo.com intdmp.com intecheye.com @@ -53508,7 +53162,6 @@ inter-credit.net inter-rock.com inter1908.net interactivebrokers.hk -interarknet.com interchinawater.com interface003.com intergreat.com @@ -53560,10 +53213,10 @@ invoee.com invzible.com inwaishe.com inwatch.cc +inwuoo.com inxedu.com inxni.com inyota.com -inyutech.com inzone-auto.com inzotek.com ioa365.com @@ -53650,6 +53303,7 @@ ip.istatmenus.app ip.la ip008.com ip138.com +ip159.com ip192.com ip33.com ip3366.net @@ -53694,7 +53348,6 @@ ipcodm.com ipcorecatalog.com ipctest.com ipcwifi.com -ipcxz.com ipdaili.com ipdatacloud.com ipddz.com @@ -53840,7 +53493,6 @@ iqujing.com iqunix.com iqunix.store iqupdate.com -iqushai.com iqxbf.com iqxedu.com iqyun.cc @@ -54138,7 +53790,6 @@ itany.com itany.org itanzi.com itao.com -itaocow.com itaogw.com itaoke.org itaokecms.com @@ -54304,6 +53955,7 @@ itrus.com itruscloud.com itrusign.com itry.com +its-mo.com its114.com itsapu.com itsdz.com @@ -54348,7 +54000,6 @@ ityears.com ityg.com itying.com ityizu.com -itykc.com itylq.com ityouknow.com ityxb.com @@ -54413,13 +54064,11 @@ ivsky.com ivtfx.com ivu4e.com ivvajob.com -ivvui.com ivweb.io ivwen.com ivxiaoyuan.com ivy-school.org ivybaby.me -ivycoffee.com ivydad.com ivykit.com ivypha.com @@ -54444,7 +54093,6 @@ iwatani-gz.com iwatch365.com iwatertech.com iway-tech.com -iwc999.com iwcoo.com iwebad.com iwebchoice.com @@ -54804,7 +54452,6 @@ javaeye.com javamilk.org javanav.com javascriptcn.com -javashuo.com javatang.com javawind.net javaxxz.com @@ -54819,7 +54466,6 @@ jayce.icu jayfc.com jayfu.tk jayjw.com -jayumovie.com jayxhj.com jaz581.com jazlxs.com @@ -54895,7 +54541,6 @@ jccpay.com jccsoc.com jccug.com jcdd.com -jce8.com jcebid.com jcecom.com jcedu.org @@ -54969,7 +54614,6 @@ jcsfs.com jcsjt.com jcsrsj.com jcssolar.com -jcstem.com jcsy66.com jcszhtc.com jctmj.net @@ -54998,7 +54642,6 @@ jczh100.com jczhijia.com jczhiyao.com jcznzb.com -jczqw.com jd-88.com jd-app.com jd-bbs.com @@ -55099,7 +54742,6 @@ jddj.com jddmoto.com jddtv.com jddyl.com -jddzdq.net jdedu.net jdemall.com jdf999.com @@ -55118,7 +54760,6 @@ jdfzm.com jdgogo.com jdgslb.com jdgslb.net -jdgwdq.com jdgzf.net jdh.com jdh.healthcare @@ -55146,7 +54787,6 @@ jdlgw.com jdlhb.com jdlhpt.com jdlingyu.com -jdmk.xyz jdmwk.com jdmy.com jdnews.net @@ -55190,7 +54830,6 @@ jdx.com jdxc.net jdxfw.com jdxlt.com -jdxpsb.com jdxs.com jdxsr.com jdxyydf.com @@ -55302,7 +54941,6 @@ jewellery.gold jewellworld.com jewelryseeds.com jewelryshanghai.com -jewetek.com jexus.org jeyi.com jeywatch.com @@ -55323,7 +54961,6 @@ jfcjt.com jfcoo.com jfdaily.com jfedu.net -jfewle.com jfgjwl.com jfgou.com jfh.com @@ -55370,7 +55007,6 @@ jgfarm.com jgg.hk jgg09.com jggame.net -jggjj.com jghstar.com jgjapp.com jgjsoft.com @@ -55389,7 +55025,6 @@ jguo.com jgxb120.com jgxzy.com jgy.com -jgyb.net jgyee.com jgyljt.com jgyllh.com @@ -55644,7 +55279,6 @@ jiandaopay.com jiandaoyun.com jiandati.com jiandiao.com -jiane86.com jianeryi.com jianfc.com jianfei.com @@ -55685,7 +55319,6 @@ jiangnan-group.com jiangongdata.com jiangongw.com jiangpaipinpai.com -jiangping.fyi jiangpinjiangxin.com jiangqiaomuye.com jiangque.com @@ -55768,7 +55401,6 @@ jianliyuan.com jianloubao.com jianlow.com jianlu365.com -jianlw.com jianmaidi.com jianmao.net jianmeicao.com @@ -55855,7 +55487,6 @@ jiaobu365.com jiaobuser.com jiaochengzhijia.com jiaoda306.com -jiaodaseo.com jiaodian.pub jiaodj.com jiaodong.net @@ -55883,7 +55514,6 @@ jiaotu.men jiaow.com jiaoya.com jiaoyf.com -jiaoyian.com jiaoyibao.com jiaoyimao.com jiaoyin.com @@ -55905,7 +55535,6 @@ jiapuvip.com jiaqiangban.com jiaqianglian.com jiaqianlee.com -jiaqilixiang.xyz jiaren.org jiarendress.com jiarenrecycle.com @@ -56018,7 +55647,6 @@ jidacheng.com jidaihome.com jidanpu.com jidantuoshebei.com -jidaola.com jide.com jidekan.com jideos.com @@ -56039,12 +55667,10 @@ jiebaogroup.com jiebide.xin jiecang.com jiecangtubemotors.com -jiecao.com jiechengcehui.com jiechengcloud.com jiechikeji.com jiechuang.com -jiededy.com jiediankeji.com jiefadg.com jiefanglinli.net @@ -56063,7 +55689,6 @@ jiehuigroup.com jiehun021.com jiehun027.com jiejichengshi.com -jiejiecup.com jiejing.fun jiekenmould.com jiekon.com @@ -56141,6 +55766,7 @@ jifenapp.com jifencity.com jifenfu.net jifengkj.com +jifengyun.com jifenh.com jifenyi.com jifenyouhuidui.com @@ -56197,6 +55823,8 @@ jike.info jike800.com jikecdn.com jikedata.com +jikedingyue.com +jikedog.com jikefan.com jikegou.net jikeiot.cloud @@ -56213,7 +55841,6 @@ jikipedia.com jilaihuyu.com jilailawyer.com jilaoshi.com -jileniao.net jiletaotao.com jili20.com jiliguala.com @@ -56282,7 +55909,6 @@ jinbifun.com jinbilianmeng.com jinbitou.net jinbondt.com -jinbumao.com jincaicaiwu.com jincao.com jincaocw.com @@ -56525,6 +56151,7 @@ jinhongchina.com jinhonggroup.com jinhongnl.com jinhu.me +jinhuapp.com jinhuatv.com jinhuawatch.com jinhuazhe.com @@ -56716,7 +56343,6 @@ jintouwangdai.com jintuituiapp88.com jinwaimai.com jinweitec.com -jinwin.net jinwucdn.com jinxiang114.com jinxianglian.net @@ -56819,7 +56445,6 @@ jisuanla.com jisuanzt.com jisuapi.com jisuchou.com -jisuclouds.com jisuim.com jisuimage.com jisuimg.com @@ -57203,7 +56828,6 @@ jjzyy.com jk-bms.com jk-px.com jk.com -jk123.net jk126.com jk13.net jk169.net @@ -57211,7 +56835,6 @@ jk2h.com jk37du.com jk3a.com jk51.com -jk520.net jk725.com jk90.com jkangbao.com @@ -57225,6 +56848,7 @@ jkcn365.com jkcorkpads.com jkcsjd.com jkd.com +jkd360.com jkdsz.com jkelec.com jkh-ym.com @@ -57363,7 +56987,6 @@ jlonline.com jlpay.com jlq.com jlqsugar.com -jlrcom.com jlriza.com jlrtvu.com jlscjrkf.com @@ -57387,7 +57010,6 @@ jlsw.cc jlswansen.com jlsyqzyy.com jlszlyy.com -jlszykj.com jlt01.com jltchina.com jltq.com @@ -57475,7 +57097,6 @@ jmwater.com jmwww.net jmxckj.com jmxiangyi.com -jmxingtang.com jmxlmc.com jmxw.net jmycapacitor.com @@ -57542,7 +57163,6 @@ jnjingxin.com jnjj.com jnjpkj.com jnjszl.com -jnjtsc.com jnkason.com jnky.com jnlab.com @@ -57824,7 +57444,6 @@ joyu.com joyuai.com joyugas.com joyulf.com -joyuyx.com joyware.com joywellsemi.com joywii.net @@ -57850,7 +57469,6 @@ jpddc.com jpedo.com jpeen.com jperation.com -jpfans.com jpfmor.com jpg.cm jpghd.com @@ -57889,7 +57507,6 @@ jpwindow.com jpwky.com jpwxapp.com jpxm.com -jpxs.org jpxue.com jpxww.com jpyoo.com @@ -57957,7 +57574,6 @@ jrmianban.com jrnba.cc jrntv.com jrpengze.com -jrptweb.org jrqiwen.com jrqzw.net jrsncn.com @@ -58120,7 +57736,6 @@ jsepa.com jser.io jsessh.com jsexpressway.com -jsf666.com jsfish.net jsfj.net jsfls.com @@ -58286,7 +57901,6 @@ jskjgc.com jskjgroup.com jsklcy.com jskly.com -jskmmy.com jskoso.com jskpcg.org jskuajing.com @@ -58325,7 +57939,6 @@ jsmodeling.com jsmolfa.com jsmrmf.com jsmsg.com -jsmuseum.com jsmxgs.com jsmxw.com jsnaier.com @@ -58562,6 +58175,7 @@ jsycport.com jsycsy.com jsyczls.com jsyd139.com +jsydns15.com jsyes123.com jsyf88.com jsyfxcl.com @@ -58656,7 +58270,6 @@ jtfengtou.com jtfulfillment.com jtg2g.com jtggame.com -jtggb.com jtgloble.com jtgzfw.com jthcsx.com @@ -58688,7 +58301,6 @@ jtnsh.com jto8.com jtpipeline.com jtrauto.com -jtrhc.fun jtrobots.com jtso.net jtsp98.com @@ -58718,7 +58330,6 @@ juanyunkeji.com juaq.com jubaihuijia.com jubaiye.com -jubaopay.com jubaozang.com juben108.com juben68.com @@ -58805,18 +58416,15 @@ jujiangkk.com jujiangktz.com jujiaobaby.com jujiaonet.com -jujiaozs.com jujias.com jujie.com jujienet.com jujin8.com jujinpcb.com jujinwater.com -jujiu8.com jujoy.com jujumao.com jukan.net -jukandiannews.com juke200.com jukebao.com jukejia.com @@ -58831,7 +58439,6 @@ julanling.com julecn.com julefun.com juli-china.com -julialabarge.com juliandianqi.com juliang8.com juliangcili.com @@ -58960,7 +58567,6 @@ juntec.com juntu.com juntuan.net junwu262.com -junxianhr.com junxinmed.com junyao.tech junyi-auto.com @@ -59286,7 +58892,6 @@ jxnjy.com jxnongjiayuan.com jxnxs.com jxnyc.net -jxorg.com jxpdf.com jxphone.com jxphyz.com @@ -59357,7 +58962,6 @@ jxtyzx.org jxtzw.com jxunicom.com jxveg.org -jxw123.com jxw12328.com jxwan.com jxwmanage.com @@ -59392,7 +58996,6 @@ jxzikao.net jxzl.cc jxzxtec.com jxzyx.com -jy-dengju.com jy-leasing.com jy-mach.com jy-sz.net @@ -59459,7 +59062,6 @@ jyjxtech.com jykm88.com jykss.com jykuaidi.com -jyl1688.com jyl88.com jylight.cc jylink.com @@ -59524,11 +59126,11 @@ jywlcm.com jywmgs.com jywxq.com jyxdyzx.com -jyy010.com jyykyy.com jyyun.com jyzb01.com jyzc.com +jyzhongg.com jyzz666.com jyzzdq.com jyzzx.com @@ -59570,7 +59172,6 @@ jzgc-school.com jzgchy.com jzgcjsysjzz.com jzgcjszz.com -jzgcsl.com jzgczz.com jzgede.com jzggzy.com @@ -59587,10 +59188,8 @@ jzj2009.com jzj9999.com jzjgift.com jzjt.com -jzkelida.com jzking.com jzkjjt.com -jzkoo.net jzlt100.com jzmbti.com jzmjtjn.xyz @@ -59602,7 +59201,6 @@ jznygf.com jznyjt.com jzongguan.com jzpat.com -jzpbuy.com jzptt.com jzpu.com jzpx.net @@ -59688,7 +59286,6 @@ k8008.com k8azeicxy4idx.com k8k8k8.com k8ser.com -k8sj.com k8smeetup.com k8stech.net k913.com @@ -59718,6 +59315,7 @@ kafeng.com kagirl.net kah8.com kahaozhushou.com +kahuodong.com kai-asia-hk.com kai-lun.net kai-ying.com @@ -59756,7 +59354,6 @@ kaigongyi.com kaiguo.com kaihei.co kaihu51.com -kaihuacar.com kaihuaeva.com kaihuia.com kaijia-smt.com @@ -59775,6 +59372,7 @@ kaimanhua.com kaimen360.com kaimg.com kaimitech.com +kaipai.com kaipanla.com kaipuyun.com kaipuyun.net @@ -59845,7 +59443,6 @@ kaizhan.com kajicam.com kajishou.com kaka.com -kaka3.com kaka996.com kakacl.net kakalili.com @@ -60077,7 +59674,6 @@ kaopujinfu.com kaopuyun.com kaopuyun.net kaoqin.com -kaoqinjiweb.com kaoqintong.net kaoqinyi.com kaoruo.com @@ -60090,11 +59686,11 @@ kaoshibaike.com kaoshibao.com kaoshibb.com kaoshidian.com +kaoshixing.com kaoshizixun.com kaosite.com kaostedu.com kaotipai.com -kaotop.com kaowana.com kaowang.com kaowx.com @@ -60253,7 +59849,6 @@ kdweibo.com kdzs.com kdzwy.com kdzxedu.com -kdzyy.net ke-chuang.com ke.com ke51.com @@ -60306,7 +59901,6 @@ keduxinxi.com kedwyz.com keede.com keejuu.com -keem6.com keen-dental.com keenbow.com keenonrobot.com @@ -60340,7 +59934,6 @@ kehanedu.com kehaohao.com kehou.com kehu51.com -kehua360.com kehuaapp.com kehuan-upward.com kehuda.com @@ -60399,11 +59992,9 @@ kelete.com keliangtek.com kelibiao.com kelikt.com -kelilens.com kelimotor.com kelinpower.com kelinsoft.com -kelkjj.com kelon.com kelong-chemical.com kelong-powder.com @@ -60634,7 +60225,6 @@ kiaic.com kiana.love kiapmyf.xyz kibinggroup.com -kickoffo.site kicontech.com kid17.com kiddopal.com @@ -60767,7 +60357,6 @@ kingsunsoft.com kingtaifook.com kingtroldata.com kingtysin.com -kinguid.com kingview.com kingwisoft.com kingyield.com @@ -60792,6 +60381,7 @@ kinzhan.com kinzoncap.com kiomodesign.com kira.cool +kirakuapp.com kirgen.com kiriko-china.com kirin-tech.com @@ -60900,7 +60490,6 @@ kk1bie336689.com kk30.com kk30.net kk3g.net -kk888888kk.com kkabc.com kkapp.com kkcache.net @@ -61048,7 +60637,6 @@ kmgdgs.com kmgg88.com kmguolv.com kmgybsr.com -kmhdjz.com kmhpc.net kmhwtz.com kmhybz.com @@ -61088,7 +60676,6 @@ kmw.com kmwatersupply.com kmway.com kmwx.net -kmxg.net kmxkh.com kmxqt.com kmxyj.com @@ -61113,7 +60700,6 @@ knfeco.com knight-un.com knightedge.com knightli.com -knightyoung.asia kninebox.com knj-nanjing.com knn-nj.com @@ -61128,6 +60714,7 @@ knowhowedu.com knowingclouds.com knowingcloudvip.com knowingyun.com +knowlink-assets.com knownpcb.com knownsec.com knowsafe.com @@ -61190,7 +60777,6 @@ kongapi.com kongbugushi.com kongdao.com kongduan.com -kongfou.net kongfz.com kongge.com kongjianjia.com @@ -61340,7 +60926,6 @@ kqalevel.com kqapi.com kqgeo.com kqgyl.com -kqidong.com kqj123.com kqjtj.com kqjtj.net @@ -61523,7 +61108,6 @@ ktlstbg.com ktmap.com ktmv.com ktmwan.net -ktokib.com ktovztie.com ktplay.com ktrcn.com @@ -61691,7 +61275,6 @@ kuaiwan.com kuaiwenyun.com kuaixiazai.com kuaixue.com -kuaixun360.com kuaiyan.com kuaiyankanshu.org kuaiyiad.com @@ -61731,7 +61314,6 @@ kuajinzhifu.com kuakao.com kuakao.net kuake8.com -kuamarketer.com kuaming.com kuandaige.com kuanfans.com @@ -61748,7 +61330,6 @@ kuangming.com kuangshitech.com kuangshun.com kuangstudy.com -kuangwan.tv kuangxiangit.com kuangyeyuan.com kuangyi.com @@ -62032,7 +61613,6 @@ kwaiying.com kwaiymx64war5a7f.com kwaizt.com kwangfeng.com -kwgaewsl.shop kwggroupholdings.com kwimgs.com kwinbon.com @@ -62102,10 +61682,8 @@ kxx2.com kxxsc.com kxxxl.com kxyyf.com -ky-cable.com ky-express.com ky.live -ky0ip30.com ky393834.com ky5yx.com ky6yx.com @@ -62177,7 +61755,6 @@ kzmyhome.com kzrcw.com kzread.com kzrqicae.com -kztpms.com kztsjj.com kzwr.com kzwx.net @@ -62222,7 +61799,6 @@ labno3.com labpyx.com labuladong.online labview.help -labworld.cc labxing.com labzj.com lacaoshi.com @@ -62254,7 +61830,6 @@ lagoujobs.com laguaba.com laguke.com lahuashanbx.com -lahuobao56.com lahuolaozao.com lai-ai.com laianbbs.com @@ -62467,7 +62042,6 @@ langrenclub.com langrensha.net langruiyun.com langsajiasi.com -langsheng-eco.com langsong.site langtao.cc langtaojin.com @@ -62564,7 +62138,6 @@ lansurcn.com lantaochina.com lantiangufen.com lantianyu.net -lanting123.com lantinglou.com lantumap.com lantushiji.com @@ -62723,7 +62296,6 @@ lapin365.com laplace-semi.com lapulace.com laravel-admin.org -laravel-china.org laravelacademy.org larenla.com large.net @@ -62762,7 +62334,6 @@ laruence.com lasashengdi.com laschina.org lascn.net -laser-dhc.com laser568.com laserfair.com laserjg.com @@ -62793,6 +62364,7 @@ lavaradio.com lavdrzv.xyz law-lib.com law-star.com +law-wei.com law01.net law6888.com lawasst.com @@ -62948,6 +62520,7 @@ lcfby.com lcfcw.com lcfgjs.com lcfile.com +lcftech.com lcfw.co lcgdbzz.org lcgjcj.com @@ -63030,6 +62603,7 @@ ldgjj.com ldgslb.com ldhrd.com ldhxbj.com +ldhy.click ldj-edujy.com ldjt-china.com ldkftz.com @@ -63183,7 +62757,6 @@ ledctl.com lede.com ledguhon.com ledhyzm.com -ledianduo.com ledianyun.com lediaocha.com ledmary.com @@ -63205,7 +62778,6 @@ leeleo.vip leenzee.com leenzhu.com leeon.me -leepoint.net leesdog.space leeshen.net leesoar.com @@ -63351,6 +62923,7 @@ lemonpiggy.com lemonplus.asia lemonsay.com lemonttt.com +lemonvp.com lemonyd.com lemote.com lempstack.com @@ -63799,7 +63372,6 @@ lianhecang.com lianhejiaju.com lianhengtec.com lianhepaimai.com -lianhjz.com lianhuangroup.com lianjia.com lianjianode.xyz @@ -63817,7 +63389,6 @@ lianku.xin liankuaiche.com lianli168.com lianlian.com -lianlianchem.com lianlianlvyou.com lianlianpay-inc.com lianlianpay.com @@ -63856,7 +63427,6 @@ lianwo8.com lianwwl.com lianxianjia.com lianxinapp.com -lianxing.org lianxinkj.com lianyi.com lianyins.com @@ -63880,7 +63450,6 @@ liaogx.com liaoing.com liaoji.com liaojiu.net -liaokeyu.com liaokong.com liaoliao.com liaoningmoduo.com @@ -63889,6 +63458,7 @@ liaosam.com liaoshenrc.com liaotiantu.com liaowei.net +liaoworking.com liaoxiwenhua.com liaoxuefeng.com liaoyuanchats.com @@ -64098,7 +63668,6 @@ lihuasoft.net lihui.net lihuia.com lihun66.com -lihunlawer.com liigou.com lijiabaijc.com lijiabrasstube.com @@ -64120,6 +63689,7 @@ likamao.com likangwei.com like.video like996.icu +likeaboat2023.com likeacg.com likebuy.com likecha.com @@ -64198,7 +63768,6 @@ linfan.com linfeicloud.com linfen365.com linfeng.tech -linfenshenzhou.com linfenwater.net ling-shi.com lingangholding.com @@ -64249,6 +63818,7 @@ linglonglife.com linglongtech.com lingmao.tech lingmeijie.com +lingmeng888.com lingmovie.com lingnanpass.com lingo-ace.com @@ -64298,6 +63868,7 @@ lingxingkj.com lingxiuwenlv.com lingxmall.com lingy.cc +lingyanghuyu.com lingyi.org lingyifang.com lingyihanhua.com @@ -64420,7 +63991,6 @@ linovel.net linovelib.com linoya.com linpx.com -linqijin.com linqujob.com linqumarathon.com linruanwangluo.com @@ -64597,7 +64167,6 @@ litten.me little-star.love little-sun.com littleboy.net -littlefoxgroup.com littlehero.xyz littleqiu.net littleroost.net @@ -64728,7 +64297,6 @@ liuyuechuan.com liuyunliumeng.com liuyuntian.com liuzaoqi.com -liuzekang.com liuzhihang.com liuzhixiang.com liuzhiyugzs.com @@ -64738,7 +64306,6 @@ liuzhoukaichuang.com liuzhourm.com liuzhousteel.com liuzhuni.com -liuzi.net liuzitang.com liuziyoudu.com liuzongyang.com @@ -64890,9 +64457,7 @@ lizikeji.vip lizilaw.com liziqiche.com lizitongxue.com -liziwl.com liziwu.net -lizixin.cool liziyuan.com lizq.host lj-audio.com @@ -65018,7 +64583,6 @@ llsserver.com llssite.com llsttapp.com llsun.com -lltllt.com lltoken.com lltskb.com llumar-cn.com @@ -65047,7 +64611,6 @@ lmbus.com lmdk01.com lmdouble.com lmengcity.com -lmfdt.com lmjd2.app lmjtgs.com lmjx.net @@ -65172,7 +64735,6 @@ lnzzpf.com lo97.com loac.cc loadingbay.com -loan163.com loansliml.com local-ip.online localizecdn.com @@ -65331,7 +64893,6 @@ longhuvip.com longi.com longigroup.com longjcun.com -longjiaowan.com longjiazuo.com longjisteel.com longjisz.com @@ -65446,8 +65007,6 @@ lookao.com lookbaby.com lookbravo.com lookchem.com -lookcss.com -lookedu.net lookfor.one lookgame.com looking-car.com @@ -65505,7 +65064,6 @@ lotusair.net lotusdata.com lotusfr.com lotut.com -lou86.com loubobooo.com louding.com loudseas.com @@ -65533,7 +65091,6 @@ loveabc.net lovean.com loveapp.com lovebizhi.com -lovebuy99.com lovedword.com loveforvenus.com lovefree.cc @@ -65559,7 +65116,6 @@ loveota.com loveota.net lovepd.com loverdoor.com -loveroise.com lovesec.com loveshang.com lovesoo.org @@ -65582,7 +65138,6 @@ loyi.net loyo.cc loystnetwork.com lp.fyi -lp006.com lp023.com lp025.com lp91.com @@ -65620,7 +65175,6 @@ lqbby.com lqbj.com lqbj66.com lqfeather.com -lqgrdj.com lqhualang.com lqjob88.com lqjt.com @@ -65732,7 +65286,6 @@ lsmaps.com lsmtjy.com lsmzt.cc lsnm.com -lsoli.com lsoos.com lspjy.com lsplayer.com @@ -65886,7 +65439,6 @@ luchengas.com luchentech.com luchenwater.com luchuang.com -luchuanquan.com luciaz.me lucifer.ren lucifr.com @@ -66010,7 +65562,6 @@ lunlunapp.com lunwenf.com lunwengo.net lunwenlib.com -lunwenschool.com lunwenstudy.com lunwentong.com lunwenxiazai.com @@ -66105,7 +65656,6 @@ lushangroups.com lushaojun.com lushifu.net lushu.com -lushuyu.site lusongsong.com luspet.com lussac.net @@ -66123,7 +65673,6 @@ lutongnet.com luv66.com luwei.me luweiwater.com -luwoff.com luxe.cc luxe.co luxemon.com @@ -66209,7 +65758,6 @@ lvfapiao.com lvgangss.com lvgou.com lvgset.com -lvguang.net lvguo.net lvjhx.com lvjiaoya121.com @@ -66238,7 +65786,6 @@ lvneng.com lvnengliang.com lvpai114.com lvpin100.com -lvping.com lvpu-chem.com lvqingqichangjia.com lvrdn.com @@ -66345,7 +65892,6 @@ lxbio.net lxbtrip.com lxccl.com lxcdns.com -lxcsc.com lxcvc.com lxdas.com lxdfs.com @@ -66510,6 +66056,8 @@ lyhomestayinn.com lyhuadu.com lyhx.net lyia.org +lyihub.com +lyilife.com lyjiuzhou.com lyjj.net lyjksw.com @@ -66601,6 +66149,7 @@ lyyzedu.com lyz810.com lyzaix.com lyzb.com +lyzb33.app lyzfgjj.com lyzggs.com lyzhanlang.com @@ -66791,12 +66340,10 @@ lztb.com lztdzy.com lzteli.com lztlcyxx.com -lztv.tv lztvnet.com lztx123.com lztxw.com lztzgroup.com -lzw.me lzweidaoyou.com lzwg.com lzwi.fun @@ -67004,7 +66551,6 @@ madio.net madisonboom.com madissonline.com madmalls.com -madouer.com madouvip.com madsrevolution.net maemo.cc @@ -67156,7 +66702,6 @@ maitao.com maitaowang.com maitegao.com maitewang.com -maitianquan.com maitix.com maitix.net maitu.cc @@ -67252,7 +66797,6 @@ malong.com malsmiles.com maltm.com mama100.com -mamabaobao.com mamacn.com mamahao.com mamahuo.com @@ -67311,6 +66855,7 @@ mangpielb.com mangren.com mangrovetek.com mangrovetreeresort.com +mangtian.com mangtuhuyu.com manguo42.com mangxia.com @@ -67332,6 +66877,7 @@ manjiwang.com mankebao.com mankewenxue.cc manlaxy.com +manli.ltd manlinggame.com manlinwood.com manluoni.com @@ -67396,7 +66942,6 @@ maogua.com maogumaogu.com maogx.win maoha.com -maohaha.com maohongdz.com maojiaoque.com maojiuxs.com @@ -67405,6 +66950,7 @@ maoken.com maoln.com maolog.com maolvtv.com +maomao365.com maomaoche.com maomaoxue.com maomaoyuanma.com @@ -67755,6 +67301,7 @@ mc-ccpit.com mc-dj.com mc-f.com mc-test.com +mc-user.com mc-xborder.com mc.cc mc1314.com @@ -67783,7 +67330,6 @@ mcearnmore.com mcecy.com mceebbs.com mcfound.net -mcfsji.com mcfun.tv mcfxw.com mcgsjt.com @@ -67839,6 +67385,7 @@ mcwizrd.com mcwshop.com mcx666.com mcxzs.com +mcy003.org mcyhfl.com mcypls.com mcyz.com @@ -67852,7 +67399,6 @@ md-store.com.tw md5ma.com md6v3pq.com mdapp.tv -mdaxue.com mdbchina.com mdbimg.com mdclub.org @@ -68194,6 +67740,7 @@ meishesdk.com meishi.cc meishi13.com meishichina.com +meishiffx.online meishij.net meishijr.com meishilife.com @@ -68224,6 +67771,7 @@ meitu-int.com meitu-mobile.com meitu.com meitu.net +meituaccount.com meituan.com meituan.net meitubase.com @@ -68255,6 +67803,7 @@ meitupic.com meitupingzi.com meituriji.com meiturom.com +meitushijie.com meitushop.com meitushouji.com meitusnap.com @@ -68294,7 +67843,6 @@ meiyanstatic.com meiyatour.com meiye.art meiyedana.com -meiyejob.com meiyes.com meiyi.ai meiyinji.vip @@ -68438,7 +67986,6 @@ mereith.com mergeek.com merklechina.com merkpd.com -merlinexh.com merlinmedicine.com mero-db.com merries-china.com @@ -68453,7 +68000,6 @@ mesou.net mesowe.com mesresearch.com messecloud.com -mesule.com met.red met169.com meta-stone.com @@ -68505,7 +68051,6 @@ meu95otw4967t.com meuicat.com meutu.com mevionchina.com -mevyyk.com mew.fun mewx.art mexicopanama.com @@ -68536,7 +68081,6 @@ mfexcel.com mfg-magnets.com mfgchn.com mfhcd.com -mficp.com mfinetech.com mfisp.com mfjl.wiki @@ -68769,7 +68313,6 @@ mice-gz.org micecn.com michael-j.net michaelapp.com -michelleventon.com michoi.com michong.com michplay.com @@ -68811,6 +68354,7 @@ microxiang.com microyan.com microzuji.com mictormedical.com +micu.hk micw.com micyjz.com mid-link.net @@ -68877,6 +68421,7 @@ migames.com migelab.com miglioriorologi.com migood.net +migu.store migucloud.com migufm.com migufun.com @@ -68897,6 +68442,7 @@ mihoyocloud.com mihoyogift.com mihoyomall.com mihua.net +mihuachat.com mihuangame.com mihuashi.com mihuatown.com @@ -69085,6 +68631,7 @@ mingpian.biz mingpian.net mingqi.co mingqian666.com +mingqu.xyz mingr.com mingren888.com mingricctv.com @@ -69107,7 +68654,6 @@ mingxigu.com mingxingku.com mingxinglai.com mingxuan.store -mingxuanxz.com mingya.mobi mingyafeng.com mingyang100.com @@ -69177,7 +68723,6 @@ minkave.com minking.cc minleai.com minli.com -minlida.com minmetals.com minor-tech.com minovapharma.com @@ -69199,7 +68744,6 @@ mintmuse.com mintrust.com mints-id.com minunix.com -minxindai.com minxing365.com minxiwang.com minxue.net @@ -69246,7 +68790,6 @@ mirmzhy.com mirreal.net mirrorcast.tv mirrorchyan.com -mirrorcn.com misaka.center misall.com miscd.com @@ -69559,7 +69102,6 @@ mnancheng.com mnbvbqw.com mnbvdfg.com mnbvtgv.com -mnclighting.com mndqlib.net mnengine.com mnihyc.com @@ -69577,6 +69119,7 @@ moa06240ju.com moa06250ju.com moage.com mob55.com +mobai.sbs mobaibox.com moban.com mobanhao.com @@ -69799,7 +69342,6 @@ mokamrp.com mokatyper.com mokayuedu.com moke.com -moke9.com mokeyjay.com moko.cc mokxing.com @@ -70009,7 +69551,6 @@ motilive.com motimaster.com motimo.com motisky.com -motnt.com moto-one.com.hk moto8.com moto8.net @@ -70085,7 +69626,6 @@ moziqing.com mozouyan.com mp.cc mp17.com -mp3-switch.com mp4ba.com mp4cn.com mpaascloud.com @@ -70112,7 +69652,6 @@ mpnbenefitsrtl.download.prss.microsoft.com mpnbenefitsrtluat.download.prss.microsoft.com mpoa.vip mpopkart.com -mpronnn.com mpserverless.com mpsoft.net mpxiaomi.net @@ -70141,7 +69680,6 @@ mr-ping.com mr77.com mr91.com mrbanana.com -mrbcq.com mrbird.cc mrbook114.com mrcrm.com @@ -70201,7 +69739,6 @@ msd-facing.com msddp.com msdn.download.prss.microsoft.com msdn.hk -msdn.im msdnxitong.com msdpmarathon.com msdprc.com @@ -70367,7 +69904,6 @@ much001.com muchangqing.com muchcloud.com muchong.com -muchrank.com muchunkang.com mudanauto.com mudgj.com @@ -70406,7 +69942,6 @@ mulangbrand.com mulanlake.com mulazim.com mulightapp.com -mulingyuer.com mulinsen.com mulinyun.com multi-parking.com @@ -70417,6 +69952,7 @@ mumayi.com mumbuy365.com mumingfang.com mumunv.com +mumuplayer.com mumuxili.com mundane.ink mungerlab.net @@ -70468,7 +70004,6 @@ mutean.com mutian.net mutianyugreatwall.com mutieffect.com -mutoe.com mutouxb.com mutouyu.com mutualhunter.com @@ -70507,7 +70042,6 @@ muzisoft.com muziyueqiu.com muzuhui.com mvashanghai.org -mvcat.com mvhere.com mvmaster.com mvoicer.com @@ -70538,7 +70072,6 @@ mwkhjc.com mwquicio.com mwrf.net mwrfabc.com -mwsbwcl.com mwstore.com mwtee.com mwtg.vip @@ -70557,7 +70090,6 @@ mxbc.com mxbc.net mxbiao.com mxbsy.com -mxceyjj.com mxchip.com mxddp.com mxde.com @@ -70627,6 +70159,7 @@ my089.com my120.org my147.com my1616.net +my22.art my22.fun my22.info my2852.com @@ -70707,6 +70240,7 @@ mycosresearch.net mycoss.com mycoss.net mycoss.org +mycplife.com mycqgc.com mycreate.net mycyjg.com @@ -70723,7 +70257,6 @@ mydidadi.com mydigi.net mydigit.net mydigitex.com -mydiyclub.com mydnns.com mydns114.net mydns8.com @@ -70794,7 +70327,6 @@ myimis.com myip.la myiplay.com myir-tech.com -myiroom.com myirtech.com myitit.com myityun.com @@ -70804,7 +70336,6 @@ myjiedian.com myjob.com myjob500.com myjoy777.com -myjql.com myjujing.com myk3.com mykarry.com @@ -70812,6 +70343,7 @@ mykd.cc mykeeta.com mykqyy.com mykscdn.com +mykuaidi.com mykuaiji.com mylbabao.com mylguoji.com @@ -71079,13 +70611,11 @@ n3sd.com n459.com n5w.com n63.com -n7433.com n802.com n8soft.com n9z.net na-mexico-1.myhuaweicloud.com na.ci -na2sib.com naaln.com nabluemedia.com naboyi.com @@ -71128,6 +70658,7 @@ naitta.com naiveadmin.com naiveblue.com naiwch.com +naixi.com naixuecha.com naiyouxuexi.com najingtech.com @@ -71142,7 +70673,6 @@ nalanchuanmei.com nalanxi.com nalati.com nalichi.com -name1688.com name2012.com name321.net nameidi.com @@ -71227,7 +70757,6 @@ nanjingtianqi114.com nanjingttym.com nanjingxinxu.com nanjingyinuo.com -nanjingzyhb.com nanjix.net nanjixiong.com nankaimba.org @@ -71388,7 +70917,6 @@ nb-bailing.com nb-jf.com nb-jiale.com nb-medicalsystem.com -nb0817.com nb160.com nb591.com nba.com @@ -71676,6 +71204,7 @@ necgokr2-724.acs.wecandeo.com necool.com nedfon.co nedigitals.com +neeca.net neefood.com neegle.net neeinn.com @@ -71693,6 +71222,7 @@ neihancommunity.com neihancommunity.net neihandiantai.com neihanfly.com +neihang.net neihanshequ.com neimaowang.com neimenggugames.com @@ -71813,7 +71343,6 @@ netpi.me netpoint25.com netposa.com netqd.com -netreds.com netsmell.com netspreading.com netstatic.net @@ -71993,7 +71522,6 @@ newxing.com newxitong.com newxue.com newyanshamall.com -newyiben.com newyifagroup.com newyishi.com newyorkluxurywatch.com @@ -72209,7 +71737,6 @@ nics365.com nicsbuy.com nicwind.com nidecms.com -nidekash.com nidiandaojia.com nie.io nieapps.com @@ -72289,7 +71816,6 @@ ningkekeji.com ninglutech.com ningma.com ningmengdou.com -ningmengsdfysdn.com ningmengyun.com ningshing.com ningtingche.com @@ -72414,7 +71940,6 @@ nj-kejin.com nj-kk.com nj-maici.com nj-nanhuai.com -nj-netgalaxy.com nj-newhope.com nj-qiyiguo.net nj-reagent.com @@ -72751,7 +72276,6 @@ njrzkj.com njsadz.com njsanhui.com njsbz.net -njsc-trade.com njsdjt.com njsdyy.com njsech.com @@ -72829,7 +72353,6 @@ njwcjx.com njwds.com njweixiao.com njweiyi6.com -njwljd.com njwmbj.com njwpdi.com njwqqx.com @@ -72874,7 +72397,6 @@ njyouwin.com njypk.com njyqhj.com njyqmj.com -njyshb.com njyspharma.com njysw.com njytian.com @@ -73020,8 +72542,6 @@ nn-jinlun.com nn-tct.com nn.com nn11001.com -nn11022.com -nn11661.com nn11771.com nn12333.com nn1yy.com @@ -73054,7 +72574,6 @@ nnboyi.com nnbsjyk.com nnbtl.com nnbupin.com -nnbvr.com nnbyg.com nncbre.com nncc626.com @@ -73207,7 +72726,6 @@ nnkj77.com nnkqfs.com nnkxnz.com nnlanfang.com -nnlbsh.com nnlfcm.com nnlghbkj.com nnlgjt.com @@ -73229,7 +72747,6 @@ nnmhzc.com nnminghe.com nnmingyuanyun.com nnmjm.com -nnmov.com nnmsjdgs.com nnmutong.com nnmwsy.com @@ -73344,7 +72861,6 @@ nnxqy.com nnxsypco.com nnxt.net nnxxzl.com -nnyarun.com nnybf.com nnybskq.com nnych.com @@ -73475,7 +72991,6 @@ nongnet.com nongpin88.com nongplay.com nongshang.com -nongtongyi.com nongxinyin.com nongyao001.com nongye.tv @@ -73601,7 +73116,6 @@ nowre.com nows.fun nowscore.com nowtop.net -nowwon.xyz nowxz.com noxagile.duapp.com noxgroup.com @@ -73653,7 +73167,6 @@ nrbbearing.com nrdzqwd.com nrec.com nrenba.com -nresm.com nri-beijing.com nrisc.com nrmchina.com @@ -73732,6 +73245,7 @@ nsydt.com nsynu.com nszmz.com nszxsyxx.com +nszynd66ggbcx.com nt.app nt.cc nt56.net @@ -73928,7 +73442,6 @@ nwdlink.com nweon.com nwncd.com nwshotel.com -nwswn.com nx-sc.com nx.cm nx5.com @@ -73942,7 +73455,6 @@ nxengine.com nxez.com nxgangyi.com nxgjbyy.com -nxgqt.org nxgtjt.com nxgyzb.com nxhongshanhe.com @@ -74010,7 +73522,6 @@ nync.com nypd520.com nyq.ink nyrmyy.com -nyrsksw.com nysenba.com nysgjgs.com nyshipyard.com @@ -74101,7 +73612,6 @@ oahelp.net oaimai.com oait360.com oak-amc.com -oaklandjs.com oaloft.com oaloft.net oalur.com @@ -74119,7 +73629,6 @@ obagame.com obai.cc obaku.com obatsipilisjos.com -obd2sale.com obd2top.com obeishi.com obesu.com @@ -74266,7 +73775,6 @@ offside.hk ofgame.net ofidc.com ofo.com -ofo2025.com ofopp.com ofpay.com ofpay365.com @@ -74528,7 +74036,6 @@ onedict.com onedns.net oneflys.com onefoot365.com -onegg.site onegobrand.com onegreen.net onehome.me @@ -74550,7 +74057,6 @@ onenice.tech oneniceapp.com onenoter.com oneonewrite.com -onephper.com oneplus.com oneplus.net oneplus6666.com @@ -74815,7 +74321,6 @@ opython.com oqrstu.com oqss.com or-sun.com -or77.net oracle-tencent.com oracle-tencent.net oracle.com @@ -74976,7 +74481,6 @@ osredm.com osrelease.download.prss.microsoft.com oss-cn-beijing-aliyuncs.com oss.link -oss.so ossdshxh.com osslan.com osuxrq.com @@ -75148,7 +74652,6 @@ ourwebpic.info ourwebpic.net ourwebpic.org ourwebpicvip.com -ourxun.com ouryao.com ousaikj.com oushangstyle.com @@ -75156,7 +74659,6 @@ oushidiban.net oushinet.com oushisheng.com oushivoyages.com -oushiyimulayou.com ousweixin.com outes.com outfit7.com @@ -75361,7 +74863,6 @@ paibaohy.com paichen.net paichi.com paidai.com -paidai.org paidui.com paiduidai.com paigepian.com @@ -75370,7 +74871,6 @@ paihang360.com paihang8.com paihb.com paihotels.cc -paike360.com paikew.com paiky.com paiky.net @@ -75380,7 +74880,6 @@ paimaprint.com paiming.net paintinghere.org paints.market -paiorg.com paipai.com paipai123.com paipaibang.com @@ -75642,7 +75141,6 @@ parkbees.com parketech.com parkicloud.com parking520.com -parkingadsaas.com parkinginfoweb.com parkingjet.com parkingos.club @@ -75849,7 +75347,6 @@ pddim.com pddpic.com pddugc.com pddxfd.com -pddzj.com pdeepmatrix.com pdf.la pdf00.com @@ -75857,7 +75354,6 @@ pdf1122.com pdfangchan.com pdfbianji.com pdfdo.com -pdfdowell.com pdffsy.com pdfjia.com pdflibr.com @@ -75868,7 +75364,6 @@ pdgzf.com pdhr.com pdidc.com pdie-expo.com -pdim.gs pdinvestmentgroup.com pdlib.com pdlnn.com @@ -75985,7 +75480,6 @@ pengboguandao.com pengchengenergy.com pengchenglx.com pengfei.com -pengfei.tech penghh.fun penghui88.com penging.com @@ -76083,7 +75577,6 @@ petope.com petpcb.com petpetin.com petrexchina.com -petrobest.com petroren.com petrostaroil.com petrvet.com @@ -76098,7 +75591,6 @@ pf178.com pfcexpress.com pfhoo.com pfinno.com -pfmcchina.org pfmmedicalchina.com pft12301.cc pftianshanno.com @@ -76129,6 +75621,7 @@ pgsql.tech pgxqw.net pgxxw.com pgy6.com +pgyapi.com pgyer.cc pgyer.com pgyer.im @@ -76208,7 +75701,6 @@ photo889.com photocnc.com photocome.com photohn.com -photoint.net photoncounts.com photonpay.com photops.com @@ -76241,7 +75733,6 @@ phpkaiyuancms.com phpks.com phplife.net phpor.net -phprnu.com phpsong.com phpspider.org phpstat.net @@ -76385,7 +75876,6 @@ pimax.com pimei.com pimspeak.com pin-color.net -pin-qu.com pin0312.com pin18pin.com pin2eat.com @@ -76501,7 +75991,6 @@ pinpai.biz pinpai1.com pinpai37.com pinpai9999.com -pinpaidadao.com pinpaihuoyuan.com pinpailiu.com pinpaime.com @@ -76582,7 +76071,6 @@ pizkutam.shop pj-666.com pj-road.com pj.com -pj00001.com pj39800.com pj57.com pjbest.com @@ -76621,7 +76109,6 @@ pkma.cc pkmer.net pko123.com pkoplink.com -pkpk.com pkpk999.com pkpky.com pkpmjc.com @@ -76689,6 +76176,7 @@ platinumchina.com play-analytics.com play-cdn10.com play-cdn11.com +play-cdn13.com play-cdn14.com play-cdn16.com play-cdn20.com @@ -76719,7 +76207,6 @@ playpangu.com playsm.com playtai.com playtai.net -playuav.com playwonderful.com playwxgame.com playyx.com @@ -76827,7 +76314,6 @@ pngbag.com pngsucai.com pniao.com pnol.net -pnshicha.com pnst8.com pntagkyy.com pntagsyy.com @@ -76863,7 +76349,6 @@ poemschina.com pohaier.com pohover.com poikm.com -poinesttia.com point-memory.com poiuytw.com poizon-inner.com @@ -76998,6 +76483,7 @@ postgres.fun postgresqlchina.com postjson.com postpony.com +postxin.com posyn.com poszjia.com potalapalace.com @@ -77040,6 +76526,7 @@ powerleadercdn.com powerleaderidc.com powerliber.com powerlong.com +powerlongmuseum.com powerma.net powermaxcorp.com powerpigs.net @@ -77091,6 +76578,7 @@ ppdd.com ppdesk.com ppdqk.com ppduck.com +ppdys.vip ppfeng.com ppforging.com ppfu3m.com @@ -77163,7 +76651,6 @@ ppter8.com ppthi-hoo.com pptianliao.com pptiyu.com -pptjia.com pptkj.net pptmall.net pptmao.com @@ -77227,7 +76714,6 @@ prcee.org prcfe.com prcvalve.com precise-test.com -precise2.net precision-biotech.com precision-biz.com preludeid.com @@ -77259,6 +76745,7 @@ printhome.com printhr.com printidea.art printlake.com +privateapi.xyz privatehd.to privatess.win privspace.net @@ -77356,7 +76843,6 @@ psd8.com psdee.com psdiv.com pse-meti.com -pse345.com psfjz.com psiexpo.com psjia.com @@ -77411,16 +76897,15 @@ pthxuexi.com pthxx.com pthxxw.com ptimg.org +pting.club ptkckj.com ptkill.com -ptlhzx.com ptmezkgg.com ptnrjt.com ptools.fun ptorch.com ptotour.com ptpcp.com -ptqxw.com ptrcw.com pts-testing.com ptshare.org @@ -77447,7 +76932,6 @@ puaas.com puai999.com puaihospital.net puamap.com -puasu.com puata.info pubbcsapp.com pubchn.com @@ -77468,7 +76952,6 @@ pubyun.com pubyun.net pubyun.org pucijiankang.com -pucms.com pudding.cc pudetouzi.com pudie.net @@ -77479,7 +76962,6 @@ pudutech.com puduzhai.com puem.org puer10000.com -puercha.cc puercn.com puerlife.org puersai.com @@ -77796,6 +77278,7 @@ qaynak.com qazasd.com qazdsa.com qazso.com +qaztool.com qazwobdu.com qazxsdc.com qbangmang.com @@ -77827,7 +77310,6 @@ qc-hr.com qc-shanghaipathology.com qc101.com qc188.com -qc1h.com qc6.com qc99.com qcaipiao.com @@ -77921,6 +77403,7 @@ qcxzls.com qcy.com qcymall.com qcyoung.com +qcyuns.com qczb.app qd-dy.com qd-metro.com @@ -77963,7 +77446,6 @@ qdeastsea.net qdedu.net qderzhong.net qdexam.com -qdf0605.com qdfik.com qdfnscy.com qdfuer.com @@ -78109,7 +77591,6 @@ qfedu.com qfeiche.com qfiee.com qfihdr.com -qflyw.net qfns1.com qfpay.com qfpq.com @@ -78146,7 +77627,6 @@ qgqy.com qgren.com qgswvza.com qgsydw.com -qgtong.com qgtql.com qgvps.com qgw.tm @@ -78250,7 +77730,6 @@ qhtibetan.com qhtui.com qhtycp.com qhtyzx.com -qhwgz.com qhwmw.com qhwptyn.com qhwww.com @@ -78293,7 +77772,6 @@ qiancha.cc qianchenglvdong.com qianchengriben.com qianchiyun.com -qianchuan.ltd qiancipai.com qiandai.com qiandao.com @@ -78305,7 +77783,6 @@ qiandaqian.com qiandaren.com qiandd.com qiandeups.com -qiandianyf.com qianduan.com qianduanheidong.com qiandunvpn.com @@ -78369,7 +77846,6 @@ qianlht.com qianliao.net qianliao.tv qianliaowang.com -qianlidianji.com qianliht.com qianliii.com qianlima.com @@ -78497,7 +77973,6 @@ qibazaixian.com qibingdaojia.com qibingwang.com qibo168.com -qibobang.com qiboleqipai.com qibosoft.com qibox.com @@ -78757,6 +78232,7 @@ qingdaoren.com qingdaoshenghao.com qingdelan.com qingdou.net +qingdou.vip qingdouw.com qingf001.com qingfanqie.com @@ -78806,7 +78282,7 @@ qingline.net qinglingvip.com qinglinong.com qinglm.com -qinglongwood.com +qinglue.com qinglue.net qinglvpin.com qingly.ink @@ -79199,7 +78675,6 @@ qjjmw.com qjmotor.com qjnice.com qjrc.com -qjrcj.com qjren.com qjsalia.com qjsalib.com @@ -79229,7 +78704,6 @@ qkisp.com qkkj88.com qkkjbj.com qkkjd.com -qkl123.com qkl234.com qknode.com qknown.com @@ -79360,15 +78834,11 @@ qnssl.com qntz.cc qnvipmall.com qnvipxd.com -qnvod.net qnw.cc qnydns.com qnydns.net -qnyglobal.com -qnzhdf.com qnzrmyy.com qnzyy.com -qoaao.com qolai.com qooboo.com qoocc.com @@ -79512,7 +78982,6 @@ qqqooo.com qqrain.com qqread.com qqrer.com -qqride.com qqrizhi.com qqro.com qqscb.com @@ -79542,7 +79011,6 @@ qqtouxiangzq.com qqts.net qqtu8.cc qqtu8.com -qqtxt.cc qqtz.com qquanquan.com qqumall.com @@ -79814,7 +79282,6 @@ quartzhy.com quasarchs.com quazero.com quba360.com -qubaidu.net qubaike.com qubaobei.com qubiankeji.com @@ -80091,7 +79558,6 @@ quguonet.com quhaidiao.com quheqihuo.com quhua.com -quhuangye.com quhuaxue.com quhuhao.com quhuichang.net @@ -80190,7 +79656,6 @@ qunxingvc.com qunxinzdh.com qunyaninfo.com qunyingkeji.com -qunyouxuan.com qunzh.com qunzhuquan.com qunzou.com @@ -80244,6 +79709,7 @@ quxianchang.com quxiang.work quxianzhuan.com quxingdong.com +quxintiaodong.com quxiu.com quxuan.com quyangyizhong.com @@ -80368,7 +79834,6 @@ qy.com qy.net qy266.com qy57.com -qy58w.com qy6.com qy7v7nn96e.com qyaninfo.com @@ -80379,7 +79844,6 @@ qycn.com qycn.net qycn.org qycname.com -qycs168.com qycylinder.com qyd-rf.com qydimg.com @@ -80460,7 +79924,6 @@ qzbhgyl.com qzbhzy.com qzbuxi.com qzbwjx.com -qzbykq.com qzccbank.com qzchuxing.com qzcia.com @@ -80494,7 +79957,6 @@ qzhrkj.com qzhsjc.com qzhslw.com qzhxshipping.com -qzhyyljg.com qzimg.com qzj2.com qzjcd.com @@ -80503,7 +79965,6 @@ qzjhscl.com qzjhsd.com qzjianwo.com qzjkw.net -qzjlw.com qzjxzs.com qzjy029.com qzjycc.com @@ -80532,7 +79993,6 @@ qzone.cc qzone.com qzoneapp.com qzonei.com -qzp666.com qzqcfw.com qzqcw.com qzqiye.com @@ -80605,7 +80065,6 @@ r220.cc r2coding.com r2yx.com r302.cc -r3lhl.com r435.com r51.net r5g.cc @@ -81008,7 +80467,6 @@ redianyuansu.com redianyule.com redianzixun.com rediao.com -redicecn.com redidc.com redirector.bdn.dev redirector.c.youtubeeducation.com @@ -81265,7 +80723,6 @@ revefrance.com revenuads.com reviosky.com revolut.ltd -revy.asia rew65.com rewnat.xyz reworlder.com @@ -81319,7 +80776,6 @@ rgrcb.com rgsgnj.com rgslb.com rgtjf.com -rgtygroup.com rgxw.com rgyh6t.com rgzbgroup.hk @@ -81338,6 +80794,7 @@ rhexe.com rhhz.net rhine-inc.com rhinosgamestwhk.com +rhinoxky.com rhkj.com rhky.com rhnewmaterials.com @@ -81492,6 +80949,7 @@ rj889.net rjaaa.com rjcopy.com rjdk.org +rjdownd.com rjetech.com rjeye.com rjfc110.com @@ -81558,7 +81016,6 @@ rmjiaju.com rmjtxw.com rmnof.com rmny.tech -rmoxl.com rmrbwc.com rmrun.com rmsznet.com @@ -81581,7 +81038,6 @@ rnhospital.com rnhy.net rnmachine.com rnmgn.net -rnw7f6jfk8.vip ro.com ro50.com ro8qwpaikd4kx.com @@ -81643,7 +81099,6 @@ roffar.com roguelike.com roguelitegames.com rohm-chip.com -rohs-china.com roidmi.com roii.cc roiland.com @@ -81768,7 +81223,6 @@ rootzhushou.com roouoo.com ropefitting.com ropinsite.com -roqwq.com ror-game.com rorotoo.com ros-lab.com @@ -81839,7 +81293,6 @@ rpfbzjam.shop rpfieldcdn.com rpg99.com rpgmoba.com -rphbnm.com rpo5156.com rq.run rqb99.com @@ -81934,7 +81387,6 @@ rsscc.com rssdtec.com rssforever.com rssso.com -rstex.net rsttest.com rsty77.com rsuedu.com @@ -82054,7 +81506,6 @@ ruguoapp.com ruguojiaoyu.com ruhaivip.com ruhnn.com -ruhousw.com rui.plus ruian.com ruianchayuan.com @@ -82117,7 +81568,6 @@ ruipai.com ruipengkeji.com ruipengpet.com ruipupharma.com -ruisaier.com ruiscz.com ruisheng.cc ruishengseal.com @@ -82142,7 +81592,6 @@ ruixiangbest.com ruixiangdy.com ruixin-eht.com ruixing.cc -ruixingkuaiji.com ruixueys.com ruixuncw.com ruixunidc.com @@ -82195,7 +81644,6 @@ runhengfdc.com runhuayou.biz runjf.com runjian.com -runjiandianqi.com runjiapp.com runkodo.com runkunoptics.com @@ -82271,6 +81719,7 @@ ruu6373.com ruubypay.com ruvar.com ruvisas.com +ruwen5.org ruxiaoyi.com ruyig.com ruyigou.com @@ -82537,6 +81986,7 @@ sailingyun.com sailipaint.com sailongmetal.com sailungroup.com +sailunkeji.com sailuntire.com sailway-china.com saiminprecision.com @@ -82555,7 +82005,6 @@ saiqi.mobi sairaicc.com sairui020.com saisaiwa.com -saisreetravels.com saitenm.com saiterobot.com saivsi.com @@ -82586,7 +82035,6 @@ salogs.com salonglong.com salongweb.com salutecc.asia -sam-jeong.net sam-tec.com samanhua.net samanlehua.com @@ -82723,7 +82171,6 @@ sankumao.com sanlan123.com sanlei.net sanlengbio.com -sanlian-cn.com sanlian-group.com sanlian-machine.com sanlian-sh.com @@ -82797,6 +82244,7 @@ sanyastar.com sanyasx.com sanyawater.com sanyecao.com +sanyegame.com sanyenet.com sanyewu.com sanyexin.com @@ -82807,7 +82255,6 @@ sanyibao.com sanyichemical.com sanyipos.com sanyouco.com -sanyougame.com sanyoumed.com sanyoutj.com sanyuanbaobao.com @@ -82827,7 +82274,6 @@ sanzinfo.com sanzkf.com sao-ma.com sao.ren -saogai.com saohua.com saoic.com saolife.com @@ -83397,7 +82843,6 @@ scxdf.com scxinkang.com scxjyw.com scxsls.com -scxsrh.com scyanzu.com scyarui.com scybjc.com @@ -83978,7 +83423,6 @@ sealeadbattery.com sealien.net sealimg.com sealos.run -sealui.com sealyun.com seamanhome.com seamaty.com @@ -84027,7 +83471,6 @@ secdriver.com secec.com secfree.com secisland.com -secist.com secjia.com seclover.com secoo.com @@ -84088,7 +83531,6 @@ seekwavetech.com seelishi.com seelvyou.com seemmo.com -seemoread.com seemse.com seentao.com seepomotor.com @@ -84241,7 +83683,6 @@ senyao1718.com senyou.com senyuanhi.com senyuanzhonggong.com -seo-820.com seo-lv.com seo.tm seo1158.com @@ -84340,6 +83781,7 @@ sf-zs.net sf007.com sf024.com sf0jm.xyz +sf2021.com sf34.com sf888.net sfacg.com @@ -84455,7 +83897,6 @@ sgmw.com sgmwlu.com sgmwsales.com sgnet.cc -sgnongkang.com sgou.com sgpjbg.com sgplink.xyz @@ -84509,7 +83950,6 @@ sh-datastone.com sh-deem.com sh-delixi.com sh-desu.com -sh-dgvalve.com sh-dongbiao.com sh-eastwes.com sh-edi.com @@ -84739,7 +84179,6 @@ shangdiguo.com shangdixinxi.com shangdu.com shangdu.info -shangeedu.com shangeyun.com shangfang56.com shangfenbao.com @@ -84822,7 +84261,6 @@ shanghaixuejia.com shanghaiyinyang.com shanghaiyk.com shanghaiyouxi.com -shanghaiyuqiang.com shanghaizhaxinhospital.com shanghaizhenji.com shanghcat.com @@ -85378,7 +84816,6 @@ shenmadsp.com shenmapay.com shenmayouxi.com shenmeipharm.com -shenmezhidexia.com shenmikj.com shenmo.com shenmojiaoyu.com @@ -85497,7 +84934,6 @@ shfamily.com shfangshui.com shfayy.com shfcw.com -shfeikuang.com shffjt.com shfft.co shfft.com @@ -85662,7 +85098,6 @@ shijie2.com shijiebang.com shijiechaoshi.com shijieditu.net -shijiehuarenbao.com shijiemap.com shijieminghua.com shijiemingren.com @@ -85677,7 +85112,6 @@ shijihulian.com shijiong.com shijiqingqing.com shijiretailo2o.com -shijitailai.com shijiudao.com shijiufang.com shijqq.com @@ -85818,7 +85252,6 @@ shitac.net shitairen.com shiti.net shitianxia.vip -shitibaodian.com shitoc.com shitou.com shitouboy.com @@ -85918,7 +85351,6 @@ shjtos.com shjtw.com shjtxx.net shjus.com -shjustdo.com shjvguan.com shjx-group.com shjy18.com @@ -85995,7 +85427,6 @@ shmog.org shmondial.com shms-expo.com shmtu.net -shmulan.com shmusic.org shmusicschool.com shmylike.com @@ -86199,11 +85630,9 @@ shppa.net shps518.com shpsncp.com shpyedu.com -shqcplw.com shqec.com shqi7.net shqianbin.com -shqianshuibeng.com shqinghe.com shqingzao.com shqipai.org @@ -86570,7 +85999,6 @@ shunderen.com shunfalighting.com shunfangw.com shunfeng.cc -shunfengche.org shunguang.com shunhaiwang.com shunhejieshui.com @@ -86583,7 +86011,6 @@ shunlitm.com shunmi.com shunnengnet.com shunnengoil.com -shunong.com shunqi.com shunscom.com shunshikj.com @@ -86596,7 +86023,6 @@ shunyagroup.com shunygroup.com shunyoubio.com shunyuwater.com -shuo66.com shuoba.com shuoba.me shuoba.org @@ -86623,7 +86049,6 @@ shuozhiwu.com shupackaging.com shupaiyun.com shupeng.com -shupin.net shuq.net shuqi.com shuqiaozt.com @@ -86656,6 +86081,7 @@ shuwenxianyun.com shuwulou.com shuxiangmenhu.com shuxiangmuye.com +shuxiayun.com shuxinsp.com shuxinyc.com shuxuehua.com @@ -86815,7 +86241,6 @@ shzfsy.com shzfzz.net shzgauto.com shzgd.org -shzgh.org shzgt56.com shzh.net shzhanling.com @@ -87032,7 +86457,6 @@ simengqifu.com simglo.com simhaoka.com simiam.com -simiao.net simici3.com simicloud.com simij.com @@ -87141,7 +86565,6 @@ sino-customs.com sino-epa.com sino-flexography.com sino-foldingcarton.com -sino-garments.com sino-gps.com sino-heavymach.com sino-info.net @@ -87308,7 +86731,6 @@ sinovationmed.com sinovationventures.com sinovdc.com sinovel.com -sinovio.net sinovoice.com sinowaycarbon.com sinowbs.com @@ -87453,7 +86875,6 @@ sj33.net sj3g.com sj51.net sj6rgxtjg3tmb.com -sj84.com sj998.com sjawards.com sjaz.com @@ -87552,7 +86973,6 @@ sjy-art.org sjy2.com sjycbl.com sjyhotel.com -sjyj100.com sjyl.com sjysz.com sjyt.net @@ -87768,7 +87188,6 @@ slashdevslashnetslashtun.net slatic.net slbauto.com slbiop.com -slbrucite.com slcad.com slchos.com slcyber.icu @@ -88273,6 +87692,7 @@ softbank.best softbanks.net softbar.com softbingo.net +softdownd.com softgostop.com softhome.cc softjinzhou.com @@ -88306,7 +87726,6 @@ sogou.net sogoucdn.com sogoucdndl.com sogouimecdn.com -sogouspider.com sogouw.com sogowan.com sogw.cc @@ -88370,7 +87789,6 @@ soldierstory-toys.com solelybio.com solepic.com soletower.com -soli.so soliao.com solidigm-asdf.com solidigm-zxcv.com @@ -88755,6 +88173,7 @@ specchemind.com specialcdnstatus.com spectorfilm.com spectreax.com +sped-ssss-pppp-eeee-dddd.com speechless.pw speed-hz.com speedaf.com @@ -88943,6 +88362,7 @@ srgnmsrg.com srgow.com sriappalam.com sribs.com +sric.fun srichina.org srici.com sritsoft.com @@ -89021,13 +88441,10 @@ ssfei.com ssffx.com ssgedm.com ssgeek.com -ssggg.com ssgsemi.com -ssgxwq.com ssgz.com sshce.com sshr.net -sshzhuangshipin.com ssia.cc ssidc.net ssidc.org @@ -89123,7 +88540,6 @@ ssydt.com ssyer.com ssyssf.com ssywh.com -ssyxdeli.com ssyxlx.com ssyxmall.com ssyzx.net @@ -89156,7 +88572,6 @@ staidson.com standard-groups.com standardcn.com standardshop.net -standatrans.com standteam.net stanlyview.com staofchina.com @@ -89194,7 +88609,6 @@ staringos.com starkai.com starlakelab.com starlink.uno -starlott.com starlu.com starm.cc starmily.com @@ -89238,7 +88652,6 @@ starwaycomm.com starworldgames.com starworldmacau.com starwsn.com -starxiiient.com starxn.com staryea.com stat-nba.com @@ -89264,6 +88677,7 @@ stay-bullish.com staybrowser.com staycu.com stbieshu.com +stboy.com stbs100.com stc2002.com stcaimcu.com @@ -89406,6 +88820,7 @@ streamcomputing.com streamipcf.akamaized.net streamlakeapi.com streffy.com +strinova.com strong-light.com strong-study.com strongfc.com @@ -89464,10 +88879,8 @@ stxsw.com styadmin.com stylecdn.com stylechina.com -stylecho.com stylemafiadaily.com styles-sys.com -styst.net styuanhua.com stzc.com stzzx.com @@ -89482,7 +88895,6 @@ suanfazu.com suanguaju.com suanjiayun.com suanjuzi.com -suanlitou.com suanpin.com suansheng.com suanst.com @@ -89564,6 +88976,7 @@ sufangxu.com sufeinet.com sufoma.com sufont.com +sufycdn.com sugaov.com sugar5.club sugarall365.com @@ -89588,7 +89001,6 @@ suibao-jiaozhu.com suibao.com suibiji.com suibo.org -suigo.net suiji123.com suijinetworks.com suijunlaowu.com @@ -89742,7 +89154,6 @@ sunhepower.com sunhongs.com sunhospital.net sunhuhotel.com -sunhwee.com suninf.net suninfo.com suning.com @@ -89937,7 +89348,6 @@ supercare168.com supercarrier8.com supercell.com supercodepower.com -supercopy2020.com supercrm.com superepoxyresin.com superfix.com @@ -90092,7 +89502,6 @@ suzhousj.com suzhouyabao.com suzip.com suzport.com -suzu365.com suzuki-china.com suzuki-shanghai.com svconcloud.com @@ -90105,7 +89514,6 @@ svimeng.com svinsight.com svip51.com svipdog.com -svipduihuan.com svipgulr.com sviping.com svk3o97xmyid93.com @@ -90137,7 +89545,6 @@ swanpowerstrip.com swanrov.com swaqds.com swarma.net -swarma.org swat-js.com swatou.com swbbsc.com @@ -90282,7 +89689,6 @@ sxetcedu.com sxfl.org sxfoundation.com sxfu.org -sxfyjzzs.com sxgbs.com sxgdtv.com sxggec.com @@ -90452,7 +89858,6 @@ sxxl.com sxxrmyy.com sxxsmjh.com sxxt.net -sxxtong.com sxxw.net sxxyfw.com sxxynews.com @@ -90492,7 +89897,6 @@ sy17.com sy1994.com sy1z.com sy2k.com -sy2mc.com sy2z.com sy3.com sy76.com @@ -90653,7 +90057,6 @@ sysmaster.online sysmini.com sysmls.com sysnfj.com -sysokean.com sysshine.com systedata.com systoon.com @@ -90761,7 +90164,6 @@ sz-lcsc.com sz-lzyy.com sz-map.com sz-matro.com -sz-meicheng.com sz-mtr.com sz-myjs.com sz-news.com @@ -90899,7 +90301,6 @@ szcmer.com szcnpiec.com szcogo.com szcompare.com -szcopper.com szcp.com szcsot.com szcssx.com @@ -91055,7 +90456,6 @@ szhmjp.com szhmkeji.com szhnsz.com szhntxh.com -szhoiyan.com szhome.com szhomeimg.com szhongshe.com @@ -91087,7 +90487,6 @@ szhxbiz.com szhytrip.com szhzsd.com szhzzl.com -szhzzy.com szicbe.com szicc.net szicpa.org @@ -91150,7 +90549,6 @@ szjuyou.com szjxgroup.com szjxj.com szjy.cc -szjydzkj.com szjyos.com szjys.net szjys1888.com @@ -91389,6 +90787,7 @@ szsnk.com szsnking.com szsoa.org szsolutia.com +szsongmao.com szsorch.com szsptk.com szsq.net @@ -91413,7 +90812,6 @@ szsupvan.com szswgcjc.com szswjc.com szswjs.com -szsyqcn.com szsyyxh.org szszjt.com szszlm.com @@ -91734,7 +91132,6 @@ taida-china.com taida100.com taidao.net taidaxincai.com -taidhotel.com taidichina.com taidu.com taiduhome.com @@ -91794,6 +91191,7 @@ taikongmedia.com taikoohui.com taikoyc.com taikr.com +tailgdd.com tailingood.com tailixiangjiao.com taillkang.com @@ -91921,6 +91319,7 @@ tangdouedn.com tangdoufdn.com tangdouhdn.com tangdouimg.com +tangdouz.com tangeche.com tangfc.com tanggu11g.com @@ -91933,6 +91332,7 @@ tangkabj.com tanglei.name tangmi.net tangmingint.com +tangoic.com tangongye.com tangpai.cc tangping.com @@ -92030,7 +91430,6 @@ taobaotesting.com taobeihai.com taobiaozu.com taobizhong.com -taobz.com taoc.cc taocange.com taocdn.com @@ -92078,6 +91477,7 @@ taohaowan.com taohhui.com taohua.com taohuang.com +taohuaqizhi.com taohuazu.net taohuazu.pw taohui.pub @@ -92161,7 +91561,6 @@ taoxiangyoushu.com taoxiaolu.com taoxie.com taoxie.com.tw -taoxuemei.com taoxv.com taoyi-support.com taoyi120.net @@ -92277,7 +91676,6 @@ tblk.me tbmcas.com tbmkt.com tbnimg.com -tbnrm.com tboxn.com tbpark.com tbq168.com @@ -92333,13 +91731,13 @@ tcdnvod.com tcdnvodbak.com tcdnvp.com tcdushi.com -tcdxt.com tcecps.org tceic.com tceratronix.com tcfhty.com tcfmglobal.com tcgcardgame.com +tcgdxyb.xyz tcggkj.com tcgke.com tcgsw.com @@ -92391,6 +91789,7 @@ tcnews.cc tcnvmms.com tcomall.com tcp.hk +tcp.pub tcping8.com tcqmj.com tcrcb.com @@ -92434,7 +91833,6 @@ td-sf.com td-tech.com td22.com td300321.com -td518.com td776.com td96.com td98.com @@ -92536,7 +91934,6 @@ teandy.com teapic.com teapottravel.com teatreexy.com -teawang.com tebaidu.com tebiao.net tebie6.com @@ -92808,7 +92205,6 @@ tensafe.com tenshi.cc tensorchip.com tensorflownews.com -tensornews.net tenstars.net tensuntrans.com tensynchina.com @@ -93017,7 +92413,6 @@ thecodeway.com thedatasys.com thederma.com theduapp.com -theessentiallifestyle.com thefastcdns.com thefastfile.com thefastimg.com @@ -93103,6 +92498,7 @@ thinkcmf.com thinkdid.com thinkdream.com thinkeridea.com +thinkerride.com thinkerx.com thinkindrupal.com thinkive.com @@ -93386,7 +92782,6 @@ tiantianfm.com tiantianfunds.com tiantianleshuiguo.com tiantianquce.com -tiantianqutao.com tiantiantiaosheng.com tiantianxieye.com tiantianxuexi.com @@ -93589,7 +92984,6 @@ tijox.net tijox.org tik2019.com tikersport.com -tiko.ink tiktoknewaccount.com tiktokrow-cdn.com tikuol.com @@ -93647,6 +93041,7 @@ tinetcloud.com tinfinite.com tinfo.com ting22.com +ting27.com ting55.com ting89.com tingbook.com @@ -93743,7 +93138,6 @@ titansci.com titapark.com titianshanfz.com tititxt.com -title-cn.com titloteka.com titussb.com tivitv.com @@ -93767,7 +93161,6 @@ tizoinfo.com tj-fch.com tj-guangxin.com tj-hcdz.com -tj-htjh.com tj-kingdee.com tj-model.com tj-un.com @@ -93819,7 +93212,6 @@ tjgcs.com tjgdjt.com tjgg88.com tjghw.com -tjgkw.org tjgmcg.com tjgportnet.com tjgtgd.com @@ -93893,7 +93285,6 @@ tjwf.com tjwj88.com tjwmschool.net tjxdzhonda.com -tjxinshunda.com tjxinyu.com tjxiqi.com tjxunlei888.com @@ -93927,7 +93318,6 @@ tkchina.com tkckjr.com tkcn.cc tkd-suzhou.com -tkddns.xyz tkfff.com tkgame.com tkhealthcare.com @@ -93959,7 +93349,6 @@ tl4su.com tl50.com tl88.net tlang.com -tlbaby.com tlbapm.com tlby120.com tlbyx.com @@ -94096,7 +93485,6 @@ tnedu.com tnettms.com tnfn.net tngcjx.com -tngdigital.com.my tnodenow.com tnong.com tnsou.com @@ -94173,7 +93561,6 @@ tokeimall080.com tokeisuisukopi.com token-ad.com token-sensor.com -tokenet.site tokenglish.com tokensky.net tokimekiclub.org @@ -94267,7 +93654,6 @@ tongrentangkj.com tongrentangzyyy.com tongsha.com tongshanbank.com -tongshengjixie.com tongshiling.net tongshilu.com tongshuai.com @@ -94310,7 +93696,6 @@ tongyi.com tongyicm.com tongyidrying.com tongyiplastic.com -tongyipumps.com tongyist.com tongyonggroup.com tongyongpe.net @@ -94349,6 +93734,7 @@ toodaylab.com toodudu.com tool.la tool.lu +tool56.com tool77.com tooleemesse.com toolgg.com @@ -95049,10 +94435,8 @@ tsrnjs.com tsrqjt.com tsrqjtfc.com tsruifeng.com -tsshunxin.com tssns.net tsstorry.com -tsstyb.com tssyedu.com tssyjt.com tst98.com @@ -95190,7 +94574,6 @@ ttwqw.com ttwx.com ttwxh.com ttxgu.com -ttxjj.com ttxn.com ttxs123.net ttxs7.com @@ -95208,6 +94591,7 @@ ttyongche.com ttyqm.com ttysq.com ttyuyin.com +ttyy800.vip ttzcw.com ttzubao.com ttzw365.com @@ -95246,6 +94630,7 @@ tuanyanan.com tuanyougou.com tuanyuan520.com tuanyx.com +tuanziai.com tubachina.com tubanginfo.com tubangzhu.com @@ -95351,7 +94736,6 @@ tuituifang.com tuituisoft.com tuituitang.com tuiwen.net -tuixue.online tuiyi.cc tuizx.com tujia.com @@ -95417,12 +94801,12 @@ tuo-pan.com tuoaa.com tuobeng.net tuocad.com +tuodan.tech tuodangclub.com tuodanlab.com tuodanyy.com tuohuangzu.com tuojiebiotech.com -tuojuncn.com tuojunedu.com tuolajieightscore.com tuoluowang.com @@ -95579,7 +94963,6 @@ tvmao.com tvmcloud.com tvmining.com tvniao.com -tvnwang.cc tvoao.com tvos.com tvt.im @@ -95706,7 +95089,6 @@ txttgj.com txttool.com txtyxg.com txvat.com -txvlog.com txwb.com txweekly.com txwestart.com @@ -95767,7 +95149,6 @@ tyfc.xyz tyfo.com tygameworld.com tygckj.com -tyguocao.com tyh120.com tyhjzx.com tyi365.com @@ -95859,7 +95240,6 @@ tzfdc.com tzfeilu.com tzfeize.xyz tzfile.com -tzfpa.com tzgcjie.com tzggzj.com tzgjjt.com @@ -95867,11 +95247,8 @@ tzgkuci.com tzgsjc.com tzhledu.net tzhospital.com -tzhuaya.com tzhwcc.com -tzjizhou.com tzjob.com -tzjufeng.com tzjxl.com tzjyjt.com tzjzsw.com @@ -95986,6 +95363,7 @@ u9time.com u9u8.com u9u9.com u9wan.com +uabkrsj.xyz uaff7j.com uahh.site uakwezgc.com @@ -96051,6 +95429,7 @@ ucancs.com ucanrobot.com ucantech.com ucantech.net +ucany.net ucarinc.com ucassc.com ucb6.com @@ -96156,7 +95535,6 @@ uepei.com ueram.com ueren.com uestcedu.com -uestcgxcd.com uestcliuxue.com uetianshanyp.com ueuz.com @@ -96191,6 +95569,7 @@ ugapi.com ugapk.com ugbb.com ugdesk.com +ugdocker.link uggame.com uggd.com ugirls.tv @@ -96317,7 +95696,6 @@ ukvisacenterd.com ukworldsale.com ulab360.com ulanzou.com -ulaojiu.com ulapia.com ule.com ule.hk @@ -96613,6 +95991,7 @@ upchinapro.com upchinaproduct.com upd.kaspersky.com update.microsoft.com +update2.cyou update8.com updeals.com updf.com @@ -96660,7 +96039,6 @@ uptom.com uptougu.com upu-opt.com upupbug.com -upupmo.com upupoo.com upupview.com upupw.net @@ -96837,7 +96215,6 @@ uu11441.com uu11661.com uu1314.com uu178.com -uu32500.com uu37.com uu375.com uu38.com @@ -96856,7 +96233,6 @@ uucnn.com uucqrdmk.com uueasy.com uuedutech.com -uufbacad.shop uufund.com uufuns.com uug22.com @@ -96945,7 +96321,6 @@ uwn.com uwntek.com uworter.com uwparking.com -uwsa4.com ux18.com ux87.com uxacn.com @@ -96976,11 +96351,11 @@ uyanip.com uyanke.com uycnr.com uyesee.com -uyess.com uyhjnm.com uyi2.com uyiban.com uyiqggpa.com +uymfybcf.shop uyou.com uyouii.cool uyouqu.com @@ -97017,7 +96392,6 @@ v15cdn.com v15i.com v1h5.com v1kf.com -v1l1b.com v1lady.com v1pin.com v1tv.cc @@ -97301,7 +96675,6 @@ venustrain.com vephp.com veqxiu.net ver.cc -verdareto.com vergilisme.com verify5.com verisilicon.com @@ -97516,7 +96889,6 @@ vingoostation.com vinjn.com vinkdong.com vinlion.com -vinnywang.com vinsondata.com violetgo.com violinstudy.net @@ -97716,7 +97088,6 @@ vjifen.com vjread.com vjshi.com vjtchina.com -vjzogyz.com vk6.me vk6oqcevmd1a.com vk8.co @@ -97772,7 +97143,6 @@ vmdo.net vmecum.com vmengblog.com vmeti.com -vmgikpw.com vmic.xyz vmicloud.com vmkj.net @@ -98008,6 +97378,7 @@ vqskrzmq.com vqu.show vqudo.com vqudochina.com +vqyzdzcg.shop vr-cat.com vr186.com vr2.tv @@ -98222,7 +97593,6 @@ w123w.com w18.net w1989.com w218.com -w24so.com w2985nq.xyz w2bc.com w2gou.com @@ -98381,13 +97751,11 @@ waluer.com walvax.com wamawama.com wamila.com -wamkio.com wan-ka.com wan.cc wan.com wan1234.com wan123x.com -wan160.com wan25.com wan32.com wan5d.com @@ -98675,7 +98043,6 @@ wanlitong.com wanlongdianqi.com wanlongjituan.com wanmaco.com -wanmadajian.com wanmei.com wanmei.net wanmeidapei.com @@ -98732,7 +98099,6 @@ wantgame.net wantiangroup.com wantiku.com wantong-tech.net -wantouzi.net wantowan.com wantquotes.net wantuju.com @@ -99117,7 +98483,6 @@ webanktcftp.net webankwealth.com webankwealthcdn.net webankwyd.com -webarch.org webarcx.com webcamx666.com webdns263.com @@ -99332,7 +98697,6 @@ weigangqin.com weigaogroup.com weigaoholding.com weigaoyaoye.com -weigay.com weige2006.com weige55.com weighment.com @@ -99361,6 +98725,7 @@ weihuo.site weihz.net weii.cc weiixxin.com +weijia1999.com weijiancloud.com weijianmen.com weijingzhijia.com @@ -99431,7 +98796,6 @@ weimibio.com weimingchem.com weimingcq.com weimingedu.com -weimingfj.com weimingkids.com weimingxt.com weimisystem.com @@ -99497,6 +98861,7 @@ weishi024.com weishi100.com weishigz.com weishipin.com +weishishuyuan.com weisiliang.com weismarts.com weistang.com @@ -99542,12 +98907,10 @@ weixin-001.com weixin.com weixin12315.com weixinbang.com -weixinbianjiqi.com weixinbiaoqing.com weixinbridge.com weixincall.com weixindadang.com -weixinduihuan.com weixingate.com weixingmap.com weixingon.com @@ -99592,7 +98955,6 @@ weiye.me weiyes.com weiyi.com weiyi.link -weiyichina.org weiyiqibj.com weiyitec.com weiyituku.com @@ -99685,7 +99047,6 @@ weme.fun wemechat.com wemeche.com wemediacn.com -wemiquan.com wemomo.com wemorefun.com wems.net @@ -99761,6 +99122,7 @@ wenjuan.ltd wenjuan.net wenjuan.pub wenjuanba.com +wenjuanbang.com wenjuanshow.com wenjuntech.com wenkaoba.com @@ -99836,7 +99198,6 @@ wenxue100.com wenxue360.com wenxueapp.com wenxuedu.com -wenxuee.com wenxuefan.net wenxuem.com wenxuemm.com @@ -100260,7 +99621,6 @@ whitecat.com whitecdnx.com whitegem.net whitemedia-china.com -whiterose-sy.com whiteswanhotels.com whitjy.com whizen.com @@ -100425,7 +99785,6 @@ whthgy.com whtime.net whtmhh.com whtongyun.com -whtongzhou.net whtonhe.com whtpgbyy.com whtpi.com @@ -100482,7 +99841,6 @@ whxcepc.com whxcy.com whxh.com whxhdn.com -whxinhuo.com whxlv.com whxrjt.com whxsdn.com @@ -100495,6 +99853,7 @@ whycan.com whycw.com whyec.com whyenjoy.com +whyesi.fun whyestar.com whyicheng.com whyimingkeji.com @@ -100532,7 +99891,6 @@ whzhjty.com whzhongxin.net whzhongzhi.com whzhtd.com -whzhuoyuan.com whzhzxmr.com whzjyy.com whzjzxy.com @@ -100548,7 +99906,6 @@ whzxzls.com whzydz.com whzys.com whzzhb.com -wi98a.com wibaidu.com wicep.com wicp.net @@ -100679,6 +100036,7 @@ windows10.pro windows10zj.com windows11.pro windows7en.com +windowstool.net windowsupdate.microsoft.com windowszj.com windpayer.com @@ -100747,7 +100105,6 @@ winsenseos.com winshang.com winshangdata.com winsing.net -winsome-jewelry.com winspay.com winstandard.com winstoncc.com @@ -100948,7 +100305,6 @@ wkcdn.com wkcmall.com wkcw.net wkddkyy.com -wkderp.com wkdty.com wkene.com wkepu.com @@ -101178,7 +100534,6 @@ woa.com woaanc.com woaap.com woai310.com -woaide.com woaidu.org woaifanyi.com woaihaoyouxi.com @@ -101264,7 +100619,6 @@ wol.tv wolai.com wolai.ren wolaidai.com -wolaidu1.com wolansw.com wolegou.net wolei-tech.com @@ -101401,8 +100755,6 @@ worksoho.com worktile.com worktilemail.com workyun.com -world-audio.com -world-fireworks.com world-machining.com world-pet.org world3dmodel.com @@ -101465,7 +100817,6 @@ wotucdn.com wotula.com wouju.com wouu.net -wow-mall.net wow.fun wowamazingthings.com wowbbs.com @@ -101914,7 +101265,6 @@ wuhexxg.com wuhongsheng.com wuht.net wuhu.cc -wuhuagongshui.com wuhuashe.com wuhubtv.com wuhues.com @@ -101941,6 +101291,7 @@ wujieyouth.com wujiit.com wujijiasu.com wujinimg.com +wujinpp.com wujintool.com wujinwater.com wujiok.com @@ -102240,7 +101591,6 @@ wwwfkw.com wwwic.net wwwimages.adobe.com wwwimages2.adobe.com -wwwruhecom.com wwxrmyy.com wwxxg.com wx-api.net @@ -102709,7 +102059,6 @@ x-cloud.cc x-cmd.com x-droners.com x-imagine.com -x-inc.org x-jishu.com x-kicks.com x-mol.com @@ -102749,7 +102098,6 @@ x4dp.com x586di.com x5dj.com x5zs.com -x6485f.cc x64go.com x64pro.com x66597.com @@ -102765,6 +102113,7 @@ x81zw.co x81zw2.com x821.com x86android.com +x86pi.com x8ds.com x8sb.com x9393.com @@ -102816,7 +102165,6 @@ xagmsm.com xaguanggu.com xagxp.com xagxyz.com -xahb.com xahc971.com xahdwzhs.com xahhp.com @@ -102933,7 +102281,6 @@ xbauto.com xbb8.com xbbaoan.com xbceo.com -xbcf518.com xbcjy.com xbcpsjk.com xbd61.com @@ -103018,7 +102365,6 @@ xcdngyc.vip xcdntp.vip xcdssy.com xcedu.net -xcetv.com xcex.net xcexe.com xcfuer.com @@ -103091,7 +102437,6 @@ xcvmbyte.com xcvvs.com xcwhjj.com xcx-x.com -xcxbaba.com xcxd-inc.com xcxjpd.com xcxvs.com @@ -103126,7 +102471,6 @@ xdcdn.net xdcg100.com xddpay.com xde.com -xde6.net xdebike.com xdf99.com xdfckjz.com @@ -103315,7 +102659,6 @@ xfzllht.com xg-techgroup.com xg1234.com xg38.com -xgaij.com xgamevip.com xgantt.net xgate.com @@ -103339,7 +102682,6 @@ xgiu.com xgj-info.com xgjdyjjt.com xgjgas.com -xgjiefu.com xgjjw.com xgkwx.com xglgift.com @@ -103370,7 +102712,6 @@ xgz.cc xgzbwdj.com xgzdhj.com xgzrs.com -xgzx.org xh-arch.com xh-health.com xh-silicone.com @@ -103416,7 +102757,6 @@ xhily.com xhintech.com xhj.com xhj.info -xhj365.com xhjaty.com xhjianglong.com xhjingling.com @@ -103450,6 +102790,7 @@ xhslink.com xhslw.com xhsmlt.com xhsrmyy.com +xhsxmt.com xhsyqx.com xhsyww.com xhtheme.com @@ -103573,7 +102914,6 @@ xiangbinmeigui.com xiangbojiubo.com xiangboshu.net xiangbosoft.com -xiangchengjob.com xiangcoin.com xiangcun.cc xiangcun.com @@ -103659,6 +102999,7 @@ xiangyue.life xiangyueedu.com xiangyuezhongxue.com xiangyujiankang.com +xiangyuncdn.com xiangyungx.com xiangyuyaoye.com xiangzhan.com @@ -103782,6 +103123,7 @@ xiaobot.net xiaobu.tech xiaobu121.com xiaobuwq.com +xiaocanapp.com xiaocanhulian.com xiaocantech.com xiaocaoo.com @@ -103789,7 +103131,6 @@ xiaocaoyun.com xiaoce.fun xiaocen.com xiaochamao.com -xiaochangxian.com xiaoche001.com xiaocheng.com xiaochengxu029.com @@ -103811,7 +103152,6 @@ xiaodaozhi.com xiaodapei.com xiaodengvip.com xiaodian.com -xiaodian.in xiaodian.so xiaodianweb.com xiaodigu.com @@ -103994,7 +103334,6 @@ xiaomashijia.com xiaomaxitong.com xiaomayi.co xiaomayi.net -xiaomayics.com xiaomazhixing.com xiaomei.cc xiaomeiti.com @@ -104074,7 +103413,6 @@ xiaoqiqiao.com xiaoqiweb.com xiaoquba.com xiaoqueshe.com -xiaoqugang.com xiaoquyijia.com xiaorizi.me xiaorui.cc @@ -104119,7 +103457,6 @@ xiaotiancai.com xiaoting.com xiaotongqq.com xiaotud.com -xiaotut.com xiaotuzhan.com xiaou2014.com xiaoupan.com @@ -104232,7 +103569,6 @@ xiaozhu158.com xiaozhu2.com xiaozhua.com xiaozhuangzhuang.com -xiaozhulanjuwei.com xiaozhustatic1.com xiaozhustatic2.com xiaozhustatic3.com @@ -104284,7 +103620,6 @@ xibojiaoyu.com xibsteel.com xibu168.com xibujuece.com -xibumaker.com xiburongmei.com xicaijing.com xicaishe.com @@ -104304,7 +103639,6 @@ xidibuy.com xidie.com xidiglobal.com xidong.net -xidongv.com xiduobaby.com xie22.com xie56.xyz @@ -104367,7 +103701,6 @@ xifengjiuzhaoshang.com xifu120.com xifumi.com xigaogen.com -xigeweb.com xiggua.com xigo.tv xigou100.com @@ -104425,7 +103758,6 @@ xilichi.com xilinjie.com xilinsi.org xilinx-ic.com -xilinzj.com xilipy.com xilish.com xilitang.com @@ -104549,7 +103881,6 @@ xinfuyun.net xing-bei.com xing-su.com xing73.com -xing800.com xingames.com xinganghulan.cc xingb.net @@ -104561,7 +103892,6 @@ xingcheshixian.com xingchiauto.com xingchuangcar.com xingchuangtiandi.com -xingdajt.com xingdatrip.com xingdong.co xingdongliu.com @@ -104588,7 +103918,6 @@ xinghai365.com xinghaigroup.com xinghan.vip xinghangdao.com -xinghanmuye.com xinghantec.com xinghaoyun8.com xinghejoy.com @@ -104612,10 +103941,8 @@ xingkec.com xingkeqi.com xingketech.com xingkong.link -xingkong.run xingkongfy.xyz xingkongmt.com -xingkoo.com xingkupai.com xinglai.com xinglan.co @@ -104924,7 +104251,6 @@ xinss.com xinss.net xinstall.com xinstatic.com -xinsuyang.xyz xinszy.com xintaikeji.com xintairen.com @@ -105059,7 +104385,6 @@ xinzhiguanwangyun.com xinzhongqi.net xinzhou.org xinzlkj.com -xinzuhe.com xinzuojia.com xinzushenghuo.com xiolift.com @@ -105068,7 +104393,6 @@ xiongbagk.com xiongbeng.com xiongbingtianxia.com xiongchuan.com -xiongdacn.com xiongf.com xiongfengcl.com xiongfenggroup.com @@ -105256,6 +104580,7 @@ xiyoucdn.com xiyouchat.com xiyouji.com xiyoulink.net +xiyoulinux.com xiyoupark.com xiyouquan.com xiyousdk.com @@ -105357,7 +104682,6 @@ xjjnjp.org xjjqd154.com xjjsws.com xjjt.com -xjkangjia.com xjks.net xjlxw.com xjlytz.com @@ -105366,7 +104690,6 @@ xjmachine.com xjmg.com xjmtx.com xjmty.com -xjmw.net xjnnet.net xjnzm.com xjoycity.com @@ -105462,7 +104785,6 @@ xkyn.net xkyy.com xkzzz.com xl-ai.com -xl-clean.com xl-edu.net xl-ele.com xl-lcd.com @@ -105723,7 +105045,6 @@ xmzmy.com xmzs.org xmzyark.com xmzzy.net -xn--0lqv73m.com xn--0lqwsu2w.com xn--15q53an56b23i4nu0jb.com xn--1bs9ye16ez8b.com @@ -105741,7 +105062,6 @@ xn--3bs781ecijtrt.com xn--3bsp13hurlcwb.com xn--3bsx54la62v.com xn--3bsz0pskmp89skv3a0zd724b1py.net -xn--3lqv74e.com xn--48s50dpwnbh95ah07i.com xn--4gq0d69oba129b9wd94ey8bs83ji3c3q7hoka.org xn--4gq1d760bszbgdv5p12rhq5bx2yc.net @@ -105843,11 +105163,11 @@ xn--g2xt1d91f2xk.com xn--glr604k.com xn--gmqr9gdtrhuf56g.com xn--h0tn34c.cc -xn--h6qq3whvbw6a42x4ij.com xn--husx9zj2eepau0se83d.com xn--hutn94av9amzg.net xn--i6q33br88fkud.com xn--igt225itqf.com +xn--it-if7c19g5s4bps5c.com xn--jh1a128b.com xn--jhqx3hjuanvm9zbb084ayucqwxhuqzew60ae3xve1fnwybs8a.com xn--jor0b302fdhgwnccw8g.com @@ -105935,7 +105255,6 @@ xn--xhqx10kr8o.com xn--xkr26fp82clgt.com xn--xkr999cp4fv97a.com xn--xkrs9ba41r.com -xn--xys863bov4ac4h.com xn--y6q834d2k3al4h.com xn--y8jhmm6gn.moe xn--yet74fr8g.com @@ -106061,7 +105380,6 @@ xqbase.com xqblog.com xqce.com xqckg.com -xqcwm123.com xqdgroup.com xqdjkwz.com xqfunds.com @@ -106157,7 +105475,6 @@ xsgongju.com xsgrq.com xsgtvacct.com xsh520.com -xshdchem.com xshengyan.com xshenshu.com xshhotels.com @@ -106267,7 +105584,6 @@ xtaike.com xtal.cc xtao.me xtbank.com -xtbaoziji.com xtc-edu.com xtcaq.com xtcfjt.com @@ -106279,6 +105595,7 @@ xtep.com xthinking.net xthtc.com xthyjt.com +xtiai.com xtianlang.com xtibet.com xtingcloud.com @@ -106298,7 +105615,6 @@ xtomp.com xtong-solar.com xtongs.com xtoobmo.xyz -xtowork.com xtqarzip.com xtransfer.com xtrapowercn.com @@ -106336,7 +105652,6 @@ xuanceo.com xuancheng.org xuanchuanyi.com xuandan.com -xuandashi.com xuandecarpet.com xuanfengge.com xuanhaikuwan.com @@ -106362,6 +105677,7 @@ xuanshu.org xuansiwei.com xuantaikeji.com xuanteng.org +xuanwifi.com xuanwonainiu.com xuanwu88.com xuanwumobile.com @@ -106380,7 +105696,6 @@ xuanyouwang.com xuanyuanhuangdi.org xuanyuans.com xuanyuanzjy.com -xuanyucttw.com xuanyusong.com xuanyutech.com xuanzhi.com @@ -106489,10 +105804,8 @@ xueqiu360.com xuerong.com xuesai.net xuesax.com -xueseo.com xueshanlinghu.com xuesheng.com -xuesheng360.com xueshiyun.com xueshu.com xueshu5.com @@ -106575,7 +105888,6 @@ xuexiwa.com xuexizhiwang.com xuexizoo.com xuexun.com -xueya8.com xueyanshe.com xueyiyun.com xueyou.org @@ -106630,7 +105942,6 @@ xunbin.com xunbo.net xunchabing.com xunchanggroup.com -xuncheng.cc xundasemi.com xundayun.com xundekai.com @@ -106667,7 +105978,6 @@ xunkids.com xunlanchina.com xunlei.com xunlei.net -xunleige.com xunleioa.com xunleisvipp.com xunlew.com @@ -106739,7 +106049,6 @@ xussb.com xusss.com xutour.com xuvol.com -xuwdui.com xuweidj.com xuwenliang.com xuxian.com @@ -106786,7 +106095,6 @@ xwamp.com xwan.com xwb8.com xwbank.com -xwcool.com xwcx6.com xwcx666.com xwcxgroup.com @@ -106823,7 +106131,6 @@ xwy-powder.com xwylhh.com xwyun.net xwzc.net -xwzw5.com xwzxldfx.com xx-industrial.com xx-motor.com @@ -106976,7 +106283,6 @@ xybsyw.com xybtv.com xybygc.com xybygw.com -xyc-edu.com xycad.com xycaogen.com xycareer.com @@ -107008,7 +106314,6 @@ xyffsb.com xyffvip.com xyfinechem.com xyfish.com -xyfnz.com xyfsy.com xyg100.com xygdcm.com @@ -107133,6 +106438,7 @@ xyyh.xyz xyyksy.com xyykt.org xyyl.com +xyyuan.fun xyyuedu.com xyyx82.com xyyxcm.co @@ -107153,7 +106459,6 @@ xyzkj.xyz xyzmdzs.com xyzmovie.net xyzop.com -xyzpw.net xyzs.com xyzshouji.com xyzspeaker.com @@ -107167,7 +106472,6 @@ xz.com xz325.com xz3733.com xz3z.com -xz5jin.com xz5u.com xz6.com xz6699.com @@ -107324,7 +106628,6 @@ y5news.com y5store.com y617.com y66b1pi5re.com -y6kky.com y70qeg6506.com y77.cc y78r.com @@ -107520,13 +106823,13 @@ yangtianb.com yangtong.com yangtse-automobile.com yangtse.com -yangtze-elevator.com yangwajia.com yangwang.pw yangwangauto.com yangwc.com yangwenlong.org yangwenqing.com +yangxi.tech yangxiang.com yangxiangdb.com yangxingzhen.com @@ -107573,7 +106876,6 @@ yanjinews.com yanjingge.com yanjiubaogao.com yanjiuchubanshe.com -yanjiyou.net yanjob.com yanjun7858.com yankay.com @@ -107592,6 +106894,7 @@ yanpk.com yanqiao.com yanqingshan.com yanqueai.com +yanrongyun.com yanshanmuyuan.com yanshanpump.com yanshaoutlets.com @@ -107723,14 +107026,12 @@ yaoxun.net yaoyaola.net yaoyedan.net yaoying.vip -yaoyitang.com yaoyouke.com yaozh.com yaozhigong.com yaozhizhu.com yaozs.com yaozui.com -yapodong.com yapp.com yaqilian.com yaqjyj.com @@ -107816,6 +107117,7 @@ ybc1024.com ybc35.com ybccb.com ybccode.com +ybcheck.com ybcjmarathon.com ybcnjg.com ybcxjd.com @@ -107874,7 +107176,6 @@ yc-gc.com yc-petronas.com yc-yinhe.com yc-zj.com -yc-zyg.com yc0917.com yc123.com yc123.net @@ -107894,7 +107195,6 @@ ycbiz.net ycbright.com ycbus.com ycc.ink -yccar.com yccdl.net ycclny.com yccn.cc @@ -108484,7 +107784,6 @@ yh999999.com yhachina.com yhadmob.com yham.net -yhbimg.com yhc-card.com yhcangchu.com yhchj.com @@ -108548,11 +107847,9 @@ yhsport.com yhstjt.com yhtclb.com yhthing.com -yhtj2014.com yhtools.cc yhtx.tv yhtzx.net -yhuimall.com yhurl.com yhwch.com yhwins.com @@ -108715,7 +108012,6 @@ yiduqiang.com yiduwater.com yiec.com yiernews.com -yieryouxin.com yiexi.com yifabao.com yifajingren.com @@ -108950,6 +108246,7 @@ yimudoor.com yimutian.com yimuymc.com yinbaitu.com +yinban.com yinbangbroker.com yinbaor.com yinbian.cc @@ -109009,7 +108306,6 @@ yinghecloud.com yingheedu.com yingheying.com yinghezhong.com -yinghuahao.net yinghuaonline.com yinghuasuan.com yinghuiiot.com @@ -109055,6 +108351,7 @@ yingsoft.com yingsoo.com yingsun.net yingsx.com +yingt.fun yingtai.com yingtaigroup.com yingtaoai.com @@ -109094,7 +108391,6 @@ yingyudengji.com yingyuecl.com yingyuehe.com yingyushijie.com -yingyuweb.com yingyuxiaoshuo.com yingzaocms.com yingzhongshare.com @@ -109241,9 +108537,7 @@ yiqingyuan.com yiqinzi.com yiqioffice.com yiqipaipingtai.com -yiqisese.com yiqishai.com -yiqishangmao.com yiqishanyuan.com yiqiso.com yiqisooimg.com @@ -109259,7 +108553,6 @@ yiqixiegushi.com yiqiyoo.com yiqiyou.com yiquan-keji.com -yiquanhs.com yiquanseo.com yiquhai.com yiqujing.com @@ -109419,7 +108712,6 @@ yixingart.com yixingauto.com yixingguanchang.com yixinli.xin -yixinqiye.com yixintui.com yixinu.com yixiu.cloud @@ -109764,7 +109056,6 @@ ylscw.net ylsdeyy.com ylsdyyy.com ylsfqyy.com -ylsgmr.com ylsgzx.com ylsmtnozzle.com ylssgg.com @@ -109774,7 +109065,6 @@ ylstatic.com ylstcgz.com ylstudy.com ylsw.net -ylsxyjy.com ylt2008.com yltapi.com yltender.com @@ -109806,7 +109096,6 @@ ylxzgz.com ylydmt.com ylyk.com ylyun.com -ylywave.com ylyz.com ylzbsj.com ylzbtech.com @@ -109994,7 +109283,6 @@ ynsyy.com ynszfw.com ynszk.com ynszlyy.com -yntcbc.com yntz.cc yntz.net ynu.icu @@ -110007,7 +109295,6 @@ ynxcbc.com ynxdfpr.com ynxingexinxi.com ynxinhua.com -ynxinshili.com ynxiu.com ynxr.com ynxrmyy.com @@ -110075,7 +109362,6 @@ yogorobot.com yoher.com yohipay.com yoho.org -yohoblk.com yohoboys.com yohobuy.com yohogirls.com @@ -110323,7 +109609,6 @@ youganghangmoguan.com yougaoji.com yougaoyx.com yougenet.com -yougewenhua.xyz youginorg.com yougou.com yougu.tv @@ -110408,7 +109693,6 @@ youlishipin.com youloft.com youlong123.com youlongciqing.com -youlongteng.com youlu.com youlu.net youlu6.com @@ -110514,6 +109798,7 @@ youshop04.com youshop10.com youshu.cc youshuge.com +youshujian.com yousi.com youstong.com youtaidoors.com @@ -110791,7 +110076,6 @@ yqh.com yqh1969.com yqh5.com yqhlm.com -yqhouseware.com yqhzz.com yqjtgs.com yqk889.com @@ -110967,12 +110251,10 @@ ystzzy.com ysug.com ysupan.com ysw1950.com -ysw365.com ysw68.com yswebportal.cc yswh.com yswlgame.com -yswliot.com yswswkj.com yswu.net yswyyds.com @@ -110985,12 +110267,10 @@ ysxyhtz.com ysxzls.com ysys.com ysyycv.com -yszgnn.com yszpwatch.com yszx99.com yszxx.net yszyun.com -yszzlt.com yt-ma.com yt-shoes.com yt-taili.com @@ -111098,7 +110378,6 @@ ytxinyan.com ytxsc.com ytxww.com ytyaoye.com -ytygame.com ytyhdyy.com ytyz.net ytyz.org @@ -111116,7 +110395,6 @@ yuan2808.com yuan7i.com yuanabsorber.com yuanbaobaoxian.com -yuanbaohui.com yuanbaokc.com yuanbaotaoche.com yuanbei.biz @@ -111232,7 +110510,6 @@ yuanzipower.com yuanziyan.com yuanzun.fun yuaoq.com -yuaowuliu.com yuapt.com yubaike.com yubangweb.com @@ -111249,12 +110526,10 @@ yuchaipg.com yuchaizm.com yuchenpharm.com yuchenw.com -yuchichem.com yuchofoodmachine.com yuchuan.org yuchuantech.com yuci998.com -yucne.com yucoolgame.com yucui.org yucunkeji.com @@ -111457,7 +110732,6 @@ yuhx.com yui06161shga.com yui06171shga.com yuiapi.com -yuike.com yujia.com yujiahui.com yujianpay.com @@ -111472,7 +110746,6 @@ yujunjie.com yujunren.com yujzw.com yukaiprecision.com -yukapril.com yukeinfo.com yukexinchem.com yukicat.net @@ -111801,6 +111074,7 @@ yunqishi8.com yunqiyqh.com yunque360.com yunquna.com +yunrang.fun yunrenshi.net yunrg.com yunrongu.com @@ -112024,6 +111298,7 @@ yuwan-game.com yuwang.com yuwangcn.com yuwanjianshe.com +yuwanyouxi.com yuweikuijianzhan.com yuweitek.com yuweiyanwo.com @@ -112047,7 +111322,6 @@ yuxicorrosion.com yuxinews.com yuxingqiu.com yuxinoulogistics.com -yuxinqinhang.com yuxipark.com yuxitech.com yuxungs.com @@ -112097,7 +111371,6 @@ yuzua.com yuzundaojia.com yvv.in yvzfgigpiwmofux.com -yw020.com yw11.com yw160.com yw2005.com @@ -112241,7 +111514,6 @@ yxintent.com yxit.net yxixy.com yxjia.com -yxjidi.com yxjjdby.com yxjkhb.com yxjob.net @@ -112331,7 +111603,6 @@ yy591.com yy6.fun yy845.com yy960.com -yy99998.com yyarea.com yyblly.com yybnet.net @@ -112401,7 +111672,6 @@ yyming2.com yymoban.com yynetwk.com yynykj.com -yyos2.com yyouren.com yyoz.com yypf-china.com @@ -112455,6 +111725,7 @@ yyyeee.com yyyg.com yyyisp.com yyylll.com +yyymvp.com yyyncp.com yyyqm.com yyyvvv.com @@ -112530,7 +111801,6 @@ yzfcdn.com yzfchat.com yzfdc.net yzfjy.com -yzforex.com yzfrkf.com yzftpx.com yzfybj.com @@ -112665,7 +111935,6 @@ yzzxxz.com yzzy-online.com yzzy20-play.com yzzyimages.com -yzzzn.com z-bank.com z-henergy.com z-inn.com @@ -112715,7 +111984,6 @@ zabxib.com zac1993.com zachina.org zack.asia -zackku.com zacveh.com zaduonews.com zaecu.com @@ -112741,7 +112009,6 @@ zaiguahao.com zaih.com zaihuangshi.com zaijia.com -zaijiamaicai.com zaijiawan.com zailaboratory.com zailingtech.com @@ -112844,6 +112111,7 @@ zaucyih.com zawomkv.com zaxdcredit.com zaxisparts.com +zaxline.com zaxzn.com zaysz.com zazhidang.com @@ -112870,7 +112138,6 @@ zbchem.com zbcyrq.com zbdedu.com zbdzy.com -zbesa.com zbfilm.com zbgala.com zbgarden.cc @@ -113094,7 +112361,6 @@ zddr.com zddream.com zdeqs.com zdevo.com -zdexe.com zdfans.com zdfdc.com zdfei.com @@ -113162,7 +112428,6 @@ ze-introduce.com ze-invite.com ze-mp.com ze-wx.com -ze13.com zeaho.com zealer.com zeali.net @@ -113318,7 +112583,6 @@ zg-gyt.com zg-import.com zg-imsoft.com zg-seastar.com -zg-tianzi.com zg114jy.com zg114w.com zg114zs.com @@ -113520,7 +112784,6 @@ zgnjm.com zgnnwdkj.com zgnt.cc zgnt.net -zgnuan.com zgnwp.com zgny.com zgnyw.net @@ -113551,7 +112814,6 @@ zgrcjyw.com zgrd.org zgrdnews.com zgrlm.com -zgrmw.com zgruisai.com zgrzbj.com zgsclp.com @@ -113646,12 +112908,10 @@ zgxytc.com zgxyzx.net zgxzcj.com zgxzhjx.com -zgyaohua.com zgybsfxh.com zgycgc.com zgyeda.com zgyey.com -zgygsy.com zgygw.com zgyhbc.com zgyhys.org @@ -113688,7 +112948,6 @@ zgzpsjz.com zgzsa.com zgzsrc.com zgzszy.com -zgzxhg.com zgzy.net zgzypyw.com zgzyxxzs.com @@ -113740,7 +112999,6 @@ zhanbanji.com zhanbuba.com zhanchenyouqi.com zhanchily.com -zhanchuang1407.com zhandao.net zhandaren.com zhandian88.com @@ -114006,7 +113264,6 @@ zhcsgc.com zhctv.com zhcw.com zhcyanshi.com -zhdba.com zhdfg.com zhdgps.com zhdhq.com @@ -114019,7 +113276,6 @@ zhdxbj.com zhe.com zhe800.com zhe900.com -zhe97.com zhebei.com zhebeipharm.com zhebumai.com @@ -114056,7 +113312,6 @@ zhelixin.com zheliyin.com zhen-ao.com zhen.com -zhen22.com zhenai.com zhenaihn.com zhenandl.com @@ -114066,7 +113321,6 @@ zhenbi.com zhenbizi.com zhenbon.com zhenchu.cc -zhendagroup.com zhending-chicken.com zhendong365.com zhendonggames.com @@ -114264,7 +113518,6 @@ zhibaimeixue.com zhibeidy.com zhibiaow.com zhibitouzi.com -zhibo.me zhibo.tv zhibo8.cc zhibo8.com @@ -114389,7 +113642,6 @@ zhijiashe.com zhijidoc.com zhijie-edu.com zhijieguo.com -zhijiehuanyu.com zhijieketang.com zhijin.com zhijinwang.com @@ -114410,7 +113662,6 @@ zhil.cloud zhilandaren.com zhilehuo.com zhileiqiye.com -zhileng.com zhilepin.com zhilian-nb.com zhilian.com @@ -114502,7 +113753,6 @@ zhishif.com zhishifanli.com zhishifenzi.com zhishinn.com -zhishiq.com zhishisoft.com zhishiu.com zhishiv.com @@ -114584,6 +113834,7 @@ zhiyuanshijie.com zhiyuanxinglvye.com zhiyuanyun.com zhiyuanzhongyi.com +zhiyuapp.com zhiyueit.com zhiyuequan.com zhiyun-cn.com @@ -114698,7 +113949,6 @@ zhongcetech.com zhongche.com zhongchebaolian.com zhongchewuliu.com -zhongchoujia.com zhongchouke.com zhongchuang365.com zhongchuangwenhua.com @@ -114806,7 +114056,6 @@ zhongmingjiaoyu.net zhongnakeji.com zhongnengrecycling.com zhongnice.com -zhongniu.com zhongnongjimu.com zhongp.com zhongpaiwang.com @@ -114893,7 +114142,6 @@ zhongyapeicui.com zhongyasmart.com zhongyejy.com zhongyf.com -zhongyi1985.com zhongyi6.com zhongyi9999.com zhongyibaodian.com @@ -114984,6 +114232,7 @@ zhpecc.com zhpharm-sh.com zhqgtjxh.com zhqyue.com +zhrct.com zhrczp.com zhrtc.com zhsapphire.com @@ -115188,7 +114437,6 @@ zhuluyy.com zhumanggroup.com zhumanggroup.net zhumaweb.com -zhumengqinziyou.com zhumengwl.com zhumingepc.com zhumiquan.com @@ -115204,7 +114452,6 @@ zhundaoyun.com zhuneijs.com zhuniangjia.com zhuniu.com -zhunkua.net zhunnai.com zhunshitianqi.com zhunter.com @@ -115227,7 +114474,6 @@ zhuolaoshi.com zhuolaoshi.net zhuoligk.com zhuomaiyun.com -zhuomajidian.com zhuomiles.com zhuomogroup.com zhuoquapp.com @@ -115405,7 +114651,6 @@ zigaokj.com zige365.com zigeer.com zigonggroup.com -zigongyinuo.com ziguhonglan.com zihai0351.com zihai0535.com @@ -115535,7 +114780,6 @@ ziwanyouxi.com ziweicn.com ziweifu.com ziweihuan.com -ziwojianding.net ziwoyou.net ziwufang.com ziwuyunjiao.com @@ -115566,7 +114810,6 @@ ziyimall.com ziying.site ziyou.com ziyou.studio -ziyouad.com ziyoufa.com ziyouma.net ziyouwu.com @@ -115964,7 +115207,6 @@ zjlljt.com zjlottery.com zjlsbz.com zjlsedu.org -zjlskd.com zjlvjie.com zjlxjs.com zjlxtx.com @@ -116089,7 +115331,6 @@ zjskgr.com zjskjt.com zjslep.com zjslzh.com -zjsmhg.com zjsms.com zjspas.com zjssjt.com @@ -116254,7 +115495,6 @@ zjzhongtian.com zjzj.net zjzj.org zjzjjx.com -zjznk.com zjzoneng.com zjzramc.com zjzrzyjy.com @@ -116576,7 +115816,6 @@ zntcexpo.com zntschool.com zntvrom.com zntx.cc -zntzdj.com znum.com znwb.com znxdxs.com @@ -116626,6 +115865,7 @@ zonafs.com zonboapp.com zonci.com zone-king.com +zone.id zone139.com zoneben.com zoneidc.com @@ -116790,7 +116030,6 @@ zqins.com zqjcedu.com zqjiese.com zqjinneng.com -zqjjr.com zqkjy.com zqlian.com zqlx.com @@ -116873,7 +116112,6 @@ zsaxi.com zsb2c.com zsbbk.com zsbeike.com -zsbk.net zsboai.com zsbqgz.com zsbsoft.com @@ -116939,11 +116177,9 @@ zsimc.com zsincer.com zsite.com zsj18.com -zsjcxh.com zsjdxh.org zsjhsjy.com zsjhx.com -zsjinqi.com zsjjob.com zsjjyp.com zsjuchuang.com @@ -117316,7 +116552,6 @@ zuzuche.com zuzuqueen.com zviewcloud.com zving.com -zvr1f.com zvryuq7xg31x5g.com zvstapp.com zvsts.com @@ -117385,7 +116620,6 @@ zwyll.com zwzdiy.cc zwzrent.com zwzsh.net -zwzyd.com zwzyzx.com zx-tour.com zx-xcx.com @@ -117570,7 +116804,6 @@ zyfchina.com zyfj.com zyfsz.net zygames.com -zygg.cc zygj.net zygjtzjt.com zygs.com @@ -117687,7 +116920,6 @@ zyzl120.com zyzw.com zz-hh.com zz-invest.com -zz-zigzag.com zz.ci zz123456789.xyz zz2024.com @@ -117718,7 +116950,6 @@ zzc9.com zzccom.com zzccp.com zzcdnx.com -zzcdsl.com zzcjby.com zzcjxy.com zzcm1.com @@ -117742,6 +116973,7 @@ zzfeilu.com zzfly.net zzfreshair.com zzfriend.com +zzfxfz.com zzgcjyzx.com zzgd.tv zzgdapp.com @@ -117751,7 +116983,6 @@ zzgkyy.com zzgtjtgs.com zzguest.com zzguifan.com -zzh789.com zzhaofang.com zzhaoz.com zzhbgs.com @@ -117813,6 +117044,7 @@ zzqss.com zzquan9.com zzqudu.com zzqxs.com +zzqz2024.com zzqzz.com zzrc.net zzrcw.net diff --git a/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute b/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute index 42e018d405..a111f3db49 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute +++ b/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute @@ -53,6 +53,7 @@ 101.198.0.0/22 101.198.160.0/19 101.198.192.0/19 +101.198.4.0/24 101.199.112.0/24 101.199.128.0/23 101.199.196.0/22 @@ -89,6 +90,8 @@ 101.248.0.0/15 101.251.0.0/22 101.251.128.0/19 +101.251.160.0/20 +101.251.176.0/22 101.251.192.0/18 101.251.80.0/20 101.254.0.0/20 @@ -207,7 +210,7 @@ 103.126.101.0/24 103.126.102.0/23 103.126.124.0/22 -103.126.18.0/23 +103.126.19.0/24 103.13.12.0/24 103.13.244.0/22 103.130.160.0/23 @@ -253,6 +256,7 @@ 103.145.92.0/24 103.146.126.0/23 103.147.124.0/24 +103.149.111.0/24 103.149.181.0/24 103.149.242.0/24 103.149.244.0/22 @@ -264,6 +268,7 @@ 103.150.212.0/24 103.150.24.0/23 103.151.148.0/23 +103.151.179.0/24 103.151.216.0/23 103.151.228.0/23 103.151.5.0/24 @@ -281,6 +286,7 @@ 103.154.30.0/23 103.154.41.0/24 103.155.110.0/23 +103.155.120.0/23 103.155.76.0/23 103.156.174.0/23 103.156.186.0/23 @@ -311,8 +317,8 @@ 103.175.197.0/24 103.177.28.0/23 103.179.78.0/23 -103.18.186.0/24 103.180.108.0/23 +103.181.164.0/23 103.181.234.0/24 103.183.122.0/23 103.183.124.0/23 @@ -387,7 +393,7 @@ 103.21.140.0/22 103.21.176.0/22 103.210.160.0/22 -103.210.170.0/23 +103.210.171.0/24 103.211.220.0/22 103.211.44.0/22 103.212.1.0/24 @@ -655,6 +661,7 @@ 103.42.8.0/22 103.43.132.0/24 103.43.134.0/23 +103.43.175.0/24 103.43.184.0/22 103.43.240.0/23 103.44.144.0/22 @@ -685,7 +692,7 @@ 103.49.196.0/24 103.49.198.0/23 103.5.192.0/22 -103.50.36.0/22 +103.50.38.0/24 103.51.62.0/23 103.52.100.0/22 103.52.104.0/23 @@ -744,6 +751,7 @@ 103.71.232.0/22 103.71.68.0/22 103.72.113.0/24 +103.72.120.0/22 103.72.172.0/24 103.73.116.0/22 103.73.136.0/21 @@ -768,7 +776,7 @@ 103.78.60.0/22 103.79.120.0/22 103.79.200.0/22 -103.79.228.0/23 +103.79.228.0/24 103.79.24.0/22 103.8.220.0/22 103.8.32.0/22 @@ -957,6 +965,7 @@ 110.218.192.0/20 110.218.224.0/20 110.218.32.0/20 +110.219.128.0/17 110.219.64.0/22 110.219.68.0/24 110.228.0.0/14 @@ -1028,7 +1037,6 @@ 111.235.178.0/23 111.235.180.0/23 111.235.182.0/24 -111.67.192.0/20 111.72.0.0/13 111.85.0.0/16 112.0.0.0/10 @@ -1220,7 +1228,8 @@ 115.175.64.0/19 115.182.0.0/15 115.190.0.0/17 -115.190.128.0/19 +115.190.128.0/18 +115.190.192.0/20 115.192.0.0/11 115.224.0.0/12 115.24.0.0/14 @@ -1229,6 +1238,7 @@ 115.32.0.0/19 115.32.32.0/21 115.32.56.0/21 +115.32.64.0/20 115.44.0.0/14 115.48.0.0/12 115.84.0.0/18 @@ -1419,7 +1429,8 @@ 118.178.0.0/16 118.180.0.0/14 118.184.0.0/22 -118.184.104.0/22 +118.184.105.0/24 +118.184.106.0/23 118.184.128.0/17 118.184.30.0/24 118.184.40.0/21 @@ -1427,7 +1438,6 @@ 118.184.52.0/24 118.184.64.0/24 118.184.66.0/23 -118.184.69.0/24 118.184.76.0/22 118.184.81.0/24 118.184.82.0/23 @@ -1474,8 +1484,7 @@ 118.192.70.0/24 118.192.96.0/19 118.193.128.0/23 -118.193.138.0/24 -118.193.144.0/23 +118.193.144.0/24 118.193.152.0/22 118.193.160.0/23 118.193.162.0/24 @@ -1488,8 +1497,8 @@ 118.194.240.0/21 118.194.32.0/19 118.195.0.0/16 -118.196.0.0/19 -118.196.32.0/20 +118.196.0.0/18 +118.196.64.0/19 118.199.0.0/16 118.202.0.0/15 118.212.0.0/15 @@ -1588,7 +1597,6 @@ 119.255.128.0/17 119.255.63.0/24 119.27.160.0/19 -119.27.64.0/18 119.28.28.0/24 119.29.0.0/16 119.3.0.0/16 @@ -1985,11 +1993,7 @@ 124.172.0.0/15 124.192.0.0/15 124.196.0.0/24 -124.196.10.0/23 124.196.12.0/23 -124.196.17.0/24 -124.196.18.0/23 -124.196.20.0/24 124.196.25.0/24 124.196.26.0/23 124.196.28.0/24 @@ -2002,12 +2006,9 @@ 124.196.56.0/23 124.196.58.0/24 124.196.66.0/24 -124.196.72.0/24 -124.196.76.0/23 -124.196.78.0/24 +124.196.77.0/24 124.196.80.0/22 124.196.84.0/24 -124.196.9.0/24 124.200.0.0/16 124.202.0.0/16 124.203.176.0/20 @@ -2030,7 +2031,6 @@ 124.40.128.0/18 124.42.0.0/16 124.47.0.0/18 -124.6.64.0/18 124.64.0.0/15 124.66.0.0/17 124.67.0.0/16 @@ -2190,8 +2190,7 @@ 150.138.0.0/15 150.158.0.0/16 150.223.0.0/16 -150.242.120.0/24 -150.242.122.0/23 +150.242.120.0/22 150.242.156.0/22 150.242.168.0/22 150.242.184.0/22 @@ -2205,7 +2204,6 @@ 150.242.96.0/22 150.255.0.0/16 151.241.174.0/24 -151.242.65.0/24 152.104.128.0/17 152.136.0.0/16 153.0.0.0/16 @@ -2221,6 +2219,7 @@ 154.208.160.0/21 154.208.172.0/23 154.213.4.0/23 +154.218.6.0/23 154.223.168.0/24 154.223.179.0/24 154.223.180.0/24 @@ -2232,11 +2231,14 @@ 154.8.128.0/17 154.91.158.0/23 155.117.164.0/24 +155.117.188.0/24 155.126.176.0/23 156.107.160.0/24 156.107.170.0/24 156.107.179.0/24 156.107.181.0/24 +156.227.1.0/24 +156.227.24.0/22 156.230.11.0/24 156.231.163.0/24 156.236.116.0/24 @@ -2315,10 +2317,6 @@ 167.148.46.0/24 167.189.0.0/16 167.220.244.0/22 -168.159.144.0/21 -168.159.152.0/22 -168.159.156.0/23 -168.159.158.0/24 168.160.0.0/17 168.160.152.0/24 168.160.158.0/23 @@ -2366,6 +2364,7 @@ 175.42.0.0/15 175.44.0.0/16 175.46.0.0/15 +178.219.5.0/24 178.253.239.0/24 180.129.128.0/17 180.130.0.0/16 @@ -2449,7 +2448,7 @@ 182.61.128.0/19 182.61.192.0/22 182.61.200.0/21 -182.61.216.0/21 +182.61.208.0/20 182.61.224.0/19 182.80.0.0/13 182.88.0.0/14 @@ -2479,14 +2478,12 @@ 185.75.173.0/24 185.75.174.0/24 188.131.128.0/17 -192.102.204.0/22 192.140.160.0/19 192.140.208.0/21 192.144.128.0/17 192.163.11.0/24 192.232.97.0/24 192.55.46.0/24 -192.55.68.0/22 193.112.0.0/16 193.119.10.0/23 193.119.12.0/23 @@ -2494,6 +2491,7 @@ 193.119.17.0/24 193.119.19.0/24 193.119.20.0/23 +193.119.22.0/24 193.119.25.0/24 193.119.28.0/24 193.119.30.0/24 @@ -2507,7 +2505,6 @@ 194.138.245.0/24 194.15.39.0/24 195.114.203.0/24 -198.175.100.0/22 198.208.112.0/23 198.208.17.0/24 198.208.19.0/24 @@ -2573,7 +2570,6 @@ 202.153.48.0/20 202.158.160.0/19 202.160.140.0/22 -202.164.0.0/20 202.164.25.0/24 202.168.160.0/19 202.170.128.0/19 @@ -2688,7 +2684,7 @@ 203.119.26.0/23 203.119.28.0/22 203.119.33.0/24 -203.119.80.0/23 +203.119.80.0/24 203.119.83.0/24 203.12.204.0/23 203.12.91.0/24 @@ -2932,7 +2928,6 @@ 203.83.56.0/21 203.86.0.0/19 203.86.112.0/24 -203.86.116.0/24 203.86.254.0/23 203.86.43.0/24 203.86.44.0/23 @@ -3223,7 +3218,7 @@ 211.97.0.0/17 211.97.128.0/19 211.97.160.0/21 -211.97.190.0/24 +211.97.176.0/20 211.97.192.0/18 211.98.0.0/16 211.99.128.0/18 @@ -3233,6 +3228,7 @@ 211.99.32.0/19 211.99.64.0/18 211.99.8.0/21 +212.100.186.0/24 212.129.128.0/17 212.64.0.0/17 218.0.0.0/11 @@ -3537,7 +3533,6 @@ 223.240.0.0/13 223.248.0.0/14 223.252.194.0/24 -223.252.196.0/24 223.252.199.0/24 223.252.200.0/23 223.252.202.0/24 @@ -3601,6 +3596,7 @@ 36.213.192.0/20 36.213.208.0/23 36.213.210.0/24 +36.221.0.0/17 36.248.0.0/14 36.255.116.0/22 36.255.128.0/22 @@ -3620,6 +3616,7 @@ 36.56.0.0/13 36.96.0.0/12 38.111.220.0/23 +38.211.199.0/24 39.104.0.0/14 39.108.0.0/16 39.128.0.0/10 @@ -3661,7 +3658,8 @@ 42.240.12.0/24 42.240.128.0/17 42.240.16.0/24 -42.240.20.0/24 +42.240.20.0/23 +42.240.22.0/24 42.240.8.0/22 42.242.0.0/15 42.244.0.0/14 @@ -3681,7 +3679,6 @@ 42.83.189.0/24 42.83.190.0/24 42.83.200.0/23 -42.83.255.0/24 42.84.0.0/14 42.88.0.0/13 42.96.128.0/17 @@ -3741,7 +3738,8 @@ 43.229.216.0/22 43.229.48.0/22 43.230.136.0/22 -43.230.220.0/22 +43.230.221.0/24 +43.230.222.0/23 43.230.72.0/22 43.231.144.0/20 43.231.160.0/21 @@ -3887,8 +3885,7 @@ 45.116.208.0/22 45.116.32.0/22 45.116.52.0/22 -45.117.68.0/24 -45.117.70.0/23 +45.117.68.0/22 45.117.8.0/22 45.119.105.0/24 45.119.116.0/22 @@ -3934,7 +3931,7 @@ 45.248.8.0/22 45.249.208.0/23 45.249.212.0/22 -45.250.152.0/24 +45.250.152.0/23 45.250.180.0/23 45.250.184.0/22 45.250.188.0/24 @@ -4194,6 +4191,7 @@ 66.102.248.0/22 66.102.252.0/24 66.102.254.0/23 +66.92.248.0/24 68.79.0.0/18 69.163.104.0/24 69.163.106.0/24 @@ -4207,6 +4205,7 @@ 71.132.0.0/18 71.136.64.0/18 71.137.0.0/18 +74.122.24.0/24 77.107.118.0/24 8.128.32.0/19 8.128.64.0/19 @@ -4228,7 +4227,7 @@ 8.150.64.0/23 8.152.0.0/13 8.160.0.0/15 -8.162.0.0/19 +8.162.0.0/18 8.163.0.0/16 8.164.0.0/16 81.173.18.0/23 @@ -4236,9 +4235,7 @@ 81.173.28.0/24 81.68.0.0/14 82.156.0.0/15 -82.206.108.0/24 84.247.114.0/24 84.54.2.0/23 85.237.205.0/24 -89.149.17.0/24 94.191.0.0/17 diff --git a/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 b/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 index 18154cd717..68e936be55 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 +++ b/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 @@ -30,6 +30,7 @@ 2400:5f60::/32 2400:6000::/32 2400:6460:300::/40 +2400:6460:500::/40 2400:6460::/39 2400:6600::/32 2400:6e60:1301::/48 @@ -162,7 +163,6 @@ 2401:7e00::/32 2401:800::/32 2401:8be0::/48 -2401:8d00:10::/48 2401:8d00:12::/48 2401:8d00:14::/48 2401:8d00:4::/48 @@ -204,10 +204,11 @@ 2401:f860:86::/47 2401:f860:88::/47 2401:f860:90::/46 -2401:f860:94::/48 -2401:f860:c::/48 -2401:f860:e::/48 +2401:f860:94::/47 +2401:f860:a::/47 +2401:f860:c::/46 2401:f860:f100::/40 +2401:f860:f6::/48 2401:fa00:40::/43 2402:1440::/32 2402:2000::/32 @@ -349,7 +350,7 @@ 2404:e280::/47 2404:e5c0::/32 2404:e8c0::/32 -2404:f4c0:f000::/44 +2404:f4c0::/32 2405:1480:1000::/48 2405:1480:2000::/48 2405:1480:3000::/47 @@ -452,7 +453,8 @@ 2406:840:fda0::/43 2406:840:fdc0::/44 2406:840:fdd1::/48 -2406:840:fde1::/48 +2406:840:fde5::/48 +2406:840:fde6::/47 2406:840:fe27::/48 2406:840:fe90::/46 2406:840:fe94::/48 @@ -473,7 +475,7 @@ 2406:840:fed1::/48 2406:840:fed8::/48 2406:840:fedb::/48 -2406:840:fedc::/48 +2406:840:fedc::/47 2406:840:fedf::/48 2406:840:fef0::/48 2406:840:fef3::/48 @@ -575,6 +577,7 @@ 2408:8181:a000::/40 2408:8181:a220::/44 2408:8181:e000::/40 +2408:8182:6000::/40 2408:8182:c000::/40 2408:8183:4000::/40 2408:8183:8000::/40 @@ -1100,7 +1103,6 @@ 240a:4020:883a::/48 240a:4021:83a::/48 240a:4021:883a::/48 -240a:4083::/35 240a:4084:2000::/35 240a:4088:a000::/35 240a:408c:2000::/35 @@ -1118,7 +1120,6 @@ 240a:4090:5200::/40 240a:4090:7000::/39 240a:4090:7200::/40 -240a:4090:a000::/35 240a:4093::/35 240a:4094:2000::/35 240a:409c:2000::/35 @@ -1171,6 +1172,7 @@ 240a:41f2::/31 240a:420a::/31 240a:4224:9000::/44 +240a:4224:a000::/44 240a:4224:d000::/44 240a:4224:e000::/44 240a:4230::/31 @@ -1197,8 +1199,10 @@ 240e::/20 2602:2e0:ff::/48 2602:f7ee:ee::/48 +2602:f92a:a478::/48 +2602:f92a:d1ff::/48 +2602:f92a:dead::/48 2602:f92a:e100::/44 -2602:f92a:f000::/48 2602:f93b:400::/38 2602:f9ba:10c::/48 2602:f9ba:a8::/48 @@ -1224,6 +1228,7 @@ 2620:57:4004::/48 2804:1e48:9001::/48 2804:1e48:9002::/48 +2a01:f100:100::/48 2a01:f100:1f8::/48 2a01:ffc7:100::/40 2a03:5840:126::/48 @@ -1316,6 +1321,7 @@ 2a0e:aa07:e162::/48 2a0e:aa07:e16a::/48 2a0e:aa07:e1a0::/44 +2a0e:aa07:e1e1::/48 2a0e:aa07:e1e2::/47 2a0e:aa07:e1e4::/47 2a0e:aa07:e1e6::/48 @@ -1356,15 +1362,18 @@ 2a0f:7803:fe82::/48 2a0f:7804:f650::/44 2a0f:7804:f9f0::/44 +2a0f:7807::/32 2a0f:7d07::/32 2a0f:85c1:ba5::/48 2a0f:85c1:ca0::/44 2a0f:85c1:ce1::/48 +2a0f:85c1:cf1::/48 2a0f:9400:6110::/48 2a0f:9400:7700::/48 2a0f:ac00::/29 2a0f:ea47:fc1d::/48 2a10:2f00:15a::/48 +2a10:67c2:2::/48 2a10:ccc0:d00::/46 2a10:ccc0:d0a::/47 2a10:ccc0:d0c::/47 @@ -1387,12 +1396,16 @@ 2a13:a5c7:2102::/48 2a13:a5c7:2121::/48 2a13:a5c7:2301::/48 +2a13:a5c7:2302::/48 2a13:a5c7:23c0::/42 +2a13:a5c7:2600::/40 2a13:a5c7:2801::/48 2a13:a5c7:2803::/48 2a13:a5c7:3108::/48 2a13:a5c7:31a0::/43 -2a13:a5c7:3307::/48 +2a13:a5c7:3301::/48 +2a13:a5c7:3304::/48 +2a13:a5c7:3306::/47 2a13:aac4:f000::/44 2a14:4c41::/32 2a14:67c1:20::/44 @@ -1410,14 +1423,12 @@ 2a14:67c1:a040::/47 2a14:67c1:a061::/48 2a14:67c1:a064::/48 -2a14:67c1:a090::/46 -2a14:67c1:a094::/47 -2a14:67c1:a096::/48 +2a14:67c1:a090::/45 2a14:67c1:a099::/48 2a14:67c1:a100::/43 2a14:67c1:a125::/48 -2a14:67c1:a127::/48 2a14:67c1:a144::/48 +2a14:67c1:a150::/44 2a14:67c1:b000::/48 2a14:67c1:b065::/48 2a14:67c1:b066::/48 @@ -1441,10 +1452,10 @@ 2a14:67c1:b581::/48 2a14:67c1:b582::/48 2a14:67c1:b588::/47 -2a14:67c1:b590::/48 +2a14:67c1:b590::/47 2a14:67c1:b599::/48 2a14:67c5:1900::/40 -2a14:7580:72f::/48 +2a14:7580:740::/44 2a14:7580:750::/47 2a14:7580:9200::/40 2a14:7580:9400::/39 @@ -1458,6 +1469,7 @@ 2a14:7580:fe00::/40 2a14:7580:fff4::/48 2a14:7580:fff7::/48 +2a14:7580:fffa::/48 2a14:7581:3100::/40 2a14:7581:3400::/47 2a14:7581:9010::/44 @@ -1484,9 +1496,20 @@ 2a14:7581:bcd::/48 2a14:7581:bff::/48 2a14:7581:ffb::/48 +2a14:7581:ffd::/48 2a14:7583:f201::/48 2a14:7583:f203::/48 -2a14:7583:f300::/40 +2a14:7583:f300::/46 +2a14:7583:f304::/48 +2a14:7583:f4fe::/48 +2a14:7583:f500::/48 +2a14:7583:f701::/48 +2a14:7583:f702::/47 +2a14:7583:f704::/47 +2a14:7583:f707::/48 +2a14:7583:f708::/48 +2a14:7583:f743::/48 +2a14:7583:f764::/48 2a14:7584::/36 2a14:7c0:4a01::/48 2c0f:f7a8:8011::/48 diff --git a/small/luci-app-passwall/root/usr/share/passwall/rules/gfwlist b/small/luci-app-passwall/root/usr/share/passwall/rules/gfwlist index 1d4885deca..45ad5e8186 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/rules/gfwlist +++ b/small/luci-app-passwall/root/usr/share/passwall/rules/gfwlist @@ -138,6 +138,7 @@ abematv.akamaized.net abitno.linpie.com ablwang.com aboluowang.com +about.gitlab.com about.me abplive.com abs.edu @@ -734,6 +735,8 @@ brutaltgp.com bsky.app bsky.network bsky.social +bt4g.org +bt4gprx.com bt95.com btaia.com btbit.net @@ -1898,6 +1901,7 @@ gaopi.net gardennetworks.com gardennetworks.org gartlive.com +garudalinux.org gate.io gatecoin.com gather.com @@ -2700,6 +2704,7 @@ iphone4hongkong.com iphonetaiwan.org iphonix.fr ipicture.ru +ipify.org ipjetable.net ipobar.com ipoock.com @@ -3176,6 +3181,7 @@ mcadforums.com mcaf.ee mcfog.com mcreasite.com +mcusercontent.com md-t.org me.me me.ns.ci @@ -3550,6 +3556,7 @@ ninecommentaries.com ninjacloak.com ninjaproxy.ninja nintendium.com +nirsoft.net nitter.cc nitter.net niu.moe @@ -4368,6 +4375,7 @@ simplecd.org simpleproductivityblog.com simpleswap.io simplex.chat +sina.com.hk sinchew.com.my singaporepools.com.sg singfortibet.com @@ -4667,11 +4675,13 @@ taiwantt.org.tw taiwanus.net taiwanyes.ning.com talk853.com +talkatone.com talkboxapp.com talkcc.com talkonly.net tanc.org tangren.us +tanks.gg taoism.net tapanwap.com tapatalk.com @@ -5141,7 +5151,6 @@ ubddns.org uberproxy.net uc-japan.org uchicago.edu -uderzo.it udn.com udn.com.tw udnbkk.com @@ -5378,6 +5387,7 @@ vpnvip.com vpnworldwide.com vporn.com vpser.net +vpsxb.net vraiesagesse.net vrchat.com vrmtr.com diff --git a/small/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/small/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 890573e6ed..a0a5fd82f9 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/small/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -685,8 +685,13 @@ local function processData(szType, content, add_mode, add_from) else userinfo = base64Decode(hostInfo[1]) end - local method = userinfo:sub(1, userinfo:find(":") - 1) - local password = userinfo:sub(userinfo:find(":") + 1, #userinfo) + local method, password + if userinfo:find(":") then + method = userinfo:sub(1, userinfo:find(":") - 1) + password = userinfo:sub(userinfo:find(":") + 1, #userinfo) + else + password = hostInfo[1] --一些链接用明文uuid做密码 + end -- 判断密码是否经过url编码 local function isURLEncodedPassword(pwd) @@ -701,12 +706,20 @@ local function processData(szType, content, add_mode, add_from) if isURLEncodedPassword(password) and decoded then password = decoded end + + local _method = (method or "none"):lower() + method = (_method == "chacha20-poly1305" and "chacha20-ietf-poly1305") or + (_method == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or _method + result.method = method result.password = password - if result.type ~= "Xray" then - result.method = (method:lower() == "chacha20-poly1305" and "chacha20-ietf-poly1305") or - (method:lower() == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or method + if has_xray and (result.type ~= 'Xray' and result.type ~= 'sing-box' and params.type) then + result.type = 'Xray' + result.protocol = 'shadowsocks' + elseif has_singbox and (result.type ~= 'Xray' and result.type ~= 'sing-box' and params.type) then + result.type = 'sing-box' + result.protocol = 'shadowsocks' end if result.plugin then @@ -1109,6 +1122,9 @@ local function processData(szType, content, add_mode, add_from) if not params.type then params.type = "tcp" end params.type = string.lower(params.type) + if ({ xhttp=true, kcp=true, mkcp=true })[params.type] and result.type ~= "Xray" and has_xray then + result.type = "Xray" + end if result.type == "sing-box" and params.type == "raw" then params.type = "tcp" elseif result.type == "Xray" and params.type == "tcp" then @@ -1805,9 +1821,9 @@ local function parse_link(raw, add_mode, add_from, cfgid) else -- ssd 外的格式 if add_mode == "1" then - nodes = split(raw:gsub(" ", "\n"), "\n") + nodes = split(raw, "\n") else - nodes = split(base64Decode(raw):gsub(" ", "\n"), "\n") + nodes = split(base64Decode(raw):gsub("\r\n", "\n"), "\n") end end @@ -1825,7 +1841,8 @@ local function parse_link(raw, add_mode, add_from, cfgid) local link = api.trim(dat[2]:gsub("#.*$", "")) result = processData(dat[1], base64Decode(link), add_mode, add_from) else - result = processData(dat[1], dat[2], add_mode, add_from) + local link = dat[2]:gsub("&", "&"):gsub("%s*#%s*", "#") -- 一些奇葩的链接用"&"当做"&","#"前后带空格 + result = processData(dat[1], link, add_mode, add_from) end end else diff --git a/small/luci-app-passwall2/Makefile b/small/luci-app-passwall2/Makefile index ef30315bf6..501d071b89 100644 --- a/small/luci-app-passwall2/Makefile +++ b/small/luci-app-passwall2/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 -PKG_VERSION:=25.9.20 +PKG_VERSION:=25.9.24 PKG_RELEASE:=1 PKG_CONFIG_DEPENDS:= \ diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua index 11b3f173ea..ffa58a986a 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua @@ -124,6 +124,11 @@ if #hysteria2_type > 0 then end end +if #ss_type > 0 or #trojan_type > 0 or #vmess_type > 0 or #vless_type > 0 or #hysteria2_type > 0 then + o.description = string.format("%s", + translate("The configured type also applies to the core specified when manually importing nodes.")) +end + o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node.")) o.default = "" o:value("", translate("Auto")) diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua index b4c811fd6b..b0af935ce1 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua @@ -122,7 +122,7 @@ function o.custom_write(self, section, value) else result = { value } end - api.uci:set_list(appname, section, "balancing_node", result) + m.uci:set_list(appname, section, "balancing_node", result) end o = s:option(ListValue, _n("balancingStrategy"), translate("Balancing Strategy")) diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua index c8dc18c7b9..518cbf908b 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua @@ -132,7 +132,7 @@ function o.custom_write(self, section, value) else result = { value } end - api.uci:set_list(appname, section, "urltest_node", result) + m.uci:set_list(appname, section, "urltest_node", result) end o = s:option(Value, _n("urltest_url"), translate("Probe URL")) diff --git a/small/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm b/small/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm index db2dde9e77..493231728f 100644 --- a/small/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm +++ b/small/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm @@ -793,6 +793,7 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ if (ssrurl === null || ssrurl === "") { return false; } + ssrurl = ssrurl.replace(/&/gi, '&').replace(/\s*#\s*/, '#').trim(); //一些奇葩的链接用"&"当做"&","#"前后带空格 s.innerHTML = ""; var ssu = ssrurl.split('://'); var event = document.createEvent("HTMLEvents"); @@ -870,6 +871,8 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ if (userInfoSplitIndex !== -1) { method = userInfo.substr(0, userInfoSplitIndex); password = userInfo.substr(userInfoSplitIndex + 1); + } else { + password = url0.substr(0, sipIndex); //一些链接用明文uuid做密码 } } else { // base64(method:pass@host:port) @@ -908,14 +911,14 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ pluginOpts = pluginParams.join(";"); } - if (ss_type == "sing-box" && has_singbox) { - dom_prefix = "singbox_" - opt.set('type', "sing-box"); - opt.set(dom_prefix + 'protocol', "shadowsocks"); - } else if (ss_type == "xray" && has_xray) { + if (has_xray && ((ss_type !== "xray" && ss_type !== "sing-box" && queryParam.type) || ss_type == "xray")) { dom_prefix = "xray_" opt.set('type', "Xray"); opt.set(dom_prefix + 'protocol', "shadowsocks"); + } else if (has_singbox && ((ss_type !== "xray" && ss_type !== "sing-box" && queryParam.type) || ss_type == "sing-box")) { + dom_prefix = "singbox_" + opt.set('type', "sing-box"); + opt.set(dom_prefix + 'protocol', "shadowsocks"); } else if (ss_type == "shadowsocks-rust") { dom_prefix = "ssrust_" opt.set('type', "SS-Rust"); @@ -928,10 +931,14 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ opt.set('type', "SS"); } } - if (ss_type !== "xray") { - method = method.toLowerCase() === "chacha20-poly1305" ? "chacha20-ietf-poly1305" : method; - method = method.toLowerCase() === "xchacha20-poly1305" ? "xchacha20-ietf-poly1305" : method; - } + + const _method = (method || "none").toLowerCase(); + const mapping = { + "chacha20-poly1305": "chacha20-ietf-poly1305", + "xchacha20-poly1305": "xchacha20-ietf-poly1305", + }; + method = mapping[_method] || _method; + opt.set(dom_prefix + 'address', unbracketIP(server)); opt.set(dom_prefix + 'port', port); opt.set(dom_prefix + 'password', password || ""); @@ -1324,16 +1331,13 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ dom_prefix = "xray_" opt.set('type', "Xray"); } - opt.set(dom_prefix + 'protocol', "vless"); + var m = parseNodeUrl(ssrurl); var password = m.passwd; if (password === "") { s.innerHTML = "<%:Invalid Share URL Format%>"; return false; } - opt.set(dom_prefix + 'uuid', password); - opt.set(dom_prefix + 'address', unbracketIP(m.hostname)); - opt.set(dom_prefix + 'port', m.port || "443"); var queryParam = {}; if (m.search.length > 1) { var query = m.search.replace('/?', '?').split('?') @@ -1346,6 +1350,16 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ } } + queryParam.type = queryParam.type.toLowerCase(); + if (["xhttp", "kcp", "mkcp"].includes(queryParam.type) && vless_type !== "xray" && has_xray) { + dom_prefix = "xray_" + opt.set('type', "Xray"); + } + opt.set(dom_prefix + 'protocol', "vless"); + opt.set(dom_prefix + 'uuid', password); + opt.set(dom_prefix + 'address', unbracketIP(m.hostname)); + opt.set(dom_prefix + 'port', m.port || "443"); + opt.set(dom_prefix + 'encryption', queryParam.encryption || "none"); if (queryParam.security) { if (queryParam.security == "tls") { @@ -1385,7 +1399,6 @@ local hysteria2_type = get_core("hysteria2_type", {{has_hysteria2,"hysteria2"},{ } - queryParam.type = queryParam.type.toLowerCase(); if (queryParam.type === "kcp" || queryParam.type === "mkcp") { queryParam.type = "mkcp"; } diff --git a/small/luci-app-passwall2/po/zh-cn/passwall2.po b/small/luci-app-passwall2/po/zh-cn/passwall2.po index 13d4d3613b..4d2711f592 100644 --- a/small/luci-app-passwall2/po/zh-cn/passwall2.po +++ b/small/luci-app-passwall2/po/zh-cn/passwall2.po @@ -1833,3 +1833,6 @@ msgstr "客户端版本" msgid "Random version will be used if empty." msgstr "如留空,则使用随机版本。" + +msgid "The configured type also applies to the core specified when manually importing nodes." +msgstr "配置的类型同样适用于手动导入节点时所指定的核心程序。" diff --git a/small/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua b/small/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua index af71e71cfc..4507b0bd52 100755 --- a/small/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua +++ b/small/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua @@ -688,8 +688,13 @@ local function processData(szType, content, add_mode, add_from) else userinfo = base64Decode(hostInfo[1]) end - local method = userinfo:sub(1, userinfo:find(":") - 1) - local password = userinfo:sub(userinfo:find(":") + 1, #userinfo) + local method, password + if userinfo:find(":") then + method = userinfo:sub(1, userinfo:find(":") - 1) + password = userinfo:sub(userinfo:find(":") + 1, #userinfo) + else + password = hostInfo[1] --一些链接用明文uuid做密码 + end -- 判断密码是否经过url编码 local function isURLEncodedPassword(pwd) @@ -704,12 +709,20 @@ local function processData(szType, content, add_mode, add_from) if isURLEncodedPassword(password) and decoded then password = decoded end + + local _method = (method or "none"):lower() + method = (_method == "chacha20-poly1305" and "chacha20-ietf-poly1305") or + (_method == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or _method + result.method = method result.password = password - if result.type ~= "Xray" then - result.method = (method:lower() == "chacha20-poly1305" and "chacha20-ietf-poly1305") or - (method:lower() == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or method + if has_xray and (result.type ~= 'Xray' and result.type ~= 'sing-box' and params.type) then + result.type = 'Xray' + result.protocol = 'shadowsocks' + elseif has_singbox and (result.type ~= 'Xray' and result.type ~= 'sing-box' and params.type) then + result.type = 'sing-box' + result.protocol = 'shadowsocks' end if result.plugin then @@ -1115,6 +1128,9 @@ local function processData(szType, content, add_mode, add_from) if not params.type then params.type = "tcp" end params.type = string.lower(params.type) + if ({ xhttp=true, kcp=true, mkcp=true })[params.type] and result.type ~= "Xray" and has_xray then + result.type = "Xray" + end if result.type == "sing-box" and params.type == "raw" then params.type = "tcp" elseif result.type == "Xray" and params.type == "tcp" then @@ -1810,9 +1826,9 @@ local function parse_link(raw, add_mode, add_from, cfgid) else -- ssd 外的格式 if add_mode == "1" then - nodes = split(raw:gsub(" ", "\n"), "\n") + nodes = split(raw, "\n") else - nodes = split(base64Decode(raw):gsub(" ", "\n"), "\n") + nodes = split(base64Decode(raw):gsub("\r\n", "\n"), "\n") end end @@ -1830,7 +1846,8 @@ local function parse_link(raw, add_mode, add_from, cfgid) local link = api.trim(dat[2]:gsub("#.*$", "")) result = processData(dat[1], base64Decode(link), add_mode, add_from) else - result = processData(dat[1], dat[2], add_mode, add_from) + local link = dat[2]:gsub("&", "&"):gsub("%s*#%s*", "#") -- 一些奇葩的链接用"&"当做"&","#"前后带空格 + result = processData(dat[1], link, add_mode, add_from) end end else diff --git a/v2rayn/v2rayN/Directory.Packages.props b/v2rayn/v2rayN/Directory.Packages.props index 71d906f755..283e95a6e8 100644 --- a/v2rayn/v2rayN/Directory.Packages.props +++ b/v2rayn/v2rayN/Directory.Packages.props @@ -20,11 +20,11 @@ - + - \ No newline at end of file + diff --git a/v2rayn/v2rayN/ServiceLib/Handler/AppEvents.cs b/v2rayn/v2rayN/ServiceLib/Handler/AppEvents.cs index 109ee7622f..a4c2917de9 100644 --- a/v2rayn/v2rayN/ServiceLib/Handler/AppEvents.cs +++ b/v2rayn/v2rayN/ServiceLib/Handler/AppEvents.cs @@ -6,16 +6,22 @@ namespace ServiceLib.Handler; public static class AppEvents { public static readonly Subject ProfilesRefreshRequested = new(); + public static readonly Subject SubscriptionsRefreshRequested = new(); + public static readonly Subject ProxiesReloadRequested = new(); + public static readonly Subject DispatcherStatisticsRequested = new(); public static readonly Subject SendSnackMsgRequested = new(); - public static readonly Subject SendMsgViewRequested = new(); public static readonly Subject AppExitRequested = new(); - public static readonly Subject ShutdownRequested = new(); public static readonly Subject AdjustMainLvColWidthRequested = new(); - public static readonly Subject DispatcherStatisticsRequested = new(); + public static readonly Subject SetDefaultServerRequested = new(); + + public static readonly Subject RoutingsMenuRefreshRequested = new(); + public static readonly Subject TestServerRequested = new(); + public static readonly Subject InboundDisplayRequested = new(); + public static readonly Subject SysProxyChangeRequested = new(); } diff --git a/v2rayn/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs b/v2rayn/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs index 343d49dfa4..bf999d12df 100644 --- a/v2rayn/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayn/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs @@ -69,6 +69,8 @@ public class ClashProxiesViewModel : MyReactiveObject SortingSelected = _config.ClashUIItem.ProxiesSorting; RuleModeSelected = (int)_config.ClashUIItem.RuleMode; + #region WhenAnyValue && ReactiveCommand + this.WhenAnyValue( x => x.SelectedGroup, y => y != null && y.Name.IsNotEmpty()) @@ -89,6 +91,17 @@ public class ClashProxiesViewModel : MyReactiveObject y => y == true) .Subscribe(c => { _config.ClashUIItem.ProxiesAutoRefresh = AutoRefresh; }); + #endregion WhenAnyValue && ReactiveCommand + + #region AppEvents + + AppEvents.ProxiesReloadRequested + .AsObservable() + .ObserveOn(RxApp.MainThreadScheduler) + .Subscribe(async _ => await ProxiesReload()); + + #endregion AppEvents + _ = Init(); } diff --git a/v2rayn/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayn/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index 4e9fc9fc36..3492670c50 100644 --- a/v2rayn/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayn/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -2,7 +2,6 @@ using System.Reactive; using System.Reactive.Concurrency; using ReactiveUI; using ReactiveUI.Fody.Helpers; -using Splat; namespace ServiceLib.ViewModels; @@ -240,7 +239,6 @@ public class MainWindowViewModel : MyReactiveObject BlReloadEnabled = true; await Reload(); await AutoHideStartup(); - Locator.Current.GetService()?.RefreshRoutingsMenu(); } #endregion Init @@ -301,7 +299,7 @@ public class MainWindowViewModel : MyReactiveObject private void RefreshSubscriptions() { - Locator.Current.GetService()?.RefreshSubscriptions(); + AppEvents.SubscriptionsRefreshRequested.OnNext(Unit.Default); } #endregion Servers && Groups @@ -433,7 +431,7 @@ public class MainWindowViewModel : MyReactiveObject var ret = await _updateView?.Invoke(EViewAction.OptionSettingWindow, null); if (ret == true) { - Locator.Current.GetService()?.InboundDisplayStatus(); + AppEvents.InboundDisplayRequested.OnNext(Unit.Default); await Reload(); } } @@ -444,7 +442,7 @@ public class MainWindowViewModel : MyReactiveObject if (ret == true) { await ConfigHandler.InitBuiltinRouting(_config); - Locator.Current.GetService()?.RefreshRoutingsMenu(); + AppEvents.RoutingsMenuRefreshRequested.OnNext(Unit.Default); await Reload(); } } @@ -518,9 +516,15 @@ public class MainWindowViewModel : MyReactiveObject await SysProxyHandler.UpdateSysProxy(_config, false); await Task.Delay(1000); }); - Locator.Current.GetService()?.TestServerAvailability(); + AppEvents.TestServerRequested.OnNext(Unit.Default); - RxApp.MainThreadScheduler.Schedule(() => _ = ReloadResult()); + var showClashUI = _config.IsRunningCore(ECoreType.sing_box); + if (showClashUI) + { + AppEvents.ProxiesReloadRequested.OnNext(Unit.Default); + } + + RxApp.MainThreadScheduler.Schedule(() => ReloadResult(showClashUI)); BlReloadEnabled = true; if (_hasNextReloadJob) @@ -530,19 +534,11 @@ public class MainWindowViewModel : MyReactiveObject } } - public async Task ReloadResult() + private void ReloadResult(bool showClashUI) { // BlReloadEnabled = true; - //Locator.Current.GetService()?.ChangeSystemProxyAsync(_config.systemProxyItem.sysProxyType, false); - ShowClashUI = _config.IsRunningCore(ECoreType.sing_box); - if (ShowClashUI) - { - Locator.Current.GetService()?.ProxiesReload(); - } - else - { - TabMainSelectedIndex = 0; - } + ShowClashUI = showClashUI; + TabMainSelectedIndex = showClashUI ? TabMainSelectedIndex : 0; } private async Task LoadCore() @@ -574,7 +570,7 @@ public class MainWindowViewModel : MyReactiveObject { await ConfigHandler.ApplyRegionalPreset(_config, type); await ConfigHandler.InitRouting(_config); - Locator.Current.GetService()?.RefreshRoutingsMenu(); + AppEvents.RoutingsMenuRefreshRequested.OnNext(Unit.Default); await ConfigHandler.SaveConfig(_config); await new UpdateService().UpdateGeoFileAll(_config, UpdateTaskHandler); diff --git a/v2rayn/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs b/v2rayn/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs index 4c0fd2b9f4..87e1d78f03 100644 --- a/v2rayn/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs +++ b/v2rayn/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs @@ -240,11 +240,21 @@ public class ProfilesViewModel : MyReactiveObject .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(async _ => await RefreshServersBiz()); + AppEvents.SubscriptionsRefreshRequested + .AsObservable() + .ObserveOn(RxApp.MainThreadScheduler) + .Subscribe(async _ => await RefreshSubscriptions()); + AppEvents.DispatcherStatisticsRequested .AsObservable() .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(async result => await UpdateStatistics(result)); + AppEvents.SetDefaultServerRequested + .AsObservable() + .ObserveOn(RxApp.MainThreadScheduler) + .Subscribe(async indexId => await SetDefaultServer(indexId)); + #endregion AppEvents _ = Init(); @@ -380,7 +390,7 @@ public class ProfilesViewModel : MyReactiveObject await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null); } - public async Task RefreshSubscriptions() + private async Task RefreshSubscriptions() { SubItems.Clear(); @@ -565,7 +575,7 @@ public class ProfilesViewModel : MyReactiveObject await SetDefaultServer(SelectedProfile.IndexId); } - public async Task SetDefaultServer(string? indexId) + private async Task SetDefaultServer(string? indexId) { if (indexId.IsNullOrEmpty()) { diff --git a/v2rayn/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayn/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index e9ee033e25..ee66351c54 100644 --- a/v2rayn/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayn/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -11,6 +11,9 @@ namespace ServiceLib.ViewModels; public class StatusBarViewModel : MyReactiveObject { + private static readonly Lazy _instance = new(() => new(null)); + public static StatusBarViewModel Instance => _instance.Value; + #region ObservableCollection public IObservableCollection RoutingItems { get; } = new ObservableCollectionExtended(); @@ -209,6 +212,26 @@ public class StatusBarViewModel : MyReactiveObject .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(async result => await UpdateStatistics(result)); + AppEvents.RoutingsMenuRefreshRequested + .AsObservable() + .ObserveOn(RxApp.MainThreadScheduler) + .Subscribe(async _ => await RefreshRoutingsMenu()); + + AppEvents.TestServerRequested + .AsObservable() + .ObserveOn(RxApp.MainThreadScheduler) + .Subscribe(async _ => await TestServerAvailability()); + + AppEvents.InboundDisplayRequested + .AsObservable() + .ObserveOn(RxApp.MainThreadScheduler) + .Subscribe(async _ => await InboundDisplayStatus()); + + AppEvents.SysProxyChangeRequested + .AsObservable() + .ObserveOn(RxApp.MainThreadScheduler) + .Subscribe(async result => await SetListenerType(result)); + #endregion AppEvents _ = Init(); @@ -329,7 +352,7 @@ public class StatusBarViewModel : MyReactiveObject { return; } - Locator.Current.GetService()?.SetDefaultServer(SelectedServer.ID); + AppEvents.SetDefaultServerRequested.OnNext(SelectedServer.ID); } public async Task TestServerAvailability() @@ -364,7 +387,7 @@ public class StatusBarViewModel : MyReactiveObject #region System proxy and Routings - public async Task SetListenerType(ESysProxyType type) + private async Task SetListenerType(ESysProxyType type) { if (_config.SystemProxyItem.SysProxyType == type) { @@ -393,7 +416,7 @@ public class StatusBarViewModel : MyReactiveObject } } - public async Task RefreshRoutingsMenu() + private async Task RefreshRoutingsMenu() { RoutingItems.Clear(); @@ -501,7 +524,7 @@ public class StatusBarViewModel : MyReactiveObject #region UI - public async Task InboundDisplayStatus() + private async Task InboundDisplayStatus() { StringBuilder sb = new(); sb.Append($"[{EInboundProtocol.mixed}:{AppManager.Instance.GetLocalPort(EInboundProtocol.socks)}"); diff --git a/v2rayn/v2rayN/v2rayN.Desktop/App.axaml.cs b/v2rayn/v2rayN/v2rayN.Desktop/App.axaml.cs index aa357ca47f..515354d516 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/App.axaml.cs +++ b/v2rayn/v2rayN/v2rayN.Desktop/App.axaml.cs @@ -16,9 +16,7 @@ public partial class App : Application AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; - var ViewModel = new StatusBarViewModel(null); - Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(StatusBarViewModel)); - DataContext = ViewModel; + DataContext = StatusBarViewModel.Instance; } public override void OnFrameworkInitializationCompleted() diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs b/v2rayn/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs index 754dd2a16b..c8e7aeba65 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs +++ b/v2rayn/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs @@ -3,7 +3,6 @@ using Avalonia.Input; using Avalonia.ReactiveUI; using DynamicData; using ReactiveUI; -using Splat; namespace v2rayN.Desktop.Views; @@ -13,7 +12,6 @@ public partial class ClashProxiesView : ReactiveUserControl ViewModel, typeof(ClashProxiesViewModel)); lstProxyDetails.DoubleTapped += LstProxyDetails_DoubleTapped; this.KeyDown += ClashProxiesView_KeyDown; diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayn/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index d72c37a73a..eb884e4be9 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayn/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -20,7 +20,7 @@ namespace v2rayN.Desktop.Views; public partial class MainWindow : WindowBase { private static Config _config; - private WindowNotificationManager? _manager; + private readonly WindowNotificationManager? _manager; private CheckUpdateView? _checkUpdateView; private BackupAndRestoreView? _backupAndRestoreView; private bool _blCloseByUser = false; @@ -259,7 +259,7 @@ public partial class MainWindow : WindowBase case EGlobalHotkey.SystemProxySet: case EGlobalHotkey.SystemProxyUnchanged: case EGlobalHotkey.SystemProxyPac: - Locator.Current.GetService()?.SetListenerType((ESysProxyType)((int)e - 1)); + AppEvents.SysProxyChangeRequested.OnNext((ESysProxyType)((int)e - 1)); break; } } diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs b/v2rayn/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs index 5bade399e2..8876385174 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs +++ b/v2rayn/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs @@ -8,7 +8,6 @@ using Avalonia.Threading; using DialogHostAvalonia; using MsBox.Avalonia.Enums; using ReactiveUI; -using Splat; using v2rayN.Desktop.Common; namespace v2rayN.Desktop.Views; @@ -48,7 +47,6 @@ public partial class ProfilesView : ReactiveUserControl //} ViewModel = new ProfilesViewModel(UpdateViewHandler); - Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(ProfilesViewModel)); this.WhenActivated(disposables => { diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs b/v2rayn/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs index 3eb08f9633..976c156d7f 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs +++ b/v2rayn/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs @@ -6,7 +6,6 @@ using Avalonia.ReactiveUI; using Avalonia.Threading; using DialogHostAvalonia; using ReactiveUI; -using Splat; using v2rayN.Desktop.Common; namespace v2rayN.Desktop.Views; @@ -20,9 +19,8 @@ public partial class StatusBarView : ReactiveUserControl InitializeComponent(); _config = AppManager.Instance.Config; - //ViewModel = new StatusBarViewModel(UpdateViewHandler); - //Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(StatusBarViewModel)); - ViewModel = Locator.Current.GetService(); + + ViewModel = StatusBarViewModel.Instance; ViewModel?.InitUpdateView(UpdateViewHandler); txtRunningServerDisplay.Tapped += TxtRunningServerDisplay_Tapped; diff --git a/v2rayn/v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs b/v2rayn/v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs index eff95de940..23943da190 100644 --- a/v2rayn/v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs +++ b/v2rayn/v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs @@ -1,7 +1,6 @@ using System.Reactive.Disposables; using System.Windows.Input; using ReactiveUI; -using Splat; namespace v2rayN.Views; @@ -14,7 +13,6 @@ public partial class ClashProxiesView { InitializeComponent(); ViewModel = new ClashProxiesViewModel(UpdateViewHandler); - Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(ClashProxiesViewModel)); lstProxyDetails.PreviewMouseDoubleClick += lstProxyDetails_PreviewMouseDoubleClick; this.WhenActivated(disposables => diff --git a/v2rayn/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayn/v2rayN/v2rayN/Views/MainWindow.xaml.cs index a804775ecc..28073be80b 100644 --- a/v2rayn/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayn/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -249,7 +249,7 @@ public partial class MainWindow case EGlobalHotkey.SystemProxySet: case EGlobalHotkey.SystemProxyUnchanged: case EGlobalHotkey.SystemProxyPac: - Locator.Current.GetService()?.SetListenerType((ESysProxyType)((int)e - 1)); + AppEvents.SysProxyChangeRequested.OnNext((ESysProxyType)((int)e - 1)); break; } } @@ -287,11 +287,7 @@ public partial class MainWindow var clipboardData = WindowsUtils.GetClipboardData(); if (clipboardData.IsNotEmpty()) { - var service = Locator.Current.GetService(); - if (service != null) - { - _ = service.AddServerViaClipboardAsync(clipboardData); - } + ViewModel?.AddServerViaClipboardAsync(clipboardData); } break; diff --git a/v2rayn/v2rayN/v2rayN/Views/ProfilesView.xaml.cs b/v2rayn/v2rayN/v2rayN/Views/ProfilesView.xaml.cs index 8ef236aba7..3c46966cd5 100644 --- a/v2rayn/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayn/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -8,7 +8,6 @@ using System.Windows.Media; using System.Windows.Threading; using MaterialDesignThemes.Wpf; using ReactiveUI; -using Splat; using v2rayN.Base; using Point = System.Windows.Point; @@ -42,7 +41,6 @@ public partial class ProfilesView } ViewModel = new ProfilesViewModel(UpdateViewHandler); - Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(ProfilesViewModel)); this.WhenActivated(disposables => { diff --git a/v2rayn/v2rayN/v2rayN/Views/StatusBarView.xaml.cs b/v2rayn/v2rayN/v2rayN/Views/StatusBarView.xaml.cs index 8a3a5df40a..1d80a694c9 100644 --- a/v2rayn/v2rayN/v2rayN/Views/StatusBarView.xaml.cs +++ b/v2rayn/v2rayN/v2rayN/Views/StatusBarView.xaml.cs @@ -3,7 +3,6 @@ using System.Windows; using System.Windows.Input; using System.Windows.Threading; using ReactiveUI; -using Splat; using v2rayN.Manager; namespace v2rayN.Views; @@ -16,8 +15,8 @@ public partial class StatusBarView { InitializeComponent(); _config = AppManager.Instance.Config; - ViewModel = new StatusBarViewModel(UpdateViewHandler); - Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(StatusBarViewModel)); + ViewModel = StatusBarViewModel.Instance; + ViewModel?.InitUpdateView(UpdateViewHandler); menuExit.Click += menuExit_Click; txtRunningServerDisplay.PreviewMouseDown += txtRunningInfoDisplay_MouseDoubleClick; diff --git a/yt-dlp/.github/workflows/release.yml b/yt-dlp/.github/workflows/release.yml index 103dc0b203..52c61808fc 100644 --- a/yt-dlp/.github/workflows/release.yml +++ b/yt-dlp/.github/workflows/release.yml @@ -272,7 +272,7 @@ jobs: printf '\n\n%s\n\n%s%s\n\n---\n' \ "#### A description of the various files is in the [README](https://github.com/${REPOSITORY}#release-files)" \ "The PyInstaller-bundled executables are subject to the licenses described in " \ - "[THIRD_PARTY_LICENSES.txt](https://github.com/${BASE_REPO}/blob/master/THIRD_PARTY_LICENSES.txt)" >> ./RELEASE_NOTES + "[THIRD_PARTY_LICENSES.txt](https://github.com/${BASE_REPO}/blob/${HEAD_SHA}/THIRD_PARTY_LICENSES.txt)" >> ./RELEASE_NOTES python ./devscripts/make_changelog.py -vv --collapsible >> ./RELEASE_NOTES printf '%s\n\n' '**This is a pre-release build**' >> ./PRERELEASE_NOTES cat ./RELEASE_NOTES >> ./PRERELEASE_NOTES diff --git a/yt-dlp/.github/workflows/test-workflows.yml b/yt-dlp/.github/workflows/test-workflows.yml index c07e01d7af..684ec6cc44 100644 --- a/yt-dlp/.github/workflows/test-workflows.yml +++ b/yt-dlp/.github/workflows/test-workflows.yml @@ -49,4 +49,4 @@ jobs: shellcheck bundle/docker/linux/*.sh - name: Test GHA devscripts run: | - pytest -Werror --tb=short devscripts/setup_variables_tests.py + pytest -Werror --tb=short --color=yes devscripts/setup_variables_tests.py diff --git a/yt-dlp/CONTRIBUTORS b/yt-dlp/CONTRIBUTORS index d0f475d1c1..9064ebd7f8 100644 --- a/yt-dlp/CONTRIBUTORS +++ b/yt-dlp/CONTRIBUTORS @@ -808,3 +808,6 @@ Randalix runarmod gitchasing zakaryan2004 +cdce8p +nicolaasjan +willsmillie diff --git a/yt-dlp/Changelog.md b/yt-dlp/Changelog.md index 120516ab2a..ed61c3bc3c 100644 --- a/yt-dlp/Changelog.md +++ b/yt-dlp/Changelog.md @@ -4,6 +4,63 @@ # To create a release, dispatch the https://github.com/yt-dlp/yt-dlp/actions/workflows/release.yml workflow on master --> +### 2025.09.23 + +#### Important changes +- **Several options have been deprecated** +In order to simplify the codebase and reduce maintenance burden, various options have been deprecated. Please remove them from your commands/configurations. [Read more](https://github.com/yt-dlp/yt-dlp/issues/14198) + +#### Core changes +- **compat**: [Add `compat_datetime_from_timestamp`](https://github.com/yt-dlp/yt-dlp/commit/6a763a55d8a93b2a964ecf7699248ad342485412) ([#11902](https://github.com/yt-dlp/yt-dlp/issues/11902)) by [pzhlkj6612](https://github.com/pzhlkj6612), [seproDev](https://github.com/seproDev) +- **utils** + - `mimetype2ext`: [Recognize `vnd.dlna.mpeg-tts`](https://github.com/yt-dlp/yt-dlp/commit/98b6b0d339130e955f9d45ce67c0357c633c1627) ([#14388](https://github.com/yt-dlp/yt-dlp/issues/14388)) by [seproDev](https://github.com/seproDev) + - `random_user_agent`: [Bump versions](https://github.com/yt-dlp/yt-dlp/commit/f3829463c728a5b5e62b3fc157e71c99b26edac7) ([#14317](https://github.com/yt-dlp/yt-dlp/issues/14317)) by [seproDev](https://github.com/seproDev) + +#### Extractor changes +- **10play**: [Fix extractor](https://github.com/yt-dlp/yt-dlp/commit/067062bb87ac057e453ce9efdac7ca117a6a7da0) ([#14242](https://github.com/yt-dlp/yt-dlp/issues/14242)) by [Sipherdrakon](https://github.com/Sipherdrakon) +- **applepodcast**: [Fix extractor](https://github.com/yt-dlp/yt-dlp/commit/b2c01d0498653e0239c7226c5a7fcb614dd4dbc8) ([#14372](https://github.com/yt-dlp/yt-dlp/issues/14372)) by [seproDev](https://github.com/seproDev) +- **loco**: [Fix extractor](https://github.com/yt-dlp/yt-dlp/commit/f5cb721185e8725cf4eb4080e86aa9aa73ef25b3) ([#14256](https://github.com/yt-dlp/yt-dlp/issues/14256)) by [seproDev](https://github.com/seproDev) +- **mitele**: [Remove extractor](https://github.com/yt-dlp/yt-dlp/commit/820c6e244571557fcfc127d4b3680e2d07c04dca) ([#14348](https://github.com/yt-dlp/yt-dlp/issues/14348)) by [bashonly](https://github.com/bashonly) +- **newspicks**: [Warn when only preview is available](https://github.com/yt-dlp/yt-dlp/commit/9def9a4b0e958285e055eb350e5dd43b5c423336) ([#14197](https://github.com/yt-dlp/yt-dlp/issues/14197)) by [doe1080](https://github.com/doe1080) +- **onsen**: [Add extractor](https://github.com/yt-dlp/yt-dlp/commit/17bfaa53edf5c52fce73cf0cef4592f929c2462d) ([#10971](https://github.com/yt-dlp/yt-dlp/issues/10971)) by [doe1080](https://github.com/doe1080) +- **pixivsketch**: [Remove extractors](https://github.com/yt-dlp/yt-dlp/commit/3d9a88bd8ef149d781c7e569e48e61551eda395e) ([#14196](https://github.com/yt-dlp/yt-dlp/issues/14196)) by [doe1080](https://github.com/doe1080) +- **smotrim**: [Rework extractors](https://github.com/yt-dlp/yt-dlp/commit/8cb037c0b06c2815080f87d61ea2e95c412785fc) ([#14200](https://github.com/yt-dlp/yt-dlp/issues/14200)) by [doe1080](https://github.com/doe1080), [swayll](https://github.com/swayll) +- **telecinco**: [Support browser impersonation](https://github.com/yt-dlp/yt-dlp/commit/e123a48f1155703d8709a4221a42bd45c0a2b3ce) ([#14351](https://github.com/yt-dlp/yt-dlp/issues/14351)) by [bashonly](https://github.com/bashonly) +- **tiktok**: live: [Fix room ID extraction](https://github.com/yt-dlp/yt-dlp/commit/5c1abcdc49b9d23e1dcb77b95d063cf2bf93e352) ([#14287](https://github.com/yt-dlp/yt-dlp/issues/14287)) by [bashonly](https://github.com/bashonly) +- **ttinglive**: [Adapt FlexTV extractor to new domain](https://github.com/yt-dlp/yt-dlp/commit/4bc19adc8798e7564513898cf34adc432c6c5709) ([#14375](https://github.com/yt-dlp/yt-dlp/issues/14375)) by [seproDev](https://github.com/seproDev) +- **tunein**: [Fix extractors](https://github.com/yt-dlp/yt-dlp/commit/7d9e48b22a780c2e8d2d2d68940d49fd2029ab70) ([#13981](https://github.com/yt-dlp/yt-dlp/issues/13981)) by [doe1080](https://github.com/doe1080) +- **twitch**: clips: [Fix extractor](https://github.com/yt-dlp/yt-dlp/commit/f8750504c2f71b54586fb857d60dce4e354a13ea) ([#14397](https://github.com/yt-dlp/yt-dlp/issues/14397)) by [seproDev](https://github.com/seproDev) +- **vimeo**: [Fix login error handling](https://github.com/yt-dlp/yt-dlp/commit/679587dac7cd011a1472255e1f06efb017ba91b6) ([#14280](https://github.com/yt-dlp/yt-dlp/issues/14280)) by [bashonly](https://github.com/bashonly) +- **vk** + - [Support vksport URLs](https://github.com/yt-dlp/yt-dlp/commit/b81e9272dce5844e8fba371cb4b4fd95ad3ed819) ([#14341](https://github.com/yt-dlp/yt-dlp/issues/14341)) by [seproDev](https://github.com/seproDev) + - uservideos: [Support alternate URL format](https://github.com/yt-dlp/yt-dlp/commit/bf5d18016b03a3f2fd5d3494d9efe85d3f8beeac) ([#14376](https://github.com/yt-dlp/yt-dlp/issues/14376)) by [seproDev](https://github.com/seproDev) +- **xhamster**: [Fix extractor](https://github.com/yt-dlp/yt-dlp/commit/a1c98226a4e869a34cc764a9dcf7a4558516308e) ([#14286](https://github.com/yt-dlp/yt-dlp/issues/14286)) by [nicolaasjan](https://github.com/nicolaasjan), [willsmillie](https://github.com/willsmillie) (With fixes in [677997d](https://github.com/yt-dlp/yt-dlp/commit/677997d84eaec0037397f7d935386daa3025b004) by [arand](https://github.com/arand), [thegymguy](https://github.com/thegymguy)) +- **youtube**: [Force player `0004de42`](https://github.com/yt-dlp/yt-dlp/commit/7f5d9f8543d19590eeec9473d54fa00151afa78a) ([#14398](https://github.com/yt-dlp/yt-dlp/issues/14398)) by [seproDev](https://github.com/seproDev) + +#### Misc. changes +- **build** + - [Fix cache warmer](https://github.com/yt-dlp/yt-dlp/commit/8597a4331e8535a246d777bb8397bdcab251766c) ([#14261](https://github.com/yt-dlp/yt-dlp/issues/14261)) by [bashonly](https://github.com/bashonly) + - [Post-release workflow cleanup](https://github.com/yt-dlp/yt-dlp/commit/cd94e7004036e0149d7d3fa236c7dd44cf460788) ([#14250](https://github.com/yt-dlp/yt-dlp/issues/14250)) by [bashonly](https://github.com/bashonly) + - [Refactor Linux build jobs](https://github.com/yt-dlp/yt-dlp/commit/e2d37bcc8e84be9ce0f67fc24cb830c13963d10f) ([#14275](https://github.com/yt-dlp/yt-dlp/issues/14275)) by [bashonly](https://github.com/bashonly) + - [Use PyInstaller 6.16 for Windows](https://github.com/yt-dlp/yt-dlp/commit/df4b4e8ccf3385be6d2ad65465a0704c223dfdfb) ([#14318](https://github.com/yt-dlp/yt-dlp/issues/14318)) by [bashonly](https://github.com/bashonly) + - [Use SPDX license identifier](https://github.com/yt-dlp/yt-dlp/commit/48a214bef4bfd5984362d3d24b09dce50ba449ea) ([#14260](https://github.com/yt-dlp/yt-dlp/issues/14260)) by [cdce8p](https://github.com/cdce8p) + - [Use new PyInstaller builds for Windows](https://github.com/yt-dlp/yt-dlp/commit/c8ede5f34d6c95c442b936bb01ecbcb724aefdef) ([#14273](https://github.com/yt-dlp/yt-dlp/issues/14273)) by [bashonly](https://github.com/bashonly) +- **ci** + - [Bump actions/setup-python to v6](https://github.com/yt-dlp/yt-dlp/commit/22ea0688ed6bcdbe4c51401a84239cda3decfc9c) ([#14282](https://github.com/yt-dlp/yt-dlp/issues/14282)) by [bashonly](https://github.com/bashonly) + - [Improve workflow checks](https://github.com/yt-dlp/yt-dlp/commit/ae3923b6b23bc62115be55510d6b5842f7a46b5f) ([#14316](https://github.com/yt-dlp/yt-dlp/issues/14316)) by [bashonly](https://github.com/bashonly) + - [Test and lint workflows](https://github.com/yt-dlp/yt-dlp/commit/7c9b10ebc83907d37f9f65ea9d4bd6f5e3bd1371) ([#14249](https://github.com/yt-dlp/yt-dlp/issues/14249)) by [bashonly](https://github.com/bashonly) + - [Test with Python 3.14](https://github.com/yt-dlp/yt-dlp/commit/83b8409366d0f9554eaeae56394b244dab64a2cb) ([#13468](https://github.com/yt-dlp/yt-dlp/issues/13468)) by [bashonly](https://github.com/bashonly) +- **cleanup** + - [Bump ruff to 0.13.x](https://github.com/yt-dlp/yt-dlp/commit/ba8044685537e8e14adc6826fb4d730856fd2e2b) ([#14293](https://github.com/yt-dlp/yt-dlp/issues/14293)) by [bashonly](https://github.com/bashonly) + - [Deprecate various options](https://github.com/yt-dlp/yt-dlp/commit/08d78996831bd8e1e3c2592d740c3def00bbf548) ([#13821](https://github.com/yt-dlp/yt-dlp/issues/13821)) by [seproDev](https://github.com/seproDev) + - [Remove broken extractors](https://github.com/yt-dlp/yt-dlp/commit/65e90aea29cf3bfc9d1ae3e009fbf9a8db3a23c9) ([#14305](https://github.com/yt-dlp/yt-dlp/issues/14305)) by [bashonly](https://github.com/bashonly) + - [Remove setup.cfg](https://github.com/yt-dlp/yt-dlp/commit/eb4b3a5fc7765a6cd0370ca44ccee0d7d5111dd7) ([#14314](https://github.com/yt-dlp/yt-dlp/issues/14314)) by [seproDev](https://github.com/seproDev) (With fixes in [8ab262c](https://github.com/yt-dlp/yt-dlp/commit/8ab262c66bd3e1d8874fb2d070068ba1f0d48f16) by [bashonly](https://github.com/bashonly)) + - Miscellaneous: [2e81e29](https://github.com/yt-dlp/yt-dlp/commit/2e81e298cdce23afadb06a95836284acb38f7018) by [bashonly](https://github.com/bashonly), [doe1080](https://github.com/doe1080), [seproDev](https://github.com/seproDev) +- **docs** + - [Clarify license of PyInstaller-bundled executables](https://github.com/yt-dlp/yt-dlp/commit/e6e6b512141e66b1b36058966804fe59c02a2b4d) ([#14257](https://github.com/yt-dlp/yt-dlp/issues/14257)) by [seproDev](https://github.com/seproDev) + - [Establish AI/LLM contribution policy](https://github.com/yt-dlp/yt-dlp/commit/8821682f15af59047bc1f92724ef8a9ba30d6f7e) ([#14194](https://github.com/yt-dlp/yt-dlp/issues/14194)) by [bashonly](https://github.com/bashonly), [seproDev](https://github.com/seproDev) +- **test**: utils: [Fix `sanitize_path` test for Windows CPython 3.11](https://github.com/yt-dlp/yt-dlp/commit/a183837ec8bb5e28fe6eb3a9d77ea2d0d7a106bd) ([#13878](https://github.com/yt-dlp/yt-dlp/issues/13878)) by [Grub4K](https://github.com/Grub4K) + ### 2025.09.05 #### Core changes diff --git a/yt-dlp/README.md b/yt-dlp/README.md index 8cd9d892f6..f6ae18d85a 100644 --- a/yt-dlp/README.md +++ b/yt-dlp/README.md @@ -320,7 +320,6 @@ Tip: Use `CTRL`+`F` (or `Command`+`F`) to search by keywords playlist (default) --abort-on-error Abort downloading of further videos if an error occurs (Alias: --no-ignore-errors) - --dump-user-agent Display the current user-agent and exit --list-extractors List all supported extractors and exit --extractor-descriptions Output descriptions of all supported extractors and exit @@ -571,8 +570,6 @@ Tip: Use `CTRL`+`F` (or `Command`+`F`) to search by keywords --playlist-random and --playlist-reverse --no-lazy-playlist Process videos in the playlist only after the entire playlist is parsed (default) - --xattr-set-filesize Set file xattribute ytdl.filesize with - expected file size --hls-use-mpegts Use the mpegts container for HLS videos; allowing some players to play the video while downloading, and reducing the chance @@ -596,9 +593,9 @@ Tip: Use `CTRL`+`F` (or `Command`+`F`) to search by keywords use (optionally) prefixed by the protocols (http, ftp, m3u8, dash, rstp, rtmp, mms) to use it for. Currently supports native, - aria2c, avconv, axel, curl, ffmpeg, httpie, - wget. You can use this option multiple times - to set different downloaders for different + aria2c, axel, curl, ffmpeg, httpie, wget. + You can use this option multiple times to + set different downloaders for different protocols. E.g. --downloader aria2c --downloader "dash,m3u8:native" will use aria2c for http/ftp downloads, and the @@ -1821,7 +1818,8 @@ The following extractors use this feature: * `player_skip`: Skip some network requests that are generally needed for robust extraction. One or more of `configs` (skip client configs), `webpage` (skip initial webpage), `js` (skip js player), `initial_data` (skip initial data/next ep request). While these options can help reduce the number of requests needed or avoid some rate-limiting, they could cause issues such as missing formats or metadata. See [#860](https://github.com/yt-dlp/yt-dlp/pull/860) and [#12826](https://github.com/yt-dlp/yt-dlp/issues/12826) for more details * `webpage_skip`: Skip extraction of embedded webpage data. One or both of `player_response`, `initial_data`. These options are for testing purposes and don't skip any network requests * `player_params`: YouTube player parameters to use for player requests. Will overwrite any default ones set by yt-dlp. -* `player_js_variant`: The player javascript variant to use for signature and nsig deciphering. The known variants are: `main`, `tce`, `tv`, `tv_es6`, `phone`, `tablet`. The default is `main`, and the others are for debugging purposes. You can use `actual` to go with what is prescribed by the site +* `player_js_variant`: The player javascript variant to use for n/sig deciphering. The known variants are: `main`, `tcc`, `tce`, `es5`, `es6`, `tv`, `tv_es6`, `phone`, `tablet`. The default is `main`, and the others are for debugging purposes. You can use `actual` to go with what is prescribed by the site +* `player_js_version`: The player javascript version to use for n/sig deciphering, in the format of `signature_timestamp@hash`. Currently, the default is to force `20348@0004de42`. You can use `actual` to go with what is prescribed by the site * `comment_sort`: `top` or `new` (default) - choose comment sorting mode (on YouTube's side) * `max_comments`: Limit the amount of comments to gather. Comma-separated list of integers representing `max-comments,max-parents,max-replies,max-replies-per-thread`. Default is `all,all,all,all` * E.g. `all,all,1000,10` will get a maximum of 1000 replies total, with up to 10 replies per thread. `1000,all,100` will get a maximum of 1000 comments, with a maximum of 100 replies total @@ -2216,7 +2214,6 @@ with yt_dlp.YoutubeDL(ydl_opts) as ydl: * Fix for [n-sig based throttling](https://github.com/ytdl-org/youtube-dl/issues/29326) **\*** * Download livestreams from the start using `--live-from-start` (*experimental*) * Channel URLs download all uploads of the channel, including shorts and live - * Support for [logging in with OAuth](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#logging-in-with-oauth) * **Cookies from browser**: Cookies can be automatically extracted from all major web browsers using `--cookies-from-browser BROWSER[+KEYRING][:PROFILE][::CONTAINER]` @@ -2360,7 +2357,7 @@ While these options still work, their use is not recommended since there are oth --hls-prefer-native --downloader "m3u8:native" --hls-prefer-ffmpeg --downloader "m3u8:ffmpeg" --list-formats-old --compat-options list-formats (Alias: --no-list-formats-as-table) - --list-formats-as-table --compat-options -list-formats [Default] (Alias: --no-list-formats-old) + --list-formats-as-table --compat-options -list-formats [Default] --geo-bypass --xff "default" --no-geo-bypass --xff "never" --geo-bypass-country CODE --xff CODE diff --git a/yt-dlp/devscripts/changelog_override.json b/yt-dlp/devscripts/changelog_override.json index f551b44e9c..618e7fe6fe 100644 --- a/yt-dlp/devscripts/changelog_override.json +++ b/yt-dlp/devscripts/changelog_override.json @@ -293,5 +293,10 @@ "action": "add", "when": "c76ce28e06c816eb5b261dfb6aff6e69dd9b7382", "short": "[priority] **linux_armv7l_exe builds are being discontinued**\nThis release's `yt-dlp_linux_armv7l` binary could be the last one. [Read more](https://github.com/yt-dlp/yt-dlp/issues/13976)" + }, + { + "action": "add", + "when": "08d78996831bd8e1e3c2592d740c3def00bbf548", + "short": "[priority] **Several options have been deprecated**\nIn order to simplify the codebase and reduce maintenance burden, various options have been deprecated. Please remove them from your commands/configurations. [Read more](https://github.com/yt-dlp/yt-dlp/issues/14198)" } ] diff --git a/yt-dlp/supportedsites.md b/yt-dlp/supportedsites.md index 3937134378..513fd93989 100644 --- a/yt-dlp/supportedsites.md +++ b/yt-dlp/supportedsites.md @@ -20,7 +20,6 @@ The only reliable way to check if a site is supported is to try it. - **3sat** - **4tube** - **56.com** - - **6play** - **7plus** - **8tracks** - **9c9media** @@ -299,7 +298,6 @@ The only reliable way to check if a site is supported is to try it. - **cpac** - **cpac:playlist** - **Cracked** - - **Crackle** - **Craftsy** - **CrooksAndLiars** - **CrowdBunker** @@ -314,8 +312,6 @@ The only reliable way to check if a site is supported is to try it. - **curiositystream**: [*curiositystream*](## "netrc machine") - **curiositystream:collections**: [*curiositystream*](## "netrc machine") - **curiositystream:series**: [*curiositystream*](## "netrc machine") - - **cwtv** - - **cwtv:movie** - **Cybrary**: [*cybrary*](## "netrc machine") - **CybraryCourse**: [*cybrary*](## "netrc machine") - **DacastPlaylist** @@ -450,7 +446,6 @@ The only reliable way to check if a site is supported is to try it. - **Filmweb** - **FiveThirtyEight** - **FiveTV** - - **FlexTV** - **Flickr** - **Floatplane** - **FloatplaneChannel** @@ -798,7 +793,6 @@ The only reliable way to check if a site is supported is to try it. - **mirrativ** - **mirrativ:user** - **MirrorCoUK** - - **MiTele**: mitele.es - **mixch** - **mixch:archive** - **mixch:movie** @@ -1009,6 +1003,7 @@ The only reliable way to check if a site is supported is to try it. - **onet.tv:channel** - **OnetMVP** - **OnionStudios** + - **onsen**: [*onsen*](## "netrc machine") インターネットラジオステーション<音泉> - **Opencast** - **OpencastPlaylist** - **openrec** @@ -1033,8 +1028,6 @@ The only reliable way to check if a site is supported is to try it. - **Panopto** - **PanoptoList** - **PanoptoPlaylist** - - **ParamountPlus** - - **ParamountPlusSeries** - **ParamountPressExpress** - **Parler**: Posts on parler.com - **parliamentlive.tv**: UK parliament videos @@ -1069,8 +1062,6 @@ The only reliable way to check if a site is supported is to try it. - **PinterestCollection** - **PiramideTV** - **PiramideTVChannel** - - **pixiv:sketch** - - **pixiv:​sketch:user** - **PlanetMarathi** - **Platzi**: [*platzi*](## "netrc machine") - **PlatziCourse**: [*platzi*](## "netrc machine") @@ -1257,7 +1248,6 @@ The only reliable way to check if a site is supported is to try it. - **rutube:person**: Rutube person videos - **rutube:playlist**: Rutube playlists - **rutube:tags**: Rutube tags - - **RUTV**: RUTV.RU - **Ruutu**: (**Currently broken**) - **Ruv** - **ruv.is:spila** @@ -1332,7 +1322,10 @@ The only reliable way to check if a site is supported is to try it. - **Slideshare** - **SlidesLive** - **Slutload** - - **Smotrim** + - **smotrim** + - **smotrim:audio** + - **smotrim:live** + - **smotrim:playlist** - **SnapchatSpotlight** - **Snotr** - **SoftWhiteUnderbelly**: [*softwhiteunderbelly*](## "netrc machine") @@ -1370,8 +1363,6 @@ The only reliable way to check if a site is supported is to try it. - **Sport5** - **SportBox**: (**Currently broken**) - **SportDeutschland** - - **spotify**: Spotify episodes (**Currently broken**) - - **spotify:show**: Spotify shows (**Currently broken**) - **Spreaker** - **SpreakerShow** - **SpringboardPlatform** @@ -1510,15 +1501,17 @@ The only reliable way to check if a site is supported is to try it. - **TrueID** - **TruNews** - **Truth** + - **ttinglive**: 띵라이브 (formerly FlexTV) - **Tube8**: (**Currently broken**) - **TubeTuGraz**: [*tubetugraz*](## "netrc machine") tube.tugraz.at - **TubeTuGrazSeries**: [*tubetugraz*](## "netrc machine") - **tubitv**: [*tubitv*](## "netrc machine") - **tubitv:series** - **Tumblr**: [*tumblr*](## "netrc machine") - - **TuneInPodcast** - - **TuneInPodcastEpisode** - - **TuneInStation** + - **tunein:embed** + - **tunein:podcast** + - **tunein:​podcast:program** + - **tunein:station** - **tv.dfb.de** - **TV2** - **TV2Article** @@ -1600,7 +1593,6 @@ The only reliable way to check if a site is supported is to try it. - **Varzesh3**: (**Currently broken**) - **Vbox7** - **Veo** - - **Vesti**: Вести.Ru (**Currently broken**) - **Vevo** - **VevoPlaylist** - **VGTV**: VGTV, BTTV, FTV, Aftenposten and Aftonbladet @@ -1748,7 +1740,6 @@ The only reliable way to check if a site is supported is to try it. - **wykop:​dig:comment** - **wykop:post** - **wykop:​post:comment** - - **Xanimu** - **XboxClips** - **XHamster** - **XHamsterEmbed** diff --git a/yt-dlp/yt_dlp/extractor/tenplay.py b/yt-dlp/yt_dlp/extractor/tenplay.py index 9dc1de6b78..bf5dddde42 100644 --- a/yt-dlp/yt_dlp/extractor/tenplay.py +++ b/yt-dlp/yt_dlp/extractor/tenplay.py @@ -109,7 +109,7 @@ class TenPlayIE(InfoExtractor): video_data = self._download_json( f'https://vod.ten.com.au/api/videos/bcquery?command=find_videos_by_id&video_id={data["altId"]}', content_id, 'Downloading video JSON') - # Dash URL 403s, changing the m3u8 format works + # Dash URL 404s, changing the m3u8 format works m3u8_url = self._request_webpage( HEADRequest(update_url_query(video_data['items'][0]['dashManifestUrl'], { 'manifest': 'm3u', diff --git a/yt-dlp/yt_dlp/extractor/twitch.py b/yt-dlp/yt_dlp/extractor/twitch.py index 1b60202045..503d0a7a65 100644 --- a/yt-dlp/yt_dlp/extractor/twitch.py +++ b/yt-dlp/yt_dlp/extractor/twitch.py @@ -44,7 +44,7 @@ class TwitchBaseIE(InfoExtractor): 'CollectionSideBar': '27111f1b382effad0b6def325caef1909c733fe6a4fbabf54f8d491ef2cf2f14', 'FilterableVideoTower_Videos': 'a937f1d22e269e39a03b509f65a7490f9fc247d7f83d6ac1421523e3b68042cb', 'ClipsCards__User': 'b73ad2bfaecfd30a9e6c28fada15bd97032c83ec77a0440766a56fe0bd632777', - 'ShareClipRenderStatus': 'f130048a462a0ac86bb54d653c968c514e9ab9ca94db52368c1179e97b0f16eb', + 'ShareClipRenderStatus': 'e0a46b287d760c6890a39d1ccd736af5ec9479a267d02c710e9ac33326b651d2', 'ChannelCollectionsContent': '447aec6a0cc1e8d0a8d7732d47eb0762c336a2294fdb009e9c9d854e49d484b9', 'StreamMetadata': 'a647c2a13599e5991e175155f798ca7f1ecddde73f7f341f39009c14dbf59962', 'ComscoreStreamingQuery': 'e1edae8122517d013405f237ffcc124515dc6ded82480a88daef69c83b53ac01', @@ -1153,8 +1153,8 @@ class TwitchClipsIE(TwitchBaseIE): 'channel_id': '25163635', 'channel_is_verified': False, 'channel_follower_count': int, - 'uploader': 'EA', - 'uploader_id': '25163635', + 'uploader': 'stereotype_', + 'uploader_id': '43566419', }, }, { 'url': 'https://www.twitch.tv/xqc/clip/CulturedAmazingKuduDatSheffy-TiZ_-ixAGYR3y2Uy', @@ -1174,8 +1174,8 @@ class TwitchClipsIE(TwitchBaseIE): 'channel_id': '71092938', 'channel_is_verified': True, 'channel_follower_count': int, - 'uploader': 'xQc', - 'uploader_id': '71092938', + 'uploader': 'okSTFUdude', + 'uploader_id': '744085721', 'categories': ['Just Chatting'], }, }, { diff --git a/yt-dlp/yt_dlp/extractor/txxx.py b/yt-dlp/yt_dlp/extractor/txxx.py index 488c13b1ac..c0b7161bd2 100644 --- a/yt-dlp/yt_dlp/extractor/txxx.py +++ b/yt-dlp/yt_dlp/extractor/txxx.py @@ -343,22 +343,6 @@ class TxxxIE(InfoExtractor): 'thumbnail': 'https://tn.voyeurhit.com/contents/videos_sources/332000/332875/screenshots/1.jpg', }, }] - _WEBPAGE_TESTS = [{ - 'url': 'https://pornzog.com/video/9125519/michelle-malone-dreamgirls-wild-wet-3/', - 'info_dict': { - 'id': '5119660', - 'display_id': '5119660', - 'ext': 'mp4', - 'title': 'Michelle Malone - Dreamgirls - Wild Wet 3', - 'uploader': 'FallenAngel12', - 'duration': 402, - 'view_count': int, - 'like_count': int, - 'dislike_count': int, - 'age_limit': 18, - 'thumbnail': 'https://hctn.nv7s.com/contents/videos_sources/5119000/5119660/screenshots/1.jpg', - }, - }] def _call_api(self, url, video_id, fatal=False, **kwargs): content = self._download_json(url, video_id, fatal=fatal, **kwargs) diff --git a/yt-dlp/yt_dlp/extractor/youtube/_video.py b/yt-dlp/yt_dlp/extractor/youtube/_video.py index 8c5486c4c2..6dba724cee 100644 --- a/yt-dlp/yt_dlp/extractor/youtube/_video.py +++ b/yt-dlp/yt_dlp/extractor/youtube/_video.py @@ -2015,16 +2015,28 @@ class YoutubeIE(YoutubeBaseInfoExtractor): time.sleep(max(0, FETCH_SPAN + fetch_time - time.time())) + def _get_player_js_version(self): + player_js_version = self._configuration_arg('player_js_version', [''])[0] or '20348@0004de42' + if player_js_version == 'actual': + return None, None + if not re.fullmatch(r'[0-9]{5,}@[0-9a-f]{8,}', player_js_version): + self.report_warning( + f'Invalid player JS version "{player_js_version}" specified. ' + f'It should be "actual" or in the format of STS@HASH', only_once=True) + return None, None + return player_js_version.split('@') + def _extract_player_url(self, *ytcfgs, webpage=None): player_url = traverse_obj( ytcfgs, (..., 'PLAYER_JS_URL'), (..., 'WEB_PLAYER_CONTEXT_CONFIGS', ..., 'jsUrl'), get_all=False, expected_type=str) if not player_url: return + player_id_override = self._get_player_js_version()[1] requested_js_variant = self._configuration_arg('player_js_variant', [''])[0] or 'main' if requested_js_variant in self._PLAYER_JS_VARIANT_MAP: - player_id = self._extract_player_info(player_url) + player_id = player_id_override or self._extract_player_info(player_url) original_url = player_url player_url = f'/s/player/{player_id}/{self._PLAYER_JS_VARIANT_MAP[requested_js_variant]}' if original_url != player_url: @@ -2387,6 +2399,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor): Extract signatureTimestamp (sts) Required to tell API what sig/player version is in use. """ + player_sts_override = self._get_player_js_version()[0] + if player_sts_override: + return int(player_sts_override) + if sts := traverse_obj(ytcfg, ('STS', {int_or_none})): return sts diff --git a/yt-dlp/yt_dlp/version.py b/yt-dlp/yt_dlp/version.py index 624271cb73..83f9018e3b 100644 --- a/yt-dlp/yt_dlp/version.py +++ b/yt-dlp/yt_dlp/version.py @@ -1,8 +1,8 @@ # Autogenerated by devscripts/update-version.py -__version__ = '2025.09.05' +__version__ = '2025.09.23' -RELEASE_GIT_HEAD = '50136eeeb3767289b236f140b759f23b39b00888' +RELEASE_GIT_HEAD = '2e81e298cdce23afadb06a95836284acb38f7018' VARIANT = None @@ -12,4 +12,4 @@ CHANNEL = 'stable' ORIGIN = 'yt-dlp/yt-dlp' -_pkg_version = '2025.09.05' +_pkg_version = '2025.09.23'