Merge pull request #1 from jim3ma/main

update
This commit is contained in:
Christian Schulthess 2022-11-27 14:54:14 +01:00 committed by GitHub
commit c4c8c875ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 610 additions and 56 deletions

189
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,189 @@
#
# Copyright (C) 2022 Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: Build
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
version:
description: 'tag'
required: false
type: string
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [apollolake, broadwell, broadwellnk, denverton, geminilake, v1000]
steps:
- name: Checkout
uses: actions/checkout@main
- name: Init Env
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: Calculate tag
run: |
function increment_version() {
declare -a part=( ${1//\./ } )
declare new
declare -i carry=1
for (( CNTR=${#part[@]}-1; CNTR>=0; CNTR-=1 )); do
len=${#part[CNTR]}
new=$((part[CNTR]+carry))
[ ${#new} -gt $len ] && carry=1 || carry=0
[ $CNTR -gt 0 ] && part[CNTR]=${new: -len} || part[CNTR]=${new}
done
new="${part[*]}"
echo -e "${new// /.}"
}
git clone ${{ github.server_url }}/${{ github.repository }}
cd ${{ github.event.repository.name }}
CUR_TAG=$(git tag -l | tail -1)
NEW_TAG=$(increment_version ${CUR_TAG})
echo CUR_TAG: ${CUR_TAG} NEW_TAG:${NEW_TAG}
if [ ${{ github.event_name }} == 'push' -a ${{ github.ref_type }} == 'tag' ]; then
echo "new_tag=${{ github.ref_name }}" >> $GITHUB_ENV
else
if [ -n "${{ inputs.version }}" ]; then
echo "new_tag=${{ inputs.version }}" >> $GITHUB_ENV
else
echo "new_tag=${NEW_TAG}" >> $GITHUB_ENV
fi
fi
echo 'git_log<<EOF' >> $GITHUB_ENV
git log ${CUR_TAG}..HEAD --oneline >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
cd ..
rm -rf ${{ github.event.repository.name }}
# 修改源文件版本号
sed -i "s/^#define DRV_VERSION.*/#define DRV_VERSION \"$NEW_TAG\"/" igc_main.c
- name: Build igc for ${{matrix.platform}}
run: |
echo new_tag: ${{ env.new_tag }}
mkdir ./${{matrix.platform}} && chmod 777 ./${{matrix.platform}}
sudo docker run -u 1000 --rm -t -v "${PWD}":/input -v "${PWD}/${{matrix.platform}}":/output fbelavenuto/syno-compiler compile-module ${{matrix.platform}}
ls -al ${PWD}/${{matrix.platform}}
tar zcvf igc-${{matrix.platform}}.tgz -C./${{matrix.platform}}/ .
rm -rf ${PWD}/${{matrix.platform}}
- name: Upload firmware to artifacts
uses: actions/upload-artifact@v3
if: (!cancelled())
with:
name: igc
path: ./igc-*.tgz
- name: Upload firmware to releases
uses: softprops/action-gh-release@v1
if: (!cancelled())
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.new_tag }}
body: |
Changes:
${{ env.git_log }}
files: ./igc-*.tgz
ext:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@main
- name: git switch
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
git fetch
git branch -a
git checkout --progress --force main
- name: Init Env
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: download to artifacts
uses: actions/download-artifact@v3
with:
name: igc
path: ./
- name: update exts
run: |
ls -al
git clone ${{ github.server_url }}/${{ github.repository }}
cd ${{ github.event.repository.name }}
NEW_TAG=$(git tag -l | tail -1)
cd ..
rm -rf ${{ github.event.repository.name }}
echo NEW_TAG ${NEW_TAG}
echo "new_tag=${NEW_TAG}" >> $GITHUB_ENV
for i in igc-*.tgz
do
echo ${i}
rm -f ./igc/releases/${i}
cp -f ${i} ./igc/releases/${i}
platform=$(echo ${i} | awk -F'[-.]' '{ print $2 }')
configfile=./igc/releases/${platform}_42218.json
sed -i "s/$(jq -r .files[0].sha256 ${configfile})/$(sha256sum ./igc/releases/igc-${platform}.tgz | awk '{print $1}')/g" ${configfile}
sed -i "s/\"$(jq -r .mod_version ${configfile})\"/\"${NEW_TAG}\"/g" ${configfile}
done
baseurl=$(jq -r .url ./igc/rpext-index.json)
repotmp=${baseurl%/master/*}
oldrepo=${repotmp#*.com/}
echo ${oldrepo}
for i in $(find ./igc -name "*.json")
do
echo ${i}
sed -i "s|${oldrepo}|${{ github.repository }}|g" ${i}
done
# 修改源文件版本号
sed -i "s/^#define DRV_VERSION.*/#define DRV_VERSION \"$NEW_TAG\"/" igc_main.c
- name: Commit and Push
run: |
ischange=false
if [ -n "$(git status -s | grep igc/)" ];then
git add ./igc/*
ischange=true
fi
if [ -n "$(git status -s | grep igc_main.c)" ];then
git add ./igc_main.c
ischange=true
fi
if [ ${ischange} == true ];then
git commit -m "update ${{ env.new_tag }}"
git push -f
fi

View File

@ -2,27 +2,53 @@
> Backport from Linux Kernel v5.12, commit: https://github.com/torvalds/linux/commit/9f4ad9e425a1d3b6a34617b8ea226d56a119a717
## Compatible devices&NICs list
## Known issues
Not all i225/i226 NIC is working.
My device is UGREEN DX4600 with i225v b3, the igc driver is working normally.
* None
## Compatible devices&NICs manifest
I have updated the most pciids of I225/I226 NICs. All I225/I226 NICs should work normal.
If this igc driver is compatible with your devices, you can reply in [this issue](https://github.com/jim3ma/synology-igc/issues/3).
| Device Name | NIC version | Ports |
| --- | --- | --- |
| UGREEN DX4600 | i225v b3 | 2 |
| ROG MAXIMUS XIII HERO | i225v b3 | 2 |
| Motherboard | NIC Version | Device ID | Ports | Firmware Version |
| --- | --- | --- | --- | --- |
| UGREEN DX4600 | I225-V B3 | 8086:15F3| 2 | 1057:8754 |
| ROG MAXIMUS XIII HERO | I225-V B3 | 8086:15F3 | 2 | 1057:8754 |
| CW N5105-N6005-6SATA | I226-V | 8086:125C | 4 | 2014:8877 |
## Prebuild module
Download from https://github.com/fbelavenuto/arpl-modules
Download from https://github.com/jim3ma/synology-igc/tree/main/igc/releases
Eg: https://github.com/fbelavenuto/arpl-modules/blob/main/geminilake-4.4.180/igc.ko
Eg: https://github.com/jim3ma/synology-igc/raw/main/igc/releases/igc-geminilake.tgz
Follow load module action: https://github.com/jim3ma/synology-igc#3-load-module
## Build
## Build in docker
```
mkdir -p output
# avaliable platform:
# apollolake
# broadwell
# broadwellnk
# denverton
# geminilake
# v1000
# I think the platform is not important for building `igc`, change it as your own
PLATFORM=geminilake
docker run -u 1000 --rm -t -v "${PWD}":/input -v "${PWD}/output":/output fbelavenuto/syno-compiler compile-module ${PLATFORM}
```
The `output/igc.ko` is the module.
And then Follow load module actions: https://github.com/jim3ma/synology-igc#3-load-module
## Build in Synology develop environment
### 1. Setup develop environment
@ -78,6 +104,37 @@ ip link set up eth1 # in my machine, the nic name is eth1
## History
### 1.3.0
_Date 2022.11.23_
* fix page refcount not decrease when free page
### 1.2.8
_Date 2022.11.17_
* fix pages leak for IGC_RING_FLAG_RX_3K_BUFFER devices
### 1.2.4 - 1.2.7
Only test for automating build, no code changes
### 1.2.3
_Date 2022.11.16_
This version support i226 with device id 8086:125C, firmware version: 2014:8877
* igc: Remove phy->type checking
* igc: Remove _I_PHY_ID checking
### 1.2.2
_Date 2022.11.15_
* Update defines for compile error
### 1.2.1
_Date 2022.11.03_

View File

@ -201,3 +201,22 @@ static inline bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
*legacy_u32 = src[0];
return retval;
}
static inline int page_ref_sub_and_test(struct page *page, int nr)
{
int ret = atomic_sub_and_test(nr, &page->_count);
return ret;
}
static inline void __page_frag_cache_drain(struct page *page, unsigned int count)
{
if (page_ref_sub_and_test(page, count)) {
unsigned int order = compound_order(page);
// TODO optimize with free_unref_page
// if (order == 0)
// free_unref_page(page);
// else
__free_pages(page, order);
}
}

1
igc.h
View File

@ -244,6 +244,7 @@ void igc_rings_dump(struct igc_adapter *adapter);
void igc_regs_dump(struct igc_adapter *adapter);
extern char igc_driver_name[];
extern char igc_driver_version[];
#define IGC_REGS_LEN 740

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.3.0",
"files": [
{
"name": "igc-apollolake.tgz",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/igc-apollolake.tgz",
"sha256": "748336b991decef10050fe31fdbf5f0098cd6353b126fbaf67de35c09db065a9",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.3.0",
"files": [
{
"name": "igc-broadwell.tgz",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/igc-broadwell.tgz",
"sha256": "2ece3efe1ea6645c47805869b2a4df57d3b663b780933173673afd8bcb16fc75",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.3.0",
"files": [
{
"name": "igc-broadwellnk.tgz",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/igc-broadwellnk.tgz",
"sha256": "30382eaa6ecd2cfc61588a1407d382fee885c80fb3fca1b81fb8cb0f30879925",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.3.0",
"files": [
{
"name": "igc-denverton.tgz",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/igc-denverton.tgz",
"sha256": "64c42b4a17a79b5d8ef9a2cd837aae4914ca417241bac6bf4339d3b03762e1f7",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.3.0",
"files": [
{
"name": "igc-geminilake.tgz",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/igc-geminilake.tgz",
"sha256": "9a08e024567cab65a4c6c1206c3bbef481a15725a34eef8508498195cc4358ac",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
igc/releases/igc-v1000.tgz Normal file

Binary file not shown.

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.3.0",
"files": [
{
"name": "igc-v1000.tgz",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/igc-v1000.tgz",
"sha256": "502776736a295cd470f2dcde50be725254afc65a6bf50da644ade231633a81f1",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

79
igc/rpext-index.json Normal file
View File

@ -0,0 +1,79 @@
{
"id": "jim3ma.igc",
"url": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/rpext-index.json",
"info": {
"name": "igc",
"description": "Adds Intel(R) 2.5G Ethernet Linux Driver Support",
"author_url": "https://github.com/jim3ma/synology-igc",
"packer_url": "https://github.com/jim3ma/synology-igc",
"help_url": "<todo>"
},
"releases": {
"ds3617xs_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3617xs_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3617xs_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3617xs_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3617xs_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3622xsp_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds3622xsp_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds3622xsp_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds3622xsp_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds3622xsp_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds1621p_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1621p_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1621p_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1621p_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1621p_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/v1000_42218.json",
"dva3221_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/denverton_42218.json",
"dva3221_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/denverton_42218.json",
"dva3221_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/denverton_42218.json",
"dva3221_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/denverton_42218.json",
"dva3221_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/denverton_42218.json",
"ds918p_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/apollolake_42218.json",
"ds918p_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/apollolake_42218.json",
"ds918p_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/apollolake_42218.json",
"ds918p_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/apollolake_42218.json",
"ds918p_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/apollolake_42218.json",
"ds920p_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds920p_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds920p_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds920p_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds920p_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42218": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42621": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42661": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42951": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42962": "https://raw.githubusercontent.com/jim3ma/synology-igc/master/igc/releases/geminilake_42218.json",
"endofmodel": "endofurls"
}
}

10
igc/src/check-igc.sh Normal file
View File

@ -0,0 +1,10 @@
#
# Checking modules is loaded
#
echo -n "Loading module igc -> "
if [ `/sbin/lsmod |grep -i igc|wc -l` -gt 0 ] ; then
echo "Module igc loaded succesfully"
else echo "Module igc is not loaded "
fi

View File

@ -187,15 +187,7 @@ static s32 igc_init_phy_params_base(struct igc_hw *hw)
igc_check_for_copper_link(hw);
/* Verify phy id and set remaining function pointers */
switch (phy->id) {
case I225_I_PHY_ID:
phy->type = igc_phy_i225;
break;
default:
ret_val = -IGC_ERR_PHY;
goto out;
}
out:
return ret_val;

View File

@ -415,6 +415,37 @@
#define IGC_RXCSUM_CRCOFL 0x00000800 /* CRC32 offload enable */
#define IGC_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */
/* PCIe PTM Control */
#define IGC_PTM_CTRL_START_NOW BIT(29) /* Start PTM Now */
#define IGC_PTM_CTRL_EN BIT(30) /* Enable PTM */
#define IGC_PTM_CTRL_TRIG BIT(31) /* PTM Cycle trigger */
#define IGC_PTM_CTRL_SHRT_CYC(usec) (((usec) & 0x2f) << 2)
#define IGC_PTM_CTRL_PTM_TO(usec) (((usec) & 0xff) << 8)
#define IGC_PTM_SHORT_CYC_DEFAULT 10 /* Default Short/interrupted cycle interval */
#define IGC_PTM_CYC_TIME_DEFAULT 5 /* Default PTM cycle time */
#define IGC_PTM_TIMEOUT_DEFAULT 255 /* Default timeout for PTM errors */
/* PCIe Digital Delay */
#define IGC_PCIE_DIG_DELAY_DEFAULT 0x01440000
/* PCIe PHY Delay */
#define IGC_PCIE_PHY_DELAY_DEFAULT 0x40900000
#define IGC_TIMADJ_ADJUST_METH 0x40000000
/* PCIe PTM Status */
#define IGC_PTM_STAT_VALID BIT(0) /* PTM Status */
#define IGC_PTM_STAT_RET_ERR BIT(1) /* Root port timeout */
#define IGC_PTM_STAT_BAD_PTM_RES BIT(2) /* PTM Response msg instead of PTM Response Data */
#define IGC_PTM_STAT_T4M1_OVFL BIT(3) /* T4 minus T1 overflow */
#define IGC_PTM_STAT_ADJUST_1ST BIT(4) /* 1588 timer adjusted during 1st PTM cycle */
#define IGC_PTM_STAT_ADJUST_CYC BIT(5) /* 1588 timer adjusted during non-1st PTM cycle */
/* PCIe PTM Cycle Control */
#define IGC_PTM_CYCLE_CTRL_CYC_TIME(msec) ((msec) & 0x3ff) /* PTM Cycle Time (msec) */
#define IGC_PTM_CYCLE_CTRL_AUTO_CYC_EN BIT(31) /* PTM Cycle Control */
/* GPY211 - I225 defines */
#define GPY_MMD_MASK 0xFFFF0000
#define GPY_MMD_SHIFT 16

View File

@ -144,6 +144,7 @@ static void igc_ethtool_get_drvinfo(struct net_device *netdev,
u16 gphy_version;
strscpy(drvinfo->driver, igc_driver_name, sizeof(drvinfo->driver));
strscpy(drvinfo->version, igc_driver_version, sizeof(drvinfo->version));
/* NVM image version is reported as firmware version for i225 device */
hw->nvm.ops.read(hw, IGC_NVM_DEV_STARTER, 1, &nvm_version);

View File

@ -20,7 +20,7 @@
#include "backport_overflow.h"
#define DRV_SUMMARY "Intel(R) 2.5G Ethernet Linux Driver"
#define DRV_VERSION "1.2.1"
#define DRV_VERSION "1.3.0"
#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK)
@ -35,6 +35,8 @@ module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
char igc_driver_name[] = "igc";
char igc_driver_version[] = DRV_VERSION;
static const char igc_driver_string[] = DRV_SUMMARY;
static const char igc_copyright[] =
"Copyright(c) 2018 Intel Corporation. Copyright(c) 2022 Jim Ma.";
@ -374,7 +376,7 @@ static void igc_clean_rx_ring(struct igc_ring *rx_ring)
buffer_info->dma,
igc_rx_pg_size(rx_ring),
DMA_FROM_DEVICE);
__free_page(buffer_info->page);
__page_frag_cache_drain(buffer_info->page, buffer_info->pagecnt_bias);
i++;
if (i == rx_ring->count)
@ -1763,7 +1765,7 @@ static void igc_put_rx_buffer(struct igc_ring *rx_ring,
dma_unmap_page(rx_ring->dev, rx_buffer->dma,
igc_rx_pg_size(rx_ring),
DMA_FROM_DEVICE);
__free_page(rx_buffer->page);
__page_frag_cache_drain(rx_buffer->page, rx_buffer->pagecnt_bias);
}
/* clear contents of rx_buffer */
@ -1801,7 +1803,7 @@ static bool igc_alloc_mapped_page(struct igc_ring *rx_ring,
* there isn't much point in holding memory we can't use
*/
if (dma_mapping_error(rx_ring->dev, dma)) {
__free_page(page);
__free_pages(page, igc_rx_pg_order(rx_ring));
rx_ring->rx_stats.alloc_failed++;
return false;
@ -4142,20 +4144,12 @@ bool igc_has_link(struct igc_adapter *adapter)
* false until the igc_check_for_link establishes link
* for copper adapters ONLY
*/
switch (hw->phy.media_type) {
case igc_media_type_copper:
if (!hw->mac.get_link_status)
return true;
hw->mac.ops.check_for_link(hw);
link_active = !hw->mac.get_link_status;
break;
default:
case igc_media_type_unknown:
break;
}
if (hw->mac.type == igc_i225 &&
hw->phy.id == I225_I_PHY_ID) {
if (hw->mac.type == igc_i225) {
if (!netif_carrier_ok(adapter->netdev)) {
adapter->flags &= ~IGC_FLAG_NEED_LINK_UPDATE;
} else if (!(adapter->flags & IGC_FLAG_NEED_LINK_UPDATE)) {

View File

@ -249,8 +249,7 @@ static s32 igc_phy_setup_autoneg(struct igc_hw *hw)
return ret_val;
}
if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
hw->phy.id == I225_I_PHY_ID) {
if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
/* Read the MULTI GBT AN Control Register - reg 7.32 */
ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
MMD_DEVADDR_SHIFT) |
@ -390,8 +389,7 @@ static s32 igc_phy_setup_autoneg(struct igc_hw *hw)
ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
mii_1000t_ctrl_reg);
if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
hw->phy.id == I225_I_PHY_ID)
if (phy->autoneg_mask & ADVERTISE_2500_FULL)
ret_val = phy->ops.write_reg(hw,
(STANDARD_AN_REG_MASK <<
MMD_DEVADDR_SHIFT) |

View File

@ -219,6 +219,27 @@
#define IGC_TXSTMPL 0x0B618 /* Tx timestamp value Low - RO */
#define IGC_TXSTMPH 0x0B61C /* Tx timestamp value High - RO */
/* PCIe Registers */
#define IGC_PTM_CTRL 0x12540 /* PTM Control */
#define IGC_PTM_STAT 0x12544 /* PTM Status */
#define IGC_PTM_CYCLE_CTRL 0x1254C /* PTM Cycle Control */
/* PTM Time registers */
#define IGC_PTM_T1_TIM0_L 0x12558 /* T1 on Timer 0 Low */
#define IGC_PTM_T1_TIM0_H 0x1255C /* T1 on Timer 0 High */
#define IGC_PTM_CURR_T2_L 0x1258C /* Current T2 Low */
#define IGC_PTM_CURR_T2_H 0x12590 /* Current T2 High */
#define IGC_PTM_PREV_T2_L 0x12584 /* Previous T2 Low */
#define IGC_PTM_PREV_T2_H 0x12588 /* Previous T2 High */
#define IGC_PTM_PREV_T4M1 0x12578 /* T4 Minus T1 on previous PTM Cycle */
#define IGC_PTM_CURR_T4M1 0x1257C /* T4 Minus T1 on this PTM Cycle */
#define IGC_PTM_PREV_T3M2 0x12580 /* T3 Minus T2 on previous PTM Cycle */
#define IGC_PTM_TDELAY 0x12594 /* PTM PCIe Link Delay */
#define IGC_PCIE_DIG_DELAY 0x12550 /* PCIe Digital Delay */
#define IGC_PCIE_PHY_DELAY 0x12554 /* PCIe PHY Delay */
/* Management registers */
#define IGC_MANC 0x05820 /* Management Control - RW */