aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atl1
diff options
context:
space:
mode:
authorJay Cliburn <jacliburn@bellsouth.net>2007-07-19 19:45:14 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-24 16:28:41 -0400
commita3093d9b07101f2461f88dfd0a20aaaa8853e976 (patch)
tree064ee9dd7e619777e1b68e345a88724aacd44258 /drivers/net/atl1
parentef76e3e2505db01f7d4b537854f4a177220c26c8 (diff)
atl1: use kernel provided ethernet length constants
Use constants already provided by the kernel for ethernet related lengths. Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/atl1')
-rw-r--r--drivers/net/atl1/atl1_hw.h5
-rw-r--r--drivers/net/atl1/atl1_main.c13
2 files changed, 7 insertions, 11 deletions
diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atl1/atl1_hw.h
index f0d7e82251d2..939aa0f53f6e 100644
--- a/drivers/net/atl1/atl1_hw.h
+++ b/drivers/net/atl1/atl1_hw.h
@@ -680,11 +680,6 @@ void atl1_check_options(struct atl1_adapter *adapter);
680#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds */ 680#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds */
681#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds */ 681#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds */
682 682
683/* The size (in bytes) of a ethernet packet */
684#define ENET_HEADER_SIZE 14
685#define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* with FCS */
686#define MINIMUM_ETHERNET_FRAME_SIZE 64 /* with FCS */
687#define ETHERNET_FCS_SIZE 4
688#define MAX_JUMBO_FRAME_SIZE 0x2800 683#define MAX_JUMBO_FRAME_SIZE 0x2800
689 684
690#define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */ 685#define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6aa2dc32727e..993ed2a2d282 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -59,6 +59,7 @@
59#include <linux/skbuff.h> 59#include <linux/skbuff.h>
60#include <linux/etherdevice.h> 60#include <linux/etherdevice.h>
61#include <linux/if_vlan.h> 61#include <linux/if_vlan.h>
62#include <linux/if_ether.h>
62#include <linux/irqreturn.h> 63#include <linux/irqreturn.h>
63#include <linux/workqueue.h> 64#include <linux/workqueue.h>
64#include <linux/timer.h> 65#include <linux/timer.h>
@@ -120,8 +121,8 @@ static int __devinit atl1_sw_init(struct atl1_adapter *adapter)
120 struct atl1_hw *hw = &adapter->hw; 121 struct atl1_hw *hw = &adapter->hw;
121 struct net_device *netdev = adapter->netdev; 122 struct net_device *netdev = adapter->netdev;
122 123
123 hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; 124 hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
124 hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE; 125 hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
125 126
126 adapter->wol = 0; 127 adapter->wol = 0;
127 adapter->rx_buffer_len = (hw->max_frame_size + 7) & ~7; 128 adapter->rx_buffer_len = (hw->max_frame_size + 7) & ~7;
@@ -688,9 +689,9 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
688{ 689{
689 struct atl1_adapter *adapter = netdev_priv(netdev); 690 struct atl1_adapter *adapter = netdev_priv(netdev);
690 int old_mtu = netdev->mtu; 691 int old_mtu = netdev->mtu;
691 int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; 692 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
692 693
693 if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || 694 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
694 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 695 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
695 dev_warn(&adapter->pdev->dev, "invalid MTU setting\n"); 696 dev_warn(&adapter->pdev->dev, "invalid MTU setting\n");
696 return -EINVAL; 697 return -EINVAL;
@@ -1337,7 +1338,7 @@ rrd_ok:
1337 skb = buffer_info->skb; 1338 skb = buffer_info->skb;
1338 length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size); 1339 length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size);
1339 1340
1340 skb_put(skb, length - ETHERNET_FCS_SIZE); 1341 skb_put(skb, length - ETH_FCS_LEN);
1341 1342
1342 /* Receive Checksum Offload */ 1343 /* Receive Checksum Offload */
1343 atl1_rx_checksum(adapter, rrd, skb); 1344 atl1_rx_checksum(adapter, rrd, skb);
@@ -1456,7 +1457,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
1456 tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, 1457 tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
1457 iph->daddr, 0, IPPROTO_TCP, 0); 1458 iph->daddr, 0, IPPROTO_TCP, 0);
1458 ipofst = skb_network_offset(skb); 1459 ipofst = skb_network_offset(skb);
1459 if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ 1460 if (ipofst != ETH_HLEN) /* 802.3 frame */
1460 tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; 1461 tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;
1461 1462
1462 tso->tsopl |= (iph->ihl & 1463 tso->tsopl |= (iph->ihl &