Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 081971b in mainline


Ignore:
Timestamp:
2012-02-13T23:10:29Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
87e5658c
Parents:
2ff150e
Message:

Need to pad short Ethernet frames. Add some more debugging code.

Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ne2k/dp8390.c

    r2ff150e r081971b  
    410410        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
    411411
     412        printf("ne2k_send()\n");
    412413        assert(ne2k->probed);
    413414        assert(ne2k->up);
     
    421422        if ((size < ETH_MIN_PACK_SIZE) || (size > ETH_MAX_PACK_SIZE_TAGGED)) {
    422423                fibril_mutex_unlock(&ne2k->sq_mutex);
     424                printf("ne2k_send() - checks failed size=%zu (min %zu, max %zu)\n",
     425                    size, ETH_MIN_PACK_SIZE, ETH_MAX_PACK_SIZE_TAGGED);
    423426                return;
    424427        }
     428
     429        printf("ne2k_send() - uploading\n");
     430        size_t i;
     431        for (i = 0; i < size; i++)
     432                printf("%02x ", ((uint8_t *)data)[i]);
     433        printf("\n");
    425434
    426435        /* Upload the frame to the ethernet card */
  • uspace/srv/ethip/ethip.c

    r2ff150e r081971b  
    172172
    173173        frame.dest.addr = 0xdeeedeeedeee;
    174         frame.src.addr =  0xaafeedfaceee;
     174        frame.src.addr =  0xaadeadbeeffe;
    175175        frame.etype_len = ETYPE_IP;
    176176        frame.data = sdu->data;
  • uspace/srv/ethip/pdu.c

    r2ff150e r081971b  
    3838#include <errno.h>
    3939#include <io/log.h>
     40#include <macros.h>
    4041#include <mem.h>
    4142#include <stdlib.h>
     
    5758        eth_header_t *hdr;
    5859
    59         size = sizeof(eth_header_t) + frame->size;
     60        size = max(sizeof(eth_header_t) + frame->size, ETH_FRAME_MIN_SIZE);
    6061
    6162        data = calloc(size, 1);
     
    122123
    123124        val = addr->addr;
    124         for (i = 0; i < MAC48_BYTES; i++) {
     125        for (i = 0; i < MAC48_BYTES; i++)
    125126                bbuf[i] = (val >> (8 * (MAC48_BYTES - i - 1))) & 0xff;
    126                 val = val >> 8;
    127         }
    128127}
    129128
  • uspace/srv/ethip/std.h

    r2ff150e r081971b  
    5353#define ETYPE_IP        0x0800
    5454
     55#define ETH_FRAME_MIN_SIZE 60
     56
    5557#endif
    5658
  • uspace/srv/inet/inet_link.c

    r2ff150e r081971b  
    182182        inet_addrobj_t *addr;
    183183
     184        static int first = 1;
    184185        /* XXX For testing: set static IP address 192.168.0.4/24 */
    185186        addr = inet_addrobj_new();
    186         addr->naddr.ipv4 = (192 << 24) + (168 << 16) + (0 << 8) + 4;
     187        if (first) {
     188                addr->naddr.ipv4 = (127 << 24) + (0 << 16) + (0 << 8) + 1;
     189                first = 0;
     190        } else {
     191                addr->naddr.ipv4 = (192 << 24) + (168 << 16) + (0 << 8) + 4;
     192        }
    187193        addr->naddr.bits = 24;
    188194        addr->ilink = ilink;
Note: See TracChangeset for help on using the changeset viewer.