RDMA/cxgb3: Support for new abort logic
[powerpc.git] / drivers / net / bnx2.c
index c12e5ea..f98a220 100644 (file)
@@ -54,8 +54,8 @@
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.5.5"
-#define DRV_MODULE_RELDATE     "February 1, 2007"
+#define DRV_MODULE_VERSION     "1.5.8"
+#define DRV_MODULE_RELDATE     "April 24, 2007"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -1884,10 +1884,8 @@ bnx2_rx_int(struct bnx2 *bp, int budget)
                                goto reuse_rx;
 
                        /* aligned copy */
-                       memcpy(new_skb->data,
-                               skb->data + bp->rx_offset - 2,
-                               len + 2);
-
+                       skb_copy_from_linear_data_offset(skb, bp->rx_offset - 2,
+                                     new_skb->data, len + 2);
                        skb_reserve(new_skb, 2);
                        skb_put(new_skb, len);
 
@@ -2033,8 +2031,8 @@ bnx2_has_work(struct bnx2 *bp)
            (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
                return 1;
 
-       if (((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != 0) !=
-           bp->link_up)
+       if ((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) !=
+           (sblk->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE))
                return 1;
 
        return 0;
@@ -3099,20 +3097,18 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
 
        if ((align_start = (offset32 & 3))) {
                offset32 &= ~3;
-               len32 += (4 - align_start);
+               len32 += align_start;
+               if (len32 < 4)
+                       len32 = 4;
                if ((rc = bnx2_nvram_read(bp, offset32, start, 4)))
                        return rc;
        }
 
        if (len32 & 3) {
-               if ((len32 > 4) || !align_start) {
-                       align_end = 4 - (len32 & 3);
-                       len32 += align_end;
-                       if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4,
-                               end, 4))) {
-                               return rc;
-                       }
-               }
+               align_end = 4 - (len32 & 3);
+               len32 += align_end;
+               if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4, end, 4)))
+                       return rc;
        }
 
        if (align_start || align_end) {
@@ -3187,17 +3183,17 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
                if ((rc = bnx2_enable_nvram_write(bp)) != 0)
                        goto nvram_write_end;
 
-               /* Erase the page */
-               if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
-                       goto nvram_write_end;
-
-               /* Re-enable the write again for the actual write */
-               bnx2_enable_nvram_write(bp);
-
                /* Loop to write back the buffer data from page_start to
                 * data_start */
                i = 0;
                if (bp->flash_info->buffered == 0) {
+                       /* Erase the page */
+                       if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
+                               goto nvram_write_end;
+
+                       /* Re-enable the write again for the actual write */
+                       bnx2_enable_nvram_write(bp);
+
                        for (addr = page_start; addr < data_start;
                                addr += 4, i += 4) {
 
@@ -3423,6 +3419,9 @@ bnx2_init_chip(struct bnx2 *bp)
        val = REG_RD(bp, BNX2_MQ_CONFIG);
        val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE;
        val |= BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE_256;
+       if (CHIP_ID(bp) == CHIP_ID_5709_A0 || CHIP_ID(bp) == CHIP_ID_5709_A1)
+               val |= BNX2_MQ_CONFIG_HALT_DIS;
+
        REG_WR(bp, BNX2_MQ_CONFIG, val);
 
        val = 0x10000 + (MAX_CID_CNT * MB_KERNEL_CTX_SIZE);
@@ -4512,6 +4511,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if ((mss = skb_shinfo(skb)->gso_size) &&
                (skb->len > (bp->dev->mtu + ETH_HLEN))) {
                u32 tcp_opt_len, ip_tcp_len;
+               struct iphdr *iph;
 
                if (skb_header_cloned(skb) &&
                    pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
@@ -4519,25 +4519,23 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        return NETDEV_TX_OK;
                }
 
-               tcp_opt_len = ((skb->h.th->doff - 5) * 4);
                vlan_tag_flags |= TX_BD_FLAGS_SW_LSO;
 
                tcp_opt_len = 0;
-               if (skb->h.th->doff > 5) {
-                       tcp_opt_len = (skb->h.th->doff - 5) << 2;
-               }
-               ip_tcp_len = (skb->nh.iph->ihl << 2) + sizeof(struct tcphdr);
-
-               skb->nh.iph->check = 0;
-               skb->nh.iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
-               skb->h.th->check =
-                       ~csum_tcpudp_magic(skb->nh.iph->saddr,
-                                           skb->nh.iph->daddr,
-                                           0, IPPROTO_TCP, 0);
-
-               if (tcp_opt_len || (skb->nh.iph->ihl > 5)) {
-                       vlan_tag_flags |= ((skb->nh.iph->ihl - 5) +
-                               (tcp_opt_len >> 2)) << 8;
+               if (tcp_hdr(skb)->doff > 5)
+                       tcp_opt_len = tcp_optlen(skb);
+
+               ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
+
+               iph = ip_hdr(skb);
+               iph->check = 0;
+               iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
+               tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
+                                                        iph->daddr, 0,
+                                                        IPPROTO_TCP, 0);
+               if (tcp_opt_len || (iph->ihl > 5)) {
+                       vlan_tag_flags |= ((iph->ihl - 5) +
+                                          (tcp_opt_len >> 2)) << 8;
                }
        }
        else