6lowpan: move frame allocation code to a separate function