{"id":2381,"date":"2015-07-30T12:46:56","date_gmt":"2015-07-30T16:46:56","guid":{"rendered":"http:\/\/www.braindeadprojects.com\/blog\/?p=2381"},"modified":"2015-07-30T12:51:39","modified_gmt":"2015-07-30T16:51:39","slug":"startech-pex10000sfp-and-locating-modules-in-the-linux-source","status":"publish","type":"post","link":"http:\/\/www.braindeadprojects.com\/blog\/what\/startech-pex10000sfp-and-locating-modules-in-the-linux-source\/","title":{"rendered":"StarTech PEX10000SFP and locating modules in the Linux source."},"content":{"rendered":"<p>A friend contacted me recently with issues getting a new <a href=\"http:\/\/www.newegg.com\/Product\/Product.aspx?Item=N82E16833114135&amp;cm_re=PEX10000SFP-_-33-114-135-_-Product\" target=\"_blank\">StarTech PCIe card with SFP+ slot<\/a> working. He had hoped the card would work out of the box&#8230; but sometimes that doesn&#8217;t happen.<\/p>\n<figure id=\"attachment_2401\" aria-describedby=\"caption-attachment-2401\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/PEX10000SFP.main_.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2401\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/PEX10000SFP.main_-300x300.jpg\" alt=\"PEX10000SFP\" width=\"300\" height=\"300\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/PEX10000SFP.main_-300x300.jpg 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/PEX10000SFP.main_-150x150.jpg 150w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/PEX10000SFP.main_-144x144.jpg 144w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/PEX10000SFP.main_.jpg 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-2401\" class=\"wp-caption-text\">Our test subject: The PEX10000SFP.<\/figcaption><\/figure>\n<p>First off, let&#8217;s have a look at the PCI bus and see what the card has for a device ID number:<\/p>\n<blockquote><p>edge:~# lspci -k<\/p>\n<p>&#8230;<\/p>\n<p>01:06.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD\/ATI] ES1000 (rev 02)<br \/>\nSubsystem: Super Micro Computer Inc Device 1711<br \/>\n<strong>Kernel driver in use: radeon<\/strong><br \/>\n03:00.0 Ethernet controller: Tehuti Networks Ltd. Device <strong>4024<\/strong><br \/>\nSubsystem: Tehuti Networks Ltd. Device 3015<br \/>\nedge:~#<\/p><\/blockquote>\n<p>As you can see, the VGA controller has a kernel module loaded and associated with it (<strong>radeon<\/strong>), however the Startech (Tehuti Networks) controller does not. With the device ID number in hand (<strong>0x4024<\/strong>), we can now look for it in the kernel source. If you don&#8217;t already have a copy of the Linux source, make sure to grab one via git:<\/p>\n<blockquote><p>edge:~# mkdir ~\/git<\/p>\n<p>edge:~# cd ~\/git<\/p>\n<p>edge: git# git clone git:\/\/git.kernel.org\/pub\/scm\/linux\/kernel\/git\/torvalds\/linux.git linux<\/p>\n<p>&#8230;<\/p>\n<p>edge: git# cd ~\/git\/linux<\/p>\n<p>edge:~# grep 0x4024 include\/linux\/pci_ids.h<\/p>\n<p>edge:~#<\/p><\/blockquote>\n<p>Hmm&#8230;not a single hit. Let&#8217;s search for anything Tehuti related:<\/p>\n<blockquote><p>edge:~# grep DEVICE_ID_TEHUTI include\/linux\/pci_ids.h<br \/>\n#define PCI_DEVICE_ID_TEHUTI_3009 0x3009<br \/>\n#define PCI_DEVICE_ID_TEHUTI_3010 0x3010<br \/>\n#define PCI_DEVICE_ID_TEHUTI_3014 0x3014<\/p><\/blockquote>\n<p>So there&#8217;s device ID&#8217;s 0x3009, 0x3010, and 0x3014&#8230; but no 0x4024. So it doesn&#8217;t appear to be present in the source tree. But a quick search on the vendor website and the drivers are readily available for <a href=\"http:\/\/sgcdn.startech.com\/005329\/media\/sets\/Tehuti_TN4010_Drivers\/Tehuti_TN4010.zip\">download<\/a> &#8211; great news, but the running kernel (3.16.0-4-amd64) isn&#8217;t supported:<\/p>\n<blockquote><p>(From the Tehuti_TN4010.zip Readme file)<\/p>\n<p>&#8220;- Supported kernels: <strong>2.6.24 &#8211; 3.14.x&#8221;<\/strong><\/p>\n<p>edge:~# uname -r<\/p>\n<p><strong>3.16.0-4-amd64<\/strong><\/p><\/blockquote>\n<p>And when trying to compile it, it fails:<\/p>\n<blockquote><p>&#8230;<\/p>\n<p>\/var\/tmp\/Linux\/tn40.c: In function \u2018bdx_ethtool_ops\u2019:<br \/>\n<strong>\/var\/tmp\/Linux\/tn40.c:4021:5: error: implicit declaration of function \u2018SET_ETHTOOL_OPS\u2019 [-Werror=implicit-function-declaration]<\/strong><br \/>\n<strong> SET_ETHTOOL_OPS(netdev, &amp;bdx_ethtool_ops);<\/strong><br \/>\n^<br \/>\ncc1: some warnings being treated as errors<br \/>\n<strong>\/usr\/src\/linux-headers-3.16.0-4-common\/scripts\/Makefile.build:262: recipe for target &#8216;\/var\/tmp\/Linux\/tn40.o&#8217; failed<\/strong><\/p><\/blockquote>\n<p>So, let&#8217;s dig around and see if we can find the SET_ETHTOOL_OPS macro in the changelogs:<\/p>\n<blockquote><p>edge: git# cd ~\/git\/linux<\/p>\n<p>edge:git# git log -S &#8220;#define SET_ETHTOOL_OPS&#8221;<\/p>\n<p>&#8230;<\/p>\n<p>commit 7ad24ea4bf620a32631d7b3069c3e30c078b0c3e<br \/>\nAuthor: Wilfried Klaebe &lt;w-lkml@lebenslange-mailadresse.de&gt;<br \/>\nDate: Sun May 11 00:12:32 2014 +0000<\/p>\n<p>net: get rid of SET_ETHTOOL_OPS<\/p>\n<p>net: get rid of SET_ETHTOOL_OPS<\/p>\n<p><strong>Dave Miller mentioned he&#8217;d like to see SET_ETHTOOL_OPS gone.<\/strong><br \/>\n<strong> This does that.<\/strong><\/p>\n<p>Mostly done via coccinelle script:<br \/>\n@@<br \/>\nstruct ethtool_ops *ops;<br \/>\nstruct net_device *dev;<br \/>\n@@<br \/>\n&#8211; SET_ETHTOOL_OPS(dev, ops);<br \/>\n+ dev-&gt;ethtool_ops = ops;<\/p>\n<p>Compile tested only, but I&#8217;d seriously wonder if this broke anything.<\/p>\n<p>Suggested-by: Dave Miller &lt;davem@davemloft.net&gt;<br \/>\nSigned-off-by: Wilfried Klaebe &lt;w-lkml@lebenslange-mailadresse.de&gt;<br \/>\nAcked-by: Felipe Balbi &lt;balbi@ti.com&gt;<br \/>\nSigned-off-by: David S. Miller &lt;davem@davemloft.net&gt;<\/p><\/blockquote>\n<p>Well, there&#8217;s the reason it won&#8217;t compile &#8211; the macro was recently removed. So how do we get the module to compile? Simple &#8211; just update the source to perform the same action that the macro used to do. Or to make things easy (although it&#8217;s overkill for a patch file), just apply a <a href=\"http:\/\/www.braindeadprojects.com\/src\/tn40.c.ethtool_ops.patch\" target=\"_blank\">truly braindead patch<\/a>:<\/p>\n<blockquote><p>edge: tmp# wget http:\/\/www.braindeadprojects.com\/src\/tn40.c.ethtool_ops.patch<\/p>\n<p>edge: tmp# patch -p0 &lt; tn40.c.ethtool_ops.patch<\/p>\n<p>patching file Linux\/tn40.c<\/p><\/blockquote>\n<p>And with a quick recompile, install and modprobe, we now have a working Startech card in our system:<\/p>\n<blockquote><p>edge: tmp# modprobe tn40xx<\/p>\n<p>&#8230;<\/p>\n<p>edge: tmp# lspci -k<\/p>\n<p>&#8230;<\/p>\n<p>03:00.0 Ethernet controller: Tehuti Networks Ltd. Device 4024<br \/>\nSubsystem: Tehuti Networks Ltd. Device 3015<br \/>\n<strong>Kernel driver in use: tn40xx<\/strong><\/p>\n<p>&#8230;<\/p>\n<p>edge: tmp## ethtool eth2<br \/>\nSettings for eth2:<br \/>\nSupported ports: [ FIBRE ]<br \/>\nSupported link modes: 10000baseT\/Full<br \/>\nSupported pause frame use: Symmetric<br \/>\nSupports auto-negotiation: No<br \/>\nAdvertised link modes: 10000baseT\/Full<br \/>\nAdvertised pause frame use: Symmetric<br \/>\nAdvertised auto-negotiation: No<br \/>\nSpeed: Unknown!<br \/>\nDuplex: Full<br \/>\nPort: FIBRE<br \/>\nPHYAD: 0<br \/>\nTransceiver: external<br \/>\nAuto-negotiation: off<br \/>\nLink detected: no<\/p><\/blockquote>\n<p>I&#8217;ve passed along the information to Startech. It&#8217;s a pretty simple fix, so I&#8217;d expect to see it in their distributed source code soon. But in the meantime, if you&#8217;re working with this card and unable to get the kernel module to build, see if this solution will work for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A friend contacted me recently with issues getting a new StarTech PCIe card with SFP+ slot working. He had hoped the card would work out of the box&#8230; but sometimes that doesn&#8217;t happen. First off, let&#8217;s have a look at the PCI bus and see what the card has for a device ID number: edge:~# &hellip; <a href=\"http:\/\/www.braindeadprojects.com\/blog\/what\/startech-pex10000sfp-and-locating-modules-in-the-linux-source\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">StarTech PEX10000SFP and locating modules in the Linux source.<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,43,1],"tags":[],"class_list":["post-2381","post","type-post","status-publish","format-standard","hentry","category-c","category-fiber","category-what"],"_links":{"self":[{"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/posts\/2381"}],"collection":[{"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/comments?post=2381"}],"version-history":[{"count":45,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/posts\/2381\/revisions"}],"predecessor-version":[{"id":2427,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/posts\/2381\/revisions\/2427"}],"wp:attachment":[{"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/media?parent=2381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/categories?post=2381"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/tags?post=2381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}