Commit 17083d6d authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging



# gpg: Signature made Tue 31 Mar 2020 14:15:18 BST
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request:
  qtest: add tulip test case
  hw/net/allwinner-sun8i-emac.c: Fix REG_ADDR_HIGH/LOW reads
  net: tulip: check frame size and r/w data length
  net/colo-compare.c: Expose "expired_scan_cycle" to users
  net/colo-compare.c: Expose "compare_timeout" to users
  hw/net/can: Make CanBusClientInfo::can_receive() return a boolean
  hw/net: Make NetCanReceive() return a boolean
  hw/net/rtl8139: Update coding style to make checkpatch.pl happy
  hw/net/rtl8139: Simplify if/else statement
  hw/net/smc91c111: Let smc91c111_can_receive() return a boolean
  hw/net/e1000e_core: Let e1000e_can_receive() return a boolean
  Fixed integer overflow in e1000e
  hw/net/i82596.c: Avoid reading off end of buffer in i82596_receive()
  hw/net/i82596: Correct command bitmask (CID 1419392)

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 2a95551e 1153cf9f
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ static void allwinner_sun8i_emac_flush_desc(FrameDescriptor *desc,
    cpu_physical_memory_write(phys_addr, desc, sizeof(*desc));
}

static int allwinner_sun8i_emac_can_receive(NetClientState *nc)
static bool allwinner_sun8i_emac_can_receive(NetClientState *nc)
{
    AwSun8iEmacState *s = qemu_get_nic_opaque(nc);
    FrameDescriptor desc;
@@ -611,10 +611,10 @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset,
        value = s->mii_data;
        break;
    case REG_ADDR_HIGH:         /* MAC Address High */
        value = *(((uint32_t *) (s->conf.macaddr.a)) + 1);
        value = lduw_le_p(s->conf.macaddr.a + 4);
        break;
    case REG_ADDR_LOW:          /* MAC Address Low */
        value = *(uint32_t *) (s->conf.macaddr.a);
        value = ldl_le_p(s->conf.macaddr.a);
        break;
    case REG_TX_DMA_STA:        /* Transmit DMA Status */
        break;
@@ -728,14 +728,10 @@ static void allwinner_sun8i_emac_write(void *opaque, hwaddr offset,
        s->mii_data = value;
        break;
    case REG_ADDR_HIGH:         /* MAC Address High */
        s->conf.macaddr.a[4] = (value & 0xff);
        s->conf.macaddr.a[5] = (value & 0xff00) >> 8;
        stw_le_p(s->conf.macaddr.a + 4, value);
        break;
    case REG_ADDR_LOW:          /* MAC Address Low */
        s->conf.macaddr.a[0] = (value & 0xff);
        s->conf.macaddr.a[1] = (value & 0xff00) >> 8;
        s->conf.macaddr.a[2] = (value & 0xff0000) >> 16;
        s->conf.macaddr.a[3] = (value & 0xff000000) >> 24;
        stl_le_p(s->conf.macaddr.a, value);
        break;
    case REG_TX_DMA_STA:        /* Transmit DMA Status */
    case REG_TX_CUR_DESC:       /* Transmit Current Descriptor */
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ static uint32_t fifo8_pop_word(Fifo8 *fifo)
    return ret;
}

static int aw_emac_can_receive(NetClientState *nc)
static bool aw_emac_can_receive(NetClientState *nc)
{
    AwEmacState *s = qemu_get_nic_opaque(nc);

+4 −4
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ static void phy_update_link(CadenceGEMState *s)
    }
}

static int gem_can_receive(NetClientState *nc)
static bool gem_can_receive(NetClientState *nc)
{
    CadenceGEMState *s;
    int i;
@@ -518,7 +518,7 @@ static int gem_can_receive(NetClientState *nc)
            s->can_rx_state = 1;
            DB_PRINT("can't receive - no enable\n");
        }
        return 0;
        return false;
    }

    for (i = 0; i < s->num_priority_queues; i++) {
@@ -532,14 +532,14 @@ static int gem_can_receive(NetClientState *nc)
            s->can_rx_state = 2;
            DB_PRINT("can't receive - all the buffer descriptors are busy\n");
        }
        return 0;
        return false;
    }

    if (s->can_rx_state != 0) {
        s->can_rx_state = 0;
        DB_PRINT("can receive\n");
    }
    return 1;
    return true;
}

/*
+4 −4
Original line number Diff line number Diff line
@@ -733,21 +733,21 @@ uint64_t can_sja_mem_read(CanSJA1000State *s, hwaddr addr, unsigned size)
    return temp;
}

int can_sja_can_receive(CanBusClientState *client)
bool can_sja_can_receive(CanBusClientState *client)
{
    CanSJA1000State *s = container_of(client, CanSJA1000State, bus_client);

    if (s->clock & 0x80) { /* PeliCAN Mode */
        if (s->mode & 0x01) { /* reset mode. */
            return 0;
            return false;
        }
    } else { /* BasicCAN mode */
        if (s->control & 0x01) {
            return 0;
            return false;
        }
    }

    return 1; /* always return 1, when operation mode */
    return true; /* always return true, when operation mode */
}

ssize_t can_sja_receive(CanBusClientState *client, const qemu_can_frame *frames,
+1 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ void can_sja_disconnect(CanSJA1000State *s);

int can_sja_init(CanSJA1000State *s, qemu_irq irq);

int can_sja_can_receive(CanBusClientState *client);
bool can_sja_can_receive(CanBusClientState *client);

ssize_t can_sja_receive(CanBusClientState *client,
                        const qemu_can_frame *frames, size_t frames_cnt);
Loading