Skip to content

Commit

Permalink
net: hsr: remove camel case usage in the code
Browse files Browse the repository at this point in the history
Current driver code uses camel case in many places. This is
seen when ran checkpatch.pl -f on files under net/hsr. This
patch fixes the code to remove camel case usage.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Murali Karicheri authored and David S. Miller committed Apr 7, 2019
1 parent d131fcc commit b1b4aa9
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 75 deletions.
29 changes: 15 additions & 14 deletions net/hsr/hsr_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static const struct header_ops hsr_header_ops = {
};

static void send_hsr_supervision_frame(struct hsr_port *master,
u8 type, u8 hsrVer)
u8 type, u8 hsr_ver)
{
struct sk_buff *skb;
int hlen, tlen;
Expand All @@ -264,28 +264,28 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
skb_reserve(skb, hlen);

skb->dev = master->dev;
skb->protocol = htons(hsrVer ? ETH_P_HSR : ETH_P_PRP);
skb->protocol = htons(hsr_ver ? ETH_P_HSR : ETH_P_PRP);
skb->priority = TC_PRIO_CONTROL;

if (dev_hard_header(skb, skb->dev, (hsrVer ? ETH_P_HSR : ETH_P_PRP),
if (dev_hard_header(skb, skb->dev, (hsr_ver ? ETH_P_HSR : ETH_P_PRP),
master->hsr->sup_multicast_addr,
skb->dev->dev_addr, skb->len) <= 0)
goto out;
skb_reset_mac_header(skb);

if (hsrVer > 0) {
if (hsr_ver > 0) {
hsr_tag = skb_put(skb, sizeof(struct hsr_tag));
hsr_tag->encap_proto = htons(ETH_P_PRP);
set_hsr_tag_LSDU_size(hsr_tag, HSR_V1_SUP_LSDUSIZE);
}

hsr_stag = skb_put(skb, sizeof(struct hsr_sup_tag));
set_hsr_stag_path(hsr_stag, (hsrVer ? 0x0 : 0xf));
set_hsr_stag_HSR_Ver(hsr_stag, hsrVer);
set_hsr_stag_path(hsr_stag, (hsr_ver ? 0x0 : 0xf));
set_hsr_stag_HSR_ver(hsr_stag, hsr_ver);

/* From HSRv1 on we have separate supervision sequence numbers. */
spin_lock_irqsave(&master->hsr->seqnr_lock, irqflags);
if (hsrVer > 0) {
if (hsr_ver > 0) {
hsr_stag->sequence_nr = htons(master->hsr->sup_sequence_nr);
hsr_tag->sequence_nr = htons(master->hsr->sequence_nr);
master->hsr->sup_sequence_nr++;
Expand All @@ -296,13 +296,14 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
}
spin_unlock_irqrestore(&master->hsr->seqnr_lock, irqflags);

hsr_stag->HSR_TLV_Type = type;
hsr_stag->HSR_TLV_type = type;
/* TODO: Why 12 in HSRv0? */
hsr_stag->HSR_TLV_Length = hsrVer ? sizeof(struct hsr_sup_payload) : 12;
hsr_stag->HSR_TLV_length =
hsr_ver ? sizeof(struct hsr_sup_payload) : 12;

/* Payload: MacAddressA */
hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload));
ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr);
ether_addr_copy(hsr_sp->macaddress_A, master->dev->dev_addr);

if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN))
return;
Expand All @@ -328,15 +329,15 @@ static void hsr_announce(struct timer_list *t)
rcu_read_lock();
master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);

if (hsr->announce_count < 3 && hsr->protVersion == 0) {
if (hsr->announce_count < 3 && hsr->prot_version == 0) {
send_hsr_supervision_frame(master, HSR_TLV_ANNOUNCE,
hsr->protVersion);
hsr->prot_version);
hsr->announce_count++;

interval = msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL);
} else {
send_hsr_supervision_frame(master, HSR_TLV_LIFE_CHECK,
hsr->protVersion);
hsr->prot_version);

interval = msecs_to_jiffies(HSR_LIFE_CHECK_INTERVAL);
}
Expand Down Expand Up @@ -455,7 +456,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr);
hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec;

hsr->protVersion = protocol_version;
hsr->prot_version = protocol_version;

/* FIXME: should I modify the value of these?
*
Expand Down
38 changes: 19 additions & 19 deletions net/hsr/hsr_forward.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,40 +48,40 @@ struct hsr_frame_info {
*/
static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb)
{
struct ethhdr *ethHdr;
struct hsr_sup_tag *hsrSupTag;
struct hsrv1_ethhdr_sp *hsrV1Hdr;
struct ethhdr *eth_hdr;
struct hsr_sup_tag *hsr_sup_tag;
struct hsrv1_ethhdr_sp *hsr_V1_hdr;

WARN_ON_ONCE(!skb_mac_header_was_set(skb));
ethHdr = (struct ethhdr *)skb_mac_header(skb);
eth_hdr = (struct ethhdr *)skb_mac_header(skb);

/* Correct addr? */
if (!ether_addr_equal(ethHdr->h_dest,
if (!ether_addr_equal(eth_hdr->h_dest,
hsr->sup_multicast_addr))
return false;

/* Correct ether type?. */
if (!(ethHdr->h_proto == htons(ETH_P_PRP) ||
ethHdr->h_proto == htons(ETH_P_HSR)))
if (!(eth_hdr->h_proto == htons(ETH_P_PRP) ||
eth_hdr->h_proto == htons(ETH_P_HSR)))
return false;

/* Get the supervision header from correct location. */
if (ethHdr->h_proto == htons(ETH_P_HSR)) { /* Okay HSRv1. */
hsrV1Hdr = (struct hsrv1_ethhdr_sp *)skb_mac_header(skb);
if (hsrV1Hdr->hsr.encap_proto != htons(ETH_P_PRP))
if (eth_hdr->h_proto == htons(ETH_P_HSR)) { /* Okay HSRv1. */
hsr_V1_hdr = (struct hsrv1_ethhdr_sp *)skb_mac_header(skb);
if (hsr_V1_hdr->hsr.encap_proto != htons(ETH_P_PRP))
return false;

hsrSupTag = &hsrV1Hdr->hsr_sup;
hsr_sup_tag = &hsr_V1_hdr->hsr_sup;
} else {
hsrSupTag =
hsr_sup_tag =
&((struct hsrv0_ethhdr_sp *)skb_mac_header(skb))->hsr_sup;
}

if (hsrSupTag->HSR_TLV_Type != HSR_TLV_ANNOUNCE &&
hsrSupTag->HSR_TLV_Type != HSR_TLV_LIFE_CHECK)
if (hsr_sup_tag->HSR_TLV_type != HSR_TLV_ANNOUNCE &&
hsr_sup_tag->HSR_TLV_type != HSR_TLV_LIFE_CHECK)
return false;
if (hsrSupTag->HSR_TLV_Length != 12 &&
hsrSupTag->HSR_TLV_Length != sizeof(struct hsr_sup_payload))
if (hsr_sup_tag->HSR_TLV_length != 12 &&
hsr_sup_tag->HSR_TLV_length != sizeof(struct hsr_sup_payload))
return false;

return true;
Expand Down Expand Up @@ -125,7 +125,7 @@ static struct sk_buff *frame_get_stripped_skb(struct hsr_frame_info *frame,
}

static void hsr_fill_tag(struct sk_buff *skb, struct hsr_frame_info *frame,
struct hsr_port *port, u8 protoVersion)
struct hsr_port *port, u8 proto_version)
{
struct hsr_ethhdr *hsr_ethhdr;
int lane_id;
Expand All @@ -146,7 +146,7 @@ static void hsr_fill_tag(struct sk_buff *skb, struct hsr_frame_info *frame,
set_hsr_tag_LSDU_size(&hsr_ethhdr->hsr_tag, lsdu_size);
hsr_ethhdr->hsr_tag.sequence_nr = htons(frame->sequence_nr);
hsr_ethhdr->hsr_tag.encap_proto = hsr_ethhdr->ethhdr.h_proto;
hsr_ethhdr->ethhdr.h_proto = htons(protoVersion ?
hsr_ethhdr->ethhdr.h_proto = htons(proto_version ?
ETH_P_HSR : ETH_P_PRP);
}

Expand Down Expand Up @@ -176,7 +176,7 @@ static struct sk_buff *create_tagged_skb(struct sk_buff *skb_o,
memmove(dst, src, movelen);
skb_reset_mac_header(skb);

hsr_fill_tag(skb, frame, port, port->hsr->protVersion);
hsr_fill_tag(skb, frame, port, port->hsr->prot_version);

return skb;
}
Expand Down
Loading

0 comments on commit b1b4aa9

Please sign in to comment.