| .. | .. |
|---|
| 16 | 16 | #define QDIO_MAX_QUEUES_PER_IRQ 4 |
|---|
| 17 | 17 | #define QDIO_MAX_BUFFERS_PER_Q 128 |
|---|
| 18 | 18 | #define QDIO_MAX_BUFFERS_MASK (QDIO_MAX_BUFFERS_PER_Q - 1) |
|---|
| 19 | +#define QDIO_BUFNR(num) ((num) & QDIO_MAX_BUFFERS_MASK) |
|---|
| 19 | 20 | #define QDIO_MAX_ELEMENTS_PER_BUFFER 16 |
|---|
| 20 | 21 | #define QDIO_SBAL_SIZE 256 |
|---|
| 21 | 22 | |
|---|
| .. | .. |
|---|
| 25 | 26 | |
|---|
| 26 | 27 | /** |
|---|
| 27 | 28 | * struct qdesfmt0 - queue descriptor, format 0 |
|---|
| 28 | | - * @sliba: storage list information block address |
|---|
| 29 | | - * @sla: storage list address |
|---|
| 30 | | - * @slsba: storage list state block address |
|---|
| 31 | | - * @akey: access key for DLIB |
|---|
| 29 | + * @sliba: absolute address of storage list information block |
|---|
| 30 | + * @sla: absolute address of storage list |
|---|
| 31 | + * @slsba: absolute address of storage list state block |
|---|
| 32 | + * @akey: access key for SLIB |
|---|
| 32 | 33 | * @bkey: access key for SL |
|---|
| 33 | 34 | * @ckey: access key for SBALs |
|---|
| 34 | 35 | * @dkey: access key for SLSB |
|---|
| .. | .. |
|---|
| 50 | 51 | /** |
|---|
| 51 | 52 | * struct qdr - queue description record (QDR) |
|---|
| 52 | 53 | * @qfmt: queue format |
|---|
| 53 | | - * @pfmt: implementation dependent parameter format |
|---|
| 54 | 54 | * @ac: adapter characteristics |
|---|
| 55 | 55 | * @iqdcnt: input queue descriptor count |
|---|
| 56 | 56 | * @oqdcnt: output queue descriptor count |
|---|
| 57 | | - * @iqdsz: inpout queue descriptor size |
|---|
| 57 | + * @iqdsz: input queue descriptor size |
|---|
| 58 | 58 | * @oqdsz: output queue descriptor size |
|---|
| 59 | | - * @qiba: queue information block address |
|---|
| 59 | + * @qiba: absolute address of queue information block |
|---|
| 60 | 60 | * @qkey: queue information block key |
|---|
| 61 | 61 | * @qdf0: queue descriptions |
|---|
| 62 | 62 | */ |
|---|
| 63 | 63 | struct qdr { |
|---|
| 64 | 64 | u32 qfmt : 8; |
|---|
| 65 | | - u32 pfmt : 8; |
|---|
| 66 | | - u32 : 8; |
|---|
| 65 | + u32 : 16; |
|---|
| 67 | 66 | u32 ac : 8; |
|---|
| 68 | 67 | u32 : 8; |
|---|
| 69 | 68 | u32 iqdcnt : 8; |
|---|
| .. | .. |
|---|
| 112 | 111 | /* private: */ |
|---|
| 113 | 112 | u8 res[88]; |
|---|
| 114 | 113 | /* public: */ |
|---|
| 115 | | - u8 parm[QDIO_MAX_BUFFERS_PER_Q]; |
|---|
| 114 | + u8 parm[128]; |
|---|
| 116 | 115 | } __attribute__ ((packed, aligned(256))); |
|---|
| 117 | 116 | |
|---|
| 118 | 117 | /** |
|---|
| .. | .. |
|---|
| 202 | 201 | * @scount: SBAL count |
|---|
| 203 | 202 | * @sflags: whole SBAL flags |
|---|
| 204 | 203 | * @length: length |
|---|
| 205 | | - * @addr: address |
|---|
| 204 | + * @addr: absolute data address |
|---|
| 206 | 205 | */ |
|---|
| 207 | 206 | struct qdio_buffer_element { |
|---|
| 208 | 207 | u8 eflags; |
|---|
| .. | .. |
|---|
| 212 | 211 | u8 scount; |
|---|
| 213 | 212 | u8 sflags; |
|---|
| 214 | 213 | u32 length; |
|---|
| 215 | | - void *addr; |
|---|
| 214 | + u64 addr; |
|---|
| 216 | 215 | } __attribute__ ((packed, aligned(16))); |
|---|
| 217 | 216 | |
|---|
| 218 | 217 | /** |
|---|
| .. | .. |
|---|
| 252 | 251 | * (for communication with upper layer programs) |
|---|
| 253 | 252 | * (only required for use with completion queues) |
|---|
| 254 | 253 | * @flags: flags indicating state of buffer |
|---|
| 255 | | - * @aob: pointer to QAOB used for the particular SBAL |
|---|
| 256 | 254 | * @user: pointer to upper layer program's state information related to SBAL |
|---|
| 257 | 255 | * (stored in user1 data of QAOB) |
|---|
| 258 | 256 | */ |
|---|
| 259 | 257 | struct qdio_outbuf_state { |
|---|
| 260 | 258 | u8 flags; |
|---|
| 261 | | - struct qaob *aob; |
|---|
| 262 | 259 | void *user; |
|---|
| 263 | 260 | }; |
|---|
| 264 | 261 | |
|---|
| .. | .. |
|---|
| 279 | 276 | #define CHSC_AC2_MULTI_BUFFER_AVAILABLE 0x0080 |
|---|
| 280 | 277 | #define CHSC_AC2_MULTI_BUFFER_ENABLED 0x0040 |
|---|
| 281 | 278 | #define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010 |
|---|
| 279 | +#define CHSC_AC2_SNIFFER_AVAILABLE 0x0008 |
|---|
| 282 | 280 | #define CHSC_AC2_DATA_DIV_ENABLED 0x0002 |
|---|
| 283 | 281 | |
|---|
| 284 | 282 | #define CHSC_AC3_FORMAT2_CQ_AVAILABLE 0x8000 |
|---|
| .. | .. |
|---|
| 327 | 325 | |
|---|
| 328 | 326 | /** |
|---|
| 329 | 327 | * struct qdio_initialize - qdio initialization data |
|---|
| 330 | | - * @cdev: associated ccw device |
|---|
| 331 | 328 | * @q_format: queue format |
|---|
| 332 | | - * @adapter_name: name for the adapter |
|---|
| 329 | + * @qdr_ac: feature flags to set |
|---|
| 333 | 330 | * @qib_param_field_format: format for qib_parm_field |
|---|
| 334 | 331 | * @qib_param_field: pointer to 128 bytes or NULL, if no param field |
|---|
| 335 | 332 | * @qib_rflags: rflags to set |
|---|
| .. | .. |
|---|
| 339 | 336 | * @no_output_qs: number of output queues |
|---|
| 340 | 337 | * @input_handler: handler to be called for input queues |
|---|
| 341 | 338 | * @output_handler: handler to be called for output queues |
|---|
| 342 | | - * @queue_start_poll_array: polling handlers (one per input queue or NULL) |
|---|
| 339 | + * @irq_poll: Data IRQ polling handler (NULL when not supported) |
|---|
| 340 | + * @scan_threshold: # of in-use buffers that triggers scan on output queue |
|---|
| 343 | 341 | * @int_parm: interruption parameter |
|---|
| 344 | | - * @input_sbal_addr_array: address of no_input_qs * 128 pointers |
|---|
| 345 | | - * @output_sbal_addr_array: address of no_output_qs * 128 pointers |
|---|
| 342 | + * @input_sbal_addr_array: per-queue array, each element points to 128 SBALs |
|---|
| 343 | + * @output_sbal_addr_array: per-queue array, each element points to 128 SBALs |
|---|
| 346 | 344 | * @output_sbal_state_array: no_output_qs * 128 state info (for CQ or NULL) |
|---|
| 347 | 345 | */ |
|---|
| 348 | 346 | struct qdio_initialize { |
|---|
| 349 | | - struct ccw_device *cdev; |
|---|
| 350 | 347 | unsigned char q_format; |
|---|
| 351 | 348 | unsigned char qdr_ac; |
|---|
| 352 | | - unsigned char adapter_name[8]; |
|---|
| 353 | 349 | unsigned int qib_param_field_format; |
|---|
| 354 | 350 | unsigned char *qib_param_field; |
|---|
| 355 | 351 | unsigned char qib_rflags; |
|---|
| .. | .. |
|---|
| 359 | 355 | unsigned int no_output_qs; |
|---|
| 360 | 356 | qdio_handler_t *input_handler; |
|---|
| 361 | 357 | qdio_handler_t *output_handler; |
|---|
| 362 | | - void (**queue_start_poll_array) (struct ccw_device *, int, |
|---|
| 363 | | - unsigned long); |
|---|
| 364 | | - int scan_threshold; |
|---|
| 358 | + void (*irq_poll)(struct ccw_device *cdev, unsigned long data); |
|---|
| 359 | + unsigned int scan_threshold; |
|---|
| 365 | 360 | unsigned long int_parm; |
|---|
| 366 | | - void **input_sbal_addr_array; |
|---|
| 367 | | - void **output_sbal_addr_array; |
|---|
| 361 | + struct qdio_buffer ***input_sbal_addr_array; |
|---|
| 362 | + struct qdio_buffer ***output_sbal_addr_array; |
|---|
| 368 | 363 | struct qdio_outbuf_state *output_sbal_state_array; |
|---|
| 369 | 364 | }; |
|---|
| 370 | | - |
|---|
| 371 | | -/** |
|---|
| 372 | | - * enum qdio_brinfo_entry_type - type of address entry for qdio_brinfo_desc() |
|---|
| 373 | | - * @l3_ipv6_addr: entry contains IPv6 address |
|---|
| 374 | | - * @l3_ipv4_addr: entry contains IPv4 address |
|---|
| 375 | | - * @l2_addr_lnid: entry contains MAC address and VLAN ID |
|---|
| 376 | | - */ |
|---|
| 377 | | -enum qdio_brinfo_entry_type {l3_ipv6_addr, l3_ipv4_addr, l2_addr_lnid}; |
|---|
| 378 | | - |
|---|
| 379 | | -/** |
|---|
| 380 | | - * struct qdio_brinfo_entry_XXX - Address entry for qdio_brinfo_desc() |
|---|
| 381 | | - * @nit: Network interface token |
|---|
| 382 | | - * @addr: Address of one of the three types |
|---|
| 383 | | - * |
|---|
| 384 | | - * The struct is passed to the callback function by qdio_brinfo_desc() |
|---|
| 385 | | - */ |
|---|
| 386 | | -struct qdio_brinfo_entry_l3_ipv6 { |
|---|
| 387 | | - u64 nit; |
|---|
| 388 | | - struct { unsigned char _s6_addr[16]; } addr; |
|---|
| 389 | | -} __packed; |
|---|
| 390 | | -struct qdio_brinfo_entry_l3_ipv4 { |
|---|
| 391 | | - u64 nit; |
|---|
| 392 | | - struct { uint32_t _s_addr; } addr; |
|---|
| 393 | | -} __packed; |
|---|
| 394 | | -struct qdio_brinfo_entry_l2 { |
|---|
| 395 | | - u64 nit; |
|---|
| 396 | | - struct { u8 mac[6]; u16 lnid; } addr_lnid; |
|---|
| 397 | | -} __packed; |
|---|
| 398 | 365 | |
|---|
| 399 | 366 | #define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */ |
|---|
| 400 | 367 | #define QDIO_STATE_ESTABLISHED 0x00000004 /* after qdio_establish */ |
|---|
| .. | .. |
|---|
| 409 | 376 | void qdio_free_buffers(struct qdio_buffer **buf, unsigned int count); |
|---|
| 410 | 377 | void qdio_reset_buffers(struct qdio_buffer **buf, unsigned int count); |
|---|
| 411 | 378 | |
|---|
| 412 | | -extern int qdio_allocate(struct qdio_initialize *); |
|---|
| 413 | | -extern int qdio_establish(struct qdio_initialize *); |
|---|
| 379 | +extern int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs, |
|---|
| 380 | + unsigned int no_output_qs); |
|---|
| 381 | +extern int qdio_establish(struct ccw_device *cdev, |
|---|
| 382 | + struct qdio_initialize *init_data); |
|---|
| 414 | 383 | extern int qdio_activate(struct ccw_device *); |
|---|
| 415 | 384 | extern void qdio_release_aob(struct qaob *); |
|---|
| 416 | 385 | extern int do_QDIO(struct ccw_device *, unsigned int, int, unsigned int, |
|---|
| 417 | 386 | unsigned int); |
|---|
| 418 | | -extern int qdio_start_irq(struct ccw_device *, int); |
|---|
| 419 | | -extern int qdio_stop_irq(struct ccw_device *, int); |
|---|
| 387 | +extern int qdio_start_irq(struct ccw_device *cdev); |
|---|
| 388 | +extern int qdio_stop_irq(struct ccw_device *cdev); |
|---|
| 420 | 389 | extern int qdio_get_next_buffers(struct ccw_device *, int, int *, int *); |
|---|
| 390 | +extern int qdio_inspect_queue(struct ccw_device *cdev, unsigned int nr, |
|---|
| 391 | + bool is_input, unsigned int *bufnr, |
|---|
| 392 | + unsigned int *error); |
|---|
| 421 | 393 | extern int qdio_shutdown(struct ccw_device *, int); |
|---|
| 422 | 394 | extern int qdio_free(struct ccw_device *); |
|---|
| 423 | 395 | extern int qdio_get_ssqd_desc(struct ccw_device *, struct qdio_ssqd_desc *); |
|---|
| 424 | | -extern int qdio_pnso_brinfo(struct subchannel_id schid, |
|---|
| 425 | | - int cnc, u16 *response, |
|---|
| 426 | | - void (*cb)(void *priv, enum qdio_brinfo_entry_type type, |
|---|
| 427 | | - void *entry), |
|---|
| 428 | | - void *priv); |
|---|
| 429 | 396 | |
|---|
| 430 | 397 | #endif /* __QDIO_H__ */ |
|---|