kern/105054: [vge] [patch] vge driver sends VLAN IDs in wrong endian.

Yo Its Me Remember yoitsmeremember at yahoo.com
Thu Nov 2 21:50:31 UTC 2006


The following reply was made to PR kern/105054; it has been noted by GNATS.

From: Yo Its Me Remember <yoitsmeremember at yahoo.com>
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: kern/105054: [vge] [patch] vge driver sends VLAN IDs in wrong endian.
Date: Thu, 2 Nov 2006 13:43:34 -0800 (PST)

 --0-15573433-1162503814=:18302
 Content-Type: text/plain; charset=iso-8859-1
 Content-Transfer-Encoding: 8bit
 
 Yeah, I thought it was pretty strange too, but it's up and running with my patch.  However, now that i think about it, htole16() shouldn't be there, since we're doing bitwise OR we should just leave them both in their native endians and then let the htole32() convert the final product to the correct (little) endian.  Only affects big-endian systems, but would end up causing the same bug that we're trying to fix on them.  Coinsidentally, the original code would work fine on big-endian systems. ;)
 
 If no one on the FBSD team has a vge card, I'd be more than happy to donate money to buy one (they're ~$15 shipped).  Or perhaps we could ask VIA for details...
 
 The final patch that I have working (and should work for big-endian systems) looks like this:
 
 
 *** 1819,1825 ****
          mtag = VLAN_OUTPUT_TAG(sc->vge_ifp, m_head);
          if (mtag != NULL)
                  sc->vge_ldata.vge_tx_list[idx].vge_ctl |=
 !                    htole32(htons(VLAN_TAG_VALUE(mtag)) | VGE_TDCTL_VTAG);
          sc->vge_ldata.vge_tx_list[idx].vge_sts |= htole32(VGE_TDSTS_OWN);
 --- 1819,1825 ----
          mtag = VLAN_OUTPUT_TAG(sc->vge_ifp, m_head);
          if (mtag != NULL)
                  sc->vge_ldata.vge_tx_list[idx].vge_ctl |=
 !                    htole32(VLAN_TAG_VALUE(mtag) | VGE_TDCTL_VTAG);
          sc->vge_ldata.vge_tx_list[idx].vge_sts |= htole32(VGE_TDSTS_OWN);
 ...looks similar for HEAD, just strip out that one htons() on that line.
 
 Thanks,
 Ian
 
  
 ---------------------------------
 Low, Low, Low Rates! Check out Yahoo! Messenger's cheap  PC-to-Phone call rates.
 --0-15573433-1162503814=:18302
 Content-Type: text/html; charset=iso-8859-1
 Content-Transfer-Encoding: 8bit
 
 Yeah, I thought it was pretty strange too, but it's up and running with my patch.&nbsp; However, now that i think about it, htole16() shouldn't be there, since we're doing bitwise OR we should just leave them both in their native endians and then let the htole32() convert the final product to the correct (little) endian.&nbsp; Only affects big-endian systems, but would end up causing the same bug that we're trying to fix on them.&nbsp; Coinsidentally, the original code would work fine on big-endian systems . ;)<br><br>If no one on the FBSD team has a vge card, I'd be more than happy to donate money to buy one (they're ~$15 shipped).&nbsp; Or perhaps we could ask VIA for details...<br><br>The final patch that I have working (and should work for big-endian systems) looks like this:<br><br><pre><span class="patch_revinfo">*** 1819,1825 ****</span><br>         mtag = VLAN_OUTPUT_TAG(sc-&gt;vge_ifp, m_head);<br>         if (mtag != NULL)<br>                
  sc-&gt;vge_ldata.vge_tx_list[idx].vge_ctl |=<br><span class="patch_contextline">!                    htole32(htons(VLAN_TAG_VALUE(mtag)) | VGE_TDCTL_VTAG);</span><br>         sc-&gt;vge_ldata.vge_tx_list[idx].vge_sts |= htole32(VGE_TDSTS_OWN);<br><span class="patch_revinfo">--- 1819,1825 ----</span><br>         mtag = VLAN_OUTPUT_TAG(sc-&gt;vge_ifp, m_head);<br>         if (mtag != NULL)<br>                 sc-&gt;vge_ldata.vge_tx_list[idx].vge_ctl |=<br><span class="patch_contextline">!                     htole32(VLAN_TAG_VALUE(mtag) | VGE_TDCTL_VTAG);</span><br>         sc-&gt;vge_ldata.vge_tx_list[idx].vge_sts |= htole32(VGE_TDSTS_OWN);</pre>...looks similar for HEAD, just strip out that one htons() on that line.<br><br>Thanks,<br>Ian<br><p>&#32;
 
 <hr size=1>Low, Low, Low Rates! Check out Yahoo! Messenger's cheap <a href="http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com"> PC-to-Phone call rates.</a>
 
 --0-15573433-1162503814=:18302--


More information about the freebsd-bugs mailing list