Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*


 206         clock_t                  xch_start_time;
 207 
 208         stmf_data_buf_t         **xch_dbufs;
 209         uint8_t                 xch_dbuf_num;
 210         uint8_t                 xch_sequence_no;
 211         uint8_t                 xch_ref;
 212 
 213         int                      xch_left_data_size;
 214 } fcoet_exchange_t;
 215 /*
 216  * Add the reference to avoid such situation:
 217  * 1, Frame received, then abort happen (maybe because local port offline, or
 218  * remote port abort the cmd), cmd is aborted and then freed right after we
 219  * get the exchange from hash table in fcoet_rx_frame.
 220  * 2, Frame sent out, then queued in fcoe for release. then abort happen, cmd
 221  * is aborted and then freed before fcoe_watchdog() call up to release the
 222  * frame.
 223  * These two situation should seldom happen. But just invoke this seems won't
 224  * downgrade the performance too much, so we keep it.
 225  */
 226 #define FCOET_BUSY_XCHG(xch)    atomic_add_8(&(xch)->xch_ref, 1)
 227 #define FCOET_RELE_XCHG(xch)    atomic_add_8(&(xch)->xch_ref, -1)
 228 
 229 #define XCH_FLAG_NONFCP_REQ_SENT        0x0001
 230 #define XCH_FLAG_NONFCP_RESP_SENT       0x0002
 231 #define XCH_FLAG_FCP_CMD_RCVD           0x0004
 232 #define XCH_FLAG_INI_ASKED_ABORT        0x0008
 233 #define XCH_FLAG_FCT_CALLED_ABORT       0x0010
 234 #define XCH_FLAG_IN_HASH_TABLE          0x0020
 235 
 236 /*
 237  * IOCTL supporting stuff
 238  */
 239 #define FCOET_IOCTL_FLAG_MASK           0xFF
 240 #define FCOET_IOCTL_FLAG_IDLE           0x00
 241 #define FCOET_IOCTL_FLAG_OPEN           0x01
 242 #define FCOET_IOCTL_FLAG_EXCL           0x02
 243 
 244 /*
 245  * define common-used conversion and calculation macros
 246  */
 247 #define FRM2SS(x_frm)                                                   \




 206         clock_t                  xch_start_time;
 207 
 208         stmf_data_buf_t         **xch_dbufs;
 209         uint8_t                 xch_dbuf_num;
 210         uint8_t                 xch_sequence_no;
 211         uint8_t                 xch_ref;
 212 
 213         int                      xch_left_data_size;
 214 } fcoet_exchange_t;
 215 /*
 216  * Add the reference to avoid such situation:
 217  * 1, Frame received, then abort happen (maybe because local port offline, or
 218  * remote port abort the cmd), cmd is aborted and then freed right after we
 219  * get the exchange from hash table in fcoet_rx_frame.
 220  * 2, Frame sent out, then queued in fcoe for release. then abort happen, cmd
 221  * is aborted and then freed before fcoe_watchdog() call up to release the
 222  * frame.
 223  * These two situation should seldom happen. But just invoke this seems won't
 224  * downgrade the performance too much, so we keep it.
 225  */
 226 #define FCOET_BUSY_XCHG(xch)    atomic_inc_8(&(xch)->xch_ref)
 227 #define FCOET_RELE_XCHG(xch)    atomic_dec_8(&(xch)->xch_ref)
 228 
 229 #define XCH_FLAG_NONFCP_REQ_SENT        0x0001
 230 #define XCH_FLAG_NONFCP_RESP_SENT       0x0002
 231 #define XCH_FLAG_FCP_CMD_RCVD           0x0004
 232 #define XCH_FLAG_INI_ASKED_ABORT        0x0008
 233 #define XCH_FLAG_FCT_CALLED_ABORT       0x0010
 234 #define XCH_FLAG_IN_HASH_TABLE          0x0020
 235 
 236 /*
 237  * IOCTL supporting stuff
 238  */
 239 #define FCOET_IOCTL_FLAG_MASK           0xFF
 240 #define FCOET_IOCTL_FLAG_IDLE           0x00
 241 #define FCOET_IOCTL_FLAG_OPEN           0x01
 242 #define FCOET_IOCTL_FLAG_EXCL           0x02
 243 
 244 /*
 245  * define common-used conversion and calculation macros
 246  */
 247 #define FRM2SS(x_frm)                                                   \