aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-05-06 14:58:55 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-06 14:58:55 -0400
commitad638bd16d91012a512979327b5c17c867d260c6 (patch)
tree094bcc3975a8669b6e2450f7e8aaf498c734bbad /drivers/net
parent7143b7d41218d4fc2ea33e6056c73609527ae687 (diff)
hamachi: Delete TX checksumming code commented out since 1999
TX checksumming support has been ifdef commented out of this driver for more than 10 years, and it makes references to aspects of the IPv4 stack from back then as well. If someone has one of these rare cards and wants to properly resurrect TX checksumming support, they can still get at this code in the version control history. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/hamachi.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 80d25ed5334..f5fba73c873 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -132,14 +132,8 @@ static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
132/* 132/*
133 * RX_CHECKSUM turns on card-generated receive checksum generation for 133 * RX_CHECKSUM turns on card-generated receive checksum generation for
134 * TCP and UDP packets. Otherwise the upper layers do the calculation. 134 * TCP and UDP packets. Otherwise the upper layers do the calculation.
135 * TX_CHECKSUM won't do anything too useful, even if it works. There's no
136 * easy mechanism by which to tell the TCP/UDP stack that it need not
137 * generate checksums for this device. But if somebody can find a way
138 * to get that to work, most of the card work is in here already.
139 * 3/10/1999 Pete Wyckoff <wyckoff@ca.sandia.gov> 135 * 3/10/1999 Pete Wyckoff <wyckoff@ca.sandia.gov>
140 */ 136 */
141#undef TX_CHECKSUM
142#define RX_CHECKSUM
143 137
144/* Operational parameters that usually are not changed. */ 138/* Operational parameters that usually are not changed. */
145/* Time in jiffies before concluding the transmitter is hung. */ 139/* Time in jiffies before concluding the transmitter is hung. */
@@ -630,11 +624,6 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
630 624
631 SET_NETDEV_DEV(dev, &pdev->dev); 625 SET_NETDEV_DEV(dev, &pdev->dev);
632 626
633#ifdef TX_CHECKSUM
634 printk("check that skbcopy in ip_queue_xmit isn't happening\n");
635 dev->hard_header_len += 8; /* for cksum tag */
636#endif
637
638 for (i = 0; i < 6; i++) 627 for (i = 0; i < 6; i++)
639 dev->dev_addr[i] = 1 ? read_eeprom(ioaddr, 4 + i) 628 dev->dev_addr[i] = 1 ? read_eeprom(ioaddr, 4 + i)
640 : readb(ioaddr + StationAddr + i); 629 : readb(ioaddr + StationAddr + i);
@@ -937,11 +926,7 @@ static int hamachi_open(struct net_device *dev)
937 926
938 /* always 1, takes no more time to do it */ 927 /* always 1, takes no more time to do it */
939 writew(0x0001, ioaddr + RxChecksum); 928 writew(0x0001, ioaddr + RxChecksum);
940#ifdef TX_CHECKSUM
941 writew(0x0001, ioaddr + TxChecksum);
942#else
943 writew(0x0000, ioaddr + TxChecksum); 929 writew(0x0000, ioaddr + TxChecksum);
944#endif
945 writew(0x8000, ioaddr + MACCnfg); /* Soft reset the MAC */ 930 writew(0x8000, ioaddr + MACCnfg); /* Soft reset the MAC */
946 writew(0x215F, ioaddr + MACCnfg); 931 writew(0x215F, ioaddr + MACCnfg);
947 writew(0x000C, ioaddr + FrameGap0); 932 writew(0x000C, ioaddr + FrameGap0);
@@ -1226,40 +1211,6 @@ static void hamachi_init_ring(struct net_device *dev)
1226} 1211}
1227 1212
1228 1213
1229#ifdef TX_CHECKSUM
1230#define csum_add(it, val) \
1231do { \
1232 it += (u16) (val); \
1233 if (it & 0xffff0000) { \
1234 it &= 0xffff; \
1235 ++it; \
1236 } \
1237} while (0)
1238 /* printk("add %04x --> %04x\n", val, it); \ */
1239
1240/* uh->len already network format, do not swap */
1241#define pseudo_csum_udp(sum,ih,uh) do { \
1242 sum = 0; \
1243 csum_add(sum, (ih)->saddr >> 16); \
1244 csum_add(sum, (ih)->saddr & 0xffff); \
1245 csum_add(sum, (ih)->daddr >> 16); \
1246 csum_add(sum, (ih)->daddr & 0xffff); \
1247 csum_add(sum, cpu_to_be16(IPPROTO_UDP)); \
1248 csum_add(sum, (uh)->len); \
1249} while (0)
1250
1251/* swap len */
1252#define pseudo_csum_tcp(sum,ih,len) do { \
1253 sum = 0; \
1254 csum_add(sum, (ih)->saddr >> 16); \
1255 csum_add(sum, (ih)->saddr & 0xffff); \
1256 csum_add(sum, (ih)->daddr >> 16); \
1257 csum_add(sum, (ih)->daddr & 0xffff); \
1258 csum_add(sum, cpu_to_be16(IPPROTO_TCP)); \
1259 csum_add(sum, htons(len)); \
1260} while (0)
1261#endif
1262
1263static netdev_tx_t hamachi_start_xmit(struct sk_buff *skb, 1214static netdev_tx_t hamachi_start_xmit(struct sk_buff *skb,
1264 struct net_device *dev) 1215 struct net_device *dev)
1265{ 1216{
@@ -1292,36 +1243,6 @@ static netdev_tx_t hamachi_start_xmit(struct sk_buff *skb,
1292 1243
1293 hmp->tx_skbuff[entry] = skb; 1244 hmp->tx_skbuff[entry] = skb;
1294 1245
1295#ifdef TX_CHECKSUM
1296 {
1297 /* tack on checksum tag */
1298 u32 tagval = 0;
1299 struct ethhdr *eh = (struct ethhdr *)skb->data;
1300 if (eh->h_proto == cpu_to_be16(ETH_P_IP)) {
1301 struct iphdr *ih = (struct iphdr *)((char *)eh + ETH_HLEN);
1302 if (ih->protocol == IPPROTO_UDP) {
1303 struct udphdr *uh
1304 = (struct udphdr *)((char *)ih + ih->ihl*4);
1305 u32 offset = ((unsigned char *)uh + 6) - skb->data;
1306 u32 pseudo;
1307 pseudo_csum_udp(pseudo, ih, uh);
1308 pseudo = htons(pseudo);
1309 printk("udp cksum was %04x, sending pseudo %04x\n",
1310 uh->check, pseudo);
1311 uh->check = 0; /* zero out uh->check before card calc */
1312 /*
1313 * start at 14 (skip ethhdr), store at offset (uh->check),
1314 * use pseudo value given.
1315 */
1316 tagval = (14 << 24) | (offset << 16) | pseudo;
1317 } else if (ih->protocol == IPPROTO_TCP) {
1318 printk("tcp, no auto cksum\n");
1319 }
1320 }
1321 *(u32 *)skb_push(skb, 8) = tagval;
1322 }
1323#endif
1324
1325 hmp->tx_ring[entry].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, 1246 hmp->tx_ring[entry].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
1326 skb->data, skb->len, PCI_DMA_TODEVICE)); 1247 skb->data, skb->len, PCI_DMA_TODEVICE));
1327 1248