BPI-R3 SFP Module compatibility

Thanks! Got the H!fibre from Amazon: https://www.amazon.com/dp/B07B47SSHH Everything works without a hitch.

Hello Daniel, I use on my BPI R3 a GPON sfp module OEM DFP-34X-2C2 capable of both 1000base-x and 2500base-x. Unfortunately the stable OWRT v23.05.2 only showing 1000base-x then I created following patch as per your suggestion: target/linux/generic/pending-5.15/706-net-sfp-add-quirk-for-DFP-34X-2C2.patch text

Enabling this option makes DFP-34X-2C2 working at 2500baseX

--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -383,6 +366,12 @@ static const struct sfp_quirk sfp_quirks
		.part = "MXPD-483II",
		.modes = sfp_quirk_2500basex,
 	}, {
+		// OEM DFP-34X-2C2 GPON ONU can operate at 2500base-X, but report 1.2GBd
+		// NRZ in their EEPROM	
+		.vendor = "OEM",
+		.part = "DFP-34X-2C2",
+		.modes = sfp_quirk_2500basex,
+	}, {
 		// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
 		// NRZ in their EEPROM
 		.vendor = "HUAWEI",

and after the compilation with patch ethtool correctly showing:

Settings for eth1:
        Supported ports: [ FIBRE ]
        Supported link modes:   2500baseX/Full
                                1000baseX/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  2500baseX/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 2500Mb/s
        Duplex: Full
        Auto-negotiation: on
        Port: FIBRE
        PHYAD: 0
        Transceiver: internal
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err

Can you please add the patch for this stick in the openwrt development so that it will be embedded in next versions? Thanks in advance from all DFP-34X-2C2 users.

As I don’t have the hardware myself for testing the best would be you submitted this patch to upstream Linux mailing lists. As things have advanced in upstream Linux since v5.15, the equivalent patch you should submit to netdev mailing list would look like that:

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 2abc155dc5cf8..a14f61bab256f 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -495,6 +495,9 @@ static const struct sfp_quirk sfp_quirks[] = {
        // 2500MBd NRZ in their EEPROM
        SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex),
 
+       // DFP-34X-2C2 GPON ONU supports 2500base-X
+       SFP_QUIRK_M("OEM", "DFP-34X-2C2", sfp_quirk_2500basex),
+
        SFP_QUIRK_M("UBNT", "UF-INSTANT", sfp_quirk_ubnt_uf_instant),
 
        // Walsun HXSX-ATR[CI]-1 don't identify as copper, and use the

Once sent to Linux netdev kernel mailing list, the patch will show up in Netdev + BPF - Patchwork

From there, download the patch file and add it to (including the complete patch description and X-Patchwork* headers, so we can track it and remove it once we move to newer kernels which will then include it) to both target/linux/generic/pending-5.15 and target/linux/generic/pending-6.1. Then make change both patches so they actually build and work on Linux 5.15 and Linux 6.1 (ie. the patch content will then look like what you are suggesting above, but include a patch description and X-Patchwork… headers), commit that to your local openwrt.git checkout and submit the resulting patch to OpenWrt’s openwrt-devel mailing list or open a pull request on Github.

If you face any difficulties or have questions, please ask, I will help and assist you along the process.

Hi Daniel, this is the first time fo me to submit a patch. Can you please explain what do you mean for “send to Linux netdev”. Do I have to use

git send-email [email protected] --to="[email protected]" 001-description.patch

or do I have to send to

[email protected]

or do I have to subscribe:

openwrt-devel

Thanks in advance for your help. Best regards and Merry Christmas Sergio

https://www.kernel.org/doc/html/v5.3/networking/netdev-FAQ.html

So this is linux not openwrt specific…openwrt then adds the patches from linux

You send patches to the recipients listed by get_maintainer.pl script of linux source. Get net-next source first,add your changes and use git format-patch to get patchfile

If 1000M is not an issue, here is a nice offer €5,92 (buy 2 for free shipping):

https://nl.aliexpress.com/item/1005006169925450.html

It says i2c access to phy, so should be ok…

1 Like

Submitted the patch and shown in Patchwork Netdev+BPF as success. What is now the next step? Thanks for your kind help.

waiting for the patch to be reviewed and applied :slight_smile:

can you post link to the patch (patchwork)?

Hi Frank, here the link. https://patchwork.kernel.org/project/netdevbpf/patch/AS1PR03MB8189F6C1F7DF7907E38198D382672@AS1PR03MB8189.eurprd03.prod.outlook.com/

Some information additional (or shorter) to the readme you already got in the Mailinglist:

Look for previous commits on this file to get the right subsystem prefix and gives you some examples how commits should look like…

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/log/drivers/net/phy/sfp.c

As you see,commits here are like this

net: sfp: add support for xyz module

you can change commit with

git commit --amend -s

If it is your topmost commit (i guess it is in your tree). The s flag adds the signed-off-by if not already there.

Then add a commit message explaining why this patch is needed (see also previous commits as example).

Then use “git format-patch HEAD~1” and check the resulting file with scripts/checkpatch.pl and use get_maintainers.pl to get recipients (maintainer,reviewers and mailinglists only - exclude commit signers). Then you can use git send-email to send the patch to the adresses you’ve got

Hi Frank, I struggled all day in order to understand how to proceed without success. Unfortunately I started from patch already prepared without creating it from scratch and mailed it without applying it in the system. However I cloned kernel/git/netdev/net-next.git - Netdev Group's -next networking tree and tryed to apply the patch without success (errors reported which I could not understand). It is still not clear to me how to create (diff ?) the patch and/or apply it, when to commit and how to sned it to the maintainers mailing list. I read documents suggested, but still need some very basic help in order to understand how to proceed. Still not clear to me if I can do the requested changes directly on the patch file and send it to the maintaines mailing list or if I have to create, apply, commit it in the system and use the git commands to proceed. Your and Daniel’s help would be much apreciated.

your patch does not apply because you have used spaces instead of tabs for the existing lines (Lantech and UBNT SFP)

then i would align the quirks by vendor so it should imho be near the other OEM quirks

so codechange is more like this:

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index f75c9eb3958e..1a447e3567c8 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -506,6 +506,9 @@ static const struct sfp_quirk sfp_quirks[] = {
        SFP_QUIRK_M("OEM", "SFP-2.5G-T", sfp_quirk_oem_2_5g),
        SFP_QUIRK_F("OEM", "RTSFP-10", sfp_fixup_rollball_cc),
        SFP_QUIRK_F("OEM", "RTSFP-10G", sfp_fixup_rollball_cc),
+       // DFP-34X-2C2 GPON ONU supports 2500base-X
+       SFP_QUIRK_M("OEM", "DFP-34X-2C2", sfp_quirk_2500basex),
+
        SFP_QUIRK_F("Turris", "RTSFP-10", sfp_fixup_rollball),
        SFP_QUIRK_F("Turris", "RTSFP-10G", sfp_fixup_rollball),
 };

so now look how the commits look like for older sfp support

$ git log --oneline -10 drivers/net/phy/sfp.c
e9301af385e7 net: sfp: fix PHY discovery for FS SFP-10G-T module
bb1afee98466 net: sfp: Convert to platform remove callback returning void
2f3ce7a56c6e net: sfp: rework the RollBall PHY waiting code
dd9d75fcf0f4 net: phy: fill in missing MODULE_DESCRIPTION()s
5ffe330e40bd net: sfp: improve Nokia GPON sfp fixup
e184e8609f8c net: sfp: re-implement ignoring the hardware TX_FAULT signal
e27aca3760c0 net: sfp: add quirk for FS's 2.5G copper SFP
d387e34fec40 net: sfp: add quirk for Fiberstone GPON-ONU-34-20BI
f4bf467883f2 net: phy: move marking PHY on SFP module into SFP code
ac2e8e3cfe48 net: sfp: add support for HXSX-ATRI-1 copper SFP+ module

e.g. e27aca3760c0 looks good so far, so use e.g. git show e27aca3760c0 to look how commit message is written (you can copy the text and modify it to match your SFP without the indent added by git show).

git commit -s drivers/net/phy/sfp.c

something like this (signed-off-by is added with the -s switch of git commit):

net: sfp: add quirk for DFP-34X-2C2 GPON ONU SFP

Add a quirk for a GPON SFP that identifies itself as "OEM", "DFP-34X-2C2".
This module's PHY is inaccessible, and can only run at 2500base-X.

then you have the commit like it should be on top of your tree (you can use “git show” without ref to see it)…lets make a patch from it, check this and get maintainers

$ git format-patch HEAD^
0001-net-sfp-add-quirk-for-DFP-34X-2C2-GPON-ONU-SFP.patch

$ scripts/checkpatch.pl 0001-net-sfp-add-quirk-for-DFP-34X-2C2-GPON-ONU-SFP.patch
total: 0 errors, 0 warnings, 0 checks, 9 lines checked

0001-net-sfp-add-quirk-for-DFP-34X-2C2-GPON-ONU-SFP.patch has no obvious style problems and is ready for submission.
$ scripts/get_maintainer.pl 0001-net-sfp-add-quirk-for-DFP-34X-2C2-GPON-ONU-SFP.patch
...

you can add these adresses directly to patch-file or inserting them when running git send-email (maybe needs to be installed - sudo apt install git-email in debian/ubuntu)

to add to Patch-File you can open your created patch in editor of your choice and add To: and Cc: headers between Date and Subject without the part in parenthesis (no blank line). add a comma at the end of line except the last recipient per header and a space before emails not prefixed by email-Header-Tag

so it should look like (maintainers in “To”, all other - except commit signers - in “Cc”):

Date: Sat, 6 Jan 2024 12:31:35 +0100
To: Russell King <email>,
 Andrew Lunn <email>,
 Heiner Kallweit <email>,
 "David S. Miller" <email>,
 Eric Dumazet <email>,
 Jakub Kicinski <email>,
 Paolo Abeni <email>
Cc: [email protected],
 [email protected]
Subject: [PATCH] net: sfp: add quirk for DFP-34X-2C2 GPON ONU SFP

after saving you can send your patch

$ git send-email 0001-net-sfp-add-quirk-for-DFP-34X-2C2-GPON-ONU-SFP.patch
0001-net-sfp-add-quirk-for-DFP-34X-2C2-GPON-ONU-SFP.patch
To whom should the emails be sent (if anyone)? 
Message-ID to be used as In-Reply-To for the first email (if any)?
...
From: Frank Wunderlich <email>
To: Russell King <email>,
	Andrew Lunn <email>,
	Heiner Kallweit <email>,
	"David S. Miller" <email>,
	Eric Dumazet <email>,
	Jakub Kicinski <email>,
	Paolo Abeni <email>
Cc: Frank Wunderlich <enail>,
	[email protected],
	[email protected]
Subject: [PATCH] net: sfp: add quirk for DFP-34X-2C2 GPON ONU SFP
Date: Sat,  6 Jan 2024 12:40:12 +0100
Message-Id: <20240106114012.10761-1-...>
X-Mailer: git-send-email 2.34.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

    The Cc list above has been expanded by additional
    addresses found in the patch commit message. By default
    send-email prompts before sending whenever this occurs.
    This behavior is controlled by the sendemail.confirm
    configuration setting.

    For additional information, run 'git send-email --help'.
    To retain the current behavior, but squelch this message,
    run 'git config --global sendemail.confirm auto'.

Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll):

make sure the To- and Cc-headers are displayed correctly (not merged 2 adresses or similar)

you may need to setup your mail-provider before if not done already

$ nano ~/.gitconfig

and add a section with you data:

[sendemail]
        #from = Name <email> #optional if not matching the senders email
        smtpencryption = ssl
        smtpserver = <mailserver>
        smtpServerPort = 465
        smtpuser = <loginuser>
        composeencoding = UTF-8

Hi Frank, thanks very much for your complete explanationss. This made me clear on actions to be performed. So:

- I made changes on the file deivers/net/phy/sfp.c
- I committed the changes using the format message needed for netdev
- I formatted the patch using git format-patch as per instructions
- I got the list of the recipients to be emailed
- I added the To and the Cc to the file
- I sent the email using git send-email
- Patch showed up at netdev + bpf

Let me know if any further action is needed.

Found patch here: net: sfp: add quirk for DFP-34X-2C2 GPON ONU SFP - Patchwork

Forgot to mention that new versions need a version increasing…you get it when using format-patch with -v flag (-v2 creates version 2 where patches named v2-000*.patch),sorry for telling this.

Also noted that you have a indent beginning with line 2 of message and a typo in “enabled”. Have you make sure your message has max 75 chars per line (checkpatch should report this)?

I guess you will need v3. Don’t worry,nobody is perfect…i made patches with more than 8 versions :slight_smile:

Else once patch is out,wait for comments and fix the problems told you,if unsure ask how you should fix it (but after thinking about it)

Hi Frank, the 75 chars is ok. I saw the typo ater the patch was sent. I think the name of the patch is different from the one posted today. Is it the warning related to the [PATCH] instead of [PATCH net-next] in the subject? In that case what is needed to do? Edit the patch file changing typo and adding net-next and sending? or restart from recreation the patch with git format-patch ?

You should always change the commit and recreate the atch as described above,but first wait for responses of your v2 patch…i would like to know if the comment line is ok or should be dropped

For length…if your commits headline is below 75chars it is ok…the [Patch …] Is dropped when patch is applied…it will also contain the version when you add it…it makes it easier to see changes and drop the old versions from list

As you got response from russel,you can prepare changes he suggested…but i woult wait at least 24h for others to comment

You can set the tree (net-next here) by providing --subject-prefix (iirc,maybe do “git format-patch --help”)

If you post new version please add a version log after the tags (below signed-off-by atm) separated by — line

Something like this:

Signed-off-by: Sergio Palumbo <...>
---
Changes:
V3:
- fix identation of commit message
- add target tree (net-next)
- describe 1000 vs 2500baseX switch
V2:
- add commit message and SoB
- add subsystem prefix
---
 drivers/net/phy/sfp.c | 3

Hi Frank, I got comments from Russel and now is clear changes I have to do. Unfortunately there are now 2 new variables:

  1. I discovered that I have two different versions of the modle DFP-34X-2C2 one with vedor ID “ODI” and another with vendor ID “OEM” so I already compiled a new version of the OWRT for Banana PI R3 with the patch to accomodate both vendor IDs and is correctly working with the 2 modules.
  2. the net-next is closed due to the cycle and Russel told that this it should be the correct tree where to submit the patch. As far as the point 1. Do I need to create a completely new Patch with V1? or do I have to create a V2 includiing also the second? As far as pooint 2 better to wait the net-next is opened again or ppost the new patch in the net tree? When sending a patch with a new version will the patchwork create a new record? Thanks Sergio

1 quirk per patch, you can create a series, but imho it is easier to send them both alone (new one as v1, the old as v3 when changed the things suggested) as they do not depend on each other, right?

no as russel told you, new features are net-next (this is a special handling for the networking subsystem as it is very large subsystem with much patches not clearly fixes or feature-updates).

yes, wait for net-next to be opened…it should be only ~1 week (Monday in 1 week, 2 weeks after release of 6.7 final where the current next-trees are merged into torvalds as 6.8-rc1).

but you can test how to get the net-next-flag in (afair git format-patch --subject-prefix), or do you have already?

Frank, Daniel, can you please help me in the discussion with net-dev group and Russell who does not want to accept the patch for the two modules because he is saying that it has to be tested in case it is used with an linux host working only at 1000base-X and the quirk installed. I tested with Banana PI R3 without the patch and module showing up to linux at 1000base-X only and setting speed at 1000 Mb. I tested with Banana PI R3 with the patch and module showing up at both 1000base-X and 2500base-X setting speed at 2500 Mb I think this is same situation of Huawei MA5671A and Fiberstone GPON-ONU-34-20BI. This two modules require “sfp_quirk_2500basex” and “sfp_fixup_ignore_tx_fault” quirks, while DFP-34X-2C2 only requires “sfp_quirk_2500basex” Is there any possibility that after the quirk there will be any situation where there can be problems? I’m really confused, but I’m sure the patch is working and I tested in all situation I could. Thanks for your help. Sergio

If i understood correctly the module now works in both modes, before it was only 1000base-X, right?

https://patchwork.kernel.org/project/netdevbpf/patch/AS1PR03MB8189AD85CEB6E139F27307D3827F2@AS1PR03MB8189.eurprd03.prod.outlook.com/#25704971

russel still want to avoid that this quirk will be changed another time so it should include all modes the SFP supports. i do not have a ONT SFP and not know much about them, so except the commit-Message itself i cannot help much…when posting to mainline please always refer to mainline code, not openwrt.

for commit-message you still need repost because of the unwanted indentation. Then write which modes the SFP supports from datasheet and maybe which modes you have tested. Together with the main problem (sfp is not working because it needs mode xyz not set in eeprom) in front imho it should be OK.

only one problem i read out of russels comments:

it will cause these modules to regress when they are in the manufacturer default state when used with a host that supports both 1000base-X and 2500base-X

so maybe you now force the SFP to 2500Base-X so it does not work with 1000Base-X which is a regression for other users, i’m not sure, if i understand it correctly and if you can add multiple modes.