Message ID | 1512369428-20455-5-git-send-email-subashab@codeaurora.org |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Series | net: qualcomm: rmnet: Configuration options | expand |
From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> Date: Sun, 3 Dec 2017 23:37:06 -0700 > Add support to send and receive packets over ethernet. > An example of usage is testing the data path on UML. This can be > achieved by setting up two UML instances in multicast mode and > associating rmnet over the UML ethernet device. > > Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> > --- > drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c > index a46053c..ee20f23 100644 > --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c > +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c > @@ -15,6 +15,7 @@ > > #include <linux/netdevice.h> > #include <linux/netdev_features.h> > +#include <linux/if_arp.h> > #include "rmnet_private.h" > #include "rmnet_config.h" > #include "rmnet_vnd.h" > @@ -104,6 +105,12 @@ static void rmnet_set_skb_proto(struct sk_buff *skb) > { > struct sk_buff *skbn; > > + if (skb->dev->type == ARPHRD_ETHER) { > + if (skb_headroom(skb) < ETH_HLEN) > + kfree_skb(skb); > + skb_push(skb, ETH_HLEN); > + } This will crash, you didn't test the new code path that does the kfree_skb(). You should use an SKB helper function which will realloc the headroom if ETH_HLEN is not available, instead of failing.
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c index a46053c..ee20f23 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c @@ -15,6 +15,7 @@ #include <linux/netdevice.h> #include <linux/netdev_features.h> +#include <linux/if_arp.h> #include "rmnet_private.h" #include "rmnet_config.h" #include "rmnet_vnd.h" @@ -104,6 +105,12 @@ static void rmnet_set_skb_proto(struct sk_buff *skb) { struct sk_buff *skbn; + if (skb->dev->type == ARPHRD_ETHER) { + if (skb_headroom(skb) < ETH_HLEN) + kfree_skb(skb); + skb_push(skb, ETH_HLEN); + } + if (port->ingress_data_format & RMNET_INGRESS_FORMAT_DEAGGREGATION) { while ((skbn = rmnet_map_deaggregate(skb)) != NULL) __rmnet_map_ingress_handler(skbn, port);
Add support to send and receive packets over ethernet. An example of usage is testing the data path on UML. This can be achieved by setting up two UML instances in multicast mode and associating rmnet over the UML ethernet device. Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> --- drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 7 +++++++ 1 file changed, 7 insertions(+)