Merge
authorpravin@inf.ethz.ch <pravin@inf.ethz.ch>
Sun, 13 Nov 2011 15:49:56 +0000 (16:49 +0100)
committerpravin@inf.ethz.ch <pravin@inf.ethz.ch>
Sun, 13 Nov 2011 15:49:56 +0000 (16:49 +0100)
1  2 
errors/errno.fugu
hake/Config.hs.template
hake/symbolic_targets.mk
if/netd.if
lib/barrelfish/Hakefile
lib/barrelfish/ram_alloc.c
lib/barrelfish/vspace/mmu_aware.c
lib/lwip/src/core/ipv4/icmp.c
lib/posixcompat/select.c
usr/drivers/rtl8029/rtl8029.c
usr/fish/Hakefile

Simple merge
Simple merge
@@@ -139,8 -137,11 +139,12 @@@ MODULES_x86_64= 
        sbin/timer_test \
        sbin/net_openport_test \
        sbin/examples/xmpl-perfmon \
+       sbin/routing_setup \
+       sbin/multihoptest \
+       sbin/multihop_latency_bench \
+       sbin/cryptotest \
        $(BIN_CONSENSUS) \
 +      sbin/bcached \
  
  # the following are broken in the newidc system
  MODULES_x86_64_broken= \
diff --cc if/netd.if
Simple merge
Simple merge
@@@ -109,20 -106,25 +109,34 @@@ errval_t ram_alloc(struct capref *ret, 
  {
      struct ram_alloc_state *ram_alloc_state = get_ram_alloc_state();
      assert(ram_alloc_state->ram_alloc_func != NULL);
 -    return ram_alloc_state->
 +    errval_t err = ram_alloc_state->
          ram_alloc_func(ret, size_bits, ram_alloc_state->default_minbase,
                         ram_alloc_state->default_maxlimit);
 +    if(err_is_fail(err)) {
 +      DEBUG_ERR(err, "ram_alloc");
 +      printf("callstack: %p %p %p %p\n",
 +           __builtin_return_address(0),
 +           __builtin_return_address(1),
 +           __builtin_return_address(2),
 +           __builtin_return_address(3));
 +    }
 +    return err;
  }
  
+ errval_t ram_available(genpaddr_t *available, genpaddr_t *total)
+ {
+     errval_t err;
+     struct mem_rpc_client *mc = get_mem_client();
+     err = mc->vtbl.available(mc, available, total);
+     if(err_is_fail(err)) {
+         USER_PANIC_ERR(err, "available");
+     }
+     return SYS_ERR_OK;
+ }
  static void bind_continuation(void *st, errval_t err, struct mem_binding *b)
  {
      struct ram_alloc_state *ram_alloc_state = st;
@@@ -203,33 -206,37 +206,38 @@@ errval_t vspace_mmu_aware_unmap(struct 
      assert(vspace_lvaddr_to_genvaddr(base) > vregion_get_base_addr(&state->vregion));
      assert(base + bytes == (lvaddr_t)eaddr);
  
-     do {
-         // Unmap and return (via unfill) frames from base
-         err = state->memobj.m.f.unfill(&state->memobj.m, gen_base,
-                                        &frame, &offset);
-         if(err_is_fail(err) && err_no(err) != LIB_ERR_MEMOBJ_UNFILL_TOO_HIGH_OFFSET) {
-             return err_push(err, LIB_ERR_MEMOBJ_UNMAP_REGION);
-         }
-         // Delete frame cap
-         if(err_is_ok(err)) {
-             success = true;
-             if (min_offset == 0 || min_offset > offset) {
-                 min_offset = offset;
+     // Reduce offset
+     state->offset -= bytes;
+     state->consumed -= bytes;
+     // Free only in bigger blocks
+     if(state->mapoffset - state->offset > MIN_MEM_FOR_FREE) {
+         do {
+             // Unmap and return (via unfill) frames from base
+             err = state->memobj.m.f.unfill(&state->memobj.m, gen_base,
+                                            &frame, &offset);
+             if(err_is_fail(err) && err_no(err) != LIB_ERR_MEMOBJ_UNFILL_TOO_HIGH_OFFSET) {
+                 return err_push(err, LIB_ERR_MEMOBJ_UNMAP_REGION);
              }
  
-             err = cap_destroy(frame);
-             if(err_is_fail(err)) {
-                 return err;
+             // Delete frame cap
+             if(err_is_ok(err)) {
+                 success = true;
+                 if (min_offset == 0 || min_offset > offset) {
+                     min_offset = offset;
+                 }
+                 err = cap_destroy(frame);
+                 if(err_is_fail(err)) {
+                     return err;
+                 }
              }
-         }
-     } while(err != LIB_ERR_MEMOBJ_UNFILL_TOO_HIGH_OFFSET);
+         } while(err != LIB_ERR_MEMOBJ_UNFILL_TOO_HIGH_OFFSET);
  
-     // Reduce offset
-     state->offset -= bytes;
 +//    state->consumed -= bytes;
-     if (success) {
-         state->mapoffset = min_offset;
+         if (success) {
+             state->mapoffset = min_offset;
+         }
      }
  
      return SYS_ERR_OK;
@@@ -331,57 -314,50 +331,56 @@@ void icmp_time_exceeded(struct pbuf *p
   * @param type Type of the ICMP header
   * @param code Code of the ICMP header
   */
 -static void
 -icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
 +static void icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
  {
 -  struct pbuf *q;
 -  struct ip_hdr *iphdr;
 -  /* we can use the echo header here */
 -  struct icmp_echo_hdr *icmphdr;
 -
 -  /* ICMP header + IP header + 8 bytes of data */
 -  q = pbuf_alloc(PBUF_IP, sizeof(struct icmp_echo_hdr) + IP_HLEN + ICMP_DEST_UNREACH_DATASIZE, PBUF_RAM);
 -  if (q == NULL) {
 -    LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded: failed to allocate pbuf for ICMP packet.\n"));
 -    return;
 -  }
 -  LWIP_ASSERT("check that first pbuf can hold icmp message",
 -             (q->len >= (sizeof(struct icmp_echo_hdr) + IP_HLEN + ICMP_DEST_UNREACH_DATASIZE)));
 -
 -  iphdr = p->payload;
 -  LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from "));
 -  ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src));
 -  LWIP_DEBUGF(ICMP_DEBUG, (" to "));
 -  ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest));
 -  LWIP_DEBUGF(ICMP_DEBUG, ("\n"));
 -
 -  icmphdr = q->payload;
 -  icmphdr->type = type;
 -  icmphdr->code = code;
 -  icmphdr->id = 0;
 -  icmphdr->seqno = 0;
 -
 -  /* copy fields from original packet */
 -  SMEMCPY((u8_t *)q->payload + sizeof(struct icmp_echo_hdr), (u8_t *)p->payload,
 -          IP_HLEN + ICMP_DEST_UNREACH_DATASIZE);
 -
 -  /* calculate checksum */
 -  icmphdr->chksum = 0;
 -  icmphdr->chksum = inet_chksum(icmphdr, q->len);
 -  ICMP_STATS_INC(icmp.xmit);
 -  /* increase number of messages attempted to send */
 -  snmp_inc_icmpoutmsgs();
 -  /* increase number of destination unreachable messages attempted to send */
 -  snmp_inc_icmpouttimeexcds();
 -  ip_output(q, NULL, &(iphdr->src), ICMP_TTL, 0, IP_PROTO_ICMP);
 -  pbuf_free(q);
 +    struct pbuf *q;
 +    struct ip_hdr *iphdr;
 +
 +    /* we can use the echo header here */
 +    struct icmp_echo_hdr *icmphdr;
 +
 +    /* ICMP header + IP header + 8 bytes of data */
 +    q =
 +      pbuf_alloc(PBUF_IP,
 +                 sizeof(struct icmp_echo_hdr) + IP_HLEN +
 +                 ICMP_DEST_UNREACH_DATASIZE, PBUF_RAM);
 +    if (q == NULL) {
 +        LWIP_DEBUGF(ICMP_DEBUG,
 +                    ("icmp_time_exceeded: failed to allocate pbuf for ICMP packet.\n"));
 +        return;
 +    }
 +    LWIP_ASSERT("check that first pbuf can hold icmp message",
 +                (q->len >=
 +                 (sizeof(struct icmp_echo_hdr) + IP_HLEN +
 +                  ICMP_DEST_UNREACH_DATASIZE)));
 +
 +    iphdr = p->payload;
 +    LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from "));
 +    ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src));
 +    LWIP_DEBUGF(ICMP_DEBUG, (" to "));
 +    ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest));
 +    LWIP_DEBUGF(ICMP_DEBUG, ("\n"));
 +
 +    icmphdr = q->payload;
 +    icmphdr->type = type;
 +    icmphdr->code = code;
 +    icmphdr->id = 0;
 +    icmphdr->seqno = 0;
 +
 +    /* copy fields from original packet */
 +    SMEMCPY((u8_t *) q->payload + sizeof(struct icmp_echo_hdr),
 +            (u8_t *) p->payload, IP_HLEN + ICMP_DEST_UNREACH_DATASIZE);
 +
 +    /* calculate checksum */
 +    icmphdr->chksum = 0;
 +    icmphdr->chksum = inet_chksum(icmphdr, q->len);
 +    ICMP_STATS_INC(icmp.xmit);
 +    /* increase number of messages attempted to send */
 +    snmp_inc_icmpoutmsgs();
 +    /* increase number of destination unreachable messages attempted to send */
-     printf("Trying to send ICMP response back\n");
 +    snmp_inc_icmpouttimeexcds();
 +    ip_output(q, NULL, &(iphdr->src), ICMP_TTL, 0, IP_PROTO_ICMP);
 +    pbuf_free(q);
  }
  
 -#endif /* LWIP_ICMP */
 +#endif                          /* LWIP_ICMP */
@@@ -29,9 -29,8 +29,9 @@@ static void timeout_fired(void *arg
    struct timeout_event *toe = arg;
    assert(toe != NULL);
    toe->fired = true;
-   /* printf("%d: select() timeout fired\n", disp_get_domain_id()); */
  }
  
++
  int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
             struct timeval *timeout)
  {
Simple merge
  
  [ build application { target = "fish",
                      cFiles = [ "fish.c", "font.c" ],
 -                    addLibraries = [ "vfs", "nfs", "lwip", "contmng",
 -                                       "pci", "trace", "skb" ],
 +                    addLibraries = [ "vfs", "nfs", "lwip",
 +                      "contmng", "procon", "pci", "trace", "skb" ],
-                     flounderBindings = [ "pixels" ],
-                     flounderExtraBindings = [ ("spawn", ["rpcclient"]),
-                                                 ("mem", ["rpcclient"]) ]
+                     flounderBindings = [ "pixels" ]
                      }
  ]