Deleted Added
sdiff udiff text old ( 231437 ) new ( 231879 )
full compact
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/* $FreeBSD: head/sys/dev/oce/oce_queue.c 231879 2012-02-17 13:55:17Z luigi $ */
40
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;
653 struct mbx_create_common_mq_ex *fwcmd = NULL;
654 struct oce_mq *mq = NULL;
655 int rc = 0;
656 struct oce_cq *cq;
657 oce_mq_ext_ctx_t *ctx;
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
683 fwcmd = (struct mbx_create_common_mq_ex *)&mbx.payload;
684 version = OCE_MBX_VER_V0;
685 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
686 MBX_SUBSYSTEM_COMMON,
687 OPCODE_COMMON_CREATE_MQ_EXT,
688 MBX_TIMEOUT_SEC,
689 sizeof(struct mbx_create_common_mq_ex),
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;
702
703 mbx.u0.s.embedded = 1;
704 mbx.payload_length = sizeof(struct mbx_create_common_mq_ex);
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 ---