xpnet.c 18 KB

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