diff options
Diffstat (limited to 'drivers/firewire/net.c')
-rw-r--r-- | drivers/firewire/net.c | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index e7a711f53a6..03a7a85d042 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -256,8 +256,8 @@ static int fwnet_header_rebuild(struct sk_buff *skb) | |||
256 | if (get_unaligned_be16(&h->h_proto) == ETH_P_IP) | 256 | if (get_unaligned_be16(&h->h_proto) == ETH_P_IP) |
257 | return arp_find((unsigned char *)&h->h_dest, skb); | 257 | return arp_find((unsigned char *)&h->h_dest, skb); |
258 | 258 | ||
259 | dev_notice(&skb->dev->dev, "unable to resolve type %04x addresses\n", | 259 | fw_notify("%s: unable to resolve type %04x addresses\n", |
260 | be16_to_cpu(h->h_proto)); | 260 | skb->dev->name, be16_to_cpu(h->h_proto)); |
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
263 | 263 | ||
@@ -369,7 +369,7 @@ static struct fwnet_fragment_info *fwnet_frag_new( | |||
369 | 369 | ||
370 | new = kmalloc(sizeof(*new), GFP_ATOMIC); | 370 | new = kmalloc(sizeof(*new), GFP_ATOMIC); |
371 | if (!new) { | 371 | if (!new) { |
372 | dev_err(&pd->skb->dev->dev, "out of memory\n"); | 372 | fw_error("out of memory\n"); |
373 | return NULL; | 373 | return NULL; |
374 | } | 374 | } |
375 | 375 | ||
@@ -414,7 +414,7 @@ fail_w_fi: | |||
414 | fail_w_new: | 414 | fail_w_new: |
415 | kfree(new); | 415 | kfree(new); |
416 | fail: | 416 | fail: |
417 | dev_err(&net->dev, "out of memory\n"); | 417 | fw_error("out of memory\n"); |
418 | 418 | ||
419 | return NULL; | 419 | return NULL; |
420 | } | 420 | } |
@@ -502,7 +502,11 @@ static struct fwnet_peer *fwnet_peer_find_by_node_id(struct fwnet_device *dev, | |||
502 | static unsigned fwnet_max_payload(unsigned max_rec, unsigned speed) | 502 | static unsigned fwnet_max_payload(unsigned max_rec, unsigned speed) |
503 | { | 503 | { |
504 | max_rec = min(max_rec, speed + 8); | 504 | max_rec = min(max_rec, speed + 8); |
505 | max_rec = clamp(max_rec, 8U, 11U); /* 512...4096 */ | 505 | max_rec = min(max_rec, 0xbU); /* <= 4096 */ |
506 | if (max_rec < 8) { | ||
507 | fw_notify("max_rec %x out of range\n", max_rec); | ||
508 | max_rec = 8; | ||
509 | } | ||
506 | 510 | ||
507 | return (1 << (max_rec + 1)) - RFC2374_FRAG_HDR_SIZE; | 511 | return (1 << (max_rec + 1)) - RFC2374_FRAG_HDR_SIZE; |
508 | } | 512 | } |
@@ -554,7 +558,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net, | |||
554 | sspd = arp1394->sspd; | 558 | sspd = arp1394->sspd; |
555 | /* Sanity check. OS X 10.3 PPC reportedly sends 131. */ | 559 | /* Sanity check. OS X 10.3 PPC reportedly sends 131. */ |
556 | if (sspd > SCODE_3200) { | 560 | if (sspd > SCODE_3200) { |
557 | dev_notice(&net->dev, "sspd %x out of range\n", sspd); | 561 | fw_notify("sspd %x out of range\n", sspd); |
558 | sspd = SCODE_3200; | 562 | sspd = SCODE_3200; |
559 | } | 563 | } |
560 | max_payload = fwnet_max_payload(arp1394->max_rec, sspd); | 564 | max_payload = fwnet_max_payload(arp1394->max_rec, sspd); |
@@ -574,9 +578,8 @@ static int fwnet_finish_incoming_packet(struct net_device *net, | |||
574 | spin_unlock_irqrestore(&dev->lock, flags); | 578 | spin_unlock_irqrestore(&dev->lock, flags); |
575 | 579 | ||
576 | if (!peer) { | 580 | if (!peer) { |
577 | dev_notice(&net->dev, | 581 | fw_notify("No peer for ARP packet from %016llx\n", |
578 | "no peer for ARP packet from %016llx\n", | 582 | (unsigned long long)peer_guid); |
579 | (unsigned long long)peer_guid); | ||
580 | goto no_peer; | 583 | goto no_peer; |
581 | } | 584 | } |
582 | 585 | ||
@@ -692,7 +695,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, | |||
692 | 695 | ||
693 | skb = dev_alloc_skb(len + net->hard_header_len + 15); | 696 | skb = dev_alloc_skb(len + net->hard_header_len + 15); |
694 | if (unlikely(!skb)) { | 697 | if (unlikely(!skb)) { |
695 | dev_err(&net->dev, "out of memory\n"); | 698 | fw_error("out of memory\n"); |
696 | net->stats.rx_dropped++; | 699 | net->stats.rx_dropped++; |
697 | 700 | ||
698 | return -ENOMEM; | 701 | return -ENOMEM; |
@@ -815,7 +818,7 @@ static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r, | |||
815 | rcode = RCODE_TYPE_ERROR; | 818 | rcode = RCODE_TYPE_ERROR; |
816 | else if (fwnet_incoming_packet(dev, payload, length, | 819 | else if (fwnet_incoming_packet(dev, payload, length, |
817 | source, generation, false) != 0) { | 820 | source, generation, false) != 0) { |
818 | dev_err(&dev->netdev->dev, "incoming packet failure\n"); | 821 | fw_error("Incoming packet failure\n"); |
819 | rcode = RCODE_CONFLICT_ERROR; | 822 | rcode = RCODE_CONFLICT_ERROR; |
820 | } else | 823 | } else |
821 | rcode = RCODE_COMPLETE; | 824 | rcode = RCODE_COMPLETE; |
@@ -828,6 +831,7 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context, | |||
828 | { | 831 | { |
829 | struct fwnet_device *dev; | 832 | struct fwnet_device *dev; |
830 | struct fw_iso_packet packet; | 833 | struct fw_iso_packet packet; |
834 | struct fw_card *card; | ||
831 | __be16 *hdr_ptr; | 835 | __be16 *hdr_ptr; |
832 | __be32 *buf_ptr; | 836 | __be32 *buf_ptr; |
833 | int retval; | 837 | int retval; |
@@ -839,6 +843,7 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context, | |||
839 | unsigned long flags; | 843 | unsigned long flags; |
840 | 844 | ||
841 | dev = data; | 845 | dev = data; |
846 | card = dev->card; | ||
842 | hdr_ptr = header; | 847 | hdr_ptr = header; |
843 | length = be16_to_cpup(hdr_ptr); | 848 | length = be16_to_cpup(hdr_ptr); |
844 | 849 | ||
@@ -859,8 +864,8 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context, | |||
859 | if (specifier_id == IANA_SPECIFIER_ID && ver == RFC2734_SW_VERSION) { | 864 | if (specifier_id == IANA_SPECIFIER_ID && ver == RFC2734_SW_VERSION) { |
860 | buf_ptr += 2; | 865 | buf_ptr += 2; |
861 | length -= IEEE1394_GASP_HDR_SIZE; | 866 | length -= IEEE1394_GASP_HDR_SIZE; |
862 | fwnet_incoming_packet(dev, buf_ptr, length, source_node_id, | 867 | fwnet_incoming_packet(dev, buf_ptr, length, |
863 | context->card->generation, true); | 868 | source_node_id, -1, true); |
864 | } | 869 | } |
865 | 870 | ||
866 | packet.payload_length = dev->rcv_buffer_size; | 871 | packet.payload_length = dev->rcv_buffer_size; |
@@ -880,7 +885,7 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context, | |||
880 | if (retval >= 0) | 885 | if (retval >= 0) |
881 | fw_iso_context_queue_flush(dev->broadcast_rcv_context); | 886 | fw_iso_context_queue_flush(dev->broadcast_rcv_context); |
882 | else | 887 | else |
883 | dev_err(&dev->netdev->dev, "requeue failed\n"); | 888 | fw_error("requeue failed\n"); |
884 | } | 889 | } |
885 | 890 | ||
886 | static struct kmem_cache *fwnet_packet_task_cache; | 891 | static struct kmem_cache *fwnet_packet_task_cache; |
@@ -935,10 +940,9 @@ static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask) | |||
935 | case RFC2374_HDR_LASTFRAG: | 940 | case RFC2374_HDR_LASTFRAG: |
936 | case RFC2374_HDR_UNFRAG: | 941 | case RFC2374_HDR_UNFRAG: |
937 | default: | 942 | default: |
938 | dev_err(&dev->netdev->dev, | 943 | fw_error("Outstanding packet %x lf %x, header %x,%x\n", |
939 | "outstanding packet %x lf %x, header %x,%x\n", | 944 | ptask->outstanding_pkts, lf, ptask->hdr.w0, |
940 | ptask->outstanding_pkts, lf, ptask->hdr.w0, | 945 | ptask->hdr.w1); |
941 | ptask->hdr.w1); | ||
942 | BUG(); | 946 | BUG(); |
943 | 947 | ||
944 | case RFC2374_HDR_FIRSTFRAG: | 948 | case RFC2374_HDR_FIRSTFRAG: |
@@ -956,12 +960,7 @@ static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask) | |||
956 | break; | 960 | break; |
957 | } | 961 | } |
958 | 962 | ||
959 | if (ptask->dest_node == IEEE1394_ALL_NODES) { | 963 | skb_pull(skb, ptask->max_payload); |
960 | skb_pull(skb, | ||
961 | ptask->max_payload + IEEE1394_GASP_HDR_SIZE); | ||
962 | } else { | ||
963 | skb_pull(skb, ptask->max_payload); | ||
964 | } | ||
965 | if (ptask->outstanding_pkts > 1) { | 964 | if (ptask->outstanding_pkts > 1) { |
966 | fwnet_make_sf_hdr(&ptask->hdr, RFC2374_HDR_INTFRAG, | 965 | fwnet_make_sf_hdr(&ptask->hdr, RFC2374_HDR_INTFRAG, |
967 | dg_size, fg_off, datagram_label); | 966 | dg_size, fg_off, datagram_label); |
@@ -1015,9 +1014,8 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, | |||
1015 | fwnet_transmit_packet_failed(ptask); | 1014 | fwnet_transmit_packet_failed(ptask); |
1016 | 1015 | ||
1017 | if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { | 1016 | if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { |
1018 | dev_err(&ptask->dev->netdev->dev, | 1017 | fw_error("fwnet_write_complete: " |
1019 | "fwnet_write_complete failed: %x (skipped %d)\n", | 1018 | "failed: %x (skipped %d)\n", rcode, errors_skipped); |
1020 | rcode, errors_skipped); | ||
1021 | 1019 | ||
1022 | errors_skipped = 0; | 1020 | errors_skipped = 0; |
1023 | last_rcode = rcode; | 1021 | last_rcode = rcode; |
@@ -1065,7 +1063,7 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask) | |||
1065 | smp_rmb(); | 1063 | smp_rmb(); |
1066 | node_id = dev->card->node_id; | 1064 | node_id = dev->card->node_id; |
1067 | 1065 | ||
1068 | p = skb_push(ptask->skb, IEEE1394_GASP_HDR_SIZE); | 1066 | p = skb_push(ptask->skb, 8); |
1069 | put_unaligned_be32(node_id << 16 | IANA_SPECIFIER_ID >> 8, p); | 1067 | put_unaligned_be32(node_id << 16 | IANA_SPECIFIER_ID >> 8, p); |
1070 | put_unaligned_be32((IANA_SPECIFIER_ID & 0xff) << 24 | 1068 | put_unaligned_be32((IANA_SPECIFIER_ID & 0xff) << 24 |
1071 | | RFC2734_SW_VERSION, &p[4]); | 1069 | | RFC2734_SW_VERSION, &p[4]); |
@@ -1127,12 +1125,17 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) | |||
1127 | unsigned u; | 1125 | unsigned u; |
1128 | 1126 | ||
1129 | if (dev->local_fifo == FWNET_NO_FIFO_ADDR) { | 1127 | if (dev->local_fifo == FWNET_NO_FIFO_ADDR) { |
1128 | /* outside OHCI posted write area? */ | ||
1129 | static const struct fw_address_region region = { | ||
1130 | .start = 0xffff00000000ULL, | ||
1131 | .end = CSR_REGISTER_BASE, | ||
1132 | }; | ||
1133 | |||
1130 | dev->handler.length = 4096; | 1134 | dev->handler.length = 4096; |
1131 | dev->handler.address_callback = fwnet_receive_packet; | 1135 | dev->handler.address_callback = fwnet_receive_packet; |
1132 | dev->handler.callback_data = dev; | 1136 | dev->handler.callback_data = dev; |
1133 | 1137 | ||
1134 | retval = fw_core_add_address_handler(&dev->handler, | 1138 | retval = fw_core_add_address_handler(&dev->handler, ®ion); |
1135 | &fw_high_memory_region); | ||
1136 | if (retval < 0) | 1139 | if (retval < 0) |
1137 | goto failed_initial; | 1140 | goto failed_initial; |
1138 | 1141 | ||
@@ -1545,12 +1548,14 @@ static int fwnet_probe(struct device *_dev) | |||
1545 | put_unaligned_be64(card->guid, net->dev_addr); | 1548 | put_unaligned_be64(card->guid, net->dev_addr); |
1546 | put_unaligned_be64(~0ULL, net->broadcast); | 1549 | put_unaligned_be64(~0ULL, net->broadcast); |
1547 | ret = register_netdev(net); | 1550 | ret = register_netdev(net); |
1548 | if (ret) | 1551 | if (ret) { |
1552 | fw_error("Cannot register the driver\n"); | ||
1549 | goto out; | 1553 | goto out; |
1554 | } | ||
1550 | 1555 | ||
1551 | list_add_tail(&dev->dev_link, &fwnet_device_list); | 1556 | list_add_tail(&dev->dev_link, &fwnet_device_list); |
1552 | dev_notice(&net->dev, "IPv4 over IEEE 1394 on card %s\n", | 1557 | fw_notify("%s: IPv4 over FireWire on device %016llx\n", |
1553 | dev_name(card->device)); | 1558 | net->name, (unsigned long long)card->guid); |
1554 | have_dev: | 1559 | have_dev: |
1555 | ret = fwnet_add_peer(dev, unit, device); | 1560 | ret = fwnet_add_peer(dev, unit, device); |
1556 | if (ret && allocated_netdev) { | 1561 | if (ret && allocated_netdev) { |
@@ -1652,7 +1657,7 @@ static const struct ieee1394_device_id fwnet_id_table[] = { | |||
1652 | static struct fw_driver fwnet_driver = { | 1657 | static struct fw_driver fwnet_driver = { |
1653 | .driver = { | 1658 | .driver = { |
1654 | .owner = THIS_MODULE, | 1659 | .owner = THIS_MODULE, |
1655 | .name = KBUILD_MODNAME, | 1660 | .name = "net", |
1656 | .bus = &fw_bus_type, | 1661 | .bus = &fw_bus_type, |
1657 | .probe = fwnet_probe, | 1662 | .probe = fwnet_probe, |
1658 | .remove = fwnet_remove, | 1663 | .remove = fwnet_remove, |