-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1
 
 iQEcBAABAgAGBQJVm8g1AAoJEJykq7OBq3PIIGYH/0/b8B5HussDgeKmMt74ZmkL
 5lq/+hTJYN1qPWSBXbKI/FGvSFWnM02vrgdNFsc3Zxn3k7ciXrAgYjHbKpx9CMBP
 iS9PJ1T6aWfxlVPsNQuOmD3z8w9OheEwkck6D7mOEKMRfGTQJisDhNuIidEzIUzW
 Bk+pe4uCeSehZfZTvS4pJb5R+VNwb3GqEFh8hQaF0/F8yLn6vfqyuKompgsRPiMe
 qYmafGdxW1h1/0DuzXsn7GHIpnuEyAEslqJbgzvpQHEZTaYDYPyw+mSS9X1XGT7V
 4m1BRMr97teYrjq0/Eb++Tc9ZaxuGx9+iJ+JeZzb6tXZvUTIDNArcJIS6k/5hmw=
 =DE34
 -----END PGP SIGNATURE-----

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

# gpg: Signature made Tue Jul  7 13:38:13 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/net-pull-request:
  rocker: tests: don't need to specify master/self when setting vlans
  rocker: mark copy-to-cpu pkts as forwarding offloaded
  rocker: return -1 when dropping packet on ingress
  rocker: fix missing break statements
  rocker: fix misplaced break statement
  rocker: don't queue receive pkts when port is disabled
  vmxnet3: Fix incorrect small packet padding
  e1000: flush packets when link comes up
  rocker: fix memory leak

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-07-07 15:48:49 +01:00
commit f2562fbb7a
11 changed files with 44 additions and 24 deletions

View File

@ -637,6 +637,7 @@ The TLVs for Rx descriptor buffer are:
(1 << 5): TCP packet
(1 << 6): UDP packet
(1 << 7): TCP/UDP csum good
(1 << 8): Offload forward
RX_CSUM 2 IP calculated checksum:
IPv4: IP payload csum
IPv6: header and payload csum
@ -645,6 +646,9 @@ The TLVs for Rx descriptor buffer are:
RX_FRAG_MAX_LEN 2 Packet maximum fragment length
RX_FRAG_LEN 2 Actual packet fragment length after receive
Offload forward RX_FLAG indicates the device has already forwarded the packet
so the host CPU should not also forward the packet.
Possible status return codes in descriptor on completion are:
DESC_COMP_ERR reason

View File

@ -185,6 +185,9 @@ e1000_link_up(E1000State *s)
{
s->mac_reg[STATUS] |= E1000_STATUS_LU;
s->phy_reg[PHY_STATUS] |= MII_SR_LINK_STATUS;
/* E1000_STATUS_LU is tested by e1000_can_receive() */
qemu_flush_queued_packets(qemu_get_queue(s->nic));
}
static bool

View File

@ -96,7 +96,7 @@ World *rocker_get_world(Rocker *r, enum rocker_world_type type)
RockerSwitch *qmp_query_rocker(const char *name, Error **errp)
{
RockerSwitch *rocker = g_malloc0(sizeof(*rocker));
RockerSwitch *rocker;
Rocker *r;
r = rocker_find(name);
@ -106,6 +106,7 @@ RockerSwitch *qmp_query_rocker(const char *name, Error **errp)
return NULL;
}
rocker = g_new0(RockerSwitch, 1);
rocker->name = g_strdup(r->name);
rocker->id = r->switch_id;
rocker->ports = r->fp_ports;
@ -192,11 +193,13 @@ static int tx_consume(Rocker *r, DescInfo *info)
if (!tlvs[ROCKER_TLV_TX_L3_CSUM_OFF]) {
return -ROCKER_EINVAL;
}
break;
case ROCKER_TX_OFFLOAD_TSO:
if (!tlvs[ROCKER_TLV_TX_TSO_MSS] ||
!tlvs[ROCKER_TLV_TX_TSO_HDR_LEN]) {
return -ROCKER_EINVAL;
}
break;
}
if (tlvs[ROCKER_TLV_TX_L3_CSUM_OFF]) {
@ -600,7 +603,7 @@ static DescRing *rocker_get_rx_ring_by_pport(Rocker *r,
}
int rx_produce(World *world, uint32_t pport,
const struct iovec *iov, int iovcnt)
const struct iovec *iov, int iovcnt, uint8_t copy_to_cpu)
{
Rocker *r = world_rocker(world);
PCIDevice *dev = (PCIDevice *)r;
@ -643,6 +646,10 @@ int rx_produce(World *world, uint32_t pport,
goto out;
}
if (copy_to_cpu) {
rx_flags |= ROCKER_RX_FLAGS_FWD_OFFLOAD;
}
/* XXX calc rx flags/csum */
tlv_size = rocker_tlv_total_size(sizeof(uint16_t)) + /* flags */

View File

@ -77,7 +77,7 @@ int rocker_event_link_changed(Rocker *r, uint32_t pport, bool link_up);
int rocker_event_mac_vlan_seen(Rocker *r, uint32_t pport, uint8_t *addr,
uint16_t vlan_id);
int rx_produce(World *world, uint32_t pport,
const struct iovec *iov, int iovcnt);
const struct iovec *iov, int iovcnt, uint8_t copy_to_cpu);
int rocker_port_eg(Rocker *r, uint32_t pport,
const struct iovec *iov, int iovcnt);

View File

@ -125,18 +125,21 @@ int fp_port_eg(FpPort *port, const struct iovec *iov, int iovcnt)
return ROCKER_OK;
}
static int fp_port_can_receive(NetClientState *nc)
{
FpPort *port = qemu_get_nic_opaque(nc);
return port->enabled;
}
static ssize_t fp_port_receive_iov(NetClientState *nc, const struct iovec *iov,
int iovcnt)
{
FpPort *port = qemu_get_nic_opaque(nc);
/* If the port is disabled, we want to drop this pkt
* now rather than queing it for later. We don't want
* any stale pkts getting into the device when the port
* transitions to enabled.
*/
if (!port->enabled) {
return -1;
}
return world_ingress(port->world, port->pport, iov, iovcnt);
}
@ -165,7 +168,6 @@ static void fp_port_set_link_status(NetClientState *nc)
static NetClientInfo fp_port_info = {
.type = NET_CLIENT_OPTIONS_KIND_NIC,
.size = sizeof(NICState),
.can_receive = fp_port_can_receive,
.receive = fp_port_receive,
.receive_iov = fp_port_receive_iov,
.cleanup = fp_port_cleanup,

View File

@ -250,6 +250,7 @@ enum {
#define ROCKER_RX_FLAGS_TCP (1 << 5)
#define ROCKER_RX_FLAGS_UDP (1 << 6)
#define ROCKER_RX_FLAGS_TCP_UDP_CSUM_GOOD (1 << 7)
#define ROCKER_RX_FLAGS_FWD_OFFLOAD (1 << 8)
/* Tx msg */
enum {

View File

@ -825,6 +825,8 @@ static OfDpaGroup *of_dpa_group_alloc(uint32_t id)
static void of_dpa_output_l2_interface(OfDpaFlowContext *fc,
OfDpaGroup *group)
{
uint8_t copy_to_cpu = fc->action_set.apply.copy_to_cpu;
if (group->l2_interface.pop_vlan) {
of_dpa_flow_pkt_strip_vlan(fc);
}
@ -837,7 +839,8 @@ static void of_dpa_output_l2_interface(OfDpaFlowContext *fc,
*/
if (group->l2_interface.out_pport == 0) {
rx_produce(fc->of_dpa->world, fc->in_pport, fc->iov, fc->iovcnt);
rx_produce(fc->of_dpa->world, fc->in_pport, fc->iov, fc->iovcnt,
copy_to_cpu);
} else if (group->l2_interface.out_pport != fc->in_pport) {
rocker_port_eg(world_rocker(fc->of_dpa->world),
group->l2_interface.out_pport,
@ -2525,7 +2528,6 @@ static void of_dpa_group_fill(void *key, void *value, void *user_data)
ngroup->has_set_vlan_id = true;
ngroup->set_vlan_id = ntohs(group->l2_rewrite.vlan_id);
}
break;
if (memcmp(group->l2_rewrite.src_mac.a, zero_mac.a, ETH_ALEN)) {
ngroup->has_set_eth_src = true;
ngroup->set_eth_src =
@ -2536,6 +2538,7 @@ static void of_dpa_group_fill(void *key, void *value, void *user_data)
ngroup->set_eth_dst =
qemu_mac_strdup_printf(group->l2_rewrite.dst_mac.a);
}
break;
case ROCKER_OF_DPA_GROUP_TYPE_L2_FLOOD:
case ROCKER_OF_DPA_GROUP_TYPE_L2_MCAST:
ngroup->has_vlan_id = true;

View File

@ -32,7 +32,7 @@ ssize_t world_ingress(World *world, uint32_t pport,
return world->ops->ig(world, pport, iov, iovcnt);
}
return iov_size(iov, iovcnt);
return -1;
}
int world_do_cmd(World *world, DescInfo *info,

View File

@ -1879,6 +1879,12 @@ vmxnet3_receive(NetClientState *nc, const uint8_t *buf, size_t size)
return -1;
}
if (s->peer_has_vhdr) {
vmxnet_rx_pkt_set_vhdr(s->rx_pkt, (struct virtio_net_hdr *)buf);
buf += sizeof(struct virtio_net_hdr);
size -= sizeof(struct virtio_net_hdr);
}
/* Pad to minimum Ethernet frame length */
if (size < sizeof(min_buf)) {
memcpy(min_buf, buf, size);
@ -1887,12 +1893,6 @@ vmxnet3_receive(NetClientState *nc, const uint8_t *buf, size_t size)
size = sizeof(min_buf);
}
if (s->peer_has_vhdr) {
vmxnet_rx_pkt_set_vhdr(s->rx_pkt, (struct virtio_net_hdr *)buf);
buf += sizeof(struct virtio_net_hdr);
size -= sizeof(struct virtio_net_hdr);
}
vmxnet_rx_pkt_set_packet_type(s->rx_pkt,
get_eth_packet_type(PKT_GET_ETH_HDR(buf)));

View File

@ -20,8 +20,8 @@ simp ssh tut sw1 --cmd "echo 1 | sudo dd of=/sys/class/net/br0/bridge/vlan_filte
# add both ports to VLAN 57
simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p1 master self"
simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p2 master self"
simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p1"
simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p2"
# turn off learning and flooding in SW

View File

@ -21,8 +21,8 @@ simp ssh tut sw1 --cmd "echo 1 | sudo dd of=/sys/class/net/br0/bridge/vlan_filte
# add both ports to VLAN 57
simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p1 master self"
simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p2 master self"
simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p1"
simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p2"
# turn off learning and flooding in SW