diff options
-rw-r--r-- | drivers/scsi/libfc/fc_fcp.c | 15 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_frame.c | 6 | ||||
-rw-r--r-- | include/scsi/fc_frame.h | 16 |
3 files changed, 10 insertions, 27 deletions
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index 970b54f653b7..567eee7b8609 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
@@ -505,18 +505,11 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq, | |||
505 | */ | 505 | */ |
506 | if (tlen % 4) | 506 | if (tlen % 4) |
507 | using_sg = 0; | 507 | using_sg = 0; |
508 | if (using_sg) { | 508 | fp = fc_frame_alloc(lport, using_sg ? 0 : tlen); |
509 | fp = _fc_frame_alloc(lport, 0); | 509 | if (!fp) |
510 | if (!fp) | 510 | return -ENOMEM; |
511 | return -ENOMEM; | ||
512 | } else { | ||
513 | fp = fc_frame_alloc(lport, tlen); | ||
514 | if (!fp) | ||
515 | return -ENOMEM; | ||
516 | 511 | ||
517 | data = (void *)(fr_hdr(fp)) + | 512 | data = fc_frame_header_get(fp) + 1; |
518 | sizeof(struct fc_frame_header); | ||
519 | } | ||
520 | fh_parm_offset = frame_offset; | 513 | fh_parm_offset = frame_offset; |
521 | fr_max_payload(fp) = fsp->max_payload; | 514 | fr_max_payload(fp) = fsp->max_payload; |
522 | } | 515 | } |
diff --git a/drivers/scsi/libfc/fc_frame.c b/drivers/scsi/libfc/fc_frame.c index 4fea369b58ee..79c956501bd9 100644 --- a/drivers/scsi/libfc/fc_frame.c +++ b/drivers/scsi/libfc/fc_frame.c | |||
@@ -51,7 +51,7 @@ EXPORT_SYMBOL(fc_frame_crc_check); | |||
51 | * Allocate a frame intended to be sent via fcoe_xmit. | 51 | * Allocate a frame intended to be sent via fcoe_xmit. |
52 | * Get an sk_buff for the frame and set the length. | 52 | * Get an sk_buff for the frame and set the length. |
53 | */ | 53 | */ |
54 | struct fc_frame *__fc_frame_alloc(size_t len) | 54 | struct fc_frame *_fc_frame_alloc(size_t len) |
55 | { | 55 | { |
56 | struct fc_frame *fp; | 56 | struct fc_frame *fp; |
57 | struct sk_buff *skb; | 57 | struct sk_buff *skb; |
@@ -67,7 +67,7 @@ struct fc_frame *__fc_frame_alloc(size_t len) | |||
67 | skb_put(skb, len); | 67 | skb_put(skb, len); |
68 | return fp; | 68 | return fp; |
69 | } | 69 | } |
70 | EXPORT_SYMBOL(__fc_frame_alloc); | 70 | EXPORT_SYMBOL(_fc_frame_alloc); |
71 | 71 | ||
72 | struct fc_frame *fc_frame_alloc_fill(struct fc_lport *lp, size_t payload_len) | 72 | struct fc_frame *fc_frame_alloc_fill(struct fc_lport *lp, size_t payload_len) |
73 | { | 73 | { |
@@ -77,7 +77,7 @@ struct fc_frame *fc_frame_alloc_fill(struct fc_lport *lp, size_t payload_len) | |||
77 | fill = payload_len % 4; | 77 | fill = payload_len % 4; |
78 | if (fill != 0) | 78 | if (fill != 0) |
79 | fill = 4 - fill; | 79 | fill = 4 - fill; |
80 | fp = __fc_frame_alloc(payload_len + fill); | 80 | fp = _fc_frame_alloc(payload_len + fill); |
81 | if (fp) { | 81 | if (fp) { |
82 | memset((char *) fr_hdr(fp) + payload_len, 0, fill); | 82 | memset((char *) fr_hdr(fp) + payload_len, 0, fill); |
83 | /* trim is OK, we just allocated it so there are no fragments */ | 83 | /* trim is OK, we just allocated it so there are no fragments */ |
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h index ab2f8d41761b..4d3e9c7b7c57 100644 --- a/include/scsi/fc_frame.h +++ b/include/scsi/fc_frame.h | |||
@@ -100,17 +100,7 @@ static inline void fc_frame_init(struct fc_frame *fp) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); | 102 | struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); |
103 | 103 | struct fc_frame *_fc_frame_alloc(size_t payload_len); | |
104 | struct fc_frame *__fc_frame_alloc(size_t payload_len); | ||
105 | |||
106 | /* | ||
107 | * Get frame for sending via port. | ||
108 | */ | ||
109 | static inline struct fc_frame *_fc_frame_alloc(struct fc_lport *dev, | ||
110 | size_t payload_len) | ||
111 | { | ||
112 | return __fc_frame_alloc(payload_len); | ||
113 | } | ||
114 | 104 | ||
115 | /* | 105 | /* |
116 | * Allocate fc_frame structure and buffer. Set the initial length to | 106 | * Allocate fc_frame structure and buffer. Set the initial length to |
@@ -124,10 +114,10 @@ static inline struct fc_frame *fc_frame_alloc(struct fc_lport *dev, size_t len) | |||
124 | * Note: Since len will often be a constant multiple of 4, | 114 | * Note: Since len will often be a constant multiple of 4, |
125 | * this check will usually be evaluated and eliminated at compile time. | 115 | * this check will usually be evaluated and eliminated at compile time. |
126 | */ | 116 | */ |
127 | if ((len % 4) != 0) | 117 | if (len && len % 4) |
128 | fp = fc_frame_alloc_fill(dev, len); | 118 | fp = fc_frame_alloc_fill(dev, len); |
129 | else | 119 | else |
130 | fp = _fc_frame_alloc(dev, len); | 120 | fp = _fc_frame_alloc(len); |
131 | return fp; | 121 | return fp; |
132 | } | 122 | } |
133 | 123 | ||