drivers/target: Import OnePlus Changes

Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
This commit is contained in:
Cyber Knight 2021-09-26 01:53:58 +08:00
parent 782d03dd85
commit 7b34d91b52
No known key found for this signature in database
GPG Key ID: 23BD4CCD326E9D64
5 changed files with 10 additions and 28 deletions

View File

@ -1382,27 +1382,14 @@ static u32 iscsit_do_crypto_hash_sg(
sg = cmd->first_data_sg;
page_off = cmd->first_data_sg_off;
if (data_length && page_off) {
struct scatterlist first_sg;
u32 len = min_t(u32, data_length, sg->length - page_off);
sg_init_table(&first_sg, 1);
sg_set_page(&first_sg, sg_page(sg), len, sg->offset + page_off);
ahash_request_set_crypt(hash, &first_sg, NULL, len);
crypto_ahash_update(hash);
data_length -= len;
sg = sg_next(sg);
}
while (data_length) {
u32 cur_len = min_t(u32, data_length, sg->length);
u32 cur_len = min_t(u32, data_length, (sg->length - page_off));
ahash_request_set_crypt(hash, sg, NULL, cur_len);
crypto_ahash_update(hash);
data_length -= cur_len;
page_off = 0;
/* iscsit_map_iovec has already checked for invalid sg pointers */
sg = sg_next(sg);
}

View File

@ -1158,7 +1158,7 @@ iscsit_conn_set_transport(struct iscsi_conn *conn, struct iscsit_transport *t)
}
void iscsi_target_login_sess_out(struct iscsi_conn *conn,
bool zero_tsih, bool new_sess)
struct iscsi_np *np, bool zero_tsih, bool new_sess)
{
if (!new_sess)
goto old_sess_out;
@ -1180,6 +1180,7 @@ void iscsi_target_login_sess_out(struct iscsi_conn *conn,
conn->sess = NULL;
old_sess_out:
iscsi_stop_login_thread_timer(np);
/*
* If login negotiation fails check if the Time2Retain timer
* needs to be restarted.
@ -1439,9 +1440,8 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
new_sess_out:
new_sess = true;
old_sess_out:
iscsi_stop_login_thread_timer(np);
tpg_np = conn->tpg_np;
iscsi_target_login_sess_out(conn, zero_tsih, new_sess);
iscsi_target_login_sess_out(conn, np, zero_tsih, new_sess);
new_sess = false;
if (tpg) {

View File

@ -22,7 +22,8 @@ extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32);
extern void iscsit_free_conn(struct iscsi_np *, struct iscsi_conn *);
extern int iscsit_start_kthreads(struct iscsi_conn *);
extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8);
extern void iscsi_target_login_sess_out(struct iscsi_conn *, bool, bool);
extern void iscsi_target_login_sess_out(struct iscsi_conn *, struct iscsi_np *,
bool, bool);
extern int iscsi_target_login_thread(void *);
#endif /*** ISCSI_TARGET_LOGIN_H ***/

View File

@ -554,11 +554,12 @@ static bool iscsi_target_sk_check_and_clear(struct iscsi_conn *conn, unsigned in
static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login *login)
{
struct iscsi_np *np = login->np;
bool zero_tsih = login->zero_tsih;
iscsi_remove_failed_auth_entry(conn);
iscsi_target_nego_release(conn);
iscsi_target_login_sess_out(conn, zero_tsih, true);
iscsi_target_login_sess_out(conn, np, zero_tsih, true);
}
static void iscsi_target_login_timeout(unsigned long data)

View File

@ -997,14 +997,7 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
struct tcmu_cmd_entry *entry = (void *) mb + CMDR_OFF + udev->cmdr_last_cleaned;
struct tcmu_cmd *cmd;
/*
* Flush max. up to end of cmd ring since current entry might
* be a padding that is shorter than sizeof(*entry)
*/
size_t ring_left = head_to_end(udev->cmdr_last_cleaned,
udev->cmdr_size);
tcmu_flush_dcache_range(entry, ring_left < sizeof(*entry) ?
ring_left : sizeof(*entry));
tcmu_flush_dcache_range(entry, sizeof(*entry));
if (tcmu_hdr_get_op(entry->hdr.len_op) == TCMU_OP_PAD) {
UPDATE_HEAD(udev->cmdr_last_cleaned,