smsc95xx.c (2e0c17d100c35e843dac1e99daf19b5e2b3fe168) smsc95xx.c (11bc3088373e913f165a8652601c6f8b8dc4aea2)
1 /***************************************************************************
2 *
3 * Copyright (C) 2007-2008 SMSC
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.

--- 1175 unchanged lines hidden (view full) ---

1184 overhead, 0, flags);
1185 dev_kfree_skb_any(skb);
1186 skb = skb2;
1187 if (!skb)
1188 return NULL;
1189 }
1190
1191 if (csum) {
1 /***************************************************************************
2 *
3 * Copyright (C) 2007-2008 SMSC
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.

--- 1175 unchanged lines hidden (view full) ---

1184 overhead, 0, flags);
1185 dev_kfree_skb_any(skb);
1186 skb = skb2;
1187 if (!skb)
1188 return NULL;
1189 }
1190
1191 if (csum) {
1192 u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
1193 skb_push(skb, 4);
1194 memcpy(skb->data, &csum_preamble, 4);
1192 if (skb->len <= 45) {
1193 /* workaround - hardware tx checksum does not work
1194 * properly with extremely small packets */
1195 long csstart = skb->csum_start - skb_headroom(skb);
1196 __wsum calc = csum_partial(skb->data + csstart,
1197 skb->len - csstart, 0);
1198 *((__sum16 *)(skb->data + csstart
1199 + skb->csum_offset)) = csum_fold(calc);
1200
1201 csum = false;
1202 } else {
1203 u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
1204 skb_push(skb, 4);
1205 memcpy(skb->data, &csum_preamble, 4);
1206 }
1195 }
1196
1197 skb_push(skb, 4);
1198 tx_cmd_b = (u32)(skb->len - 4);
1199 if (csum)
1200 tx_cmd_b |= TX_CMD_B_CSUM_ENABLE;
1201 cpu_to_le32s(&tx_cmd_b);
1202 memcpy(skb->data, &tx_cmd_b, 4);

--- 127 unchanged lines hidden ---
1207 }
1208
1209 skb_push(skb, 4);
1210 tx_cmd_b = (u32)(skb->len - 4);
1211 if (csum)
1212 tx_cmd_b |= TX_CMD_B_CSUM_ENABLE;
1213 cpu_to_le32s(&tx_cmd_b);
1214 memcpy(skb->data, &tx_cmd_b, 4);

--- 127 unchanged lines hidden ---