On Sun, Dec 28, 2014 at 08:00:57PM +1000, David Gwynne wrote:
> 
> > On 27 Dec 2014, at 6:09 pm, Kapetanakis Giannis <bil...@edu.physics.uoc.gr> 
> > wrote:
> > 
> > On 27/12/14 10:05, Kapetanakis Giannis wrote:
> >> On 26/12/14 12:23, Kapetanakis Giannis wrote:
> >>> Hi,
> >>> 
> >>> Any ideas on this? I'm getting at least one panic every day.
> >>> 
> >>> G
> >>> 
> >>> On 24/12/14 06:13, Kapetanakis Giannis wrote:
> >>>> Today I've installed a 10Gb adapter and upgraded to latest snapshot.
> >>>> I've had a crash...
> >>>> 
> >>>> Machine is a Fujitsu RX300 S6 and the adapter is an Intel X520 SR1
> >>>> 
> >>>> G
> >>>> 
> >>>> ddb{0}> trace
> >>>> ixgbe_tx_ctx_setup(d4164980,d919df00,f55a0e5c,f55a0e60,4) at 
> >>>> ixgbe_tx_ctx_setup
> >>>> +0x11a
> >>>> ixgbe_encap(d4164980,d919df00,0,1000,a) at ixgbe_encap+0x16a
> >>>> ixgbe_start(d4376030,d424f2c0,1,f55a0ed4,d43ac320) at ixgbe_start+0xa7
> >>>> nettxintr(0,50,0,f55a0f08,d055e282) at nettxintr+0x47
> >>>> softintr_dispatch(1) at softintr_dispatch+0x5a
> >>>> Xsoftnet() at Xsoftnet+0x17
> >>>> --- interrupt ---
> >>>> cpu_idle_cycle(d0c54a00) at cpu_idle_cycle+0xf
> >>>> Bad frame pointer: 0xd0d1ee58
> >> 
> >> I'm still getting the crash at the same point.
> >> I've followed http://www.benzedrine.cx/crashreport.html
> >> and I have managed to trace it to line 2114 of revision 1.113
> >> 
> >>  2107          /* Set the ether header length */
> >>  2108          vlan_macip_lens |= ehdrlen << IXGBE_ADVTXD_MACLEN_SHIFT;
> >>  2109
> >>  2110          switch (etype) {
> >>  2111          case ETHERTYPE_IP:
> >>  2112                  ip = (struct ip *)(mp->m_data + ehdrlen);
> >>  2113                  ip_hlen = ip->ip_hl << 2;
> >>>> 2114                  ipproto = ip->ip_p;
> >>  2115                  type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4;
> >>  2116                  break;
> >> 
> >> I've also tried to revert back to older revisions of if_ix.c (until 1.108) 
> >> with no luck.
> >> I will continue a bit more to see if anything changes.
> >> 
> >> regards,
> >> 
> >> Giannis
> > 
> > Just to add that I'm running vlan 802.1q trunk on this interface.
> 
> thats pretty cool.
> 
> what kind of traffic are you sending on this interface? is it forwarded 
> traffic or locally generated?
> 
> cheers,
> dlg

can you try this diff? it should apply with a little fuzz.

Index: if_ix.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_ix.c,v
retrieving revision 1.113
diff -u -p -r1.113 if_ix.c
--- if_ix.c     22 Dec 2014 02:28:52 -0000      1.113
+++ if_ix.c     28 Dec 2014 11:53:00 -0000
@@ -2035,14 +2049,13 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
        struct ix_softc *sc = txr->sc;
        struct ixgbe_adv_tx_context_desc *TXD;
        struct ixgbe_tx_buf *tx_buffer;
+       struct ether_header eh;
 #if NVLAN > 0
-       struct ether_vlan_header *eh;
-#else
-       struct ether_header *eh;
+       struct ether_vlan_header evh;
 #endif
-       struct ip *ip;
+       struct ip ip;
 #ifdef notyet
-       struct ip6_hdr *ip6;
+       struct ip6_hdr ip6;
 #endif
        uint32_t vlan_macip_lens = 0, type_tucmd_mlhl = 0;
        int     ehdrlen, ip_hlen = 0;
@@ -2089,19 +2102,21 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
         * Jump over vlan headers if already present,
         * helpful for QinQ too.
         */
+       if (mp->m_pkthdr.len < sizeof(eh))
+               return (1);
+
+       m_copydata(mp, 0, sizeof(eh), (caddr_t)&eh);
+       etype = ntohs(eh.ether_type);
+       ehdrlen = ETHER_HDR_LEN;
 #if NVLAN > 0
-       eh = mtod(mp, struct ether_vlan_header *);
-       if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) {
-               etype = ntohs(eh->evl_proto);
-               ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
-       } else {
-               etype = ntohs(eh->evl_encap_proto);
-               ehdrlen = ETHER_HDR_LEN;
+       if (etype == htons(ETHERTYPE_VLAN)) {
+               if (mp->m_pkthdr.len < sizeof(evh))
+                       return (1);
+
+               m_copydata(mp, 0, sizeof(evh), (caddr_t)&evh);
+               etype = ntohs(evh.evl_proto);
+               ehdrlen = sizeof(evh);
        }
-#else
-       eh = mtod(mp, struct ether_header *);
-       etype = ntohs(eh->ether_type);
-       ehdrlen = ETHER_HDR_LEN;
 #endif
 
        /* Set the ether header length */
@@ -2109,17 +2124,23 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
 
        switch (etype) {
        case ETHERTYPE_IP:
-               ip = (struct ip *)(mp->m_data + ehdrlen);
-               ip_hlen = ip->ip_hl << 2;
-               ipproto = ip->ip_p;
+               if (mp->m_pkthdr.len < ehdrlen + sizeof(ip))
+                       return (1);
+
+               m_copydata(mp, ehdrlen, sizeof(ip), (caddr_t)&ip);
+               ip_hlen = ip.ip_hl << 2;
+               ipproto = ip.ip_p;
                type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4;
                break;
 #ifdef notyet
        case ETHERTYPE_IPV6:
-               ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen);
-               ip_hlen = sizeof(struct ip6_hdr);
+               if (mp->m_pkthdr.len < ehdrlen + sizeof(ip6))
+                       return (1);
+
+               m_copydata(mp, ehdrlen, sizeof(ip6), (caddr_t)&ip6);
+               ip_hlen = sizeof(ip6);
                /* XXX-BZ this will go badly in case of ext hdrs. */
-               ipproto = ip6->ip6_nxt;
+               ipproto = ip6.ip6_nxt;
                type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV6;
                break;
 #endif

Reply via email to