Ver código fonte

qcacld-3.0: Serialize the LRO manager array access

Serialize the LRO descriptor list modifications.

Change-Id: Ie40ccf274e6e44441a16ff3d6f36a3007b732c09
CRs-Fixed: 1056091
Manjunathappa Prakash 8 anos atrás
pai
commit
b4ae4ab7b0
2 arquivos alterados com 15 adições e 10 exclusões
  1. 1 1
      core/hdd/inc/wlan_hdd_lro.h
  2. 14 9
      core/hdd/src/wlan_hdd_lro.c

+ 1 - 1
core/hdd/inc/wlan_hdd_lro.h

@@ -101,7 +101,7 @@ struct hdd_lro_desc_info {
  * hdd_lro_s - LRO information per HDD adapter
  * @lro_mgr: LRO manager
  * @lro_desc_info: LRO descriptor information
- * @lroi_mgr_arr_access_lock: Lock to access LRO manager array.
+ * @lro_mgr_arr_access_lock: Lock to access LRO manager array.
  */
 struct hdd_lro_s {
 	struct net_lro_mgr *lro_mgr;

+ 14 - 9
core/hdd/src/wlan_hdd_lro.c

@@ -419,11 +419,10 @@ void hdd_lro_flush_pkt(struct net_lro_mgr *lro_mgr,
 
 	lro_desc = hdd_lro_get_desc(lro_mgr, lro_mgr->lro_arr, iph, tcph);
 
-	if (!lro_desc)
-		return;
-
-	hdd_lro_desc_free(lro_desc, adapter);
-	lro_flush_desc(lro_mgr, lro_desc);
+	if (lro_desc) {
+		hdd_lro_desc_free(lro_desc, adapter);
+		lro_flush_desc(lro_mgr, lro_desc);
+	}
 }
 
 /**
@@ -438,10 +437,10 @@ void hdd_lro_flush_pkt(struct net_lro_mgr *lro_mgr,
 void hdd_lro_flush(void *data)
 {
 	hdd_adapter_t *adapter = (hdd_adapter_t *)data;
-	struct hdd_lro_s *hdd_info = &adapter->lro_info;
+	struct hdd_lro_s *hdd_lro = &adapter->lro_info;
 	int i;
 
-	qdf_spin_lock_bh(&hdd_info->lro_mgr_arr_access_lock);
+	qdf_spin_lock_bh(&hdd_lro->lro_mgr_arr_access_lock);
 	for (i = 0; i < adapter->lro_info.lro_mgr->max_desc; i++) {
 		if (adapter->lro_info.lro_mgr->lro_arr[i].active) {
 			hdd_lro_desc_free(
@@ -451,7 +450,7 @@ void hdd_lro_flush(void *data)
 				 &adapter->lro_info.lro_mgr->lro_arr[i]);
 		}
 	}
-	qdf_spin_unlock_bh(&hdd_info->lro_mgr_arr_access_lock);
+	qdf_spin_unlock_bh(&hdd_lro->lro_mgr_arr_access_lock);
 }
 
 /**
@@ -634,8 +633,11 @@ enum hdd_lro_rx_status hdd_lro_rx(hdd_context_t *hdd_ctx,
 		struct iphdr *iph;
 		struct tcphdr *tcph;
 		struct net_lro_desc *lro_desc = NULL;
+		struct hdd_lro_s *hdd_lro = &adapter->lro_info;
 		iph = (struct iphdr *)skb->data;
 		tcph = (struct tcphdr *)(skb->data + QDF_NBUF_CB_RX_TCP_OFFSET(skb));
+		qdf_spin_lock_bh(
+			&hdd_lro->lro_mgr_arr_access_lock);
 		if (hdd_lro_eligible(adapter, skb, iph, tcph, &lro_desc)) {
 			struct net_lro_info hdd_lro_info;
 
@@ -652,14 +654,17 @@ enum hdd_lro_rx_status hdd_lro_rx(hdd_context_t *hdd_ctx,
 			lro_receive_skb_ext(adapter->lro_info.lro_mgr, skb,
 				 (void *)adapter, &hdd_lro_info);
 
-			if (!hdd_lro_info.lro_desc->active)
+			if (!hdd_lro_info.lro_desc->active) {
 				hdd_lro_desc_free(lro_desc, adapter);
+			}
 
 			status = HDD_LRO_RX;
 		} else {
 			hdd_lro_flush_pkt(adapter->lro_info.lro_mgr,
 				 iph, tcph, adapter);
 		}
+		qdf_spin_unlock_bh(
+			&hdd_lro->lro_mgr_arr_access_lock);
 	}
 	return status;
 }