]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
firewire: Add function to get speed from opaque struct fw_request
authorChris Boot <bootc@bootc.net>
Thu, 16 Feb 2012 09:16:35 +0000 (09:16 +0000)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sun, 15 Apr 2012 01:03:58 +0000 (18:03 -0700)
Sometimes it's useful to know the FireWire speed of the request that has
just come in to a fw_address_handler callback. As struct fw_request is
opaque we can't peek inside to get the speed out of the struct fw_packet
that's just inside. For example, the SBP-2 spec says:

"The speed at which the block write request to the MANAGEMENT_AGENT
register is received shall determine the speed used by the target for
all subsequent requests to read the initiator’s configuration ROM, fetch
ORB’s from initiator memory or store status at the initiator’s
status_FIFO. Command block ORB’s separately specify the speed for
requests addressed to the data buffer or page table."

[ ANSI T10/1155D Revision 4 page 53/54 ]

Signed-off-by: Chris Boot <bootc@bootc.net>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/firewire/core-transaction.c
include/linux/firewire.h

index dea2dcc9310d3fc2324b7fa726c0a8590581a96f..db8a965cf712b456382256d7ebf7cb6a4b721cce 100644 (file)
@@ -820,6 +820,15 @@ void fw_send_response(struct fw_card *card,
 }
 EXPORT_SYMBOL(fw_send_response);
 
+/**
+ * fw_get_request_speed() - returns speed at which the @request was received
+ */
+int fw_get_request_speed(struct fw_request *request)
+{
+       return request->response.speed;
+}
+EXPORT_SYMBOL(fw_get_request_speed);
+
 static void handle_exclusive_region_request(struct fw_card *card,
                                            struct fw_packet *p,
                                            struct fw_request *request,
index cdc9b719e9c7e285e85878677a64ff4b3d7d3501..46831303b0b9c068f4ee9ab1fd8c36dd5c5f0c82 100644 (file)
@@ -325,6 +325,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
 void fw_core_remove_address_handler(struct fw_address_handler *handler);
 void fw_send_response(struct fw_card *card,
                      struct fw_request *request, int rcode);
+int fw_get_request_speed(struct fw_request *request);
 void fw_send_request(struct fw_card *card, struct fw_transaction *t,
                     int tcode, int destination_id, int generation, int speed,
                     unsigned long long offset, void *payload, size_t length,