oce_queue.c (9dba179d5e2453efa8e67ee2df13ee86d46ad0d4) | oce_queue.c (9bd3250a02c34dea617b02eff5970004d4eb7fc0) |
---|---|
1/*- 2 * Copyright (C) 2012 Emulex 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 22 unchanged lines hidden (view full) --- 31 * Contact Information: 32 * freebsd-drivers@emulex.com 33 * 34 * Emulex 35 * 3333 Susan Street 36 * Costa Mesa, CA 92626 37 */ 38 | 1/*- 2 * Copyright (C) 2012 Emulex 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 22 unchanged lines hidden (view full) --- 31 * Contact Information: 32 * freebsd-drivers@emulex.com 33 * 34 * Emulex 35 * 3333 Susan Street 36 * Costa Mesa, CA 92626 37 */ 38 |
39 40 | |
41/* $FreeBSD$ */ 42 | 39/* $FreeBSD$ */ 40 |
43 | |
44#include "oce_if.h" 45 46/***************************************************** 47 * local queue functions 48 *****************************************************/ 49 50static struct oce_wq *oce_wq_init(POCE_SOFTC sc, 51 uint32_t q_len, uint32_t wq_type); --- 596 unchanged lines hidden (view full) --- 648 * @param eq the EQ to associate with the MQ for event notification 649 * @param q_len the number of entries to create in the MQ 650 * @returns pointer to the created MQ, failure otherwise 651 */ 652static struct oce_mq * 653oce_mq_create(POCE_SOFTC sc, struct oce_eq *eq, uint32_t q_len) 654{ 655 struct oce_mbx mbx; | 41#include "oce_if.h" 42 43/***************************************************** 44 * local queue functions 45 *****************************************************/ 46 47static struct oce_wq *oce_wq_init(POCE_SOFTC sc, 48 uint32_t q_len, uint32_t wq_type); --- 596 unchanged lines hidden (view full) --- 645 * @param eq the EQ to associate with the MQ for event notification 646 * @param q_len the number of entries to create in the MQ 647 * @returns pointer to the created MQ, failure otherwise 648 */ 649static struct oce_mq * 650oce_mq_create(POCE_SOFTC sc, struct oce_eq *eq, uint32_t q_len) 651{ 652 struct oce_mbx mbx; |
656 struct mbx_create_common_mq *fwcmd = NULL; | 653 struct mbx_create_common_mq_ex *fwcmd = NULL; |
657 struct oce_mq *mq = NULL; 658 int rc = 0; 659 struct oce_cq *cq; | 654 struct oce_mq *mq = NULL; 655 int rc = 0; 656 struct oce_cq *cq; |
660 oce_mq_ctx_t *ctx; | 657 oce_mq_ext_ctx_t *ctx; |
661 uint32_t num_pages; 662 uint32_t page_size; 663 uint32_t version; 664 665 666 cq = oce_cq_create(sc, eq, CQ_LEN_256, 667 sizeof(struct oce_mq_cqe), 1, 1, 0, 0); 668 if (!cq) --- 9 unchanged lines hidden (view full) --- 678 mq->parent = sc; 679 680 mq->ring = oce_create_ring_buffer(sc, q_len, sizeof(struct oce_mbx)); 681 if (!mq->ring) 682 goto error; 683 684 bzero(&mbx, sizeof(struct oce_mbx)); 685 | 658 uint32_t num_pages; 659 uint32_t page_size; 660 uint32_t version; 661 662 663 cq = oce_cq_create(sc, eq, CQ_LEN_256, 664 sizeof(struct oce_mq_cqe), 1, 1, 0, 0); 665 if (!cq) --- 9 unchanged lines hidden (view full) --- 675 mq->parent = sc; 676 677 mq->ring = oce_create_ring_buffer(sc, q_len, sizeof(struct oce_mbx)); 678 if (!mq->ring) 679 goto error; 680 681 bzero(&mbx, sizeof(struct oce_mbx)); 682 |
686 fwcmd = (struct mbx_create_common_mq *)&mbx.payload; | 683 fwcmd = (struct mbx_create_common_mq_ex *)&mbx.payload; |
687 version = OCE_MBX_VER_V0; 688 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0, 689 MBX_SUBSYSTEM_COMMON, | 684 version = OCE_MBX_VER_V0; 685 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0, 686 MBX_SUBSYSTEM_COMMON, |
690 OPCODE_COMMON_CREATE_MQ, | 687 OPCODE_COMMON_CREATE_MQ_EXT, |
691 MBX_TIMEOUT_SEC, | 688 MBX_TIMEOUT_SEC, |
692 sizeof(struct mbx_create_common_mq), | 689 sizeof(struct mbx_create_common_mq_ex), |
693 version); 694 695 num_pages = oce_page_list(mq->ring, &fwcmd->params.req.pages[0]); 696 page_size = mq->ring->num_items * mq->ring->item_size; 697 698 ctx = &fwcmd->params.req.context; 699 ctx->v0.num_pages = num_pages; 700 ctx->v0.cq_id = cq->cq_id; 701 ctx->v0.ring_size = OCE_LOG2(q_len) + 1; 702 ctx->v0.valid = 1; | 690 version); 691 692 num_pages = oce_page_list(mq->ring, &fwcmd->params.req.pages[0]); 693 page_size = mq->ring->num_items * mq->ring->item_size; 694 695 ctx = &fwcmd->params.req.context; 696 ctx->v0.num_pages = num_pages; 697 ctx->v0.cq_id = cq->cq_id; 698 ctx->v0.ring_size = OCE_LOG2(q_len) + 1; 699 ctx->v0.valid = 1; |
700 /* Subscribe to Link State and Group 5 Events(bits 1 and 5 set) */ 701 ctx->v0.async_evt_bitmap = 0xffffffff; |
|
703 704 mbx.u0.s.embedded = 1; | 702 703 mbx.u0.s.embedded = 1; |
705 mbx.payload_length = sizeof(struct mbx_create_common_mq); | 704 mbx.payload_length = sizeof(struct mbx_create_common_mq_ex); |
706 DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ); 707 708 rc = oce_mbox_post(sc, &mbx, NULL); 709 if (rc) 710 goto error; 711 712 mq->mq_id = LE_16(fwcmd->params.rsp.mq_id); 713 mq->cq = cq; --- 500 unchanged lines hidden --- | 705 DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ); 706 707 rc = oce_mbox_post(sc, &mbx, NULL); 708 if (rc) 709 goto error; 710 711 mq->mq_id = LE_16(fwcmd->params.rsp.mq_id); 712 mq->cq = cq; --- 500 unchanged lines hidden --- |