On Sun, Apr 10, 2016 at 08:38:03PM +0300, Sagi Grimberg wrote:
> 
> 
> On 09/04/16 16:11, Varun Prakash wrote:
> >Add int (*iscsit_xmit_datain_pdu)() to
> >struct iscsit_transport, iscsi-target
> >uses this callback to transmit a DATAIN
> >iSCSI PDU.
> >
> >Signed-off-by: Varun Prakash <[email protected]>
> >---
> >  drivers/target/iscsi/iscsi_target.c    | 143 
> > +++++++++++++++++++--------------
> >  include/target/iscsi/iscsi_transport.h |   3 +
> >  2 files changed, 86 insertions(+), 60 deletions(-)
> >
> >diff --git a/drivers/target/iscsi/iscsi_target.c 
> >b/drivers/target/iscsi/iscsi_target.c
> >index 0e7a481..9e65e5d 100644
> >--- a/drivers/target/iscsi/iscsi_target.c
> >+++ b/drivers/target/iscsi/iscsi_target.c
> >@@ -577,6 +577,84 @@ static int iscsit_xmit_pdu(struct iscsi_conn *conn, 
> >struct iscsi_cmd *cmd,
> >     return 0;
> >  }
> >
> >+static int iscsit_map_iovec(struct iscsi_cmd *, struct kvec *, u32, u32);
> >+static void iscsit_unmap_iovec(struct iscsi_cmd *);
> >+static u32 iscsit_do_crypto_hash_sg(struct ahash_request *, struct 
> >iscsi_cmd *,
> >+                                u32, u32, u32, u8 *);
> >+static int
> >+iscsit_xmit_datain_pdu(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
> >+                   struct iscsi_datain_req *dr, struct iscsi_datain *datain)
> 
> Looks very similar to xmit_pdu(), if we add a datain pointer that
> can be null for normal pdus would that reduce code duplication?

Yes, we can have a common xmit function for all pdus -

int iscsit_xmit_pdu(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
                    struct iscsi_datain_req *dr, const void *buf, u32 buf_len);

dr will be NULL for non datain pdus and buf will point to data buffer.
For datain pdus buf will point to datain(struct iscsi_datain) buffer, buf_len 
will be zero.

I will add this in -v3, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to