[U-Boot] [PATCH 18/28] net: Add NetUpdateEther() to handle ARP or Ping replies (VLAN or SNAP)

Joe Hershberger joe.hershberger at gmail.com
Fri Feb 10 01:36:23 CET 2012


Hi Mike,

On Fri, Feb 3, 2012 at 6:25 AM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Thursday 19 January 2012 19:53:21 Joe Hershberger wrote:
>> --- a/net/net.c
>> +++ b/net/net.c
>>
>> +int
>> +NetUpdateEther(struct Ethernet_t *et, uchar *addr, uint prot)
>> +{
>> +     ushort protlen;
>> +
>> +     memcpy(et->et_dest, addr, 6);
>> +     memcpy(et->et_src, NetOurEther, 6);
>> +     protlen = ntohs(et->et_protlen);
>> +     if (protlen == PROT_VLAN) {
>> +             struct VLAN_Ethernet_t *vet = (struct VLAN_Ethernet_t *)et;
>> +             vet->vet_type = htons(prot);
>> +             return VLAN_ETHER_HDR_SIZE;
>> +     } else if (protlen > 1514) {
>> +             et->et_protlen = htons(prot);
>> +             return ETHER_HDR_SIZE;
>> +     } else {
>> +             /* 802.2 + SNAP */
>> +             et->et_prot = htons(prot);
>> +             return E802_HDR_SIZE;
>> +     }
>> +}
>
> seems to overlap a bit with NetSetEther.  can't you have one use the other ?

I don't see a very clean way ATM.  Maybe some future refactoring will
make that more obvious.

-Joe


More information about the U-Boot mailing list