Commit 56470c92 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan Committed by David S. Miller

net: qualcomm: rmnet: Remove duplicate setting of rmnet private info

The end point is set twice in the local_ep as well as the mux_id and
the real_dev in the rmnet private structure. Remove the local_ep.
While these elements are equivalent, rmnet_endpoint will be
used only as part of the rmnet_port for muxed scenarios in VND mode.
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 91489632
...@@ -67,13 +67,8 @@ rmnet_get_endpoint(struct net_device *dev, int config_id) ...@@ -67,13 +67,8 @@ rmnet_get_endpoint(struct net_device *dev, int config_id)
struct rmnet_endpoint *ep; struct rmnet_endpoint *ep;
struct rmnet_port *port; struct rmnet_port *port;
if (!rmnet_is_real_dev_registered(dev)) { port = rmnet_get_port_rtnl(dev);
ep = rmnet_vnd_get_endpoint(dev); ep = &port->muxed_ep[config_id];
} else {
port = rmnet_get_port_rtnl(dev);
ep = &port->muxed_ep[config_id];
}
return ep; return ep;
} }
...@@ -183,7 +178,6 @@ static int rmnet_newlink(struct net *src_net, struct net_device *dev, ...@@ -183,7 +178,6 @@ static int rmnet_newlink(struct net *src_net, struct net_device *dev,
port->rmnet_mode = mode; port->rmnet_mode = mode;
rmnet_set_endpoint_config(real_dev, mux_id, dev); rmnet_set_endpoint_config(real_dev, mux_id, dev);
rmnet_set_endpoint_config(dev, mux_id, real_dev);
return 0; return 0;
err2: err2:
......
...@@ -20,9 +20,6 @@ ...@@ -20,9 +20,6 @@
#define RMNET_MAX_LOGICAL_EP 255 #define RMNET_MAX_LOGICAL_EP 255
/* Information about the next device to deliver the packet to.
* Exact usage of this parameter depends on the rmnet_mode.
*/
struct rmnet_endpoint { struct rmnet_endpoint {
u8 mux_id; u8 mux_id;
struct net_device *egress_dev; struct net_device *egress_dev;
...@@ -44,7 +41,6 @@ struct rmnet_port { ...@@ -44,7 +41,6 @@ struct rmnet_port {
extern struct rtnl_link_ops rmnet_link_ops; extern struct rtnl_link_ops rmnet_link_ops;
struct rmnet_priv { struct rmnet_priv {
struct rmnet_endpoint local_ep;
u8 mux_id; u8 mux_id;
struct net_device *real_dev; struct net_device *real_dev;
}; };
......
...@@ -116,8 +116,7 @@ rmnet_map_ingress_handler(struct sk_buff *skb, ...@@ -116,8 +116,7 @@ rmnet_map_ingress_handler(struct sk_buff *skb,
} }
static int rmnet_map_egress_handler(struct sk_buff *skb, static int rmnet_map_egress_handler(struct sk_buff *skb,
struct rmnet_port *port, struct rmnet_port *port, u8 mux_id,
struct rmnet_endpoint *ep,
struct net_device *orig_dev) struct net_device *orig_dev)
{ {
int required_headroom, additional_header_len; int required_headroom, additional_header_len;
...@@ -136,10 +135,10 @@ static int rmnet_map_egress_handler(struct sk_buff *skb, ...@@ -136,10 +135,10 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,
return RMNET_MAP_CONSUMED; return RMNET_MAP_CONSUMED;
if (port->egress_data_format & RMNET_EGRESS_FORMAT_MUXING) { if (port->egress_data_format & RMNET_EGRESS_FORMAT_MUXING) {
if (ep->mux_id == 0xff) if (mux_id == 0xff)
map_header->mux_id = 0; map_header->mux_id = 0;
else else
map_header->mux_id = ep->mux_id; map_header->mux_id = mux_id;
} }
skb->protocol = htons(ETH_P_MAP); skb->protocol = htons(ETH_P_MAP);
...@@ -176,14 +175,17 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb) ...@@ -176,14 +175,17 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb)
* for egress device configured in logical endpoint. Packet is then transmitted * for egress device configured in logical endpoint. Packet is then transmitted
* on the egress device. * on the egress device.
*/ */
void rmnet_egress_handler(struct sk_buff *skb, void rmnet_egress_handler(struct sk_buff *skb)
struct rmnet_endpoint *ep)
{ {
struct net_device *orig_dev; struct net_device *orig_dev;
struct rmnet_port *port; struct rmnet_port *port;
struct rmnet_priv *priv;
u8 mux_id;
orig_dev = skb->dev; orig_dev = skb->dev;
skb->dev = ep->egress_dev; priv = netdev_priv(orig_dev);
skb->dev = priv->real_dev;
mux_id = priv->mux_id;
port = rmnet_get_port(skb->dev); port = rmnet_get_port(skb->dev);
if (!port) { if (!port) {
...@@ -192,7 +194,7 @@ void rmnet_egress_handler(struct sk_buff *skb, ...@@ -192,7 +194,7 @@ void rmnet_egress_handler(struct sk_buff *skb,
} }
if (port->egress_data_format & RMNET_EGRESS_FORMAT_MAP) { if (port->egress_data_format & RMNET_EGRESS_FORMAT_MAP) {
switch (rmnet_map_egress_handler(skb, port, ep, orig_dev)) { switch (rmnet_map_egress_handler(skb, port, mux_id, orig_dev)) {
case RMNET_MAP_CONSUMED: case RMNET_MAP_CONSUMED:
return; return;
......
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
#include "rmnet_config.h" #include "rmnet_config.h"
void rmnet_egress_handler(struct sk_buff *skb, void rmnet_egress_handler(struct sk_buff *skb);
struct rmnet_endpoint *ep);
rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb); rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb);
......
...@@ -45,8 +45,8 @@ static netdev_tx_t rmnet_vnd_start_xmit(struct sk_buff *skb, ...@@ -45,8 +45,8 @@ static netdev_tx_t rmnet_vnd_start_xmit(struct sk_buff *skb,
struct rmnet_priv *priv; struct rmnet_priv *priv;
priv = netdev_priv(dev); priv = netdev_priv(dev);
if (priv->local_ep.egress_dev) { if (priv->real_dev) {
rmnet_egress_handler(skb, &priv->local_ep); rmnet_egress_handler(skb);
} else { } else {
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
kfree_skb(skb); kfree_skb(skb);
...@@ -143,21 +143,6 @@ u8 rmnet_vnd_get_mux(struct net_device *rmnet_dev) ...@@ -143,21 +143,6 @@ u8 rmnet_vnd_get_mux(struct net_device *rmnet_dev)
return priv->mux_id; return priv->mux_id;
} }
/* Gets the logical endpoint configuration for a RmNet virtual network device
* node. Caller should confirm that devices is a RmNet VND before calling.
*/
struct rmnet_endpoint *rmnet_vnd_get_endpoint(struct net_device *rmnet_dev)
{
struct rmnet_priv *priv;
if (!rmnet_dev)
return NULL;
priv = netdev_priv(rmnet_dev);
return &priv->local_ep;
}
int rmnet_vnd_do_flow_control(struct net_device *rmnet_dev, int enable) int rmnet_vnd_do_flow_control(struct net_device *rmnet_dev, int enable)
{ {
netdev_dbg(rmnet_dev, "Setting VND TX queue state to %d\n", enable); netdev_dbg(rmnet_dev, "Setting VND TX queue state to %d\n", enable);
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#define _RMNET_VND_H_ #define _RMNET_VND_H_
int rmnet_vnd_do_flow_control(struct net_device *dev, int enable); int rmnet_vnd_do_flow_control(struct net_device *dev, int enable);
struct rmnet_endpoint *rmnet_vnd_get_endpoint(struct net_device *dev);
int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
struct rmnet_port *port, struct rmnet_port *port,
struct net_device *real_dev); struct net_device *real_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment