03 Jul, 2009

2 commits


26 Jun, 2009

1 commit

  • The DMA mapping API cannot map on-stack addresses, as explained in
    Documentation/DMA-mapping.txt. Convert the two cases of on-stack packet
    payload buffers in firewire-core (payload of lock requests in the bus
    manager work and in iso resource management) to slab-allocated memory.

    There are a number on-stack buffers for quadlet write or quadlet read
    requests in firewire-core and firewire-sbp2. These are harmless; they
    are copied to/ from card driver internal DMA buffers since quadlet
    payloads are inlined with packet headers.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

21 Jun, 2009

1 commit

  • The new stack is now recommended over the old one if used for industrial
    video (IIDC/DCAM) or for storage devices (SBP-2) due to better
    performance, improved compatibility, added features, and security. It
    should also be functionally on par with and is more secure than the old
    ieee1394 stack in the use case of consumer video devices.

    IP-over-1394 support for the new stack is currently emerging, and a
    backend of the firedtv DVB driver to the new stack should be available
    soon.

    The one remaining area where the old stack is still required are audio
    devices, as the new stack is not yet able to support the FFADO FireWire
    audio framework.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

17 Jun, 2009

4 commits

  • The AR req handler should not check the generation; higher level code
    is the better place to handle bus generation changes. The target node
    ID just needs to be checked for not being the "all nodes" address; in
    this case don't handle the request and don't respond.

    Use Address_Error and Type_Error rcodes as appropriate.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Fix some problems from "firewire: net: allow for unordered unit
    discovery":
    - fwnet_remove was missing a list_del, causing fwnet_probe to crash if
    called after fwnet_remove, e.g. if firewire-ohci was unloaded and
    reloaded.
    - fwnet_probe should set its new_netdev flag only if it actually
    allocated a net_device.
    - Use dev_set_drvdata and dev_get_drvdata instead of deprecated direct
    access to device.driver_data.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • If isochronous contexts existed when firewire-ohci was unloaded, the
    core iso shutdown functions crashed with NULL dereferences, and buffers
    etc. weren't released.

    How the fix works: We first copy the card driver's iso shutdown hooks
    into the dummy driver, then fw_destroy_nodes notifies upper layers of
    devices going away, these should shut down (including their iso
    contexts), wait_for_completion(&card->done) will be triggered after
    upper layers gave up all fw_device references, after which the card
    driver's shutdown proceeds.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • dmap_unmap_page() shall use the same direction as dma_map_page().

    Signed-off-by: Stefan Richter

    Stefan Richter
     

14 Jun, 2009

8 commits

  • The .ndo_tx_timeout callback is currently without function; delete it.
    Give .watchdog_timeo a proper time value; lower it to 2 seconds.

    Decrease the .tx_queue_len from 1000 (as in Ethernet card drivers) to 10
    because we have only 64 transaction labels available, and responders
    might have further limits of their AR req contexts.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Decouple the creation and destruction of the net_device from the order
    of discovery and removal of nodes with RFC 2734 unit directories since
    there is no reliable order. The net_device is now created when the
    first RFC 2734 unit on a card is discovered, and destroyed when the last
    RFC 2734 unit on a card went away. This includes all remote units as
    well as the local unit, which is therefore tracked as a peer now too.

    Also, locking around the list of peers is slightly extended to guard
    against peer removal. As a side effect, fwnet_peer.pdg_lock has become
    superfluous and is deleted.

    Peer data (max_rec, speed, node ID, generation) are updated more
    carefully.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Change names of types, variables, functions.
    Omit debug code.
    Use get_unaligned*, put_unaligned*.
    Annotate big endian data.
    Handle errors in __init.
    Change whitespace.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • The driver is now called firewire-net. It might implement the transport
    of other networking protocols in the future, notably IPv6 per RFC 3146.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Implement IPv4 over IEEE 1394 as per RFC 2734 for the newer firewire
    stack. This feature has only been present in the older ieee1394 stack
    via the eth1394 driver.

    Still to do:
    - fix ipv4_priv and ipv4_node lifetime logic
    - fix determination of speeds and max payloads
    - fix bus reset handling
    - fix unaligned memory accesses
    - fix coding style
    - further testing/ improvement of fragment reassembly
    - perhaps multicast support

    Signed-off-by: Jay Fenlason
    Signed-off-by: Stefan Richter (rebased, copyright note, changelog)

    Jay Fenlason
     
  • Tlabel is a 6 bits wide datum. Wrap it after 63 rather than 31 for more
    safety against transaction label exhaustion and potential responders'
    transaction layer bugs. (As noted by Guus Sliepen, this change requires
    an expansion of tlabel_mask to 64 bits.)

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • This extra check will avoid Broadcast_Channel register related traffic
    to many IIDC, SBP-2, and AV/C devices which aren't IRMC or have a
    max_rec < 8 (i.e. support < 512 bytes async payload). This avoids a
    little bit of traffic after bus reset and is even more careful with
    devices which don't implement this CSR.

    The assumption is that no other protocol than IP over 1394 uses the
    broadcast channel for streams.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

07 Jun, 2009

3 commits


05 Jun, 2009

6 commits

  • The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e.
    "drivers/firewire/fw-*.c"
    are renamed to
    "drivers/firewire/core-*.c",
    "drivers/firewire/ohci.c",
    "drivers/firewire/sbp2.c".

    The old fw- prefix was redundant to the directory name. The new core-
    prefix distinguishes the files according to which driver they belong to.

    This change comes a little late, but still before further firewire
    drivers are added as anticipated RSN.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • The three header files of firewire-core, i.e.
    "drivers/firewire/fw-device.h",
    "drivers/firewire/fw-topology.h",
    "drivers/firewire/fw-transaction.h",
    are replaced by
    "drivers/firewire/core.h",
    "include/linux/firewire.h".

    The latter includes everything which a firewire high-level driver (like
    firewire-sbp2) needs besides linux/firewire-constants.h, while core.h
    contains the rest which is needed by firewire-core itself and by low-
    level drivers (card drivers) like firewire-ohci.

    High-level drivers can now also reside outside of drivers/firewire
    without having to add drivers/firewire to the header file search path in
    makefiles. At least the firedtv driver will be such a driver.

    I also considered to spread the contents of core.h over several files,
    one for each .c file where the respective implementation resides. But
    it turned out that most core .c files will end up including most of the
    core .h files. Also, the combined core.h isn't unreasonably big, and it
    will lose more of its contents to linux/firewire.h anyway soon when more
    firewire drivers are added. (IP-over-1394, firedtv, and there are plans
    for one or two more.)

    Furthermore, fw-ohci.h is renamed to ohci.h. The name of core.h and
    ohci.h is chosen with regard to name changes of the .c files in a
    follow-up change.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Include required headers which were only indirectly included.
    Remove unused includes and an unused constant.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • In the unlikely event that card->driver->get_bus_time() is called during
    a cycle64Seconds interrupt, we could read garbage unless atomic accesses
    are used.

    The switch to atomic ops requires to change the 64 seconds counter from
    unsigned to signed, but this shouldn't matter to the end result.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Due to AV/C protocol extensions, FireDTV devices need a vendor-specific
    driver. But their configuration ROM features a vendor ID only in the
    root directory, not in the unit directory.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • That way, the new firedtv driver will be able to use a single ID table
    in builds against ieee1394 core and/or against firewire core.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

01 Jun, 2009

2 commits

  • This adds the attribute /sys/bus/firewire/devices/fw[0-9]+/units. It
    can be used in udev rules like the following ones:

    # IIDC devices: industrial cameras and some webcams
    SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010?*", GROUP="video"

    # AV/C devices: camcorders, set-top boxes, TV sets, audio devices, ...
    SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video"

    Background:

    firewire-core manages two device types:
    - fw_device is a FireWire node. A character device file is associated
    with it.
    - fw_unit is a unit directory on a node. Each fw_device may have 0..n
    children of type fw_unit. The units tell us what kinds of protocols
    a node implements.

    We want to set ownership or ACLs or permissions of the character device
    file of an fw_device, or/and create symlinks to it, based on available
    protocols. Until now udev rules had to look at the fw_unit devices and
    then modify their parent's character device file accordingly. This is
    problematic for two reasons: 1) It happens sometime after the creation
    of the fw_device, 2) an access policy may require that information from
    all children is evaluated before a decision about the parent is made.

    Problem 1) can ultimately not be avoided since this is the nature of
    FireWire nodes: They may add or remove unit directories at any point in
    time.

    However, we can still help userland a lot by providing the protocol type
    information of all units in a summary sysfs attribute directly at the
    fw_device. This way,
    - the information is immediately available at the affected device
    when userspace goes about to handle an ADD or CHANGE event of the
    fw_device,
    - with most policies, it won't be necessary anymore to dig through
    child attributes.

    The new attribute is called "units". It contains space-separated tuples
    of specifier_id and version of each present unit. The delimiter within
    tuples is a colon. Specifier_id and version are printed as 0x%06x.

    Here is an example of a node which implements an IPv4 unit and an IPv6
    unit: $ cat /sys/bus/firewire/devices/fw2/units
    0x00005e:0x000001 0x00005e:0x000002

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • struct fw_attribute_group.attrs.[] must have enough room for all
    attributes. This can and should be checked at build time.

    Our previous check at run time was a little late and not reliable since
    most of the time less than the available attributes are populated.

    Furthermore, omit an increment of an index at its last usage.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

17 May, 2009

1 commit

  • My recently added test for a device being local in fw-cdev.c got it
    slightly wrong: Comparisons of node IDs are only valid if the
    generation is current, which I forgot to check. Normally, serialization
    by card->lock takes care of this, but a device in FW_DEVICE_GONE state
    will necessarily have a wrong generation and invalid node_id.

    The "is it local?" check is made 100% correct and simpler now by means
    of a struct fw_device flag which is set at fw_device creation.

    Besides the fw-cdev site which was to be fixed, there is another site
    which can make use of the new flag, and an RFC-2734 driver will benefit
    from it too.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

28 Mar, 2009

1 commit


25 Mar, 2009

11 commits

  • Eliminate
    drivers/media/dvb/firewire/firedtv-avc.c: In function 'debug_fcp':
    drivers/media/dvb/firewire/firedtv-avc.c:156: warning: format '%d' expects type 'int', but argument 5 has type 'size_t'

    Acked-by: Mauro Carvalho Chehab
    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Eliminate the following warnings in raw1394_compat_write()'s error
    return path, seen on x86-64 with CONFIG_COMPAT=y:

    drivers/ieee1394/raw1394.c:381:17: warning: incorrect type in return expression (different address spaces)
    drivers/ieee1394/raw1394.c:381:17: expected char const [noderef] *
    drivers/ieee1394/raw1394.c:381:17: got void *
    drivers/ieee1394/raw1394.c:2252:14: warning: incorrect type in argument 1 (different address spaces)
    drivers/ieee1394/raw1394.c:2252:14: expected void const *ptr
    drivers/ieee1394/raw1394.c:2252:14: got char const [noderef] *[assigned] buffer
    drivers/ieee1394/raw1394.c:2253:19: warning: incorrect type in argument 1 (different address spaces)
    drivers/ieee1394/raw1394.c:2253:19: expected void const *ptr
    drivers/ieee1394/raw1394.c:2253:19: got char const [noderef] *[assigned] buffer

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • The C99 specification states in section 6.11.5:

    The placement of a storage-class specifier other than at the beginning
    of the declaration specifiers in a declaration is an obsolescent
    feature.

    Signed-off-by: Tobias Klauser
    Signed-off-by: Stefan Richter

    Tobias Klauser
     
  • Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Cache the test result of whether a device implements BROADCAST_CHANNEL.
    This minimizes traffic on the bus after each bus reset. A majority of
    devices does not implement BROADCAST_CHANNEL.

    Remove busy retries; just rely on the hardware to retry requests to busy
    responders. Remove unnecessary log messages.

    Rename the flag is_irm to broadcast_channel_allocated to better reflect
    its meaning. Reset the flag earlier in fw_core_handle_bus_reset.

    Pass the generation down as a call parameter; that way generation can't
    be newer than card->broadcast_channel_allocated and device->node_id.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • fw-iso.c has channel allocation code now, use it.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Per IEEE 1394 clause 8.4.2.5, bus manager capable nodes which are not
    incumbent shall wait at least 125ms before trying to establish
    themselves as bus manager.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • All callers inserted NULL and 0 here.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • This changes the as yet unreleased FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
    to generate an fw_cdev_event_response event just like the other two
    ioctls for asynchronous request transmission do. This way, clients get
    feedback on successful or unsuccessful transmission.

    This also adds input validation for length, tag, channel, sy, speed.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • This changes the ioctl() return value of FW_CDEV_IOC_SEND_REQUEST and of
    the as yet unreleased FW_CDEV_IOC_SEND_BROADCAST_REQUEST. They used to
    return
    sizeof(struct fw_cdev_send_request *) + data_length

    which is obviously a failed attempt to emulate the return value of
    raw1394's respective interface which uses write() instead of ioctl().

    However, the first summand, as size of a kernel pointer, is entirely
    meaningless to clients and the second summand is already known to
    clients. And the result does not resemble raw1394's write() return
    code anyway.

    So simplify it to a constant non-negative value, i.e. 0. The only
    dangers here would be that future client implementations check for error
    by ret != 0 instead of ret < 0 when running on top of an old kernel; or
    that current clients interpret ret = 0 or more as failure. But both are
    hypothetical cases which don't justify to return irritating values.

    While we touch this code, also remove "& 0x1f" from tcode in the call of
    fw_send_request. The tcode cannot be bigger than 0x1f at this point.

    Signed-off-by: Stefan Richter

    Stefan Richter