iwlwifi: mvm: change iwl_mvm_tx_csum to return value
authorSara Sharon <sara.sharon@intel.com>
Thu, 29 Sep 2016 12:16:03 +0000 (15:16 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 26 Jan 2017 07:38:57 +0000 (09:38 +0200)
Currently the function changes the TX cmd itself.
Make it more generic by returning a value, as preperation
to the new TX cmd.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/tx.c

index 66957ac12ca400d00e9f5b5dcd05b09af02fd4d9..73a90d4a43eb9790389c0be4b1322d7074040299 100644 (file)
@@ -102,14 +102,13 @@ iwl_mvm_bar_check_trigger(struct iwl_mvm *mvm, const u8 *addr,
 #define OPT_HDR(type, skb, off) \
        (type *)(skb_network_header(skb) + (off))
 
-static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
-                           struct ieee80211_hdr *hdr,
-                           struct ieee80211_tx_info *info,
-                           struct iwl_tx_cmd *tx_cmd)
+static u16 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
+                          struct ieee80211_hdr *hdr,
+                          struct ieee80211_tx_info *info)
 {
+       u16 offload_assist = 0;
 #if IS_ENABLED(CONFIG_INET)
        u16 mh_len = ieee80211_hdrlen(hdr->frame_control);
-       u16 offload_assist = le16_to_cpu(tx_cmd->offload_assist);
        u8 protocol = 0;
 
        /*
@@ -117,7 +116,7 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
         * compute it
         */
        if (skb->ip_summed != CHECKSUM_PARTIAL || IWL_MVM_SW_TX_CSUM_OFFLOAD)
-               return;
+               goto out;
 
        /* We do not expect to be requested to csum stuff we do not support */
        if (WARN_ONCE(!(mvm->hw->netdev_features & IWL_TX_CSUM_NETIF_FLAGS) ||
@@ -125,7 +124,7 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
                       skb->protocol != htons(ETH_P_IPV6)),
                      "No support for requested checksum\n")) {
                skb_checksum_help(skb);
-               return;
+               goto out;
        }
 
        if (skb->protocol == htons(ETH_P_IP)) {
@@ -145,7 +144,7 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
                            protocol != NEXTHDR_HOP &&
                            protocol != NEXTHDR_DEST) {
                                skb_checksum_help(skb);
-                               return;
+                               goto out;
                        }
 
                        hp = OPT_HDR(struct ipv6_opt_hdr, skb, off);
@@ -159,7 +158,7 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
        if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP) {
                WARN_ON_ONCE(1);
                skb_checksum_help(skb);
-               return;
+               goto out;
        }
 
        /* enable L4 csum */
@@ -191,8 +190,9 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
        mh_len /= 2;
        offload_assist |= mh_len << TX_CMD_OFFLD_MH_SIZE;
 
-       tx_cmd->offload_assist = cpu_to_le16(offload_assist);
+out:
 #endif
+       return offload_assist;
 }
 
 /*
@@ -295,7 +295,8 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
            !(tx_cmd->offload_assist & cpu_to_le16(BIT(TX_CMD_OFFLD_AMSDU))))
                tx_cmd->offload_assist |= cpu_to_le16(BIT(TX_CMD_OFFLD_PAD));
 
-       iwl_mvm_tx_csum(mvm, skb, hdr, info, tx_cmd);
+       tx_cmd->offload_assist |=
+               cpu_to_le16(iwl_mvm_tx_csum(mvm, skb, hdr, info));
 }
 
 /*