Merge branch 'devel-1.6' into 'stable-1.6'
Preparations for version 1.6 See merge request etherlab.org/ethercat!114
This commit is contained in:
commit
8330bca82c
|
|
@ -6,15 +6,65 @@ stages:
|
|||
- test
|
||||
- doc
|
||||
- deploy
|
||||
- release
|
||||
|
||||
variables:
|
||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ethercat/${CI_COMMIT_TAG}"
|
||||
|
||||
rtai:
|
||||
stage: build
|
||||
image: registry.gitlab.com/etherlab.org/build-container-factory/ethercat-kernels:rtai
|
||||
|
||||
script:
|
||||
- ./bootstrap
|
||||
- ./configure --enable-8139too --enable-igb --enable-e100 --with-linux-dir=/usr/src/linux-obj/x86_64/0404rtai --enable-rtdm --with-rtai-dir=/usr
|
||||
- make -j8 all modules
|
||||
|
||||
xenomai2:
|
||||
stage: build
|
||||
image: registry.gitlab.com/etherlab.org/build-container-factory/ethercat-kernels:xenomai2
|
||||
|
||||
script:
|
||||
- ./bootstrap
|
||||
- ./configure --disable-8139too --with-linux-dir=/usr/src/linux-obj/x86_64/0318xenomai2 --enable-rtdm --with-xenomai-dir=/usr
|
||||
- make -j8 all modules
|
||||
|
||||
kernel 3.4:
|
||||
stage: build
|
||||
image: registry.gitlab.com/etherlab.org/build-container-factory/ethercat-kernels:k3.4-rt145
|
||||
script:
|
||||
- ./bootstrap
|
||||
- ./configure --enable-8139too --enable-e100 --enable-e1000 --enable-e1000e --enable-r8169 --with-linux-dir=/usr/src/linux-obj/x86_64/0304rt
|
||||
- make -j8 all modules
|
||||
|
||||
xenomai3:
|
||||
stage: build
|
||||
image: registry.gitlab.com/etherlab.org/build-container-factory/ethercat-kernels:xenomai3
|
||||
|
||||
script:
|
||||
- ./bootstrap
|
||||
- ./configure --enable-8139too --enable-igb --enable-e100 --with-linux-dir=/usr/src/linux-obj/x86_64/0510xenomai3 --enable-rtdm --with-xenomai-dir=/usr
|
||||
- make -j8 all modules
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
||||
script:
|
||||
- ./bootstrap
|
||||
- ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too --enable-tty --with-devices=2 --enable-ccat
|
||||
- ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --enable-tty --with-devices=2 --enable-ccat
|
||||
- make -j8 all modules
|
||||
- make -C lib symbol-version-check
|
||||
- make DISTCHECK_CONFIGURE_FLAGS="--with-linux-dir=/usr/src/linux-obj/$(uname -i)/default" distcheck
|
||||
- make dist
|
||||
- mkdir test_dist && cd test_dist && tar xzf ../ethercat-*.tar.gz && cd ethercat-*/
|
||||
- mkdir build && cd build
|
||||
- ../configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too --enable-tty --with-devices=2 --enable-ccat
|
||||
- make -j8 all modules
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- ethercat-*.tar.gz
|
||||
- ethercat-*.tar.bz2
|
||||
|
||||
# Build ethercat tool subcommand help output for documentation
|
||||
commands:
|
||||
|
|
@ -54,7 +104,7 @@ doxygen:
|
|||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
script:
|
||||
- ./bootstrap
|
||||
- ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too --enable-tty --with-devices=2 --enable-ccat
|
||||
- ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --enable-tty --with-devices=2 --enable-ccat
|
||||
- make doc
|
||||
- mv doxygen-output/html/ html/
|
||||
artifacts:
|
||||
|
|
@ -69,7 +119,7 @@ pdf:
|
|||
image: registry.gitlab.com/etherlab.org/build-container-factory/leap-15.3:texlive
|
||||
script:
|
||||
- cd documentation
|
||||
- git show -s --format="\def\revision{%h}\def\gitversion{%(describe)}\def\gitauthor{%an}\def\isodate#1-#2-#3x{\day=#3 \month=#2 \year=#1}\isodate %csx" HEAD > git.tex
|
||||
- git show -s --format="\def\revision{%h}\def\gitversion{%(describe)}\def\gittag{%(describe:abbrev=0)}\def\gitauthor{%an}\def\isodate#1-#2-#3x{\day=#3 \month=#2 \year=#1}\isodate %csx" HEAD > git.tex
|
||||
- make
|
||||
- make index
|
||||
- make
|
||||
|
|
@ -83,12 +133,45 @@ pdf:
|
|||
update docs server:
|
||||
stage: deploy
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "stable-1.5" && $CI_PROJECT_NAMESPACE == "etherlab.org"
|
||||
- if: $CI_COMMIT_BRANCH == "stable-1.6" && $CI_PROJECT_NAMESPACE == "etherlab.org"
|
||||
trigger: etherlab.org/docs
|
||||
|
||||
upload:
|
||||
stage: deploy
|
||||
image: curlimages/curl:latest
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
|
||||
dependencies:
|
||||
- "build"
|
||||
script:
|
||||
- echo "$CI_COMMIT_TAG" | grep -qE '^[0-9]+(\.[0-9]+){2}$'
|
||||
- |
|
||||
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
|
||||
--header "Content-Type: application/gzip" \
|
||||
--fail-with-body \
|
||||
--upload-file "ethercat-${CI_COMMIT_TAG}.tar.gz" \
|
||||
"${PACKAGE_REGISTRY_URL}/ethercat-${CI_COMMIT_TAG}.tar.gz"
|
||||
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
|
||||
--header "Content-Type: application/x-bzip2" \
|
||||
--fail-with-body \
|
||||
--upload-file "ethercat-${CI_COMMIT_TAG}.tar.bz2" \
|
||||
"${PACKAGE_REGISTRY_URL}/ethercat-${CI_COMMIT_TAG}.tar.bz2"
|
||||
|
||||
|
||||
release:
|
||||
stage: release
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
|
||||
script:
|
||||
- |
|
||||
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
||||
--assets-link "{\"name\":\"ethercat.tar.bz2\",\"url\":\"${PACKAGE_REGISTRY_URL}/ethercat-${CI_COMMIT_TAG}.tar.bz2\",\"link_type\":\"package\",\"filepath\":\"/dist-tarballs/ethercat.tar.bz2\"}" \
|
||||
--assets-link "{\"name\":\"ethercat.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/ethercat-${CI_COMMIT_TAG}.tar.gz\",\"link_type\":\"package\",\"filepath\":\"/dist-tarballs/ethercat.tar.gz\"}"
|
||||
|
||||
# from 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml', but on all branches
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_MERGE_REQUEST_IID
|
||||
- if: $CI_COMMIT_TAG
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "stable-1.5"
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "stable-1.6"
|
||||
|
|
|
|||
|
|
@ -193,7 +193,8 @@ TAB_SIZE = 4
|
|||
# will result in a user-defined paragraph with heading "Side Effects:".
|
||||
# You can put \n's in the value part of an alias to insert newlines.
|
||||
|
||||
ALIASES =
|
||||
ALIASES = \
|
||||
"apiusage{1}=@par API Usage^^@ref apiusage \"\1\""
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding
|
||||
|
|
@ -915,7 +916,9 @@ HTML_EXTRA_STYLESHEET = @top_srcdir@/doxygen-layout/style/custom.css \
|
|||
# files. In the HTML_STYLESHEET file, use the file name only. Also note that
|
||||
# the files will be copied as-is; there are no commands or markers available.
|
||||
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_EXTRA_FILES = @top_srcdir@/doxygen-layout/images/etherlab-128.png \
|
||||
@top_srcdir@/doxygen-layout/images/favicon.ico \
|
||||
@top_srcdir@/doxygen-layout/images/favicon.svg
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
|
||||
# Doxygen will adjust the colors in the style sheet and background images
|
||||
|
|
|
|||
19
Kbuild.in
19
Kbuild.in
|
|
@ -1,6 +1,4 @@
|
|||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# $Id$
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
#
|
||||
|
|
@ -19,15 +17,9 @@
|
|||
# with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
# vi: syntax=make
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
obj-m := examples/ master/ devices/
|
||||
|
||||
|
|
@ -35,4 +27,9 @@ ifeq (@ENABLE_TTY@,1)
|
|||
obj-m += tty/
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
ifeq (@ENABLE_RTAI@, 1)
|
||||
KBUILD_EXTRA_SYMBOLS := \
|
||||
@RTAI_MODULE_DIR@/Module.symvers
|
||||
endif
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -17,12 +17,6 @@
|
|||
# with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
include $(top_srcdir)/Makefile.kbuild
|
||||
|
|
@ -30,7 +24,6 @@ include $(top_srcdir)/Makefile.kbuild
|
|||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
AM_DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--disable-8139too \
|
||||
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
|
||||
|
||||
SUBDIRS = \
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# ```
|
||||
# include $(top_srcdir)/Makefile.kbuild
|
||||
# ```
|
||||
KBUILD = $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(abs_srcdir)" INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)"
|
||||
KBUILD = $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(abs_builddir)" INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)"
|
||||
|
||||
|
||||
modules:
|
||||
|
|
|
|||
11
NEWS
11
NEWS
|
|
@ -1,13 +1,20 @@
|
|||
-------------------------------------------------------------------------------
|
||||
|
||||
$Id$
|
||||
|
||||
vim: spelllang=en spell tw=78
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Changes in 1.6.0:
|
||||
|
||||
* Added all native Ethernet drivers for kernels 5.14 and 6.1.
|
||||
* Dropped support for kernels < 3.0.
|
||||
* Allow to query the scanning progress via API.
|
||||
* Added EoE set IP command via command-line-tool.
|
||||
* Changed the default AL state change timeout from 5 to 10 s.
|
||||
|
||||
Changes since 1.5.2:
|
||||
|
||||
* Added feature flag API.
|
||||
* Fixed FoE timeout calculation bug.
|
||||
|
||||
Changes in 1.5.2:
|
||||
|
|
|
|||
13
README.EoE
13
README.EoE
|
|
@ -1,10 +1,8 @@
|
|||
-------------------------------------------------------------------------------
|
||||
|
||||
$Id$
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
vim: spelllang=en spell tw=78
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
This file shall give additional information on how to set up a network
|
||||
environment with Ethernet over EtherCAT devices.
|
||||
|
|
@ -12,8 +10,9 @@ environment with Ethernet over EtherCAT devices.
|
|||
A virtual network interface will appear for every EoE-capable slave. The
|
||||
interface naming scheme is either eoeXsY, where X is the master index and Y is
|
||||
the slave's ring position, or (if the slave has an alias set) eoeXaZ, where Z
|
||||
is the (decimal) alias address. Please provide a network configuration file for
|
||||
any of these interfaces. On SUSE systems, these can look like the following:
|
||||
is the (decimal) alias address. Please provide a network configuration file
|
||||
for any of these interfaces. On SUSE systems, these can look like the
|
||||
following:
|
||||
|
||||
/etc/sysconfig/network/ifcfg-eoe0s14:
|
||||
IPADDRESS=10.0.0.14/8
|
||||
|
|
@ -26,4 +25,4 @@ necessary. Instead, copy the file script/ifup-eoe.sh to your systems if-up.d
|
|||
directory (on SUSE, this is /etc/sysconfig/network/if-up.d), and customize the
|
||||
included variables.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------
|
||||
|
|
|
|||
13
README.md
13
README.md
|
|
@ -20,10 +20,10 @@ information, see http://etherlab.org/en/ethercat.
|
|||
or contact
|
||||
|
||||
>>>
|
||||
Dipl.-Ing. (FH) Florian Pose <fp@igh.de>
|
||||
Ingenieurgemeinschaft IgH
|
||||
Nordsternstraße 66
|
||||
D-45329 Essen
|
||||
Dipl.-Ing. (FH) Florian Pose <fp@igh.de>
|
||||
Ingenieurgemeinschaft IgH
|
||||
Nordsternstraße 66
|
||||
D-45329 Essen
|
||||
http://igh.de
|
||||
>>>
|
||||
|
||||
|
|
@ -101,11 +101,6 @@ You should have received a copy of the GNU General Public License along with
|
|||
the IgH EtherCAT Master; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
---
|
||||
|
||||
The license mentioned above concerns the source code only. Using the EtherCAT
|
||||
technology and brand is only permitted in compliance with the industrial
|
||||
property and similar rights of Beckhoff Automation GmbH.
|
||||
|
||||
# Coding Style
|
||||
|
||||
|
|
|
|||
7
TODO
7
TODO
|
|
@ -2,12 +2,15 @@
|
|||
|
||||
EtherCAT master TODO
|
||||
|
||||
$Id$
|
||||
|
||||
vim700: spelllang=en spell
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
See issues on
|
||||
https://gitlab.com/etherlab.org/ethercat/-/issues
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Future issues:
|
||||
|
||||
* Improve redundancy_active doc in ecrt.h.
|
||||
|
|
|
|||
14
bootstrap
14
bootstrap
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# $Id$
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
#
|
||||
|
|
@ -20,13 +18,7 @@
|
|||
# with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
|
@ -39,4 +31,4 @@ mkdir -p m4
|
|||
|
||||
autoreconf -i
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
|||
306
configure.ac
306
configure.ac
|
|
@ -1,6 +1,6 @@
|
|||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006-2023 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
# Copyright (C) 2006-2024 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
#
|
||||
# This file is part of the IgH EtherCAT Master.
|
||||
#
|
||||
|
|
@ -17,13 +17,7 @@
|
|||
# with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
|
|
@ -37,7 +31,7 @@ AC_PREREQ(2.59)
|
|||
# - Update version number below
|
||||
# - make dist-bzip2
|
||||
#
|
||||
AC_INIT([ethercat],[1.5.2],[fp@igh.de])
|
||||
AC_INIT([ethercat],[1.6.0],[fp@igh.de])
|
||||
AC_CONFIG_AUX_DIR([autoconf])
|
||||
AM_INIT_AUTOMAKE([-Wall -Wno-override -Werror dist-bzip2 subdir-objects foreign])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
|
@ -48,18 +42,18 @@ AC_PROG_SED
|
|||
PKG_PROG_PKG_CONFIG
|
||||
PKG_INSTALLDIR()
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Global
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AM_PROG_CC_C_O
|
||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
AC_PROG_CXX
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Kernel modules
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to build kernel modules])
|
||||
|
||||
|
|
@ -72,7 +66,7 @@ AC_ARG_ENABLE([kernel],
|
|||
;;
|
||||
no) enablekernel=0
|
||||
;;
|
||||
*) AC_MSG_ERROR([Invalid value for --enable-generic])
|
||||
*) AC_MSG_ERROR([Invalid value for --enable-kernel])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
|
|
@ -88,9 +82,9 @@ fi
|
|||
AM_CONDITIONAL(ENABLE_KERNEL, test "x$enablekernel" = "x1")
|
||||
AC_SUBST(ENABLE_KERNEL,[$enablekernel])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Linux sources
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
if test "x$enablekernel" = "x1"; then
|
||||
|
||||
|
|
@ -152,9 +146,9 @@ AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $linuxversion)])
|
|||
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Linux module installation subdirectory
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_WITH([module-dir],
|
||||
AC_HELP_STRING(
|
||||
|
|
@ -169,9 +163,40 @@ AC_SUBST(INSTALL_MOD_DIR,[$moddir])
|
|||
AC_MSG_CHECKING([for Linux modules installation directory])
|
||||
AC_MSG_RESULT([$INSTALL_MOD_DIR])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Native driver resource (de)allocation verifying
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to verify native driver resources])
|
||||
|
||||
AC_ARG_ENABLE([driver-resource-verifying],
|
||||
AS_HELP_STRING([--enable-driver-resource-verifying],
|
||||
[Verify resource (de-)allocation in native drivers]),
|
||||
[
|
||||
case "${enableval}" in
|
||||
yes) enableverifying=1
|
||||
;;
|
||||
no) enableverifying=0
|
||||
;;
|
||||
*) AC_MSG_ERROR([Invalid value for --enable-driver-resource-verifying])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enableverifying=0]
|
||||
)
|
||||
|
||||
if test "x$enableverifying" = "x1"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_DRIVER_RESOURCE_VERIFYING, test "x$enableverifying" = "x1")
|
||||
AC_SUBST(ENABLE_DRIVER_RESOURCE_VERIFYING,[$enableverifying])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generic Ethernet driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([generic],
|
||||
AS_HELP_STRING([--enable-generic],
|
||||
|
|
@ -192,9 +217,9 @@ AC_ARG_ENABLE([generic],
|
|||
AM_CONDITIONAL(ENABLE_GENERIC, test "x$enablegeneric" = "x1")
|
||||
AC_SUBST(ENABLE_GENERIC,[$enablegeneric])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# 8139too driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([8139too],
|
||||
AS_HELP_STRING([--enable-8139too],
|
||||
|
|
@ -209,7 +234,7 @@ AC_ARG_ENABLE([8139too],
|
|||
;;
|
||||
esac
|
||||
],
|
||||
[enable8139too=$enablekernel]
|
||||
[enable8139too=0] # disabled by default
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_8139TOO, test "x$enable8139too" = "x1")
|
||||
|
|
@ -247,9 +272,9 @@ fi
|
|||
|
||||
AC_SUBST(KERNEL_8139TOO,[$kernel8139too])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# e100 driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([e100],
|
||||
AS_HELP_STRING([--enable-e100],
|
||||
|
|
@ -302,9 +327,9 @@ fi
|
|||
|
||||
AC_SUBST(KERNEL_E100,[$kernele100])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# e1000 driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([e1000],
|
||||
AS_HELP_STRING([--enable-e1000],
|
||||
|
|
@ -357,9 +382,9 @@ fi
|
|||
|
||||
AC_SUBST(KERNEL_E1000,[$kernele1000])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# e1000e driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([e1000e],
|
||||
AS_HELP_STRING([--enable-e1000e],
|
||||
|
|
@ -432,9 +457,9 @@ fi
|
|||
AC_SUBST(KERNEL_E1000E,[$kernele1000e])
|
||||
AC_SUBST(E1000E_LAYOUT, [$e1000elayout])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# genet driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([genet],
|
||||
AS_HELP_STRING([--enable-genet],
|
||||
|
|
@ -480,9 +505,9 @@ fi
|
|||
|
||||
AC_SUBST(KERNEL_GENET,[$kernelgenet])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# igb driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([igb],
|
||||
AS_HELP_STRING([--enable-igb],
|
||||
|
|
@ -527,9 +552,10 @@ if test "x${enableigb}" = "x1"; then
|
|||
fi
|
||||
|
||||
AC_SUBST(KERNEL_IGB,[$kerneligb])
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# igc driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([igc],
|
||||
AS_HELP_STRING([--enable-igc],
|
||||
|
|
@ -574,9 +600,9 @@ fi
|
|||
|
||||
AC_SUBST(KERNEL_IGC,[$kerneligc])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# r8169 driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([r8169],
|
||||
AS_HELP_STRING([--enable-r8169],
|
||||
|
|
@ -638,9 +664,83 @@ fi
|
|||
|
||||
AC_SUBST(KERNEL_R8169,[$kernel_r8169])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# stmmac-pci and dwmac-intel driver
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
enablestmmac=0
|
||||
|
||||
AC_ARG_ENABLE([stmmac-pci],
|
||||
AS_HELP_STRING([--enable-stmmac-pci],
|
||||
[Enable stmmac driver]),
|
||||
[
|
||||
case "${enableval}" in
|
||||
yes) enablestmmacpci=1
|
||||
enablestmmac=1
|
||||
;;
|
||||
no) enablestmmacpci=0
|
||||
;;
|
||||
*) AC_MSG_ERROR([Invalid value for --enable-stmmac])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enablestmmacpci=0] # disabled by default
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_STMMACPCI, test "x$enablestmmacpci" = "x1")
|
||||
AC_SUBST(ENABLE_STMMACPCI,[$enablestmmacpci])
|
||||
|
||||
AC_ARG_ENABLE([dwmac-intel],
|
||||
AS_HELP_STRING([--enable-dwmac-intel],
|
||||
[Enable stmmac driver]),
|
||||
[
|
||||
case "${enableval}" in
|
||||
yes) enabledwmacintel=1
|
||||
enablestmmac=1
|
||||
;;
|
||||
no) enabledwmacintel=0
|
||||
;;
|
||||
*) AC_MSG_ERROR([Invalid value for --enable-stmmac])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enabledwmacintel=0] # disabled by default
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_DWMACINTEL, test "x$enabledwmacintel" = "x1")
|
||||
AC_SUBST(ENABLE_DWMACINTEL,[$enabledwmacintel])
|
||||
|
||||
AM_CONDITIONAL(ENABLE_STMMAC, test "x$enablestmmac" = "x1")
|
||||
AC_SUBST(ENABLE_STMMAC, [$enablestmmac])
|
||||
|
||||
AC_ARG_WITH([stmmac-kernel],
|
||||
AC_HELP_STRING(
|
||||
[--with-stmmac-kernel=<X.Y.Z>],
|
||||
[stmmac kernel (only if differing)]
|
||||
),
|
||||
[
|
||||
kernelstmmac=[$withval]
|
||||
],
|
||||
[
|
||||
kernelstmmac=$linuxversion
|
||||
]
|
||||
)
|
||||
|
||||
if test "x${enablestmmac}" = "x1"; then
|
||||
AC_MSG_CHECKING([for kernel for stmmac driver])
|
||||
|
||||
if test ! -f "${srcdir}/devices/stmmac/stmmac-${kernelstmmac}-orig.h"; then
|
||||
AC_MSG_ERROR([kernel $kernelstmmac not available for stmmac driver!])
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$kernelstmmac])
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_STMMAC,[$kernelstmmac])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# CCAT driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to build the CCAT driver])
|
||||
|
||||
|
|
@ -669,9 +769,9 @@ fi
|
|||
AM_CONDITIONAL(ENABLE_CCAT, test "x$enableccat" = "x1")
|
||||
AC_SUBST(ENABLE_CCAT,[$enableccat])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# RTAI path (optional)
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_WITH([rtai-dir],
|
||||
AC_HELP_STRING(
|
||||
|
|
@ -693,13 +793,15 @@ AC_MSG_CHECKING([for RTAI path])
|
|||
if test -z "${rtaidir}"; then
|
||||
AC_MSG_RESULT([not specified.])
|
||||
else
|
||||
if test \! -r ${rtaidir}/include/rtai.h; then
|
||||
if test \! -x ${rtaidir}/bin/rtai-config; then
|
||||
AC_MSG_ERROR([no RTAI installation found in ${rtaidir}!])
|
||||
fi
|
||||
AC_MSG_RESULT([$rtaidir])
|
||||
|
||||
rtai_lxrt_cflags=`$rtaidir/bin/rtai-config --lxrt-cflags`
|
||||
rtai_lxrt_ldflags=`$rtaidir/bin/rtai-config --lxrt-ldflags`
|
||||
rtai_module_dir=`$rtaidir/bin/rtai-config --module-dir`
|
||||
rtai_kernel_cflags=`$rtaidir/bin/rtai-config --kernel-cflags`
|
||||
fi
|
||||
|
||||
AC_SUBST(RTAI_DIR,[$rtaidir])
|
||||
|
|
@ -708,10 +810,12 @@ AC_SUBST(ENABLE_RTAI,[$rtai])
|
|||
|
||||
AC_SUBST(RTAI_LXRT_CFLAGS,[$rtai_lxrt_cflags])
|
||||
AC_SUBST(RTAI_LXRT_LDFLAGS,[$rtai_lxrt_ldflags])
|
||||
AC_SUBST(RTAI_MODULE_DIR,[$rtai_module_dir])
|
||||
AC_SUBST(RTAI_KERNEL_CFLAGS,[$rtai_kernel_cflags])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Xenomai path (optional)
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_WITH([xenomai-dir],
|
||||
AC_HELP_STRING(
|
||||
|
|
@ -728,28 +832,61 @@ AC_ARG_WITH([xenomai-dir],
|
|||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH([xenomai-config],
|
||||
AC_HELP_STRING(
|
||||
[--with-xenomai-config=<CMD>],
|
||||
[Xenomai config invokation, default to xenomai-dir/bin/xeno-config]
|
||||
),
|
||||
[
|
||||
xenomaiconfig=[$withval]
|
||||
],
|
||||
[
|
||||
xenomaiconfig="$xenomaidir/bin/xeno-config"
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for Xenomai path])
|
||||
|
||||
if test -z "${xenomaidir}"; then
|
||||
AC_MSG_RESULT([not specified.])
|
||||
else
|
||||
if test \! -r ${xenomaidir}/include/xeno_config.h; then
|
||||
if test \! -x ${xenomaiconfig}; then
|
||||
AC_MSG_ERROR([no Xenomai installation found in ${xenomaidir}!])
|
||||
fi
|
||||
AC_MSG_RESULT([$xenomaidir])
|
||||
|
||||
xeno_native_cflags=`$xenomaidir/bin/xeno-config --skin native --cflags`
|
||||
xeno_native_ldflags=`$xenomaidir/bin/xeno-config --skin native --ldflags`
|
||||
xeno_posix_cflags=`$xenomaidir/bin/xeno-config --skin posix --cflags`
|
||||
xeno_posix_ldflags=`$xenomaidir/bin/xeno-config --skin posix --ldflags`
|
||||
xeno_rtdm_cflags=`$xenomaidir/bin/xeno-config --skin rtdm --cflags`
|
||||
xeno_rtdm_ldflags=`$xenomaidir/bin/xeno-config --skin rtdm --ldflags`
|
||||
xenomai_ver=`$xenomaiconfig --version`
|
||||
xenomai_ver=${xenomai_ver##\"}
|
||||
xenomai_ver=${xenomai_ver%%\"}
|
||||
echo "xenomai version: " $xenomai_ver
|
||||
|
||||
if test ${xenomai_ver%%.*} -gt 2; then
|
||||
xeno_alchemy_cflags=`$xenomaiconfig --skin alchemy --cflags`
|
||||
xeno_alchemy_ldflags=`$xenomaiconfig --skin alchemy --auto-init-solib --ldflags`
|
||||
xeno_posix_ldflags=`$xenomaiconfig --skin posix --auto-init-solib --ldflags`
|
||||
xeno_rtdm_ldflags=`$xenomaiconfig --skin rtdm --auto-init-solib --ldflags`
|
||||
xeno_v3=1
|
||||
xeno=0
|
||||
AC_DEFINE([EC_RTDM_XENOMAI_V3], [1], [Use Xenomai3 RTDM flavour])
|
||||
else
|
||||
xeno_native_cflags=`$xenomaiconfig --skin native --cflags`
|
||||
xeno_native_ldflags=`$xenomaiconfig --skin native --ldflags`
|
||||
xeno_posix_ldflags=`$xenomaiconfig --skin posix --ldflags`
|
||||
xeno_rtdm_ldflags=`$xenomaiconfig --skin rtdm --ldflags`
|
||||
fi
|
||||
|
||||
xeno_posix_cflags=`$xenomaiconfig --skin posix --cflags`
|
||||
xeno_rtdm_cflags=`$xenomaiconfig --skin rtdm --cflags`
|
||||
fi
|
||||
|
||||
AC_SUBST(XENOMAI_DIR,[$xenomaidir])
|
||||
AM_CONDITIONAL(ENABLE_XENOMAI, test "x$xeno" = "x1")
|
||||
AC_SUBST(ENABLE_XENOMAI,[$xeno])
|
||||
AM_CONDITIONAL(ENABLE_XENOMAI_V3, test "x$xeno_v3" = "x1")
|
||||
AC_SUBST(ENABLE_XENOMAI_V3,[$xeno_v3])
|
||||
|
||||
AC_SUBST(XENOMAI_ALCHEMY_CFLAGS,[$xeno_alchemy_cflags])
|
||||
AC_SUBST(XENOMAI_ALCHEMY_LDFLAGS,[$xeno_alchemy_ldflags])
|
||||
AC_SUBST(XENOMAI_NATIVE_CFLAGS,[$xeno_native_cflags])
|
||||
AC_SUBST(XENOMAI_NATIVE_LDFLAGS,[$xeno_native_ldflags])
|
||||
AC_SUBST(XENOMAI_POSIX_CFLAGS,[$xeno_posix_cflags])
|
||||
|
|
@ -757,9 +894,9 @@ AC_SUBST(XENOMAI_POSIX_LDFLAGS,[$xeno_posix_ldflags])
|
|||
AC_SUBST(XENOMAI_RTDM_CFLAGS,[$xeno_rtdm_cflags])
|
||||
AC_SUBST(XENOMAI_RTDM_LDFLAGS,[$xeno_rtdm_ldflags])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# RTDM interface (optional)
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([rtdm],
|
||||
AC_HELP_STRING(
|
||||
|
|
@ -791,9 +928,9 @@ fi
|
|||
AM_CONDITIONAL(ENABLE_RTDM, test "x$rtdm" = "x1")
|
||||
AC_SUBST(ENABLE_RTDM,[$rtdm])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Debug interface
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to build the debug interface])
|
||||
|
||||
|
|
@ -823,9 +960,9 @@ fi
|
|||
AM_CONDITIONAL(ENABLE_DEBUG_IF, test "x$dbg" = "x1")
|
||||
AC_SUBST(ENABLE_DEBUG_IF,[$dbg])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Debug ring
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to build the debug ring])
|
||||
|
||||
|
|
@ -852,9 +989,9 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Ethernet over EtherCAT support
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to build with EoE support])
|
||||
|
||||
|
|
@ -884,9 +1021,9 @@ fi
|
|||
AM_CONDITIONAL(ENABLE_EOE, test "x$eoe" = "x1")
|
||||
AC_SUBST(ENABLE_EOE,[$eoe])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# CPU timestamp counter support
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to use the CPU timestamp counter])
|
||||
|
||||
|
|
@ -913,9 +1050,9 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# High-resolution timer support
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to use high-resolution timers for scheduling])
|
||||
|
||||
|
|
@ -942,9 +1079,9 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Read alias address from register
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to read alias addresses from registers])
|
||||
|
||||
|
|
@ -971,7 +1108,7 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Command-line tool
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -1001,9 +1138,9 @@ fi
|
|||
|
||||
AM_CONDITIONAL(BUILD_TOOL, test "x$tool" = "x1")
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Userspace library generation
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to build the userspace library])
|
||||
|
||||
|
|
@ -1031,9 +1168,9 @@ fi
|
|||
|
||||
AM_CONDITIONAL(ENABLE_USERLIB, test "x$userlib" = "x1")
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# TTY driver
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to build the tty driver])
|
||||
|
||||
|
|
@ -1062,9 +1199,9 @@ fi
|
|||
AM_CONDITIONAL(ENABLE_TTY, test "x$tty" = "x1")
|
||||
AC_SUBST(ENABLE_TTY,[$tty])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Slave identification wildcards
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to allow identification wildcards])
|
||||
|
||||
|
|
@ -1092,9 +1229,9 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Redundancy (number of devices)
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_WITH([devices],
|
||||
AC_HELP_STRING(
|
||||
|
|
@ -1124,9 +1261,9 @@ fi
|
|||
AC_DEFINE_UNQUOTED([EC_MAX_NUM_DEVICES], $devices,
|
||||
[Max. number of Ethernet devices per master])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# SII assignment
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to assign the SII to PDI])
|
||||
|
||||
|
|
@ -1153,9 +1290,9 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# syslog output in realtime context
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([whether to syslog in realtime context])
|
||||
|
||||
|
|
@ -1182,9 +1319,9 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# systemd service support
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_WITH([systemdsystemunitdir],
|
||||
AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
|
||||
|
|
@ -1211,7 +1348,7 @@ esac
|
|||
AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "x")
|
||||
AC_SUBST(systemdsystemunitdir,[$with_systemdsystemunitdir])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Doxyfile
|
||||
|
|
@ -1233,6 +1370,8 @@ AC_CONFIG_FILES([
|
|||
devices/igc/Makefile
|
||||
devices/r8169/Kbuild
|
||||
devices/r8169/Makefile
|
||||
devices/stmmac/Kbuild
|
||||
devices/stmmac/Makefile
|
||||
ethercat.spec
|
||||
examples/Kbuild
|
||||
examples/Makefile
|
||||
|
|
@ -1263,6 +1402,7 @@ AC_CONFIG_FILES([
|
|||
tty/Kbuild
|
||||
tty/Makefile
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -656,7 +648,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2014 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -665,7 +657,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2014 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -665,7 +657,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2014 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -665,7 +657,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2014 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -665,7 +657,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -657,7 +649,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -665,7 +657,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2014 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -665,7 +657,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2014 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -665,7 +657,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2014 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -669,7 +661,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -17,12 +17,6 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
|
@ -668,7 +662,7 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
/******************************************************************************
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
* Copyright (C) 2006-2023 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT Master.
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -50,7 +42,7 @@
|
|||
|
||||
-----<snip>-----
|
||||
|
||||
Written 1997-2001 by Donald Becker.
|
||||
Written 1997-2001 by Donald Becker.
|
||||
This software may be used and distributed according to the
|
||||
terms of the GNU General Public License (GPL), incorporated
|
||||
herein by reference. Drivers based on or derived from this
|
||||
|
|
@ -139,6 +131,7 @@
|
|||
#include <linux/compiler.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
|
@ -150,14 +143,26 @@
|
|||
#include <linux/io.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
#include "../globals.h"
|
||||
#include "ecdev.h"
|
||||
|
||||
#ifdef CONFIG_SUSE_KERNEL
|
||||
#include <linux/suse_version.h>
|
||||
#else
|
||||
# ifndef SUSE_VERSION
|
||||
# define SUSE_VERSION 0
|
||||
# endif
|
||||
# ifndef SUSE_PATCHLEVEL
|
||||
# define SUSE_PATCHLEVEL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define RTL8139_DRIVER_NAME DRV_NAME \
|
||||
" EtherCAT-capable Fast Ethernet driver " \
|
||||
DRV_VERSION ", master " EC_MASTER_VERSION
|
||||
" EtherCAT-capable Fast Ethernet driver " \
|
||||
DRV_VERSION ", master " EC_MASTER_VERSION
|
||||
|
||||
#define PFX DRV_NAME ": "
|
||||
|
||||
|
|
@ -193,9 +198,9 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
|
|||
|
||||
/* Whether to use MMIO or PIO. Default to MMIO. */
|
||||
#ifdef CONFIG_8139TOO_PIO
|
||||
static int use_io = 1;
|
||||
static bool use_io = true;
|
||||
#else
|
||||
static int use_io = 0;
|
||||
static bool use_io = false;
|
||||
#endif
|
||||
|
||||
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
|
||||
|
|
@ -227,10 +232,13 @@ static int debug = -1;
|
|||
/* Number of Tx descriptor registers. */
|
||||
#define NUM_TX_DESC 4
|
||||
|
||||
/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1536
|
||||
/* max supported ethernet frame size -- must be at least (dev->mtu+18+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1792
|
||||
|
||||
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */
|
||||
/* max supported payload size */
|
||||
#define MAX_ETH_DATA_SIZE (MAX_ETH_FRAME_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN)
|
||||
|
||||
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+18+4). */
|
||||
#define TX_BUF_SIZE MAX_ETH_FRAME_SIZE
|
||||
#define TX_BUF_TOT_LEN (TX_BUF_SIZE * NUM_TX_DESC)
|
||||
|
||||
|
|
@ -273,13 +281,13 @@ typedef enum {
|
|||
static const struct {
|
||||
const char *name;
|
||||
u32 hw_flags;
|
||||
} board_info[] __devinitdata = {
|
||||
} board_info[] = {
|
||||
{ "RealTek RTL8139", RTL8139_CAPS },
|
||||
{ "RealTek RTL8129", RTL8129_CAPS },
|
||||
};
|
||||
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
|
||||
static const struct pci_device_id rtl8139_pci_tbl[] = {
|
||||
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
|
|
@ -299,6 +307,7 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
|
|||
{0x126c, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x1743, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x021b, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x16ec, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
|
||||
#ifdef CONFIG_SH_SECUREEDGE5410
|
||||
/* Bogus 8139 silicon reports 8129 without external PROM :-( */
|
||||
|
|
@ -590,8 +599,8 @@ static const struct {
|
|||
|
||||
{ "RTL-8100",
|
||||
HW_REVID(1, 1, 1, 1, 0, 1, 0),
|
||||
HasLWake,
|
||||
},
|
||||
HasLWake,
|
||||
},
|
||||
|
||||
{ "RTL-8100B/8139D",
|
||||
HW_REVID(1, 1, 1, 0, 1, 0, 1),
|
||||
|
|
@ -612,6 +621,12 @@ struct rtl_extra_stats {
|
|||
unsigned long rx_lost_in_ring;
|
||||
};
|
||||
|
||||
struct rtl8139_stats {
|
||||
u64 packets;
|
||||
u64 bytes;
|
||||
struct u64_stats_sync syncp;
|
||||
};
|
||||
|
||||
struct rtl8139_private {
|
||||
void __iomem *mmio_addr;
|
||||
int drv_flags;
|
||||
|
|
@ -622,11 +637,13 @@ struct rtl8139_private {
|
|||
|
||||
unsigned char *rx_ring;
|
||||
unsigned int cur_rx; /* RX buf index of next pkt */
|
||||
struct rtl8139_stats rx_stats;
|
||||
dma_addr_t rx_ring_dma;
|
||||
|
||||
unsigned int tx_flag;
|
||||
unsigned long cur_tx;
|
||||
unsigned long dirty_tx;
|
||||
struct rtl8139_stats tx_stats;
|
||||
unsigned char *tx_buf[NUM_TX_DESC]; /* Tx bounce buffers */
|
||||
unsigned char *tx_bufs; /* Tx bounce buffer region. */
|
||||
dma_addr_t tx_bufs_dma;
|
||||
|
|
@ -656,12 +673,12 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
||||
module_param(use_io, int, 0);
|
||||
module_param(use_io, bool, 0);
|
||||
MODULE_PARM_DESC(use_io, "Force use of I/O access mode. 0=MMIO 1=PIO");
|
||||
module_param(multicast_filter_limit, int, 0);
|
||||
module_param_array(media, int, NULL, 0);
|
||||
|
|
@ -680,7 +697,7 @@ static int mdio_read (struct net_device *dev, int phy_id, int location);
|
|||
static void mdio_write (struct net_device *dev, int phy_id, int location,
|
||||
int val);
|
||||
static void rtl8139_start_thread(struct rtl8139_private *tp);
|
||||
static void rtl8139_tx_timeout (struct net_device *dev);
|
||||
static void rtl8139_tx_timeout (struct net_device *dev, unsigned int txqueue);
|
||||
static void rtl8139_init_ring (struct net_device *dev);
|
||||
static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
||||
struct net_device *dev);
|
||||
|
|
@ -692,7 +709,8 @@ static int rtl8139_poll(struct napi_struct *napi, int budget);
|
|||
static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance);
|
||||
static int rtl8139_close (struct net_device *dev);
|
||||
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev);
|
||||
static void rtl8139_get_stats64(struct net_device *dev,
|
||||
struct rtnl_link_stats64 *stats);
|
||||
static void rtl8139_set_rx_mode (struct net_device *dev);
|
||||
static void __set_rx_mode (struct net_device *dev);
|
||||
static void rtl8139_hw_start (struct net_device *dev);
|
||||
|
|
@ -768,7 +786,6 @@ static void __rtl8139_cleanup_dev (struct net_device *dev)
|
|||
pci_release_regions (pdev);
|
||||
|
||||
free_netdev(dev);
|
||||
pci_set_drvdata (pdev, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -789,28 +806,32 @@ static void rtl8139_chip_reset (void __iomem *ioaddr)
|
|||
}
|
||||
|
||||
|
||||
static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
|
||||
static struct net_device *rtl8139_init_board(struct pci_dev *pdev)
|
||||
{
|
||||
struct device *d = &pdev->dev;
|
||||
void __iomem *ioaddr;
|
||||
struct net_device *dev;
|
||||
struct rtl8139_private *tp;
|
||||
u8 tmp8;
|
||||
int rc, disable_dev_on_err = 0;
|
||||
unsigned int i;
|
||||
unsigned long pio_start, pio_end __attribute__ ((unused)), pio_flags,
|
||||
pio_len;
|
||||
unsigned long mmio_start __attribute__ ((unused)),
|
||||
mmio_end __attribute__ ((unused)), mmio_flags, mmio_len;
|
||||
unsigned int i, bar;
|
||||
unsigned long io_len;
|
||||
u32 version;
|
||||
static const struct {
|
||||
unsigned long mask;
|
||||
char *type;
|
||||
} res[] = {
|
||||
{ IORESOURCE_IO, "PIO" },
|
||||
{ IORESOURCE_MEM, "MMIO" }
|
||||
};
|
||||
|
||||
assert (pdev != NULL);
|
||||
|
||||
/* dev and priv zeroed in alloc_etherdev */
|
||||
dev = alloc_etherdev (sizeof (*tp));
|
||||
if (dev == NULL) {
|
||||
dev_err(&pdev->dev, "Unable to alloc new net device\n");
|
||||
if (dev == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
||||
tp = netdev_priv(dev);
|
||||
|
|
@ -821,78 +842,48 @@ static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
|
|||
if (rc)
|
||||
goto err_out;
|
||||
|
||||
pio_start = pci_resource_start (pdev, 0);
|
||||
pio_end = pci_resource_end (pdev, 0);
|
||||
pio_flags = pci_resource_flags (pdev, 0);
|
||||
pio_len = pci_resource_len (pdev, 0);
|
||||
|
||||
mmio_start = pci_resource_start (pdev, 1);
|
||||
mmio_end = pci_resource_end (pdev, 1);
|
||||
mmio_flags = pci_resource_flags (pdev, 1);
|
||||
mmio_len = pci_resource_len (pdev, 1);
|
||||
|
||||
/* set this immediately, we need to know before
|
||||
* we talk to the chip directly */
|
||||
pr_debug("PIO region size == 0x%02lX\n", pio_len);
|
||||
pr_debug("MMIO region size == 0x%02lX\n", mmio_len);
|
||||
|
||||
retry:
|
||||
if (use_io) {
|
||||
/* make sure PCI base addr 0 is PIO */
|
||||
if (!(pio_flags & IORESOURCE_IO)) {
|
||||
dev_err(&pdev->dev, "region #0 not a PIO resource, aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
/* check for weird/broken PCI region reporting */
|
||||
if (pio_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(&pdev->dev, "Invalid PCI I/O region size(s), aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
} else {
|
||||
/* make sure PCI base addr 1 is MMIO */
|
||||
if (!(mmio_flags & IORESOURCE_MEM)) {
|
||||
dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
if (mmio_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(&pdev->dev, "Invalid PCI mem region size(s), aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
|
||||
disable_dev_on_err = 1;
|
||||
rc = pci_request_regions (pdev, DRV_NAME);
|
||||
if (rc)
|
||||
goto err_out;
|
||||
disable_dev_on_err = 1;
|
||||
|
||||
/* enable PCI bus-mastering */
|
||||
pci_set_master (pdev);
|
||||
|
||||
if (use_io) {
|
||||
ioaddr = pci_iomap(pdev, 0, 0);
|
||||
if (!ioaddr) {
|
||||
dev_err(&pdev->dev, "cannot map PIO, aborting\n");
|
||||
rc = -EIO;
|
||||
goto err_out;
|
||||
}
|
||||
dev->base_addr = pio_start;
|
||||
tp->regs_len = pio_len;
|
||||
} else {
|
||||
/* ioremap MMIO region */
|
||||
ioaddr = pci_iomap(pdev, 1, 0);
|
||||
if (ioaddr == NULL) {
|
||||
dev_err(&pdev->dev, "cannot remap MMIO, trying PIO\n");
|
||||
pci_release_regions(pdev);
|
||||
use_io = 1;
|
||||
u64_stats_init(&tp->rx_stats.syncp);
|
||||
u64_stats_init(&tp->tx_stats.syncp);
|
||||
|
||||
retry:
|
||||
/* PIO bar register comes first. */
|
||||
bar = !use_io;
|
||||
|
||||
io_len = pci_resource_len(pdev, bar);
|
||||
|
||||
dev_dbg(d, "%s region size = 0x%02lX\n", res[bar].type, io_len);
|
||||
|
||||
if (!(pci_resource_flags(pdev, bar) & res[bar].mask)) {
|
||||
dev_err(d, "region #%d not a %s resource, aborting\n", bar,
|
||||
res[bar].type);
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
if (io_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(d, "Invalid PCI %s region size(s), aborting\n",
|
||||
res[bar].type);
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
ioaddr = pci_iomap(pdev, bar, 0);
|
||||
if (!ioaddr) {
|
||||
dev_err(d, "cannot map %s\n", res[bar].type);
|
||||
if (!use_io) {
|
||||
use_io = true;
|
||||
goto retry;
|
||||
}
|
||||
dev->base_addr = (long) ioaddr;
|
||||
tp->regs_len = mmio_len;
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
tp->regs_len = io_len;
|
||||
tp->mmio_addr = ioaddr;
|
||||
|
||||
/* Bring old chips out of low-power mode. */
|
||||
|
|
@ -961,24 +952,51 @@ err_out:
|
|||
return ERR_PTR(rc);
|
||||
}
|
||||
|
||||
static int rtl8139_set_features(struct net_device *dev, netdev_features_t features)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
netdev_features_t changed = features ^ dev->features;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
|
||||
if (!(changed & (NETIF_F_RXALL)))
|
||||
return 0;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
|
||||
if (changed & NETIF_F_RXALL) {
|
||||
int rx_mode = tp->rx_config;
|
||||
if (features & NETIF_F_RXALL)
|
||||
rx_mode |= (AcceptErr | AcceptRunt);
|
||||
else
|
||||
rx_mode &= ~(AcceptErr | AcceptRunt);
|
||||
tp->rx_config = rtl8139_rx_config | rx_mode;
|
||||
RTL_W32_F(RxConfig, tp->rx_config);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops rtl8139_netdev_ops = {
|
||||
.ndo_open = rtl8139_open,
|
||||
.ndo_stop = rtl8139_close,
|
||||
.ndo_get_stats = rtl8139_get_stats,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_get_stats64 = rtl8139_get_stats64,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = rtl8139_set_mac_address,
|
||||
.ndo_start_xmit = rtl8139_start_xmit,
|
||||
.ndo_set_multicast_list = rtl8139_set_rx_mode,
|
||||
.ndo_set_rx_mode = rtl8139_set_rx_mode,
|
||||
.ndo_do_ioctl = netdev_ioctl,
|
||||
.ndo_tx_timeout = rtl8139_tx_timeout,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = rtl8139_poll_controller,
|
||||
#endif
|
||||
.ndo_set_features = rtl8139_set_features,
|
||||
};
|
||||
|
||||
static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
static int rtl8139_init_one(struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
{
|
||||
struct net_device *dev = NULL;
|
||||
struct rtl8139_private *tp;
|
||||
|
|
@ -1015,7 +1033,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
pdev->subsystem_vendor == PCI_VENDOR_ID_ATHEROS &&
|
||||
pdev->subsystem_device == PCI_DEVICE_ID_REALTEK_8139) {
|
||||
pr_info("OQO Model 2 detected. Forcing PIO\n");
|
||||
use_io = 1;
|
||||
use_io = true;
|
||||
}
|
||||
|
||||
dev = rtl8139_init_board (pdev);
|
||||
|
|
@ -1033,7 +1051,6 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
for (i = 0; i < 3; i++)
|
||||
((__le16 *) (dev->dev_addr))[i] =
|
||||
cpu_to_le16(read_eeprom (ioaddr, i + 7, addr_len));
|
||||
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
|
||||
|
||||
/* The Rtl8139-specific entries in the device structure. */
|
||||
dev->netdev_ops = &rtl8139_netdev_ops;
|
||||
|
|
@ -1046,8 +1063,14 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
* features
|
||||
*/
|
||||
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
|
||||
dev->vlan_features = dev->features;
|
||||
|
||||
dev->irq = pdev->irq;
|
||||
dev->hw_features |= NETIF_F_RXALL;
|
||||
dev->hw_features |= NETIF_F_RXFCS;
|
||||
|
||||
/* MTU range: 68 - 1770 */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = MAX_ETH_DATA_SIZE;
|
||||
|
||||
/* tp zeroed and aligned in alloc_etherdev */
|
||||
tp = netdev_priv(dev);
|
||||
|
|
@ -1067,11 +1090,13 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
tp->mii.reg_num_mask = 0x1f;
|
||||
|
||||
/* dev is fully set up and ready to use now */
|
||||
|
||||
// offer device to EtherCAT master module
|
||||
tp->ecdev = ecdev_offer(dev, ec_poll, THIS_MODULE);
|
||||
|
||||
if (!tp->ecdev) {
|
||||
pr_debug("about to register device named %s (%p)...\n", dev->name, dev);
|
||||
pr_debug("about to register device named %s (%p)...\n",
|
||||
dev->name, dev);
|
||||
i = register_netdev (dev);
|
||||
if (i) goto err_out;
|
||||
}
|
||||
|
|
@ -1159,20 +1184,20 @@ err_out:
|
|||
}
|
||||
|
||||
|
||||
static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
||||
static void rtl8139_remove_one(struct pci_dev *pdev)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
assert (dev != NULL);
|
||||
|
||||
flush_scheduled_work();
|
||||
|
||||
if (tp->ecdev) {
|
||||
ecdev_close(tp->ecdev);
|
||||
ecdev_withdraw(tp->ecdev);
|
||||
}
|
||||
else {
|
||||
cancel_delayed_work_sync(&tp->thread);
|
||||
|
||||
unregister_netdev (dev);
|
||||
}
|
||||
|
||||
|
|
@ -1196,14 +1221,14 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
|||
No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.
|
||||
*/
|
||||
|
||||
#define eeprom_delay() (void)RTL_R32(Cfg9346)
|
||||
#define eeprom_delay() (void)RTL_R8(Cfg9346)
|
||||
|
||||
/* The EEPROM commands include the alway-set leading bit. */
|
||||
#define EE_WRITE_CMD (5)
|
||||
#define EE_READ_CMD (6)
|
||||
#define EE_ERASE_CMD (7)
|
||||
|
||||
static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_len)
|
||||
static int read_eeprom(void __iomem *ioaddr, int location, int addr_len)
|
||||
{
|
||||
int i;
|
||||
unsigned retval = 0;
|
||||
|
|
@ -1235,7 +1260,7 @@ static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_l
|
|||
}
|
||||
|
||||
/* Terminate the EEPROM access. */
|
||||
RTL_W8 (Cfg9346, ~EE_CS);
|
||||
RTL_W8(Cfg9346, 0);
|
||||
eeprom_delay ();
|
||||
|
||||
return retval;
|
||||
|
|
@ -1373,12 +1398,12 @@ static void mdio_write (struct net_device *dev, int phy_id, int location,
|
|||
static int rtl8139_open (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int retval;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
const int irq = tp->pci_dev->irq;
|
||||
int retval;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
retval = request_irq(dev->irq, rtl8139_interrupt,
|
||||
IRQF_SHARED, dev->name, dev);
|
||||
retval = request_irq(irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
|
|
@ -1389,7 +1414,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
&tp->rx_ring_dma, GFP_KERNEL);
|
||||
if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {
|
||||
if (!tp->ecdev) {
|
||||
free_irq(dev->irq, dev);
|
||||
free_irq(irq, dev);
|
||||
}
|
||||
|
||||
if (tp->tx_bufs)
|
||||
|
|
@ -1418,7 +1443,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
"%s() ioaddr %#llx IRQ %d GP Pins %02x %s-duplex\n",
|
||||
__func__,
|
||||
(unsigned long long)pci_resource_start (tp->pci_dev, 1),
|
||||
dev->irq, RTL_R8 (MediaStatus),
|
||||
irq, RTL_R8 (MediaStatus),
|
||||
tp->mii.full_duplex ? "full" : "half");
|
||||
|
||||
if (!tp->ecdev) {
|
||||
|
|
@ -1731,6 +1756,10 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
int i;
|
||||
u8 tmp8;
|
||||
|
||||
napi_disable(&tp->napi);
|
||||
netif_stop_queue(dev);
|
||||
synchronize_rcu();
|
||||
|
||||
netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
|
||||
RTL_R8(ChipCmd), RTL_R16(IntrStatus),
|
||||
RTL_R16(IntrMask), RTL_R8(MediaStatus));
|
||||
|
|
@ -1755,25 +1784,25 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
rtl8139_hw_start (dev);
|
||||
}
|
||||
else {
|
||||
spin_lock_bh(&tp->rx_lock);
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0x0000);
|
||||
spin_lock_bh(&tp->rx_lock);
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0x0000);
|
||||
|
||||
/* Stop a shared interrupt from scavenging while we are. */
|
||||
spin_lock_irq(&tp->lock);
|
||||
rtl8139_tx_clear (tp);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
/* Stop a shared interrupt from scavenging while we are. */
|
||||
spin_lock_irq(&tp->lock);
|
||||
rtl8139_tx_clear (tp);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
|
||||
/* ...and finally, reset everything */
|
||||
if (netif_running(dev)) {
|
||||
rtl8139_hw_start (dev);
|
||||
netif_wake_queue (dev);
|
||||
}
|
||||
spin_unlock_bh(&tp->rx_lock);
|
||||
/* ...and finally, reset everything */
|
||||
napi_enable(&tp->napi);
|
||||
rtl8139_hw_start(dev);
|
||||
netif_wake_queue(dev);
|
||||
|
||||
spin_unlock_bh(&tp->rx_lock);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtl8139_tx_timeout (struct net_device *dev)
|
||||
static void rtl8139_tx_timeout(struct net_device *dev, unsigned int txqueue)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
|
|
@ -1802,11 +1831,11 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
|||
memset(tp->tx_buf[entry], 0, ETH_ZLEN);
|
||||
skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);
|
||||
if (!tp->ecdev) {
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
} else {
|
||||
if (!tp->ecdev) {
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
dev->stats.tx_dropped++;
|
||||
return NETDEV_TX_OK;
|
||||
|
|
@ -1883,8 +1912,10 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
|
|||
dev->stats.tx_fifo_errors++;
|
||||
}
|
||||
dev->stats.collisions += (txstatus >> 24) & 15;
|
||||
dev->stats.tx_bytes += txstatus & 0x7ff;
|
||||
dev->stats.tx_packets++;
|
||||
u64_stats_update_begin(&tp->tx_stats.syncp);
|
||||
tp->tx_stats.packets++;
|
||||
tp->tx_stats.bytes += txstatus & 0x7ff;
|
||||
u64_stats_update_end(&tp->tx_stats.syncp);
|
||||
}
|
||||
|
||||
dirty_tx++;
|
||||
|
|
@ -2052,7 +2083,10 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
|||
/* read size+status of next frame from DMA ring buffer */
|
||||
rx_status = le32_to_cpu (*(__le32 *) (rx_ring + ring_offset));
|
||||
rx_size = rx_status >> 16;
|
||||
pkt_size = rx_size - 4;
|
||||
if (likely(!(dev->features & NETIF_F_RXFCS)))
|
||||
pkt_size = rx_size - 4;
|
||||
else
|
||||
pkt_size = rx_size;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (netif_msg_rx_status(tp))
|
||||
|
|
@ -2102,39 +2136,56 @@ no_early_rx:
|
|||
if (unlikely((rx_size > (MAX_ETH_FRAME_SIZE+4)) ||
|
||||
(rx_size < 8) ||
|
||||
(!(rx_status & RxStatusOK)))) {
|
||||
if ((dev->features & NETIF_F_RXALL) &&
|
||||
(rx_size <= (MAX_ETH_FRAME_SIZE + 4)) &&
|
||||
(rx_size >= 8) &&
|
||||
(!(rx_status & RxStatusOK))) {
|
||||
/* Length is at least mostly OK, but pkt has
|
||||
* error. I'm hoping we can handle some of these
|
||||
* errors without resetting the chip. --Ben
|
||||
*/
|
||||
dev->stats.rx_errors++;
|
||||
if (rx_status & RxCRCErr) {
|
||||
dev->stats.rx_crc_errors++;
|
||||
goto keep_pkt;
|
||||
}
|
||||
if (rx_status & RxRunt) {
|
||||
dev->stats.rx_length_errors++;
|
||||
goto keep_pkt;
|
||||
}
|
||||
}
|
||||
rtl8139_rx_err (rx_status, dev, tp, ioaddr);
|
||||
received = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
keep_pkt:
|
||||
if (tp->ecdev) {
|
||||
ecdev_receive(tp->ecdev, &rx_ring[ring_offset + 4], pkt_size);
|
||||
dev->stats.rx_bytes += pkt_size;
|
||||
dev->stats.rx_packets++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* Malloc up new buffer, compatible with net-2e. */
|
||||
/* Omit the four octet CRC from the length. */
|
||||
|
||||
skb = netdev_alloc_skb(dev, pkt_size + NET_IP_ALIGN);
|
||||
skb = napi_alloc_skb(&tp->napi, pkt_size);
|
||||
if (likely(skb)) {
|
||||
skb_reserve (skb, NET_IP_ALIGN); /* 16 byte align the IP fields. */
|
||||
#if RX_BUF_IDX == 3
|
||||
wrap_copy(skb, rx_ring, ring_offset+4, pkt_size);
|
||||
#else
|
||||
skb_copy_to_linear_data (skb, &rx_ring[ring_offset + 4], pkt_size);
|
||||
skb_copy_to_linear_data (skb, &rx_ring[ring_offset + 4],
|
||||
pkt_size);
|
||||
#endif
|
||||
skb_put (skb, pkt_size);
|
||||
|
||||
skb->protocol = eth_type_trans (skb, dev);
|
||||
|
||||
dev->stats.rx_bytes += pkt_size;
|
||||
dev->stats.rx_packets++;
|
||||
u64_stats_update_begin(&tp->rx_stats.syncp);
|
||||
tp->rx_stats.packets++;
|
||||
tp->rx_stats.bytes += pkt_size;
|
||||
u64_stats_update_end(&tp->rx_stats.syncp);
|
||||
|
||||
netif_receive_skb (skb);
|
||||
} else {
|
||||
if (net_ratelimit())
|
||||
pr_warning("%s: Memory squeeze, dropping packet.\n",
|
||||
dev->name);
|
||||
dev->stats.rx_dropped++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2221,13 +2272,10 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
|
|||
|
||||
if (work_done < budget) {
|
||||
unsigned long flags;
|
||||
/*
|
||||
* Order is important since data can get interrupted
|
||||
* again when we think we are done.
|
||||
*/
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
__napi_complete(napi);
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
if (napi_complete_done(napi, work_done))
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
}
|
||||
spin_unlock(&tp->rx_lock);
|
||||
|
|
@ -2311,7 +2359,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
if (status & TxErr)
|
||||
RTL_W16 (IntrStatus, TxErr);
|
||||
}
|
||||
out:
|
||||
out:
|
||||
if (!tp->ecdev) {
|
||||
spin_unlock (&tp->lock);
|
||||
}
|
||||
|
|
@ -2328,9 +2376,12 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
*/
|
||||
static void rtl8139_poll_controller(struct net_device *dev)
|
||||
{
|
||||
disable_irq(dev->irq);
|
||||
rtl8139_interrupt(dev->irq, dev);
|
||||
enable_irq(dev->irq);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
const int irq = tp->pci_dev->irq;
|
||||
|
||||
disable_irq_nosync(irq);
|
||||
rtl8139_interrupt(irq, dev);
|
||||
enable_irq(irq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2343,8 +2394,11 @@ static int rtl8139_set_mac_address(struct net_device *dev, void *p)
|
|||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
#if SUSE_VERSION == 15 && SUSE_PATCHLEVEL >= 5
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
#else
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
|
||||
#endif
|
||||
spin_lock_irq(&tp->lock);
|
||||
|
||||
RTL_W8_F(Cfg9346, Cfg9346_Unlock);
|
||||
|
|
@ -2361,41 +2415,33 @@ static int rtl8139_close (struct net_device *dev)
|
|||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
unsigned long flags = 0;
|
||||
|
||||
if (tp->ecdev) {
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8 (ChipCmd, 0);
|
||||
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0);
|
||||
|
||||
/* Update the error counts. */
|
||||
dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
} else {
|
||||
if (!tp->ecdev) {
|
||||
netif_stop_queue(dev);
|
||||
napi_disable(&tp->napi);
|
||||
|
||||
if (netif_msg_ifdown(tp))
|
||||
pr_debug("%s: Shutting down ethercard, status was 0x%4.4x.\n",
|
||||
dev->name, RTL_R16 (IntrStatus));
|
||||
netif_dbg(tp, ifdown, dev,
|
||||
"Shutting down ethercard, status was 0x%04x\n",
|
||||
RTL_R16(IntrStatus));
|
||||
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
}
|
||||
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8 (ChipCmd, 0);
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8 (ChipCmd, 0);
|
||||
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0);
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0);
|
||||
|
||||
/* Update the error counts. */
|
||||
dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
/* Update the error counts. */
|
||||
dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
|
||||
if (!tp->ecdev) {
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
free_irq (dev->irq, dev);
|
||||
free_irq(tp->pci_dev->irq, dev);
|
||||
}
|
||||
|
||||
rtl8139_tx_clear (tp);
|
||||
|
|
@ -2497,27 +2543,28 @@ static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
|||
static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
strcpy(info->driver, DRV_NAME);
|
||||
strcpy(info->version, DRV_VERSION);
|
||||
strcpy(info->bus_info, pci_name(tp->pci_dev));
|
||||
info->regdump_len = tp->regs_len;
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
strlcpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int rtl8139_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static int rtl8139_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
spin_lock_irq(&tp->lock);
|
||||
mii_ethtool_gset(&tp->mii, cmd);
|
||||
mii_ethtool_get_link_ksettings(&tp->mii, cmd);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8139_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static int rtl8139_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int rc;
|
||||
spin_lock_irq(&tp->lock);
|
||||
rc = mii_ethtool_sset(&tp->mii, cmd);
|
||||
rc = mii_ethtool_set_link_ksettings(&tp->mii, cmd);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -2599,8 +2646,6 @@ static void rtl8139_get_strings(struct net_device *dev, u32 stringset, u8 *data)
|
|||
|
||||
static const struct ethtool_ops rtl8139_ethtool_ops = {
|
||||
.get_drvinfo = rtl8139_get_drvinfo,
|
||||
.get_settings = rtl8139_get_settings,
|
||||
.set_settings = rtl8139_set_settings,
|
||||
.get_regs_len = rtl8139_get_regs_len,
|
||||
.get_regs = rtl8139_get_regs,
|
||||
.nway_reset = rtl8139_nway_reset,
|
||||
|
|
@ -2612,6 +2657,8 @@ static const struct ethtool_ops rtl8139_ethtool_ops = {
|
|||
.get_strings = rtl8139_get_strings,
|
||||
.get_sset_count = rtl8139_get_sset_count,
|
||||
.get_ethtool_stats = rtl8139_get_ethtool_stats,
|
||||
.get_link_ksettings = rtl8139_get_link_ksettings,
|
||||
.set_link_ksettings = rtl8139_set_link_ksettings,
|
||||
};
|
||||
|
||||
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
|
|
@ -2630,11 +2677,13 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
|||
}
|
||||
|
||||
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
||||
static void
|
||||
rtl8139_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
unsigned int start;
|
||||
|
||||
if (tp->ecdev || netif_running(dev)) {
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
|
|
@ -2643,7 +2692,19 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
|||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
}
|
||||
|
||||
return &dev->stats;
|
||||
netdev_stats_to_stats64(stats, &dev->stats);
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&tp->rx_stats.syncp);
|
||||
stats->rx_packets = tp->rx_stats.packets;
|
||||
stats->rx_bytes = tp->rx_stats.bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&tp->rx_stats.syncp, start));
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&tp->tx_stats.syncp);
|
||||
stats->tx_packets = tp->tx_stats.packets;
|
||||
stats->tx_bytes = tp->tx_stats.bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&tp->tx_stats.syncp, start));
|
||||
}
|
||||
|
||||
/* Set or clear the multicast filter for this adaptor.
|
||||
|
|
@ -2683,6 +2744,9 @@ static void __set_rx_mode (struct net_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
if (dev->features & NETIF_F_RXALL)
|
||||
rx_mode |= (AcceptErr | AcceptRunt);
|
||||
|
||||
/* We can safely update without stopping the chip. */
|
||||
tmp = rtl8139_rx_config | rx_mode;
|
||||
if (tp->rx_config != tmp) {
|
||||
|
|
@ -2703,17 +2767,13 @@ static void rtl8139_set_rx_mode (struct net_device *dev)
|
|||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
||||
static int __maybe_unused rtl8139_suspend(struct device *device)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct net_device *dev = dev_get_drvdata(device);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
|
||||
pci_save_state (pdev);
|
||||
|
||||
if (tp->ecdev || !netif_running (dev))
|
||||
return 0;
|
||||
|
||||
|
|
@ -2731,39 +2791,31 @@ static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
|||
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
pci_set_power_state (pdev, PCI_D3hot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int rtl8139_resume (struct pci_dev *pdev)
|
||||
static int __maybe_unused rtl8139_resume(struct device *device)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct net_device *dev = dev_get_drvdata(device);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
pci_restore_state (pdev);
|
||||
if (tp->ecdev || !netif_running (dev))
|
||||
return 0;
|
||||
pci_set_power_state (pdev, PCI_D0);
|
||||
|
||||
rtl8139_init_ring (dev);
|
||||
rtl8139_hw_start (dev);
|
||||
netif_device_attach (dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(rtl8139_pm_ops, rtl8139_suspend, rtl8139_resume);
|
||||
|
||||
static struct pci_driver rtl8139_pci_driver = {
|
||||
.name = DRV_NAME,
|
||||
.id_table = rtl8139_pci_tbl,
|
||||
.probe = rtl8139_init_one,
|
||||
.remove = __devexit_p(rtl8139_remove_one),
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = rtl8139_suspend,
|
||||
.resume = rtl8139_resume,
|
||||
#endif /* CONFIG_PM */
|
||||
.remove = rtl8139_remove_one,
|
||||
.driver.pm = &rtl8139_pm_ops,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
-----<snip>-----
|
||||
|
||||
Written 1997-2001 by Donald Becker.
|
||||
Written 1997-2001 by Donald Becker.
|
||||
This software may be used and distributed according to the
|
||||
terms of the GNU General Public License (GPL), incorporated
|
||||
herein by reference. Drivers based on or derived from this
|
||||
|
|
@ -100,6 +100,7 @@
|
|||
#include <linux/compiler.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
|
@ -111,6 +112,7 @@
|
|||
#include <linux/io.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
#define RTL8139_DRIVER_NAME DRV_NAME " Fast Ethernet driver " DRV_VERSION
|
||||
|
|
@ -147,9 +149,9 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
|
|||
|
||||
/* Whether to use MMIO or PIO. Default to MMIO. */
|
||||
#ifdef CONFIG_8139TOO_PIO
|
||||
static int use_io = 1;
|
||||
static bool use_io = true;
|
||||
#else
|
||||
static int use_io = 0;
|
||||
static bool use_io = false;
|
||||
#endif
|
||||
|
||||
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
|
||||
|
|
@ -181,10 +183,13 @@ static int debug = -1;
|
|||
/* Number of Tx descriptor registers. */
|
||||
#define NUM_TX_DESC 4
|
||||
|
||||
/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1536
|
||||
/* max supported ethernet frame size -- must be at least (dev->mtu+18+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1792
|
||||
|
||||
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */
|
||||
/* max supported payload size */
|
||||
#define MAX_ETH_DATA_SIZE (MAX_ETH_FRAME_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN)
|
||||
|
||||
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+18+4). */
|
||||
#define TX_BUF_SIZE MAX_ETH_FRAME_SIZE
|
||||
#define TX_BUF_TOT_LEN (TX_BUF_SIZE * NUM_TX_DESC)
|
||||
|
||||
|
|
@ -227,13 +232,13 @@ typedef enum {
|
|||
static const struct {
|
||||
const char *name;
|
||||
u32 hw_flags;
|
||||
} board_info[] __devinitdata = {
|
||||
} board_info[] = {
|
||||
{ "RealTek RTL8139", RTL8139_CAPS },
|
||||
{ "RealTek RTL8129", RTL8129_CAPS },
|
||||
};
|
||||
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
|
||||
static const struct pci_device_id rtl8139_pci_tbl[] = {
|
||||
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
|
|
@ -253,6 +258,7 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
|
|||
{0x126c, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x1743, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x021b, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x16ec, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
|
||||
#ifdef CONFIG_SH_SECUREEDGE5410
|
||||
/* Bogus 8139 silicon reports 8129 without external PROM :-( */
|
||||
|
|
@ -542,8 +548,8 @@ static const struct {
|
|||
|
||||
{ "RTL-8100",
|
||||
HW_REVID(1, 1, 1, 1, 0, 1, 0),
|
||||
HasLWake,
|
||||
},
|
||||
HasLWake,
|
||||
},
|
||||
|
||||
{ "RTL-8100B/8139D",
|
||||
HW_REVID(1, 1, 1, 0, 1, 0, 1),
|
||||
|
|
@ -564,6 +570,12 @@ struct rtl_extra_stats {
|
|||
unsigned long rx_lost_in_ring;
|
||||
};
|
||||
|
||||
struct rtl8139_stats {
|
||||
u64 packets;
|
||||
u64 bytes;
|
||||
struct u64_stats_sync syncp;
|
||||
};
|
||||
|
||||
struct rtl8139_private {
|
||||
void __iomem *mmio_addr;
|
||||
int drv_flags;
|
||||
|
|
@ -574,11 +586,13 @@ struct rtl8139_private {
|
|||
|
||||
unsigned char *rx_ring;
|
||||
unsigned int cur_rx; /* RX buf index of next pkt */
|
||||
struct rtl8139_stats rx_stats;
|
||||
dma_addr_t rx_ring_dma;
|
||||
|
||||
unsigned int tx_flag;
|
||||
unsigned long cur_tx;
|
||||
unsigned long dirty_tx;
|
||||
struct rtl8139_stats tx_stats;
|
||||
unsigned char *tx_buf[NUM_TX_DESC]; /* Tx bounce buffers */
|
||||
unsigned char *tx_bufs; /* Tx bounce buffer region. */
|
||||
dma_addr_t tx_bufs_dma;
|
||||
|
|
@ -611,7 +625,7 @@ MODULE_DESCRIPTION ("RealTek RTL-8139 Fast Ethernet driver");
|
|||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION);
|
||||
|
||||
module_param(use_io, int, 0);
|
||||
module_param(use_io, bool, 0);
|
||||
MODULE_PARM_DESC(use_io, "Force use of I/O access mode. 0=MMIO 1=PIO");
|
||||
module_param(multicast_filter_limit, int, 0);
|
||||
module_param_array(media, int, NULL, 0);
|
||||
|
|
@ -628,7 +642,7 @@ static int mdio_read (struct net_device *dev, int phy_id, int location);
|
|||
static void mdio_write (struct net_device *dev, int phy_id, int location,
|
||||
int val);
|
||||
static void rtl8139_start_thread(struct rtl8139_private *tp);
|
||||
static void rtl8139_tx_timeout (struct net_device *dev);
|
||||
static void rtl8139_tx_timeout (struct net_device *dev, unsigned int txqueue);
|
||||
static void rtl8139_init_ring (struct net_device *dev);
|
||||
static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
||||
struct net_device *dev);
|
||||
|
|
@ -640,7 +654,8 @@ static int rtl8139_poll(struct napi_struct *napi, int budget);
|
|||
static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance);
|
||||
static int rtl8139_close (struct net_device *dev);
|
||||
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev);
|
||||
static void rtl8139_get_stats64(struct net_device *dev,
|
||||
struct rtnl_link_stats64 *stats);
|
||||
static void rtl8139_set_rx_mode (struct net_device *dev);
|
||||
static void __set_rx_mode (struct net_device *dev);
|
||||
static void rtl8139_hw_start (struct net_device *dev);
|
||||
|
|
@ -716,7 +731,6 @@ static void __rtl8139_cleanup_dev (struct net_device *dev)
|
|||
pci_release_regions (pdev);
|
||||
|
||||
free_netdev(dev);
|
||||
pci_set_drvdata (pdev, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -737,26 +751,32 @@ static void rtl8139_chip_reset (void __iomem *ioaddr)
|
|||
}
|
||||
|
||||
|
||||
static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
|
||||
static struct net_device *rtl8139_init_board(struct pci_dev *pdev)
|
||||
{
|
||||
struct device *d = &pdev->dev;
|
||||
void __iomem *ioaddr;
|
||||
struct net_device *dev;
|
||||
struct rtl8139_private *tp;
|
||||
u8 tmp8;
|
||||
int rc, disable_dev_on_err = 0;
|
||||
unsigned int i;
|
||||
unsigned long pio_start, pio_end, pio_flags, pio_len;
|
||||
unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
|
||||
unsigned int i, bar;
|
||||
unsigned long io_len;
|
||||
u32 version;
|
||||
static const struct {
|
||||
unsigned long mask;
|
||||
char *type;
|
||||
} res[] = {
|
||||
{ IORESOURCE_IO, "PIO" },
|
||||
{ IORESOURCE_MEM, "MMIO" }
|
||||
};
|
||||
|
||||
assert (pdev != NULL);
|
||||
|
||||
/* dev and priv zeroed in alloc_etherdev */
|
||||
dev = alloc_etherdev (sizeof (*tp));
|
||||
if (dev == NULL) {
|
||||
dev_err(&pdev->dev, "Unable to alloc new net device\n");
|
||||
if (dev == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
||||
tp = netdev_priv(dev);
|
||||
|
|
@ -767,78 +787,48 @@ static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
|
|||
if (rc)
|
||||
goto err_out;
|
||||
|
||||
pio_start = pci_resource_start (pdev, 0);
|
||||
pio_end = pci_resource_end (pdev, 0);
|
||||
pio_flags = pci_resource_flags (pdev, 0);
|
||||
pio_len = pci_resource_len (pdev, 0);
|
||||
|
||||
mmio_start = pci_resource_start (pdev, 1);
|
||||
mmio_end = pci_resource_end (pdev, 1);
|
||||
mmio_flags = pci_resource_flags (pdev, 1);
|
||||
mmio_len = pci_resource_len (pdev, 1);
|
||||
|
||||
/* set this immediately, we need to know before
|
||||
* we talk to the chip directly */
|
||||
pr_debug("PIO region size == 0x%02lX\n", pio_len);
|
||||
pr_debug("MMIO region size == 0x%02lX\n", mmio_len);
|
||||
|
||||
retry:
|
||||
if (use_io) {
|
||||
/* make sure PCI base addr 0 is PIO */
|
||||
if (!(pio_flags & IORESOURCE_IO)) {
|
||||
dev_err(&pdev->dev, "region #0 not a PIO resource, aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
/* check for weird/broken PCI region reporting */
|
||||
if (pio_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(&pdev->dev, "Invalid PCI I/O region size(s), aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
} else {
|
||||
/* make sure PCI base addr 1 is MMIO */
|
||||
if (!(mmio_flags & IORESOURCE_MEM)) {
|
||||
dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
if (mmio_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(&pdev->dev, "Invalid PCI mem region size(s), aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
|
||||
disable_dev_on_err = 1;
|
||||
rc = pci_request_regions (pdev, DRV_NAME);
|
||||
if (rc)
|
||||
goto err_out;
|
||||
disable_dev_on_err = 1;
|
||||
|
||||
/* enable PCI bus-mastering */
|
||||
pci_set_master (pdev);
|
||||
|
||||
if (use_io) {
|
||||
ioaddr = pci_iomap(pdev, 0, 0);
|
||||
if (!ioaddr) {
|
||||
dev_err(&pdev->dev, "cannot map PIO, aborting\n");
|
||||
rc = -EIO;
|
||||
goto err_out;
|
||||
}
|
||||
dev->base_addr = pio_start;
|
||||
tp->regs_len = pio_len;
|
||||
} else {
|
||||
/* ioremap MMIO region */
|
||||
ioaddr = pci_iomap(pdev, 1, 0);
|
||||
if (ioaddr == NULL) {
|
||||
dev_err(&pdev->dev, "cannot remap MMIO, trying PIO\n");
|
||||
pci_release_regions(pdev);
|
||||
use_io = 1;
|
||||
u64_stats_init(&tp->rx_stats.syncp);
|
||||
u64_stats_init(&tp->tx_stats.syncp);
|
||||
|
||||
retry:
|
||||
/* PIO bar register comes first. */
|
||||
bar = !use_io;
|
||||
|
||||
io_len = pci_resource_len(pdev, bar);
|
||||
|
||||
dev_dbg(d, "%s region size = 0x%02lX\n", res[bar].type, io_len);
|
||||
|
||||
if (!(pci_resource_flags(pdev, bar) & res[bar].mask)) {
|
||||
dev_err(d, "region #%d not a %s resource, aborting\n", bar,
|
||||
res[bar].type);
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
if (io_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(d, "Invalid PCI %s region size(s), aborting\n",
|
||||
res[bar].type);
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
ioaddr = pci_iomap(pdev, bar, 0);
|
||||
if (!ioaddr) {
|
||||
dev_err(d, "cannot map %s\n", res[bar].type);
|
||||
if (!use_io) {
|
||||
use_io = true;
|
||||
goto retry;
|
||||
}
|
||||
dev->base_addr = (long) ioaddr;
|
||||
tp->regs_len = mmio_len;
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
tp->regs_len = io_len;
|
||||
tp->mmio_addr = ioaddr;
|
||||
|
||||
/* Bring old chips out of low-power mode. */
|
||||
|
|
@ -907,24 +897,51 @@ err_out:
|
|||
return ERR_PTR(rc);
|
||||
}
|
||||
|
||||
static int rtl8139_set_features(struct net_device *dev, netdev_features_t features)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
netdev_features_t changed = features ^ dev->features;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
|
||||
if (!(changed & (NETIF_F_RXALL)))
|
||||
return 0;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
|
||||
if (changed & NETIF_F_RXALL) {
|
||||
int rx_mode = tp->rx_config;
|
||||
if (features & NETIF_F_RXALL)
|
||||
rx_mode |= (AcceptErr | AcceptRunt);
|
||||
else
|
||||
rx_mode &= ~(AcceptErr | AcceptRunt);
|
||||
tp->rx_config = rtl8139_rx_config | rx_mode;
|
||||
RTL_W32_F(RxConfig, tp->rx_config);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops rtl8139_netdev_ops = {
|
||||
.ndo_open = rtl8139_open,
|
||||
.ndo_stop = rtl8139_close,
|
||||
.ndo_get_stats = rtl8139_get_stats,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_get_stats64 = rtl8139_get_stats64,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = rtl8139_set_mac_address,
|
||||
.ndo_start_xmit = rtl8139_start_xmit,
|
||||
.ndo_set_multicast_list = rtl8139_set_rx_mode,
|
||||
.ndo_set_rx_mode = rtl8139_set_rx_mode,
|
||||
.ndo_do_ioctl = netdev_ioctl,
|
||||
.ndo_tx_timeout = rtl8139_tx_timeout,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = rtl8139_poll_controller,
|
||||
#endif
|
||||
.ndo_set_features = rtl8139_set_features,
|
||||
};
|
||||
|
||||
static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
static int rtl8139_init_one(struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
{
|
||||
struct net_device *dev = NULL;
|
||||
struct rtl8139_private *tp;
|
||||
|
|
@ -961,7 +978,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
pdev->subsystem_vendor == PCI_VENDOR_ID_ATHEROS &&
|
||||
pdev->subsystem_device == PCI_DEVICE_ID_REALTEK_8139) {
|
||||
pr_info("OQO Model 2 detected. Forcing PIO\n");
|
||||
use_io = 1;
|
||||
use_io = true;
|
||||
}
|
||||
|
||||
dev = rtl8139_init_board (pdev);
|
||||
|
|
@ -979,7 +996,6 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
for (i = 0; i < 3; i++)
|
||||
((__le16 *) (dev->dev_addr))[i] =
|
||||
cpu_to_le16(read_eeprom (ioaddr, i + 7, addr_len));
|
||||
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
|
||||
|
||||
/* The Rtl8139-specific entries in the device structure. */
|
||||
dev->netdev_ops = &rtl8139_netdev_ops;
|
||||
|
|
@ -992,8 +1008,14 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
* features
|
||||
*/
|
||||
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
|
||||
dev->vlan_features = dev->features;
|
||||
|
||||
dev->irq = pdev->irq;
|
||||
dev->hw_features |= NETIF_F_RXALL;
|
||||
dev->hw_features |= NETIF_F_RXFCS;
|
||||
|
||||
/* MTU range: 68 - 1770 */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = MAX_ETH_DATA_SIZE;
|
||||
|
||||
/* tp zeroed and aligned in alloc_etherdev */
|
||||
tp = netdev_priv(dev);
|
||||
|
|
@ -1020,9 +1042,9 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
|
||||
pci_set_drvdata (pdev, dev);
|
||||
|
||||
netdev_info(dev, "%s at 0x%lx, %pM, IRQ %d\n",
|
||||
netdev_info(dev, "%s at 0x%p, %pM, IRQ %d\n",
|
||||
board_info[ent->driver_data].name,
|
||||
dev->base_addr, dev->dev_addr, dev->irq);
|
||||
ioaddr, dev->dev_addr, pdev->irq);
|
||||
|
||||
netdev_dbg(dev, "Identified 8139 chip type '%s'\n",
|
||||
rtl_chip_info[tp->chipset].name);
|
||||
|
|
@ -1089,13 +1111,14 @@ err_out:
|
|||
}
|
||||
|
||||
|
||||
static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
||||
static void rtl8139_remove_one(struct pci_dev *pdev)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
assert (dev != NULL);
|
||||
|
||||
flush_scheduled_work();
|
||||
cancel_delayed_work_sync(&tp->thread);
|
||||
|
||||
unregister_netdev (dev);
|
||||
|
||||
|
|
@ -1119,14 +1142,14 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
|||
No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.
|
||||
*/
|
||||
|
||||
#define eeprom_delay() (void)RTL_R32(Cfg9346)
|
||||
#define eeprom_delay() (void)RTL_R8(Cfg9346)
|
||||
|
||||
/* The EEPROM commands include the alway-set leading bit. */
|
||||
#define EE_WRITE_CMD (5)
|
||||
#define EE_READ_CMD (6)
|
||||
#define EE_ERASE_CMD (7)
|
||||
|
||||
static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_len)
|
||||
static int read_eeprom(void __iomem *ioaddr, int location, int addr_len)
|
||||
{
|
||||
int i;
|
||||
unsigned retval = 0;
|
||||
|
|
@ -1158,7 +1181,7 @@ static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_l
|
|||
}
|
||||
|
||||
/* Terminate the EEPROM access. */
|
||||
RTL_W8 (Cfg9346, ~EE_CS);
|
||||
RTL_W8(Cfg9346, 0);
|
||||
eeprom_delay ();
|
||||
|
||||
return retval;
|
||||
|
|
@ -1296,10 +1319,11 @@ static void mdio_write (struct net_device *dev, int phy_id, int location,
|
|||
static int rtl8139_open (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int retval;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
const int irq = tp->pci_dev->irq;
|
||||
int retval;
|
||||
|
||||
retval = request_irq (dev->irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);
|
||||
retval = request_irq(irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
|
|
@ -1308,7 +1332,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
tp->rx_ring = dma_alloc_coherent(&tp->pci_dev->dev, RX_BUF_TOT_LEN,
|
||||
&tp->rx_ring_dma, GFP_KERNEL);
|
||||
if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {
|
||||
free_irq(dev->irq, dev);
|
||||
free_irq(irq, dev);
|
||||
|
||||
if (tp->tx_bufs)
|
||||
dma_free_coherent(&tp->pci_dev->dev, TX_BUF_TOT_LEN,
|
||||
|
|
@ -1334,7 +1358,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
"%s() ioaddr %#llx IRQ %d GP Pins %02x %s-duplex\n",
|
||||
__func__,
|
||||
(unsigned long long)pci_resource_start (tp->pci_dev, 1),
|
||||
dev->irq, RTL_R8 (MediaStatus),
|
||||
irq, RTL_R8 (MediaStatus),
|
||||
tp->mii.full_duplex ? "full" : "half");
|
||||
|
||||
rtl8139_start_thread(tp);
|
||||
|
|
@ -1636,6 +1660,10 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
int i;
|
||||
u8 tmp8;
|
||||
|
||||
napi_disable(&tp->napi);
|
||||
netif_stop_queue(dev);
|
||||
synchronize_rcu();
|
||||
|
||||
netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
|
||||
RTL_R8(ChipCmd), RTL_R16(IntrStatus),
|
||||
RTL_R16(IntrMask), RTL_R8(MediaStatus));
|
||||
|
|
@ -1665,14 +1693,14 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
spin_unlock_irq(&tp->lock);
|
||||
|
||||
/* ...and finally, reset everything */
|
||||
if (netif_running(dev)) {
|
||||
rtl8139_hw_start (dev);
|
||||
netif_wake_queue (dev);
|
||||
}
|
||||
napi_enable(&tp->napi);
|
||||
rtl8139_hw_start(dev);
|
||||
netif_wake_queue(dev);
|
||||
|
||||
spin_unlock_bh(&tp->rx_lock);
|
||||
}
|
||||
|
||||
static void rtl8139_tx_timeout (struct net_device *dev)
|
||||
static void rtl8139_tx_timeout(struct net_device *dev, unsigned int txqueue)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
|
|
@ -1700,9 +1728,9 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
|||
if (len < ETH_ZLEN)
|
||||
memset(tp->tx_buf[entry], 0, ETH_ZLEN);
|
||||
skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
} else {
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
dev->stats.tx_dropped++;
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
|
@ -1774,8 +1802,10 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
|
|||
dev->stats.tx_fifo_errors++;
|
||||
}
|
||||
dev->stats.collisions += (txstatus >> 24) & 15;
|
||||
dev->stats.tx_bytes += txstatus & 0x7ff;
|
||||
dev->stats.tx_packets++;
|
||||
u64_stats_update_begin(&tp->tx_stats.syncp);
|
||||
tp->tx_stats.packets++;
|
||||
tp->tx_stats.bytes += txstatus & 0x7ff;
|
||||
u64_stats_update_end(&tp->tx_stats.syncp);
|
||||
}
|
||||
|
||||
dirty_tx++;
|
||||
|
|
@ -1938,7 +1968,10 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
|||
/* read size+status of next frame from DMA ring buffer */
|
||||
rx_status = le32_to_cpu (*(__le32 *) (rx_ring + ring_offset));
|
||||
rx_size = rx_status >> 16;
|
||||
pkt_size = rx_size - 4;
|
||||
if (likely(!(dev->features & NETIF_F_RXFCS)))
|
||||
pkt_size = rx_size - 4;
|
||||
else
|
||||
pkt_size = rx_size;
|
||||
|
||||
netif_dbg(tp, rx_status, dev, "%s() status %04x, size %04x, cur %04x\n",
|
||||
__func__, rx_status, rx_size, cur_rx);
|
||||
|
|
@ -1976,15 +2009,34 @@ no_early_rx:
|
|||
if (unlikely((rx_size > (MAX_ETH_FRAME_SIZE+4)) ||
|
||||
(rx_size < 8) ||
|
||||
(!(rx_status & RxStatusOK)))) {
|
||||
if ((dev->features & NETIF_F_RXALL) &&
|
||||
(rx_size <= (MAX_ETH_FRAME_SIZE + 4)) &&
|
||||
(rx_size >= 8) &&
|
||||
(!(rx_status & RxStatusOK))) {
|
||||
/* Length is at least mostly OK, but pkt has
|
||||
* error. I'm hoping we can handle some of these
|
||||
* errors without resetting the chip. --Ben
|
||||
*/
|
||||
dev->stats.rx_errors++;
|
||||
if (rx_status & RxCRCErr) {
|
||||
dev->stats.rx_crc_errors++;
|
||||
goto keep_pkt;
|
||||
}
|
||||
if (rx_status & RxRunt) {
|
||||
dev->stats.rx_length_errors++;
|
||||
goto keep_pkt;
|
||||
}
|
||||
}
|
||||
rtl8139_rx_err (rx_status, dev, tp, ioaddr);
|
||||
received = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
keep_pkt:
|
||||
/* Malloc up new buffer, compatible with net-2e. */
|
||||
/* Omit the four octet CRC from the length. */
|
||||
|
||||
skb = netdev_alloc_skb_ip_align(dev, pkt_size);
|
||||
skb = napi_alloc_skb(&tp->napi, pkt_size);
|
||||
if (likely(skb)) {
|
||||
#if RX_BUF_IDX == 3
|
||||
wrap_copy(skb, rx_ring, ring_offset+4, pkt_size);
|
||||
|
|
@ -1995,13 +2047,13 @@ no_early_rx:
|
|||
|
||||
skb->protocol = eth_type_trans (skb, dev);
|
||||
|
||||
dev->stats.rx_bytes += pkt_size;
|
||||
dev->stats.rx_packets++;
|
||||
u64_stats_update_begin(&tp->rx_stats.syncp);
|
||||
tp->rx_stats.packets++;
|
||||
tp->rx_stats.bytes += pkt_size;
|
||||
u64_stats_update_end(&tp->rx_stats.syncp);
|
||||
|
||||
netif_receive_skb (skb);
|
||||
} else {
|
||||
if (net_ratelimit())
|
||||
netdev_warn(dev, "Memory squeeze, dropping packet\n");
|
||||
dev->stats.rx_dropped++;
|
||||
}
|
||||
received++;
|
||||
|
|
@ -2084,13 +2136,10 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
|
|||
|
||||
if (work_done < budget) {
|
||||
unsigned long flags;
|
||||
/*
|
||||
* Order is important since data can get interrupted
|
||||
* again when we think we are done.
|
||||
*/
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
__napi_complete(napi);
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
if (napi_complete_done(napi, work_done))
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
}
|
||||
spin_unlock(&tp->rx_lock);
|
||||
|
|
@ -2171,9 +2220,12 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
*/
|
||||
static void rtl8139_poll_controller(struct net_device *dev)
|
||||
{
|
||||
disable_irq(dev->irq);
|
||||
rtl8139_interrupt(dev->irq, dev);
|
||||
enable_irq(dev->irq);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
const int irq = tp->pci_dev->irq;
|
||||
|
||||
disable_irq_nosync(irq);
|
||||
rtl8139_interrupt(irq, dev);
|
||||
enable_irq(irq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2226,7 +2278,7 @@ static int rtl8139_close (struct net_device *dev)
|
|||
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
free_irq (dev->irq, dev);
|
||||
free_irq(tp->pci_dev->irq, dev);
|
||||
|
||||
rtl8139_tx_clear (tp);
|
||||
|
||||
|
|
@ -2327,27 +2379,28 @@ static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
|||
static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
strcpy(info->driver, DRV_NAME);
|
||||
strcpy(info->version, DRV_VERSION);
|
||||
strcpy(info->bus_info, pci_name(tp->pci_dev));
|
||||
info->regdump_len = tp->regs_len;
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
strlcpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int rtl8139_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static int rtl8139_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
spin_lock_irq(&tp->lock);
|
||||
mii_ethtool_gset(&tp->mii, cmd);
|
||||
mii_ethtool_get_link_ksettings(&tp->mii, cmd);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8139_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static int rtl8139_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int rc;
|
||||
spin_lock_irq(&tp->lock);
|
||||
rc = mii_ethtool_sset(&tp->mii, cmd);
|
||||
rc = mii_ethtool_set_link_ksettings(&tp->mii, cmd);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -2429,8 +2482,6 @@ static void rtl8139_get_strings(struct net_device *dev, u32 stringset, u8 *data)
|
|||
|
||||
static const struct ethtool_ops rtl8139_ethtool_ops = {
|
||||
.get_drvinfo = rtl8139_get_drvinfo,
|
||||
.get_settings = rtl8139_get_settings,
|
||||
.set_settings = rtl8139_set_settings,
|
||||
.get_regs_len = rtl8139_get_regs_len,
|
||||
.get_regs = rtl8139_get_regs,
|
||||
.nway_reset = rtl8139_nway_reset,
|
||||
|
|
@ -2442,6 +2493,8 @@ static const struct ethtool_ops rtl8139_ethtool_ops = {
|
|||
.get_strings = rtl8139_get_strings,
|
||||
.get_sset_count = rtl8139_get_sset_count,
|
||||
.get_ethtool_stats = rtl8139_get_ethtool_stats,
|
||||
.get_link_ksettings = rtl8139_get_link_ksettings,
|
||||
.set_link_ksettings = rtl8139_set_link_ksettings,
|
||||
};
|
||||
|
||||
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
|
|
@ -2460,11 +2513,13 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
|||
}
|
||||
|
||||
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
||||
static void
|
||||
rtl8139_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
unsigned int start;
|
||||
|
||||
if (netif_running(dev)) {
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
|
|
@ -2473,7 +2528,19 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
|||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
}
|
||||
|
||||
return &dev->stats;
|
||||
netdev_stats_to_stats64(stats, &dev->stats);
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&tp->rx_stats.syncp);
|
||||
stats->rx_packets = tp->rx_stats.packets;
|
||||
stats->rx_bytes = tp->rx_stats.bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&tp->rx_stats.syncp, start));
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&tp->tx_stats.syncp);
|
||||
stats->tx_packets = tp->tx_stats.packets;
|
||||
stats->tx_bytes = tp->tx_stats.bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&tp->tx_stats.syncp, start));
|
||||
}
|
||||
|
||||
/* Set or clear the multicast filter for this adaptor.
|
||||
|
|
@ -2513,6 +2580,9 @@ static void __set_rx_mode (struct net_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
if (dev->features & NETIF_F_RXALL)
|
||||
rx_mode |= (AcceptErr | AcceptRunt);
|
||||
|
||||
/* We can safely update without stopping the chip. */
|
||||
tmp = rtl8139_rx_config | rx_mode;
|
||||
if (tp->rx_config != tmp) {
|
||||
|
|
@ -2533,17 +2603,13 @@ static void rtl8139_set_rx_mode (struct net_device *dev)
|
|||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
||||
static int __maybe_unused rtl8139_suspend(struct device *device)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct net_device *dev = dev_get_drvdata(device);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
|
||||
pci_save_state (pdev);
|
||||
|
||||
if (!netif_running (dev))
|
||||
return 0;
|
||||
|
||||
|
|
@ -2561,38 +2627,30 @@ static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
|||
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
pci_set_power_state (pdev, PCI_D3hot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int rtl8139_resume (struct pci_dev *pdev)
|
||||
static int __maybe_unused rtl8139_resume(struct device *device)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct net_device *dev = dev_get_drvdata(device);
|
||||
|
||||
pci_restore_state (pdev);
|
||||
if (!netif_running (dev))
|
||||
return 0;
|
||||
pci_set_power_state (pdev, PCI_D0);
|
||||
|
||||
rtl8139_init_ring (dev);
|
||||
rtl8139_hw_start (dev);
|
||||
netif_device_attach (dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(rtl8139_pm_ops, rtl8139_suspend, rtl8139_resume);
|
||||
|
||||
static struct pci_driver rtl8139_pci_driver = {
|
||||
.name = DRV_NAME,
|
||||
.id_table = rtl8139_pci_tbl,
|
||||
.probe = rtl8139_init_one,
|
||||
.remove = __devexit_p(rtl8139_remove_one),
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = rtl8139_suspend,
|
||||
.resume = rtl8139_resume,
|
||||
#endif /* CONFIG_PM */
|
||||
.remove = rtl8139_remove_one,
|
||||
.driver.pm = &rtl8139_pm_ops,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
/******************************************************************************
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
* Copyright (C) 2006-2023 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT Master.
|
||||
*
|
||||
|
|
@ -19,22 +17,16 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
|
@ -50,7 +42,7 @@
|
|||
|
||||
-----<snip>-----
|
||||
|
||||
Written 1997-2001 by Donald Becker.
|
||||
Written 1997-2001 by Donald Becker.
|
||||
This software may be used and distributed according to the
|
||||
terms of the GNU General Public License (GPL), incorporated
|
||||
herein by reference. Drivers based on or derived from this
|
||||
|
|
@ -139,6 +131,7 @@
|
|||
#include <linux/compiler.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
|
@ -150,14 +143,15 @@
|
|||
#include <linux/io.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
#include "../globals.h"
|
||||
#include "ecdev.h"
|
||||
|
||||
#define RTL8139_DRIVER_NAME DRV_NAME \
|
||||
" EtherCAT-capable Fast Ethernet driver " \
|
||||
DRV_VERSION ", master " EC_MASTER_VERSION
|
||||
" EtherCAT-capable Fast Ethernet driver " \
|
||||
DRV_VERSION ", master " EC_MASTER_VERSION
|
||||
|
||||
#define PFX DRV_NAME ": "
|
||||
|
||||
|
|
@ -193,9 +187,9 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
|
|||
|
||||
/* Whether to use MMIO or PIO. Default to MMIO. */
|
||||
#ifdef CONFIG_8139TOO_PIO
|
||||
static int use_io = 1;
|
||||
static bool use_io = true;
|
||||
#else
|
||||
static int use_io = 0;
|
||||
static bool use_io = false;
|
||||
#endif
|
||||
|
||||
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
|
||||
|
|
@ -227,10 +221,13 @@ static int debug = -1;
|
|||
/* Number of Tx descriptor registers. */
|
||||
#define NUM_TX_DESC 4
|
||||
|
||||
/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1536
|
||||
/* max supported ethernet frame size -- must be at least (dev->mtu+18+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1792
|
||||
|
||||
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */
|
||||
/* max supported payload size */
|
||||
#define MAX_ETH_DATA_SIZE (MAX_ETH_FRAME_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN)
|
||||
|
||||
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+18+4). */
|
||||
#define TX_BUF_SIZE MAX_ETH_FRAME_SIZE
|
||||
#define TX_BUF_TOT_LEN (TX_BUF_SIZE * NUM_TX_DESC)
|
||||
|
||||
|
|
@ -273,13 +270,13 @@ typedef enum {
|
|||
static const struct {
|
||||
const char *name;
|
||||
u32 hw_flags;
|
||||
} board_info[] __devinitdata = {
|
||||
} board_info[] = {
|
||||
{ "RealTek RTL8139", RTL8139_CAPS },
|
||||
{ "RealTek RTL8129", RTL8129_CAPS },
|
||||
};
|
||||
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
|
||||
static const struct pci_device_id rtl8139_pci_tbl[] = {
|
||||
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
|
|
@ -299,6 +296,7 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
|
|||
{0x126c, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x1743, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x021b, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x16ec, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
|
||||
#ifdef CONFIG_SH_SECUREEDGE5410
|
||||
/* Bogus 8139 silicon reports 8129 without external PROM :-( */
|
||||
|
|
@ -590,8 +588,8 @@ static const struct {
|
|||
|
||||
{ "RTL-8100",
|
||||
HW_REVID(1, 1, 1, 1, 0, 1, 0),
|
||||
HasLWake,
|
||||
},
|
||||
HasLWake,
|
||||
},
|
||||
|
||||
{ "RTL-8100B/8139D",
|
||||
HW_REVID(1, 1, 1, 0, 1, 0, 1),
|
||||
|
|
@ -612,6 +610,12 @@ struct rtl_extra_stats {
|
|||
unsigned long rx_lost_in_ring;
|
||||
};
|
||||
|
||||
struct rtl8139_stats {
|
||||
u64 packets;
|
||||
u64 bytes;
|
||||
struct u64_stats_sync syncp;
|
||||
};
|
||||
|
||||
struct rtl8139_private {
|
||||
void __iomem *mmio_addr;
|
||||
int drv_flags;
|
||||
|
|
@ -622,11 +626,13 @@ struct rtl8139_private {
|
|||
|
||||
unsigned char *rx_ring;
|
||||
unsigned int cur_rx; /* RX buf index of next pkt */
|
||||
struct rtl8139_stats rx_stats;
|
||||
dma_addr_t rx_ring_dma;
|
||||
|
||||
unsigned int tx_flag;
|
||||
unsigned long cur_tx;
|
||||
unsigned long dirty_tx;
|
||||
struct rtl8139_stats tx_stats;
|
||||
unsigned char *tx_buf[NUM_TX_DESC]; /* Tx bounce buffers */
|
||||
unsigned char *tx_bufs; /* Tx bounce buffer region. */
|
||||
dma_addr_t tx_bufs_dma;
|
||||
|
|
@ -656,12 +662,12 @@ struct rtl8139_private {
|
|||
ec_device_t *ecdev;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
||||
module_param(use_io, int, 0);
|
||||
module_param(use_io, bool, 0);
|
||||
MODULE_PARM_DESC(use_io, "Force use of I/O access mode. 0=MMIO 1=PIO");
|
||||
module_param(multicast_filter_limit, int, 0);
|
||||
module_param_array(media, int, NULL, 0);
|
||||
|
|
@ -680,7 +686,7 @@ static int mdio_read (struct net_device *dev, int phy_id, int location);
|
|||
static void mdio_write (struct net_device *dev, int phy_id, int location,
|
||||
int val);
|
||||
static void rtl8139_start_thread(struct rtl8139_private *tp);
|
||||
static void rtl8139_tx_timeout (struct net_device *dev);
|
||||
static void rtl8139_tx_timeout (struct net_device *dev, unsigned int txqueue);
|
||||
static void rtl8139_init_ring (struct net_device *dev);
|
||||
static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
||||
struct net_device *dev);
|
||||
|
|
@ -692,7 +698,8 @@ static int rtl8139_poll(struct napi_struct *napi, int budget);
|
|||
static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance);
|
||||
static int rtl8139_close (struct net_device *dev);
|
||||
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev);
|
||||
static void rtl8139_get_stats64(struct net_device *dev,
|
||||
struct rtnl_link_stats64 *stats);
|
||||
static void rtl8139_set_rx_mode (struct net_device *dev);
|
||||
static void __set_rx_mode (struct net_device *dev);
|
||||
static void rtl8139_hw_start (struct net_device *dev);
|
||||
|
|
@ -768,7 +775,6 @@ static void __rtl8139_cleanup_dev (struct net_device *dev)
|
|||
pci_release_regions (pdev);
|
||||
|
||||
free_netdev(dev);
|
||||
pci_set_drvdata (pdev, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -789,26 +795,32 @@ static void rtl8139_chip_reset (void __iomem *ioaddr)
|
|||
}
|
||||
|
||||
|
||||
static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
|
||||
static struct net_device *rtl8139_init_board(struct pci_dev *pdev)
|
||||
{
|
||||
struct device *d = &pdev->dev;
|
||||
void __iomem *ioaddr;
|
||||
struct net_device *dev;
|
||||
struct rtl8139_private *tp;
|
||||
u8 tmp8;
|
||||
int rc, disable_dev_on_err = 0;
|
||||
unsigned int i;
|
||||
unsigned long pio_start, pio_end, pio_flags, pio_len;
|
||||
unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
|
||||
unsigned int i, bar;
|
||||
unsigned long io_len;
|
||||
u32 version;
|
||||
static const struct {
|
||||
unsigned long mask;
|
||||
char *type;
|
||||
} res[] = {
|
||||
{ IORESOURCE_IO, "PIO" },
|
||||
{ IORESOURCE_MEM, "MMIO" }
|
||||
};
|
||||
|
||||
assert (pdev != NULL);
|
||||
|
||||
/* dev and priv zeroed in alloc_etherdev */
|
||||
dev = alloc_etherdev (sizeof (*tp));
|
||||
if (dev == NULL) {
|
||||
dev_err(&pdev->dev, "Unable to alloc new net device\n");
|
||||
if (dev == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
||||
tp = netdev_priv(dev);
|
||||
|
|
@ -819,78 +831,48 @@ static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
|
|||
if (rc)
|
||||
goto err_out;
|
||||
|
||||
pio_start = pci_resource_start (pdev, 0);
|
||||
pio_end = pci_resource_end (pdev, 0);
|
||||
pio_flags = pci_resource_flags (pdev, 0);
|
||||
pio_len = pci_resource_len (pdev, 0);
|
||||
|
||||
mmio_start = pci_resource_start (pdev, 1);
|
||||
mmio_end = pci_resource_end (pdev, 1);
|
||||
mmio_flags = pci_resource_flags (pdev, 1);
|
||||
mmio_len = pci_resource_len (pdev, 1);
|
||||
|
||||
/* set this immediately, we need to know before
|
||||
* we talk to the chip directly */
|
||||
pr_debug("PIO region size == 0x%02lX\n", pio_len);
|
||||
pr_debug("MMIO region size == 0x%02lX\n", mmio_len);
|
||||
|
||||
retry:
|
||||
if (use_io) {
|
||||
/* make sure PCI base addr 0 is PIO */
|
||||
if (!(pio_flags & IORESOURCE_IO)) {
|
||||
dev_err(&pdev->dev, "region #0 not a PIO resource, aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
/* check for weird/broken PCI region reporting */
|
||||
if (pio_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(&pdev->dev, "Invalid PCI I/O region size(s), aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
} else {
|
||||
/* make sure PCI base addr 1 is MMIO */
|
||||
if (!(mmio_flags & IORESOURCE_MEM)) {
|
||||
dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
if (mmio_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(&pdev->dev, "Invalid PCI mem region size(s), aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
|
||||
disable_dev_on_err = 1;
|
||||
rc = pci_request_regions (pdev, DRV_NAME);
|
||||
if (rc)
|
||||
goto err_out;
|
||||
disable_dev_on_err = 1;
|
||||
|
||||
/* enable PCI bus-mastering */
|
||||
pci_set_master (pdev);
|
||||
|
||||
if (use_io) {
|
||||
ioaddr = pci_iomap(pdev, 0, 0);
|
||||
if (!ioaddr) {
|
||||
dev_err(&pdev->dev, "cannot map PIO, aborting\n");
|
||||
rc = -EIO;
|
||||
goto err_out;
|
||||
}
|
||||
dev->base_addr = pio_start;
|
||||
tp->regs_len = pio_len;
|
||||
} else {
|
||||
/* ioremap MMIO region */
|
||||
ioaddr = pci_iomap(pdev, 1, 0);
|
||||
if (ioaddr == NULL) {
|
||||
dev_err(&pdev->dev, "cannot remap MMIO, trying PIO\n");
|
||||
pci_release_regions(pdev);
|
||||
use_io = 1;
|
||||
u64_stats_init(&tp->rx_stats.syncp);
|
||||
u64_stats_init(&tp->tx_stats.syncp);
|
||||
|
||||
retry:
|
||||
/* PIO bar register comes first. */
|
||||
bar = !use_io;
|
||||
|
||||
io_len = pci_resource_len(pdev, bar);
|
||||
|
||||
dev_dbg(d, "%s region size = 0x%02lX\n", res[bar].type, io_len);
|
||||
|
||||
if (!(pci_resource_flags(pdev, bar) & res[bar].mask)) {
|
||||
dev_err(d, "region #%d not a %s resource, aborting\n", bar,
|
||||
res[bar].type);
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
if (io_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(d, "Invalid PCI %s region size(s), aborting\n",
|
||||
res[bar].type);
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
ioaddr = pci_iomap(pdev, bar, 0);
|
||||
if (!ioaddr) {
|
||||
dev_err(d, "cannot map %s\n", res[bar].type);
|
||||
if (!use_io) {
|
||||
use_io = true;
|
||||
goto retry;
|
||||
}
|
||||
dev->base_addr = (long) ioaddr;
|
||||
tp->regs_len = mmio_len;
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
tp->regs_len = io_len;
|
||||
tp->mmio_addr = ioaddr;
|
||||
|
||||
/* Bring old chips out of low-power mode. */
|
||||
|
|
@ -959,24 +941,51 @@ err_out:
|
|||
return ERR_PTR(rc);
|
||||
}
|
||||
|
||||
static int rtl8139_set_features(struct net_device *dev, netdev_features_t features)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
netdev_features_t changed = features ^ dev->features;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
|
||||
if (!(changed & (NETIF_F_RXALL)))
|
||||
return 0;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
|
||||
if (changed & NETIF_F_RXALL) {
|
||||
int rx_mode = tp->rx_config;
|
||||
if (features & NETIF_F_RXALL)
|
||||
rx_mode |= (AcceptErr | AcceptRunt);
|
||||
else
|
||||
rx_mode &= ~(AcceptErr | AcceptRunt);
|
||||
tp->rx_config = rtl8139_rx_config | rx_mode;
|
||||
RTL_W32_F(RxConfig, tp->rx_config);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops rtl8139_netdev_ops = {
|
||||
.ndo_open = rtl8139_open,
|
||||
.ndo_stop = rtl8139_close,
|
||||
.ndo_get_stats = rtl8139_get_stats,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_get_stats64 = rtl8139_get_stats64,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = rtl8139_set_mac_address,
|
||||
.ndo_start_xmit = rtl8139_start_xmit,
|
||||
.ndo_set_multicast_list = rtl8139_set_rx_mode,
|
||||
.ndo_do_ioctl = netdev_ioctl,
|
||||
.ndo_set_rx_mode = rtl8139_set_rx_mode,
|
||||
.ndo_eth_ioctl = netdev_ioctl,
|
||||
.ndo_tx_timeout = rtl8139_tx_timeout,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = rtl8139_poll_controller,
|
||||
#endif
|
||||
.ndo_set_features = rtl8139_set_features,
|
||||
};
|
||||
|
||||
static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
static int rtl8139_init_one(struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
{
|
||||
struct net_device *dev = NULL;
|
||||
struct rtl8139_private *tp;
|
||||
|
|
@ -1013,7 +1022,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
pdev->subsystem_vendor == PCI_VENDOR_ID_ATHEROS &&
|
||||
pdev->subsystem_device == PCI_DEVICE_ID_REALTEK_8139) {
|
||||
pr_info("OQO Model 2 detected. Forcing PIO\n");
|
||||
use_io = 1;
|
||||
use_io = true;
|
||||
}
|
||||
|
||||
dev = rtl8139_init_board (pdev);
|
||||
|
|
@ -1031,7 +1040,6 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
for (i = 0; i < 3; i++)
|
||||
((__le16 *) (dev->dev_addr))[i] =
|
||||
cpu_to_le16(read_eeprom (ioaddr, i + 7, addr_len));
|
||||
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
|
||||
|
||||
/* The Rtl8139-specific entries in the device structure. */
|
||||
dev->netdev_ops = &rtl8139_netdev_ops;
|
||||
|
|
@ -1044,8 +1052,14 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
* features
|
||||
*/
|
||||
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
|
||||
dev->vlan_features = dev->features;
|
||||
|
||||
dev->irq = pdev->irq;
|
||||
dev->hw_features |= NETIF_F_RXALL;
|
||||
dev->hw_features |= NETIF_F_RXFCS;
|
||||
|
||||
/* MTU range: 68 - 1770 */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = MAX_ETH_DATA_SIZE;
|
||||
|
||||
/* tp zeroed and aligned in alloc_etherdev */
|
||||
tp = netdev_priv(dev);
|
||||
|
|
@ -1065,11 +1079,13 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
tp->mii.reg_num_mask = 0x1f;
|
||||
|
||||
/* dev is fully set up and ready to use now */
|
||||
|
||||
// offer device to EtherCAT master module
|
||||
tp->ecdev = ecdev_offer(dev, ec_poll, THIS_MODULE);
|
||||
|
||||
if (!tp->ecdev) {
|
||||
pr_debug("about to register device named %s (%p)...\n", dev->name, dev);
|
||||
pr_debug("about to register device named %s (%p)...\n",
|
||||
dev->name, dev);
|
||||
i = register_netdev (dev);
|
||||
if (i) goto err_out;
|
||||
}
|
||||
|
|
@ -1157,20 +1173,20 @@ err_out:
|
|||
}
|
||||
|
||||
|
||||
static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
||||
static void rtl8139_remove_one(struct pci_dev *pdev)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
assert (dev != NULL);
|
||||
|
||||
flush_scheduled_work();
|
||||
|
||||
if (tp->ecdev) {
|
||||
ecdev_close(tp->ecdev);
|
||||
ecdev_withdraw(tp->ecdev);
|
||||
}
|
||||
else {
|
||||
cancel_delayed_work_sync(&tp->thread);
|
||||
|
||||
unregister_netdev (dev);
|
||||
}
|
||||
|
||||
|
|
@ -1194,14 +1210,14 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
|||
No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.
|
||||
*/
|
||||
|
||||
#define eeprom_delay() (void)RTL_R32(Cfg9346)
|
||||
#define eeprom_delay() (void)RTL_R8(Cfg9346)
|
||||
|
||||
/* The EEPROM commands include the alway-set leading bit. */
|
||||
#define EE_WRITE_CMD (5)
|
||||
#define EE_READ_CMD (6)
|
||||
#define EE_ERASE_CMD (7)
|
||||
|
||||
static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_len)
|
||||
static int read_eeprom(void __iomem *ioaddr, int location, int addr_len)
|
||||
{
|
||||
int i;
|
||||
unsigned retval = 0;
|
||||
|
|
@ -1233,7 +1249,7 @@ static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_l
|
|||
}
|
||||
|
||||
/* Terminate the EEPROM access. */
|
||||
RTL_W8 (Cfg9346, ~EE_CS);
|
||||
RTL_W8(Cfg9346, 0);
|
||||
eeprom_delay ();
|
||||
|
||||
return retval;
|
||||
|
|
@ -1371,12 +1387,12 @@ static void mdio_write (struct net_device *dev, int phy_id, int location,
|
|||
static int rtl8139_open (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int retval;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
const int irq = tp->pci_dev->irq;
|
||||
int retval;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
retval = request_irq(dev->irq, rtl8139_interrupt,
|
||||
IRQF_SHARED, dev->name, dev);
|
||||
retval = request_irq(irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
|
|
@ -1387,7 +1403,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
&tp->rx_ring_dma, GFP_KERNEL);
|
||||
if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {
|
||||
if (!tp->ecdev) {
|
||||
free_irq(dev->irq, dev);
|
||||
free_irq(irq, dev);
|
||||
}
|
||||
|
||||
if (tp->tx_bufs)
|
||||
|
|
@ -1416,7 +1432,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
"%s() ioaddr %#llx IRQ %d GP Pins %02x %s-duplex\n",
|
||||
__func__,
|
||||
(unsigned long long)pci_resource_start (tp->pci_dev, 1),
|
||||
dev->irq, RTL_R8 (MediaStatus),
|
||||
irq, RTL_R8 (MediaStatus),
|
||||
tp->mii.full_duplex ? "full" : "half");
|
||||
|
||||
if (!tp->ecdev) {
|
||||
|
|
@ -1729,6 +1745,10 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
int i;
|
||||
u8 tmp8;
|
||||
|
||||
napi_disable(&tp->napi);
|
||||
netif_stop_queue(dev);
|
||||
synchronize_rcu();
|
||||
|
||||
netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
|
||||
RTL_R8(ChipCmd), RTL_R16(IntrStatus),
|
||||
RTL_R16(IntrMask), RTL_R8(MediaStatus));
|
||||
|
|
@ -1753,25 +1773,25 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
rtl8139_hw_start (dev);
|
||||
}
|
||||
else {
|
||||
spin_lock_bh(&tp->rx_lock);
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0x0000);
|
||||
spin_lock_bh(&tp->rx_lock);
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0x0000);
|
||||
|
||||
/* Stop a shared interrupt from scavenging while we are. */
|
||||
spin_lock_irq(&tp->lock);
|
||||
rtl8139_tx_clear (tp);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
/* Stop a shared interrupt from scavenging while we are. */
|
||||
spin_lock_irq(&tp->lock);
|
||||
rtl8139_tx_clear (tp);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
|
||||
/* ...and finally, reset everything */
|
||||
if (netif_running(dev)) {
|
||||
rtl8139_hw_start (dev);
|
||||
netif_wake_queue (dev);
|
||||
}
|
||||
spin_unlock_bh(&tp->rx_lock);
|
||||
/* ...and finally, reset everything */
|
||||
napi_enable(&tp->napi);
|
||||
rtl8139_hw_start(dev);
|
||||
netif_wake_queue(dev);
|
||||
|
||||
spin_unlock_bh(&tp->rx_lock);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtl8139_tx_timeout (struct net_device *dev)
|
||||
static void rtl8139_tx_timeout(struct net_device *dev, unsigned int txqueue)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
|
|
@ -1800,11 +1820,11 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
|||
memset(tp->tx_buf[entry], 0, ETH_ZLEN);
|
||||
skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);
|
||||
if (!tp->ecdev) {
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
} else {
|
||||
if (!tp->ecdev) {
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
dev->stats.tx_dropped++;
|
||||
return NETDEV_TX_OK;
|
||||
|
|
@ -1881,8 +1901,10 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
|
|||
dev->stats.tx_fifo_errors++;
|
||||
}
|
||||
dev->stats.collisions += (txstatus >> 24) & 15;
|
||||
dev->stats.tx_bytes += txstatus & 0x7ff;
|
||||
dev->stats.tx_packets++;
|
||||
u64_stats_update_begin(&tp->tx_stats.syncp);
|
||||
tp->tx_stats.packets++;
|
||||
tp->tx_stats.bytes += txstatus & 0x7ff;
|
||||
u64_stats_update_end(&tp->tx_stats.syncp);
|
||||
}
|
||||
|
||||
dirty_tx++;
|
||||
|
|
@ -2050,7 +2072,10 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
|||
/* read size+status of next frame from DMA ring buffer */
|
||||
rx_status = le32_to_cpu (*(__le32 *) (rx_ring + ring_offset));
|
||||
rx_size = rx_status >> 16;
|
||||
pkt_size = rx_size - 4;
|
||||
if (likely(!(dev->features & NETIF_F_RXFCS)))
|
||||
pkt_size = rx_size - 4;
|
||||
else
|
||||
pkt_size = rx_size;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (netif_msg_rx_status(tp))
|
||||
|
|
@ -2100,39 +2125,56 @@ no_early_rx:
|
|||
if (unlikely((rx_size > (MAX_ETH_FRAME_SIZE+4)) ||
|
||||
(rx_size < 8) ||
|
||||
(!(rx_status & RxStatusOK)))) {
|
||||
if ((dev->features & NETIF_F_RXALL) &&
|
||||
(rx_size <= (MAX_ETH_FRAME_SIZE + 4)) &&
|
||||
(rx_size >= 8) &&
|
||||
(!(rx_status & RxStatusOK))) {
|
||||
/* Length is at least mostly OK, but pkt has
|
||||
* error. I'm hoping we can handle some of these
|
||||
* errors without resetting the chip. --Ben
|
||||
*/
|
||||
dev->stats.rx_errors++;
|
||||
if (rx_status & RxCRCErr) {
|
||||
dev->stats.rx_crc_errors++;
|
||||
goto keep_pkt;
|
||||
}
|
||||
if (rx_status & RxRunt) {
|
||||
dev->stats.rx_length_errors++;
|
||||
goto keep_pkt;
|
||||
}
|
||||
}
|
||||
rtl8139_rx_err (rx_status, dev, tp, ioaddr);
|
||||
received = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
keep_pkt:
|
||||
if (tp->ecdev) {
|
||||
ecdev_receive(tp->ecdev, &rx_ring[ring_offset + 4], pkt_size);
|
||||
dev->stats.rx_bytes += pkt_size;
|
||||
dev->stats.rx_packets++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* Malloc up new buffer, compatible with net-2e. */
|
||||
/* Omit the four octet CRC from the length. */
|
||||
|
||||
skb = netdev_alloc_skb(dev, pkt_size + NET_IP_ALIGN);
|
||||
skb = napi_alloc_skb(&tp->napi, pkt_size);
|
||||
if (likely(skb)) {
|
||||
skb_reserve (skb, NET_IP_ALIGN); /* 16 byte align the IP fields. */
|
||||
#if RX_BUF_IDX == 3
|
||||
wrap_copy(skb, rx_ring, ring_offset+4, pkt_size);
|
||||
#else
|
||||
skb_copy_to_linear_data (skb, &rx_ring[ring_offset + 4], pkt_size);
|
||||
skb_copy_to_linear_data (skb, &rx_ring[ring_offset + 4],
|
||||
pkt_size);
|
||||
#endif
|
||||
skb_put (skb, pkt_size);
|
||||
|
||||
skb->protocol = eth_type_trans (skb, dev);
|
||||
|
||||
dev->stats.rx_bytes += pkt_size;
|
||||
dev->stats.rx_packets++;
|
||||
u64_stats_update_begin(&tp->rx_stats.syncp);
|
||||
tp->rx_stats.packets++;
|
||||
tp->rx_stats.bytes += pkt_size;
|
||||
u64_stats_update_end(&tp->rx_stats.syncp);
|
||||
|
||||
netif_receive_skb (skb);
|
||||
} else {
|
||||
if (net_ratelimit())
|
||||
pr_warning("%s: Memory squeeze, dropping packet.\n",
|
||||
dev->name);
|
||||
dev->stats.rx_dropped++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2219,13 +2261,10 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
|
|||
|
||||
if (work_done < budget) {
|
||||
unsigned long flags;
|
||||
/*
|
||||
* Order is important since data can get interrupted
|
||||
* again when we think we are done.
|
||||
*/
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
__napi_complete(napi);
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
if (napi_complete_done(napi, work_done))
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
}
|
||||
spin_unlock(&tp->rx_lock);
|
||||
|
|
@ -2309,7 +2348,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
if (status & TxErr)
|
||||
RTL_W16 (IntrStatus, TxErr);
|
||||
}
|
||||
out:
|
||||
out:
|
||||
if (!tp->ecdev) {
|
||||
spin_unlock (&tp->lock);
|
||||
}
|
||||
|
|
@ -2326,9 +2365,12 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
*/
|
||||
static void rtl8139_poll_controller(struct net_device *dev)
|
||||
{
|
||||
disable_irq(dev->irq);
|
||||
rtl8139_interrupt(dev->irq, dev);
|
||||
enable_irq(dev->irq);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
const int irq = tp->pci_dev->irq;
|
||||
|
||||
disable_irq_nosync(irq);
|
||||
rtl8139_interrupt(irq, dev);
|
||||
enable_irq(irq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2359,41 +2401,33 @@ static int rtl8139_close (struct net_device *dev)
|
|||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
unsigned long flags = 0;
|
||||
|
||||
if (tp->ecdev) {
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8 (ChipCmd, 0);
|
||||
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0);
|
||||
|
||||
/* Update the error counts. */
|
||||
dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
} else {
|
||||
if (!tp->ecdev) {
|
||||
netif_stop_queue(dev);
|
||||
napi_disable(&tp->napi);
|
||||
|
||||
if (netif_msg_ifdown(tp))
|
||||
pr_debug("%s: Shutting down ethercard, status was 0x%4.4x.\n",
|
||||
dev->name, RTL_R16 (IntrStatus));
|
||||
netif_dbg(tp, ifdown, dev,
|
||||
"Shutting down ethercard, status was 0x%04x\n",
|
||||
RTL_R16(IntrStatus));
|
||||
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
}
|
||||
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8 (ChipCmd, 0);
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8 (ChipCmd, 0);
|
||||
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0);
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16 (IntrMask, 0);
|
||||
|
||||
/* Update the error counts. */
|
||||
dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
/* Update the error counts. */
|
||||
dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
|
||||
if (!tp->ecdev) {
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
free_irq (dev->irq, dev);
|
||||
free_irq(tp->pci_dev->irq, dev);
|
||||
}
|
||||
|
||||
rtl8139_tx_clear (tp);
|
||||
|
|
@ -2495,27 +2529,28 @@ static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
|||
static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
strcpy(info->driver, DRV_NAME);
|
||||
strcpy(info->version, DRV_VERSION);
|
||||
strcpy(info->bus_info, pci_name(tp->pci_dev));
|
||||
info->regdump_len = tp->regs_len;
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
strlcpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int rtl8139_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static int rtl8139_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
spin_lock_irq(&tp->lock);
|
||||
mii_ethtool_gset(&tp->mii, cmd);
|
||||
mii_ethtool_get_link_ksettings(&tp->mii, cmd);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8139_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static int rtl8139_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int rc;
|
||||
spin_lock_irq(&tp->lock);
|
||||
rc = mii_ethtool_sset(&tp->mii, cmd);
|
||||
rc = mii_ethtool_set_link_ksettings(&tp->mii, cmd);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -2597,8 +2632,6 @@ static void rtl8139_get_strings(struct net_device *dev, u32 stringset, u8 *data)
|
|||
|
||||
static const struct ethtool_ops rtl8139_ethtool_ops = {
|
||||
.get_drvinfo = rtl8139_get_drvinfo,
|
||||
.get_settings = rtl8139_get_settings,
|
||||
.set_settings = rtl8139_set_settings,
|
||||
.get_regs_len = rtl8139_get_regs_len,
|
||||
.get_regs = rtl8139_get_regs,
|
||||
.nway_reset = rtl8139_nway_reset,
|
||||
|
|
@ -2610,6 +2643,8 @@ static const struct ethtool_ops rtl8139_ethtool_ops = {
|
|||
.get_strings = rtl8139_get_strings,
|
||||
.get_sset_count = rtl8139_get_sset_count,
|
||||
.get_ethtool_stats = rtl8139_get_ethtool_stats,
|
||||
.get_link_ksettings = rtl8139_get_link_ksettings,
|
||||
.set_link_ksettings = rtl8139_set_link_ksettings,
|
||||
};
|
||||
|
||||
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
|
|
@ -2628,11 +2663,13 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
|||
}
|
||||
|
||||
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
||||
static void
|
||||
rtl8139_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
unsigned int start;
|
||||
|
||||
if (tp->ecdev || netif_running(dev)) {
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
|
|
@ -2641,7 +2678,19 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
|||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
}
|
||||
|
||||
return &dev->stats;
|
||||
netdev_stats_to_stats64(stats, &dev->stats);
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&tp->rx_stats.syncp);
|
||||
stats->rx_packets = tp->rx_stats.packets;
|
||||
stats->rx_bytes = tp->rx_stats.bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&tp->rx_stats.syncp, start));
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&tp->tx_stats.syncp);
|
||||
stats->tx_packets = tp->tx_stats.packets;
|
||||
stats->tx_bytes = tp->tx_stats.bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&tp->tx_stats.syncp, start));
|
||||
}
|
||||
|
||||
/* Set or clear the multicast filter for this adaptor.
|
||||
|
|
@ -2681,6 +2730,9 @@ static void __set_rx_mode (struct net_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
if (dev->features & NETIF_F_RXALL)
|
||||
rx_mode |= (AcceptErr | AcceptRunt);
|
||||
|
||||
/* We can safely update without stopping the chip. */
|
||||
tmp = rtl8139_rx_config | rx_mode;
|
||||
if (tp->rx_config != tmp) {
|
||||
|
|
@ -2701,17 +2753,13 @@ static void rtl8139_set_rx_mode (struct net_device *dev)
|
|||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
||||
static int __maybe_unused rtl8139_suspend(struct device *device)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct net_device *dev = dev_get_drvdata(device);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
|
||||
pci_save_state (pdev);
|
||||
|
||||
if (tp->ecdev || !netif_running (dev))
|
||||
return 0;
|
||||
|
||||
|
|
@ -2729,39 +2777,31 @@ static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
|||
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
pci_set_power_state (pdev, PCI_D3hot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int rtl8139_resume (struct pci_dev *pdev)
|
||||
static int __maybe_unused rtl8139_resume(struct device *device)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct net_device *dev = dev_get_drvdata(device);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
pci_restore_state (pdev);
|
||||
if (tp->ecdev || !netif_running (dev))
|
||||
return 0;
|
||||
pci_set_power_state (pdev, PCI_D0);
|
||||
|
||||
rtl8139_init_ring (dev);
|
||||
rtl8139_hw_start (dev);
|
||||
netif_device_attach (dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(rtl8139_pm_ops, rtl8139_suspend, rtl8139_resume);
|
||||
|
||||
static struct pci_driver rtl8139_pci_driver = {
|
||||
.name = DRV_NAME,
|
||||
.id_table = rtl8139_pci_tbl,
|
||||
.probe = rtl8139_init_one,
|
||||
.remove = __devexit_p(rtl8139_remove_one),
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = rtl8139_suspend,
|
||||
.resume = rtl8139_resume,
|
||||
#endif /* CONFIG_PM */
|
||||
.remove = rtl8139_remove_one,
|
||||
.driver.pm = &rtl8139_pm_ops,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
-----<snip>-----
|
||||
|
||||
Written 1997-2001 by Donald Becker.
|
||||
Written 1997-2001 by Donald Becker.
|
||||
This software may be used and distributed according to the
|
||||
terms of the GNU General Public License (GPL), incorporated
|
||||
herein by reference. Drivers based on or derived from this
|
||||
|
|
@ -100,6 +100,7 @@
|
|||
#include <linux/compiler.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
|
@ -111,6 +112,7 @@
|
|||
#include <linux/io.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
#define RTL8139_DRIVER_NAME DRV_NAME " Fast Ethernet driver " DRV_VERSION
|
||||
|
|
@ -147,9 +149,9 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
|
|||
|
||||
/* Whether to use MMIO or PIO. Default to MMIO. */
|
||||
#ifdef CONFIG_8139TOO_PIO
|
||||
static int use_io = 1;
|
||||
static bool use_io = true;
|
||||
#else
|
||||
static int use_io = 0;
|
||||
static bool use_io = false;
|
||||
#endif
|
||||
|
||||
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
|
||||
|
|
@ -181,10 +183,13 @@ static int debug = -1;
|
|||
/* Number of Tx descriptor registers. */
|
||||
#define NUM_TX_DESC 4
|
||||
|
||||
/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1536
|
||||
/* max supported ethernet frame size -- must be at least (dev->mtu+18+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1792
|
||||
|
||||
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */
|
||||
/* max supported payload size */
|
||||
#define MAX_ETH_DATA_SIZE (MAX_ETH_FRAME_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN)
|
||||
|
||||
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+18+4). */
|
||||
#define TX_BUF_SIZE MAX_ETH_FRAME_SIZE
|
||||
#define TX_BUF_TOT_LEN (TX_BUF_SIZE * NUM_TX_DESC)
|
||||
|
||||
|
|
@ -227,13 +232,13 @@ typedef enum {
|
|||
static const struct {
|
||||
const char *name;
|
||||
u32 hw_flags;
|
||||
} board_info[] __devinitdata = {
|
||||
} board_info[] = {
|
||||
{ "RealTek RTL8139", RTL8139_CAPS },
|
||||
{ "RealTek RTL8129", RTL8129_CAPS },
|
||||
};
|
||||
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
|
||||
static const struct pci_device_id rtl8139_pci_tbl[] = {
|
||||
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
|
|
@ -253,6 +258,7 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
|
|||
{0x126c, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x1743, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x021b, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
{0x16ec, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
|
||||
|
||||
#ifdef CONFIG_SH_SECUREEDGE5410
|
||||
/* Bogus 8139 silicon reports 8129 without external PROM :-( */
|
||||
|
|
@ -542,8 +548,8 @@ static const struct {
|
|||
|
||||
{ "RTL-8100",
|
||||
HW_REVID(1, 1, 1, 1, 0, 1, 0),
|
||||
HasLWake,
|
||||
},
|
||||
HasLWake,
|
||||
},
|
||||
|
||||
{ "RTL-8100B/8139D",
|
||||
HW_REVID(1, 1, 1, 0, 1, 0, 1),
|
||||
|
|
@ -564,6 +570,12 @@ struct rtl_extra_stats {
|
|||
unsigned long rx_lost_in_ring;
|
||||
};
|
||||
|
||||
struct rtl8139_stats {
|
||||
u64 packets;
|
||||
u64 bytes;
|
||||
struct u64_stats_sync syncp;
|
||||
};
|
||||
|
||||
struct rtl8139_private {
|
||||
void __iomem *mmio_addr;
|
||||
int drv_flags;
|
||||
|
|
@ -574,11 +586,13 @@ struct rtl8139_private {
|
|||
|
||||
unsigned char *rx_ring;
|
||||
unsigned int cur_rx; /* RX buf index of next pkt */
|
||||
struct rtl8139_stats rx_stats;
|
||||
dma_addr_t rx_ring_dma;
|
||||
|
||||
unsigned int tx_flag;
|
||||
unsigned long cur_tx;
|
||||
unsigned long dirty_tx;
|
||||
struct rtl8139_stats tx_stats;
|
||||
unsigned char *tx_buf[NUM_TX_DESC]; /* Tx bounce buffers */
|
||||
unsigned char *tx_bufs; /* Tx bounce buffer region. */
|
||||
dma_addr_t tx_bufs_dma;
|
||||
|
|
@ -611,7 +625,7 @@ MODULE_DESCRIPTION ("RealTek RTL-8139 Fast Ethernet driver");
|
|||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION);
|
||||
|
||||
module_param(use_io, int, 0);
|
||||
module_param(use_io, bool, 0);
|
||||
MODULE_PARM_DESC(use_io, "Force use of I/O access mode. 0=MMIO 1=PIO");
|
||||
module_param(multicast_filter_limit, int, 0);
|
||||
module_param_array(media, int, NULL, 0);
|
||||
|
|
@ -628,7 +642,7 @@ static int mdio_read (struct net_device *dev, int phy_id, int location);
|
|||
static void mdio_write (struct net_device *dev, int phy_id, int location,
|
||||
int val);
|
||||
static void rtl8139_start_thread(struct rtl8139_private *tp);
|
||||
static void rtl8139_tx_timeout (struct net_device *dev);
|
||||
static void rtl8139_tx_timeout (struct net_device *dev, unsigned int txqueue);
|
||||
static void rtl8139_init_ring (struct net_device *dev);
|
||||
static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
||||
struct net_device *dev);
|
||||
|
|
@ -640,7 +654,8 @@ static int rtl8139_poll(struct napi_struct *napi, int budget);
|
|||
static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance);
|
||||
static int rtl8139_close (struct net_device *dev);
|
||||
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev);
|
||||
static void rtl8139_get_stats64(struct net_device *dev,
|
||||
struct rtnl_link_stats64 *stats);
|
||||
static void rtl8139_set_rx_mode (struct net_device *dev);
|
||||
static void __set_rx_mode (struct net_device *dev);
|
||||
static void rtl8139_hw_start (struct net_device *dev);
|
||||
|
|
@ -716,7 +731,6 @@ static void __rtl8139_cleanup_dev (struct net_device *dev)
|
|||
pci_release_regions (pdev);
|
||||
|
||||
free_netdev(dev);
|
||||
pci_set_drvdata (pdev, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -737,26 +751,32 @@ static void rtl8139_chip_reset (void __iomem *ioaddr)
|
|||
}
|
||||
|
||||
|
||||
static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
|
||||
static struct net_device *rtl8139_init_board(struct pci_dev *pdev)
|
||||
{
|
||||
struct device *d = &pdev->dev;
|
||||
void __iomem *ioaddr;
|
||||
struct net_device *dev;
|
||||
struct rtl8139_private *tp;
|
||||
u8 tmp8;
|
||||
int rc, disable_dev_on_err = 0;
|
||||
unsigned int i;
|
||||
unsigned long pio_start, pio_end, pio_flags, pio_len;
|
||||
unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
|
||||
unsigned int i, bar;
|
||||
unsigned long io_len;
|
||||
u32 version;
|
||||
static const struct {
|
||||
unsigned long mask;
|
||||
char *type;
|
||||
} res[] = {
|
||||
{ IORESOURCE_IO, "PIO" },
|
||||
{ IORESOURCE_MEM, "MMIO" }
|
||||
};
|
||||
|
||||
assert (pdev != NULL);
|
||||
|
||||
/* dev and priv zeroed in alloc_etherdev */
|
||||
dev = alloc_etherdev (sizeof (*tp));
|
||||
if (dev == NULL) {
|
||||
dev_err(&pdev->dev, "Unable to alloc new net device\n");
|
||||
if (dev == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
||||
tp = netdev_priv(dev);
|
||||
|
|
@ -767,78 +787,48 @@ static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
|
|||
if (rc)
|
||||
goto err_out;
|
||||
|
||||
pio_start = pci_resource_start (pdev, 0);
|
||||
pio_end = pci_resource_end (pdev, 0);
|
||||
pio_flags = pci_resource_flags (pdev, 0);
|
||||
pio_len = pci_resource_len (pdev, 0);
|
||||
|
||||
mmio_start = pci_resource_start (pdev, 1);
|
||||
mmio_end = pci_resource_end (pdev, 1);
|
||||
mmio_flags = pci_resource_flags (pdev, 1);
|
||||
mmio_len = pci_resource_len (pdev, 1);
|
||||
|
||||
/* set this immediately, we need to know before
|
||||
* we talk to the chip directly */
|
||||
pr_debug("PIO region size == 0x%02lX\n", pio_len);
|
||||
pr_debug("MMIO region size == 0x%02lX\n", mmio_len);
|
||||
|
||||
retry:
|
||||
if (use_io) {
|
||||
/* make sure PCI base addr 0 is PIO */
|
||||
if (!(pio_flags & IORESOURCE_IO)) {
|
||||
dev_err(&pdev->dev, "region #0 not a PIO resource, aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
/* check for weird/broken PCI region reporting */
|
||||
if (pio_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(&pdev->dev, "Invalid PCI I/O region size(s), aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
} else {
|
||||
/* make sure PCI base addr 1 is MMIO */
|
||||
if (!(mmio_flags & IORESOURCE_MEM)) {
|
||||
dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
if (mmio_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(&pdev->dev, "Invalid PCI mem region size(s), aborting\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
|
||||
disable_dev_on_err = 1;
|
||||
rc = pci_request_regions (pdev, DRV_NAME);
|
||||
if (rc)
|
||||
goto err_out;
|
||||
disable_dev_on_err = 1;
|
||||
|
||||
/* enable PCI bus-mastering */
|
||||
pci_set_master (pdev);
|
||||
|
||||
if (use_io) {
|
||||
ioaddr = pci_iomap(pdev, 0, 0);
|
||||
if (!ioaddr) {
|
||||
dev_err(&pdev->dev, "cannot map PIO, aborting\n");
|
||||
rc = -EIO;
|
||||
goto err_out;
|
||||
}
|
||||
dev->base_addr = pio_start;
|
||||
tp->regs_len = pio_len;
|
||||
} else {
|
||||
/* ioremap MMIO region */
|
||||
ioaddr = pci_iomap(pdev, 1, 0);
|
||||
if (ioaddr == NULL) {
|
||||
dev_err(&pdev->dev, "cannot remap MMIO, trying PIO\n");
|
||||
pci_release_regions(pdev);
|
||||
use_io = 1;
|
||||
u64_stats_init(&tp->rx_stats.syncp);
|
||||
u64_stats_init(&tp->tx_stats.syncp);
|
||||
|
||||
retry:
|
||||
/* PIO bar register comes first. */
|
||||
bar = !use_io;
|
||||
|
||||
io_len = pci_resource_len(pdev, bar);
|
||||
|
||||
dev_dbg(d, "%s region size = 0x%02lX\n", res[bar].type, io_len);
|
||||
|
||||
if (!(pci_resource_flags(pdev, bar) & res[bar].mask)) {
|
||||
dev_err(d, "region #%d not a %s resource, aborting\n", bar,
|
||||
res[bar].type);
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
if (io_len < RTL_MIN_IO_SIZE) {
|
||||
dev_err(d, "Invalid PCI %s region size(s), aborting\n",
|
||||
res[bar].type);
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
ioaddr = pci_iomap(pdev, bar, 0);
|
||||
if (!ioaddr) {
|
||||
dev_err(d, "cannot map %s\n", res[bar].type);
|
||||
if (!use_io) {
|
||||
use_io = true;
|
||||
goto retry;
|
||||
}
|
||||
dev->base_addr = (long) ioaddr;
|
||||
tp->regs_len = mmio_len;
|
||||
rc = -ENODEV;
|
||||
goto err_out;
|
||||
}
|
||||
tp->regs_len = io_len;
|
||||
tp->mmio_addr = ioaddr;
|
||||
|
||||
/* Bring old chips out of low-power mode. */
|
||||
|
|
@ -907,24 +897,51 @@ err_out:
|
|||
return ERR_PTR(rc);
|
||||
}
|
||||
|
||||
static int rtl8139_set_features(struct net_device *dev, netdev_features_t features)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
netdev_features_t changed = features ^ dev->features;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
|
||||
if (!(changed & (NETIF_F_RXALL)))
|
||||
return 0;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
|
||||
if (changed & NETIF_F_RXALL) {
|
||||
int rx_mode = tp->rx_config;
|
||||
if (features & NETIF_F_RXALL)
|
||||
rx_mode |= (AcceptErr | AcceptRunt);
|
||||
else
|
||||
rx_mode &= ~(AcceptErr | AcceptRunt);
|
||||
tp->rx_config = rtl8139_rx_config | rx_mode;
|
||||
RTL_W32_F(RxConfig, tp->rx_config);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops rtl8139_netdev_ops = {
|
||||
.ndo_open = rtl8139_open,
|
||||
.ndo_stop = rtl8139_close,
|
||||
.ndo_get_stats = rtl8139_get_stats,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_get_stats64 = rtl8139_get_stats64,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = rtl8139_set_mac_address,
|
||||
.ndo_start_xmit = rtl8139_start_xmit,
|
||||
.ndo_set_multicast_list = rtl8139_set_rx_mode,
|
||||
.ndo_do_ioctl = netdev_ioctl,
|
||||
.ndo_set_rx_mode = rtl8139_set_rx_mode,
|
||||
.ndo_eth_ioctl = netdev_ioctl,
|
||||
.ndo_tx_timeout = rtl8139_tx_timeout,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = rtl8139_poll_controller,
|
||||
#endif
|
||||
.ndo_set_features = rtl8139_set_features,
|
||||
};
|
||||
|
||||
static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
static int rtl8139_init_one(struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
{
|
||||
struct net_device *dev = NULL;
|
||||
struct rtl8139_private *tp;
|
||||
|
|
@ -961,7 +978,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
pdev->subsystem_vendor == PCI_VENDOR_ID_ATHEROS &&
|
||||
pdev->subsystem_device == PCI_DEVICE_ID_REALTEK_8139) {
|
||||
pr_info("OQO Model 2 detected. Forcing PIO\n");
|
||||
use_io = 1;
|
||||
use_io = true;
|
||||
}
|
||||
|
||||
dev = rtl8139_init_board (pdev);
|
||||
|
|
@ -979,7 +996,6 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
for (i = 0; i < 3; i++)
|
||||
((__le16 *) (dev->dev_addr))[i] =
|
||||
cpu_to_le16(read_eeprom (ioaddr, i + 7, addr_len));
|
||||
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
|
||||
|
||||
/* The Rtl8139-specific entries in the device structure. */
|
||||
dev->netdev_ops = &rtl8139_netdev_ops;
|
||||
|
|
@ -992,8 +1008,14 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
* features
|
||||
*/
|
||||
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
|
||||
dev->vlan_features = dev->features;
|
||||
|
||||
dev->irq = pdev->irq;
|
||||
dev->hw_features |= NETIF_F_RXALL;
|
||||
dev->hw_features |= NETIF_F_RXFCS;
|
||||
|
||||
/* MTU range: 68 - 1770 */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = MAX_ETH_DATA_SIZE;
|
||||
|
||||
/* tp zeroed and aligned in alloc_etherdev */
|
||||
tp = netdev_priv(dev);
|
||||
|
|
@ -1020,9 +1042,9 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
|||
|
||||
pci_set_drvdata (pdev, dev);
|
||||
|
||||
netdev_info(dev, "%s at 0x%lx, %pM, IRQ %d\n",
|
||||
netdev_info(dev, "%s at 0x%p, %pM, IRQ %d\n",
|
||||
board_info[ent->driver_data].name,
|
||||
dev->base_addr, dev->dev_addr, dev->irq);
|
||||
ioaddr, dev->dev_addr, pdev->irq);
|
||||
|
||||
netdev_dbg(dev, "Identified 8139 chip type '%s'\n",
|
||||
rtl_chip_info[tp->chipset].name);
|
||||
|
|
@ -1089,13 +1111,14 @@ err_out:
|
|||
}
|
||||
|
||||
|
||||
static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
||||
static void rtl8139_remove_one(struct pci_dev *pdev)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
assert (dev != NULL);
|
||||
|
||||
flush_scheduled_work();
|
||||
cancel_delayed_work_sync(&tp->thread);
|
||||
|
||||
unregister_netdev (dev);
|
||||
|
||||
|
|
@ -1119,14 +1142,14 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
|||
No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.
|
||||
*/
|
||||
|
||||
#define eeprom_delay() (void)RTL_R32(Cfg9346)
|
||||
#define eeprom_delay() (void)RTL_R8(Cfg9346)
|
||||
|
||||
/* The EEPROM commands include the alway-set leading bit. */
|
||||
#define EE_WRITE_CMD (5)
|
||||
#define EE_READ_CMD (6)
|
||||
#define EE_ERASE_CMD (7)
|
||||
|
||||
static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_len)
|
||||
static int read_eeprom(void __iomem *ioaddr, int location, int addr_len)
|
||||
{
|
||||
int i;
|
||||
unsigned retval = 0;
|
||||
|
|
@ -1158,7 +1181,7 @@ static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_l
|
|||
}
|
||||
|
||||
/* Terminate the EEPROM access. */
|
||||
RTL_W8 (Cfg9346, ~EE_CS);
|
||||
RTL_W8(Cfg9346, 0);
|
||||
eeprom_delay ();
|
||||
|
||||
return retval;
|
||||
|
|
@ -1296,10 +1319,11 @@ static void mdio_write (struct net_device *dev, int phy_id, int location,
|
|||
static int rtl8139_open (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int retval;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
const int irq = tp->pci_dev->irq;
|
||||
int retval;
|
||||
|
||||
retval = request_irq (dev->irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);
|
||||
retval = request_irq(irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
|
|
@ -1308,7 +1332,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
tp->rx_ring = dma_alloc_coherent(&tp->pci_dev->dev, RX_BUF_TOT_LEN,
|
||||
&tp->rx_ring_dma, GFP_KERNEL);
|
||||
if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {
|
||||
free_irq(dev->irq, dev);
|
||||
free_irq(irq, dev);
|
||||
|
||||
if (tp->tx_bufs)
|
||||
dma_free_coherent(&tp->pci_dev->dev, TX_BUF_TOT_LEN,
|
||||
|
|
@ -1334,7 +1358,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
"%s() ioaddr %#llx IRQ %d GP Pins %02x %s-duplex\n",
|
||||
__func__,
|
||||
(unsigned long long)pci_resource_start (tp->pci_dev, 1),
|
||||
dev->irq, RTL_R8 (MediaStatus),
|
||||
irq, RTL_R8 (MediaStatus),
|
||||
tp->mii.full_duplex ? "full" : "half");
|
||||
|
||||
rtl8139_start_thread(tp);
|
||||
|
|
@ -1636,6 +1660,10 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
int i;
|
||||
u8 tmp8;
|
||||
|
||||
napi_disable(&tp->napi);
|
||||
netif_stop_queue(dev);
|
||||
synchronize_rcu();
|
||||
|
||||
netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
|
||||
RTL_R8(ChipCmd), RTL_R16(IntrStatus),
|
||||
RTL_R16(IntrMask), RTL_R8(MediaStatus));
|
||||
|
|
@ -1665,14 +1693,14 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
spin_unlock_irq(&tp->lock);
|
||||
|
||||
/* ...and finally, reset everything */
|
||||
if (netif_running(dev)) {
|
||||
rtl8139_hw_start (dev);
|
||||
netif_wake_queue (dev);
|
||||
}
|
||||
napi_enable(&tp->napi);
|
||||
rtl8139_hw_start(dev);
|
||||
netif_wake_queue(dev);
|
||||
|
||||
spin_unlock_bh(&tp->rx_lock);
|
||||
}
|
||||
|
||||
static void rtl8139_tx_timeout (struct net_device *dev)
|
||||
static void rtl8139_tx_timeout(struct net_device *dev, unsigned int txqueue)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
|
|
@ -1700,9 +1728,9 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
|||
if (len < ETH_ZLEN)
|
||||
memset(tp->tx_buf[entry], 0, ETH_ZLEN);
|
||||
skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
} else {
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
dev->stats.tx_dropped++;
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
|
@ -1774,8 +1802,10 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
|
|||
dev->stats.tx_fifo_errors++;
|
||||
}
|
||||
dev->stats.collisions += (txstatus >> 24) & 15;
|
||||
dev->stats.tx_bytes += txstatus & 0x7ff;
|
||||
dev->stats.tx_packets++;
|
||||
u64_stats_update_begin(&tp->tx_stats.syncp);
|
||||
tp->tx_stats.packets++;
|
||||
tp->tx_stats.bytes += txstatus & 0x7ff;
|
||||
u64_stats_update_end(&tp->tx_stats.syncp);
|
||||
}
|
||||
|
||||
dirty_tx++;
|
||||
|
|
@ -1938,7 +1968,10 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
|||
/* read size+status of next frame from DMA ring buffer */
|
||||
rx_status = le32_to_cpu (*(__le32 *) (rx_ring + ring_offset));
|
||||
rx_size = rx_status >> 16;
|
||||
pkt_size = rx_size - 4;
|
||||
if (likely(!(dev->features & NETIF_F_RXFCS)))
|
||||
pkt_size = rx_size - 4;
|
||||
else
|
||||
pkt_size = rx_size;
|
||||
|
||||
netif_dbg(tp, rx_status, dev, "%s() status %04x, size %04x, cur %04x\n",
|
||||
__func__, rx_status, rx_size, cur_rx);
|
||||
|
|
@ -1976,15 +2009,34 @@ no_early_rx:
|
|||
if (unlikely((rx_size > (MAX_ETH_FRAME_SIZE+4)) ||
|
||||
(rx_size < 8) ||
|
||||
(!(rx_status & RxStatusOK)))) {
|
||||
if ((dev->features & NETIF_F_RXALL) &&
|
||||
(rx_size <= (MAX_ETH_FRAME_SIZE + 4)) &&
|
||||
(rx_size >= 8) &&
|
||||
(!(rx_status & RxStatusOK))) {
|
||||
/* Length is at least mostly OK, but pkt has
|
||||
* error. I'm hoping we can handle some of these
|
||||
* errors without resetting the chip. --Ben
|
||||
*/
|
||||
dev->stats.rx_errors++;
|
||||
if (rx_status & RxCRCErr) {
|
||||
dev->stats.rx_crc_errors++;
|
||||
goto keep_pkt;
|
||||
}
|
||||
if (rx_status & RxRunt) {
|
||||
dev->stats.rx_length_errors++;
|
||||
goto keep_pkt;
|
||||
}
|
||||
}
|
||||
rtl8139_rx_err (rx_status, dev, tp, ioaddr);
|
||||
received = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
keep_pkt:
|
||||
/* Malloc up new buffer, compatible with net-2e. */
|
||||
/* Omit the four octet CRC from the length. */
|
||||
|
||||
skb = netdev_alloc_skb_ip_align(dev, pkt_size);
|
||||
skb = napi_alloc_skb(&tp->napi, pkt_size);
|
||||
if (likely(skb)) {
|
||||
#if RX_BUF_IDX == 3
|
||||
wrap_copy(skb, rx_ring, ring_offset+4, pkt_size);
|
||||
|
|
@ -1995,13 +2047,13 @@ no_early_rx:
|
|||
|
||||
skb->protocol = eth_type_trans (skb, dev);
|
||||
|
||||
dev->stats.rx_bytes += pkt_size;
|
||||
dev->stats.rx_packets++;
|
||||
u64_stats_update_begin(&tp->rx_stats.syncp);
|
||||
tp->rx_stats.packets++;
|
||||
tp->rx_stats.bytes += pkt_size;
|
||||
u64_stats_update_end(&tp->rx_stats.syncp);
|
||||
|
||||
netif_receive_skb (skb);
|
||||
} else {
|
||||
if (net_ratelimit())
|
||||
netdev_warn(dev, "Memory squeeze, dropping packet\n");
|
||||
dev->stats.rx_dropped++;
|
||||
}
|
||||
received++;
|
||||
|
|
@ -2084,13 +2136,10 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
|
|||
|
||||
if (work_done < budget) {
|
||||
unsigned long flags;
|
||||
/*
|
||||
* Order is important since data can get interrupted
|
||||
* again when we think we are done.
|
||||
*/
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
__napi_complete(napi);
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
if (napi_complete_done(napi, work_done))
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
}
|
||||
spin_unlock(&tp->rx_lock);
|
||||
|
|
@ -2171,9 +2220,12 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
*/
|
||||
static void rtl8139_poll_controller(struct net_device *dev)
|
||||
{
|
||||
disable_irq(dev->irq);
|
||||
rtl8139_interrupt(dev->irq, dev);
|
||||
enable_irq(dev->irq);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
const int irq = tp->pci_dev->irq;
|
||||
|
||||
disable_irq_nosync(irq);
|
||||
rtl8139_interrupt(irq, dev);
|
||||
enable_irq(irq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2226,7 +2278,7 @@ static int rtl8139_close (struct net_device *dev)
|
|||
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
free_irq (dev->irq, dev);
|
||||
free_irq(tp->pci_dev->irq, dev);
|
||||
|
||||
rtl8139_tx_clear (tp);
|
||||
|
||||
|
|
@ -2327,27 +2379,28 @@ static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
|||
static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
strcpy(info->driver, DRV_NAME);
|
||||
strcpy(info->version, DRV_VERSION);
|
||||
strcpy(info->bus_info, pci_name(tp->pci_dev));
|
||||
info->regdump_len = tp->regs_len;
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
strlcpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int rtl8139_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static int rtl8139_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
spin_lock_irq(&tp->lock);
|
||||
mii_ethtool_gset(&tp->mii, cmd);
|
||||
mii_ethtool_get_link_ksettings(&tp->mii, cmd);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8139_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static int rtl8139_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int rc;
|
||||
spin_lock_irq(&tp->lock);
|
||||
rc = mii_ethtool_sset(&tp->mii, cmd);
|
||||
rc = mii_ethtool_set_link_ksettings(&tp->mii, cmd);
|
||||
spin_unlock_irq(&tp->lock);
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -2429,8 +2482,6 @@ static void rtl8139_get_strings(struct net_device *dev, u32 stringset, u8 *data)
|
|||
|
||||
static const struct ethtool_ops rtl8139_ethtool_ops = {
|
||||
.get_drvinfo = rtl8139_get_drvinfo,
|
||||
.get_settings = rtl8139_get_settings,
|
||||
.set_settings = rtl8139_set_settings,
|
||||
.get_regs_len = rtl8139_get_regs_len,
|
||||
.get_regs = rtl8139_get_regs,
|
||||
.nway_reset = rtl8139_nway_reset,
|
||||
|
|
@ -2442,6 +2493,8 @@ static const struct ethtool_ops rtl8139_ethtool_ops = {
|
|||
.get_strings = rtl8139_get_strings,
|
||||
.get_sset_count = rtl8139_get_sset_count,
|
||||
.get_ethtool_stats = rtl8139_get_ethtool_stats,
|
||||
.get_link_ksettings = rtl8139_get_link_ksettings,
|
||||
.set_link_ksettings = rtl8139_set_link_ksettings,
|
||||
};
|
||||
|
||||
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
|
|
@ -2460,11 +2513,13 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
|||
}
|
||||
|
||||
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
||||
static void
|
||||
rtl8139_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
unsigned int start;
|
||||
|
||||
if (netif_running(dev)) {
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
|
|
@ -2473,7 +2528,19 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
|||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
}
|
||||
|
||||
return &dev->stats;
|
||||
netdev_stats_to_stats64(stats, &dev->stats);
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&tp->rx_stats.syncp);
|
||||
stats->rx_packets = tp->rx_stats.packets;
|
||||
stats->rx_bytes = tp->rx_stats.bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&tp->rx_stats.syncp, start));
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&tp->tx_stats.syncp);
|
||||
stats->tx_packets = tp->tx_stats.packets;
|
||||
stats->tx_bytes = tp->tx_stats.bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&tp->tx_stats.syncp, start));
|
||||
}
|
||||
|
||||
/* Set or clear the multicast filter for this adaptor.
|
||||
|
|
@ -2513,6 +2580,9 @@ static void __set_rx_mode (struct net_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
if (dev->features & NETIF_F_RXALL)
|
||||
rx_mode |= (AcceptErr | AcceptRunt);
|
||||
|
||||
/* We can safely update without stopping the chip. */
|
||||
tmp = rtl8139_rx_config | rx_mode;
|
||||
if (tp->rx_config != tmp) {
|
||||
|
|
@ -2533,17 +2603,13 @@ static void rtl8139_set_rx_mode (struct net_device *dev)
|
|||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
||||
static int __maybe_unused rtl8139_suspend(struct device *device)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct net_device *dev = dev_get_drvdata(device);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
|
||||
pci_save_state (pdev);
|
||||
|
||||
if (!netif_running (dev))
|
||||
return 0;
|
||||
|
||||
|
|
@ -2561,38 +2627,30 @@ static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
|||
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
pci_set_power_state (pdev, PCI_D3hot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int rtl8139_resume (struct pci_dev *pdev)
|
||||
static int __maybe_unused rtl8139_resume(struct device *device)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct net_device *dev = dev_get_drvdata(device);
|
||||
|
||||
pci_restore_state (pdev);
|
||||
if (!netif_running (dev))
|
||||
return 0;
|
||||
pci_set_power_state (pdev, PCI_D0);
|
||||
|
||||
rtl8139_init_ring (dev);
|
||||
rtl8139_hw_start (dev);
|
||||
netif_device_attach (dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(rtl8139_pm_ops, rtl8139_suspend, rtl8139_resume);
|
||||
|
||||
static struct pci_driver rtl8139_pci_driver = {
|
||||
.name = DRV_NAME,
|
||||
.id_table = rtl8139_pci_tbl,
|
||||
.probe = rtl8139_init_one,
|
||||
.remove = __devexit_p(rtl8139_remove_one),
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = rtl8139_suspend,
|
||||
.resume = rtl8139_resume,
|
||||
#endif /* CONFIG_PM */
|
||||
.remove = rtl8139_remove_one,
|
||||
.driver.pm = &rtl8139_pm_ops,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -17,11 +17,6 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
|
|
@ -665,10 +660,19 @@ struct rtl8139_private {
|
|||
unsigned int regs_len;
|
||||
unsigned long fifo_copy_timeout;
|
||||
|
||||
ec_device_t *ecdev;
|
||||
ec_device_t *ecdev_;
|
||||
bool ecdev_initialized;
|
||||
};
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
static inline ec_device_t *get_ecdev(struct rtl8139_private *adapter)
|
||||
{
|
||||
#ifdef EC_ENABLE_DRIVER_RESOURCE_VERIFYING
|
||||
WARN_ON(!adapter->ecdev_initialized);
|
||||
#endif
|
||||
return adapter->ecdev_;
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(EC_MASTER_VERSION);
|
||||
|
|
@ -1088,9 +1092,10 @@ static int rtl8139_init_one(struct pci_dev *pdev,
|
|||
/* dev is fully set up and ready to use now */
|
||||
|
||||
// offer device to EtherCAT master module
|
||||
tp->ecdev = ecdev_offer(dev, ec_poll, THIS_MODULE);
|
||||
tp->ecdev_ = ecdev_offer(dev, ec_poll, THIS_MODULE);
|
||||
tp->ecdev_initialized = true;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
pr_debug("about to register device named %s (%p)...\n",
|
||||
dev->name, dev);
|
||||
i = register_netdev (dev);
|
||||
|
|
@ -1163,10 +1168,10 @@ static int rtl8139_init_one(struct pci_dev *pdev,
|
|||
if (rtl_chip_info[tp->chipset].flags & HasHltClk)
|
||||
RTL_W8 (HltClk, 'H'); /* 'R' would leave the clock running. */
|
||||
|
||||
if (tp->ecdev) {
|
||||
i = ecdev_open(tp->ecdev);
|
||||
if (get_ecdev(tp)) {
|
||||
i = ecdev_open(get_ecdev(tp));
|
||||
if (i) {
|
||||
ecdev_withdraw(tp->ecdev);
|
||||
ecdev_withdraw(get_ecdev(tp));
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
|
|
@ -1187,9 +1192,9 @@ static void rtl8139_remove_one(struct pci_dev *pdev)
|
|||
|
||||
assert (dev != NULL);
|
||||
|
||||
if (tp->ecdev) {
|
||||
ecdev_close(tp->ecdev);
|
||||
ecdev_withdraw(tp->ecdev);
|
||||
if (get_ecdev(tp)) {
|
||||
ecdev_close(get_ecdev(tp));
|
||||
ecdev_withdraw(get_ecdev(tp));
|
||||
}
|
||||
else {
|
||||
cancel_delayed_work_sync(&tp->thread);
|
||||
|
|
@ -1398,7 +1403,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
const int irq = tp->pci_dev->irq;
|
||||
int retval;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
retval = request_irq(irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
|
@ -1409,7 +1414,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
tp->rx_ring = dma_alloc_coherent(&tp->pci_dev->dev, RX_BUF_TOT_LEN,
|
||||
&tp->rx_ring_dma, GFP_KERNEL);
|
||||
if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
free_irq(irq, dev);
|
||||
}
|
||||
|
||||
|
|
@ -1431,7 +1436,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
|
||||
rtl8139_init_ring (dev);
|
||||
rtl8139_hw_start (dev);
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
netif_start_queue (dev);
|
||||
}
|
||||
|
||||
|
|
@ -1442,7 +1447,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
irq, RTL_R8 (MediaStatus),
|
||||
tp->mii.full_duplex ? "full" : "half");
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
rtl8139_start_thread(tp);
|
||||
}
|
||||
|
||||
|
|
@ -1454,10 +1459,10 @@ static void rtl_check_media (struct net_device *dev, unsigned int init_media)
|
|||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
if (tp->ecdev) {
|
||||
if (get_ecdev(tp)) {
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
u16 state = RTL_R16(BasicModeStatus) & BMSR_LSTATUS;
|
||||
ecdev_set_link(tp->ecdev, state ? 1 : 0);
|
||||
ecdev_set_link(get_ecdev(tp), state ? 1 : 0);
|
||||
}
|
||||
else {
|
||||
if (tp->phys[0] >= 0) {
|
||||
|
|
@ -1528,7 +1533,7 @@ static void rtl8139_hw_start (struct net_device *dev)
|
|||
if ((!(tmp & CmdRxEnb)) || (!(tmp & CmdTxEnb)))
|
||||
RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb);
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
/* Enable all known interrupts by setting the interrupt mask. */
|
||||
RTL_W16 (IntrMask, rtl8139_intr_mask);
|
||||
}
|
||||
|
|
@ -1775,7 +1780,7 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
|
|||
if (tmp8 & CmdTxEnb)
|
||||
RTL_W8 (ChipCmd, CmdRxEnb);
|
||||
|
||||
if (tp->ecdev) {
|
||||
if (get_ecdev(tp)) {
|
||||
rtl8139_tx_clear (tp);
|
||||
rtl8139_hw_start (dev);
|
||||
}
|
||||
|
|
@ -1803,7 +1808,7 @@ static void rtl8139_tx_timeout(struct net_device *dev, unsigned int txqueue)
|
|||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
tp->watchdog_fired = 1;
|
||||
if (!tp->ecdev && !tp->have_thread) {
|
||||
if (!get_ecdev(tp) && !tp->have_thread) {
|
||||
INIT_DELAYED_WORK(&tp->thread, rtl8139_thread);
|
||||
schedule_delayed_work(&tp->thread, next_tick);
|
||||
}
|
||||
|
|
@ -1826,18 +1831,18 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
|||
if (len < ETH_ZLEN)
|
||||
memset(tp->tx_buf[entry], 0, ETH_ZLEN);
|
||||
skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
} else {
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
dev->stats.tx_dropped++;
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
}
|
||||
/*
|
||||
|
|
@ -1851,7 +1856,7 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
|
|||
|
||||
tp->cur_tx++;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
|
||||
netif_stop_queue (dev);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
|
@ -1930,7 +1935,7 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
|
|||
if (tp->dirty_tx != dirty_tx) {
|
||||
tp->dirty_tx = dirty_tx;
|
||||
mb();
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
netif_wake_queue (dev);
|
||||
}
|
||||
}
|
||||
|
|
@ -2066,7 +2071,7 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
|||
RTL_R16 (RxBufAddr),
|
||||
RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd));
|
||||
|
||||
while ((tp->ecdev || netif_running(dev))
|
||||
while ((get_ecdev(tp) || netif_running(dev))
|
||||
&& received < budget
|
||||
&& (RTL_R8 (ChipCmd) & RxBufEmpty) == 0) {
|
||||
u32 ring_offset = cur_rx % RX_BUF_LEN;
|
||||
|
|
@ -2084,7 +2089,7 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
|||
else
|
||||
pkt_size = rx_size;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
if (netif_msg_rx_status(tp))
|
||||
pr_debug("%s: rtl8139_rx() status %4.4x, size %4.4x,"
|
||||
" cur %4.4x.\n", dev->name, rx_status,
|
||||
|
|
@ -2156,8 +2161,8 @@ no_early_rx:
|
|||
}
|
||||
|
||||
keep_pkt:
|
||||
if (tp->ecdev) {
|
||||
ecdev_receive(tp->ecdev, &rx_ring[ring_offset + 4], pkt_size);
|
||||
if (get_ecdev(tp)) {
|
||||
ecdev_receive(get_ecdev(tp), &rx_ring[ring_offset + 4], pkt_size);
|
||||
}
|
||||
else {
|
||||
/* Malloc up new buffer, compatible with net-2e. */
|
||||
|
|
@ -2295,7 +2300,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
int link_changed = 0; /* avoid bogus "uninit" warning */
|
||||
int handled = 0;
|
||||
|
||||
if (tp->ecdev) {
|
||||
if (get_ecdev(tp)) {
|
||||
status = RTL_R16 (IntrStatus);
|
||||
}
|
||||
else {
|
||||
|
|
@ -2313,7 +2318,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
if (unlikely(status == 0xFFFF))
|
||||
goto out;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
/* close possible race's with dev_close */
|
||||
if (unlikely(!netif_running(dev))) {
|
||||
RTL_W16 (IntrMask, 0);
|
||||
|
|
@ -2333,7 +2338,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
/* Receive packets are processed by poll routine.
|
||||
If not running start it now. */
|
||||
if (status & RxAckBits){
|
||||
if (tp->ecdev) {
|
||||
if (get_ecdev(tp)) {
|
||||
/* EtherCAT device: Just receive all frames */
|
||||
rtl8139_rx(dev, tp, 100); // FIXME
|
||||
} else {
|
||||
|
|
@ -2356,7 +2361,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
|
|||
RTL_W16 (IntrStatus, TxErr);
|
||||
}
|
||||
out:
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
spin_unlock (&tp->lock);
|
||||
}
|
||||
|
||||
|
|
@ -2410,7 +2415,7 @@ static int rtl8139_close (struct net_device *dev)
|
|||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags = 0;
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
netif_stop_queue(dev);
|
||||
napi_disable(&tp->napi);
|
||||
|
||||
|
|
@ -2431,7 +2436,7 @@ static int rtl8139_close (struct net_device *dev)
|
|||
dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
|
||||
if (!tp->ecdev) {
|
||||
if (!get_ecdev(tp)) {
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
free_irq(tp->pci_dev->irq, dev);
|
||||
|
|
@ -2659,7 +2664,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
|||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int rc;
|
||||
|
||||
if (tp->ecdev || !netif_running(dev))
|
||||
if (get_ecdev(tp) || !netif_running(dev))
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irq(&tp->lock);
|
||||
|
|
@ -2678,7 +2683,7 @@ rtl8139_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
|||
unsigned long flags;
|
||||
unsigned int start;
|
||||
|
||||
if (tp->ecdev || netif_running(dev)) {
|
||||
if (get_ecdev(tp) || netif_running(dev)) {
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
|
|
@ -2767,7 +2772,7 @@ static int __maybe_unused rtl8139_suspend(struct device *device)
|
|||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
|
||||
if (tp->ecdev || !netif_running (dev))
|
||||
if (get_ecdev(tp) || !netif_running (dev))
|
||||
return 0;
|
||||
|
||||
netif_device_detach (dev);
|
||||
|
|
@ -2792,7 +2797,7 @@ static int __maybe_unused rtl8139_resume(struct device *device)
|
|||
struct net_device *dev = dev_get_drvdata(device);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
|
||||
if (tp->ecdev || !netif_running (dev))
|
||||
if (get_ecdev(tp) || !netif_running (dev))
|
||||
return 0;
|
||||
|
||||
rtl8139_init_ring (dev);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# $Id$
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
#
|
||||
|
|
@ -21,15 +19,17 @@
|
|||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# vim: syntax=make
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
ifeq (@ENABLE_DRIVER_RESOURCE_VERIFYING@,1)
|
||||
ccflags-y += -DEC_ENABLE_DRIVER_RESOURCE_VERIFYING
|
||||
endif
|
||||
|
||||
|
||||
REV := $(shell if test -s $(src)/../revision; then \
|
||||
cat $(src)/../revision; \
|
||||
|
|
@ -93,8 +93,12 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq (@ENABLE_STMMAC@,1)
|
||||
obj-m += stmmac/
|
||||
endif
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS := \
|
||||
@abs_top_builddir@/$(LINUX_SYMVERS) \
|
||||
@abs_top_builddir@/master/$(LINUX_SYMVERS)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -17,12 +17,6 @@
|
|||
# with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
include $(top_srcdir)/Makefile.kbuild
|
||||
|
|
@ -34,48 +28,11 @@ SUBDIRS = \
|
|||
genet \
|
||||
igb \
|
||||
igc \
|
||||
r8169
|
||||
r8169 \
|
||||
stmmac
|
||||
|
||||
# using HEADERS to enable tags target
|
||||
noinst_HEADERS = \
|
||||
8139too-2.6.13-ethercat.c \
|
||||
8139too-2.6.13-orig.c \
|
||||
8139too-2.6.17-ethercat.c \
|
||||
8139too-2.6.17-orig.c \
|
||||
8139too-2.6.18-ethercat.c \
|
||||
8139too-2.6.18-orig.c \
|
||||
8139too-2.6.19-ethercat.c \
|
||||
8139too-2.6.19-orig.c \
|
||||
8139too-2.6.22-ethercat.c \
|
||||
8139too-2.6.22-orig.c \
|
||||
8139too-2.6.23-ethercat.c \
|
||||
8139too-2.6.23-orig.c \
|
||||
8139too-2.6.24-ethercat.c \
|
||||
8139too-2.6.24-orig.c \
|
||||
8139too-2.6.25-ethercat.c \
|
||||
8139too-2.6.25-orig.c \
|
||||
8139too-2.6.26-ethercat.c \
|
||||
8139too-2.6.26-orig.c \
|
||||
8139too-2.6.27-ethercat.c \
|
||||
8139too-2.6.27-orig.c \
|
||||
8139too-2.6.28-ethercat.c \
|
||||
8139too-2.6.28-orig.c \
|
||||
8139too-2.6.29-ethercat.c \
|
||||
8139too-2.6.29-orig.c \
|
||||
8139too-2.6.31-ethercat.c \
|
||||
8139too-2.6.31-orig.c \
|
||||
8139too-2.6.32-ethercat.c \
|
||||
8139too-2.6.32-orig.c \
|
||||
8139too-2.6.33-ethercat.c \
|
||||
8139too-2.6.33-orig.c \
|
||||
8139too-2.6.34-ethercat.c \
|
||||
8139too-2.6.34-orig.c \
|
||||
8139too-2.6.35-ethercat.c \
|
||||
8139too-2.6.35-orig.c \
|
||||
8139too-2.6.36-ethercat.c \
|
||||
8139too-2.6.36-orig.c \
|
||||
8139too-2.6.37-ethercat.c \
|
||||
8139too-2.6.37-orig.c \
|
||||
8139too-3.0-ethercat.c \
|
||||
8139too-3.0-orig.c \
|
||||
8139too-3.10-ethercat.c \
|
||||
|
|
@ -98,32 +55,14 @@ noinst_HEADERS = \
|
|||
8139too-4.4-orig.c \
|
||||
8139too-5.10-ethercat.c \
|
||||
8139too-5.10-orig.c \
|
||||
8139too-5.14-ethercat.c \
|
||||
8139too-5.14-orig.c \
|
||||
8139too-5.15-ethercat.c \
|
||||
8139too-5.15-orig.c \
|
||||
8139too-6.1-ethercat.c \
|
||||
8139too-6.1-orig.c \
|
||||
create_driver_table.py \
|
||||
device_drivers_template.md \
|
||||
e100-2.6.20-ethercat.c \
|
||||
e100-2.6.20-orig.c \
|
||||
e100-2.6.24-ethercat.c \
|
||||
e100-2.6.24-orig.c \
|
||||
e100-2.6.26-ethercat.c \
|
||||
e100-2.6.26-orig.c \
|
||||
e100-2.6.27-ethercat.c \
|
||||
e100-2.6.27-orig.c \
|
||||
e100-2.6.28-ethercat.c \
|
||||
e100-2.6.28-orig.c \
|
||||
e100-2.6.29-ethercat.c \
|
||||
e100-2.6.29-orig.c \
|
||||
e100-2.6.31-ethercat.c \
|
||||
e100-2.6.31-orig.c \
|
||||
e100-2.6.32-ethercat.c \
|
||||
e100-2.6.32-orig.c \
|
||||
e100-2.6.33-ethercat.c \
|
||||
e100-2.6.33-orig.c \
|
||||
e100-2.6.35-ethercat.c \
|
||||
e100-2.6.35-orig.c \
|
||||
e100-2.6.37-ethercat.c \
|
||||
e100-2.6.37-orig.c \
|
||||
e100-3.0-ethercat.c \
|
||||
e100-3.0-orig.c \
|
||||
e100-3.10-ethercat.c \
|
||||
|
|
@ -156,26 +95,6 @@ noinst_HEADERS = \
|
|||
e100-6.4-orig.c \
|
||||
ecdev.h \
|
||||
generic.c \
|
||||
r8169-2.6.24-ethercat.c \
|
||||
r8169-2.6.24-orig.c \
|
||||
r8169-2.6.27-ethercat.c \
|
||||
r8169-2.6.27-orig.c \
|
||||
r8169-2.6.28-ethercat.c \
|
||||
r8169-2.6.28-orig.c \
|
||||
r8169-2.6.29-ethercat.c \
|
||||
r8169-2.6.29-orig.c \
|
||||
r8169-2.6.31-ethercat.c \
|
||||
r8169-2.6.31-orig.c \
|
||||
r8169-2.6.32-ethercat.c \
|
||||
r8169-2.6.32-orig.c \
|
||||
r8169-2.6.33-ethercat.c \
|
||||
r8169-2.6.33-orig.c \
|
||||
r8169-2.6.35-ethercat.c \
|
||||
r8169-2.6.35-orig.c \
|
||||
r8169-2.6.36-ethercat.c \
|
||||
r8169-2.6.36-orig.c \
|
||||
r8169-2.6.37-ethercat.c \
|
||||
r8169-2.6.37-orig.c \
|
||||
r8169-3.10-ethercat.c \
|
||||
r8169-3.10-orig.c \
|
||||
r8169-3.12-ethercat.c \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# $Id$
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
#
|
||||
|
|
@ -21,15 +19,12 @@
|
|||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# vim: syntax=make
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
TOPDIR := $(src)/../..
|
||||
|
||||
|
|
@ -53,4 +48,4 @@ KBUILD_EXTRA_SYMBOLS := \
|
|||
@abs_top_builddir@/$(LINUX_SYMVERS) \
|
||||
@abs_top_builddir@/master/$(LINUX_SYMVERS)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# $Id$
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
#
|
||||
|
|
@ -19,18 +17,18 @@
|
|||
# with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
include $(top_srcdir)/Makefile.kbuild
|
||||
|
||||
EXTRA_DIST = \
|
||||
gpio.c \
|
||||
module.c \
|
||||
module.h \
|
||||
netdev.c \
|
||||
netdev.h \
|
||||
update.h
|
||||
sram.c \
|
||||
update.h \
|
||||
update.c
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -31,6 +31,17 @@
|
|||
#define request_dma(X, Y) ((int)(-EINVAL))
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SUSE_KERNEL
|
||||
#include <linux/suse_version.h>
|
||||
#else
|
||||
# ifndef SUSE_VERSION
|
||||
# define SUSE_VERSION 0
|
||||
# endif
|
||||
# ifndef SUSE_PATCHLEVEL
|
||||
# define SUSE_PATCHLEVEL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "module.h"
|
||||
|
||||
/**
|
||||
|
|
@ -897,7 +908,7 @@ static int ccat_eth_init_netdev(struct ccat_eth_priv *priv)
|
|||
|
||||
/* init netdev with MAC and stack callbacks */
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) || (SUSE_VERSION == 15 && SUSE_PATCHLEVEL == 5)
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
|
||||
if (priv->netdev->addr_len != ETH_ALEN)
|
||||
|
|
|
|||
|
|
@ -19,12 +19,6 @@
|
|||
# with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# The license mentioned above concerns the source code only. Using the
|
||||
# EtherCAT technology and brand is only permitted in compliance with the
|
||||
# industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
from os import walk
|
||||
|
|
@ -34,6 +28,7 @@ from re import compile
|
|||
DRIVER_MAP=(
|
||||
# (subdir, driver name, file prefix)
|
||||
(".", "8139too", "8139too"),
|
||||
("stmmac", "dwmac-intel", "dwmac-intel"),
|
||||
(".", "e100", "e100"),
|
||||
("e1000", "e1000", "e1000_main"),
|
||||
("e1000e", "e1000e", "netdev"),
|
||||
|
|
@ -42,6 +37,7 @@ DRIVER_MAP=(
|
|||
("igc", "igc", "igc_main"),
|
||||
(".", "r8169", "r8169"),
|
||||
("r8169", "r8169", "r8169_main"),
|
||||
("stmmac", "stmmac-pci", "stmmac_pci"),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -237,7 +229,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1202,7 +1194,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -239,7 +231,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1217,7 +1209,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -239,7 +231,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1217,7 +1209,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -239,7 +231,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1217,7 +1209,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -239,7 +231,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1217,7 +1209,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -239,7 +231,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1214,7 +1206,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -239,7 +231,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1214,7 +1206,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -239,7 +231,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1214,7 +1206,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -21,15 +19,9 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -38,7 +30,7 @@
|
|||
|
||||
/* Former documentation: */
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
|
||||
Intel PRO/100 Linux driver
|
||||
Copyright(c) 1999 - 2006 Intel Corporation.
|
||||
|
|
@ -64,7 +56,7 @@
|
|||
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
|
||||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
|
||||
*******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* e100.c: Intel(R) PRO/100 ethernet driver
|
||||
|
|
@ -239,7 +231,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRV_VERSION ", master " EC_MASTER_VERSION);
|
||||
|
||||
|
|
@ -1219,7 +1211,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,17 +17,12 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -211,7 +204,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
void e100_ec_poll(struct net_device *);
|
||||
|
|
@ -1190,7 +1183,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -19,17 +17,12 @@
|
|||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The license mentioned above concerns the source code only. Using the
|
||||
* EtherCAT technology and brand is only permitted in compliance with the
|
||||
* industrial property and similar rights of Beckhoff Automation GmbH.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* vim: noexpandtab
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
|
|
@ -223,7 +216,7 @@ MODULE_FIRMWARE(FIRMWARE_D101S);
|
|||
MODULE_FIRMWARE(FIRMWARE_D102E);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_AUTHOR("Florian Pose <fp@igh.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
void e100_ec_poll(struct net_device *);
|
||||
|
|
@ -1202,7 +1195,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
|||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (nic->ecdev ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
|
|
@ -2415,7 +2408,11 @@ static int e100_set_mac_address(struct net_device *netdev, void *p)
|
|||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
#if SUSE_VERSION == 15 && SUSE_PATCHLEVEL >= 5
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
#else
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
#endif
|
||||
e100_exec_cb(nic, NULL, e100_setup_iaaddr);
|
||||
|
||||
return 0;
|
||||
|
|
@ -3099,7 +3096,11 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
|
||||
e100_phy_init(nic);
|
||||
|
||||
#if SUSE_VERSION == 15 && SUSE_PATCHLEVEL >= 5
|
||||
eth_hw_addr_set(netdev, (const u8*)nic->eeprom);
|
||||
#else
|
||||
memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN);
|
||||
#endif
|
||||
if (!is_valid_ether_addr(netdev->dev_addr)) {
|
||||
if (!eeprom_bad_csum_allow) {
|
||||
netif_err(nic, probe, nic->netdev, "Invalid MAC address from EEPROM, aborting\n");
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue