mirror of https://gitee.com/openkylin/qemu.git
Net patches
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJS5nEPAAoJEJykq7OBq3PI2XkH/1+f2mTJydxsg71571fOV+05 IQl5dp14FZe+b3R4gRIEkU78JzsvhSnBdM8BQp4PwUhRIxz37tv3WfiAUVxOVMME U21/e+Oq0dFwBdCsx8G7ZRNP0xfWz8dvujo1cVZPWfFHAyBecgkcDQM1shHB4kGt PRrN3UfS6JOLQ6yBbXWSMMA7sWxZ7dlME7OPvUs3rql/mk20+xzpFJiyXVyMTEGA uu2l0iSpdwytisYTe2Pn8efwvuG1pIvNYmWIFcBjQIXfRTr0X9UGmGfgXTHlWERL 91BR7wcKvQveMRYYbRdYvHLm/wcCc3o+MhS1My5TZItxZPLFIaZZyvf/Z4gvj9U= =xJOf -----END PGP SIGNATURE----- Merge remote-tracking branch 'stefanha/tags/net-pull-request' into staging Net patches # gpg: Signature made Mon 27 Jan 2014 14:45:35 GMT using RSA key ID 81AB73C8 # gpg: Can't check signature: public key not found * stefanha/tags/net-pull-request: tap-linux: Get features once and use it many times Fix lan9118 buffer length handling Fix lan9118 TX "CMD A" handling net: Use g_strdup_printf instead of snprintf. Message-id: 1390834129-19625-1-git-send-email-stefanha@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
8e02b35926
|
@ -727,14 +727,14 @@ static void tx_fifo_push(lan9118_state *s, uint32_t val)
|
|||
s->txp->cmd_a = val & 0x831f37ff;
|
||||
s->txp->fifo_used++;
|
||||
s->txp->state = TX_B;
|
||||
s->txp->buffer_size = extract32(s->txp->cmd_a, 0, 11);
|
||||
s->txp->offset = extract32(s->txp->cmd_a, 16, 5);
|
||||
break;
|
||||
case TX_B:
|
||||
if (s->txp->cmd_a & 0x2000) {
|
||||
/* First segment */
|
||||
s->txp->cmd_b = val;
|
||||
s->txp->fifo_used++;
|
||||
s->txp->buffer_size = s->txp->cmd_a & 0x7ff;
|
||||
s->txp->offset = (s->txp->cmd_a >> 16) & 0x1f;
|
||||
/* End alignment does not include command words. */
|
||||
n = (s->txp->buffer_size + s->txp->offset + 3) >> 2;
|
||||
switch ((n >> 24) & 3) {
|
||||
|
@ -763,7 +763,7 @@ static void tx_fifo_push(lan9118_state *s, uint32_t val)
|
|||
if (s->txp->buffer_size <= 0 && s->txp->pad != 0) {
|
||||
s->txp->pad--;
|
||||
} else {
|
||||
n = 4;
|
||||
n = MIN(4, s->txp->buffer_size + s->txp->offset);
|
||||
while (s->txp->offset) {
|
||||
val >>= 8;
|
||||
n--;
|
||||
|
|
|
@ -164,7 +164,6 @@ void qemu_macaddr_default_if_unset(MACAddr *macaddr)
|
|||
static char *assign_name(NetClientState *nc1, const char *model)
|
||||
{
|
||||
NetClientState *nc;
|
||||
char buf[256];
|
||||
int id = 0;
|
||||
|
||||
QTAILQ_FOREACH(nc, &net_clients, next) {
|
||||
|
@ -176,9 +175,7 @@ static char *assign_name(NetClientState *nc1, const char *model)
|
|||
}
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s.%d", model, id);
|
||||
|
||||
return g_strdup(buf);
|
||||
return g_strdup_printf("%s.%d", model, id);
|
||||
}
|
||||
|
||||
static void qemu_net_client_destructor(NetClientState *nc)
|
||||
|
|
|
@ -52,14 +52,17 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||
memset(&ifr, 0, sizeof(ifr));
|
||||
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
|
||||
|
||||
if (ioctl(fd, TUNGETFEATURES, &features) == 0 &&
|
||||
features & IFF_ONE_QUEUE) {
|
||||
if (ioctl(fd, TUNGETFEATURES, &features) == -1) {
|
||||
error_report("warning: TUNGETFEATURES failed: %s", strerror(errno));
|
||||
features = 0;
|
||||
}
|
||||
|
||||
if (features & IFF_ONE_QUEUE) {
|
||||
ifr.ifr_flags |= IFF_ONE_QUEUE;
|
||||
}
|
||||
|
||||
if (*vnet_hdr) {
|
||||
if (ioctl(fd, TUNGETFEATURES, &features) == 0 &&
|
||||
features & IFF_VNET_HDR) {
|
||||
if (features & IFF_VNET_HDR) {
|
||||
*vnet_hdr = 1;
|
||||
ifr.ifr_flags |= IFF_VNET_HDR;
|
||||
} else {
|
||||
|
@ -82,8 +85,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||
}
|
||||
|
||||
if (mq_required) {
|
||||
if ((ioctl(fd, TUNGETFEATURES, &features) != 0) ||
|
||||
!(features & IFF_MULTI_QUEUE)) {
|
||||
if (!(features & IFF_MULTI_QUEUE)) {
|
||||
error_report("multiqueue required, but no kernel "
|
||||
"support for IFF_MULTI_QUEUE available");
|
||||
close(fd);
|
||||
|
|
Loading…
Reference in New Issue