Lines Matching +full:magic +full:- +full:packet

7  * Copyright (C) 1999-2009 Silicon Graphics, Inc. All rights reserved.
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
42 * size is the number of bytes to transfer which includes the skb->len
48 u32 magic; /* Special number indicating this is xpnet */ member
64 (XPNET_MSG_SIZE - offsetof(struct xpnet_message, data))
83 ((XPNET_VERSION_MAJOR(_m->version) == XPNET_VERSION_MAJOR(XPNET_VERSION)) \
84 && (msg->magic == XPNET_MAGIC))
112 * and it relies upon cache-line size transfers, we need to reserve at
113 * least one cache-line for head and tail alignment. The BTE is
121 #define XPNET_MAX_MTU (0x800000UL - L1_CACHE_BYTES)
147 * Packet was recevied by XPC and forwarded to us.
158 * Packet with a different XPC version. Ignore. in xpnet_receive()
162 xpnet_device->stats.rx_errors++; in xpnet_receive()
166 dev_dbg(xpnet, "received 0x%lx, %d, %d, %d\n", msg->buf_pa, msg->size, in xpnet_receive()
167 msg->leadin_ignore, msg->tailout_ignore); in xpnet_receive()
170 skb = dev_alloc_skb(msg->size + L1_CACHE_BYTES); in xpnet_receive()
173 msg->size + L1_CACHE_BYTES); in xpnet_receive()
177 xpnet_device->stats.rx_errors++; in xpnet_receive()
185 * skb->data pointer moved forward. in xpnet_receive()
187 skb_reserve(skb, (L1_CACHE_BYTES - ((u64)skb->data & in xpnet_receive()
188 (L1_CACHE_BYTES - 1)) + in xpnet_receive()
189 msg->leadin_ignore)); in xpnet_receive()
195 skb_put(skb, (msg->size - msg->leadin_ignore - msg->tailout_ignore)); in xpnet_receive()
200 if ((XPNET_VERSION_MINOR(msg->version) == 1) && in xpnet_receive()
201 (msg->embedded_bytes != 0)) { in xpnet_receive()
203 "%lu)\n", skb->data, &msg->data, in xpnet_receive()
204 (size_t)msg->embedded_bytes); in xpnet_receive()
206 skb_copy_to_linear_data(skb, &msg->data, in xpnet_receive()
207 (size_t)msg->embedded_bytes); in xpnet_receive()
209 dst = (void *)((u64)skb->data & ~(L1_CACHE_BYTES - 1)); in xpnet_receive()
210 dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" in xpnet_receive()
212 (void *)msg->buf_pa, msg->size); in xpnet_receive()
214 ret = xp_remote_memcpy(xp_pa(dst), msg->buf_pa, msg->size); in xpnet_receive()
223 (void *)msg->buf_pa, msg->size, ret); in xpnet_receive()
227 xpnet_device->stats.rx_errors++; in xpnet_receive()
233 dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p " in xpnet_receive()
234 "skb->end=0x%p skb->len=%d\n", (void *)skb->head, in xpnet_receive()
235 (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), in xpnet_receive()
236 skb->len); in xpnet_receive()
238 skb->protocol = eth_type_trans(skb, xpnet_device); in xpnet_receive()
239 skb->ip_summed = CHECKSUM_UNNECESSARY; in xpnet_receive()
242 "\tskb->head=0x%p skb->data=0x%p skb->tail=0x%p " in xpnet_receive()
243 "skb->end=0x%p skb->len=%d\n", in xpnet_receive()
244 (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), in xpnet_receive()
245 skb_end_pointer(skb), skb->len); in xpnet_receive()
247 xpnet_device->stats.rx_packets++; in xpnet_receive()
248 xpnet_device->stats.rx_bytes += skb->len + ETH_HLEN; in xpnet_receive()
280 xpnet_device->name, partid); in xpnet_connection_activity()
294 xpnet_device->name, partid); in xpnet_connection_activity()
316 "ret=%d\n", dev->name, ret); in xpnet_dev_open()
318 return -ENOMEM; in xpnet_dev_open()
321 dev_dbg(xpnet, "ifconfig up of %s; XPC connected\n", dev->name); in xpnet_dev_open()
331 dev_dbg(xpnet, "ifconfig down of %s; XPC disconnected\n", dev->name); in xpnet_dev_stop()
353 if (atomic_dec_return(&queued_msg->use_count) == 0) { in xpnet_send_completed()
354 dev_dbg(xpnet, "all acks for skb->head=-x%p\n", in xpnet_send_completed()
355 (void *)queued_msg->skb->head); in xpnet_send_completed()
357 dev_kfree_skb_any(queued_msg->skb); in xpnet_send_completed()
371 msg->embedded_bytes = embedded_bytes; in xpnet_send()
373 msg->version = XPNET_VERSION_EMBED; in xpnet_send()
375 &msg->data, skb->data, (size_t)embedded_bytes); in xpnet_send()
376 skb_copy_from_linear_data(skb, &msg->data, in xpnet_send()
378 msg_size += embedded_bytes - 1; in xpnet_send()
380 msg->version = XPNET_VERSION; in xpnet_send()
382 msg->magic = XPNET_MAGIC; in xpnet_send()
383 msg->size = end_addr - start_addr; in xpnet_send()
384 msg->leadin_ignore = (u64)skb->data - start_addr; in xpnet_send()
385 msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb); in xpnet_send()
386 msg->buf_pa = xp_pa((void *)start_addr); in xpnet_send()
389 "msg->buf_pa=0x%lx, msg->size=%u, " in xpnet_send()
390 "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n", in xpnet_send()
391 dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size, in xpnet_send()
392 msg->leadin_ignore, msg->tailout_ignore); in xpnet_send()
394 atomic_inc(&queued_msg->use_count); in xpnet_send()
399 atomic_dec(&queued_msg->use_count); in xpnet_send()
403 * Network layer has formatted a packet (skb) and is ready to place it
405 * which have connected with us and are targets of this packet.
407 * MAC-NOTE: For the XPNET driver, the MAC address contains the
409 * this packet is to be broadcast to all connected partitions.
419 dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " in xpnet_dev_hard_start_xmit()
420 "skb->end=0x%p skb->len=%d\n", (void *)skb->head, in xpnet_dev_hard_start_xmit()
421 (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), in xpnet_dev_hard_start_xmit()
422 skb->len); in xpnet_dev_hard_start_xmit()
424 if (skb->data[0] == 0x33) { in xpnet_dev_hard_start_xmit()
437 "packet\n", sizeof(struct xpnet_pending_msg)); in xpnet_dev_hard_start_xmit()
439 dev->stats.tx_errors++; in xpnet_dev_hard_start_xmit()
445 start_addr = ((u64)skb->data & ~(L1_CACHE_BYTES - 1)); in xpnet_dev_hard_start_xmit()
449 if (unlikely(skb->len <= XPNET_MSG_DATA_MAX)) { in xpnet_dev_hard_start_xmit()
450 /* skb->data does fit so embed */ in xpnet_dev_hard_start_xmit()
451 embedded_bytes = skb->len; in xpnet_dev_hard_start_xmit()
459 * a packet destined for a partition which is no longer up. in xpnet_dev_hard_start_xmit()
461 atomic_set(&queued_msg->use_count, 1); in xpnet_dev_hard_start_xmit()
462 queued_msg->skb = skb; in xpnet_dev_hard_start_xmit()
464 if (skb->data[0] == 0xff) { in xpnet_dev_hard_start_xmit()
473 dest_partid = (short)skb->data[XPNET_PARTID_OCTET + 1]; in xpnet_dev_hard_start_xmit()
474 dest_partid |= (short)skb->data[XPNET_PARTID_OCTET + 0] << 8; in xpnet_dev_hard_start_xmit()
485 dev->stats.tx_packets++; in xpnet_dev_hard_start_xmit()
486 dev->stats.tx_bytes += skb->len; in xpnet_dev_hard_start_xmit()
488 if (atomic_dec_return(&queued_msg->use_count) == 0) { in xpnet_dev_hard_start_xmit()
502 dev->stats.tx_errors++; in xpnet_dev_tx_timeout()
521 return -ENODEV; in xpnet_init()
528 return -ENOMEM; in xpnet_init()
538 return -ENOMEM; in xpnet_init()
543 xpnet_device->netdev_ops = &xpnet_netdev_ops; in xpnet_init()
544 xpnet_device->mtu = XPNET_DEF_MTU; in xpnet_init()
545 xpnet_device->min_mtu = XPNET_MIN_MTU; in xpnet_init()
546 xpnet_device->max_mtu = XPNET_MAX_MTU; in xpnet_init()
564 xpnet_device->flags &= ~IFF_MULTICAST; in xpnet_init()
569 * packet will be dropped. in xpnet_init()
571 xpnet_device->features = NETIF_F_HW_CSUM; in xpnet_init()