4949/* available since kernel version 6.5 */
5050#define FW_CDEV_EVENT_REQUEST3 0x0a
5151#define FW_CDEV_EVENT_RESPONSE2 0x0b
52+ #define FW_CDEV_EVENT_PHY_PACKET_SENT2 0x0c
53+ #define FW_CDEV_EVENT_PHY_PACKET_RECEIVED2 0x0d
5254
5355/**
5456 * struct fw_cdev_event_common - Common part of all fw_cdev_event_* types
@@ -423,20 +425,59 @@ struct fw_cdev_event_iso_resource {
423425 * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
424426 * @rcode: %RCODE_..., indicates success or failure of transmission
425427 * @length: Data length in bytes
428+ * @data: Incoming data for %FW_CDEV_IOC_RECEIVE_PHY_PACKETS. For %FW_CDEV_IOC_SEND_PHY_PACKET
429+ * the field has the same data in the request, thus the length of 8 bytes.
430+ *
431+ * This event is sent instead of &fw_cdev_event_phy_packet2 if the kernel or
432+ * the client implements ABI version <= 5. It has the lack of time stamp field comparing to
433+ * &fw_cdev_event_phy_packet2.
434+ */
435+ struct fw_cdev_event_phy_packet {
436+ __u64 closure ;
437+ __u32 type ;
438+ __u32 rcode ;
439+ __u32 length ;
440+ __u32 data [];
441+ };
442+
443+ /**
444+ * struct fw_cdev_event_phy_packet2 - A PHY packet was transmitted or received with time stamp.
445+ * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
446+ * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
447+ * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT2 or %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
448+ * @rcode: %RCODE_..., indicates success or failure of transmission
449+ * @length: Data length in bytes
450+ * @tstamp: For %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, the time stamp of isochronous cycle at
451+ * which the packet arrived. For %FW_CDEV_EVENT_PHY_PACKET_SENT2 and non-ping packet,
452+ * the time stamp of isochronous cycle at which the packet was sent. For ping packet,
453+ * the tick count for round-trip time measured by 1394 OHCI controller.
454+ * The time stamp of isochronous cycle at which either the response was sent for
455+ * %FW_CDEV_EVENT_PHY_PACKET_SENT2 or the request arrived for
456+ * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2.
426457 * @data: Incoming data
427458 *
428- * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,
429- * except in case of a ping packet: Then, @length is 4, and @data[0] is the
430- * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
459+ * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT2, @length is 8 and @data consists of the two PHY
460+ * packet quadlets to be sent, in host byte order,
431461 *
432- * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data
433- * consists of the two PHY packet quadlets, in host byte order.
462+ * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, @length is 8 and @data consists of the two PHY
463+ * packet quadlets, in host byte order.
464+ *
465+ * For %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, the @tstamp is the isochronous cycle at which the
466+ * packet arrived. It is 16 bit integer value and the higher 3 bits expresses three low order bits
467+ * of second field and the rest 13 bits expresses cycle field in the format of CYCLE_TIME register.
468+ *
469+ * For %FW_CDEV_EVENT_PHY_PACKET_SENT2, the @tstamp has different meanings whether to sent the
470+ * packet for ping or not. If it's not for ping, the @tstamp is the isochronous cycle at which the
471+ * packet was sent, and use the same format as the case of %FW_CDEV_EVENT_PHY_PACKET_SENT2. If it's
472+ * for ping, the @tstamp is for round-trip time measured by 1394 OHCI controller with 42.195 MHz
473+ * resolution.
434474 */
435- struct fw_cdev_event_phy_packet {
475+ struct fw_cdev_event_phy_packet2 {
436476 __u64 closure ;
437477 __u32 type ;
438478 __u32 rcode ;
439479 __u32 length ;
480+ __u32 tstamp ;
440481 __u32 data [];
441482};
442483
@@ -459,6 +500,8 @@ struct fw_cdev_event_phy_packet {
459500 *
460501 * @request3: Valid if @common.type == %FW_CDEV_EVENT_REQUEST3
461502 * @response2: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE2
503+ * @phy_packet2: Valid if @common.type == %FW_CDEV_EVENT_PHY_PACKET_SENT2 or
504+ * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
462505 *
463506 * Convenience union for userspace use. Events could be read(2) into an
464507 * appropriately aligned char buffer and then cast to this union for further
@@ -480,6 +523,7 @@ union fw_cdev_event {
480523 struct fw_cdev_event_phy_packet phy_packet ; /* added in 2.6.36 */
481524 struct fw_cdev_event_request3 request3 ; /* added in 6.5 */
482525 struct fw_cdev_event_response2 response2 ; /* added in 6.5 */
526+ struct fw_cdev_event_phy_packet2 phy_packet2 ; /* added in 6.5 */
483527};
484528
485529/* available since kernel version 2.6.22 */
@@ -547,6 +591,8 @@ union fw_cdev_event {
547591 * 6 (6.5) - added some event for subactions of asynchronous transaction with time stamp
548592 * - %FW_CDEV_EVENT_REQUEST3
549593 * - %FW_CDEV_EVENT_RESPONSE2
594+ * - %FW_CDEV_EVENT_PHY_PACKET_SENT2
595+ * - %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
550596 */
551597
552598/**
@@ -1100,8 +1146,8 @@ struct fw_cdev_send_stream_packet {
11001146 * @data: First and second quadlet of the PHY packet
11011147 * @generation: The bus generation where packet is valid
11021148 *
1103- * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes
1104- * on the same card as this device. After transmission, an
1149+ * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes on the same card as this
1150+ * device. After transmission, either %FW_CDEV_EVENT_PHY_PACKET_SENT event or
11051151 * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
11061152 *
11071153 * The payload @data\[\] shall be specified in host byte order. Usually,
@@ -1120,8 +1166,9 @@ struct fw_cdev_send_phy_packet {
11201166 * struct fw_cdev_receive_phy_packets - start reception of PHY packets
11211167 * @closure: Passed back to userspace in phy packet events
11221168 *
1123- * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to
1124- * incoming PHY packets from any node on the same bus as the device.
1169+ * This ioctl activates issuing of either %FW_CDEV_EVENT_PHY_PACKET_RECEIVED or
1170+ * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2 due to incoming PHY packets from any node on the same bus
1171+ * as the device.
11251172 *
11261173 * The ioctl is only permitted on device files which represent a local node.
11271174 */
0 commit comments