/* Similar to pbuf_header(-size) but de-refs header pbufs for (size >= p->len) */
struct pbuf* pbuf_free_header(struct pbuf *q, u16_t size)
/* Similar to pbuf_header(-size) but de-refs header pbufs for (size >= p->len) */
struct pbuf* pbuf_free_header(struct pbuf *q, u16_t size)
{
  struct pbuf *p = q;
  u16_t free_left = size;
  while (free_left && p) {
    if (free_left >= p->len) {
      struct pbuf *f = p;
      free_left = (u16_t)(free_left - p->len);
      p = p->next;
      f->next = 0;
      pbuf_free(f);
    } else {
      pbuf_remove_header(p, free_left);
      free_left = 0;
    }
  }
  return p;
}