Skip to content

Commit

Permalink
Merge following 3.0 commits into master.
Browse files Browse the repository at this point in the history
commit 5a9838a91c5061f5e7a22b882f1f3dd8504baf8d
Author: Raja Sivaramakrishnan <raja@juniper.net>
Date:   Wed Jun 1 16:56:17 2016 -0700

    Fix a race condition which resulted in the pkt0 thread polling too soon
    (before the eventfd could be added to the poll).

    Change-Id: I51c1484d7aa8b67fcb2a03c42ef73894158129da
    Closes-Bug: 1587275

commit cfa2f6e92ae11885724b868daea667d556921e64
Author: Raja Sivaramakrishnan <raja@juniper.net>
Date:   Tue May 24 23:31:38 2016 -0700

    Set MAC address of slave interface explicitly if it is a SR-IOV VF.

    Change-Id: I4d62d23fff5d9e34477f3d706197322c1f2c94a7
    Closes-bug: 1573255

commit b060bc7dca5bb2368a6ccca7420ab8a3bf1eb74c
Author: Raja Sivaramakrishnan <raja@juniper.net>
Date:   Thu May 19 13:52:58 2016 -0700

    Set vlan filter only when vrouter physical interface is a VF.

    Change-Id: Iad9a60ba9fa737167a650cd80997ff149cc8c9cf
    Closes-bug: 1573255

commit 1979d7e728e6d293ddedcfb06c74eaaaa0d5e363
Author: Raja Sivaramakrishnan <raja@juniper.net>
Date:   Thu May 19 00:23:47 2016 -0700

    - Set the VLAN filter for VFs if vrouter is provisioned on a VLAN.

    Change-Id: I33e5f26b50c0532c3a802acba8025f3a268be4fb
    Closes-bug: 1573255

Change-Id: I725ee4558c0ddc9131039f9fa7c7f361395ce608
  • Loading branch information
srajag committed Jun 23, 2016
1 parent da6fea3 commit c71dea5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 7 deletions.
49 changes: 46 additions & 3 deletions dpdk/vr_dpdk_interface.c
Expand Up @@ -163,9 +163,9 @@ dpdk_find_pci_addr_by_port(struct rte_pci_addr *addr, uint8_t port_id)
}

static inline void
dpdk_set_hw_vlan_strip(uint32_t port_id, struct vr_interface *vif)
dpdk_set_addr_vlan_filter_strip(uint32_t port_id, struct vr_interface *vif)
{
uint32_t i;
uint32_t i, ret;
uint8_t *port_id_ptr;
int port_num = 0;
struct vr_dpdk_ethdev *ethdev = &vr_dpdk.ethdevs[port_id];
Expand All @@ -174,6 +174,49 @@ dpdk_set_hw_vlan_strip(uint32_t port_id, struct vr_interface *vif)
&ethdev->ethdev_port_id:ethdev->ethdev_slaves;

do {
/*
* TODO: vf_lcore_id check for SR-IOV VF should be a per-interface
* check to handle the case where a bond has a VF and a PF in it.
*/

/*
* Set the MAC address of slave interfaces. Doing it from the bond driver in
* DPDK doesn't seem to work on SR-IOV VFs.
*/
if ((ethdev->ethdev_nb_slaves != -1) && vr_dpdk.vf_lcore_id) {
ret = rte_eth_dev_default_mac_addr_set(*port_id_ptr,
(struct ether_addr *)vif->vif_mac);
if (ret == 0) {
RTE_LOG(INFO, VROUTER, "Bond slave port %d now uses vif MAC "
MAC_FORMAT "\n",
*port_id_ptr, MAC_VALUE(vif->vif_mac));
} else {
RTE_LOG(ERR, VROUTER, "Error setting vif MAC to bond slave port %d: "
"%s (%d)\n",
*port_id_ptr, rte_strerror(-ret), -ret);
}
}

if ((vr_dpdk.vlan_tag != VLAN_ID_INVALID) && vr_dpdk.vf_lcore_id) {
ret = rte_eth_dev_set_vlan_offload(*port_id_ptr, ETH_VLAN_FILTER_OFFLOAD);
if (ret) {
RTE_LOG(INFO, VROUTER, "Error %d enabling vlan offload on port %d\n",
ret, *port_id_ptr);
} else {
RTE_LOG(INFO, VROUTER, "Enabled vlan offload on port %d\n",
*port_id_ptr);
}

ret = rte_eth_dev_vlan_filter(*port_id_ptr, vr_dpdk.vlan_tag, 1);
if (ret) {
RTE_LOG(INFO, VROUTER, "Error %d enabling vlan %d on port %d\n",
ret, vr_dpdk.vlan_tag, *port_id_ptr);
} else {
RTE_LOG(INFO, VROUTER, "Enabled vlan %d on port %d\n",
vr_dpdk.vlan_tag, *port_id_ptr);
}
}

for (i=0; i< rte_eth_devices[*port_id_ptr].data->nb_rx_queues; i++)
{
if (vif->vif_flags & VIF_FLAG_VLAN_OFFLOAD) {
Expand Down Expand Up @@ -450,7 +493,7 @@ dpdk_fabric_if_add(struct vr_interface *vif)
#endif

/* Set hardware VLAN stripping */
dpdk_set_hw_vlan_strip(port_id, vif);
dpdk_set_addr_vlan_filter_strip(port_id, vif);

/* schedule RX/TX queues */
return vr_dpdk_lcore_if_schedule(vif, vr_dpdk_lcore_least_used_get(),
Expand Down
10 changes: 6 additions & 4 deletions dpdk/vr_dpdk_packet.c
Expand Up @@ -111,9 +111,10 @@ dpdk_packet_socket_init(void)
{
void *event_sock = NULL;
int err;
void *packet_transport;

vr_dpdk.packet_transport = (void *)vr_usocket(PACKET, RAW);
if (!vr_dpdk.packet_transport)
packet_transport = (void *)vr_usocket(PACKET, RAW);
if (!packet_transport)
return -1;

if (!vr_dpdk.packet_ring) {
Expand All @@ -136,20 +137,21 @@ dpdk_packet_socket_init(void)
goto error;
}

if (vr_usocket_bind_usockets(vr_dpdk.packet_transport,
if (vr_usocket_bind_usockets(packet_transport,
event_sock)) {
RTE_LOG(ERR, VROUTER, " error binding packet event\n");
goto error;
}
vr_dpdk.packet_event_sock = event_sock;
vr_dpdk.packet_transport = packet_transport;

return 0;

error:
err = errno;
if (event_sock)
vr_usocket_close(event_sock);
vr_usocket_close(vr_dpdk.packet_transport);
vr_usocket_close(packet_transport);
vr_dpdk.packet_transport = NULL;
errno = err;

Expand Down

0 comments on commit c71dea5

Please sign in to comment.