iwlwifi: mvm: compare full command ID
authorJohannes Berg <johannes.berg@intel.com>
Thu, 4 Aug 2016 06:57:59 +0000 (08:57 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Mon, 19 Sep 2016 06:14:11 +0000 (09:14 +0300)
When comparing command IDs, the group should be taken
into account so the same command/notification from a
different group doesn't trigger anything unexpected.
Fix this by comparing to the wide ID.

Fixes: commit 1738d60b31d7 ("iwlwifi: mvm: handle RX MPDUs separately")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index 43ea1e5fdfc615683a82c9569b93dcc01b279185..de34c9f4f0f45eec423e2585d35d4775b451ee55 100644 (file)
@@ -966,10 +966,11 @@ static void iwl_mvm_rx(struct iwl_op_mode *op_mode,
 {
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
        struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
+       u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
 
-       if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD))
+       if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD)))
                iwl_mvm_rx_rx_mpdu(mvm, napi, rxb);
-       else if (pkt->hdr.cmd == REPLY_RX_PHY_CMD)
+       else if (cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_PHY_CMD))
                iwl_mvm_rx_rx_phy_cmd(mvm, rxb);
        else
                iwl_mvm_rx_common(mvm, rxb, pkt);
@@ -981,13 +982,14 @@ static void iwl_mvm_rx_mq(struct iwl_op_mode *op_mode,
 {
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
        struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
+       u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
 
-       if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD))
+       if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD)))
                iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, 0);
-       else if (unlikely(pkt->hdr.group_id == DATA_PATH_GROUP &&
-                         pkt->hdr.cmd == RX_QUEUES_NOTIFICATION))
+       else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP,
+                                        RX_QUEUES_NOTIFICATION)))
                iwl_mvm_rx_queue_notif(mvm, rxb, 0);
-       else if (pkt->hdr.cmd == FRAME_RELEASE)
+       else if (cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE))
                iwl_mvm_rx_frame_release(mvm, napi, rxb, 0);
        else
                iwl_mvm_rx_common(mvm, rxb, pkt);
@@ -1666,13 +1668,14 @@ static void iwl_mvm_rx_mq_rss(struct iwl_op_mode *op_mode,
 {
        struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
+       u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
 
-       if (unlikely(pkt->hdr.cmd == FRAME_RELEASE))
+       if (unlikely(cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE)))
                iwl_mvm_rx_frame_release(mvm, napi, rxb, queue);
-       else if (unlikely(pkt->hdr.cmd == RX_QUEUES_NOTIFICATION &&
-                         pkt->hdr.group_id == DATA_PATH_GROUP))
+       else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP,
+                                        RX_QUEUES_NOTIFICATION)))
                iwl_mvm_rx_queue_notif(mvm, rxb, queue);
-       else if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD))
+       else if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD)))
                iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, queue);
 }