xpnet.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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-2009 Silicon Graphics, Inc. All rights reserved.
  7. */
  8. /*
  9. * Cross Partition Network Interface (XPNET) support
  10. *
  11. * XPNET provides a virtual network layered on top of the Cross
  12. * Partition communication layer.
  13. *
  14. * XPNET provides direct point-to-point and broadcast-like support
  15. * for an ethernet-like device. The ethernet broadcast medium is
  16. * replaced with a point-to-point message structure which passes
  17. * pointers to a DMA-capable block that a remote partition should
  18. * retrieve and pass to the upper level networking layer.
  19. *
  20. */
  21. #include <linux/module.h>
  22. #include <linux/netdevice.h>
  23. #include <linux/etherdevice.h>
  24. #include "xp.h"
  25. /*
  26. * The message payload transferred by XPC.
  27. *
  28. * buf_pa is the physical address where the DMA should pull from.
  29. *
  30. * NOTE: for performance reasons, buf_pa should _ALWAYS_ begin on a
  31. * cacheline boundary. To accomplish this, we record the number of
  32. * bytes from the beginning of the first cacheline to the first useful
  33. * byte of the skb (leadin_ignore) and the number of bytes from the
  34. * last useful byte of the skb to the end of the last cacheline
  35. * (tailout_ignore).
  36. *
  37. * size is the number of bytes to transfer which includes the skb->len
  38. * (useful bytes of the senders skb) plus the leadin and tailout
  39. */
  40. struct xpnet_message {
  41. u16 version; /* Version for this message */
  42. u16 embedded_bytes; /* #of bytes embedded in XPC message */
  43. u32 magic; /* Special number indicating this is xpnet */
  44. unsigned long buf_pa; /* phys address of buffer to retrieve */
  45. u32 size; /* #of bytes in buffer */
  46. u8 leadin_ignore; /* #of bytes to ignore at the beginning */
  47. u8 tailout_ignore; /* #of bytes to ignore at the end */
  48. unsigned char data; /* body of small packets */
  49. };
  50. /*
  51. * Determine the size of our message, the cacheline aligned size,
  52. * and then the number of message will request from XPC.
  53. *
  54. * XPC expects each message to exist in an individual cacheline.
  55. */
  56. #define XPNET_MSG_SIZE XPC_MSG_PAYLOAD_MAX_SIZE
  57. #define XPNET_MSG_DATA_MAX \
  58. (XPNET_MSG_SIZE - offsetof(struct xpnet_message, data))
  59. #define XPNET_MSG_NENTRIES (PAGE_SIZE / XPC_MSG_MAX_SIZE)
  60. #define XPNET_MAX_KTHREADS (XPNET_MSG_NENTRIES + 1)
  61. #define XPNET_MAX_IDLE_KTHREADS (XPNET_MSG_NENTRIES + 1)
  62. /*
  63. * Version number of XPNET implementation. XPNET can always talk to versions
  64. * with same major #, and never talk to versions with a different version.
  65. */
  66. #define _XPNET_VERSION(_major, _minor) (((_major) << 4) | (_minor))
  67. #define XPNET_VERSION_MAJOR(_v) ((_v) >> 4)
  68. #define XPNET_VERSION_MINOR(_v) ((_v) & 0xf)
  69. #define XPNET_VERSION _XPNET_VERSION(1, 0) /* version 1.0 */
  70. #define XPNET_VERSION_EMBED _XPNET_VERSION(1, 1) /* version 1.1 */
  71. #define XPNET_MAGIC 0x88786984 /* "XNET" */
  72. #define XPNET_VALID_MSG(_m) \
  73. ((XPNET_VERSION_MAJOR(_m->version) == XPNET_VERSION_MAJOR(XPNET_VERSION)) \
  74. && (msg->magic == XPNET_MAGIC))
  75. #define XPNET_DEVICE_NAME "xp0"
  76. /*
  77. * When messages are queued with xpc_send_notify, a kmalloc'd buffer
  78. * of the following type is passed as a notification cookie. When the
  79. * notification function is called, we use the cookie to decide
  80. * whether all outstanding message sends have completed. The skb can
  81. * then be released.
  82. */
  83. struct xpnet_pending_msg {
  84. struct sk_buff *skb;
  85. atomic_t use_count;
  86. };
  87. struct net_device *xpnet_device;
  88. /*
  89. * When we are notified of other partitions activating, we add them to
  90. * our bitmask of partitions to which we broadcast.
  91. */
  92. static unsigned long *xpnet_broadcast_partitions;
  93. /* protect above */
  94. static DEFINE_SPINLOCK(xpnet_broadcast_lock);
  95. /*
  96. * Since the Block Transfer Engine (BTE) is being used for the transfer
  97. * and it relies upon cache-line size transfers, we need to reserve at
  98. * least one cache-line for head and tail alignment. The BTE is
  99. * limited to 8MB transfers.
  100. *
  101. * Testing has shown that changing MTU to greater than 64KB has no effect
  102. * on TCP as the two sides negotiate a Max Segment Size that is limited
  103. * to 64K. Other protocols May use packets greater than this, but for
  104. * now, the default is 64KB.
  105. */
  106. #define XPNET_MAX_MTU (0x800000UL - L1_CACHE_BYTES)
  107. /* 32KB has been determined to be the ideal */
  108. #define XPNET_DEF_MTU (0x8000UL)
  109. /*
  110. * The partid is encapsulated in the MAC address beginning in the following
  111. * octet and it consists of two octets.
  112. */
  113. #define XPNET_PARTID_OCTET 2
  114. /* Define the XPNET debug device structures to be used with dev_dbg() et al */
  115. struct device_driver xpnet_dbg_name = {
  116. .name = "xpnet"
  117. };
  118. struct device xpnet_dbg_subname = {
  119. .init_name = "", /* set to "" */
  120. .driver = &xpnet_dbg_name
  121. };
  122. struct device *xpnet = &xpnet_dbg_subname;
  123. /*
  124. * Packet was recevied by XPC and forwarded to us.
  125. */
  126. static void
  127. xpnet_receive(short partid, int channel, struct xpnet_message *msg)
  128. {
  129. struct sk_buff *skb;
  130. void *dst;
  131. enum xp_retval ret;
  132. if (!XPNET_VALID_MSG(msg)) {
  133. /*
  134. * Packet with a different XPC version. Ignore.
  135. */
  136. xpc_received(partid, channel, (void *)msg);
  137. xpnet_device->stats.rx_errors++;
  138. return;
  139. }
  140. dev_dbg(xpnet, "received 0x%lx, %d, %d, %d\n", msg->buf_pa, msg->size,
  141. msg->leadin_ignore, msg->tailout_ignore);
  142. /* reserve an extra cache line */
  143. skb = dev_alloc_skb(msg->size + L1_CACHE_BYTES);
  144. if (!skb) {
  145. dev_err(xpnet, "failed on dev_alloc_skb(%d)\n",
  146. msg->size + L1_CACHE_BYTES);
  147. xpc_received(partid, channel, (void *)msg);
  148. xpnet_device->stats.rx_errors++;
  149. return;
  150. }
  151. /*
  152. * The allocated skb has some reserved space.
  153. * In order to use xp_remote_memcpy(), we need to get the
  154. * skb->data pointer moved forward.
  155. */
  156. skb_reserve(skb, (L1_CACHE_BYTES - ((u64)skb->data &
  157. (L1_CACHE_BYTES - 1)) +
  158. msg->leadin_ignore));
  159. /*
  160. * Update the tail pointer to indicate data actually
  161. * transferred.
  162. */
  163. skb_put(skb, (msg->size - msg->leadin_ignore - msg->tailout_ignore));
  164. /*
  165. * Move the data over from the other side.
  166. */
  167. if ((XPNET_VERSION_MINOR(msg->version) == 1) &&
  168. (msg->embedded_bytes != 0)) {
  169. dev_dbg(xpnet, "copying embedded message. memcpy(0x%p, 0x%p, "
  170. "%lu)\n", skb->data, &msg->data,
  171. (size_t)msg->embedded_bytes);
  172. skb_copy_to_linear_data(skb, &msg->data,
  173. (size_t)msg->embedded_bytes);
  174. } else {
  175. dst = (void *)((u64)skb->data & ~(L1_CACHE_BYTES - 1));
  176. dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t"
  177. "xp_remote_memcpy(0x%p, 0x%p, %hu)\n", dst,
  178. (void *)msg->buf_pa, msg->size);
  179. ret = xp_remote_memcpy(xp_pa(dst), msg->buf_pa, msg->size);
  180. if (ret != xpSuccess) {
  181. /*
  182. * !!! Need better way of cleaning skb. Currently skb
  183. * !!! appears in_use and we can't just call
  184. * !!! dev_kfree_skb.
  185. */
  186. dev_err(xpnet, "xp_remote_memcpy(0x%p, 0x%p, 0x%hx) "
  187. "returned error=0x%x\n", dst,
  188. (void *)msg->buf_pa, msg->size, ret);
  189. xpc_received(partid, channel, (void *)msg);
  190. xpnet_device->stats.rx_errors++;
  191. return;
  192. }
  193. }
  194. dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
  195. "skb->end=0x%p skb->len=%d\n", (void *)skb->head,
  196. (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb),
  197. skb->len);
  198. skb->protocol = eth_type_trans(skb, xpnet_device);
  199. skb->ip_summed = CHECKSUM_UNNECESSARY;
  200. dev_dbg(xpnet, "passing skb to network layer\n"
  201. "\tskb->head=0x%p skb->data=0x%p skb->tail=0x%p "
  202. "skb->end=0x%p skb->len=%d\n",
  203. (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb),
  204. skb_end_pointer(skb), skb->len);
  205. xpnet_device->stats.rx_packets++;
  206. xpnet_device->stats.rx_bytes += skb->len + ETH_HLEN;
  207. netif_rx_ni(skb);
  208. xpc_received(partid, channel, (void *)msg);
  209. }
  210. /*
  211. * This is the handler which XPC calls during any sort of change in
  212. * state or message reception on a connection.
  213. */
  214. static void
  215. xpnet_connection_activity(enum xp_retval reason, short partid, int channel,
  216. void *data, void *key)
  217. {
  218. DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
  219. DBUG_ON(channel != XPC_NET_CHANNEL);
  220. switch (reason) {
  221. case xpMsgReceived: /* message received */
  222. DBUG_ON(data == NULL);
  223. xpnet_receive(partid, channel, (struct xpnet_message *)data);
  224. break;
  225. case xpConnected: /* connection completed to a partition */
  226. spin_lock_bh(&xpnet_broadcast_lock);
  227. __set_bit(partid, xpnet_broadcast_partitions);
  228. spin_unlock_bh(&xpnet_broadcast_lock);
  229. netif_carrier_on(xpnet_device);
  230. dev_dbg(xpnet, "%s connected to partition %d\n",
  231. xpnet_device->name, partid);
  232. break;
  233. default:
  234. spin_lock_bh(&xpnet_broadcast_lock);
  235. __clear_bit(partid, xpnet_broadcast_partitions);
  236. spin_unlock_bh(&xpnet_broadcast_lock);
  237. if (bitmap_empty((unsigned long *)xpnet_broadcast_partitions,
  238. xp_max_npartitions)) {
  239. netif_carrier_off(xpnet_device);
  240. }
  241. dev_dbg(xpnet, "%s disconnected from partition %d\n",
  242. xpnet_device->name, partid);
  243. break;
  244. }
  245. }
  246. static int
  247. xpnet_dev_open(struct net_device *dev)
  248. {
  249. enum xp_retval ret;
  250. dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, "
  251. "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity,
  252. (unsigned long)XPNET_MSG_SIZE,
  253. (unsigned long)XPNET_MSG_NENTRIES,
  254. (unsigned long)XPNET_MAX_KTHREADS,
  255. (unsigned long)XPNET_MAX_IDLE_KTHREADS);
  256. ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL,
  257. XPNET_MSG_SIZE, XPNET_MSG_NENTRIES,
  258. XPNET_MAX_KTHREADS, XPNET_MAX_IDLE_KTHREADS);
  259. if (ret != xpSuccess) {
  260. dev_err(xpnet, "ifconfig up of %s failed on XPC connect, "
  261. "ret=%d\n", dev->name, ret);
  262. return -ENOMEM;
  263. }
  264. dev_dbg(xpnet, "ifconfig up of %s; XPC connected\n", dev->name);
  265. return 0;
  266. }
  267. static int
  268. xpnet_dev_stop(struct net_device *dev)
  269. {
  270. xpc_disconnect(XPC_NET_CHANNEL);
  271. dev_dbg(xpnet, "ifconfig down of %s; XPC disconnected\n", dev->name);
  272. return 0;
  273. }
  274. static int
  275. xpnet_dev_change_mtu(struct net_device *dev, int new_mtu)
  276. {
  277. /* 68 comes from min TCP+IP+MAC header */
  278. if ((new_mtu < 68) || (new_mtu > XPNET_MAX_MTU)) {
  279. dev_err(xpnet, "ifconfig %s mtu %d failed; value must be "
  280. "between 68 and %ld\n", dev->name, new_mtu,
  281. XPNET_MAX_MTU);
  282. return -EINVAL;
  283. }
  284. dev->mtu = new_mtu;
  285. dev_dbg(xpnet, "ifconfig %s mtu set to %d\n", dev->name, new_mtu);
  286. return 0;
  287. }
  288. /*
  289. * Notification that the other end has received the message and
  290. * DMA'd the skb information. At this point, they are done with
  291. * our side. When all recipients are done processing, we
  292. * release the skb and then release our pending message structure.
  293. */
  294. static void
  295. xpnet_send_completed(enum xp_retval reason, short partid, int channel,
  296. void *__qm)
  297. {
  298. struct xpnet_pending_msg *queued_msg = (struct xpnet_pending_msg *)__qm;
  299. DBUG_ON(queued_msg == NULL);
  300. dev_dbg(xpnet, "message to %d notified with reason %d\n",
  301. partid, reason);
  302. if (atomic_dec_return(&queued_msg->use_count) == 0) {
  303. dev_dbg(xpnet, "all acks for skb->head=-x%p\n",
  304. (void *)queued_msg->skb->head);
  305. dev_kfree_skb_any(queued_msg->skb);
  306. kfree(queued_msg);
  307. }
  308. }
  309. static void
  310. xpnet_send(struct sk_buff *skb, struct xpnet_pending_msg *queued_msg,
  311. u64 start_addr, u64 end_addr, u16 embedded_bytes, int dest_partid)
  312. {
  313. u8 msg_buffer[XPNET_MSG_SIZE];
  314. struct xpnet_message *msg = (struct xpnet_message *)&msg_buffer;
  315. u16 msg_size = sizeof(struct xpnet_message);
  316. enum xp_retval ret;
  317. msg->embedded_bytes = embedded_bytes;
  318. if (unlikely(embedded_bytes != 0)) {
  319. msg->version = XPNET_VERSION_EMBED;
  320. dev_dbg(xpnet, "calling memcpy(0x%p, 0x%p, 0x%lx)\n",
  321. &msg->data, skb->data, (size_t)embedded_bytes);
  322. skb_copy_from_linear_data(skb, &msg->data,
  323. (size_t)embedded_bytes);
  324. msg_size += embedded_bytes - 1;
  325. } else {
  326. msg->version = XPNET_VERSION;
  327. }
  328. msg->magic = XPNET_MAGIC;
  329. msg->size = end_addr - start_addr;
  330. msg->leadin_ignore = (u64)skb->data - start_addr;
  331. msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb);
  332. msg->buf_pa = xp_pa((void *)start_addr);
  333. dev_dbg(xpnet, "sending XPC message to %d:%d\n"
  334. "msg->buf_pa=0x%lx, msg->size=%u, "
  335. "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n",
  336. dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size,
  337. msg->leadin_ignore, msg->tailout_ignore);
  338. atomic_inc(&queued_msg->use_count);
  339. ret = xpc_send_notify(dest_partid, XPC_NET_CHANNEL, XPC_NOWAIT, msg,
  340. msg_size, xpnet_send_completed, queued_msg);
  341. if (unlikely(ret != xpSuccess))
  342. atomic_dec(&queued_msg->use_count);
  343. }
  344. /*
  345. * Network layer has formatted a packet (skb) and is ready to place it
  346. * "on the wire". Prepare and send an xpnet_message to all partitions
  347. * which have connected with us and are targets of this packet.
  348. *
  349. * MAC-NOTE: For the XPNET driver, the MAC address contains the
  350. * destination partid. If the destination partid octets are 0xffff,
  351. * this packet is to be broadcast to all connected partitions.
  352. */
  353. static int
  354. xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
  355. {
  356. struct xpnet_pending_msg *queued_msg;
  357. u64 start_addr, end_addr;
  358. short dest_partid;
  359. u16 embedded_bytes = 0;
  360. dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
  361. "skb->end=0x%p skb->len=%d\n", (void *)skb->head,
  362. (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb),
  363. skb->len);
  364. if (skb->data[0] == 0x33) {
  365. dev_kfree_skb(skb);
  366. return NETDEV_TX_OK; /* nothing needed to be done */
  367. }
  368. /*
  369. * The xpnet_pending_msg tracks how many outstanding
  370. * xpc_send_notifies are relying on this skb. When none
  371. * remain, release the skb.
  372. */
  373. queued_msg = kmalloc(sizeof(struct xpnet_pending_msg), GFP_ATOMIC);
  374. if (queued_msg == NULL) {
  375. dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping "
  376. "packet\n", sizeof(struct xpnet_pending_msg));
  377. dev->stats.tx_errors++;
  378. dev_kfree_skb(skb);
  379. return NETDEV_TX_OK;
  380. }
  381. /* get the beginning of the first cacheline and end of last */
  382. start_addr = ((u64)skb->data & ~(L1_CACHE_BYTES - 1));
  383. end_addr = L1_CACHE_ALIGN((u64)skb_tail_pointer(skb));
  384. /* calculate how many bytes to embed in the XPC message */
  385. if (unlikely(skb->len <= XPNET_MSG_DATA_MAX)) {
  386. /* skb->data does fit so embed */
  387. embedded_bytes = skb->len;
  388. }
  389. /*
  390. * Since the send occurs asynchronously, we set the count to one
  391. * and begin sending. Any sends that happen to complete before
  392. * we are done sending will not free the skb. We will be left
  393. * with that task during exit. This also handles the case of
  394. * a packet destined for a partition which is no longer up.
  395. */
  396. atomic_set(&queued_msg->use_count, 1);
  397. queued_msg->skb = skb;
  398. if (skb->data[0] == 0xff) {
  399. /* we are being asked to broadcast to all partitions */
  400. for_each_bit(dest_partid, xpnet_broadcast_partitions,
  401. xp_max_npartitions) {
  402. xpnet_send(skb, queued_msg, start_addr, end_addr,
  403. embedded_bytes, dest_partid);
  404. }
  405. } else {
  406. dest_partid = (short)skb->data[XPNET_PARTID_OCTET + 1];
  407. dest_partid |= (short)skb->data[XPNET_PARTID_OCTET + 0] << 8;
  408. if (dest_partid >= 0 &&
  409. dest_partid < xp_max_npartitions &&
  410. test_bit(dest_partid, xpnet_broadcast_partitions) != 0) {
  411. xpnet_send(skb, queued_msg, start_addr, end_addr,
  412. embedded_bytes, dest_partid);
  413. }
  414. }
  415. if (atomic_dec_return(&queued_msg->use_count) == 0) {
  416. dev_kfree_skb(skb);
  417. kfree(queued_msg);
  418. }
  419. dev->stats.tx_packets++;
  420. dev->stats.tx_bytes += skb->len;
  421. return NETDEV_TX_OK;
  422. }
  423. /*
  424. * Deal with transmit timeouts coming from the network layer.
  425. */
  426. static void
  427. xpnet_dev_tx_timeout(struct net_device *dev)
  428. {
  429. dev->stats.tx_errors++;
  430. }
  431. static const struct net_device_ops xpnet_netdev_ops = {
  432. .ndo_open = xpnet_dev_open,
  433. .ndo_stop = xpnet_dev_stop,
  434. .ndo_start_xmit = xpnet_dev_hard_start_xmit,
  435. .ndo_change_mtu = xpnet_dev_change_mtu,
  436. .ndo_tx_timeout = xpnet_dev_tx_timeout,
  437. .ndo_set_mac_address = eth_mac_addr,
  438. .ndo_validate_addr = eth_validate_addr,
  439. };
  440. static int __init
  441. xpnet_init(void)
  442. {
  443. int result;
  444. if (!is_shub() && !is_uv())
  445. return -ENODEV;
  446. dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME);
  447. xpnet_broadcast_partitions = kzalloc(BITS_TO_LONGS(xp_max_npartitions) *
  448. sizeof(long), GFP_KERNEL);
  449. if (xpnet_broadcast_partitions == NULL)
  450. return -ENOMEM;
  451. /*
  452. * use ether_setup() to init the majority of our device
  453. * structure and then override the necessary pieces.
  454. */
  455. xpnet_device = alloc_netdev(0, XPNET_DEVICE_NAME, ether_setup);
  456. if (xpnet_device == NULL) {
  457. kfree(xpnet_broadcast_partitions);
  458. return -ENOMEM;
  459. }
  460. netif_carrier_off(xpnet_device);
  461. xpnet_device->netdev_ops = &xpnet_netdev_ops;
  462. xpnet_device->mtu = XPNET_DEF_MTU;
  463. /*
  464. * Multicast assumes the LSB of the first octet is set for multicast
  465. * MAC addresses. We chose the first octet of the MAC to be unlikely
  466. * to collide with any vendor's officially issued MAC.
  467. */
  468. xpnet_device->dev_addr[0] = 0x02; /* locally administered, no OUI */
  469. xpnet_device->dev_addr[XPNET_PARTID_OCTET + 1] = xp_partition_id;
  470. xpnet_device->dev_addr[XPNET_PARTID_OCTET + 0] = (xp_partition_id >> 8);
  471. /*
  472. * ether_setup() sets this to a multicast device. We are
  473. * really not supporting multicast at this time.
  474. */
  475. xpnet_device->flags &= ~IFF_MULTICAST;
  476. /*
  477. * No need to checksum as it is a DMA transfer. The BTE will
  478. * report an error if the data is not retrievable and the
  479. * packet will be dropped.
  480. */
  481. xpnet_device->features = NETIF_F_NO_CSUM;
  482. result = register_netdev(xpnet_device);
  483. if (result != 0) {
  484. free_netdev(xpnet_device);
  485. kfree(xpnet_broadcast_partitions);
  486. }
  487. return result;
  488. }
  489. module_init(xpnet_init);
  490. static void __exit
  491. xpnet_exit(void)
  492. {
  493. dev_info(xpnet, "unregistering network device %s\n",
  494. xpnet_device[0].name);
  495. unregister_netdev(xpnet_device);
  496. free_netdev(xpnet_device);
  497. kfree(xpnet_broadcast_partitions);
  498. }
  499. module_exit(xpnet_exit);
  500. MODULE_AUTHOR("Silicon Graphics, Inc.");
  501. MODULE_DESCRIPTION("Cross Partition Network adapter (XPNET)");
  502. MODULE_LICENSE("GPL");