1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1999,2001-2005 Silicon Graphics, Inc. All rights reserved. 7 */ 8 9 10/* 11 * Cross Partition Network Interface (XPNET) support 12 * 13 * XPNET provides a virtual network layered on top of the Cross 14 * Partition communication layer. 15 * 16 * XPNET provides direct point-to-point and broadcast-like support 17 * for an ethernet-like device. The ethernet broadcast medium is 18 * replaced with a point-to-point message structure which passes 19 * pointers to a DMA-capable block that a remote partition should 20 * retrieve and pass to the upper level networking layer. 21 * 22 */ 23 24 25#include <linux/module.h> 26#include <linux/kernel.h> 27#include <linux/init.h> 28#include <linux/ioport.h> 29#include <linux/netdevice.h> 30#include <linux/etherdevice.h> 31#include <linux/delay.h> 32#include <linux/ethtool.h> 33#include <linux/mii.h> 34#include <linux/smp.h> 35#include <linux/string.h> 36#include <asm/sn/bte.h> 37#include <asm/sn/io.h> 38#include <asm/sn/sn_sal.h> 39#include <asm/types.h> 40#include <asm/atomic.h> 41#include <asm/sn/xp.h> 42 43 44/* 45 * The message payload transferred by XPC. 46 * 47 * buf_pa is the physical address where the DMA should pull from. 48 * 49 * NOTE: for performance reasons, buf_pa should _ALWAYS_ begin on a 50 * cacheline boundary. To accomplish this, we record the number of 51 * bytes from the beginning of the first cacheline to the first useful 52 * byte of the skb (leadin_ignore) and the number of bytes from the 53 * last useful byte of the skb to the end of the last cacheline 54 * (tailout_ignore). 55 * 56 * size is the number of bytes to transfer which includes the skb->len 57 * (useful bytes of the senders skb) plus the leadin and tailout 58 */ 59struct xpnet_message { 60 u16 version; /* Version for this message */ 61 u16 embedded_bytes; /* #of bytes embedded in XPC message */ 62 u32 magic; /* Special number indicating this is xpnet */ 63 u64 buf_pa; /* phys address of buffer to retrieve */ 64 u32 size; /* #of bytes in buffer */ 65 u8 leadin_ignore; /* #of bytes to ignore at the beginning */ 66 u8 tailout_ignore; /* #of bytes to ignore at the end */ 67 unsigned char data; /* body of small packets */ 68}; 69 70/* 71 * Determine the size of our message, the cacheline aligned size, 72 * and then the number of message will request from XPC. 73 * 74 * XPC expects each message to exist in an individual cacheline. 75 */ 76#define XPNET_MSG_SIZE (L1_CACHE_BYTES - XPC_MSG_PAYLOAD_OFFSET) 77#define XPNET_MSG_DATA_MAX \ 78 (XPNET_MSG_SIZE - (u64)(&((struct xpnet_message *)0)->data)) 79#define XPNET_MSG_ALIGNED_SIZE (L1_CACHE_ALIGN(XPNET_MSG_SIZE)) 80#define XPNET_MSG_NENTRIES (PAGE_SIZE / XPNET_MSG_ALIGNED_SIZE) 81 82 83#define XPNET_MAX_KTHREADS (XPNET_MSG_NENTRIES + 1) 84#define XPNET_MAX_IDLE_KTHREADS (XPNET_MSG_NENTRIES + 1) 85 86/* 87 * Version number of XPNET implementation. XPNET can always talk to versions 88 * with same major #, and never talk to versions with a different version. 89 */ 90#define _XPNET_VERSION(_major, _minor) (((_major) << 4) | (_minor)) 91#define XPNET_VERSION_MAJOR(_v) ((_v) >> 4) 92#define XPNET_VERSION_MINOR(_v) ((_v) & 0xf) 93 94#define XPNET_VERSION _XPNET_VERSION(1,0) /* version 1.0 */ 95#define XPNET_VERSION_EMBED _XPNET_VERSION(1,1) /* version 1.1 */ 96#define XPNET_MAGIC 0x88786984 /* "XNET" */ 97 98#define XPNET_VALID_MSG(_m) \ 99 ((XPNET_VERSION_MAJOR(_m->version) == XPNET_VERSION_MAJOR(XPNET_VERSION)) \ 100 && (msg->magic == XPNET_MAGIC)) 101 102#define XPNET_DEVICE_NAME "xp0" 103 104 105/* 106 * When messages are queued with xpc_send_notify, a kmalloc'd buffer 107 * of the following type is passed as a notification cookie. When the 108 * notification function is called, we use the cookie to decide 109 * whether all outstanding message sends have completed. The skb can 110 * then be released. 111 */ 112struct xpnet_pending_msg { 113 struct list_head free_list; 114 struct sk_buff *skb; 115 atomic_t use_count; 116}; 117 118/* driver specific structure pointed to by the device structure */ 119struct xpnet_dev_private { 120 struct net_device_stats stats; 121}; 122 123struct net_device *xpnet_device; 124 125/* 126 * When we are notified of other partitions activating, we add them to 127 * our bitmask of partitions to which we broadcast. 128 */ 129static u64 xpnet_broadcast_partitions; 130/* protect above */ 131static DEFINE_SPINLOCK(xpnet_broadcast_lock); 132 133/* 134 * Since the Block Transfer Engine (BTE) is being used for the transfer 135 * and it relies upon cache-line size transfers, we need to reserve at 136 * least one cache-line for head and tail alignment. The BTE is 137 * limited to 8MB transfers. 138 * 139 * Testing has shown that changing MTU to greater than 64KB has no effect 140 * on TCP as the two sides negotiate a Max Segment Size that is limited 141 * to 64K. Other protocols May use packets greater than this, but for 142 * now, the default is 64KB. 143 */ 144#define XPNET_MAX_MTU (0x800000UL - L1_CACHE_BYTES) 145/* 32KB has been determined to be the ideal */ 146#define XPNET_DEF_MTU (0x8000UL) 147 148 149/* 150 * The partition id is encapsulated in the MAC address. The following 151 * define locates the octet the partid is in. 152 */ 153#define XPNET_PARTID_OCTET 1 154#define XPNET_LICENSE_OCTET 2 155 156 157/* 158 * Define the XPNET debug device structure that is to be used with dev_dbg(), 159 * dev_err(), dev_warn(), and dev_info(). 160 */ 161struct device_driver xpnet_dbg_name = { 162 .name = "xpnet" 163}; 164 165struct device xpnet_dbg_subname = { 166 .bus_id = {0}, /* set to "" */ 167 .driver = &xpnet_dbg_name 168}; 169 170struct device *xpnet = &xpnet_dbg_subname; 171 172/* 173 * Packet was recevied by XPC and forwarded to us. 174 */ 175static void 176xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) 177{ 178 struct sk_buff *skb; 179 bte_result_t bret; 180 struct xpnet_dev_private *priv = 181 (struct xpnet_dev_private *) xpnet_device->priv; 182 183 184 if (!XPNET_VALID_MSG(msg)) { 185 /* 186 * Packet with a different XPC version. Ignore. 187 */ 188 xpc_received(partid, channel, (void *) msg); 189 190 priv->stats.rx_errors++; 191 192 return; 193 } 194 dev_dbg(xpnet, "received 0x%lx, %d, %d, %d\n", msg->buf_pa, msg->size, 195 msg->leadin_ignore, msg->tailout_ignore); 196 197 198 /* reserve an extra cache line */ 199 skb = dev_alloc_skb(msg->size + L1_CACHE_BYTES); 200 if (!skb) { 201 dev_err(xpnet, "failed on dev_alloc_skb(%d)\n", 202 msg->size + L1_CACHE_BYTES); 203 204 xpc_received(partid, channel, (void *) msg); 205 206 priv->stats.rx_errors++; 207 208 return; 209 } 210 211 /* 212 * The allocated skb has some reserved space. 213 * In order to use bte_copy, we need to get the 214 * skb->data pointer moved forward. 215 */ 216 skb_reserve(skb, (L1_CACHE_BYTES - ((u64)skb->data & 217 (L1_CACHE_BYTES - 1)) + 218 msg->leadin_ignore)); 219 220 /* 221 * Update the tail pointer to indicate data actually 222 * transferred. 223 */ 224 skb_put(skb, (msg->size - msg->leadin_ignore - msg->tailout_ignore)); 225 226 /* 227 * Move the data over from the other side. 228 */ 229 if ((XPNET_VERSION_MINOR(msg->version) == 1) && 230 (msg->embedded_bytes != 0)) { 231 dev_dbg(xpnet, "copying embedded message. memcpy(0x%p, 0x%p, " 232 "%lu)\n", skb->data, &msg->data, 233 (size_t) msg->embedded_bytes); 234 235 skb_copy_to_linear_data(skb, &msg->data, (size_t)msg->embedded_bytes); 236 } else { 237 dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" 238 "bte_copy(0x%p, 0x%p, %hu)\n", (void *)msg->buf_pa, 239 (void *)__pa((u64)skb->data & ~(L1_CACHE_BYTES - 1)), 240 msg->size); 241 242 bret = bte_copy(msg->buf_pa, 243 __pa((u64)skb->data & ~(L1_CACHE_BYTES - 1)), 244 msg->size, (BTE_NOTIFY | BTE_WACQUIRE), NULL); 245 246 if (bret != BTE_SUCCESS) { 247 // >>> Need better way of cleaning skb. Currently skb 248 // >>> appears in_use and we can't just call 249 // >>> dev_kfree_skb. 250 dev_err(xpnet, "bte_copy(0x%p, 0x%p, 0x%hx) returned " 251 "error=0x%x\n", (void *)msg->buf_pa, 252 (void *)__pa((u64)skb->data & 253 ~(L1_CACHE_BYTES - 1)), 254 msg->size, bret); 255 256 xpc_received(partid, channel, (void *) msg); 257 258 priv->stats.rx_errors++; 259 260 return; 261 } 262 } 263 264 dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p " 265 "skb->end=0x%p skb->len=%d\n", (void *) skb->head, 266 (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), 267 skb->len); 268 269 skb->protocol = eth_type_trans(skb, xpnet_device); 270 skb->ip_summed = CHECKSUM_UNNECESSARY; 271 272 dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p " 273 "skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n", 274 (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), 275 skb_end_pointer(skb), skb->len); 276 277 278 xpnet_device->last_rx = jiffies; 279 priv->stats.rx_packets++; 280 priv->stats.rx_bytes += skb->len + ETH_HLEN; 281 282 netif_rx_ni(skb); 283 xpc_received(partid, channel, (void *) msg); 284} 285 286 287/* 288 * This is the handler which XPC calls during any sort of change in 289 * state or message reception on a connection. 290 */ 291static void 292xpnet_connection_activity(enum xpc_retval reason, partid_t partid, int channel, 293 void *data, void *key) 294{ 295 long bp; 296 297 298 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS); 299 DBUG_ON(channel != XPC_NET_CHANNEL); 300 301 switch(reason) { 302 case xpcMsgReceived: /* message received */ 303 DBUG_ON(data == NULL); 304 305 xpnet_receive(partid, channel, (struct xpnet_message *) data); 306 break; 307 308 case xpcConnected: /* connection completed to a partition */ 309 spin_lock_bh(&xpnet_broadcast_lock); 310 xpnet_broadcast_partitions |= 1UL << (partid -1 ); 311 bp = xpnet_broadcast_partitions; 312 spin_unlock_bh(&xpnet_broadcast_lock); 313 314 netif_carrier_on(xpnet_device); 315 316 dev_dbg(xpnet, "%s connection created to partition %d; " 317 "xpnet_broadcast_partitions=0x%lx\n", 318 xpnet_device->name, partid, bp); 319 break; 320 321 default: 322 spin_lock_bh(&xpnet_broadcast_lock); 323 xpnet_broadcast_partitions &= ~(1UL << (partid -1 )); 324 bp = xpnet_broadcast_partitions; 325 spin_unlock_bh(&xpnet_broadcast_lock); 326 327 if (bp == 0) { 328 netif_carrier_off(xpnet_device); 329 } 330 331 dev_dbg(xpnet, "%s disconnected from partition %d; " 332 "xpnet_broadcast_partitions=0x%lx\n", 333 xpnet_device->name, partid, bp); 334 break; 335 336 } 337} 338 339 340static int 341xpnet_dev_open(struct net_device *dev) 342{ 343 enum xpc_retval ret; 344 345 346 dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, " 347 "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity, 348 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES, XPNET_MAX_KTHREADS, 349 XPNET_MAX_IDLE_KTHREADS); 350 351 ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL, 352 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES, 353 XPNET_MAX_KTHREADS, XPNET_MAX_IDLE_KTHREADS); 354 if (ret != xpcSuccess) { 355 dev_err(xpnet, "ifconfig up of %s failed on XPC connect, " 356 "ret=%d\n", dev->name, ret); 357 358 return -ENOMEM; 359 } 360 361 dev_dbg(xpnet, "ifconfig up of %s; XPC connected\n", dev->name); 362 363 return 0; 364} 365 366 367static int 368xpnet_dev_stop(struct net_device *dev) 369{ 370 xpc_disconnect(XPC_NET_CHANNEL); 371 372 dev_dbg(xpnet, "ifconfig down of %s; XPC disconnected\n", dev->name); 373 374 return 0; 375} 376 377 378static int 379xpnet_dev_change_mtu(struct net_device *dev, int new_mtu) 380{ 381 /* 68 comes from min TCP+IP+MAC header */ 382 if ((new_mtu < 68) || (new_mtu > XPNET_MAX_MTU)) { 383 dev_err(xpnet, "ifconfig %s mtu %d failed; value must be " 384 "between 68 and %ld\n", dev->name, new_mtu, 385 XPNET_MAX_MTU); 386 return -EINVAL; 387 } 388 389 dev->mtu = new_mtu; 390 dev_dbg(xpnet, "ifconfig %s mtu set to %d\n", dev->name, new_mtu); 391 return 0; 392} 393 394 395/* 396 * Required for the net_device structure. 397 */ 398static int 399xpnet_dev_set_config(struct net_device *dev, struct ifmap *new_map) 400{ 401 return 0; 402} 403 404 405/* 406 * Return statistics to the caller. 407 */ 408static struct net_device_stats * 409xpnet_dev_get_stats(struct net_device *dev) 410{ 411 struct xpnet_dev_private *priv; 412 413 414 priv = (struct xpnet_dev_private *) dev->priv; 415 416 return &priv->stats; 417} 418 419 420/* 421 * Notification that the other end has received the message and 422 * DMA'd the skb information. At this point, they are done with 423 * our side. When all recipients are done processing, we 424 * release the skb and then release our pending message structure. 425 */ 426static void 427xpnet_send_completed(enum xpc_retval reason, partid_t partid, int channel, 428 void *__qm) 429{ 430 struct xpnet_pending_msg *queued_msg = 431 (struct xpnet_pending_msg *) __qm; 432 433 434 DBUG_ON(queued_msg == NULL); 435 436 dev_dbg(xpnet, "message to %d notified with reason %d\n", 437 partid, reason); 438 439 if (atomic_dec_return(&queued_msg->use_count) == 0) { 440 dev_dbg(xpnet, "all acks for skb->head=-x%p\n", 441 (void *) queued_msg->skb->head); 442 443 dev_kfree_skb_any(queued_msg->skb); 444 kfree(queued_msg); 445 } 446} 447 448 449/* 450 * Network layer has formatted a packet (skb) and is ready to place it 451 * "on the wire". Prepare and send an xpnet_message to all partitions 452 * which have connected with us and are targets of this packet. 453 * 454 * MAC-NOTE: For the XPNET driver, the MAC address contains the 455 * destination partition_id. If the destination partition id word 456 * is 0xff, this packet is to broadcast to all partitions. 457 */ 458static int 459xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 460{ 461 struct xpnet_pending_msg *queued_msg; 462 enum xpc_retval ret; 463 struct xpnet_message *msg; 464 u64 start_addr, end_addr; 465 long dp; 466 u8 second_mac_octet; 467 partid_t dest_partid; 468 struct xpnet_dev_private *priv; 469 u16 embedded_bytes; 470 471 472 priv = (struct xpnet_dev_private *) dev->priv; 473 474 475 dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " 476 "skb->end=0x%p skb->len=%d\n", (void *) skb->head, 477 (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), 478 skb->len); 479 480 481 /* 482 * The xpnet_pending_msg tracks how many outstanding 483 * xpc_send_notifies are relying on this skb. When none 484 * remain, release the skb. 485 */ 486 queued_msg = kmalloc(sizeof(struct xpnet_pending_msg), GFP_ATOMIC); 487 if (queued_msg == NULL) { 488 dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping " 489 "packet\n", sizeof(struct xpnet_pending_msg)); 490 491 priv->stats.tx_errors++; 492 493 return -ENOMEM; 494 } 495 496 497 /* get the beginning of the first cacheline and end of last */ 498 start_addr = ((u64) skb->data & ~(L1_CACHE_BYTES - 1)); 499 end_addr = L1_CACHE_ALIGN((u64)skb_tail_pointer(skb)); 500 501 /* calculate how many bytes to embed in the XPC message */ 502 embedded_bytes = 0; 503 if (unlikely(skb->len <= XPNET_MSG_DATA_MAX)) { 504 /* skb->data does fit so embed */ 505 embedded_bytes = skb->len; 506 } 507 508 509 /* 510 * Since the send occurs asynchronously, we set the count to one 511 * and begin sending. Any sends that happen to complete before 512 * we are done sending will not free the skb. We will be left 513 * with that task during exit. This also handles the case of 514 * a packet destined for a partition which is no longer up. 515 */ 516 atomic_set(&queued_msg->use_count, 1); 517 queued_msg->skb = skb; 518 519 520 second_mac_octet = skb->data[XPNET_PARTID_OCTET]; 521 if (second_mac_octet == 0xff) { 522 /* we are being asked to broadcast to all partitions */ 523 dp = xpnet_broadcast_partitions; 524 } else if (second_mac_octet != 0) { 525 dp = xpnet_broadcast_partitions & 526 (1UL << (second_mac_octet - 1)); 527 } else { 528 /* 0 is an invalid partid. Ignore */ 529 dp = 0; 530 } 531 dev_dbg(xpnet, "destination Partitions mask (dp) = 0x%lx\n", dp); 532 533 /* 534 * If we wanted to allow promiscuous mode to work like an 535 * unswitched network, this would be a good point to OR in a 536 * mask of partitions which should be receiving all packets. 537 */ 538 539 /* 540 * Main send loop. 541 */ 542 for (dest_partid = 1; dp && dest_partid < XP_MAX_PARTITIONS; 543 dest_partid++) { 544 545 546 if (!(dp & (1UL << (dest_partid - 1)))) { 547 /* not destined for this partition */ 548 continue; 549 } 550 551 /* remove this partition from the destinations mask */ 552 dp &= ~(1UL << (dest_partid - 1)); 553 554 555 /* found a partition to send to */ 556 557 ret = xpc_allocate(dest_partid, XPC_NET_CHANNEL, 558 XPC_NOWAIT, (void **)&msg); 559 if (unlikely(ret != xpcSuccess)) { 560 continue; 561 } 562 563 msg->embedded_bytes = embedded_bytes; 564 if (unlikely(embedded_bytes != 0)) { 565 msg->version = XPNET_VERSION_EMBED; 566 dev_dbg(xpnet, "calling memcpy(0x%p, 0x%p, 0x%lx)\n", 567 &msg->data, skb->data, (size_t) embedded_bytes); 568 skb_copy_from_linear_data(skb, &msg->data, 569 (size_t)embedded_bytes); 570 } else { 571 msg->version = XPNET_VERSION; 572 } 573 msg->magic = XPNET_MAGIC; 574 msg->size = end_addr - start_addr; 575 msg->leadin_ignore = (u64) skb->data - start_addr; 576 msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb); 577 msg->buf_pa = __pa(start_addr); 578 579 dev_dbg(xpnet, "sending XPC message to %d:%d\nmsg->buf_pa=" 580 "0x%lx, msg->size=%u, msg->leadin_ignore=%u, " 581 "msg->tailout_ignore=%u\n", dest_partid, 582 XPC_NET_CHANNEL, msg->buf_pa, msg->size, 583 msg->leadin_ignore, msg->tailout_ignore); 584 585 586 atomic_inc(&queued_msg->use_count); 587 588 ret = xpc_send_notify(dest_partid, XPC_NET_CHANNEL, msg, 589 xpnet_send_completed, queued_msg); 590 if (unlikely(ret != xpcSuccess)) { 591 atomic_dec(&queued_msg->use_count); 592 continue; 593 } 594 595 } 596 597 if (atomic_dec_return(&queued_msg->use_count) == 0) { 598 dev_dbg(xpnet, "no partitions to receive packet destined for " 599 "%d\n", dest_partid); 600 601 602 dev_kfree_skb(skb); 603 kfree(queued_msg); 604 } 605 606 priv->stats.tx_packets++; 607 priv->stats.tx_bytes += skb->len; 608 609 return 0; 610} 611 612 613/* 614 * Deal with transmit timeouts coming from the network layer. 615 */ 616static void 617xpnet_dev_tx_timeout (struct net_device *dev) 618{ 619 struct xpnet_dev_private *priv; 620 621 622 priv = (struct xpnet_dev_private *) dev->priv; 623 624 priv->stats.tx_errors++; 625 return; 626} 627 628 629static int __init 630xpnet_init(void) 631{ 632 int i; 633 u32 license_num; 634 int result = -ENOMEM; 635 636 637 if (!ia64_platform_is("sn2")) { 638 return -ENODEV; 639 } 640 641 dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME); 642 643 /* 644 * use ether_setup() to init the majority of our device 645 * structure and then override the necessary pieces. 646 */ 647 xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private), 648 XPNET_DEVICE_NAME, ether_setup); 649 if (xpnet_device == NULL) { 650 return -ENOMEM; 651 } 652 653 netif_carrier_off(xpnet_device); 654 655 xpnet_device->mtu = XPNET_DEF_MTU; 656 xpnet_device->change_mtu = xpnet_dev_change_mtu; 657 xpnet_device->open = xpnet_dev_open; 658 xpnet_device->get_stats = xpnet_dev_get_stats; 659 xpnet_device->stop = xpnet_dev_stop; 660 xpnet_device->hard_start_xmit = xpnet_dev_hard_start_xmit; 661 xpnet_device->tx_timeout = xpnet_dev_tx_timeout; 662 xpnet_device->set_config = xpnet_dev_set_config; 663 664 /* 665 * Multicast assumes the LSB of the first octet is set for multicast 666 * MAC addresses. We chose the first octet of the MAC to be unlikely 667 * to collide with any vendor's officially issued MAC. 668 */ 669 xpnet_device->dev_addr[0] = 0xfe; 670 xpnet_device->dev_addr[XPNET_PARTID_OCTET] = sn_partition_id; 671 license_num = sn_partition_serial_number_val(); 672 for (i = 3; i >= 0; i--) { 673 xpnet_device->dev_addr[XPNET_LICENSE_OCTET + i] = 674 license_num & 0xff; 675 license_num = license_num >> 8; 676 } 677 678 /* 679 * ether_setup() sets this to a multicast device. We are 680 * really not supporting multicast at this time. 681 */ 682 xpnet_device->flags &= ~IFF_MULTICAST; 683 684 /* 685 * No need to checksum as it is a DMA transfer. The BTE will 686 * report an error if the data is not retrievable and the 687 * packet will be dropped. 688 */ 689 xpnet_device->features = NETIF_F_NO_CSUM; 690 691 result = register_netdev(xpnet_device); 692 if (result != 0) { 693 free_netdev(xpnet_device); 694 } 695 696 return result; 697} 698module_init(xpnet_init); 699 700 701static void __exit 702xpnet_exit(void) 703{ 704 dev_info(xpnet, "unregistering network device %s\n", 705 xpnet_device[0].name); 706 707 unregister_netdev(xpnet_device); 708 709 free_netdev(xpnet_device); 710} 711module_exit(xpnet_exit); 712 713 714MODULE_AUTHOR("Silicon Graphics, Inc."); 715MODULE_DESCRIPTION("Cross Partition Network adapter (XPNET)"); 716MODULE_LICENSE("GPL"); 717