root/drivers/scsi/qedf/drv_scsi_fw_funcs.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. scsi_is_slow_sgl
  2. init_scsi_sgl_context

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 /* QLogic FCoE Offload Driver
   3  * Copyright (c) 2016-2018 Cavium Inc.
   4  */
   5 #include "drv_scsi_fw_funcs.h"
   6 
   7 #define SCSI_NUM_SGES_IN_CACHE 0x4
   8 
   9 bool scsi_is_slow_sgl(u16 num_sges, bool small_mid_sge)
  10 {
  11         return (num_sges > SCSI_NUM_SGES_SLOW_SGL_THR && small_mid_sge);
  12 }
  13 
  14 void init_scsi_sgl_context(struct scsi_sgl_params *ctx_sgl_params,
  15                            struct scsi_cached_sges *ctx_data_desc,
  16                            struct scsi_sgl_task_params *sgl_task_params)
  17 {
  18         /* no need to check for sgl_task_params->sgl validity */
  19         u8 num_sges_to_init = sgl_task_params->num_sges >
  20                               SCSI_NUM_SGES_IN_CACHE ? SCSI_NUM_SGES_IN_CACHE :
  21                               sgl_task_params->num_sges;
  22         u8 sge_index;
  23         u32 val;
  24 
  25         val = cpu_to_le32(sgl_task_params->sgl_phys_addr.lo);
  26         ctx_sgl_params->sgl_addr.lo = val;
  27         val = cpu_to_le32(sgl_task_params->sgl_phys_addr.hi);
  28         ctx_sgl_params->sgl_addr.hi = val;
  29         val = cpu_to_le32(sgl_task_params->total_buffer_size);
  30         ctx_sgl_params->sgl_total_length = val;
  31         ctx_sgl_params->sgl_num_sges = cpu_to_le16(sgl_task_params->num_sges);
  32 
  33         for (sge_index = 0; sge_index < num_sges_to_init; sge_index++) {
  34                 val = cpu_to_le32(sgl_task_params->sgl[sge_index].sge_addr.lo);
  35                 ctx_data_desc->sge[sge_index].sge_addr.lo = val;
  36                 val = cpu_to_le32(sgl_task_params->sgl[sge_index].sge_addr.hi);
  37                 ctx_data_desc->sge[sge_index].sge_addr.hi = val;
  38                 val = cpu_to_le32(sgl_task_params->sgl[sge_index].sge_len);
  39                 ctx_data_desc->sge[sge_index].sge_len = val;
  40         }
  41 }

/* [<][>][^][v][top][bottom][index][help] */