git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bridge: improve vlan mode related error messages when adding port
[sliver-openvswitch.git]
/
datapath
/
vport.c
diff --git
a/datapath/vport.c
b/datapath/vport.c
index
6f2b2f6
..
2673b81
100644
(file)
--- a/
datapath/vport.c
+++ b/
datapath/vport.c
@@
-20,6
+20,7
@@
#include <linux/if.h>
#include <linux/if_vlan.h>
#include <linux/jhash.h>
#include <linux/if.h>
#include <linux/if_vlan.h>
#include <linux/jhash.h>
+#include <linux/kconfig.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mutex.h>
@@
-34,17
+35,20
@@
#include "vport.h"
#include "vport-internal_dev.h"
#include "vport.h"
#include "vport-internal_dev.h"
+static void ovs_vport_record_error(struct vport *,
+ enum vport_err_type err_type);
+
/* List of statically compiled vport implementations. Don't forget to also
* add yours to the list at the bottom of vport.h. */
static const struct vport_ops *vport_ops_list[] = {
&ovs_netdev_vport_ops,
&ovs_internal_vport_ops,
/* List of statically compiled vport implementations. Don't forget to also
* add yours to the list at the bottom of vport.h. */
static const struct vport_ops *vport_ops_list[] = {
&ovs_netdev_vport_ops,
&ovs_internal_vport_ops,
+#if IS_ENABLED(CONFIG_NET_IPGRE_DEMUX)
&ovs_gre_vport_ops,
&ovs_gre64_vport_ops,
&ovs_gre_vport_ops,
&ovs_gre64_vport_ops,
-#
if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+#
endif
&ovs_vxlan_vport_ops,
&ovs_lisp_vport_ops,
&ovs_vxlan_vport_ops,
&ovs_lisp_vport_ops,
-#endif
};
/* Protected by RCU read lock for reading, ovs_mutex for writing. */
};
/* Protected by RCU read lock for reading, ovs_mutex for writing. */
@@
-118,6
+122,7
@@
struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
{
struct vport *vport;
size_t alloc_size;
{
struct vport *vport;
size_t alloc_size;
+ int i;
alloc_size = sizeof(struct vport);
if (priv_size) {
alloc_size = sizeof(struct vport);
if (priv_size) {
@@
-141,6
+146,12
@@
struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
return ERR_PTR(-ENOMEM);
}
return ERR_PTR(-ENOMEM);
}
+ for_each_possible_cpu(i) {
+ struct pcpu_tstats *vport_stats;
+ vport_stats = per_cpu_ptr(vport->percpu_stats, i);
+ u64_stats_init(&vport_stats->syncp);
+ }
+
spin_lock_init(&vport->stats_lock);
return vport;
spin_lock_init(&vport->stats_lock);
return vport;
@@
-203,7
+214,7
@@
out:
* ovs_vport_set_options - modify existing vport device (for kernel callers)
*
* @vport: vport to modify.
* ovs_vport_set_options - modify existing vport device (for kernel callers)
*
* @vport: vport to modify.
- * @
port
: New configuration.
+ * @
options
: New configuration.
*
* Modifies an existing device with the specified configuration (which is
* dependent on device type). ovs_mutex must be held.
*
* Modifies an existing device with the specified configuration (which is
* dependent on device type). ovs_mutex must be held.
@@
-238,7
+249,7
@@
void ovs_vport_del(struct vport *vport)
* @stats: stats to set
*
* Provides a set of transmit, receive, and error stats to be added as an
* @stats: stats to set
*
* Provides a set of transmit, receive, and error stats to be added as an
- * offset to the collect
data when stats are retrei
ved. Some devices may not
+ * offset to the collect
ed data when stats are retrie
ved. Some devices may not
* support setting the stats, in which case the result will always be
* -EOPNOTSUPP.
*
* support setting the stats, in which case the result will always be
* -EOPNOTSUPP.
*
@@
-349,12
+360,14
@@
int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb)
*
* @vport: vport that received the packet
* @skb: skb that was received
*
* @vport: vport that received the packet
* @skb: skb that was received
+ * @tun_key: tunnel (if any) that carried packet
*
* Must be called with rcu_read_lock. The packet cannot be shared and
* skb->data should point to the Ethernet header. The caller must have already
* called compute_ip_summed() to initialize the checksumming fields.
*/
*
* Must be called with rcu_read_lock. The packet cannot be shared and
* skb->data should point to the Ethernet header. The caller must have already
* called compute_ip_summed() to initialize the checksumming fields.
*/
-void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
+void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
+ struct ovs_key_ipv4_tunnel *tun_key)
{
struct pcpu_tstats *stats;
{
struct pcpu_tstats *stats;
@@
-364,9
+377,7
@@
void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
stats->rx_bytes += skb->len;
u64_stats_update_end(&stats->syncp);
stats->rx_bytes += skb->len;
u64_stats_update_end(&stats->syncp);
- if (!(vport->ops->flags & VPORT_F_TUN_ID))
- OVS_CB(skb)->tun_key = NULL;
-
+ OVS_CB(skb)->tun_key = tun_key;
ovs_dp_process_received_packet(vport, skb);
}
ovs_dp_process_received_packet(vport, skb);
}
@@
-383,7
+394,7
@@
int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
{
int sent = vport->ops->send(vport, skb);
{
int sent = vport->ops->send(vport, skb);
- if (likely(sent)) {
+ if (likely(sent
> 0
)) {
struct pcpu_tstats *stats;
stats = this_cpu_ptr(vport->percpu_stats);
struct pcpu_tstats *stats;
stats = this_cpu_ptr(vport->percpu_stats);
@@
-408,9
+419,10
@@
int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
* @err_type: one of enum vport_err_type types to indicate the error type
*
* If using the vport generic stats layer indicate that an error of the given
* @err_type: one of enum vport_err_type types to indicate the error type
*
* If using the vport generic stats layer indicate that an error of the given
- * type has occured.
+ * type has occur
r
ed.
*/
*/
-void ovs_vport_record_error(struct vport *vport, enum vport_err_type err_type)
+static void ovs_vport_record_error(struct vport *vport,
+ enum vport_err_type err_type)
{
spin_lock(&vport->stats_lock);
{
spin_lock(&vport->stats_lock);