[SK_BUFF]: Introduce ip_hdr(), remove skb->nh.iph
[powerpc.git] / drivers / net / ehea / ehea_main.c
index 9de2d38..0dc701e 100644 (file)
@@ -76,7 +76,7 @@ void ehea_dump(void *adr, int len, char *msg) {
        int x;
        unsigned char *deb = adr;
        for (x = 0; x < len; x += 16) {
-               printk(DRV_NAME "%s adr=%p ofs=%04x %016lx %016lx\n", msg,
+               printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg,
                          deb, x, *((u64*)&deb[0]), *((u64*)&deb[8]));
                deb += 16;
        }
@@ -555,6 +555,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
 {
        struct ehea_port *port = param;
        struct ehea_eqe *eqe;
+       struct ehea_qp *qp;
        u32 qp_token;
 
        eqe = ehea_poll_eq(port->qp_eq);
@@ -563,9 +564,14 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
                qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry);
                ehea_error("QP aff_err: entry=0x%lx, token=0x%x",
                           eqe->entry, qp_token);
+
+               qp = port->port_res[qp_token].qp;
+               ehea_error_data(port->adapter, qp->fw_handle);
                eqe = ehea_poll_eq(port->qp_eq);
        }
 
+       queue_work(port->adapter->ehea_wq, &port->reset_task);
+
        return IRQ_HANDLED;
 }
 
@@ -882,7 +888,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
                         , "%s-recv%d", dev->name, i);
                ret = ibmebus_request_irq(NULL, pr->recv_eq->attr.ist1,
                                          ehea_recv_irq_handler,
-                                         SA_INTERRUPT, pr->int_recv_name, pr);
+                                         IRQF_DISABLED, pr->int_recv_name, pr);
                if (ret) {
                        ehea_error("failed registering irq for ehea_recv_int:"
                                   "port_res_nr:%d, ist=%X", i,
@@ -899,7 +905,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
 
        ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1,
                                  ehea_qp_aff_irq_handler,
-                                 SA_INTERRUPT, port->int_aff_name, port);
+                                 IRQF_DISABLED, port->int_aff_name, port);
        if (ret) {
                ehea_error("failed registering irq for qp_aff_irq_handler:"
                           "ist=%X", port->qp_eq->attr.ist1);
@@ -916,7 +922,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
                         "%s-send%d", dev->name, i);
                ret = ibmebus_request_irq(NULL, pr->send_eq->attr.ist1,
                                          ehea_send_irq_handler,
-                                         SA_INTERRUPT, pr->int_send_name,
+                                         IRQF_DISABLED, pr->int_send_name,
                                          pr);
                if (ret) {
                        ehea_error("failed registering irq for ehea_send "
@@ -1256,8 +1262,8 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr)
 static inline void write_ip_start_end(struct ehea_swqe *swqe,
                                      const struct sk_buff *skb)
 {
-       swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data));
-       swqe->ip_end = (u8)(swqe->ip_start + skb->nh.iph->ihl * 4 - 1);
+       swqe->ip_start = skb_network_offset(skb);
+       swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1);
 }
 
 static inline void write_tcp_offset_end(struct ehea_swqe *swqe,
@@ -1294,7 +1300,7 @@ static void write_swqe2_TSO(struct sk_buff *skb,
        /* copy only eth/ip/tcp headers to immediate data and
         * the rest of skb->data to sg1entry
         */
-       headersize = ETH_HLEN + (skb->nh.iph->ihl * 4) + (skb->h.th->doff * 4);
+       headersize = ETH_HLEN + ip_hdrlen(skb) + (skb->h.th->doff * 4);
 
        skb_data_size = skb->len - skb->data_len;
 
@@ -1682,6 +1688,7 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
                       struct ehea_swqe *swqe, u32 lkey)
 {
        if (skb->protocol == htons(ETH_P_IP)) {
+               const struct iphdr *iph = ip_hdr(skb);
                /* IPv4 */
                swqe->tx_control |= EHEA_SWQE_CRC
                                 | EHEA_SWQE_IP_CHECKSUM
@@ -1691,15 +1698,15 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
 
                write_ip_start_end(swqe, skb);
 
-               if (skb->nh.iph->protocol == IPPROTO_UDP) {
-                       if ((skb->nh.iph->frag_off & IP_MF) ||
-                           (skb->nh.iph->frag_off & IP_OFFSET))
+               if (iph->protocol == IPPROTO_UDP) {
+                       if ((iph->frag_off & IP_MF) ||
+                           (iph->frag_off & IP_OFFSET))
                                /* IP fragment, so don't change cs */
                                swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM;
                        else
                                write_udp_offset_end(swqe, skb);
 
-               } else if (skb->nh.iph->protocol == IPPROTO_TCP) {
+               } else if (iph->protocol == IPPROTO_TCP) {
                        write_tcp_offset_end(swqe, skb);
                }
 
@@ -1725,10 +1732,11 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
        int i;
 
        if (skb->protocol == htons(ETH_P_IP)) {
+               const struct iphdr *iph = ip_hdr(skb);
                /* IPv4 */
                write_ip_start_end(swqe, skb);
 
-               if (skb->nh.iph->protocol == IPPROTO_TCP) {
+               if (iph->protocol == IPPROTO_TCP) {
                        swqe->tx_control |= EHEA_SWQE_CRC
                                         | EHEA_SWQE_IP_CHECKSUM
                                         | EHEA_SWQE_TCP_CHECKSUM
@@ -1736,9 +1744,9 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
 
                        write_tcp_offset_end(swqe, skb);
 
-               } else if (skb->nh.iph->protocol == IPPROTO_UDP) {
-                       if ((skb->nh.iph->frag_off & IP_MF) ||
-                           (skb->nh.iph->frag_off & IP_OFFSET))
+               } else if (iph->protocol == IPPROTO_UDP) {
+                       if ((iph->frag_off & IP_MF) ||
+                           (iph->frag_off & IP_OFFSET))
                                /* IP fragment, so don't change cs */
                                swqe->tx_control |= EHEA_SWQE_CRC
                                                 | EHEA_SWQE_IMM_DATA_PRESENT;
@@ -1933,8 +1941,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
        int index;
        u64 hret;
 
-       if (port->vgrp)
-               port->vgrp->vlan_devices[vid] = NULL;
+       vlan_group_set_device(port->vgrp, vid, NULL);
 
        cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
        if (!cb1) {
@@ -2539,7 +2546,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev,
                     (unsigned long)adapter);
 
        ret = ibmebus_request_irq(NULL, adapter->neq->attr.ist1,
-                                 ehea_interrupt_neq, SA_INTERRUPT,
+                                 ehea_interrupt_neq, IRQF_DISABLED,
                                  "ehea_neq", adapter);
        if (ret) {
                dev_err(&dev->ofdev.dev, "requesting NEQ IRQ failed");