 +	bzero(&sskb, sizeof(sskb));
 +	sskb.dev = dev;
 +	sskb.len += buf_len;
-+#ifdef NETMAP_API_4
-+	sskb.truesize = NETMAP_BUF_SIZE - shlen;
-+#else
 +	sskb.truesize = NETMAP_BUF_SIZE(&na->up) - shlen;
-+#endif
 +	sskb.head_frag = 1;
 +	sskb.data = sskb.head = (unsigned char *)buf;
 +	skb_reset_tail_pointer(&sskb);
 +	/* Ensure sskb.end points shinfo */
-+#ifdef NETMAP_API_4
-+	sskb.end = sskb.tail + NETMAP_BUF_SIZE - shlen;
-+#else
 +	sskb.end = sskb.tail + NETMAP_BUF_SIZE(&na->up) - shlen;
-+#endif
 +	sskb.mac_header = (typeof(sskb.mac_header))~0U;
 +	sskb.transport_header = (typeof(skb->transport_header))~0U;
 +

+		return 0;
+	}
+	dport = vpna->bdg_port;
+#endif
+	if (dst->port == NM_BDG_NOPORT)
+		dst->port = dport;
+	else if (likely(dst->port != dport))

+static struct internal_dev *internal_dev_priv(struct net_device *netdev);
+
+static int
+vport_internal_netmap_reg(struct netmap_adapter *na, int onoff)
+{
+	struct net_device *dev = na->ifp;
+	int error = 0;
+
+	if (!(dev)->flags & IFF_UP) {
