Skip to content

Commit cb4361c

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (37 commits) smc91c92_cs: fix the problem of "Unable to find hardware address" r8169: clean up my printk uglyness net: Hook up cxgb4 to Kconfig and Makefile cxgb4: Add main driver file and driver Makefile cxgb4: Add remaining driver headers and L2T management cxgb4: Add packet queues and packet DMA code cxgb4: Add HW and FW support code cxgb4: Add register, message, and FW definitions netlabel: Fix several rcu_dereference() calls used without RCU read locks bonding: fix potential deadlock in bond_uninit() net: check the length of the socket address passed to connect(2) stmmac: add documentation for the driver. stmmac: fix kconfig for crc32 build error be2net: fix bug in vlan rx path for big endian architecture be2net: fix flashing on big endian architectures be2net: fix a bug in flashing the redboot section bonding: bond_xmit_roundrobin() fix drivers/net: Add missing unlock net: gianfar - align BD ring size console messages net: gianfar - initialize per-queue statistics ...
2 parents 309361e + fb9e2d8 commit cb4361c

47 files changed

Lines changed: 14221 additions & 131 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
STMicroelectronics 10/100/1000 Synopsys Ethernet driver
2+
3+
Copyright (C) 2007-2010 STMicroelectronics Ltd
4+
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
5+
6+
This is the driver for the MAC 10/100/1000 on-chip Ethernet controllers
7+
(Synopsys IP blocks); it has been fully tested on STLinux platforms.
8+
9+
Currently this network device driver is for all STM embedded MAC/GMAC
10+
(7xxx SoCs).
11+
12+
DWC Ether MAC 10/100/1000 Universal version 3.41a and DWC Ether MAC 10/100
13+
Universal version 4.0 have been used for developing the first code
14+
implementation.
15+
16+
Please, for more information also visit: www.stlinux.com
17+
18+
1) Kernel Configuration
19+
The kernel configuration option is STMMAC_ETH:
20+
Device Drivers ---> Network device support ---> Ethernet (1000 Mbit) --->
21+
STMicroelectronics 10/100/1000 Ethernet driver (STMMAC_ETH)
22+
23+
2) Driver parameters list:
24+
debug: message level (0: no output, 16: all);
25+
phyaddr: to manually provide the physical address to the PHY device;
26+
dma_rxsize: DMA rx ring size;
27+
dma_txsize: DMA tx ring size;
28+
buf_sz: DMA buffer size;
29+
tc: control the HW FIFO threshold;
30+
tx_coe: Enable/Disable Tx Checksum Offload engine;
31+
watchdog: transmit timeout (in milliseconds);
32+
flow_ctrl: Flow control ability [on/off];
33+
pause: Flow Control Pause Time;
34+
tmrate: timer period (only if timer optimisation is configured).
35+
36+
3) Command line options
37+
Driver parameters can be also passed in command line by using:
38+
stmmaceth=dma_rxsize:128,dma_txsize:512
39+
40+
4) Driver information and notes
41+
42+
4.1) Transmit process
43+
The xmit method is invoked when the kernel needs to transmit a packet; it sets
44+
the descriptors in the ring and informs the DMA engine that there is a packet
45+
ready to be transmitted.
46+
Once the controller has finished transmitting the packet, an interrupt is
47+
triggered; So the driver will be able to release the socket buffers.
48+
By default, the driver sets the NETIF_F_SG bit in the features field of the
49+
net_device structure enabling the scatter/gather feature.
50+
51+
4.2) Receive process
52+
When one or more packets are received, an interrupt happens. The interrupts
53+
are not queued so the driver has to scan all the descriptors in the ring during
54+
the receive process.
55+
This is based on NAPI so the interrupt handler signals only if there is work to be
56+
done, and it exits.
57+
Then the poll method will be scheduled at some future point.
58+
The incoming packets are stored, by the DMA, in a list of pre-allocated socket
59+
buffers in order to avoid the memcpy (Zero-copy).
60+
61+
4.3) Timer-Driver Interrupt
62+
Instead of having the device that asynchronously notifies the frame receptions, the
63+
driver configures a timer to generate an interrupt at regular intervals.
64+
Based on the granularity of the timer, the frames that are received by the device
65+
will experience different levels of latency. Some NICs have dedicated timer
66+
device to perform this task. STMMAC can use either the RTC device or the TMU
67+
channel 2 on STLinux platforms.
68+
The timers frequency can be passed to the driver as parameter; when change it,
69+
take care of both hardware capability and network stability/performance impact.
70+
Several performance tests on STM platforms showed this optimisation allows to spare
71+
the CPU while having the maximum throughput.
72+
73+
4.4) WOL
74+
Wake up on Lan feature through Magic Frame is only supported for the GMAC
75+
core.
76+
77+
4.5) DMA descriptors
78+
Driver handles both normal and enhanced descriptors. The latter has been only
79+
tested on DWC Ether MAC 10/100/1000 Universal version 3.41a.
80+
81+
4.6) Ethtool support
82+
Ethtool is supported. Driver statistics and internal errors can be taken using:
83+
ethtool -S ethX command. It is possible to dump registers etc.
84+
85+
4.7) Jumbo and Segmentation Offloading
86+
Jumbo frames are supported and tested for the GMAC.
87+
The GSO has been also added but it's performed in software.
88+
LRO is not supported.
89+
90+
4.8) Physical
91+
The driver is compatible with PAL to work with PHY and GPHY devices.
92+
93+
4.9) Platform information
94+
Several information came from the platform; please refer to the
95+
driver's Header file in include/linux directory.
96+
97+
struct plat_stmmacenet_data {
98+
int bus_id;
99+
int pbl;
100+
int has_gmac;
101+
void (*fix_mac_speed)(void *priv, unsigned int speed);
102+
void (*bus_setup)(unsigned long ioaddr);
103+
#ifdef CONFIG_STM_DRIVERS
104+
struct stm_pad_config *pad_config;
105+
#endif
106+
void *bsp_priv;
107+
};
108+
109+
Where:
110+
- pbl (Programmable Burst Length) is maximum number of
111+
beats to be transferred in one DMA transaction.
112+
GMAC also enables the 4xPBL by default.
113+
- fix_mac_speed and bus_setup are used to configure internal target
114+
registers (on STM platforms);
115+
- has_gmac: GMAC core is on board (get it at run-time in the next step);
116+
- bus_id: bus identifier.
117+
118+
struct plat_stmmacphy_data {
119+
int bus_id;
120+
int phy_addr;
121+
unsigned int phy_mask;
122+
int interface;
123+
int (*phy_reset)(void *priv);
124+
void *priv;
125+
};
126+
127+
Where:
128+
- bus_id: bus identifier;
129+
- phy_addr: physical address used for the attached phy device;
130+
set it to -1 to get it at run-time;
131+
- interface: physical MII interface mode;
132+
- phy_reset: hook to reset HW function.
133+
134+
TODO:
135+
- Continue to make the driver more generic and suitable for other Synopsys
136+
Ethernet controllers used on other architectures (i.e. ARM).
137+
- 10G controllers are not supported.
138+
- MAC uses Normal descriptors and GMAC uses enhanced ones.
139+
This is a limit that should be reviewed. MAC could want to
140+
use the enhanced structure.
141+
- Checksumming: Rx/Tx csum is done in HW in case of GMAC only.
142+
- Review the timer optimisation code to use an embedded device that seems to be
143+
available in new chip generations.

‎drivers/net/Kconfig‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,6 +2582,31 @@ config CHELSIO_T3
25822582
To compile this driver as a module, choose M here: the module
25832583
will be called cxgb3.
25842584

2585+
config CHELSIO_T4_DEPENDS
2586+
tristate
2587+
depends on PCI && INET
2588+
default y
2589+
2590+
config CHELSIO_T4
2591+
tristate "Chelsio Communications T4 Ethernet support"
2592+
depends on CHELSIO_T4_DEPENDS
2593+
select FW_LOADER
2594+
select MDIO
2595+
help
2596+
This driver supports Chelsio T4-based gigabit and 10Gb Ethernet
2597+
adapters.
2598+
2599+
For general information about Chelsio and our products, visit
2600+
our website at <http://www.chelsio.com>.
2601+
2602+
For customer support, please visit our customer support page at
2603+
<http://www.chelsio.com/support.htm>.
2604+
2605+
Please send feedback to <linux-bugs@chelsio.com>.
2606+
2607+
To compile this driver as a module choose M here; the module
2608+
will be called cxgb4.
2609+
25852610
config EHEA
25862611
tristate "eHEA Ethernet support"
25872612
depends on IBMEBUS && INET && SPARSEMEM

‎drivers/net/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ obj-$(CONFIG_IXGB) += ixgb/
1919
obj-$(CONFIG_IP1000) += ipg.o
2020
obj-$(CONFIG_CHELSIO_T1) += chelsio/
2121
obj-$(CONFIG_CHELSIO_T3) += cxgb3/
22+
obj-$(CONFIG_CHELSIO_T4) += cxgb4/
2223
obj-$(CONFIG_EHEA) += ehea/
2324
obj-$(CONFIG_CAN) += can/
2425
obj-$(CONFIG_BONDING) += bonding/

‎drivers/net/benet/be_cmds.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,8 +1464,8 @@ int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
14641464

14651465
req->params.op_type = cpu_to_le32(IMG_TYPE_REDBOOT);
14661466
req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT);
1467-
req->params.offset = offset;
1468-
req->params.data_buf_size = 0x4;
1467+
req->params.offset = cpu_to_le32(offset);
1468+
req->params.data_buf_size = cpu_to_le32(0x4);
14691469

14701470
status = be_mcc_notify_wait(adapter);
14711471
if (!status)

‎drivers/net/benet/be_main.c‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ static void be_rx_compl_process(struct be_adapter *adapter,
807807
return;
808808
}
809809
vid = AMAP_GET_BITS(struct amap_eth_rx_compl, vlan_tag, rxcp);
810-
vid = be16_to_cpu(vid);
810+
vid = swab16(vid);
811811
vlan_hwaccel_receive_skb(skb, adapter->vlan_grp, vid);
812812
} else {
813813
netif_receive_skb(skb);
@@ -884,7 +884,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
884884
napi_gro_frags(&eq_obj->napi);
885885
} else {
886886
vid = AMAP_GET_BITS(struct amap_eth_rx_compl, vlan_tag, rxcp);
887-
vid = be16_to_cpu(vid);
887+
vid = swab16(vid);
888888

889889
if (!adapter->vlan_grp || adapter->vlans_added == 0)
890890
return;
@@ -1855,7 +1855,7 @@ static bool be_flash_redboot(struct be_adapter *adapter,
18551855
p += crc_offset;
18561856

18571857
status = be_cmd_get_flash_crc(adapter, flashed_crc,
1858-
(img_start + image_size - 4));
1858+
(image_size - 4));
18591859
if (status) {
18601860
dev_err(&adapter->pdev->dev,
18611861
"could not get crc from flash, not flashing redboot\n");
@@ -1991,7 +1991,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *func)
19911991
struct flash_file_hdr_g3 *fhdr3;
19921992
struct image_hdr *img_hdr_ptr = NULL;
19931993
struct be_dma_mem flash_cmd;
1994-
int status, i = 0;
1994+
int status, i = 0, num_imgs = 0;
19951995
const u8 *p;
19961996

19971997
strcpy(fw_file, func);
@@ -2017,15 +2017,14 @@ int be_load_fw(struct be_adapter *adapter, u8 *func)
20172017
if ((adapter->generation == BE_GEN3) &&
20182018
(get_ufigen_type(fhdr) == BE_GEN3)) {
20192019
fhdr3 = (struct flash_file_hdr_g3 *) fw->data;
2020-
for (i = 0; i < fhdr3->num_imgs; i++) {
2020+
num_imgs = le32_to_cpu(fhdr3->num_imgs);
2021+
for (i = 0; i < num_imgs; i++) {
20212022
img_hdr_ptr = (struct image_hdr *) (fw->data +
20222023
(sizeof(struct flash_file_hdr_g3) +
2023-
i * sizeof(struct image_hdr)));
2024-
if (img_hdr_ptr->imageid == 1) {
2025-
status = be_flash_data(adapter, fw,
2026-
&flash_cmd, fhdr3->num_imgs);
2027-
}
2028-
2024+
i * sizeof(struct image_hdr)));
2025+
if (le32_to_cpu(img_hdr_ptr->imageid) == 1)
2026+
status = be_flash_data(adapter, fw, &flash_cmd,
2027+
num_imgs);
20292028
}
20302029
} else if ((adapter->generation == BE_GEN2) &&
20312030
(get_ufigen_type(fhdr) == BE_GEN2)) {

‎drivers/net/bonding/bond_main.c‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4156,7 +4156,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
41564156
* send the join/membership reports. The curr_active_slave found
41574157
* will send all of this type of traffic.
41584158
*/
4159-
if ((iph->protocol == htons(IPPROTO_IGMP)) &&
4159+
if ((iph->protocol == IPPROTO_IGMP) &&
41604160
(skb->protocol == htons(ETH_P_IP))) {
41614161

41624162
read_lock(&bond->curr_slave_lock);
@@ -4450,6 +4450,14 @@ static const struct net_device_ops bond_netdev_ops = {
44504450
.ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,
44514451
};
44524452

4453+
static void bond_destructor(struct net_device *bond_dev)
4454+
{
4455+
struct bonding *bond = netdev_priv(bond_dev);
4456+
if (bond->wq)
4457+
destroy_workqueue(bond->wq);
4458+
free_netdev(bond_dev);
4459+
}
4460+
44534461
static void bond_setup(struct net_device *bond_dev)
44544462
{
44554463
struct bonding *bond = netdev_priv(bond_dev);
@@ -4470,7 +4478,7 @@ static void bond_setup(struct net_device *bond_dev)
44704478
bond_dev->ethtool_ops = &bond_ethtool_ops;
44714479
bond_set_mode_ops(bond, bond->params.mode);
44724480

4473-
bond_dev->destructor = free_netdev;
4481+
bond_dev->destructor = bond_destructor;
44744482

44754483
/* Initialize the device options */
44764484
bond_dev->tx_queue_len = 0;
@@ -4542,9 +4550,6 @@ static void bond_uninit(struct net_device *bond_dev)
45424550

45434551
bond_remove_proc_entry(bond);
45444552

4545-
if (bond->wq)
4546-
destroy_workqueue(bond->wq);
4547-
45484553
netif_addr_lock_bh(bond_dev);
45494554
bond_mc_list_destroy(bond);
45504555
netif_addr_unlock_bh(bond_dev);
@@ -4956,8 +4961,8 @@ int bond_create(struct net *net, const char *name)
49564961
bond_setup);
49574962
if (!bond_dev) {
49584963
pr_err("%s: eek! can't alloc netdev!\n", name);
4959-
res = -ENOMEM;
4960-
goto out;
4964+
rtnl_unlock();
4965+
return -ENOMEM;
49614966
}
49624967

49634968
dev_net_set(bond_dev, net);
@@ -4966,19 +4971,16 @@ int bond_create(struct net *net, const char *name)
49664971
if (!name) {
49674972
res = dev_alloc_name(bond_dev, "bond%d");
49684973
if (res < 0)
4969-
goto out_netdev;
4974+
goto out;
49704975
}
49714976

49724977
res = register_netdevice(bond_dev);
4973-
if (res < 0)
4974-
goto out_netdev;
49754978

49764979
out:
49774980
rtnl_unlock();
4981+
if (res < 0)
4982+
bond_destructor(bond_dev);
49784983
return res;
4979-
out_netdev:
4980-
free_netdev(bond_dev);
4981-
goto out;
49824984
}
49834985

49844986
static int __net_init bond_net_init(struct net *net)

‎drivers/net/cxgb4/Makefile‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Chelsio T4 driver
3+
#
4+
5+
obj-$(CONFIG_CHELSIO_T4) += cxgb4.o
6+
7+
cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o

0 commit comments

Comments
 (0)