Displaying 20 results from an estimated 22 matches for "virtnet_set_set".
2016 Feb 02
4
[PATCH net-next] virtio_net: add ethtool support for set and get of settings
...000:
+ case SPEED_50000:
+ case SPEED_56000:
+ case SPEED_100000:
+ case SPEED_UNKNOWN:
+ return true;
+ }
+
+ return false;
+}
+
+static bool virtnet_validate_duplex(u8 duplex)
+{
+ switch (duplex) {
+ case DUPLEX_FULL:
+ case DUPLEX_UNKNOWN:
+ return true;
+ }
+
+ return false;
+}
+
+static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+ struct virtnet_info *vi = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(cmd);
+
+ /* don't allow custom speed and duplex */
+ if (!virtnet_validate_speed(speed) ||
+ !virtnet_validate_duplex(cmd->duplex))
+ return -EINVAL;
+...
2016 Feb 02
4
[PATCH net-next] virtio_net: add ethtool support for set and get of settings
...000:
+ case SPEED_50000:
+ case SPEED_56000:
+ case SPEED_100000:
+ case SPEED_UNKNOWN:
+ return true;
+ }
+
+ return false;
+}
+
+static bool virtnet_validate_duplex(u8 duplex)
+{
+ switch (duplex) {
+ case DUPLEX_FULL:
+ case DUPLEX_UNKNOWN:
+ return true;
+ }
+
+ return false;
+}
+
+static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+ struct virtnet_info *vi = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(cmd);
+
+ /* don't allow custom speed and duplex */
+ if (!virtnet_validate_speed(speed) ||
+ !virtnet_validate_duplex(cmd->duplex))
+ return -EINVAL;
+...
2016 Feb 02
1
[PATCH net-next] virtio_net: add ethtool support for set and get of settings
...ear where the
> enums are defined so people remember to extend these
> when adding new speeds?
> Will help e.g. tun reuse this, too.
>
Right, very good suggestion. I'll split this patch in two and will
add them for everyone to use.
Thank you,
Nik
>> +
>> +static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
>> +{
>> + struct virtnet_info *vi = netdev_priv(dev);
>> + u32 speed = ethtool_cmd_speed(cmd);
>> +
>> + /* don't allow custom speed and duplex */
>> + if (!virtnet_validate_speed(speed) ||
>> +...
2016 Feb 02
1
[PATCH net-next] virtio_net: add ethtool support for set and get of settings
...ear where the
> enums are defined so people remember to extend these
> when adding new speeds?
> Will help e.g. tun reuse this, too.
>
Right, very good suggestion. I'll split this patch in two and will
add them for everyone to use.
Thank you,
Nik
>> +
>> +static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
>> +{
>> + struct virtnet_info *vi = netdev_priv(dev);
>> + u32 speed = ethtool_cmd_speed(cmd);
>> +
>> + /* don't allow custom speed and duplex */
>> + if (!virtnet_validate_speed(speed) ||
>> +...
2017 Mar 21
0
[PATCH] net: virtio_net: use new api ethtool_{get|set}_link_ksettings
...bitmap_empty(diff1.link_modes.supported,
+ __ETHTOOL_LINK_MODE_MASK_NBITS) &&
+ bitmap_empty(diff1.link_modes.advertising,
+ __ETHTOOL_LINK_MODE_MASK_NBITS) &&
+ bitmap_empty(diff1.link_modes.lp_advertising,
+ __ETHTOOL_LINK_MODE_MASK_NBITS);
}
-static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int virtnet_set_link_ksettings(struct net_device *dev,
+ const struct ethtool_link_ksettings *cmd)
{
struct virtnet_info *vi = netdev_priv(dev);
u32 speed;
- speed = ethtool_cmd_speed(cmd);
+ speed = cmd->base.speed;...
2017 Mar 21
0
[PATCH] net: virtio_net: use new api ethtool_{get|set}_link_ksettings
...bitmap_empty(diff1.link_modes.supported,
+ __ETHTOOL_LINK_MODE_MASK_NBITS) &&
+ bitmap_empty(diff1.link_modes.advertising,
+ __ETHTOOL_LINK_MODE_MASK_NBITS) &&
+ bitmap_empty(diff1.link_modes.lp_advertising,
+ __ETHTOOL_LINK_MODE_MASK_NBITS);
}
-static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int virtnet_set_link_ksettings(struct net_device *dev,
+ const struct ethtool_link_ksettings *cmd)
{
struct virtnet_info *vi = netdev_priv(dev);
u32 speed;
- speed = ethtool_cmd_speed(cmd);
+ speed = cmd->base.speed;...
2016 Oct 21
2
[PATCH net-next v2 6/9] net: use core MTU range checking in virt drivers
...--git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index fad84f3..720809f 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
> > .set_settings = virtnet_set_settings,
> > };
> >
> > -#define MIN_MTU 68
> > -#define MAX_MTU 65535
> > -
> > -static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
> > -{
> > - if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
> > - return -EINVAL;
> >...
2016 Oct 21
2
[PATCH net-next v2 6/9] net: use core MTU range checking in virt drivers
...--git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index fad84f3..720809f 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
> > .set_settings = virtnet_set_settings,
> > };
> >
> > -#define MIN_MTU 68
> > -#define MAX_MTU 65535
> > -
> > -static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
> > -{
> > - if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
> > - return -EINVAL;
> >...
2017 Mar 21
1
[PATCH 2] net: virtio_net: use new api ethtool_{get|set}_link_ksettings
...bitmap_empty(diff1.link_modes.supported,
+ __ETHTOOL_LINK_MODE_MASK_NBITS) &&
+ bitmap_empty(diff1.link_modes.advertising,
+ __ETHTOOL_LINK_MODE_MASK_NBITS) &&
+ bitmap_empty(diff1.link_modes.lp_advertising,
+ __ETHTOOL_LINK_MODE_MASK_NBITS);
}
-static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int virtnet_set_link_ksettings(struct net_device *dev,
+ const struct ethtool_link_ksettings *cmd)
{
struct virtnet_info *vi = netdev_priv(dev);
u32 speed;
- speed = ethtool_cmd_speed(cmd);
+ speed = cmd->base.speed;...
2017 Mar 21
1
[PATCH 2] net: virtio_net: use new api ethtool_{get|set}_link_ksettings
...bitmap_empty(diff1.link_modes.supported,
+ __ETHTOOL_LINK_MODE_MASK_NBITS) &&
+ bitmap_empty(diff1.link_modes.advertising,
+ __ETHTOOL_LINK_MODE_MASK_NBITS) &&
+ bitmap_empty(diff1.link_modes.lp_advertising,
+ __ETHTOOL_LINK_MODE_MASK_NBITS);
}
-static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int virtnet_set_link_ksettings(struct net_device *dev,
+ const struct ethtool_link_ksettings *cmd)
{
struct virtnet_info *vi = netdev_priv(dev);
u32 speed;
- speed = ethtool_cmd_speed(cmd);
+ speed = cmd->base.speed;...
2016 Oct 19
1
[PATCH net-next 5/6] net: use core MTU range checking in virt drivers
...--git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index fad84f3..4885a42 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
> > .set_settings = virtnet_set_settings,
> > };
> >
> > -#define MIN_MTU 68
> > -#define MAX_MTU 65535
> > -
> > -static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
> > -{
> > - if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
> > - return -EINVAL;
> >...
2016 Oct 19
1
[PATCH net-next 5/6] net: use core MTU range checking in virt drivers
...--git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index fad84f3..4885a42 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
> > .set_settings = virtnet_set_settings,
> > };
> >
> > -#define MIN_MTU 68
> > -#define MAX_MTU 65535
> > -
> > -static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
> > -{
> > - if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
> > - return -EINVAL;
> >...
2016 Feb 02
0
[PATCH net-next] virtio_net: add ethtool support for set and get of settings
...DUPLEX_FULL:
> + case DUPLEX_UNKNOWN:
> + return true;
> + }
> +
> + return false;
> +}
Let's put the validating functions near where the
enums are defined so people remember to extend these
when adding new speeds?
Will help e.g. tun reuse this, too.
> +
> +static int virtnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> +{
> + struct virtnet_info *vi = netdev_priv(dev);
> + u32 speed = ethtool_cmd_speed(cmd);
> +
> + /* don't allow custom speed and duplex */
> + if (!virtnet_validate_speed(speed) ||
> + !virtnet_validate_duplex(cm...
2016 Oct 19
7
[PATCH net-next 5/6] net: use core MTU range checking in virt drivers
...(net);
net_device_ctx = netdev_priv(net);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fad84f3..4885a42 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
.set_settings = virtnet_set_settings,
};
-#define MIN_MTU 68
-#define MAX_MTU 65535
-
-static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
-{
- if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
- return -EINVAL;
- dev->mtu = new_mtu;
- return 0;
-}
-
static const struct net_device_ops virtnet_netdev = {
....
2016 Oct 19
7
[PATCH net-next 5/6] net: use core MTU range checking in virt drivers
...(net);
net_device_ctx = netdev_priv(net);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fad84f3..4885a42 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
.set_settings = virtnet_set_settings,
};
-#define MIN_MTU 68
-#define MAX_MTU 65535
-
-static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
-{
- if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
- return -EINVAL;
- dev->mtu = new_mtu;
- return 0;
-}
-
static const struct net_device_ops virtnet_netdev = {
....
2016 Oct 19
0
[PATCH net-next 5/6] net: use core MTU range checking in virt drivers
...d Wilson wrote:
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index fad84f3..4885a42 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
> .set_settings = virtnet_set_settings,
> };
>
> -#define MIN_MTU 68
> -#define MAX_MTU 65535
> -
> -static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
> -{
> - if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
> - return -EINVAL;
> - dev->mtu = new_mtu;
> - return 0;
> -}...
2016 Oct 21
0
[PATCH net-next v2 6/9] net: use core MTU range checking in virt drivers
...io_net.c b/drivers/net/virtio_net.c
> > > index fad84f3..720809f 100644
> > > --- a/drivers/net/virtio_net.c
> > > +++ b/drivers/net/virtio_net.c
> > > @@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
> > > .set_settings = virtnet_set_settings,
> > > };
> > >
> > > -#define MIN_MTU 68
> > > -#define MAX_MTU 65535
> > > -
> > > -static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
> > > -{
> > > - if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)...
2016 Oct 20
4
[PATCH net-next v2 6/9] net: use core MTU range checking in virt drivers
...rr("Unable to register netdev.\n");
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fad84f3..720809f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
.set_settings = virtnet_set_settings,
};
-#define MIN_MTU 68
-#define MAX_MTU 65535
-
-static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
-{
- if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
- return -EINVAL;
- dev->mtu = new_mtu;
- return 0;
-}
-
static const struct net_device_ops virtnet_netdev = {
....
2016 Oct 20
4
[PATCH net-next v2 6/9] net: use core MTU range checking in virt drivers
...rr("Unable to register netdev.\n");
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fad84f3..720809f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
.set_settings = virtnet_set_settings,
};
-#define MIN_MTU 68
-#define MAX_MTU 65535
-
-static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
-{
- if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
- return -EINVAL;
- dev->mtu = new_mtu;
- return 0;
-}
-
static const struct net_device_ops virtnet_netdev = {
....
2016 Dec 23
1
[RFC PATCH] virtio_net: XDP support for adjust_head
...if (vi->mergeable_rx_bufs)
- err = add_recvbuf_mergeable(rq, gfp);
+ err = add_recvbuf_mergeable(vi, rq, gfp);
else if (vi->big_packets)
err = add_recvbuf_big(vi, rq, gfp);
else
@@ -1669,12 +1679,15 @@ static void virtnet_init_settings(struct net_device *dev)
.set_settings = virtnet_set_settings,
};
+#define VIRTIO_XDP_HEADROOM 256
+
static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog)
{
unsigned long int max_sz = PAGE_SIZE - sizeof(struct padded_vnet_hdr);
struct virtnet_info *vi = netdev_priv(dev);
struct bpf_prog *old_prog;
u16 xdp_qp = 0, curr_qp;...