mirror of
https://github.com/bolucat/Archive.git
synced 2025-09-26 20:21:35 +08:00
Update On Sat Jun 14 20:35:16 CEST 2025
This commit is contained in:
1
.github/update.log
vendored
1
.github/update.log
vendored
@@ -1027,3 +1027,4 @@ Update On Mon Jun 9 20:37:42 CEST 2025
|
||||
Update On Tue Jun 10 20:37:52 CEST 2025
|
||||
Update On Wed Jun 11 20:39:57 CEST 2025
|
||||
Update On Fri Jun 13 20:38:23 CEST 2025
|
||||
Update On Sat Jun 14 20:35:08 CEST 2025
|
||||
|
@@ -4,6 +4,8 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/metacubex/mihomo/adapter/outboundgroup"
|
||||
@@ -150,6 +152,9 @@ func proxyGroupsDagSort(groupsConfig []map[string]any) error {
|
||||
}
|
||||
|
||||
func verifyIP6() bool {
|
||||
if skip, _ := strconv.ParseBool(os.Getenv("SKIP_SYSTEM_IPV6_CHECK")); skip {
|
||||
return true
|
||||
}
|
||||
if iAddrs, err := net.InterfaceAddrs(); err == nil {
|
||||
for _, addr := range iAddrs {
|
||||
if prefix, err := netip.ParsePrefix(addr.String()); err == nil {
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SessionStatus = byte
|
||||
@@ -37,7 +38,6 @@ type Mux struct {
|
||||
id [2]byte
|
||||
length [2]byte
|
||||
status [2]byte
|
||||
otb []byte
|
||||
remain int
|
||||
}
|
||||
|
||||
@@ -104,14 +104,8 @@ func (m *Mux) Read(b []byte) (int, error) {
|
||||
}
|
||||
|
||||
func (m *Mux) Write(b []byte) (int, error) {
|
||||
if m.otb != nil {
|
||||
// create a sub connection
|
||||
if _, err := m.Conn.Write(m.otb); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
m.otb = nil
|
||||
}
|
||||
m.buf.Reset()
|
||||
defer m.buf.Reset() // reset must after write (keep the data fill in NewMux can be sent)
|
||||
|
||||
binary.Write(&m.buf, binary.BigEndian, uint16(4))
|
||||
m.buf.Write(m.id[:])
|
||||
m.buf.WriteByte(SessionStatusKeep)
|
||||
@@ -123,15 +117,26 @@ func (m *Mux) Write(b []byte) (int, error) {
|
||||
}
|
||||
|
||||
func (m *Mux) Close() error {
|
||||
_, err := m.Conn.Write([]byte{0x0, 0x4, m.id[0], m.id[1], SessionStatusEnd, OptionNone})
|
||||
if err != nil {
|
||||
return err
|
||||
errChan := make(chan error, 1)
|
||||
t := time.AfterFunc(time.Second, func() { // maybe conn write too slowly, force close underlay conn after one second
|
||||
errChan <- m.Conn.Close()
|
||||
})
|
||||
_, _ = m.Conn.Write([]byte{0x0, 0x4, m.id[0], m.id[1], SessionStatusEnd, OptionNone}) // ignore session end frame write error
|
||||
if !t.Stop() {
|
||||
// Stop does not wait for f to complete before returning, so we used a chan to know whether f is completed
|
||||
return <-errChan
|
||||
}
|
||||
return m.Conn.Close()
|
||||
}
|
||||
|
||||
func NewMux(conn net.Conn, option MuxOption) *Mux {
|
||||
buf := &bytes.Buffer{}
|
||||
mux := &Mux{
|
||||
Conn: conn,
|
||||
id: option.ID,
|
||||
}
|
||||
|
||||
// create a sub connection (in buf)
|
||||
buf := &mux.buf
|
||||
|
||||
// fill empty length
|
||||
buf.Write([]byte{0x0, 0x0})
|
||||
@@ -165,9 +170,5 @@ func NewMux(conn net.Conn, option MuxOption) *Mux {
|
||||
metadata := buf.Bytes()
|
||||
binary.BigEndian.PutUint16(metadata[:2], uint16(len(metadata)-2))
|
||||
|
||||
return &Mux{
|
||||
Conn: conn,
|
||||
id: option.ID,
|
||||
otb: metadata,
|
||||
}
|
||||
return mux
|
||||
}
|
||||
|
@@ -2,10 +2,10 @@
|
||||
"manifest_version": 1,
|
||||
"latest": {
|
||||
"mihomo": "v1.19.10",
|
||||
"mihomo_alpha": "alpha-32d447c",
|
||||
"mihomo_alpha": "alpha-93ca185",
|
||||
"clash_rs": "v0.8.0",
|
||||
"clash_premium": "2023-09-05-gdcc8d87",
|
||||
"clash_rs_alpha": "0.8.0-alpha+sha.3b8b621"
|
||||
"clash_rs_alpha": "0.8.0-alpha+sha.22dc4d9"
|
||||
},
|
||||
"arch_template": {
|
||||
"mihomo": {
|
||||
@@ -69,5 +69,5 @@
|
||||
"linux-armv7hf": "clash-armv7-unknown-linux-gnueabihf"
|
||||
}
|
||||
},
|
||||
"updated_at": "2025-06-12T22:21:05.962Z"
|
||||
"updated_at": "2025-06-13T22:21:03.711Z"
|
||||
}
|
||||
|
@@ -1,13 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 运行 clippy
|
||||
# cargo clippy --manifest-path ./src-tauri/Cargo.toml --fix
|
||||
if git diff --cached --name-only | grep -q '^src-tauri/'; then
|
||||
cargo clippy --manifest-path ./src-tauri/Cargo.toml
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Clippy found issues in src-tauri. Please fix them before pushing."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 如果 clippy 失败,阻止 push
|
||||
# if [ $? -ne 0 ]; then
|
||||
# echo "Clippy found issues in sub_crate. Please fix them before pushing."
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
# 允许 push
|
||||
exit 0
|
||||
|
@@ -98,7 +98,7 @@ pub fn run() {
|
||||
if result.is_err() {
|
||||
logging!(info, Type::Setup, true, "检测到已有应用实例运行");
|
||||
if let Some(app_handle) = AppHandleManager::global().get() {
|
||||
let _ = app_handle.exit(0);
|
||||
app_handle.exit(0);
|
||||
} else {
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
22
filebrowser/.github/ISSUE_TEMPLATE/bug_report.md
vendored
22
filebrowser/.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,22 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
---
|
||||
|
||||
**Description**
|
||||
<!-- A clear and concise description of what the issue is about. What are you trying to do? -->
|
||||
|
||||
**Expected behaviour**
|
||||
<!-- What did you expect to happen? -->
|
||||
|
||||
**What is happening instead?**
|
||||
<!-- Please, give full error messages and/or log. -->
|
||||
|
||||
**Additional context**
|
||||
<!-- Add any other context about the problem here. If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
**How to reproduce?**
|
||||
<!-- Tell us how to reproduce this issue. How can someone who is starting from scratch reproduce this behaviour as minimally as possible? -->
|
||||
|
||||
**Files**
|
||||
<!-- A list of relevant files for this issue. Large files can be uploaded one-by-one or in a tarball/zipfile. -->
|
43
filebrowser/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
43
filebrowser/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Bug Report
|
||||
description: Report a bug in FileBrowser.
|
||||
labels: [bug, triage]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Checklist
|
||||
description: Please verify that you've followed these steps
|
||||
options:
|
||||
- label: This is a bug report, not a question.
|
||||
required: true
|
||||
- label: I have searched on the [issue tracker](https://github.com/filebrowser/filebrowser/issues?q=is%3Aissue) for my bug.
|
||||
required: true
|
||||
- label: I am running the latest [FileBrowser version](https://github.com/filebrowser/filebrowser/releases) or have an issue updating.
|
||||
required: true
|
||||
- type: textarea
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
render: Text
|
||||
description: |
|
||||
Enter the version of FileBrowser you are using.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Description
|
||||
description: |
|
||||
A clear and concise description of what the issue is about. What are you trying to do?
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What did you expect to happen?
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What actually happened?
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Reproduction Steps
|
||||
description: |
|
||||
Tell us how to reproduce this issue. How can someone who is starting from scratch reproduce this behavior as minimally as possible?
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Files
|
||||
description: |
|
||||
A list of relevant files for this issue. Large files can be uploaded one-by-one or in a tarball/zipfile.
|
5
filebrowser/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
filebrowser/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: GitHub Discussions
|
||||
url: https://github.com/filebrowser/filebrowser/discussions
|
||||
about: Please ask questions and discuss features here.
|
@@ -1,16 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
<!-- Add a clear and concise description of what the problem is. E.g. *I'm always frustrated when [...]* -->
|
||||
|
||||
**Describe the solution you'd like**
|
||||
<!-- Add a clear and concise description of what you want to happen. -->
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
<!-- Add a clear and concise description of any alternative solutions or features you've considered. -->
|
||||
|
||||
**Additional context**
|
||||
<!-- Add any other context or screenshots about the feature request here. -->
|
26
filebrowser/.github/PULL_REQUEST_TEMPLATE.md
vendored
26
filebrowser/.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,19 +1,15 @@
|
||||
**Description**
|
||||
<!--
|
||||
Please explain the changes you made here.
|
||||
If the feature changes current behaviour, explain why your solution is better.
|
||||
-->
|
||||
## Description
|
||||
|
||||
:rotating_light: Before submitting your PR, please indicate which issues are either fixed or closed by this PR. See [GitHub Help: Closing issues using keywords](https://help.github.com/articles/closing-issues-via-commit-messages/).
|
||||
<!-- Please explain the changes you made here. -->
|
||||
|
||||
- [ ] DO make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). Don't request your master!
|
||||
- [ ] DO make sure you are making a pull request against the **master branch** (left side). Also you should start *your branch* off *our master*.
|
||||
- [ ] DO make sure that File Browser can be successfully built. See [builds](https://github.com/filebrowser/community/blob/master/builds.md) and [development](https://github.com/filebrowser/community/blob/master/development.md).
|
||||
- [ ] AVOID breaking the continuous integration build.
|
||||
## Additional Information
|
||||
|
||||
**Further comments**
|
||||
<!--
|
||||
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did, what alternatives you considered, etc.
|
||||
<!-- If it is a relatively large or complex change, please add more information to explain what you did, how you did it, if you considered any alternatives, etc. -->
|
||||
|
||||
:heart: Thank you!
|
||||
-->
|
||||
## Checklist
|
||||
|
||||
Before submitting your PR, please indicate which issues are either fixed or closed by this PR. See [GitHub Help: Closing issues using keywords](https://help.github.com/articles/closing-issues-via-commit-messages/).
|
||||
|
||||
- [ ] I am aware the project is currently in maintenance-only mode. See [README](https://github.com/filebrowser/community/blob/master/README.md)
|
||||
- [ ] I am making a PR against the `master` branch.
|
||||
- [ ] I am sure File Browser can be successfully built. See [builds](https://github.com/filebrowser/community/blob/master/builds.md) and [development](https://github.com/filebrowser/community/blob/master/development.md).
|
||||
|
@@ -2,10 +2,6 @@
|
||||
<img src="https://raw.githubusercontent.com/filebrowser/logo/master/banner.png" width="550"/>
|
||||
</p>
|
||||
|
||||
> [!WARNING]
|
||||
>
|
||||
> This project is currently not under active maintenance and is looking for maintainers. Please check [issue #4890](https://github.com/filebrowser/filebrowser/issues/4890).
|
||||
|
||||

|
||||
|
||||
[](https://github.com/filebrowser/filebrowser/actions/workflows/main.yaml)
|
||||
@@ -16,6 +12,19 @@
|
||||
|
||||
filebrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files. It allows the creation of multiple users and each user can have its own directory. It can be used as a standalone app.
|
||||
|
||||
> [!WARNING]
|
||||
>
|
||||
> This project is currently on **maintenance-only** mode, and is looking for new maintainers. For more information, please read the [discussion #4906](https://github.com/filebrowser/filebrowser/discussions/4906). Therefore, please note the following:
|
||||
>
|
||||
> - It can take a while until someone gets back to you. Please be patient.
|
||||
> - [Issues][issues] are only being used to track bugs. Any unrelated issues will be converted into a [discussion][discussions].
|
||||
> - No new features will be implemented until further notice. The priority is on triaging issues and merge bug fixes.
|
||||
>
|
||||
> If you're interested in maintaining this project, please reach out via the discussion above.
|
||||
|
||||
[issues]: https://github.com/filebrowser/filebrowser/issues
|
||||
[discussions]: https://github.com/filebrowser/filebrowser/discussions
|
||||
|
||||
## Demo
|
||||
|
||||
URL: https://demo.filebrowser.org/
|
||||
|
@@ -0,0 +1,33 @@
|
||||
From 854d71c555dfc3383c1fde7d9989b6046e21093d Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 9 Oct 2024 07:48:05 +0200
|
||||
Subject: [PATCH] r8169: remove original workaround for RTL8125 broken rx issue
|
||||
|
||||
Now that we have b9c7ac4fe22c ("r8169: disable ALDPS per default for
|
||||
RTL8125"), the first attempt to fix the issue shouldn't be needed
|
||||
any longer. So let's effectively revert 621735f59064 ("r8169: fix
|
||||
rare issue with broken rx after link-down on RTL8125") and see
|
||||
whether anybody complains.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/382d8c88-cbce-400f-ad62-fda0181c7e38@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -4778,11 +4778,7 @@ static void r8169_phylink_handler(struct
|
||||
if (netif_carrier_ok(ndev)) {
|
||||
rtl_link_chg_patch(tp);
|
||||
pm_request_resume(d);
|
||||
- netif_wake_queue(tp->dev);
|
||||
} else {
|
||||
- /* In few cases rx is broken after link-down otherwise */
|
||||
- if (rtl_is_8125(tp))
|
||||
- rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE);
|
||||
pm_runtime_idle(d);
|
||||
}
|
||||
|
@@ -0,0 +1,52 @@
|
||||
From b8bf38440ba94e8ed8e2ae55c5dfb0276d30e843 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 10 Oct 2024 12:58:02 +0200
|
||||
Subject: [PATCH] r8169: enable SG/TSO on selected chip versions per default
|
||||
|
||||
Due to problem reports in the past SG and TSO/TSO6 are disabled per
|
||||
default. It's not fully clear which chip versions are affected, so we
|
||||
may impact also users of unaffected chip versions, unless they know
|
||||
how to use ethtool for enabling SG/TSO/TSO6.
|
||||
Vendor drivers r8168/r8125 enable SG/TSO/TSO6 for selected chip
|
||||
versions per default, I'd interpret this as confirmation that these
|
||||
chip versions are unaffected. So let's do the same here.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++++++-----
|
||||
1 file changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -5491,11 +5491,6 @@ static int rtl_init_one(struct pci_dev *
|
||||
|
||||
dev->features |= dev->hw_features;
|
||||
|
||||
- /* There has been a number of reports that using SG/TSO results in
|
||||
- * tx timeouts. However for a lot of people SG/TSO works fine.
|
||||
- * Therefore disable both features by default, but allow users to
|
||||
- * enable them. Use at own risk!
|
||||
- */
|
||||
if (rtl_chip_supports_csum_v2(tp)) {
|
||||
dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6;
|
||||
netif_set_tso_max_size(dev, RTL_GSO_MAX_SIZE_V2);
|
||||
@@ -5506,6 +5501,17 @@ static int rtl_init_one(struct pci_dev *
|
||||
netif_set_tso_max_segs(dev, RTL_GSO_MAX_SEGS_V1);
|
||||
}
|
||||
|
||||
+ /* There has been a number of reports that using SG/TSO results in
|
||||
+ * tx timeouts. However for a lot of people SG/TSO works fine.
|
||||
+ * It's not fully clear which chip versions are affected. Vendor
|
||||
+ * drivers enable SG/TSO for certain chip versions per default,
|
||||
+ * let's mimic this here. On other chip versions users can
|
||||
+ * use ethtool to enable SG/TSO, use at own risk!
|
||||
+ */
|
||||
+ if (tp->mac_version >= RTL_GIGA_MAC_VER_46 &&
|
||||
+ tp->mac_version != RTL_GIGA_MAC_VER_61)
|
||||
+ dev->features |= dev->hw_features;
|
||||
+
|
||||
dev->hw_features |= NETIF_F_RXALL;
|
||||
dev->hw_features |= NETIF_F_RXFCS;
|
||||
|
@@ -0,0 +1,130 @@
|
||||
From e3fc5139bd8ffaa1498adc21be4e8ecbc6aed508 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sun, 13 Oct 2024 11:17:39 +0200
|
||||
Subject: [PATCH] r8169: implement additional ethtool stats ops
|
||||
|
||||
This adds support for ethtool standard statistics, and makes use of the
|
||||
extended hardware statistics being available from RTl8125.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/58e0da73-a7dd-4be3-82ae-d5b3f9069bde@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 82 +++++++++++++++++++++++
|
||||
1 file changed, 82 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -2161,6 +2161,19 @@ static void rtl8169_get_ringparam(struct
|
||||
data->tx_pending = NUM_TX_DESC;
|
||||
}
|
||||
|
||||
+static void rtl8169_get_pause_stats(struct net_device *dev,
|
||||
+ struct ethtool_pause_stats *pause_stats)
|
||||
+{
|
||||
+ struct rtl8169_private *tp = netdev_priv(dev);
|
||||
+
|
||||
+ if (!rtl_is_8125(tp))
|
||||
+ return;
|
||||
+
|
||||
+ rtl8169_update_counters(tp);
|
||||
+ pause_stats->tx_pause_frames = le32_to_cpu(tp->counters->tx_pause_on);
|
||||
+ pause_stats->rx_pause_frames = le32_to_cpu(tp->counters->rx_pause_on);
|
||||
+}
|
||||
+
|
||||
static void rtl8169_get_pauseparam(struct net_device *dev,
|
||||
struct ethtool_pauseparam *data)
|
||||
{
|
||||
@@ -2187,6 +2200,69 @@ static int rtl8169_set_pauseparam(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void rtl8169_get_eth_mac_stats(struct net_device *dev,
|
||||
+ struct ethtool_eth_mac_stats *mac_stats)
|
||||
+{
|
||||
+ struct rtl8169_private *tp = netdev_priv(dev);
|
||||
+
|
||||
+ rtl8169_update_counters(tp);
|
||||
+
|
||||
+ mac_stats->FramesTransmittedOK =
|
||||
+ le64_to_cpu(tp->counters->tx_packets);
|
||||
+ mac_stats->SingleCollisionFrames =
|
||||
+ le32_to_cpu(tp->counters->tx_one_collision);
|
||||
+ mac_stats->MultipleCollisionFrames =
|
||||
+ le32_to_cpu(tp->counters->tx_multi_collision);
|
||||
+ mac_stats->FramesReceivedOK =
|
||||
+ le64_to_cpu(tp->counters->rx_packets);
|
||||
+ mac_stats->AlignmentErrors =
|
||||
+ le16_to_cpu(tp->counters->align_errors);
|
||||
+ mac_stats->FramesLostDueToIntMACXmitError =
|
||||
+ le64_to_cpu(tp->counters->tx_errors);
|
||||
+ mac_stats->BroadcastFramesReceivedOK =
|
||||
+ le64_to_cpu(tp->counters->rx_broadcast);
|
||||
+ mac_stats->MulticastFramesReceivedOK =
|
||||
+ le32_to_cpu(tp->counters->rx_multicast);
|
||||
+
|
||||
+ if (!rtl_is_8125(tp))
|
||||
+ return;
|
||||
+
|
||||
+ mac_stats->AlignmentErrors =
|
||||
+ le32_to_cpu(tp->counters->align_errors32);
|
||||
+ mac_stats->OctetsTransmittedOK =
|
||||
+ le64_to_cpu(tp->counters->tx_octets);
|
||||
+ mac_stats->LateCollisions =
|
||||
+ le32_to_cpu(tp->counters->tx_late_collision);
|
||||
+ mac_stats->FramesAbortedDueToXSColls =
|
||||
+ le32_to_cpu(tp->counters->tx_aborted32);
|
||||
+ mac_stats->OctetsReceivedOK =
|
||||
+ le64_to_cpu(tp->counters->rx_octets);
|
||||
+ mac_stats->FramesLostDueToIntMACRcvError =
|
||||
+ le32_to_cpu(tp->counters->rx_mac_error);
|
||||
+ mac_stats->MulticastFramesXmittedOK =
|
||||
+ le64_to_cpu(tp->counters->tx_multicast64);
|
||||
+ mac_stats->BroadcastFramesXmittedOK =
|
||||
+ le64_to_cpu(tp->counters->tx_broadcast64);
|
||||
+ mac_stats->MulticastFramesReceivedOK =
|
||||
+ le64_to_cpu(tp->counters->rx_multicast64);
|
||||
+ mac_stats->FrameTooLongErrors =
|
||||
+ le32_to_cpu(tp->counters->rx_frame_too_long);
|
||||
+}
|
||||
+
|
||||
+static void rtl8169_get_eth_ctrl_stats(struct net_device *dev,
|
||||
+ struct ethtool_eth_ctrl_stats *ctrl_stats)
|
||||
+{
|
||||
+ struct rtl8169_private *tp = netdev_priv(dev);
|
||||
+
|
||||
+ if (!rtl_is_8125(tp))
|
||||
+ return;
|
||||
+
|
||||
+ rtl8169_update_counters(tp);
|
||||
+
|
||||
+ ctrl_stats->UnsupportedOpcodesReceived =
|
||||
+ le32_to_cpu(tp->counters->rx_unknown_opcode);
|
||||
+}
|
||||
+
|
||||
static const struct ethtool_ops rtl8169_ethtool_ops = {
|
||||
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
|
||||
ETHTOOL_COALESCE_MAX_FRAMES,
|
||||
@@ -2208,8 +2284,11 @@ static const struct ethtool_ops rtl8169_
|
||||
.get_link_ksettings = phy_ethtool_get_link_ksettings,
|
||||
.set_link_ksettings = phy_ethtool_set_link_ksettings,
|
||||
.get_ringparam = rtl8169_get_ringparam,
|
||||
+ .get_pause_stats = rtl8169_get_pause_stats,
|
||||
.get_pauseparam = rtl8169_get_pauseparam,
|
||||
.set_pauseparam = rtl8169_set_pauseparam,
|
||||
+ .get_eth_mac_stats = rtl8169_get_eth_mac_stats,
|
||||
+ .get_eth_ctrl_stats = rtl8169_get_eth_ctrl_stats,
|
||||
};
|
||||
|
||||
static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii)
|
||||
@@ -3894,6 +3973,9 @@ static void rtl_hw_start_8125(struct rtl
|
||||
break;
|
||||
}
|
||||
|
||||
+ /* enable extended tally counter */
|
||||
+ r8168_mac_ocp_modify(tp, 0xea84, 0, BIT(1) | BIT(0));
|
||||
+
|
||||
rtl_hw_config(tp);
|
||||
}
|
||||
|
@@ -0,0 +1,50 @@
|
||||
From ac48430368c1a4f4e6c2fa92243b4b93fd25bee4 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 16 Oct 2024 22:05:57 +0200
|
||||
Subject: [PATCH] r8169: don't take RTNL lock in rtl_task()
|
||||
|
||||
There's not really a benefit here in taking the RTNL lock. The task
|
||||
handler does exception handling only, so we're in trouble anyway when
|
||||
we come here, and there's no need to protect against e.g. a parallel
|
||||
ethtool call.
|
||||
A benefit of removing the RTNL lock here is that we now can
|
||||
synchronously cancel the workqueue from a context holding the RTNL mutex.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -4801,10 +4801,8 @@ static void rtl_task(struct work_struct
|
||||
container_of(work, struct rtl8169_private, wk.work);
|
||||
int ret;
|
||||
|
||||
- rtnl_lock();
|
||||
-
|
||||
if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
|
||||
- goto out_unlock;
|
||||
+ return;
|
||||
|
||||
if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) {
|
||||
/* if chip isn't accessible, reset bus to revive it */
|
||||
@@ -4813,7 +4811,7 @@ static void rtl_task(struct work_struct
|
||||
if (ret < 0) {
|
||||
netdev_err(tp->dev, "Can't reset secondary PCI bus, detach NIC\n");
|
||||
netif_device_detach(tp->dev);
|
||||
- goto out_unlock;
|
||||
+ return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4832,8 +4830,6 @@ reset:
|
||||
} else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) {
|
||||
rtl_reset_work(tp);
|
||||
}
|
||||
-out_unlock:
|
||||
- rtnl_unlock();
|
||||
}
|
||||
|
||||
static int rtl8169_poll(struct napi_struct *napi, int budget)
|
@@ -0,0 +1,41 @@
|
||||
From 1c105bacb160b5918e917ab811552b7be69fc69c Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 16 Oct 2024 22:29:39 +0200
|
||||
Subject: [PATCH] r8169: avoid duplicated messages if loading firmware fails
|
||||
and switch to warn level
|
||||
|
||||
In case of a problem with firmware loading we inform at the driver level,
|
||||
in addition the firmware load code itself issues warnings. Therefore
|
||||
switch to firmware_request_nowarn() to avoid duplicated error messages.
|
||||
In addition switch to warn level because the firmware is optional and
|
||||
typically just fixes compatibility issues.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Message-ID: <d9c5094c-89a6-40e2-b5fe-8df7df4624ef@gmail.com>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_firmware.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_firmware.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_firmware.c
|
||||
@@ -215,7 +215,7 @@ int rtl_fw_request_firmware(struct rtl_f
|
||||
{
|
||||
int rc;
|
||||
|
||||
- rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
|
||||
+ rc = firmware_request_nowarn(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
|
||||
if (rc < 0)
|
||||
goto out;
|
||||
|
||||
@@ -227,7 +227,7 @@ int rtl_fw_request_firmware(struct rtl_f
|
||||
|
||||
return 0;
|
||||
out:
|
||||
- dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
|
||||
- rtl_fw->fw_name, rc);
|
||||
+ dev_warn(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
|
||||
+ rtl_fw->fw_name, rc);
|
||||
return rc;
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
From d64113c6bb5ea5a70b7c9c3a6bcadef307638187 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 16 Oct 2024 22:31:10 +0200
|
||||
Subject: [PATCH] r8169: remove rtl_dash_loop_wait_high/low
|
||||
|
||||
Remove rtl_dash_loop_wait_high/low to simplify the code.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Message-ID: <fb8c490c-2d92-48f5-8bbf-1fc1f2ee1649@gmail.com>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 35 ++++++-----------------
|
||||
1 file changed, 8 insertions(+), 27 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -1346,40 +1346,19 @@ static void rtl8168ep_stop_cmac(struct r
|
||||
RTL_W8(tp, IBCR0, RTL_R8(tp, IBCR0) & ~0x01);
|
||||
}
|
||||
|
||||
-static void rtl_dash_loop_wait(struct rtl8169_private *tp,
|
||||
- const struct rtl_cond *c,
|
||||
- unsigned long usecs, int n, bool high)
|
||||
-{
|
||||
- if (!tp->dash_enabled)
|
||||
- return;
|
||||
- rtl_loop_wait(tp, c, usecs, n, high);
|
||||
-}
|
||||
-
|
||||
-static void rtl_dash_loop_wait_high(struct rtl8169_private *tp,
|
||||
- const struct rtl_cond *c,
|
||||
- unsigned long d, int n)
|
||||
-{
|
||||
- rtl_dash_loop_wait(tp, c, d, n, true);
|
||||
-}
|
||||
-
|
||||
-static void rtl_dash_loop_wait_low(struct rtl8169_private *tp,
|
||||
- const struct rtl_cond *c,
|
||||
- unsigned long d, int n)
|
||||
-{
|
||||
- rtl_dash_loop_wait(tp, c, d, n, false);
|
||||
-}
|
||||
-
|
||||
static void rtl8168dp_driver_start(struct rtl8169_private *tp)
|
||||
{
|
||||
r8168dp_oob_notify(tp, OOB_CMD_DRIVER_START);
|
||||
- rtl_dash_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
|
||||
+ if (tp->dash_enabled)
|
||||
+ rtl_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
|
||||
}
|
||||
|
||||
static void rtl8168ep_driver_start(struct rtl8169_private *tp)
|
||||
{
|
||||
r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_START);
|
||||
r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
|
||||
- rtl_dash_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
|
||||
+ if (tp->dash_enabled)
|
||||
+ rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
|
||||
}
|
||||
|
||||
static void rtl8168_driver_start(struct rtl8169_private *tp)
|
||||
@@ -1393,7 +1372,8 @@ static void rtl8168_driver_start(struct
|
||||
static void rtl8168dp_driver_stop(struct rtl8169_private *tp)
|
||||
{
|
||||
r8168dp_oob_notify(tp, OOB_CMD_DRIVER_STOP);
|
||||
- rtl_dash_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
|
||||
+ if (tp->dash_enabled)
|
||||
+ rtl_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
|
||||
}
|
||||
|
||||
static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
|
||||
@@ -1401,7 +1381,8 @@ static void rtl8168ep_driver_stop(struct
|
||||
rtl8168ep_stop_cmac(tp);
|
||||
r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP);
|
||||
r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
|
||||
- rtl_dash_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
|
||||
+ if (tp->dash_enabled)
|
||||
+ rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
|
||||
}
|
||||
|
||||
static void rtl8168_driver_stop(struct rtl8169_private *tp)
|
@@ -0,0 +1,28 @@
|
||||
From c4e64095c00cb2de413cd6b90be047c273bcd491 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 17 Oct 2024 22:27:44 +0200
|
||||
Subject: [PATCH] r8169: enable EEE at 2.5G per default on RTL8125B
|
||||
|
||||
Register a6d/12 is shadowing register MDIO_AN_EEE_ADV2. So this line
|
||||
disables advertisement of EEE at 2.5G. Latest vendor driver r8125
|
||||
doesn't do this (any longer?), so this mode seems to be safe.
|
||||
EEE saves quite some energy, therefore enable this mode per default.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Message-ID: <95dd5a0c-09ea-4847-94d9-b7aa3063e8ff@gmail.com>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -99,7 +99,6 @@ static void rtl8125a_config_eee_phy(stru
|
||||
|
||||
static void rtl8125b_config_eee_phy(struct phy_device *phydev)
|
||||
{
|
||||
- phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000);
|
||||
phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000);
|
||||
phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000);
|
||||
phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000);
|
@@ -0,0 +1,143 @@
|
||||
From f75d1fbe7809bc5ed134204b920fd9e2fc5db1df Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 24 Oct 2024 22:42:33 +0200
|
||||
Subject: [PATCH] r8169: add support for RTL8125D
|
||||
|
||||
This adds support for new chip version RTL8125D, which can be found on
|
||||
boards like Gigabyte X870E AORUS ELITE WIFI7. Firmware rtl8125d-1.fw
|
||||
for this chip version is available in linux-firmware already.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/d0306912-e88e-4c25-8b5d-545ae8834c0c@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169.h | 1 +
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 23 +++++++++++++------
|
||||
.../net/ethernet/realtek/r8169_phy_config.c | 10 ++++++++
|
||||
3 files changed, 27 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169.h
|
||||
+++ b/drivers/net/ethernet/realtek/r8169.h
|
||||
@@ -68,6 +68,7 @@ enum mac_version {
|
||||
/* support for RTL_GIGA_MAC_VER_60 has been removed */
|
||||
RTL_GIGA_MAC_VER_61,
|
||||
RTL_GIGA_MAC_VER_63,
|
||||
+ RTL_GIGA_MAC_VER_64,
|
||||
RTL_GIGA_MAC_VER_65,
|
||||
RTL_GIGA_MAC_VER_66,
|
||||
RTL_GIGA_MAC_NONE
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -55,6 +55,7 @@
|
||||
#define FIRMWARE_8107E_2 "rtl_nic/rtl8107e-2.fw"
|
||||
#define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw"
|
||||
#define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw"
|
||||
+#define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw"
|
||||
#define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw"
|
||||
#define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw"
|
||||
|
||||
@@ -138,6 +139,7 @@ static const struct {
|
||||
[RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3},
|
||||
/* reserve 62 for CFG_METHOD_4 in the vendor driver */
|
||||
[RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2},
|
||||
+ [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1},
|
||||
[RTL_GIGA_MAC_VER_65] = {"RTL8126A", FIRMWARE_8126A_2},
|
||||
[RTL_GIGA_MAC_VER_66] = {"RTL8126A", FIRMWARE_8126A_3},
|
||||
};
|
||||
@@ -707,6 +709,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3);
|
||||
MODULE_FIRMWARE(FIRMWARE_8107E_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125A_3);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125B_2);
|
||||
+MODULE_FIRMWARE(FIRMWARE_8125D_1);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_3);
|
||||
|
||||
@@ -2079,10 +2082,7 @@ static void rtl_set_eee_txidle_timer(str
|
||||
tp->tx_lpi_timer = timer_val;
|
||||
r8168_mac_ocp_write(tp, 0xe048, timer_val);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_61:
|
||||
- case RTL_GIGA_MAC_VER_63:
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66:
|
||||
tp->tx_lpi_timer = timer_val;
|
||||
RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val);
|
||||
break;
|
||||
@@ -2294,6 +2294,9 @@ static enum mac_version rtl8169_get_mac_
|
||||
{ 0x7cf, 0x64a, RTL_GIGA_MAC_VER_66 },
|
||||
{ 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 },
|
||||
|
||||
+ /* 8125D family. */
|
||||
+ { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 },
|
||||
+
|
||||
/* 8125B family. */
|
||||
{ 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 },
|
||||
|
||||
@@ -2561,9 +2564,7 @@ static void rtl_init_rxcfg(struct rtl816
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_63:
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66:
|
||||
RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST |
|
||||
RX_PAUSE_SLOT_ON);
|
||||
break;
|
||||
@@ -3875,6 +3876,12 @@ static void rtl_hw_start_8125b(struct rt
|
||||
rtl_hw_start_8125_common(tp);
|
||||
}
|
||||
|
||||
+static void rtl_hw_start_8125d(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ rtl_set_def_aspm_entry_latency(tp);
|
||||
+ rtl_hw_start_8125_common(tp);
|
||||
+}
|
||||
+
|
||||
static void rtl_hw_start_8126a(struct rtl8169_private *tp)
|
||||
{
|
||||
rtl_set_def_aspm_entry_latency(tp);
|
||||
@@ -3923,6 +3930,7 @@ static void rtl_hw_config(struct rtl8169
|
||||
[RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117,
|
||||
[RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b,
|
||||
+ [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d,
|
||||
[RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a,
|
||||
[RTL_GIGA_MAC_VER_66] = rtl_hw_start_8126a,
|
||||
};
|
||||
@@ -3940,6 +3948,7 @@ static void rtl_hw_start_8125(struct rtl
|
||||
/* disable interrupt coalescing */
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
+ case RTL_GIGA_MAC_VER_64:
|
||||
for (i = 0xa00; i < 0xb00; i += 4)
|
||||
RTL_W32(tp, i, 0);
|
||||
break;
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1103,6 +1103,15 @@ static void rtl8125b_hw_phy_config(struc
|
||||
rtl8125b_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
+static void rtl8125d_hw_phy_config(struct rtl8169_private *tp,
|
||||
+ struct phy_device *phydev)
|
||||
+{
|
||||
+ r8169_apply_firmware(tp);
|
||||
+ rtl8125_legacy_force_mode(phydev);
|
||||
+ rtl8168g_disable_aldps(phydev);
|
||||
+ rtl8125b_config_eee_phy(phydev);
|
||||
+}
|
||||
+
|
||||
static void rtl8126a_hw_phy_config(struct rtl8169_private *tp,
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
@@ -1159,6 +1168,7 @@ void r8169_hw_phy_config(struct rtl8169_
|
||||
[RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config,
|
||||
+ [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_66] = rtl8126a_hw_phy_config,
|
||||
};
|
@@ -0,0 +1,30 @@
|
||||
From b8bd8c44a266c9a7dcb907eab10fbb119e3f6494 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 24 Oct 2024 22:48:59 +0200
|
||||
Subject: [PATCH] r8169: fix inconsistent indenting in
|
||||
rtl8169_get_eth_mac_stats
|
||||
|
||||
This fixes an inconsistent indenting introduced with e3fc5139bd8f
|
||||
("r8169: implement additional ethtool stats ops").
|
||||
|
||||
Reported-by: kernel test robot <lkp@intel.com>
|
||||
Closes: https://lore.kernel.org/oe-kbuild-all/202410220413.1gAxIJ4t-lkp@intel.com/
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/20fd6f39-3c1b-4af0-9adc-7d1f49728fad@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -2226,7 +2226,7 @@ static void rtl8169_get_eth_mac_stats(st
|
||||
le64_to_cpu(tp->counters->tx_broadcast64);
|
||||
mac_stats->MulticastFramesReceivedOK =
|
||||
le64_to_cpu(tp->counters->rx_multicast64);
|
||||
- mac_stats->FrameTooLongErrors =
|
||||
+ mac_stats->FrameTooLongErrors =
|
||||
le32_to_cpu(tp->counters->rx_frame_too_long);
|
||||
}
|
||||
|
@@ -0,0 +1,49 @@
|
||||
From eb90f876b7961d702d7fc549e14614860f531e60 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 31 Oct 2024 22:42:52 +0100
|
||||
Subject: [PATCH] r8169: align RTL8125 EEE config with vendor driver
|
||||
|
||||
Align the EEE config for RTL8125A/RTL8125B with vendor driver r8125.
|
||||
This should help to avoid compatibility issues.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/044c925e-8669-4b98-87df-95b4056f4f5f@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
.../net/ethernet/realtek/r8169_phy_config.c | 18 ++++++++++++------
|
||||
1 file changed, 12 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -89,19 +89,25 @@ static void rtl8168h_config_eee_phy(stru
|
||||
phy_modify_paged(phydev, 0xa42, 0x14, 0x0000, 0x0080);
|
||||
}
|
||||
|
||||
-static void rtl8125a_config_eee_phy(struct phy_device *phydev)
|
||||
+static void rtl8125_common_config_eee_phy(struct phy_device *phydev)
|
||||
{
|
||||
- rtl8168h_config_eee_phy(phydev);
|
||||
+ phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000);
|
||||
+ phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000);
|
||||
+ phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000);
|
||||
+}
|
||||
|
||||
+static void rtl8125a_config_eee_phy(struct phy_device *phydev)
|
||||
+{
|
||||
+ rtl8168g_config_eee_phy(phydev);
|
||||
+ /* disable EEE at 2.5Gbps */
|
||||
phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000);
|
||||
- phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000);
|
||||
+ rtl8125_common_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static void rtl8125b_config_eee_phy(struct phy_device *phydev)
|
||||
{
|
||||
- phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000);
|
||||
- phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000);
|
||||
- phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000);
|
||||
+ rtl8168g_config_eee_phy(phydev);
|
||||
+ rtl8125_common_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static void rtl8169s_hw_phy_config(struct rtl8169_private *tp,
|
@@ -0,0 +1,46 @@
|
||||
From 4af2f60bf7378bd5c92b15a528d8c6c7d02bed6c Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 31 Oct 2024 22:43:45 +0100
|
||||
Subject: [PATCH] r8169: align RTL8125/RTL8126 PHY config with vendor driver
|
||||
|
||||
This aligns some parameters with vendor driver r8125/r8126 to avoid
|
||||
compatibility issues. Note that for RTL8125B there's no functional
|
||||
change, just the open-coded version of the function is replaced.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/a8a9d896-fbe6-41f2-bf87-666567d3cdb3@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1073,8 +1073,8 @@ static void rtl8125b_hw_phy_config(struc
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
r8169_apply_firmware(tp);
|
||||
+ rtl8168g_enable_gphy_10m(phydev);
|
||||
|
||||
- phy_modify_paged(phydev, 0xa44, 0x11, 0x0000, 0x0800);
|
||||
phy_modify_paged(phydev, 0xac4, 0x13, 0x00f0, 0x0090);
|
||||
phy_modify_paged(phydev, 0xad3, 0x10, 0x0003, 0x0001);
|
||||
|
||||
@@ -1113,6 +1113,7 @@ static void rtl8125d_hw_phy_config(struc
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
r8169_apply_firmware(tp);
|
||||
+ rtl8168g_enable_gphy_10m(phydev);
|
||||
rtl8125_legacy_force_mode(phydev);
|
||||
rtl8168g_disable_aldps(phydev);
|
||||
rtl8125b_config_eee_phy(phydev);
|
||||
@@ -1122,6 +1123,9 @@ static void rtl8126a_hw_phy_config(struc
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
r8169_apply_firmware(tp);
|
||||
+ rtl8168g_enable_gphy_10m(phydev);
|
||||
+ rtl8125_legacy_force_mode(phydev);
|
||||
+ rtl8168g_disable_aldps(phydev);
|
||||
}
|
||||
|
||||
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
|
@@ -0,0 +1,25 @@
|
||||
From a3d8520e6a19ab018da6c7fc22512c913697a829 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 31 Oct 2024 22:44:36 +0100
|
||||
Subject: [PATCH] r8169: align RTL8126 EEE config with vendor driver
|
||||
|
||||
Align the EEE config for RTL8126A with vendor driver r8126 to avoid
|
||||
compatibility issues.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/71e4859e-4cd0-4b6b-b7fa-621d7721992f@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1126,6 +1126,7 @@ static void rtl8126a_hw_phy_config(struc
|
||||
rtl8168g_enable_gphy_10m(phydev);
|
||||
rtl8125_legacy_force_mode(phydev);
|
||||
rtl8168g_disable_aldps(phydev);
|
||||
+ rtl8125_common_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
|
@@ -0,0 +1,38 @@
|
||||
From 2cd02f2fdd8a92e5b6b85ff64eab0fc549b30c07 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sat, 2 Nov 2024 14:49:01 +0100
|
||||
Subject: [PATCH] r8169: improve initialization of RSS registers on
|
||||
RTL8125/RTL8126
|
||||
|
||||
Replace the register addresses with the names used in r8125/r8126
|
||||
vendor driver, and consider that RSS_CTRL_8125 is a 32 bit register.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/3bf2f340-b369-4174-97bf-fd38d4217492@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -346,6 +346,8 @@ enum rtl8125_registers {
|
||||
TxPoll_8125 = 0x90,
|
||||
LEDSEL3 = 0x96,
|
||||
MAC0_BKP = 0x19e0,
|
||||
+ RSS_CTRL_8125 = 0x4500,
|
||||
+ Q_NUM_CTRL_8125 = 0x4800,
|
||||
EEE_TXIDLE_TIMER_8125 = 0x6048,
|
||||
};
|
||||
|
||||
@@ -3769,8 +3771,8 @@ static void rtl_hw_start_8125_common(str
|
||||
rtl_pcie_state_l2l3_disable(tp);
|
||||
|
||||
RTL_W16(tp, 0x382, 0x221b);
|
||||
- RTL_W8(tp, 0x4500, 0);
|
||||
- RTL_W16(tp, 0x4800, 0);
|
||||
+ RTL_W32(tp, RSS_CTRL_8125, 0);
|
||||
+ RTL_W16(tp, Q_NUM_CTRL_8125, 0);
|
||||
|
||||
/* disable UPS */
|
||||
r8168_mac_ocp_modify(tp, 0xd40a, 0x0010, 0x0000);
|
@@ -0,0 +1,113 @@
|
||||
From 83cb4b470c66b37b19a347a35cea01e0cbdd258d Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Mon, 4 Nov 2024 23:16:20 +0100
|
||||
Subject: [PATCH] r8169: remove leftover locks after reverted change
|
||||
|
||||
After e31a9fedc7d8 ("Revert "r8169: disable ASPM during NAPI poll"")
|
||||
these locks aren't needed any longer.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/680f2606-ac7d-4ced-8694-e5033855da9b@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 29 ++---------------------
|
||||
1 file changed, 2 insertions(+), 27 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -662,13 +662,9 @@ struct rtl8169_private {
|
||||
struct work_struct work;
|
||||
} wk;
|
||||
|
||||
- raw_spinlock_t config25_lock;
|
||||
raw_spinlock_t mac_ocp_lock;
|
||||
struct mutex led_lock; /* serialize LED ctrl RMW access */
|
||||
|
||||
- raw_spinlock_t cfg9346_usage_lock;
|
||||
- int cfg9346_usage_count;
|
||||
-
|
||||
unsigned supports_gmii:1;
|
||||
unsigned aspm_manageable:1;
|
||||
unsigned dash_enabled:1;
|
||||
@@ -722,22 +718,12 @@ static inline struct device *tp_to_dev(s
|
||||
|
||||
static void rtl_lock_config_regs(struct rtl8169_private *tp)
|
||||
{
|
||||
- unsigned long flags;
|
||||
-
|
||||
- raw_spin_lock_irqsave(&tp->cfg9346_usage_lock, flags);
|
||||
- if (!--tp->cfg9346_usage_count)
|
||||
- RTL_W8(tp, Cfg9346, Cfg9346_Lock);
|
||||
- raw_spin_unlock_irqrestore(&tp->cfg9346_usage_lock, flags);
|
||||
+ RTL_W8(tp, Cfg9346, Cfg9346_Lock);
|
||||
}
|
||||
|
||||
static void rtl_unlock_config_regs(struct rtl8169_private *tp)
|
||||
{
|
||||
- unsigned long flags;
|
||||
-
|
||||
- raw_spin_lock_irqsave(&tp->cfg9346_usage_lock, flags);
|
||||
- if (!tp->cfg9346_usage_count++)
|
||||
- RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
|
||||
- raw_spin_unlock_irqrestore(&tp->cfg9346_usage_lock, flags);
|
||||
+ RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
|
||||
}
|
||||
|
||||
static void rtl_pci_commit(struct rtl8169_private *tp)
|
||||
@@ -748,24 +734,18 @@ static void rtl_pci_commit(struct rtl816
|
||||
|
||||
static void rtl_mod_config2(struct rtl8169_private *tp, u8 clear, u8 set)
|
||||
{
|
||||
- unsigned long flags;
|
||||
u8 val;
|
||||
|
||||
- raw_spin_lock_irqsave(&tp->config25_lock, flags);
|
||||
val = RTL_R8(tp, Config2);
|
||||
RTL_W8(tp, Config2, (val & ~clear) | set);
|
||||
- raw_spin_unlock_irqrestore(&tp->config25_lock, flags);
|
||||
}
|
||||
|
||||
static void rtl_mod_config5(struct rtl8169_private *tp, u8 clear, u8 set)
|
||||
{
|
||||
- unsigned long flags;
|
||||
u8 val;
|
||||
|
||||
- raw_spin_lock_irqsave(&tp->config25_lock, flags);
|
||||
val = RTL_R8(tp, Config5);
|
||||
RTL_W8(tp, Config5, (val & ~clear) | set);
|
||||
- raw_spin_unlock_irqrestore(&tp->config25_lock, flags);
|
||||
}
|
||||
|
||||
static bool rtl_is_8125(struct rtl8169_private *tp)
|
||||
@@ -1571,7 +1551,6 @@ static void __rtl8169_set_wol(struct rtl
|
||||
{ WAKE_MAGIC, Config3, MagicPacket }
|
||||
};
|
||||
unsigned int i, tmp = ARRAY_SIZE(cfg);
|
||||
- unsigned long flags;
|
||||
u8 options;
|
||||
|
||||
rtl_unlock_config_regs(tp);
|
||||
@@ -1590,14 +1569,12 @@ static void __rtl8169_set_wol(struct rtl
|
||||
r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0);
|
||||
}
|
||||
|
||||
- raw_spin_lock_irqsave(&tp->config25_lock, flags);
|
||||
for (i = 0; i < tmp; i++) {
|
||||
options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask;
|
||||
if (wolopts & cfg[i].opt)
|
||||
options |= cfg[i].mask;
|
||||
RTL_W8(tp, cfg[i].reg, options);
|
||||
}
|
||||
- raw_spin_unlock_irqrestore(&tp->config25_lock, flags);
|
||||
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06:
|
||||
@@ -5460,8 +5437,6 @@ static int rtl_init_one(struct pci_dev *
|
||||
tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1;
|
||||
tp->ocp_base = OCP_STD_PHY_BASE;
|
||||
|
||||
- raw_spin_lock_init(&tp->cfg9346_usage_lock);
|
||||
- raw_spin_lock_init(&tp->config25_lock);
|
||||
raw_spin_lock_init(&tp->mac_ocp_lock);
|
||||
mutex_init(&tp->led_lock);
|
||||
|
@@ -0,0 +1,108 @@
|
||||
From c507e96b5763b36b63ad50ad804341f72ea000e4 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 6 Nov 2024 17:55:45 +0100
|
||||
Subject: [PATCH] r8169: improve __rtl8169_set_wol
|
||||
|
||||
Add helper r8169_mod_reg8_cond() what allows to significantly simplify
|
||||
__rtl8169_set_wol().
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/697b197a-8eac-40c6-8847-27093cacec36@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 55 ++++++++++-------------
|
||||
1 file changed, 24 insertions(+), 31 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -748,6 +748,20 @@ static void rtl_mod_config5(struct rtl81
|
||||
RTL_W8(tp, Config5, (val & ~clear) | set);
|
||||
}
|
||||
|
||||
+static void r8169_mod_reg8_cond(struct rtl8169_private *tp, int reg,
|
||||
+ u8 bits, bool cond)
|
||||
+{
|
||||
+ u8 val, old_val;
|
||||
+
|
||||
+ old_val = RTL_R8(tp, reg);
|
||||
+ if (cond)
|
||||
+ val = old_val | bits;
|
||||
+ else
|
||||
+ val = old_val & ~bits;
|
||||
+ if (val != old_val)
|
||||
+ RTL_W8(tp, reg, val);
|
||||
+}
|
||||
+
|
||||
static bool rtl_is_8125(struct rtl8169_private *tp)
|
||||
{
|
||||
return tp->mac_version >= RTL_GIGA_MAC_VER_61;
|
||||
@@ -1538,58 +1552,37 @@ static void rtl8169_get_wol(struct net_d
|
||||
|
||||
static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
|
||||
{
|
||||
- static const struct {
|
||||
- u32 opt;
|
||||
- u16 reg;
|
||||
- u8 mask;
|
||||
- } cfg[] = {
|
||||
- { WAKE_PHY, Config3, LinkUp },
|
||||
- { WAKE_UCAST, Config5, UWF },
|
||||
- { WAKE_BCAST, Config5, BWF },
|
||||
- { WAKE_MCAST, Config5, MWF },
|
||||
- { WAKE_ANY, Config5, LanWake },
|
||||
- { WAKE_MAGIC, Config3, MagicPacket }
|
||||
- };
|
||||
- unsigned int i, tmp = ARRAY_SIZE(cfg);
|
||||
- u8 options;
|
||||
-
|
||||
rtl_unlock_config_regs(tp);
|
||||
|
||||
if (rtl_is_8168evl_up(tp)) {
|
||||
- tmp--;
|
||||
if (wolopts & WAKE_MAGIC)
|
||||
rtl_eri_set_bits(tp, 0x0dc, MagicPacket_v2);
|
||||
else
|
||||
rtl_eri_clear_bits(tp, 0x0dc, MagicPacket_v2);
|
||||
} else if (rtl_is_8125(tp)) {
|
||||
- tmp--;
|
||||
if (wolopts & WAKE_MAGIC)
|
||||
r8168_mac_ocp_modify(tp, 0xc0b6, 0, BIT(0));
|
||||
else
|
||||
r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0);
|
||||
+ } else {
|
||||
+ r8169_mod_reg8_cond(tp, Config3, MagicPacket,
|
||||
+ wolopts & WAKE_MAGIC);
|
||||
}
|
||||
|
||||
- for (i = 0; i < tmp; i++) {
|
||||
- options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask;
|
||||
- if (wolopts & cfg[i].opt)
|
||||
- options |= cfg[i].mask;
|
||||
- RTL_W8(tp, cfg[i].reg, options);
|
||||
- }
|
||||
+ r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY);
|
||||
+ r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST);
|
||||
+ r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST);
|
||||
+ r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST);
|
||||
+ r8169_mod_reg8_cond(tp, Config5, LanWake, wolopts);
|
||||
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06:
|
||||
- options = RTL_R8(tp, Config1) & ~PMEnable;
|
||||
- if (wolopts)
|
||||
- options |= PMEnable;
|
||||
- RTL_W8(tp, Config1, options);
|
||||
+ r8169_mod_reg8_cond(tp, Config1, PMEnable, wolopts);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_34:
|
||||
case RTL_GIGA_MAC_VER_37:
|
||||
case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66:
|
||||
- if (wolopts)
|
||||
- rtl_mod_config2(tp, 0, PME_SIGNAL);
|
||||
- else
|
||||
- rtl_mod_config2(tp, PME_SIGNAL, 0);
|
||||
+ r8169_mod_reg8_cond(tp, Config2, PME_SIGNAL, wolopts);
|
||||
break;
|
||||
default:
|
||||
break;
|
@@ -0,0 +1,44 @@
|
||||
From 330dc2297c82953dff402e0b4176a5383a618538 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 6 Nov 2024 17:56:28 +0100
|
||||
Subject: [PATCH] r8169: improve rtl_set_d3_pll_down
|
||||
|
||||
Make use of new helper r8169_mod_reg8_cond() and move from a switch()
|
||||
to an if() clause. Benefit is that we don't have to touch this piece of
|
||||
code each time support for a new chip version is added.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/e1ccdb85-a4ed-4800-89c2-89770ff06452@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 18 +++++-------------
|
||||
1 file changed, 5 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -1431,19 +1431,11 @@ static enum rtl_dash_type rtl_get_dash_t
|
||||
|
||||
static void rtl_set_d3_pll_down(struct rtl8169_private *tp, bool enable)
|
||||
{
|
||||
- switch (tp->mac_version) {
|
||||
- case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26:
|
||||
- case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30:
|
||||
- case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_37:
|
||||
- case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66:
|
||||
- if (enable)
|
||||
- RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~D3_NO_PLL_DOWN);
|
||||
- else
|
||||
- RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | D3_NO_PLL_DOWN);
|
||||
- break;
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
+ if (tp->mac_version >= RTL_GIGA_MAC_VER_25 &&
|
||||
+ tp->mac_version != RTL_GIGA_MAC_VER_28 &&
|
||||
+ tp->mac_version != RTL_GIGA_MAC_VER_31 &&
|
||||
+ tp->mac_version != RTL_GIGA_MAC_VER_38)
|
||||
+ r8169_mod_reg8_cond(tp, PMCH, D3_NO_PLL_DOWN, !enable);
|
||||
}
|
||||
|
||||
static void rtl_reset_packet_filter(struct rtl8169_private *tp)
|
@@ -0,0 +1,29 @@
|
||||
From e3e9e9039fa6ae885c7d5c954d7b9f105fa23e8f Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 6 Nov 2024 17:57:08 +0100
|
||||
Subject: [PATCH] r8169: align WAKE_PHY handling with r8125/r8126 vendor
|
||||
drivers
|
||||
|
||||
Vendor drivers r8125/r8126 apply this additional magic setting when
|
||||
enabling WAKE_PHY, so do the same here.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/51130715-45be-4db5-abb7-05d87e1f5df9@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -1562,6 +1562,9 @@ static void __rtl8169_set_wol(struct rtl
|
||||
}
|
||||
|
||||
r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY);
|
||||
+ if (rtl_is_8125(tp))
|
||||
+ r8168_mac_ocp_modify(tp, 0xe0c6, 0x3f,
|
||||
+ wolopts & WAKE_PHY ? 0x13 : 0);
|
||||
r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST);
|
||||
r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST);
|
||||
r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST);
|
@@ -0,0 +1,117 @@
|
||||
From 7a3bcd39ae1f0e3ab896d9df62339ab4297a0bfd Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sat, 9 Nov 2024 23:12:12 +0100
|
||||
Subject: [PATCH] r8169: use helper r8169_mod_reg8_cond to simplify
|
||||
rtl_jumbo_config
|
||||
|
||||
Use recently added helper r8169_mod_reg8_cond() to simplify jumbo
|
||||
mode configuration.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/3df1d484-a02e-46e7-8f75-db5b428e422e@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 77 ++++-------------------
|
||||
1 file changed, 11 insertions(+), 66 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -2546,86 +2546,31 @@ static void rtl8169_init_ring_indexes(st
|
||||
tp->dirty_tx = tp->cur_tx = tp->cur_rx = 0;
|
||||
}
|
||||
|
||||
-static void r8168c_hw_jumbo_enable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
|
||||
-}
|
||||
-
|
||||
-static void r8168c_hw_jumbo_disable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
|
||||
-}
|
||||
-
|
||||
-static void r8168dp_hw_jumbo_enable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
|
||||
-}
|
||||
-
|
||||
-static void r8168dp_hw_jumbo_disable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
|
||||
-}
|
||||
-
|
||||
-static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, MaxTxPacketSize, 0x24);
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | 0x01);
|
||||
-}
|
||||
-
|
||||
-static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, MaxTxPacketSize, 0x3f);
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~0x01);
|
||||
-}
|
||||
-
|
||||
-static void r8168b_1_hw_jumbo_enable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | (1 << 0));
|
||||
-}
|
||||
-
|
||||
-static void r8168b_1_hw_jumbo_disable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~(1 << 0));
|
||||
-}
|
||||
-
|
||||
static void rtl_jumbo_config(struct rtl8169_private *tp)
|
||||
{
|
||||
bool jumbo = tp->dev->mtu > ETH_DATA_LEN;
|
||||
int readrq = 4096;
|
||||
|
||||
+ if (jumbo && tp->mac_version >= RTL_GIGA_MAC_VER_17 &&
|
||||
+ tp->mac_version <= RTL_GIGA_MAC_VER_26)
|
||||
+ readrq = 512;
|
||||
+
|
||||
rtl_unlock_config_regs(tp);
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_17:
|
||||
- if (jumbo) {
|
||||
- readrq = 512;
|
||||
- r8168b_1_hw_jumbo_enable(tp);
|
||||
- } else {
|
||||
- r8168b_1_hw_jumbo_disable(tp);
|
||||
- }
|
||||
+ r8169_mod_reg8_cond(tp, Config4, BIT(0), jumbo);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_26:
|
||||
- if (jumbo) {
|
||||
- readrq = 512;
|
||||
- r8168c_hw_jumbo_enable(tp);
|
||||
- } else {
|
||||
- r8168c_hw_jumbo_disable(tp);
|
||||
- }
|
||||
+ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo);
|
||||
+ r8169_mod_reg8_cond(tp, Config4, Jumbo_En1, jumbo);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_28:
|
||||
- if (jumbo)
|
||||
- r8168dp_hw_jumbo_enable(tp);
|
||||
- else
|
||||
- r8168dp_hw_jumbo_disable(tp);
|
||||
+ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_31 ... RTL_GIGA_MAC_VER_33:
|
||||
- if (jumbo)
|
||||
- r8168e_hw_jumbo_enable(tp);
|
||||
- else
|
||||
- r8168e_hw_jumbo_disable(tp);
|
||||
+ RTL_W8(tp, MaxTxPacketSize, jumbo ? 0x24 : 0x3f);
|
||||
+ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo);
|
||||
+ r8169_mod_reg8_cond(tp, Config4, BIT(0), jumbo);
|
||||
break;
|
||||
default:
|
||||
break;
|
@@ -0,0 +1,32 @@
|
||||
From c283782fc5d60c4d8169137c6f955aa3553d3b3d Mon Sep 17 00:00:00 2001
|
||||
From: Hui Wang <hui.wang@canonical.com>
|
||||
Date: Fri, 27 Sep 2024 19:46:10 +0800
|
||||
Subject: [PATCH] net: phy: realtek: Check the index value in
|
||||
led_hw_control_get
|
||||
|
||||
Just like rtl8211f_led_hw_is_supported() and
|
||||
rtl8211f_led_hw_control_set(), the rtl8211f_led_hw_control_get() also
|
||||
needs to check the index value, otherwise the caller is likely to get
|
||||
an incorrect rules.
|
||||
|
||||
Fixes: 17784801d888 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F")
|
||||
Signed-off-by: Hui Wang <hui.wang@canonical.com>
|
||||
Reviewed-by: Marek Vasut <marex@denx.de>
|
||||
Link: https://patch.msgid.link/20240927114610.1278935-1-hui.wang@canonical.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -527,6 +527,9 @@ static int rtl8211f_led_hw_control_get(s
|
||||
{
|
||||
int val;
|
||||
|
||||
+ if (index >= RTL8211F_LED_COUNT)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR);
|
||||
if (val < 0)
|
||||
return val;
|
@@ -0,0 +1,67 @@
|
||||
From a6ad589c1d118f9d5b1bc4c6888d42919f830340 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Mon, 7 Oct 2024 11:57:41 +0200
|
||||
Subject: [PATCH] net: phy: realtek: Fix MMD access on RTL8126A-integrated PHY
|
||||
|
||||
All MMD reads return 0 for the RTL8126A-integrated PHY. Therefore phylib
|
||||
assumes it doesn't support EEE, what results in higher power consumption,
|
||||
and a significantly higher chip temperature in my case.
|
||||
To fix this split out the PHY driver for the RTL8126A-integrated PHY
|
||||
and set the read_mmd/write_mmd callbacks to read from vendor-specific
|
||||
registers.
|
||||
|
||||
Fixes: 5befa3728b85 ("net: phy: realtek: add support for RTL8126A-integrated 5Gbps PHY")
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 24 +++++++++++++++++++++++-
|
||||
1 file changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1081,6 +1081,16 @@ static int rtl8221b_vn_cg_c45_match_phy_
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true);
|
||||
}
|
||||
|
||||
+static int rtl8251b_c22_match_phy_device(struct phy_device *phydev)
|
||||
+{
|
||||
+ return rtlgen_is_c45_match(phydev, RTL_8251B, false);
|
||||
+}
|
||||
+
|
||||
+static int rtl8251b_c45_match_phy_device(struct phy_device *phydev)
|
||||
+{
|
||||
+ return rtlgen_is_c45_match(phydev, RTL_8251B, true);
|
||||
+}
|
||||
+
|
||||
static int rtlgen_resume(struct phy_device *phydev)
|
||||
{
|
||||
int ret = genphy_resume(phydev);
|
||||
@@ -1418,7 +1428,7 @@ static struct phy_driver realtek_drvs[]
|
||||
.suspend = genphy_c45_pma_suspend,
|
||||
.resume = rtlgen_c45_resume,
|
||||
}, {
|
||||
- PHY_ID_MATCH_EXACT(0x001cc862),
|
||||
+ .match_phy_device = rtl8251b_c45_match_phy_device,
|
||||
.name = "RTL8251B 5Gbps PHY",
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1428,6 +1438,18 @@ static struct phy_driver realtek_drvs[]
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
}, {
|
||||
+ .match_phy_device = rtl8251b_c22_match_phy_device,
|
||||
+ .name = "RTL8126A-internal 5Gbps PHY",
|
||||
+ .get_features = rtl822x_get_features,
|
||||
+ .config_aneg = rtl822x_config_aneg,
|
||||
+ .read_status = rtl822x_read_status,
|
||||
+ .suspend = genphy_suspend,
|
||||
+ .resume = rtlgen_resume,
|
||||
+ .read_page = rtl821x_read_page,
|
||||
+ .write_page = rtl821x_write_page,
|
||||
+ .read_mmd = rtl822x_read_mmd,
|
||||
+ .write_mmd = rtl822x_write_mmd,
|
||||
+ }, {
|
||||
PHY_ID_MATCH_EXACT(0x001ccad0),
|
||||
.name = "RTL8224 2.5Gbps PHY",
|
||||
.get_features = rtl822x_c45_get_features,
|
@@ -1,39 +1,29 @@
|
||||
From 66d82d3f04623e9c096e12c10ca51141c345ee84 Mon Sep 17 00:00:00 2001
|
||||
From 081c9c0265c91b8333165aa6230c20bcbc6f7cbf Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Tue, 8 Oct 2024 20:59:51 +0100
|
||||
Subject: [PATCH] net: phy: realtek: read duplex and gbit master from PHYSR
|
||||
Date: Thu, 10 Oct 2024 14:07:16 +0100
|
||||
Subject: [PATCH 3/5] net: phy: realtek: read duplex and gbit master from PHYSR
|
||||
register
|
||||
|
||||
The PHYSR MMD register is present and defined equally for all RTL82xx
|
||||
Ethernet PHYs.
|
||||
Read duplex and gbit master bits from rtlgen_decode_speed() and rename
|
||||
Read duplex and Gbit master bits from rtlgen_decode_speed() and rename
|
||||
it to rtlgen_decode_physr().
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Link: https://patch.msgid.link/b9a76341da851a18c985bc4774fa295babec79bb.1728565530.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 48 ++++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 40 insertions(+), 8 deletions(-)
|
||||
drivers/net/phy/realtek.c | 41 +++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 33 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -80,20 +80,24 @@
|
||||
@@ -80,15 +80,18 @@
|
||||
|
||||
#define RTL822X_VND2_GANLPAR 0xa414
|
||||
|
||||
-#define RTL822X_VND2_PHYSR 0xa434
|
||||
-
|
||||
#define RTL8221B_PHYCR1 0xa430
|
||||
#define RTL8221B_PHYCR1_ALDPS_EN BIT(2)
|
||||
#define RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN BIT(12)
|
||||
|
||||
+#define RTL_VND2_PHYSR 0xa434
|
||||
+#define RTL_VND2_PHYSR_LINK BIT(2)
|
||||
+#define RTL_VND2_PHYSR_DUPLEX BIT(3)
|
||||
+#define RTL_VND2_PHYSR_SPEEDL GENMASK(5, 4)
|
||||
+#define RTL_VND2_PHYSR_SPEEDH GENMASK(10, 9)
|
||||
+#define RTL_VND2_PHYSR_MASTER BIT(11)
|
||||
+#define RTL_VND2_PHYSR_SPEED_MASK (RTL_VND2_PHYSR_SPEEDL | RTL_VND2_PHYSR_SPEEDH)
|
||||
+
|
||||
#define RTL8366RB_POWER_SAVE 0x15
|
||||
#define RTL8366RB_POWER_SAVE_ON BIT(12)
|
||||
|
||||
@@ -41,11 +31,16 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
#define RTL9000A_GINMR_LINK_STATUS BIT(4)
|
||||
|
||||
-#define RTLGEN_SPEED_MASK 0x0630
|
||||
-
|
||||
+#define RTL_VND2_PHYSR 0xa434
|
||||
+#define RTL_VND2_PHYSR_DUPLEX BIT(3)
|
||||
+#define RTL_VND2_PHYSR_SPEEDL GENMASK(5, 4)
|
||||
+#define RTL_VND2_PHYSR_SPEEDH GENMASK(10, 9)
|
||||
+#define RTL_VND2_PHYSR_MASTER BIT(11)
|
||||
+#define RTL_VND2_PHYSR_SPEED_MASK (RTL_VND2_PHYSR_SPEEDL | RTL_VND2_PHYSR_SPEEDH)
|
||||
|
||||
#define RTL_GENERIC_PHYID 0x001cc800
|
||||
#define RTL_8211FVD_PHYID 0x001cc878
|
||||
#define RTL_8221B_VB_CG 0x001cc849
|
||||
@@ -661,9 +665,24 @@ static int rtl8366rb_config_init(struct
|
||||
@@ -660,9 +663,18 @@ static int rtl8366rb_config_init(struct
|
||||
}
|
||||
|
||||
/* get actual speed to cover the downshift case */
|
||||
@@ -53,12 +48,6 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
+static void rtlgen_decode_physr(struct phy_device *phydev, int val)
|
||||
{
|
||||
- switch (val & RTLGEN_SPEED_MASK) {
|
||||
+ /* bit 2
|
||||
+ * 0: Link not OK
|
||||
+ * 1: Link OK
|
||||
+ */
|
||||
+ phydev->link = !!(val & RTL_VND2_PHYSR_LINK);
|
||||
+
|
||||
+ /* bit 3
|
||||
+ * 0: Half Duplex
|
||||
+ * 1: Full Duplex
|
||||
@@ -72,7 +61,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
case 0x0000:
|
||||
phydev->speed = SPEED_10;
|
||||
break;
|
||||
@@ -685,6 +704,19 @@ static void rtlgen_decode_speed(struct p
|
||||
@@ -684,6 +696,19 @@ static void rtlgen_decode_speed(struct p
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -92,7 +81,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
}
|
||||
|
||||
static int rtlgen_read_status(struct phy_device *phydev)
|
||||
@@ -702,7 +734,7 @@ static int rtlgen_read_status(struct phy
|
||||
@@ -701,7 +726,7 @@ static int rtlgen_read_status(struct phy
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
@@ -101,7 +90,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1030,11 +1062,11 @@ static int rtl822x_c45_read_status(struc
|
||||
@@ -1007,11 +1032,11 @@ static int rtl822x_c45_read_status(struc
|
||||
return 0;
|
||||
|
||||
/* Read actual speed from vendor register. */
|
@@ -1,7 +1,7 @@
|
||||
From eaca24de0c0e64145c130759207da32594d2e5d1 Mon Sep 17 00:00:00 2001
|
||||
From 68d5cd09e8919679ce13b85950debea4b2e98e04 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Tue, 8 Oct 2024 21:05:47 +0100
|
||||
Subject: [PATCH 2/3] net: phy: realtek: change order of calls in C22
|
||||
Date: Thu, 10 Oct 2024 14:07:26 +0100
|
||||
Subject: [PATCH 4/5] net: phy: realtek: change order of calls in C22
|
||||
read_status()
|
||||
|
||||
Always call rtlgen_read_status() first, so genphy_read_status() which
|
||||
@@ -9,14 +9,17 @@ is called by it clears bits in case auto-negotiation has not completed.
|
||||
Also clear 10GBT link-partner advertisement bits in case auto-negotiation
|
||||
is disabled or has not completed.
|
||||
|
||||
Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Link: https://patch.msgid.link/b15929a41621d215c6b2b57393368086589569ec.1728565530.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 22 +++++++++++++++-------
|
||||
1 file changed, 15 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -979,17 +979,25 @@ static void rtl822xb_update_interface(st
|
||||
@@ -949,17 +949,25 @@ static void rtl822xb_update_interface(st
|
||||
|
||||
static int rtl822x_read_status(struct phy_device *phydev)
|
||||
{
|
@@ -1,7 +1,7 @@
|
||||
From 8b137d1e405dc90300ba577db44c70f0e026636e Mon Sep 17 00:00:00 2001
|
||||
From 5cb409b3960e75467cbb0a8e1e5596b4490570e3 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Tue, 8 Oct 2024 21:09:19 +0100
|
||||
Subject: [PATCH 3/3] net: phy: realtek: clear 1000Base-T link partner
|
||||
Date: Thu, 10 Oct 2024 14:07:39 +0100
|
||||
Subject: [PATCH 5/5] net: phy: realtek: clear 1000Base-T link partner
|
||||
advertisement
|
||||
|
||||
Clear 1000Base-T link partner advertisement bits in Clause-45
|
||||
@@ -9,13 +9,15 @@ read_status() function in case auto-negotiation is disabled or has not
|
||||
been completed.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Link: https://patch.msgid.link/9dc9b47b2d675708afef3ad366bfd78eb584d958.1728565530.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1056,6 +1056,10 @@ static int rtl822x_c45_read_status(struc
|
||||
@@ -1026,6 +1026,10 @@ static int rtl822x_c45_read_status(struc
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@@ -0,0 +1,136 @@
|
||||
From f87a17ed3b51fba4dfdd8f8b643b5423a85fc551 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Tue, 15 Oct 2024 07:47:14 +0200
|
||||
Subject: [PATCH] net: phy: realtek: merge the drivers for internal NBase-T
|
||||
PHY's
|
||||
|
||||
The Realtek RTL8125/RTL8126 NBase-T MAC/PHY chips have internal PHY's
|
||||
which are register-compatible, at least for the registers we use here.
|
||||
So let's use just one PHY driver to support all of them.
|
||||
These internal PHY's exist also as external C45 PHY's, but on the
|
||||
internal PHY's no access to MMD registers is possible. This can be
|
||||
used to differentiate between the internal and external version.
|
||||
|
||||
As a side effect the drivers for two now external-only drivers don't
|
||||
require read_mmd/write_mmd hooks any longer.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/c57081a6-811f-4571-ab35-34f4ca6de9af@gmail.com
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 53 +++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 43 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -95,6 +95,7 @@
|
||||
|
||||
#define RTL_GENERIC_PHYID 0x001cc800
|
||||
#define RTL_8211FVD_PHYID 0x001cc878
|
||||
+#define RTL_8221B 0x001cc840
|
||||
#define RTL_8221B_VB_CG 0x001cc849
|
||||
#define RTL_8221B_VN_CG 0x001cc84a
|
||||
#define RTL_8251B 0x001cc862
|
||||
@@ -1077,6 +1078,23 @@ static bool rtlgen_supports_2_5gbps(stru
|
||||
return val >= 0 && val & MDIO_PMA_SPEED_2_5G;
|
||||
}
|
||||
|
||||
+/* On internal PHY's MMD reads over C22 always return 0.
|
||||
+ * Check a MMD register which is known to be non-zero.
|
||||
+ */
|
||||
+static bool rtlgen_supports_mmd(struct phy_device *phydev)
|
||||
+{
|
||||
+ int val;
|
||||
+
|
||||
+ phy_lock_mdio_bus(phydev);
|
||||
+ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS);
|
||||
+ __phy_write(phydev, MII_MMD_DATA, MDIO_PCS_EEE_ABLE);
|
||||
+ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS | MII_MMD_CTRL_NOINCR);
|
||||
+ val = __phy_read(phydev, MII_MMD_DATA);
|
||||
+ phy_unlock_mdio_bus(phydev);
|
||||
+
|
||||
+ return val > 0;
|
||||
+}
|
||||
+
|
||||
static int rtlgen_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
@@ -1086,7 +1104,8 @@ static int rtlgen_match_phy_device(struc
|
||||
static int rtl8226_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
- rtlgen_supports_2_5gbps(phydev);
|
||||
+ rtlgen_supports_2_5gbps(phydev) &&
|
||||
+ rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id,
|
||||
@@ -1098,6 +1117,11 @@ static int rtlgen_is_c45_match(struct ph
|
||||
return !is_c45 && (id == phydev->phy_id);
|
||||
}
|
||||
|
||||
+static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
+{
|
||||
+ return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev);
|
||||
+}
|
||||
+
|
||||
static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false);
|
||||
@@ -1118,9 +1142,21 @@ static int rtl8221b_vn_cg_c45_match_phy_
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true);
|
||||
}
|
||||
|
||||
-static int rtl8251b_c22_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
- return rtlgen_is_c45_match(phydev, RTL_8251B, false);
|
||||
+ if (phydev->is_c45)
|
||||
+ return false;
|
||||
+
|
||||
+ switch (phydev->phy_id) {
|
||||
+ case RTL_GENERIC_PHYID:
|
||||
+ case RTL_8221B:
|
||||
+ case RTL_8251B:
|
||||
+ break;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
static int rtl8251b_c45_match_phy_device(struct phy_device *phydev)
|
||||
@@ -1382,10 +1418,8 @@ static struct phy_driver realtek_drvs[]
|
||||
.resume = rtlgen_resume,
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
- .read_mmd = rtl822x_read_mmd,
|
||||
- .write_mmd = rtl822x_write_mmd,
|
||||
}, {
|
||||
- PHY_ID_MATCH_EXACT(0x001cc840),
|
||||
+ .match_phy_device = rtl8221b_match_phy_device,
|
||||
.name = "RTL8226B_RTL8221B 2.5Gbps PHY",
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1396,8 +1430,6 @@ static struct phy_driver realtek_drvs[]
|
||||
.resume = rtlgen_resume,
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
- .read_mmd = rtl822x_read_mmd,
|
||||
- .write_mmd = rtl822x_write_mmd,
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc838),
|
||||
.name = "RTL8226-CG 2.5Gbps PHY",
|
||||
@@ -1475,8 +1507,9 @@ static struct phy_driver realtek_drvs[]
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
}, {
|
||||
- .match_phy_device = rtl8251b_c22_match_phy_device,
|
||||
- .name = "RTL8126A-internal 5Gbps PHY",
|
||||
+ .match_phy_device = rtl_internal_nbaset_match_phy_device,
|
||||
+ .name = "Realtek Internal NBASE-T PHY",
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.read_status = rtl822x_read_status,
|
@@ -0,0 +1,29 @@
|
||||
From 8989bad541133c43550bff2b80edbe37b8fb9659 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 17 Oct 2024 18:01:13 +0200
|
||||
Subject: [PATCH] net: phy: realtek: add RTL8125D-internal PHY
|
||||
|
||||
The first boards show up with Realtek's RTL8125D. This MAC/PHY chip
|
||||
comes with an integrated 2.5Gbps PHY with ID 0x001cc841. It's not
|
||||
clear yet whether there's an external version of this PHY and how
|
||||
Realtek calls it, therefore use the numeric id for now.
|
||||
|
||||
Link: https://lore.kernel.org/netdev/2ada65e1-5dfa-456c-9334-2bc51272e9da@gmail.com/T/
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Message-ID: <7d2924de-053b-44d2-a479-870dc3878170@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1151,6 +1151,7 @@ static int rtl_internal_nbaset_match_phy
|
||||
case RTL_GENERIC_PHYID:
|
||||
case RTL_8221B:
|
||||
case RTL_8251B:
|
||||
+ case 0x001cc841:
|
||||
break;
|
||||
default:
|
||||
return false;
|
@@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1325,6 +1325,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1412,6 +1412,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.name = "RTL8226 2.5Gbps PHY",
|
||||
.match_phy_device = rtl8226_match_phy_device,
|
||||
@@ -23,15 +23,15 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.read_status = rtl822x_read_status,
|
||||
@@ -1337,6 +1338,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1422,6 +1423,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc840),
|
||||
.match_phy_device = rtl8221b_match_phy_device,
|
||||
.name = "RTL8226B_RTL8221B 2.5Gbps PHY",
|
||||
+ .soft_reset = genphy_soft_reset,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.config_init = rtl822xb_config_init,
|
||||
@@ -1351,6 +1353,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1434,6 +1436,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc838),
|
||||
.name = "RTL8226-CG 2.5Gbps PHY",
|
||||
@@ -39,7 +39,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.read_status = rtl822x_read_status,
|
||||
@@ -1361,6 +1364,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1444,6 +1447,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc848),
|
||||
.name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY",
|
||||
@@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.config_init = rtl822xb_config_init,
|
||||
@@ -1373,6 +1377,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1456,6 +1460,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vb_cg_c22_match_phy_device,
|
||||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)",
|
||||
@@ -55,7 +55,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.config_init = rtl822xb_config_init,
|
||||
@@ -1385,6 +1390,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1468,6 +1473,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vb_cg_c45_match_phy_device,
|
||||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)",
|
||||
@@ -63,7 +63,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.config_init = rtl822xb_config_init,
|
||||
.get_rate_matching = rtl822xb_get_rate_matching,
|
||||
.get_features = rtl822x_c45_get_features,
|
||||
@@ -1395,6 +1401,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1478,6 +1484,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vn_cg_c22_match_phy_device,
|
||||
.name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)",
|
||||
@@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.config_init = rtl822xb_config_init,
|
||||
@@ -1407,6 +1414,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1490,6 +1497,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vn_cg_c45_match_phy_device,
|
||||
.name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)",
|
||||
|
@@ -19,7 +19,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -786,8 +786,8 @@ static int rtl822x_write_mmd(struct phy_
|
||||
@@ -815,8 +815,8 @@ static int rtl822x_write_mmd(struct phy_
|
||||
static int rtl822xb_config_init(struct phy_device *phydev)
|
||||
{
|
||||
bool has_2500, has_sgmii;
|
||||
@@ -29,7 +29,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX,
|
||||
phydev->host_interfaces) ||
|
||||
@@ -837,7 +837,29 @@ static int rtl822xb_config_init(struct p
|
||||
@@ -866,7 +866,29 @@ static int rtl822xb_config_init(struct p
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@@ -18,7 +18,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1052,9 +1052,11 @@ static bool rtlgen_supports_2_5gbps(stru
|
||||
@@ -1093,9 +1093,11 @@ static bool rtlgen_supports_2_5gbps(stru
|
||||
{
|
||||
int val;
|
||||
|
||||
|
@@ -13,9 +13,9 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -82,6 +82,10 @@
|
||||
@@ -80,6 +80,10 @@
|
||||
|
||||
#define RTL822X_VND2_PHYSR 0xa434
|
||||
#define RTL822X_VND2_GANLPAR 0xa414
|
||||
|
||||
+#define RTL8221B_PHYCR1 0xa430
|
||||
+#define RTL8221B_PHYCR1_ALDPS_EN BIT(2)
|
||||
@@ -24,8 +24,8 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
#define RTL8366RB_POWER_SAVE 0x15
|
||||
#define RTL8366RB_POWER_SAVE_ON BIT(12)
|
||||
|
||||
@@ -1102,6 +1106,25 @@ static int rtl8221b_vn_cg_c45_match_phy_
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true);
|
||||
@@ -1189,6 +1193,25 @@ static int rtl8251b_c45_match_phy_device
|
||||
return rtlgen_is_c45_match(phydev, RTL_8251B, true);
|
||||
}
|
||||
|
||||
+static int rtl822x_probe(struct phy_device *phydev)
|
||||
@@ -50,7 +50,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
static int rtlgen_resume(struct phy_device *phydev)
|
||||
{
|
||||
int ret = genphy_resume(phydev);
|
||||
@@ -1377,6 +1400,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1460,6 +1483,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc838),
|
||||
.name = "RTL8226-CG 2.5Gbps PHY",
|
||||
@@ -58,7 +58,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.soft_reset = genphy_soft_reset,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1388,6 +1412,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1471,6 +1495,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc848),
|
||||
.name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY",
|
||||
@@ -66,7 +66,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.soft_reset = genphy_soft_reset,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1401,6 +1426,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1484,6 +1509,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vb_cg_c22_match_phy_device,
|
||||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)",
|
||||
@@ -74,7 +74,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.soft_reset = genphy_soft_reset,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1414,6 +1440,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1497,6 +1523,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vb_cg_c45_match_phy_device,
|
||||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)",
|
||||
@@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.soft_reset = genphy_soft_reset,
|
||||
.config_init = rtl822xb_config_init,
|
||||
.get_rate_matching = rtl822xb_get_rate_matching,
|
||||
@@ -1425,6 +1452,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1508,6 +1535,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vn_cg_c22_match_phy_device,
|
||||
.name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)",
|
||||
@@ -90,7 +90,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
.soft_reset = genphy_soft_reset,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1438,6 +1466,7 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1521,6 +1549,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vn_cg_c45_match_phy_device,
|
||||
.name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)",
|
||||
|
@@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1080,10 +1080,32 @@ static int rtl8226_match_phy_device(stru
|
||||
@@ -1139,10 +1139,32 @@ static int rtl8226_match_phy_device(stru
|
||||
static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id,
|
||||
bool is_c45)
|
||||
{
|
||||
@@ -49,4 +49,4 @@ Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
|
||||
+ }
|
||||
}
|
||||
|
||||
static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
|
@@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1282,6 +1282,51 @@ static irqreturn_t rtl9000a_handle_inter
|
||||
@@ -1369,6 +1369,51 @@ static irqreturn_t rtl9000a_handle_inter
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
|
||||
static struct phy_driver realtek_drvs[] = {
|
||||
{
|
||||
PHY_ID_MATCH_EXACT(0x00008201),
|
||||
@@ -1448,6 +1493,8 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1531,6 +1576,8 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vb_cg_c22_match_phy_device,
|
||||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)",
|
||||
@@ -73,7 +73,7 @@ Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
|
||||
.probe = rtl822x_probe,
|
||||
.soft_reset = genphy_soft_reset,
|
||||
.get_features = rtl822x_get_features,
|
||||
@@ -1462,6 +1509,8 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1545,6 +1592,8 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vb_cg_c45_match_phy_device,
|
||||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)",
|
||||
@@ -82,7 +82,7 @@ Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
|
||||
.probe = rtl822x_probe,
|
||||
.soft_reset = genphy_soft_reset,
|
||||
.config_init = rtl822xb_config_init,
|
||||
@@ -1474,6 +1523,8 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1557,6 +1606,8 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vn_cg_c22_match_phy_device,
|
||||
.name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)",
|
||||
@@ -91,7 +91,7 @@ Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
|
||||
.probe = rtl822x_probe,
|
||||
.soft_reset = genphy_soft_reset,
|
||||
.get_features = rtl822x_get_features,
|
||||
@@ -1488,6 +1539,8 @@ static struct phy_driver realtek_drvs[]
|
||||
@@ -1571,6 +1622,8 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vn_cg_c45_match_phy_device,
|
||||
.name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)",
|
||||
|
@@ -4,6 +4,8 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/metacubex/mihomo/adapter/outboundgroup"
|
||||
@@ -150,6 +152,9 @@ func proxyGroupsDagSort(groupsConfig []map[string]any) error {
|
||||
}
|
||||
|
||||
func verifyIP6() bool {
|
||||
if skip, _ := strconv.ParseBool(os.Getenv("SKIP_SYSTEM_IPV6_CHECK")); skip {
|
||||
return true
|
||||
}
|
||||
if iAddrs, err := net.InterfaceAddrs(); err == nil {
|
||||
for _, addr := range iAddrs {
|
||||
if prefix, err := netip.ParsePrefix(addr.String()); err == nil {
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SessionStatus = byte
|
||||
@@ -37,7 +38,6 @@ type Mux struct {
|
||||
id [2]byte
|
||||
length [2]byte
|
||||
status [2]byte
|
||||
otb []byte
|
||||
remain int
|
||||
}
|
||||
|
||||
@@ -104,14 +104,8 @@ func (m *Mux) Read(b []byte) (int, error) {
|
||||
}
|
||||
|
||||
func (m *Mux) Write(b []byte) (int, error) {
|
||||
if m.otb != nil {
|
||||
// create a sub connection
|
||||
if _, err := m.Conn.Write(m.otb); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
m.otb = nil
|
||||
}
|
||||
m.buf.Reset()
|
||||
defer m.buf.Reset() // reset must after write (keep the data fill in NewMux can be sent)
|
||||
|
||||
binary.Write(&m.buf, binary.BigEndian, uint16(4))
|
||||
m.buf.Write(m.id[:])
|
||||
m.buf.WriteByte(SessionStatusKeep)
|
||||
@@ -123,15 +117,26 @@ func (m *Mux) Write(b []byte) (int, error) {
|
||||
}
|
||||
|
||||
func (m *Mux) Close() error {
|
||||
_, err := m.Conn.Write([]byte{0x0, 0x4, m.id[0], m.id[1], SessionStatusEnd, OptionNone})
|
||||
if err != nil {
|
||||
return err
|
||||
errChan := make(chan error, 1)
|
||||
t := time.AfterFunc(time.Second, func() { // maybe conn write too slowly, force close underlay conn after one second
|
||||
errChan <- m.Conn.Close()
|
||||
})
|
||||
_, _ = m.Conn.Write([]byte{0x0, 0x4, m.id[0], m.id[1], SessionStatusEnd, OptionNone}) // ignore session end frame write error
|
||||
if !t.Stop() {
|
||||
// Stop does not wait for f to complete before returning, so we used a chan to know whether f is completed
|
||||
return <-errChan
|
||||
}
|
||||
return m.Conn.Close()
|
||||
}
|
||||
|
||||
func NewMux(conn net.Conn, option MuxOption) *Mux {
|
||||
buf := &bytes.Buffer{}
|
||||
mux := &Mux{
|
||||
Conn: conn,
|
||||
id: option.ID,
|
||||
}
|
||||
|
||||
// create a sub connection (in buf)
|
||||
buf := &mux.buf
|
||||
|
||||
// fill empty length
|
||||
buf.Write([]byte{0x0, 0x0})
|
||||
@@ -165,9 +170,5 @@ func NewMux(conn net.Conn, option MuxOption) *Mux {
|
||||
metadata := buf.Bytes()
|
||||
binary.BigEndian.PutUint16(metadata[:2], uint16(len(metadata)-2))
|
||||
|
||||
return &Mux{
|
||||
Conn: conn,
|
||||
id: option.ID,
|
||||
otb: metadata,
|
||||
}
|
||||
return mux
|
||||
}
|
||||
|
@@ -2,6 +2,10 @@
|
||||
icon: material/alert-decagram
|
||||
---
|
||||
|
||||
#### 1.12.0-beta.25
|
||||
|
||||
* Fixes and improvements
|
||||
|
||||
#### 1.12.0-beta.24
|
||||
|
||||
* Allow `tls_fragment` and `tls_record_fragment` to be enabled together **1**
|
||||
|
@@ -34,7 +34,7 @@ require (
|
||||
github.com/sagernet/sing-shadowsocks v0.2.8
|
||||
github.com/sagernet/sing-shadowsocks2 v0.2.1
|
||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11
|
||||
github.com/sagernet/sing-tun v0.6.6-0.20250610083027-da0a50057fb5
|
||||
github.com/sagernet/sing-tun v0.6.7-0.20250613101921-11f18fa1f602
|
||||
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88
|
||||
github.com/sagernet/smux v1.5.34-mod.2
|
||||
github.com/sagernet/tailscale v1.80.3-mod.5
|
||||
|
@@ -180,8 +180,8 @@ github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnq
|
||||
github.com/sagernet/sing-shadowsocks2 v0.2.1/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
|
||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
|
||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
|
||||
github.com/sagernet/sing-tun v0.6.6-0.20250610083027-da0a50057fb5 h1:zlcioVa11g8VLz5L0yPG7PbvQrw7mrxkDDdlMPEgqDk=
|
||||
github.com/sagernet/sing-tun v0.6.6-0.20250610083027-da0a50057fb5/go.mod h1:fisFCbC4Vfb6HqQNcwPJi2CDK2bf0Xapyz3j3t4cnHE=
|
||||
github.com/sagernet/sing-tun v0.6.7-0.20250613101921-11f18fa1f602 h1:A7ghDv4GcxdZisEHgICCu6BbaxnhYoCdcGU0M0DgY9U=
|
||||
github.com/sagernet/sing-tun v0.6.7-0.20250613101921-11f18fa1f602/go.mod h1:fisFCbC4Vfb6HqQNcwPJi2CDK2bf0Xapyz3j3t4cnHE=
|
||||
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88 h1:0pVm8sPOel+BoiCddW3pV3cKDKEaSioVTYDdTSKjyFI=
|
||||
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88/go.mod h1:IL8Rr+EGwuqijszZkNrEFTQDKhilEpkqFqOlvdpS6/w=
|
||||
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=
|
||||
|
@@ -6,12 +6,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=v2ray-plugin
|
||||
PKG_VERSION:=5.25.0
|
||||
PKG_VERSION:=5.33.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/teddysun/v2ray-plugin/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=64d2cc376c16ade97b8e2cce69e0c98d74f530dcf8a30cf7d22255969ca5c10d
|
||||
PKG_HASH:=5e7b2f9f7adcee8c2574259a3b1256d974aea87a51906be6d83aad38afded854
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
@@ -3,7 +3,7 @@ module github.com/2dust/AndroidLibXrayLite
|
||||
go 1.24.3
|
||||
|
||||
require (
|
||||
github.com/xtls/xray-core v1.250516.1-0.20250607133724-f38d3f786a47
|
||||
github.com/xtls/xray-core v1.250516.1-0.20250608135303-fbae89d017ae
|
||||
golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f
|
||||
)
|
||||
|
||||
@@ -17,6 +17,7 @@ require (
|
||||
github.com/google/btree v1.1.3 // indirect
|
||||
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/juju/ratelimit v1.0.2 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.23.4 // indirect
|
||||
@@ -32,7 +33,7 @@ require (
|
||||
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e // indirect
|
||||
github.com/vishvananda/netlink v1.3.1 // indirect
|
||||
github.com/vishvananda/netns v0.0.5 // indirect
|
||||
github.com/xtls/reality v0.0.0-20250607105625-90e738a94c8c // indirect
|
||||
github.com/xtls/reality v0.0.0-20250608132114-50752aec6bfb // indirect
|
||||
go.uber.org/automaxprocs v1.6.0 // indirect
|
||||
go.uber.org/mock v0.5.2 // indirect
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
||||
|
@@ -32,6 +32,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/juju/ratelimit v1.0.2 h1:sRxmtRiajbvrcLQT7S+JbqU0ntsb9W2yhSdNN8tWfaI=
|
||||
github.com/juju/ratelimit v1.0.2/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
|
||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||
@@ -78,10 +80,10 @@ github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW
|
||||
github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4=
|
||||
github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=
|
||||
github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
||||
github.com/xtls/reality v0.0.0-20250607105625-90e738a94c8c h1:GiY3/SynO0ujSH3rQDEIrE4MTTZM9KHufR3zx3JLD3c=
|
||||
github.com/xtls/reality v0.0.0-20250607105625-90e738a94c8c/go.mod h1:Rkdcxe9Yd8SWQRRP+LSvX6wxk1m4lmNkyUZEHzbPDZw=
|
||||
github.com/xtls/xray-core v1.250516.1-0.20250607133724-f38d3f786a47 h1:W5kc0F9Q5vVF3ET2Oj9trDP+NkU2eW5rzaA/UiZ+PiY=
|
||||
github.com/xtls/xray-core v1.250516.1-0.20250607133724-f38d3f786a47/go.mod h1:SHDO7kQ7U903zblScXv/zxGlPzUevRaG5fPaeulY/Do=
|
||||
github.com/xtls/reality v0.0.0-20250608132114-50752aec6bfb h1:X6ziJCMsFF8Ac/0F3W7+UbFdHZTu+r5nZ/smksHVxNQ=
|
||||
github.com/xtls/reality v0.0.0-20250608132114-50752aec6bfb/go.mod h1:yD47RN65bDLZgyHWMfFDiqlzrq4usDMt/Xzsk6tMbhw=
|
||||
github.com/xtls/xray-core v1.250516.1-0.20250608135303-fbae89d017ae h1:Be9MicJQI+Iup03zNG7QMEidpbJj3b4//IM8jIAnLKY=
|
||||
github.com/xtls/xray-core v1.250516.1-0.20250608135303-fbae89d017ae/go.mod h1:MkfIs2WZ5VLtZHAwDKosSS05Kx5zFFOzvly7Hy6pfPs=
|
||||
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
|
@@ -12,8 +12,8 @@ android {
|
||||
applicationId = "com.v2ray.ang"
|
||||
minSdk = 21
|
||||
targetSdk = 35
|
||||
versionCode = 655
|
||||
versionName = "1.10.5"
|
||||
versionCode = 656
|
||||
versionName = "1.10.6"
|
||||
multiDexEnabled = true
|
||||
|
||||
val abiFilterList = (properties["ABI_FILTERS"] as? String)?.split(';')
|
||||
|
@@ -189,7 +189,7 @@ object AppConfig {
|
||||
val DNS_YANDEX_ADDRESSES = arrayListOf("77.88.8.8", "77.88.8.1", "2a02:6b8::feed:0ff", "2a02:6b8:0:1::feed:0ff")
|
||||
|
||||
//minimum list https://serverfault.com/a/304791
|
||||
val BYPASS_PRIVATE_IP_LIST = arrayListOf(
|
||||
val ROUTED_IP_LIST = arrayListOf(
|
||||
"0.0.0.0/5",
|
||||
"8.0.0.0/7",
|
||||
"11.0.0.0/8",
|
||||
|
@@ -167,7 +167,7 @@ class V2RayVpnService : VpnService(), ServiceControl {
|
||||
//builder.addDnsServer(PRIVATE_VLAN4_ROUTER)
|
||||
val bypassLan = SettingsManager.routingRulesetsBypassLan()
|
||||
if (bypassLan) {
|
||||
AppConfig.BYPASS_PRIVATE_IP_LIST.forEach {
|
||||
AppConfig.ROUTED_IP_LIST.forEach {
|
||||
val addr = it.split('/')
|
||||
builder.addRoute(addr[0], addr[1].toInt())
|
||||
}
|
||||
@@ -179,6 +179,7 @@ class V2RayVpnService : VpnService(), ServiceControl {
|
||||
builder.addAddress(PRIVATE_VLAN6_CLIENT, 126)
|
||||
if (bypassLan) {
|
||||
builder.addRoute("2000::", 3) //currently only 1/8 of total ipV6 is in use
|
||||
builder.addRoute("fc00::", 18) //Xray-core default FakeIPv6 Pool
|
||||
} else {
|
||||
builder.addRoute("::", 0)
|
||||
}
|
||||
|
@@ -28,13 +28,17 @@ object PluginUtil {
|
||||
fun runPlugin(context: Context, config: ProfileItem?, socksPort: Int?) {
|
||||
Log.i(AppConfig.TAG, "Starting plugin execution")
|
||||
|
||||
if (config == null || socksPort == null) {
|
||||
if (config == null) {
|
||||
Log.w(AppConfig.TAG, "Cannot run plugin: config is null")
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
if (config.configType == EConfigType.HYSTERIA2) {
|
||||
if (socksPort == null) {
|
||||
Log.w(AppConfig.TAG, "Cannot run plugin: socksPort is null")
|
||||
return
|
||||
}
|
||||
Log.i(AppConfig.TAG, "Running Hysteria2 plugin")
|
||||
val configFile = genConfigHy2(context, config, socksPort) ?: return
|
||||
val cmd = genCmdHy2(context, configFile)
|
||||
|
Reference in New Issue
Block a user