aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_cmds.c
diff options
context:
space:
mode:
authorSomnath Kotur <somnath.kotur@emulex.com>2010-10-21 10:11:14 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-21 10:11:14 -0400
commitcc4ce020935eab2d261b7b8d24a9843b56ad594c (patch)
treedee9344522ade03f3d8e45e1c72845d6176bfedf /drivers/net/benet/be_cmds.c
parente83726b0460f4741c8f10e1488fbcc0a9e5f0b7e (diff)
be2net: Changes to use only priority codes allowed by f/w
Changes to use one of the priority codes allowed by CNA f/w for NIC traffic from host. The driver gets the bit map of the priority codes allowed for host traffic through a asynchronous message from the f/w that the driver subscribes to. Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r--drivers/net/benet/be_cmds.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index bf2dc269de12..1e7f305ed00b 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -96,6 +96,50 @@ static void be_async_link_state_process(struct be_adapter *adapter,
96 evt->port_link_status == ASYNC_EVENT_LINK_UP); 96 evt->port_link_status == ASYNC_EVENT_LINK_UP);
97} 97}
98 98
99/* Grp5 CoS Priority evt */
100static void be_async_grp5_cos_priority_process(struct be_adapter *adapter,
101 struct be_async_event_grp5_cos_priority *evt)
102{
103 if (evt->valid) {
104 adapter->vlan_prio_bmap = evt->available_priority_bmap;
105 adapter->recommended_prio =
106 evt->reco_default_priority << VLAN_PRIO_SHIFT;
107 }
108}
109
110/* Grp5 QOS Speed evt */
111static void be_async_grp5_qos_speed_process(struct be_adapter *adapter,
112 struct be_async_event_grp5_qos_link_speed *evt)
113{
114 if (evt->physical_port == adapter->port_num) {
115 /* qos_link_speed is in units of 10 Mbps */
116 adapter->link_speed = evt->qos_link_speed * 10;
117 }
118}
119
120static void be_async_grp5_evt_process(struct be_adapter *adapter,
121 u32 trailer, struct be_mcc_compl *evt)
122{
123 u8 event_type = 0;
124
125 event_type = (trailer >> ASYNC_TRAILER_EVENT_TYPE_SHIFT) &
126 ASYNC_TRAILER_EVENT_TYPE_MASK;
127
128 switch (event_type) {
129 case ASYNC_EVENT_COS_PRIORITY:
130 be_async_grp5_cos_priority_process(adapter,
131 (struct be_async_event_grp5_cos_priority *)evt);
132 break;
133 case ASYNC_EVENT_QOS_SPEED:
134 be_async_grp5_qos_speed_process(adapter,
135 (struct be_async_event_grp5_qos_link_speed *)evt);
136 break;
137 default:
138 dev_warn(&adapter->pdev->dev, "Unknown grp5 event!\n");
139 break;
140 }
141}
142
99static inline bool is_link_state_evt(u32 trailer) 143static inline bool is_link_state_evt(u32 trailer)
100{ 144{
101 return ((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) & 145 return ((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) &
@@ -103,6 +147,13 @@ static inline bool is_link_state_evt(u32 trailer)
103 ASYNC_EVENT_CODE_LINK_STATE; 147 ASYNC_EVENT_CODE_LINK_STATE;
104} 148}
105 149
150static inline bool is_grp5_evt(u32 trailer)
151{
152 return (((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) &
153 ASYNC_TRAILER_EVENT_CODE_MASK) ==
154 ASYNC_EVENT_CODE_GRP_5);
155}
156
106static struct be_mcc_compl *be_mcc_compl_get(struct be_adapter *adapter) 157static struct be_mcc_compl *be_mcc_compl_get(struct be_adapter *adapter)
107{ 158{
108 struct be_queue_info *mcc_cq = &adapter->mcc_obj.cq; 159 struct be_queue_info *mcc_cq = &adapter->mcc_obj.cq;
@@ -143,6 +194,9 @@ int be_process_mcc(struct be_adapter *adapter, int *status)
143 if (is_link_state_evt(compl->flags)) 194 if (is_link_state_evt(compl->flags))
144 be_async_link_state_process(adapter, 195 be_async_link_state_process(adapter,
145 (struct be_async_event_link_state *) compl); 196 (struct be_async_event_link_state *) compl);
197 else if (is_grp5_evt(compl->flags))
198 be_async_grp5_evt_process(adapter,
199 compl->flags, compl);
146 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { 200 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
147 *status = be_mcc_compl_process(adapter, compl); 201 *status = be_mcc_compl_process(adapter, compl);
148 atomic_dec(&mcc_obj->q.used); 202 atomic_dec(&mcc_obj->q.used);
@@ -677,10 +731,10 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
677 ctxt = &req->context; 731 ctxt = &req->context;
678 732
679 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, 733 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
680 OPCODE_COMMON_MCC_CREATE); 734 OPCODE_COMMON_MCC_CREATE_EXT);
681 735
682 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 736 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
683 OPCODE_COMMON_MCC_CREATE, sizeof(*req)); 737 OPCODE_COMMON_MCC_CREATE_EXT, sizeof(*req));
684 738
685 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); 739 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
686 740
@@ -688,7 +742,8 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
688 AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt, 742 AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt,
689 be_encoded_q_len(mccq->len)); 743 be_encoded_q_len(mccq->len));
690 AMAP_SET_BITS(struct amap_mcc_context, cq_id, ctxt, cq->id); 744 AMAP_SET_BITS(struct amap_mcc_context, cq_id, ctxt, cq->id);
691 745 /* Subscribe to Link State and Group 5 Events(bits 1 and 5 set) */
746 req->async_event_bitmap[0] |= 0x00000022;
692 be_dws_cpu_to_le(ctxt, sizeof(req->context)); 747 be_dws_cpu_to_le(ctxt, sizeof(req->context));
693 748
694 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); 749 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);