Netdev List
 help / color / mirror / Atom feed
* ipv6_get_ifaddr() not exported
From: Valentine Sinitsyn @ 2017-01-20  8:55 UTC (permalink / raw)
  To: netdev

Hi all,

I'm working on a custom Netfilter module which could seemingly use 
ipv6_get_ifaddr() function to find a netdev which has a destination IPv6 
assigned (if any). The function is public, but not exported, so I can't 
use it in my module.

Am I doing anything wrong, or I'm just a first type to use 
ipv6_get_ifaddr() outside net/ipv6 code, and it's okay to export it now?

Thanks,
Valentine

^ permalink raw reply

* Re: [PATCHv3 net-next 4/4] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter
From: Xin Long @ 2017-01-20  8:56 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: network dev, linux-sctp, Neil Horman, Vlad Yasevich, davem
In-Reply-To: <20170119214750.GM3781@localhost.localdomain>

On Fri, Jan 20, 2017 at 5:47 AM, Marcelo Ricardo Leitner
<marcelo.leitner@gmail.com> wrote:
> On Fri, Jan 20, 2017 at 01:19:14AM +0800, Xin Long wrote:
>> This patch is to implement Sender-Side Procedures for the Add
>> Outgoing and Incoming Streams Request Parameter described in
>> rfc6525 section 5.1.5-5.1.6.
>>
>> It is also to add sockopt SCTP_ADD_STREAMS in rfc6525 section
>> 6.3.4 for users.
>>
>> Signed-off-by: Xin Long <lucien.xin@gmail.com>
>> ---
>>  include/net/sctp/sctp.h   |  2 +
>>  include/uapi/linux/sctp.h |  7 ++++
>>  net/sctp/socket.c         | 29 ++++++++++++++
>>  net/sctp/stream.c         | 99 +++++++++++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 137 insertions(+)
>>
>> diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
>> index b93820f..68ee1a6 100644
>> --- a/include/net/sctp/sctp.h
>> +++ b/include/net/sctp/sctp.h
>> @@ -199,6 +199,8 @@ int sctp_offload_init(void);
>>  int sctp_send_reset_streams(struct sctp_association *asoc,
>>                           struct sctp_reset_streams *params);
>>  int sctp_send_reset_assoc(struct sctp_association *asoc);
>> +int sctp_send_add_streams(struct sctp_association *asoc,
>> +                       struct sctp_add_streams *params);
>>
>>  /*
>>   * Module global variables
>> diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
>> index c0bd8c3..a91a9cc 100644
>> --- a/include/uapi/linux/sctp.h
>> +++ b/include/uapi/linux/sctp.h
>> @@ -118,6 +118,7 @@ typedef __s32 sctp_assoc_t;
>>  #define SCTP_ENABLE_STREAM_RESET     118
>>  #define SCTP_RESET_STREAMS   119
>>  #define SCTP_RESET_ASSOC     120
>> +#define SCTP_ADD_STREAMS     121
>>
>>  /* PR-SCTP policies */
>>  #define SCTP_PR_SCTP_NONE    0x0000
>> @@ -1027,4 +1028,10 @@ struct sctp_reset_streams {
>>       uint16_t srs_stream_list[];     /* list if srs_num_streams is not 0 */
>>  };
>>
>> +struct sctp_add_streams {
>> +     sctp_assoc_t sas_assoc_id;
>> +     uint16_t sas_instrms;
>> +     uint16_t sas_outstrms;
>> +};
>> +
>>  #endif /* _UAPI_SCTP_H */
>> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
>> index 2c5c9ca..ae0a99e 100644
>> --- a/net/sctp/socket.c
>> +++ b/net/sctp/socket.c
>> @@ -3838,6 +3838,32 @@ static int sctp_setsockopt_reset_assoc(struct sock *sk,
>>       return retval;
>>  }
>>
>> +static int sctp_setsockopt_add_streams(struct sock *sk,
>> +                                    char __user *optval,
>> +                                    unsigned int optlen)
>> +{
>> +     struct sctp_association *asoc;
>> +     struct sctp_add_streams params;
>> +     int retval = -EINVAL;
>> +
>> +     if (optlen != sizeof(params))
>> +             goto out;
>> +
>> +     if (copy_from_user(&params, optval, optlen)) {
>> +             retval = -EFAULT;
>> +             goto out;
>> +     }
>> +
>> +     asoc = sctp_id2assoc(sk, params.sas_assoc_id);
>> +     if (!asoc)
>> +             goto out;
>> +
>> +     retval = sctp_send_add_streams(asoc, &params);
>> +
>> +out:
>> +     return retval;
>> +}
>> +
>>  /* API 6.2 setsockopt(), getsockopt()
>>   *
>>   * Applications use setsockopt() and getsockopt() to set or retrieve
>> @@ -4013,6 +4039,9 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
>>       case SCTP_RESET_ASSOC:
>>               retval = sctp_setsockopt_reset_assoc(sk, optval, optlen);
>>               break;
>> +     case SCTP_ADD_STREAMS:
>> +             retval = sctp_setsockopt_add_streams(sk, optval, optlen);
>> +             break;
>>       default:
>>               retval = -ENOPROTOOPT;
>>               break;
>> diff --git a/net/sctp/stream.c b/net/sctp/stream.c
>> index b368191..ba41837 100644
>> --- a/net/sctp/stream.c
>> +++ b/net/sctp/stream.c
>> @@ -195,3 +195,102 @@ int sctp_send_reset_assoc(struct sctp_association *asoc)
>>
>>       return retval;
>>  }
>> +
>> +int sctp_send_add_streams(struct sctp_association *asoc,
>> +                       struct sctp_add_streams *params)
>> +{
>> +     struct sctp_stream *stream = asoc->stream;
>> +     struct sctp_chunk *chunk = NULL;
>> +     int retval = -EINVAL;
>> +     __u16 out, in;
>> +
>> +     if (!asoc->peer.reconf_capable ||
>> +         !(asoc->strreset_enable & SCTP_ENABLE_CHANGE_ASSOC_REQ)) {
>> +             retval = -ENOPROTOOPT;
>> +             goto out;
>> +     }
>> +
>> +     if (asoc->strreset_outstanding) {
>> +             retval = -EINPROGRESS;
>> +             goto out;
>> +     }
>> +
>> +     out = params->sas_outstrms;
>> +     in  = params->sas_instrms;
>> +
>> +     if (!out && !in)
>
> [@]
>
>> +             goto out;
>> +
>> +     if (out) {
>> +             __u16 nums = stream->outcnt + out;
>> +
>> +             /* Check for overflow, can't use nums here */
>> +             if (stream->outcnt + out > SCTP_MAX_STREAM)
>> +                     goto out;
>
> You should do these overflow checks before doing actual work,
> preferreably at [@] mark above.
> Here it's fine, but when [*] below run, it may be too late.
>
>> +
>> +             /* Use ksize to check if stream array really needs to realloc */
>> +             if (ksize(stream->out) / sizeof(*stream->out) < nums) {
>> +                     struct sctp_stream_out *streamout;
>> +
>> +                     streamout = kcalloc(nums, sizeof(*streamout),
>> +                                         GFP_KERNEL);
>> +                     if (!streamout) {
>> +                             retval = -ENOMEM;
>> +                             goto out;
>> +                     }
>> +
>> +                     memcpy(streamout, stream->out,
>> +                            sizeof(*streamout) * stream->outcnt);
>> +
>> +                     kfree(stream->out);
>> +                     stream->out = streamout;
>> +             }
>> +
>> +             stream->outcnt = nums;
>> +     }
>> +
>> +     if (in) {
>> +             __u16 nums = stream->incnt + in;
>> +
>> +             if (stream->incnt + in > SCTP_MAX_STREAM)
>> +                     goto out;
>
> [*]
it will cause alloc unused memory, but no consistent issue if
we move outcnt/incnt after checking retval.

if we want overflow check to go ahead of the actual work, another
conditions if (in) {} if(out) {} have to be added.

>
>> +
>> +             if (ksize(stream->in) / sizeof(*stream->in) < nums) {
>> +                     struct sctp_stream_in *streamin;
>> +
>> +                     streamin = kcalloc(nums, sizeof(*streamin),
>> +                                        GFP_KERNEL);
>> +                     if (!streamin) {
>> +                             retval = -ENOMEM;
>> +                             goto out;
>> +                     }
>> +
>> +                     memcpy(streamin, stream->in,
>> +                            sizeof(*streamin) * stream->incnt);
>> +
>> +                     kfree(stream->in);
>> +                     stream->in = streamin;
>> +             }
>> +
>> +             stream->incnt = nums;
>> +     }
>> +
>> +     chunk = sctp_make_strreset_addstrm(asoc, out, in);
>> +     if (!chunk) {
>> +             retval = -ENOMEM;
>> +             goto out;
>> +     }
>> +
>> +     asoc->strreset_outstanding = !!out + !!in;
>> +     asoc->strreset_chunk = chunk;
>> +     sctp_chunk_hold(asoc->strreset_chunk);
>> +
>> +     retval = sctp_send_reconf(asoc, chunk);
>> +     if (retval) {
>> +             sctp_chunk_put(asoc->strreset_chunk);
>> +             asoc->strreset_chunk = NULL;
>> +     }
>> +
>> +out:
>> +     return retval;
>> +}
>> --
>> 2.1.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>

^ permalink raw reply

* [PATCH net-next] cxgb4: Fix unused variable warning
From: Ganesh Goudar @ 2017-01-20  9:17 UTC (permalink / raw)
  To: netdev, davem; +Cc: nirranjan, hariprasad, Ganesh Goudar

Fix unused variable warning when CONFIG_PCI_IOV is not
defined.

Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 4da6f90..49e000e 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4643,7 +4643,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	u32 whoami, pl_rev;
 	enum chip_type chip;
 	static int adap_idx = 1;
+#ifdef CONFIG_PCI_IOV
 	u32 v, port_vec;
+#endif
 
 	printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION);
 
-- 
2.1.0

^ permalink raw reply related

* [PATCH iproute2 net-next v2] tc: m_csum: add support for SCTP checksum
From: Davide Caratti @ 2017-01-20 10:10 UTC (permalink / raw)
  To: Stephen Hemminger, Gregoire Baron, Jiri Benc; +Cc: netdev

'sctp' parameter can now be used as 'csum' target to enable CRC32c
computation on SCTP packets.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---

Notes:
    V2
    - update man/man8/tc-csum.8 to include 'sctp' target

 man/man8/tc-csum.8 |  7 +++++--
 tc/m_csum.c        | 11 ++++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/man/man8/tc-csum.8 b/man/man8/tc-csum.8
index 3a64c82..f4392a4 100644
--- a/man/man8/tc-csum.8
+++ b/man/man8/tc-csum.8
@@ -19,6 +19,7 @@ csum - checksum update action
 .BR tcp " |"
 .BR udp " |"
 .BR udplite " |"
+.BR sctp " |"
 .IR SWEETS " }"
 
 .ti -8
@@ -43,9 +44,11 @@ IGMP header
 TCP header
 .RB ( tcp ),
 UDP header
-.RB ( udp ") or"
+.RB ( udp ),
 UDPLite header
-.RB ( udplite ).
+.RB ( udplite ") or"
+SCTP header
+.RB ( sctp ).
 .TP
 .B SWEETS
 These are merely syntactic sugar and ignored internally.
diff --git a/tc/m_csum.c b/tc/m_csum.c
index d5b1af6..0ee8cad 100644
--- a/tc/m_csum.c
+++ b/tc/m_csum.c
@@ -24,7 +24,7 @@ explain(void)
 {
 	fprintf(stderr, "Usage: ... csum <UPDATE>\n"
 			"Where: UPDATE := <TARGET> [<UPDATE>]\n"
-			"       TARGET := { ip4h | icmp | igmp | tcp | udp | udplite | <SWEETS> }\n"
+			"       TARGET := { ip4h | icmp | igmp | tcp | udp | udplite | sctp | <SWEETS> }\n"
 			"       SWEETS := { and | or | \'+\' }\n");
 }
 
@@ -65,6 +65,9 @@ parse_csum_args(int *argc_p, char ***argv_p, struct tc_csum *sel)
 		else if (matches(*argv, "udplite") == 0)
 			sel->update_flags |= TCA_CSUM_UPDATE_FLAG_UDPLITE;
 
+		else if (matches(*argv, "sctp") == 0)
+			sel->update_flags |= TCA_CSUM_UPDATE_FLAG_SCTP;
+
 		else if ((matches(*argv, "and") == 0) ||
 			 (matches(*argv, "or") == 0) ||
 			 (matches(*argv, "+") == 0))
@@ -160,6 +163,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
 	char *uflag_4 = "";
 	char *uflag_5 = "";
 	char *uflag_6 = "";
+	char *uflag_7 = "";
 
 	int uflag_count = 0;
 
@@ -191,13 +195,14 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
 	CSUM_UFLAG_BUFFER(uflag_4, TCA_CSUM_UPDATE_FLAG_TCP, "tcp");
 	CSUM_UFLAG_BUFFER(uflag_5, TCA_CSUM_UPDATE_FLAG_UDP, "udp");
 	CSUM_UFLAG_BUFFER(uflag_6, TCA_CSUM_UPDATE_FLAG_UDPLITE, "udplite");
+	CSUM_UFLAG_BUFFER(uflag_7, TCA_CSUM_UPDATE_FLAG_SCTP, "sctp");
 	if (!uflag_count) {
 		uflag_1 = "?empty";
 	}
 
-	fprintf(f, "csum (%s%s%s%s%s%s) action %s\n",
+	fprintf(f, "csum (%s%s%s%s%s%s%s) action %s\n",
 		uflag_1, uflag_2, uflag_3,
-		uflag_4, uflag_5, uflag_6,
+		uflag_4, uflag_5, uflag_6, uflag_7,
 		action_n2a(sel->action));
 	fprintf(f, "\tindex %u ref %d bind %d", sel->index, sel->refcnt,
 		sel->bindcnt);
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH net] net/mlx5e: Do not recycle pages from emergency reserve
From: Saeed Mahameed @ 2017-01-20 10:28 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Tariq Toukan, Saeed Mahameed
In-Reply-To: <1484809388.16328.19.camel@edumazet-glaptop3.roam.corp.google.com>

On Thu, Jan 19, 2017 at 9:03 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> A driver using dev_alloc_page() must not reuse a page allocated from
> emergency memory reserve.
>
> Otherwise all packets using this page will be immediately dropped,
> unless for very specific sockets having SOCK_MEMALLOC bit set.
>
> This issue might be hard to debug, because only a fraction of received
> packets would be dropped.
>
> Fixes: 4415a0319f92 ("net/mlx5e: Implement RX mapped page cache for page recycle")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Tariq Toukan <tariqt@mellanox.com>
> Cc: Saeed Mahameed <saeedm@mellanox.com>

Acked-by: Saeed Mahameed <saeedm@mellanox.com>

^ permalink raw reply

* Please read and get back to me its urgent. Thank you!
From: Benjamin Bikko @ 2017-01-20 10:27 UTC (permalink / raw)


Good  day,
I have an important message for you concerning the death of my
deceased client . I am aware you are not related to this by blood,
nationality or family, therefore I ask that you consider the factors
in my email and keep it strictly confidential. However, if you are
unable to meet my demand, kindly discard of it. This is regards the
fund 15.5 million us dollars and 5 Kilos of GOLD BAR  he left behind
here in this country (Togo),Contact me with your full names,
occupation, country of residence and direct telephone number only at
(bikkobikko001@consultant.com) for full details regards this claim.I
await your urgent response today.
Regards,
Benjamin Bikko .

^ permalink raw reply

* Re: [PATCH net] virtio-net: restore VIRTIO_HDR_F_DATA_VALID on receiving
From: Rolf Neugebauer via Virtualization @ 2017-01-20 10:56 UTC (permalink / raw)
  To: Jason Wang
  Cc: Rolf Neugebauer, Linux Kernel Network Developers, mst, LKML,
	virtualization
In-Reply-To: <1484893962-7614-1-git-send-email-jasowang@redhat.com>

On Fri, Jan 20, 2017 at 6:32 AM, Jason Wang <jasowang@redhat.com> wrote:
> Commit 501db511397f ("virtio: don't set VIRTIO_NET_HDR_F_DATA_VALID on
> xmit") in fact disables VIRTIO_HDR_F_DATA_VALID on receiving path too,
> fixing this by adding a hint (has_data_valid) and set it only on the
> receiving path.
>
> Cc: Rolf Neugebauer <rolf.neugebauer@docker.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Acked-by: Rolf Neugebauer <rolf.neugebauer@docker.com>

Ah, I missed this use of the function. Looks like this patch does not
regress the issue I was seeing with virtio_net.

Rolf

> ---
>  drivers/net/macvtap.c      | 2 +-
>  drivers/net/tun.c          | 2 +-
>  drivers/net/virtio_net.c   | 2 +-
>  include/linux/virtio_net.h | 6 +++++-
>  net/packet/af_packet.c     | 4 ++--
>  5 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 5c26653..4026185 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -825,7 +825,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
>                         return -EINVAL;
>
>                 if (virtio_net_hdr_from_skb(skb, &vnet_hdr,
> -                                           macvtap_is_little_endian(q)))
> +                                           macvtap_is_little_endian(q), true))
>                         BUG();
>
>                 if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index cd8e02c..2cd10b2 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1360,7 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,
>                         return -EINVAL;
>
>                 if (virtio_net_hdr_from_skb(skb, &gso,
> -                                           tun_is_little_endian(tun))) {
> +                                           tun_is_little_endian(tun), true)) {
>                         struct skb_shared_info *sinfo = skb_shinfo(skb);
>                         pr_err("unexpected GSO type: "
>                                "0x%x, gso_size %d, hdr_len %d\n",
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 4a10500..3474243 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1104,7 +1104,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
>                 hdr = skb_vnet_hdr(skb);
>
>         if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
> -                                   virtio_is_little_endian(vi->vdev)))
> +                                   virtio_is_little_endian(vi->vdev), false))
>                 BUG();
>
>         if (vi->mergeable_rx_bufs)
> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> index 5643647..5209b5e 100644
> --- a/include/linux/virtio_net.h
> +++ b/include/linux/virtio_net.h
> @@ -56,7 +56,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
>
>  static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
>                                           struct virtio_net_hdr *hdr,
> -                                         bool little_endian)
> +                                         bool little_endian,
> +                                         bool has_data_valid)
>  {
>         memset(hdr, 0, sizeof(*hdr));   /* no info leak */
>
> @@ -91,6 +92,9 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
>                                 skb_checksum_start_offset(skb));
>                 hdr->csum_offset = __cpu_to_virtio16(little_endian,
>                                 skb->csum_offset);
> +       } else if (has_data_valid &&
> +                  skb->ip_summed == CHECKSUM_UNNECESSARY) {
> +               hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID;
>         } /* else everything is zero */
>
>         return 0;
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index b9e1a13..3d555c7 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -1976,7 +1976,7 @@ static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb,
>                 return -EINVAL;
>         *len -= sizeof(vnet_hdr);
>
> -       if (virtio_net_hdr_from_skb(skb, &vnet_hdr, vio_le()))
> +       if (virtio_net_hdr_from_skb(skb, &vnet_hdr, vio_le(), true))
>                 return -EINVAL;
>
>         return memcpy_to_msg(msg, (void *)&vnet_hdr, sizeof(vnet_hdr));
> @@ -2237,7 +2237,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
>         if (po->has_vnet_hdr) {
>                 if (virtio_net_hdr_from_skb(skb, h.raw + macoff -
>                                             sizeof(struct virtio_net_hdr),
> -                                           vio_le())) {
> +                                           vio_le(), true)) {
>                         spin_lock(&sk->sk_receive_queue.lock);
>                         goto drop_n_account;
>                 }
> --
> 2.7.4
>

^ permalink raw reply

* Re: Re: [PATCH] rtlwifi: rtl8192x: Enabling and disabling hardware interrupts after enabling local irq flags
From: Lino Sanfilippo @ 2017-01-20 11:14 UTC (permalink / raw)
  To: Larry Finger
  Cc: Bharat Kumar Gogada, chaoming_li, linux-wireless, linux-kernel,
	kvalo, netdev, rgummal, Bharat Kumar Gogada
In-Reply-To: <b2e783f6-fa09-e287-8119-266299cdae22@lwfinger.net>

Hi,

>
> 
> This patch should be enhanced with the smb_xx() calls as suggested by by Lino.
> 

If you do this, please place the smp_rmb() before the if condition in the irq
handler like

smp_rmb();
if (rtlpci->irq_enabled == 0) {
    return ret;


as I think that the suggestion I made before was not correct (sorry for the
confusion). 

Regards,
Lino 
 

^ permalink raw reply

* Re: [PATCH v5 2/2] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341 (fwd)
From: Julia Lawall @ 2017-01-20 11:43 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, netdev,
	linux-kernel, David S. Miller, Jason Cooper,
	Sebastian Hesselbarth, Gregory CLEMENT, Thomas Petazzoni,
	linux-arm-kernel, Nadav Haklai, Wilson Ding, Kostya Porotchkin,
	Joe Zhou, Jon Pannell, kbuild-all

mv88e6xxx_6341_family is checked twice, on line 2606 and 2607.

julia

---------- Forwarded message ----------
Date: Fri, 20 Jan 2017 19:38:12 +0800
From: kbuild test robot <fengguang.wu@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH v5 2/2] net: dsa: mv88e6xxx: Add support for ethernet switch
     88E6341

In-Reply-To: <20170119214934.27442-3-gregory.clement@free-electrons.com>

Hi Gregory,

[auto build test WARNING on net-next/master]
[also build test WARNING on next-20170120]
[cannot apply to v4.10-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Gregory-CLEMENT/Add-support-for-the-ethernet-switch-on-the-ESPRESSObin/20170120-180348
:::::: branch date: 2 hours ago
:::::: commit date: 2 hours ago

>> drivers/net/dsa/mv88e6xxx/chip.c:2606:36-63: duplicated argument to && or ||

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout c618c22093235e96adf0c6f39497eeed083a60cf
vim +2606 drivers/net/dsa/mv88e6xxx/chip.c

0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2590  	if (err)
0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2591  		return err;
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2592
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2593  	/* Egress rate control 2: disable egress rate control. */
0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2594  	err = mv88e6xxx_port_write(chip, port, PORT_RATE_CONTROL_2, 0x0000);
0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2595  	if (err)
0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2596  		return err;
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2597
b35d322a1 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-12-03  2598  	if (chip->info->ops->port_pause_config) {
b35d322a1 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-12-03  2599  		err = chip->info->ops->port_pause_config(chip, port);
0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2600  		if (err)
0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2601  			return err;
b35d322a1 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-12-03  2602  	}
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2603
b35d322a1 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-12-03  2604  	if (mv88e6xxx_6352_family(chip) || mv88e6xxx_6351_family(chip) ||
b35d322a1 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-12-03  2605  	    mv88e6xxx_6165_family(chip) || mv88e6xxx_6097_family(chip) ||
c618c2209 drivers/net/dsa/mv88e6xxx/chip.c Gregory CLEMENT 2017-01-19 @2606  	    mv88e6xxx_6320_family(chip) || mv88e6xxx_6341_family(chip) ||
c618c2209 drivers/net/dsa/mv88e6xxx/chip.c Gregory CLEMENT 2017-01-19  2607  	    mv88e6xxx_6341_family(chip)) {
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2608  		/* Port ATU control: disable limiting the number of
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2609  		 * address database entries that this port is allowed
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2610  		 * to use.
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2611  		 */
0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2612  		err = mv88e6xxx_port_write(chip, port, PORT_ATU_CONTROL,
0e7b99257 drivers/net/dsa/mv88e6xxx/chip.c Andrew Lunn     2016-09-21  2613  					   0x0000);
54d792f25 drivers/net/dsa/mv88e6xxx.c      Andrew Lunn     2015-05-06  2614  		/* Priority Override: disable DA, SA and VTU priority

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply

* Re: [PATCHv3 net-next 4/4] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter
From: Marcelo Ricardo Leitner @ 2017-01-20 11:43 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, Neil Horman, Vlad Yasevich, davem
In-Reply-To: <CADvbK_dAG6gLb00VmqvuTnbXcBnK5-bSytkqd_kNEv3SxakMgw@mail.gmail.com>

On Fri, Jan 20, 2017 at 04:56:30PM +0800, Xin Long wrote:
> On Fri, Jan 20, 2017 at 5:47 AM, Marcelo Ricardo Leitner
> <marcelo.leitner@gmail.com> wrote:
> > On Fri, Jan 20, 2017 at 01:19:14AM +0800, Xin Long wrote:
> >> This patch is to implement Sender-Side Procedures for the Add
> >> Outgoing and Incoming Streams Request Parameter described in
> >> rfc6525 section 5.1.5-5.1.6.
> >>
> >> It is also to add sockopt SCTP_ADD_STREAMS in rfc6525 section
> >> 6.3.4 for users.
> >>
> >> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> >> ---
> >>  include/net/sctp/sctp.h   |  2 +
> >>  include/uapi/linux/sctp.h |  7 ++++
> >>  net/sctp/socket.c         | 29 ++++++++++++++
> >>  net/sctp/stream.c         | 99 +++++++++++++++++++++++++++++++++++++++++++++++
> >>  4 files changed, 137 insertions(+)
> >>
> >> diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
> >> index b93820f..68ee1a6 100644
> >> --- a/include/net/sctp/sctp.h
> >> +++ b/include/net/sctp/sctp.h
> >> @@ -199,6 +199,8 @@ int sctp_offload_init(void);
> >>  int sctp_send_reset_streams(struct sctp_association *asoc,
> >>                           struct sctp_reset_streams *params);
> >>  int sctp_send_reset_assoc(struct sctp_association *asoc);
> >> +int sctp_send_add_streams(struct sctp_association *asoc,
> >> +                       struct sctp_add_streams *params);
> >>
> >>  /*
> >>   * Module global variables
> >> diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
> >> index c0bd8c3..a91a9cc 100644
> >> --- a/include/uapi/linux/sctp.h
> >> +++ b/include/uapi/linux/sctp.h
> >> @@ -118,6 +118,7 @@ typedef __s32 sctp_assoc_t;
> >>  #define SCTP_ENABLE_STREAM_RESET     118
> >>  #define SCTP_RESET_STREAMS   119
> >>  #define SCTP_RESET_ASSOC     120
> >> +#define SCTP_ADD_STREAMS     121
> >>
> >>  /* PR-SCTP policies */
> >>  #define SCTP_PR_SCTP_NONE    0x0000
> >> @@ -1027,4 +1028,10 @@ struct sctp_reset_streams {
> >>       uint16_t srs_stream_list[];     /* list if srs_num_streams is not 0 */
> >>  };
> >>
> >> +struct sctp_add_streams {
> >> +     sctp_assoc_t sas_assoc_id;
> >> +     uint16_t sas_instrms;
> >> +     uint16_t sas_outstrms;
> >> +};
> >> +
> >>  #endif /* _UAPI_SCTP_H */
> >> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> >> index 2c5c9ca..ae0a99e 100644
> >> --- a/net/sctp/socket.c
> >> +++ b/net/sctp/socket.c
> >> @@ -3838,6 +3838,32 @@ static int sctp_setsockopt_reset_assoc(struct sock *sk,
> >>       return retval;
> >>  }
> >>
> >> +static int sctp_setsockopt_add_streams(struct sock *sk,
> >> +                                    char __user *optval,
> >> +                                    unsigned int optlen)
> >> +{
> >> +     struct sctp_association *asoc;
> >> +     struct sctp_add_streams params;
> >> +     int retval = -EINVAL;
> >> +
> >> +     if (optlen != sizeof(params))
> >> +             goto out;
> >> +
> >> +     if (copy_from_user(&params, optval, optlen)) {
> >> +             retval = -EFAULT;
> >> +             goto out;
> >> +     }
> >> +
> >> +     asoc = sctp_id2assoc(sk, params.sas_assoc_id);
> >> +     if (!asoc)
> >> +             goto out;
> >> +
> >> +     retval = sctp_send_add_streams(asoc, &params);
> >> +
> >> +out:
> >> +     return retval;
> >> +}
> >> +
> >>  /* API 6.2 setsockopt(), getsockopt()
> >>   *
> >>   * Applications use setsockopt() and getsockopt() to set or retrieve
> >> @@ -4013,6 +4039,9 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
> >>       case SCTP_RESET_ASSOC:
> >>               retval = sctp_setsockopt_reset_assoc(sk, optval, optlen);
> >>               break;
> >> +     case SCTP_ADD_STREAMS:
> >> +             retval = sctp_setsockopt_add_streams(sk, optval, optlen);
> >> +             break;
> >>       default:
> >>               retval = -ENOPROTOOPT;
> >>               break;
> >> diff --git a/net/sctp/stream.c b/net/sctp/stream.c
> >> index b368191..ba41837 100644
> >> --- a/net/sctp/stream.c
> >> +++ b/net/sctp/stream.c
> >> @@ -195,3 +195,102 @@ int sctp_send_reset_assoc(struct sctp_association *asoc)
> >>
> >>       return retval;
> >>  }
> >> +
> >> +int sctp_send_add_streams(struct sctp_association *asoc,
> >> +                       struct sctp_add_streams *params)
> >> +{
> >> +     struct sctp_stream *stream = asoc->stream;
> >> +     struct sctp_chunk *chunk = NULL;
> >> +     int retval = -EINVAL;
> >> +     __u16 out, in;
> >> +
> >> +     if (!asoc->peer.reconf_capable ||
> >> +         !(asoc->strreset_enable & SCTP_ENABLE_CHANGE_ASSOC_REQ)) {
> >> +             retval = -ENOPROTOOPT;
> >> +             goto out;
> >> +     }
> >> +
> >> +     if (asoc->strreset_outstanding) {
> >> +             retval = -EINPROGRESS;
> >> +             goto out;
> >> +     }
> >> +
> >> +     out = params->sas_outstrms;
> >> +     in  = params->sas_instrms;
> >> +
> >> +     if (!out && !in)
> >
> > [@]
> >
> >> +             goto out;
> >> +
> >> +     if (out) {
> >> +             __u16 nums = stream->outcnt + out;
> >> +
> >> +             /* Check for overflow, can't use nums here */
> >> +             if (stream->outcnt + out > SCTP_MAX_STREAM)
> >> +                     goto out;
> >
> > You should do these overflow checks before doing actual work,
> > preferreably at [@] mark above.
> > Here it's fine, but when [*] below run, it may be too late.
> >
> >> +
> >> +             /* Use ksize to check if stream array really needs to realloc */
> >> +             if (ksize(stream->out) / sizeof(*stream->out) < nums) {
> >> +                     struct sctp_stream_out *streamout;
> >> +
> >> +                     streamout = kcalloc(nums, sizeof(*streamout),
> >> +                                         GFP_KERNEL);
> >> +                     if (!streamout) {
> >> +                             retval = -ENOMEM;
> >> +                             goto out;
> >> +                     }
> >> +
> >> +                     memcpy(streamout, stream->out,
> >> +                            sizeof(*streamout) * stream->outcnt);
> >> +
> >> +                     kfree(stream->out);
> >> +                     stream->out = streamout;
> >> +             }
> >> +
> >> +             stream->outcnt = nums;
> >> +     }
> >> +
> >> +     if (in) {
> >> +             __u16 nums = stream->incnt + in;
> >> +
> >> +             if (stream->incnt + in > SCTP_MAX_STREAM)
> >> +                     goto out;
> >
> > [*]
> it will cause alloc unused memory, but no consistent issue if
> we move outcnt/incnt after checking retval.

Ah yes, right, so it doesn't hurt actually.

> 
> if we want overflow check to go ahead of the actual work, another
> conditions if (in) {} if(out) {} have to be added.

Not sure why? Seems 
if (!in || !out || stream->incnt + in > SCTP_MAX_STREAM ||
    stream->outcnt + out > SCTP_MAX_STREAM)
	goto out;
would do it, no?

> 
> >
> >> +
> >> +             if (ksize(stream->in) / sizeof(*stream->in) < nums) {
> >> +                     struct sctp_stream_in *streamin;
> >> +
> >> +                     streamin = kcalloc(nums, sizeof(*streamin),
> >> +                                        GFP_KERNEL);
> >> +                     if (!streamin) {
> >> +                             retval = -ENOMEM;
> >> +                             goto out;
> >> +                     }
> >> +
> >> +                     memcpy(streamin, stream->in,
> >> +                            sizeof(*streamin) * stream->incnt);
> >> +
> >> +                     kfree(stream->in);
> >> +                     stream->in = streamin;
> >> +             }
> >> +
> >> +             stream->incnt = nums;
> >> +     }
> >> +
> >> +     chunk = sctp_make_strreset_addstrm(asoc, out, in);
> >> +     if (!chunk) {
> >> +             retval = -ENOMEM;
> >> +             goto out;
> >> +     }
> >> +
> >> +     asoc->strreset_outstanding = !!out + !!in;
> >> +     asoc->strreset_chunk = chunk;
> >> +     sctp_chunk_hold(asoc->strreset_chunk);
> >> +
> >> +     retval = sctp_send_reconf(asoc, chunk);
> >> +     if (retval) {
> >> +             sctp_chunk_put(asoc->strreset_chunk);
> >> +             asoc->strreset_chunk = NULL;
> >> +     }
> >> +
> >> +out:
> >> +     return retval;
> >> +}
> >> --
> >> 2.1.0
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: [PATCH] net: ethtool: avoid allocation failure for dump_regs
From: Kalle Valo @ 2017-01-20 11:44 UTC (permalink / raw)
  To: David Miller; +Cc: linville, darcari, netdev, johannes.berg, linux-wireless
In-Reply-To: <20170119.142230.1012416564568457058.davem@davemloft.net>

David Miller <davem@davemloft.net> writes:

> From: Kalle Valo <kvalo@codeaurora.org>
> Date: Thu, 19 Jan 2017 20:08:30 +0200
>
>> "John W. Linville" <linville@tuxdriver.com> writes:
>> 
>>> I forgot to Cc Johannes and Kalle...
>> 
>> Also adding linux-wireless.
>> 
>>> On Thu, Jan 19, 2017 at 09:15:09AM -0500, John W. Linville wrote:
>>>
>>>> I'm responsible for this mess. The original idea was for various
>>>> mac80211-based drivers to override the ethtool operation and provide
>>>> their own dump operation, but the mac80211 crowd never embraced
>>>> the idea.
>>>> 
>>>> In the meantime, I added the default implementation which just
>>>> passed-up wdev->wiphy->hw_version as the version info for a 0-length
>>>> register dump. I then implemented a driver-specific regiser dump
>>>> handler for userland ethtool that would interpret the hardware version
>>>> information for the at76c50x-usb driver.
>>>> 
>>>> So the net of it is, if we treat a return of 0 from get_regs_len()
>>>> as "not supported", we break this one driver-specific feature for
>>>> userland ethtool. Realistically, there are probably very few users
>>>> to care. But I can't guarantee that the number is zero.
>> 
>> I know the number is not zero, because I remember using it years back
>> with something else than at76c50x-usb. But is the number more than one,
>> I don't know :)
>
> I'm trying to dig down and figure out why this problem is showing up now.
> ethtool_get_regs() has been using vzalloc() since 2011, and before that it
> used plain vmalloc().
>
> This code has therefore been using v{m,z}alloc() forever.  What changed?
>
> The zero size check has been in the vmalloc implementation since at least
> 2009.
>
> I don't understand why this is all triggering and being noticed now.  The
> whole ieee80211 "return zero length regs and return hw version in get_regs"
> thing should have been failing for at least 7 years now.

Maybe just nobody hasn't used it since? If my memory serves me right
(too often it does not) It's 6-7 years since I used this, and if the
kernel I worked on at the time was a year or two old, I might have used
a version without the zero size check.

But I'm just hand-waving here, I cannot be sure what's the last kernel I
used.

-- 
Kalle Valo

^ permalink raw reply

* [RFC PATCH] net: stmicro: eQOS IP Core
From: Joao Pinto @ 2017-01-20 12:27 UTC (permalink / raw)
  To: davem; +Cc: peppe.cavallaro, alexandre.torgue, netdev, Joao Pinto

For historical reasons the Designware eQOS IP Core started in version 4.x,
instead of starting in 1.x. This caused some misunderstanding, which resulted
in calling this IP as GMAC4. If you go to Synopsys website and check the
Ethernet portfolio there is no GMAC4 IP:
https://www.synopsys.com/designware-ip/interface-ip/ethernet.html

There is a new version of eQOS comming out (5.x) that will have the same
mac, dma registers and flow, with an extra set of registers to enable
features like TSN. The creation of a dwmac5 or gmac5 would be wrong, and
including those new features related to eQOS 5.x in dwmac4 would also not
be very correct.

This patch suggests to rename dwmac4_* driver to eqos_*, turning it the
official driver for eQOS IP. The registers definitions are also now
called QOS_ instead of GMAC4_.

For more information about eQOS IP please check:
https://www.synopsys.com/dw/ipdir.php?ds=dwc_ether_qos

Signed-off-by: Joao Pinto <jpinto@synopsys.com>
---
 drivers/net/ethernet/stmicro/stmmac/Makefile       |   4 +-
 drivers/net/ethernet/stmicro/stmmac/common.h       |  16 +--
 .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c    |   4 +-
 .../ethernet/stmicro/stmmac/{dwmac4.h => eqos.h}   |  28 ++---
 .../stmicro/stmmac/{dwmac4_core.c => eqos_core.c}  | 125 ++++++++++-----------
 .../stmmac/{dwmac4_descs.c => eqos_descs.c}        |  92 +++++++--------
 .../stmmac/{dwmac4_descs.h => eqos_descs.h}        |   8 +-
 .../stmicro/stmmac/{dwmac4_dma.c => eqos_dma.c}    | 125 ++++++++++-----------
 .../stmicro/stmmac/{dwmac4_dma.h => eqos_dma.h}    |  38 +++----
 .../stmicro/stmmac/{dwmac4_lib.c => eqos_lib.c}    |  36 +++---
 drivers/net/ethernet/stmicro/stmmac/mmc.h          |   2 +-
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |   4 +-
 .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c  |  10 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  42 +++----
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  |  20 ++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   |  30 +++--
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c   |   2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h   |   4 +-
 include/linux/stmmac.h                             |   2 +-
 20 files changed, 300 insertions(+), 294 deletions(-)
 rename drivers/net/ethernet/stmicro/stmmac/{dwmac4.h => eqos.h} (93%)
 rename drivers/net/ethernet/stmicro/stmmac/{dwmac4_core.c => eqos_core.c} (77%)
 rename drivers/net/ethernet/stmicro/stmmac/{dwmac4_descs.c => eqos_descs.c} (78%)
 rename drivers/net/ethernet/stmicro/stmmac/{dwmac4_descs.h => eqos_descs.h} (97%)
 rename drivers/net/ethernet/stmicro/stmmac/{dwmac4_dma.c => eqos_dma.c} (77%)
 rename drivers/net/ethernet/stmicro/stmmac/{dwmac4_dma.h => eqos_dma.h} (86%)
 rename drivers/net/ethernet/stmicro/stmmac/{dwmac4_lib.c => eqos_lib.c} (83%)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 700c603..6b7df7f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -2,8 +2,8 @@ obj-$(CONFIG_STMMAC_ETH) += stmmac.o
 stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 	      chain_mode.o dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o	\
 	      dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o	\
-	      mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o dwmac4_descs.o	\
-	      dwmac4_dma.o dwmac4_lib.o dwmac4_core.o $(stmmac-y)
+	      mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o eqos_descs.o	\
+	      eqos_dma.o eqos_lib.o eqos_core.o $(stmmac-y)
 
 # Ordering matters. Generic driver must be last.
 obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 75e2666..2645a09 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -493,16 +493,16 @@ struct stmmac_ops {
 struct stmmac_hwtimestamp {
 	void (*config_hw_tstamping) (void __iomem *ioaddr, u32 data);
 	u32 (*config_sub_second_increment)(void __iomem *ioaddr, u32 ptp_clock,
-					   int gmac4);
+					   int qos);
 	int (*init_systime) (void __iomem *ioaddr, u32 sec, u32 nsec);
 	int (*config_addend) (void __iomem *ioaddr, u32 addend);
 	int (*adjust_systime) (void __iomem *ioaddr, u32 sec, u32 nsec,
-			       int add_sub, int gmac4);
+			       int add_sub, int qos);
 	 u64(*get_systime) (void __iomem *ioaddr);
 };
 
 extern const struct stmmac_hwtimestamp stmmac_ptp;
-extern const struct stmmac_mode_ops dwmac4_ring_mode_ops;
+extern const struct stmmac_mode_ops eqos_ring_mode_ops;
 
 struct mac_link {
 	int port;
@@ -555,7 +555,7 @@ struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins,
 					int perfect_uc_entries,
 					int *synopsys_id);
 struct mac_device_info *dwmac100_setup(void __iomem *ioaddr, int *synopsys_id);
-struct mac_device_info *dwmac4_setup(void __iomem *ioaddr, int mcbins,
+struct mac_device_info *eqos_setup(void __iomem *ioaddr, int mcbins,
 				     int perfect_uc_entries, int *synopsys_id);
 
 void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
@@ -564,17 +564,17 @@ void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
 			 unsigned int high, unsigned int low);
 void stmmac_set_mac(void __iomem *ioaddr, bool enable);
 
-void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
+void stmmac_eqos_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
 				unsigned int high, unsigned int low);
-void stmmac_dwmac4_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
+void stmmac_eqos_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
 				unsigned int high, unsigned int low);
-void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable);
+void stmmac_eqos_set_mac(void __iomem *ioaddr, bool enable);
 
 void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
 
 extern const struct stmmac_mode_ops ring_mode_ops;
 extern const struct stmmac_mode_ops chain_mode_ops;
-extern const struct stmmac_desc_ops dwmac4_desc_ops;
+extern const struct stmmac_desc_ops eqos_desc_ops;
 
 /**
  * stmmac_get_synopsys_id - return the SYINID.
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index 1a3fa3d..6b4da51 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -97,8 +97,8 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
 		}
 	}
 
-	/* dwc-qos needs GMAC4, AAL, TSO and PMT */
-	plat_dat->has_gmac4 = 1;
+	/* dwc-qos needs eQOS, AAL, TSO and PMT */
+	plat_dat->has_qos = 1;
 	plat_dat->dma_cfg->aal = 1;
 	plat_dat->tso_en = 1;
 	plat_dat->pmt = 1;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/eqos.h
similarity index 93%
rename from drivers/net/ethernet/stmicro/stmmac/dwmac4.h
rename to drivers/net/ethernet/stmicro/stmmac/eqos.h
index db45134..5b98ad0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/eqos.h
@@ -1,5 +1,5 @@
 /*
- * DWMAC4 Header file.
+ * eQOS Header file.
  *
  * Copyright (C) 2015  STMicroelectronics Ltd
  *
@@ -10,8 +10,8 @@
  * Author: Alexandre Torgue <alexandre.torgue@st.com>
  */
 
-#ifndef __DWMAC4_H__
-#define __DWMAC4_H__
+#ifndef __EQOS_H__
+#define __EQOS_H__
 
 #include "common.h"
 
@@ -70,7 +70,7 @@
 
 #define	GMAC_INT_DEFAULT_MASK	GMAC_INT_PMT_EN
 
-enum dwmac4_irq_status {
+enum eqos_irq_status {
 	time_stamp_irq = 0x00001000,
 	mmc_rx_csum_offload_irq = 0x00000800,
 	mmc_tx_irq = 0x00000400,
@@ -90,18 +90,18 @@ enum power_event {
 	power_down = 0x00000001,
 };
 
-/* Energy Efficient Ethernet (EEE) for GMAC4
+/* Energy Efficient Ethernet (EEE) for eQOS
  *
  * LPI status, timer and control register offset
  */
-#define GMAC4_LPI_CTRL_STATUS	0xd0
-#define GMAC4_LPI_TIMER_CTRL	0xd4
+#define QOS_LPI_CTRL_STATUS	0xd0
+#define QOS_LPI_TIMER_CTRL	0xd4
 
 /* LPI control and status defines */
-#define GMAC4_LPI_CTRL_STATUS_LPITCSE	BIT(21)	/* LPI Tx Clock Stop Enable */
-#define GMAC4_LPI_CTRL_STATUS_LPITXA	BIT(19)	/* Enable LPI TX Automate */
-#define GMAC4_LPI_CTRL_STATUS_PLS	BIT(17) /* PHY Link Status */
-#define GMAC4_LPI_CTRL_STATUS_LPIEN	BIT(16)	/* LPI Enable */
+#define QOS_LPI_CTRL_STATUS_LPITCSE	BIT(21)	/* LPI Tx Clock Stop Enable */
+#define QOS_LPI_CTRL_STATUS_LPITXA	BIT(19)	/* Enable LPI TX Automate */
+#define QOS_LPI_CTRL_STATUS_PLS	BIT(17) /* PHY Link Status */
+#define QOS_LPI_CTRL_STATUS_LPIEN	BIT(16)	/* LPI Enable */
 
 /* MAC Debug bitmap */
 #define GMAC_DEBUG_TFCSTS_MASK		GENMASK(18, 17)
@@ -287,6 +287,6 @@ enum power_event {
 #define GMAC_PHYIF_CTRLSTATUS_SPEED_25		0x1
 #define GMAC_PHYIF_CTRLSTATUS_SPEED_2_5		0x0
 
-extern const struct stmmac_dma_ops dwmac4_dma_ops;
-extern const struct stmmac_dma_ops dwmac410_dma_ops;
-#endif /* __DWMAC4_H__ */
+extern const struct stmmac_dma_ops eqos_dma_ops;
+extern const struct stmmac_dma_ops eqos10_dma_ops;
+#endif /* __EQOS_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/eqos_core.c
similarity index 77%
rename from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
rename to drivers/net/ethernet/stmicro/stmmac/eqos_core.c
index 834f40f..b063f4c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/eqos_core.c
@@ -1,8 +1,7 @@
 /*
- * This is the driver for the GMAC on-chip Ethernet controller for ST SoCs.
- * DWC Ether MAC version 4.00  has been used for developing this code.
+ * This is the driver for the eQOS on-chip Ethernet controller for ST SoCs.
  *
- * This only implements the mac core functions for this chip.
+ * This only implements the eQOS core functions.
  *
  * Copyright (C) 2015  STMicroelectronics Ltd
  *
@@ -18,9 +17,9 @@
 #include <linux/ethtool.h>
 #include <linux/io.h>
 #include "stmmac_pcs.h"
-#include "dwmac4.h"
+#include "eqos.h"
 
-static void dwmac4_core_init(struct mac_device_info *hw, int mtu)
+static void eqos_core_init(struct mac_device_info *hw, int mtu)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	u32 value = readl(ioaddr + GMAC_CONFIG);
@@ -59,7 +58,7 @@ static void dwmac4_core_init(struct mac_device_info *hw, int mtu)
 	writel(value, ioaddr + GMAC_INT_EN);
 }
 
-static void dwmac4_rx_queue_enable(struct mac_device_info *hw, u32 queue)
+static void eqos_rx_queue_enable(struct mac_device_info *hw, u32 queue)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	u32 value = readl(ioaddr + GMAC_RXQ_CTRL0);
@@ -70,12 +69,12 @@ static void dwmac4_rx_queue_enable(struct mac_device_info *hw, u32 queue)
 	writel(value, ioaddr + GMAC_RXQ_CTRL0);
 }
 
-static void dwmac4_dump_regs(struct mac_device_info *hw)
+static void eqos_dump_regs(struct mac_device_info *hw)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	int i;
 
-	pr_debug("\tDWMAC4 regs (base addr = 0x%p)\n", ioaddr);
+	pr_debug("\teqos regs (base addr = 0x%p)\n", ioaddr);
 
 	for (i = 0; i < GMAC_REG_NUM; i++) {
 		int offset = i * 4;
@@ -85,7 +84,7 @@ static void dwmac4_dump_regs(struct mac_device_info *hw)
 	}
 }
 
-static int dwmac4_rx_ipc_enable(struct mac_device_info *hw)
+static int eqos_rx_ipc_enable(struct mac_device_info *hw)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	u32 value = readl(ioaddr + GMAC_CONFIG);
@@ -102,7 +101,7 @@ static int dwmac4_rx_ipc_enable(struct mac_device_info *hw)
 	return !!(value & GMAC_CONFIG_IPC);
 }
 
-static void dwmac4_pmt(struct mac_device_info *hw, unsigned long mode)
+static void eqos_pmt(struct mac_device_info *hw, unsigned long mode)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	unsigned int pmt = 0;
@@ -119,25 +118,25 @@ static void dwmac4_pmt(struct mac_device_info *hw, unsigned long mode)
 	writel(pmt, ioaddr + GMAC_PMT);
 }
 
-static void dwmac4_set_umac_addr(struct mac_device_info *hw,
+static void eqos_set_umac_addr(struct mac_device_info *hw,
 				 unsigned char *addr, unsigned int reg_n)
 {
 	void __iomem *ioaddr = hw->pcsr;
 
-	stmmac_dwmac4_set_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n),
+	stmmac_eqos_set_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n),
 				   GMAC_ADDR_LOW(reg_n));
 }
 
-static void dwmac4_get_umac_addr(struct mac_device_info *hw,
+static void eqos_get_umac_addr(struct mac_device_info *hw,
 				 unsigned char *addr, unsigned int reg_n)
 {
 	void __iomem *ioaddr = hw->pcsr;
 
-	stmmac_dwmac4_get_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n),
+	stmmac_eqos_get_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n),
 				   GMAC_ADDR_LOW(reg_n));
 }
 
-static void dwmac4_set_eee_mode(struct mac_device_info *hw,
+static void eqos_set_eee_mode(struct mac_device_info *hw,
 				bool en_tx_lpi_clockgating)
 {
 	void __iomem *ioaddr = hw->pcsr;
@@ -147,41 +146,41 @@ static void dwmac4_set_eee_mode(struct mac_device_info *hw,
 	 * receive path and instruct the transmit to enter in LPI
 	 * state.
 	 */
-	value = readl(ioaddr + GMAC4_LPI_CTRL_STATUS);
-	value |= GMAC4_LPI_CTRL_STATUS_LPIEN | GMAC4_LPI_CTRL_STATUS_LPITXA;
+	value = readl(ioaddr + QOS_LPI_CTRL_STATUS);
+	value |= QOS_LPI_CTRL_STATUS_LPIEN | QOS_LPI_CTRL_STATUS_LPITXA;
 
 	if (en_tx_lpi_clockgating)
-		value |= GMAC4_LPI_CTRL_STATUS_LPITCSE;
+		value |= QOS_LPI_CTRL_STATUS_LPITCSE;
 
-	writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS);
+	writel(value, ioaddr + QOS_LPI_CTRL_STATUS);
 }
 
-static void dwmac4_reset_eee_mode(struct mac_device_info *hw)
+static void eqos_reset_eee_mode(struct mac_device_info *hw)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	u32 value;
 
-	value = readl(ioaddr + GMAC4_LPI_CTRL_STATUS);
-	value &= ~(GMAC4_LPI_CTRL_STATUS_LPIEN | GMAC4_LPI_CTRL_STATUS_LPITXA);
-	writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS);
+	value = readl(ioaddr + QOS_LPI_CTRL_STATUS);
+	value &= ~(QOS_LPI_CTRL_STATUS_LPIEN | QOS_LPI_CTRL_STATUS_LPITXA);
+	writel(value, ioaddr + QOS_LPI_CTRL_STATUS);
 }
 
-static void dwmac4_set_eee_pls(struct mac_device_info *hw, int link)
+static void eqos_set_eee_pls(struct mac_device_info *hw, int link)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	u32 value;
 
-	value = readl(ioaddr + GMAC4_LPI_CTRL_STATUS);
+	value = readl(ioaddr + QOS_LPI_CTRL_STATUS);
 
 	if (link)
-		value |= GMAC4_LPI_CTRL_STATUS_PLS;
+		value |= QOS_LPI_CTRL_STATUS_PLS;
 	else
-		value &= ~GMAC4_LPI_CTRL_STATUS_PLS;
+		value &= ~QOS_LPI_CTRL_STATUS_PLS;
 
-	writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS);
+	writel(value, ioaddr + QOS_LPI_CTRL_STATUS);
 }
 
-static void dwmac4_set_eee_timer(struct mac_device_info *hw, int ls, int tw)
+static void eqos_set_eee_timer(struct mac_device_info *hw, int ls, int tw)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	int value = ((tw & 0xffff)) | ((ls & 0x7ff) << 16);
@@ -193,10 +192,10 @@ static void dwmac4_set_eee_timer(struct mac_device_info *hw, int ls, int tw)
 	 * TW: minimum time (us) for which the core waits
 	 *  after it has stopped transmitting the LPI pattern.
 	 */
-	writel(value, ioaddr + GMAC4_LPI_TIMER_CTRL);
+	writel(value, ioaddr + QOS_LPI_TIMER_CTRL);
 }
 
-static void dwmac4_set_filter(struct mac_device_info *hw,
+static void eqos_set_filter(struct mac_device_info *hw,
 			      struct net_device *dev)
 {
 	void __iomem *ioaddr = (void __iomem *)dev->base_addr;
@@ -248,7 +247,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
 		struct netdev_hw_addr *ha;
 
 		netdev_for_each_uc_addr(ha, dev) {
-			dwmac4_set_umac_addr(hw, ha->addr, reg);
+			eqos_set_umac_addr(hw, ha->addr, reg);
 			reg++;
 		}
 	}
@@ -256,7 +255,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
 	writel(value, ioaddr + GMAC_PACKET_FILTER);
 }
 
-static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
+static void eqos_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
 			     unsigned int fc, unsigned int pause_time)
 {
 	void __iomem *ioaddr = hw->pcsr;
@@ -282,24 +281,24 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
 	}
 }
 
-static void dwmac4_ctrl_ane(void __iomem *ioaddr, bool ane, bool srgmi_ral,
+static void eqos_ctrl_ane(void __iomem *ioaddr, bool ane, bool srgmi_ral,
 			    bool loopback)
 {
 	dwmac_ctrl_ane(ioaddr, GMAC_PCS_BASE, ane, srgmi_ral, loopback);
 }
 
-static void dwmac4_rane(void __iomem *ioaddr, bool restart)
+static void eqos_rane(void __iomem *ioaddr, bool restart)
 {
 	dwmac_rane(ioaddr, GMAC_PCS_BASE, restart);
 }
 
-static void dwmac4_get_adv_lp(void __iomem *ioaddr, struct rgmii_adv *adv)
+static void eqos_get_adv_lp(void __iomem *ioaddr, struct rgmii_adv *adv)
 {
 	dwmac_get_adv_lp(ioaddr, GMAC_PCS_BASE, adv);
 }
 
 /* RGMII or SMII interface */
-static void dwmac4_phystatus(void __iomem *ioaddr, struct stmmac_extra_stats *x)
+static void eqos_phystatus(void __iomem *ioaddr, struct stmmac_extra_stats *x)
 {
 	u32 status;
 
@@ -331,7 +330,7 @@ static void dwmac4_phystatus(void __iomem *ioaddr, struct stmmac_extra_stats *x)
 	}
 }
 
-static int dwmac4_irq_status(struct mac_device_info *hw,
+static int eqos_irq_status(struct mac_device_info *hw,
 			     struct stmmac_extra_stats *x)
 {
 	void __iomem *ioaddr = hw->pcsr;
@@ -370,12 +369,12 @@ static int dwmac4_irq_status(struct mac_device_info *hw,
 
 	dwmac_pcs_isr(ioaddr, GMAC_PCS_BASE, intr_status, x);
 	if (intr_status & PCS_RGSMIIIS_IRQ)
-		dwmac4_phystatus(ioaddr, x);
+		eqos_phystatus(ioaddr, x);
 
 	return ret;
 }
 
-static void dwmac4_debug(void __iomem *ioaddr, struct stmmac_extra_stats *x)
+static void eqos_debug(void __iomem *ioaddr, struct stmmac_extra_stats *x)
 {
 	u32 value;
 
@@ -459,28 +458,28 @@ static void dwmac4_debug(void __iomem *ioaddr, struct stmmac_extra_stats *x)
 		x->mac_gmii_rx_proto_engine++;
 }
 
-static const struct stmmac_ops dwmac4_ops = {
-	.core_init = dwmac4_core_init,
-	.rx_ipc = dwmac4_rx_ipc_enable,
-	.rx_queue_enable = dwmac4_rx_queue_enable,
-	.dump_regs = dwmac4_dump_regs,
-	.host_irq_status = dwmac4_irq_status,
-	.flow_ctrl = dwmac4_flow_ctrl,
-	.pmt = dwmac4_pmt,
-	.set_umac_addr = dwmac4_set_umac_addr,
-	.get_umac_addr = dwmac4_get_umac_addr,
-	.set_eee_mode = dwmac4_set_eee_mode,
-	.reset_eee_mode = dwmac4_reset_eee_mode,
-	.set_eee_timer = dwmac4_set_eee_timer,
-	.set_eee_pls = dwmac4_set_eee_pls,
-	.pcs_ctrl_ane = dwmac4_ctrl_ane,
-	.pcs_rane = dwmac4_rane,
-	.pcs_get_adv_lp = dwmac4_get_adv_lp,
-	.debug = dwmac4_debug,
-	.set_filter = dwmac4_set_filter,
+static const struct stmmac_ops eqos_ops = {
+	.core_init = eqos_core_init,
+	.rx_ipc = eqos_rx_ipc_enable,
+	.rx_queue_enable = eqos_rx_queue_enable,
+	.dump_regs = eqos_dump_regs,
+	.host_irq_status = eqos_irq_status,
+	.flow_ctrl = eqos_flow_ctrl,
+	.pmt = eqos_pmt,
+	.set_umac_addr = eqos_set_umac_addr,
+	.get_umac_addr = eqos_get_umac_addr,
+	.set_eee_mode = eqos_set_eee_mode,
+	.reset_eee_mode = eqos_reset_eee_mode,
+	.set_eee_timer = eqos_set_eee_timer,
+	.set_eee_pls = eqos_set_eee_pls,
+	.pcs_ctrl_ane = eqos_ctrl_ane,
+	.pcs_rane = eqos_rane,
+	.pcs_get_adv_lp = eqos_get_adv_lp,
+	.debug = eqos_debug,
+	.set_filter = eqos_set_filter,
 };
 
-struct mac_device_info *dwmac4_setup(void __iomem *ioaddr, int mcbins,
+struct mac_device_info *eqos_setup(void __iomem *ioaddr, int mcbins,
 				     int perfect_uc_entries, int *synopsys_id)
 {
 	struct mac_device_info *mac;
@@ -498,7 +497,7 @@ struct mac_device_info *dwmac4_setup(void __iomem *ioaddr, int mcbins,
 	if (mac->multicast_filter_bins)
 		mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins);
 
-	mac->mac = &dwmac4_ops;
+	mac->mac = &eqos_ops;
 
 	mac->link.port = GMAC_CONFIG_PS;
 	mac->link.duplex = GMAC_CONFIG_DM;
@@ -516,9 +515,9 @@ struct mac_device_info *dwmac4_setup(void __iomem *ioaddr, int mcbins,
 	*synopsys_id = stmmac_get_synopsys_id(hwid);
 
 	if (*synopsys_id > DWMAC_CORE_4_00)
-		mac->dma = &dwmac410_dma_ops;
+		mac->dma = &eqos10_dma_ops;
 	else
-		mac->dma = &dwmac4_dma_ops;
+		mac->dma = &eqos_dma_ops;
 
 	return mac;
 }
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/eqos_descs.c
similarity index 78%
rename from drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
rename to drivers/net/ethernet/stmicro/stmmac/eqos_descs.c
index 8816515..cd6bf4d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/eqos_descs.c
@@ -1,6 +1,6 @@
 /*
  * This contains the functions to handle the descriptors for DesignWare databook
- * 4.xx.
+ * eQOS IP.
  *
  * Copyright (C) 2015  STMicroelectronics Ltd
  *
@@ -13,9 +13,9 @@
 
 #include <linux/stmmac.h>
 #include "common.h"
-#include "dwmac4_descs.h"
+#include "eqos_descs.h"
 
-static int dwmac4_wrback_get_tx_status(void *data, struct stmmac_extra_stats *x,
+static int eqos_wrback_get_tx_status(void *data, struct stmmac_extra_stats *x,
 				       struct dma_desc *p,
 				       void __iomem *ioaddr)
 {
@@ -73,7 +73,7 @@ static int dwmac4_wrback_get_tx_status(void *data, struct stmmac_extra_stats *x,
 	return ret;
 }
 
-static int dwmac4_wrback_get_rx_status(void *data, struct stmmac_extra_stats *x,
+static int eqos_wrback_get_rx_status(void *data, struct stmmac_extra_stats *x,
 				       struct dma_desc *p)
 {
 	struct net_device_stats *stats = (struct net_device_stats *)data;
@@ -174,43 +174,43 @@ static int dwmac4_wrback_get_rx_status(void *data, struct stmmac_extra_stats *x,
 	return ret;
 }
 
-static int dwmac4_rd_get_tx_len(struct dma_desc *p)
+static int eqos_rd_get_tx_len(struct dma_desc *p)
 {
 	return (le32_to_cpu(p->des2) & TDES2_BUFFER1_SIZE_MASK);
 }
 
-static int dwmac4_get_tx_owner(struct dma_desc *p)
+static int eqos_get_tx_owner(struct dma_desc *p)
 {
 	return (le32_to_cpu(p->des3) & TDES3_OWN) >> TDES3_OWN_SHIFT;
 }
 
-static void dwmac4_set_tx_owner(struct dma_desc *p)
+static void eqos_set_tx_owner(struct dma_desc *p)
 {
 	p->des3 |= cpu_to_le32(TDES3_OWN);
 }
 
-static void dwmac4_set_rx_owner(struct dma_desc *p)
+static void eqos_set_rx_owner(struct dma_desc *p)
 {
 	p->des3 |= cpu_to_le32(RDES3_OWN);
 }
 
-static int dwmac4_get_tx_ls(struct dma_desc *p)
+static int eqos_get_tx_ls(struct dma_desc *p)
 {
 	return (le32_to_cpu(p->des3) & TDES3_LAST_DESCRIPTOR)
 		>> TDES3_LAST_DESCRIPTOR_SHIFT;
 }
 
-static int dwmac4_wrback_get_rx_frame_len(struct dma_desc *p, int rx_coe)
+static int eqos_wrback_get_rx_frame_len(struct dma_desc *p, int rx_coe)
 {
 	return (le32_to_cpu(p->des3) & RDES3_PACKET_SIZE_MASK);
 }
 
-static void dwmac4_rd_enable_tx_timestamp(struct dma_desc *p)
+static void eqos_rd_enable_tx_timestamp(struct dma_desc *p)
 {
 	p->des2 |= cpu_to_le32(TDES2_TIMESTAMP_ENABLE);
 }
 
-static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p)
+static int eqos_wrback_get_tx_timestamp_status(struct dma_desc *p)
 {
 	/* Context type from W/B descriptor must be zero */
 	if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE)
@@ -223,7 +223,7 @@ static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p)
 	return 1;
 }
 
-static inline u64 dwmac4_get_timestamp(void *desc, u32 ats)
+static inline u64 eqos_get_timestamp(void *desc, u32 ats)
 {
 	struct dma_desc *p = (struct dma_desc *)desc;
 	u64 ns;
@@ -235,7 +235,7 @@ static inline u64 dwmac4_get_timestamp(void *desc, u32 ats)
 	return ns;
 }
 
-static int dwmac4_rx_check_timestamp(void *desc)
+static int eqos_rx_check_timestamp(void *desc)
 {
 	struct dma_desc *p = (struct dma_desc *)desc;
 	u32 own, ctxt;
@@ -258,7 +258,7 @@ static int dwmac4_rx_check_timestamp(void *desc)
 	return ret;
 }
 
-static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats)
+static int eqos_wrback_get_rx_timestamp_status(void *desc, u32 ats)
 {
 	struct dma_desc *p = (struct dma_desc *)desc;
 	int ret = -EINVAL;
@@ -270,7 +270,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats)
 
 			/* Check if timestamp is OK from context descriptor */
 			do {
-				ret = dwmac4_rx_check_timestamp(desc);
+				ret = eqos_rx_check_timestamp(desc);
 				if (ret < 0)
 					goto exit;
 				i++;
@@ -285,7 +285,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats)
 	return ret;
 }
 
-static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
+static void eqos_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
 				   int mode, int end)
 {
 	p->des3 = cpu_to_le32(RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);
@@ -294,7 +294,7 @@ static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
 		p->des3 |= cpu_to_le32(RDES3_INT_ON_COMPLETION_EN);
 }
 
-static void dwmac4_rd_init_tx_desc(struct dma_desc *p, int mode, int end)
+static void eqos_rd_init_tx_desc(struct dma_desc *p, int mode, int end)
 {
 	p->des0 = 0;
 	p->des1 = 0;
@@ -302,7 +302,7 @@ static void dwmac4_rd_init_tx_desc(struct dma_desc *p, int mode, int end)
 	p->des3 = 0;
 }
 
-static void dwmac4_rd_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
+static void eqos_rd_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
 				      bool csum_flag, int mode, bool tx_own,
 				      bool ls)
 {
@@ -339,7 +339,7 @@ static void dwmac4_rd_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
 	p->des3 = cpu_to_le32(tdes3);
 }
 
-static void dwmac4_rd_prepare_tso_tx_desc(struct dma_desc *p, int is_fs,
+static void eqos_rd_prepare_tso_tx_desc(struct dma_desc *p, int is_fs,
 					  int len1, int len2, bool tx_own,
 					  bool ls, unsigned int tcphdrlen,
 					  unsigned int tcppayloadlen)
@@ -382,18 +382,18 @@ static void dwmac4_rd_prepare_tso_tx_desc(struct dma_desc *p, int is_fs,
 	p->des3 = cpu_to_le32(tdes3);
 }
 
-static void dwmac4_release_tx_desc(struct dma_desc *p, int mode)
+static void eqos_release_tx_desc(struct dma_desc *p, int mode)
 {
 	p->des2 = 0;
 	p->des3 = 0;
 }
 
-static void dwmac4_rd_set_tx_ic(struct dma_desc *p)
+static void eqos_rd_set_tx_ic(struct dma_desc *p)
 {
 	p->des2 |= cpu_to_le32(TDES2_INTERRUPT_ON_COMPLETION);
 }
 
-static void dwmac4_display_ring(void *head, unsigned int size, bool rx)
+static void eqos_display_ring(void *head, unsigned int size, bool rx)
 {
 	struct dma_desc *p = (struct dma_desc *)head;
 	int i;
@@ -409,7 +409,7 @@ static void dwmac4_display_ring(void *head, unsigned int size, bool rx)
 	}
 }
 
-static void dwmac4_set_mss_ctxt(struct dma_desc *p, unsigned int mss)
+static void eqos_set_mss_ctxt(struct dma_desc *p, unsigned int mss)
 {
 	p->des0 = 0;
 	p->des1 = 0;
@@ -417,27 +417,27 @@ static void dwmac4_set_mss_ctxt(struct dma_desc *p, unsigned int mss)
 	p->des3 = cpu_to_le32(TDES3_CONTEXT_TYPE | TDES3_CTXT_TCMSSV);
 }
 
-const struct stmmac_desc_ops dwmac4_desc_ops = {
-	.tx_status = dwmac4_wrback_get_tx_status,
-	.rx_status = dwmac4_wrback_get_rx_status,
-	.get_tx_len = dwmac4_rd_get_tx_len,
-	.get_tx_owner = dwmac4_get_tx_owner,
-	.set_tx_owner = dwmac4_set_tx_owner,
-	.set_rx_owner = dwmac4_set_rx_owner,
-	.get_tx_ls = dwmac4_get_tx_ls,
-	.get_rx_frame_len = dwmac4_wrback_get_rx_frame_len,
-	.enable_tx_timestamp = dwmac4_rd_enable_tx_timestamp,
-	.get_tx_timestamp_status = dwmac4_wrback_get_tx_timestamp_status,
-	.get_rx_timestamp_status = dwmac4_wrback_get_rx_timestamp_status,
-	.get_timestamp = dwmac4_get_timestamp,
-	.set_tx_ic = dwmac4_rd_set_tx_ic,
-	.prepare_tx_desc = dwmac4_rd_prepare_tx_desc,
-	.prepare_tso_tx_desc = dwmac4_rd_prepare_tso_tx_desc,
-	.release_tx_desc = dwmac4_release_tx_desc,
-	.init_rx_desc = dwmac4_rd_init_rx_desc,
-	.init_tx_desc = dwmac4_rd_init_tx_desc,
-	.display_ring = dwmac4_display_ring,
-	.set_mss = dwmac4_set_mss_ctxt,
+const struct stmmac_desc_ops eqos_desc_ops = {
+	.tx_status = eqos_wrback_get_tx_status,
+	.rx_status = eqos_wrback_get_rx_status,
+	.get_tx_len = eqos_rd_get_tx_len,
+	.get_tx_owner = eqos_get_tx_owner,
+	.set_tx_owner = eqos_set_tx_owner,
+	.set_rx_owner = eqos_set_rx_owner,
+	.get_tx_ls = eqos_get_tx_ls,
+	.get_rx_frame_len = eqos_wrback_get_rx_frame_len,
+	.enable_tx_timestamp = eqos_rd_enable_tx_timestamp,
+	.get_tx_timestamp_status = eqos_wrback_get_tx_timestamp_status,
+	.get_rx_timestamp_status = eqos_wrback_get_rx_timestamp_status,
+	.get_timestamp = eqos_get_timestamp,
+	.set_tx_ic = eqos_rd_set_tx_ic,
+	.prepare_tx_desc = eqos_rd_prepare_tx_desc,
+	.prepare_tso_tx_desc = eqos_rd_prepare_tso_tx_desc,
+	.release_tx_desc = eqos_release_tx_desc,
+	.init_rx_desc = eqos_rd_init_rx_desc,
+	.init_tx_desc = eqos_rd_init_tx_desc,
+	.display_ring = eqos_display_ring,
+	.set_mss = eqos_set_mss_ctxt,
 };
 
-const struct stmmac_mode_ops dwmac4_ring_mode_ops = { };
+const struct stmmac_mode_ops eqos_ring_mode_ops = { };
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h b/drivers/net/ethernet/stmicro/stmmac/eqos_descs.h
similarity index 97%
rename from drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h
rename to drivers/net/ethernet/stmicro/stmmac/eqos_descs.h
index 9736c50..c9c33e7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h
+++ b/drivers/net/ethernet/stmicro/stmmac/eqos_descs.h
@@ -1,6 +1,6 @@
 /*
  * Header File to describe the DMA descriptors and related definitions specific
- * for DesignWare databook 4.xx.
+ * for DesignWare eQOS.
  *
  * Copyright (C) 2015  STMicroelectronics Ltd
  *
@@ -11,8 +11,8 @@
  * Author: Alexandre Torgue <alexandre.torgue@st.com>
  */
 
-#ifndef __DWMAC4_DESCS_H__
-#define __DWMAC4_DESCS_H__
+#ifndef __EQOS_DESCS_H__
+#define __EQOS_DESCS_H__
 
 #include <linux/bitops.h>
 
@@ -130,4 +130,4 @@
 /* TDS3 use for both format (read and write back) */
 #define RDES3_OWN			BIT(31)
 
-#endif /* __DWMAC4_DESCS_H__ */
+#endif /* __EQOS_DESCS_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/eqos_dma.c
similarity index 77%
rename from drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
rename to drivers/net/ethernet/stmicro/stmmac/eqos_dma.c
index 377d1b4..fb4d892 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/eqos_dma.c
@@ -1,6 +1,5 @@
 /*
- * This is the driver for the GMAC on-chip Ethernet controller for ST SoCs.
- * DWC Ether MAC version 4.xx  has been used for  developing this code.
+ * This is the driver for the eQOS on-chip Ethernet controller for ST SoCs.
  *
  * This contains the functions to handle the dma.
  *
@@ -14,15 +13,15 @@
  */
 
 #include <linux/io.h>
-#include "dwmac4.h"
-#include "dwmac4_dma.h"
+#include "eqos.h"
+#include "eqos_dma.h"
 
-static void dwmac4_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)
+static void eqos_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)
 {
 	u32 value = readl(ioaddr + DMA_SYS_BUS_MODE);
 	int i;
 
-	pr_info("dwmac4: Master AXI performs %s burst length\n",
+	pr_info("eQOS: Master AXI performs %s burst length\n",
 		(value & DMA_SYS_BUS_FB) ? "fixed" : "any");
 
 	if (axi->axi_lpi_en)
@@ -71,7 +70,7 @@ static void dwmac4_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)
 	writel(value, ioaddr + DMA_SYS_BUS_MODE);
 }
 
-static void dwmac4_dma_init_channel(void __iomem *ioaddr,
+static void eqos_dma_init_channel(void __iomem *ioaddr,
 				    struct stmmac_dma_cfg *dma_cfg,
 				    u32 dma_tx_phy, u32 dma_rx_phy,
 				    u32 channel)
@@ -103,7 +102,7 @@ static void dwmac4_dma_init_channel(void __iomem *ioaddr,
 	writel(dma_rx_phy, ioaddr + DMA_CHAN_RX_BASE_ADDR(channel));
 }
 
-static void dwmac4_dma_init(void __iomem *ioaddr,
+static void eqos_dma_init(void __iomem *ioaddr,
 			    struct stmmac_dma_cfg *dma_cfg,
 			    u32 dma_tx, u32 dma_rx, int atds)
 {
@@ -124,10 +123,10 @@ static void dwmac4_dma_init(void __iomem *ioaddr,
 	writel(value, ioaddr + DMA_SYS_BUS_MODE);
 
 	for (i = 0; i < DMA_CHANNEL_NB_MAX; i++)
-		dwmac4_dma_init_channel(ioaddr, dma_cfg, dma_tx, dma_rx, i);
+		eqos_dma_init_channel(ioaddr, dma_cfg, dma_tx, dma_rx, i);
 }
 
-static void _dwmac4_dump_dma_regs(void __iomem *ioaddr, u32 channel)
+static void _eqos_dump_dma_regs(void __iomem *ioaddr, u32 channel)
 {
 	pr_debug(" Channel %d\n", channel);
 	pr_debug("\tDMA_CHAN_CONTROL, offset: 0x%x, val: 0x%x\n", 0,
@@ -166,17 +165,17 @@ static void _dwmac4_dump_dma_regs(void __iomem *ioaddr, u32 channel)
 		 readl(ioaddr + DMA_CHAN_STATUS(channel)));
 }
 
-static void dwmac4_dump_dma_regs(void __iomem *ioaddr)
+static void eqos_dump_dma_regs(void __iomem *ioaddr)
 {
 	int i;
 
-	pr_debug(" GMAC4 DMA registers\n");
+	pr_debug("eQOS DMA registers\n");
 
 	for (i = 0; i < DMA_CHANNEL_NB_MAX; i++)
-		_dwmac4_dump_dma_regs(ioaddr, i);
+		_eqos_dump_dma_regs(ioaddr, i);
 }
 
-static void dwmac4_rx_watchdog(void __iomem *ioaddr, u32 riwt)
+static void eqos_rx_watchdog(void __iomem *ioaddr, u32 riwt)
 {
 	int i;
 
@@ -184,7 +183,7 @@ static void dwmac4_rx_watchdog(void __iomem *ioaddr, u32 riwt)
 		writel(riwt, ioaddr + DMA_CHAN_RX_WATCHDOG(i));
 }
 
-static void dwmac4_dma_chan_op_mode(void __iomem *ioaddr, int txmode,
+static void eqos_dma_chan_op_mode(void __iomem *ioaddr, int txmode,
 				    int rxmode, u32 channel)
 {
 	u32 mtl_tx_op, mtl_rx_op, mtl_rx_int;
@@ -195,11 +194,11 @@ static void dwmac4_dma_chan_op_mode(void __iomem *ioaddr, int txmode,
 	mtl_tx_op = readl(ioaddr + MTL_CHAN_TX_OP_MODE(channel));
 
 	if (txmode == SF_DMA_MODE) {
-		pr_debug("GMAC: enable TX store and forward mode\n");
+		pr_debug("eQOS: enable TX store and forward mode\n");
 		/* Transmit COE type 2 cannot be done in cut-through mode. */
 		mtl_tx_op |= MTL_OP_MODE_TSF;
 	} else {
-		pr_debug("GMAC: disabling TX SF (threshold %d)\n", txmode);
+		pr_debug("eQOS: disabling TX SF (threshold %d)\n", txmode);
 		mtl_tx_op &= ~MTL_OP_MODE_TSF;
 		mtl_tx_op &= MTL_OP_MODE_TTC_MASK;
 		/* Set the transmit threshold */
@@ -236,10 +235,10 @@ static void dwmac4_dma_chan_op_mode(void __iomem *ioaddr, int txmode,
 	mtl_rx_op = readl(ioaddr + MTL_CHAN_RX_OP_MODE(channel));
 
 	if (rxmode == SF_DMA_MODE) {
-		pr_debug("GMAC: enable RX store and forward mode\n");
+		pr_debug("eQOS: enable RX store and forward mode\n");
 		mtl_rx_op |= MTL_OP_MODE_RSF;
 	} else {
-		pr_debug("GMAC: disable RX SF mode (threshold %d)\n", rxmode);
+		pr_debug("eQOS: disable RX SF mode (threshold %d)\n", rxmode);
 		mtl_rx_op &= ~MTL_OP_MODE_RSF;
 		mtl_rx_op &= MTL_OP_MODE_RTC_MASK;
 		if (rxmode <= 32)
@@ -260,14 +259,14 @@ static void dwmac4_dma_chan_op_mode(void __iomem *ioaddr, int txmode,
 	       ioaddr + MTL_CHAN_INT_CTRL(channel));
 }
 
-static void dwmac4_dma_operation_mode(void __iomem *ioaddr, int txmode,
+static void eqos_dma_operation_mode(void __iomem *ioaddr, int txmode,
 				      int rxmode, int rxfifosz)
 {
 	/* Only Channel 0 is actually configured and used */
-	dwmac4_dma_chan_op_mode(ioaddr, txmode, rxmode, 0);
+	eqos_dma_chan_op_mode(ioaddr, txmode, rxmode, 0);
 }
 
-static void dwmac4_get_hw_feature(void __iomem *ioaddr,
+static void eqos_get_hw_feature(void __iomem *ioaddr,
 				  struct dma_features *dma_cap)
 {
 	u32 hw_cap = readl(ioaddr + GMAC_HW_FEATURE0);
@@ -314,7 +313,7 @@ static void dwmac4_get_hw_feature(void __iomem *ioaddr,
 }
 
 /* Enable/disable TSO feature and set MSS */
-static void dwmac4_enable_tso(void __iomem *ioaddr, bool en, u32 chan)
+static void eqos_enable_tso(void __iomem *ioaddr, bool en, u32 chan)
 {
 	u32 value;
 
@@ -331,46 +330,46 @@ static void dwmac4_enable_tso(void __iomem *ioaddr, bool en, u32 chan)
 	}
 }
 
-const struct stmmac_dma_ops dwmac4_dma_ops = {
-	.reset = dwmac4_dma_reset,
-	.init = dwmac4_dma_init,
-	.axi = dwmac4_dma_axi,
-	.dump_regs = dwmac4_dump_dma_regs,
-	.dma_mode = dwmac4_dma_operation_mode,
-	.enable_dma_irq = dwmac4_enable_dma_irq,
-	.disable_dma_irq = dwmac4_disable_dma_irq,
-	.start_tx = dwmac4_dma_start_tx,
-	.stop_tx = dwmac4_dma_stop_tx,
-	.start_rx = dwmac4_dma_start_rx,
-	.stop_rx = dwmac4_dma_stop_rx,
-	.dma_interrupt = dwmac4_dma_interrupt,
-	.get_hw_feature = dwmac4_get_hw_feature,
-	.rx_watchdog = dwmac4_rx_watchdog,
-	.set_rx_ring_len = dwmac4_set_rx_ring_len,
-	.set_tx_ring_len = dwmac4_set_tx_ring_len,
-	.set_rx_tail_ptr = dwmac4_set_rx_tail_ptr,
-	.set_tx_tail_ptr = dwmac4_set_tx_tail_ptr,
-	.enable_tso = dwmac4_enable_tso,
+const struct stmmac_dma_ops eqos_dma_ops = {
+	.reset = eqos_dma_reset,
+	.init = eqos_dma_init,
+	.axi = eqos_dma_axi,
+	.dump_regs = eqos_dump_dma_regs,
+	.dma_mode = eqos_dma_operation_mode,
+	.enable_dma_irq = eqos_enable_dma_irq,
+	.disable_dma_irq = eqos_disable_dma_irq,
+	.start_tx = eqos_dma_start_tx,
+	.stop_tx = eqos_dma_stop_tx,
+	.start_rx = eqos_dma_start_rx,
+	.stop_rx = eqos_dma_stop_rx,
+	.dma_interrupt = eqos_dma_interrupt,
+	.get_hw_feature = eqos_get_hw_feature,
+	.rx_watchdog = eqos_rx_watchdog,
+	.set_rx_ring_len = eqos_set_rx_ring_len,
+	.set_tx_ring_len = eqos_set_tx_ring_len,
+	.set_rx_tail_ptr = eqos_set_rx_tail_ptr,
+	.set_tx_tail_ptr = eqos_set_tx_tail_ptr,
+	.enable_tso = eqos_enable_tso,
 };
 
-const struct stmmac_dma_ops dwmac410_dma_ops = {
-	.reset = dwmac4_dma_reset,
-	.init = dwmac4_dma_init,
-	.axi = dwmac4_dma_axi,
-	.dump_regs = dwmac4_dump_dma_regs,
-	.dma_mode = dwmac4_dma_operation_mode,
-	.enable_dma_irq = dwmac410_enable_dma_irq,
-	.disable_dma_irq = dwmac4_disable_dma_irq,
-	.start_tx = dwmac4_dma_start_tx,
-	.stop_tx = dwmac4_dma_stop_tx,
-	.start_rx = dwmac4_dma_start_rx,
-	.stop_rx = dwmac4_dma_stop_rx,
-	.dma_interrupt = dwmac4_dma_interrupt,
-	.get_hw_feature = dwmac4_get_hw_feature,
-	.rx_watchdog = dwmac4_rx_watchdog,
-	.set_rx_ring_len = dwmac4_set_rx_ring_len,
-	.set_tx_ring_len = dwmac4_set_tx_ring_len,
-	.set_rx_tail_ptr = dwmac4_set_rx_tail_ptr,
-	.set_tx_tail_ptr = dwmac4_set_tx_tail_ptr,
-	.enable_tso = dwmac4_enable_tso,
+const struct stmmac_dma_ops eqos10_dma_ops = {
+	.reset = eqos_dma_reset,
+	.init = eqos_dma_init,
+	.axi = eqos_dma_axi,
+	.dump_regs = eqos_dump_dma_regs,
+	.dma_mode = eqos_dma_operation_mode,
+	.enable_dma_irq = eqos10_enable_dma_irq,
+	.disable_dma_irq = eqos_disable_dma_irq,
+	.start_tx = eqos_dma_start_tx,
+	.stop_tx = eqos_dma_stop_tx,
+	.start_rx = eqos_dma_start_rx,
+	.stop_rx = eqos_dma_stop_rx,
+	.dma_interrupt = eqos_dma_interrupt,
+	.get_hw_feature = eqos_get_hw_feature,
+	.rx_watchdog = eqos_rx_watchdog,
+	.set_rx_ring_len = eqos_set_rx_ring_len,
+	.set_tx_ring_len = eqos_set_tx_ring_len,
+	.set_rx_tail_ptr = eqos_set_rx_tail_ptr,
+	.set_tx_tail_ptr = eqos_set_tx_tail_ptr,
+	.enable_tso = eqos_enable_tso,
 };
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h b/drivers/net/ethernet/stmicro/stmmac/eqos_dma.h
similarity index 86%
rename from drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
rename to drivers/net/ethernet/stmicro/stmmac/eqos_dma.h
index 1b06df7..fa7b5a7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
+++ b/drivers/net/ethernet/stmicro/stmmac/eqos_dma.h
@@ -1,5 +1,5 @@
 /*
- * DWMAC4 DMA Header file.
+ * eQOS DMA Header file.
  *
  *
  * Copyright (C) 2007-2015  STMicroelectronics Ltd
@@ -11,11 +11,11 @@
  * Author: Alexandre Torgue <alexandre.torgue@st.com>
  */
 
-#ifndef __DWMAC4_DMA_H__
-#define __DWMAC4_DMA_H__
+#ifndef __EQOS_DMA_H__
+#define __EQOS_DMA_H__
 
 /* Define the max channel number used for tx (also rx).
- * dwmac4 accepts up to 8 channels for TX (and also 8 channels for RX
+ * eQOS accepts up to 8 channels for TX (and also 8 channels for RX
  */
 #define DMA_CHANNEL_NB_MAX		1
 
@@ -183,20 +183,20 @@
 #define DMA_CHAN0_DBG_STAT_RPS		GENMASK(11, 8)
 #define DMA_CHAN0_DBG_STAT_RPS_SHIFT	8
 
-int dwmac4_dma_reset(void __iomem *ioaddr);
-void dwmac4_enable_dma_transmission(void __iomem *ioaddr, u32 tail_ptr);
-void dwmac4_enable_dma_irq(void __iomem *ioaddr);
-void dwmac410_enable_dma_irq(void __iomem *ioaddr);
-void dwmac4_disable_dma_irq(void __iomem *ioaddr);
-void dwmac4_dma_start_tx(void __iomem *ioaddr);
-void dwmac4_dma_stop_tx(void __iomem *ioaddr);
-void dwmac4_dma_start_rx(void __iomem *ioaddr);
-void dwmac4_dma_stop_rx(void __iomem *ioaddr);
-int dwmac4_dma_interrupt(void __iomem *ioaddr,
+int eqos_dma_reset(void __iomem *ioaddr);
+void eqos_enable_dma_transmission(void __iomem *ioaddr, u32 tail_ptr);
+void eqos_enable_dma_irq(void __iomem *ioaddr);
+void eqos10_enable_dma_irq(void __iomem *ioaddr);
+void eqos_disable_dma_irq(void __iomem *ioaddr);
+void eqos_dma_start_tx(void __iomem *ioaddr);
+void eqos_dma_stop_tx(void __iomem *ioaddr);
+void eqos_dma_start_rx(void __iomem *ioaddr);
+void eqos_dma_stop_rx(void __iomem *ioaddr);
+int eqos_dma_interrupt(void __iomem *ioaddr,
 			 struct stmmac_extra_stats *x);
-void dwmac4_set_rx_ring_len(void __iomem *ioaddr, u32 len);
-void dwmac4_set_tx_ring_len(void __iomem *ioaddr, u32 len);
-void dwmac4_set_rx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan);
-void dwmac4_set_tx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan);
+void eqos_set_rx_ring_len(void __iomem *ioaddr, u32 len);
+void eqos_set_tx_ring_len(void __iomem *ioaddr, u32 len);
+void eqos_set_rx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan);
+void eqos_set_tx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan);
 
-#endif /* __DWMAC4_DMA_H__ */
+#endif /* __EQOS_DMA_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/eqos_lib.c
similarity index 83%
rename from drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
rename to drivers/net/ethernet/stmicro/stmmac/eqos_lib.c
index c7326d5..ddfedce 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/eqos_lib.c
@@ -11,10 +11,10 @@
 #include <linux/io.h>
 #include <linux/delay.h>
 #include "common.h"
-#include "dwmac4_dma.h"
-#include "dwmac4.h"
+#include "eqos_dma.h"
+#include "eqos.h"
 
-int dwmac4_dma_reset(void __iomem *ioaddr)
+int eqos_dma_reset(void __iomem *ioaddr)
 {
 	u32 value = readl(ioaddr + DMA_BUS_MODE);
 	int limit;
@@ -35,17 +35,17 @@ int dwmac4_dma_reset(void __iomem *ioaddr)
 	return 0;
 }
 
-void dwmac4_set_rx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan)
+void eqos_set_rx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan)
 {
 	writel(tail_ptr, ioaddr + DMA_CHAN_RX_END_ADDR(0));
 }
 
-void dwmac4_set_tx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan)
+void eqos_set_tx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan)
 {
 	writel(tail_ptr, ioaddr + DMA_CHAN_TX_END_ADDR(0));
 }
 
-void dwmac4_dma_start_tx(void __iomem *ioaddr)
+void eqos_dma_start_tx(void __iomem *ioaddr)
 {
 	u32 value = readl(ioaddr + DMA_CHAN_TX_CONTROL(STMMAC_CHAN0));
 
@@ -57,7 +57,7 @@ void dwmac4_dma_start_tx(void __iomem *ioaddr)
 	writel(value, ioaddr + GMAC_CONFIG);
 }
 
-void dwmac4_dma_stop_tx(void __iomem *ioaddr)
+void eqos_dma_stop_tx(void __iomem *ioaddr)
 {
 	u32 value = readl(ioaddr + DMA_CHAN_TX_CONTROL(STMMAC_CHAN0));
 
@@ -69,7 +69,7 @@ void dwmac4_dma_stop_tx(void __iomem *ioaddr)
 	writel(value, ioaddr + GMAC_CONFIG);
 }
 
-void dwmac4_dma_start_rx(void __iomem *ioaddr)
+void eqos_dma_start_rx(void __iomem *ioaddr)
 {
 	u32 value = readl(ioaddr + DMA_CHAN_RX_CONTROL(STMMAC_CHAN0));
 
@@ -82,7 +82,7 @@ void dwmac4_dma_start_rx(void __iomem *ioaddr)
 	writel(value, ioaddr + GMAC_CONFIG);
 }
 
-void dwmac4_dma_stop_rx(void __iomem *ioaddr)
+void eqos_dma_stop_rx(void __iomem *ioaddr)
 {
 	u32 value = readl(ioaddr + DMA_CHAN_RX_CONTROL(STMMAC_CHAN0));
 
@@ -94,34 +94,34 @@ void dwmac4_dma_stop_rx(void __iomem *ioaddr)
 	writel(value, ioaddr + GMAC_CONFIG);
 }
 
-void dwmac4_set_tx_ring_len(void __iomem *ioaddr, u32 len)
+void eqos_set_tx_ring_len(void __iomem *ioaddr, u32 len)
 {
 	writel(len, ioaddr + DMA_CHAN_TX_RING_LEN(STMMAC_CHAN0));
 }
 
-void dwmac4_set_rx_ring_len(void __iomem *ioaddr, u32 len)
+void eqos_set_rx_ring_len(void __iomem *ioaddr, u32 len)
 {
 	writel(len, ioaddr + DMA_CHAN_RX_RING_LEN(STMMAC_CHAN0));
 }
 
-void dwmac4_enable_dma_irq(void __iomem *ioaddr)
+void eqos_enable_dma_irq(void __iomem *ioaddr)
 {
 	writel(DMA_CHAN_INTR_DEFAULT_MASK, ioaddr +
 	       DMA_CHAN_INTR_ENA(STMMAC_CHAN0));
 }
 
-void dwmac410_enable_dma_irq(void __iomem *ioaddr)
+void eqos10_enable_dma_irq(void __iomem *ioaddr)
 {
 	writel(DMA_CHAN_INTR_DEFAULT_MASK_4_10,
 	       ioaddr + DMA_CHAN_INTR_ENA(STMMAC_CHAN0));
 }
 
-void dwmac4_disable_dma_irq(void __iomem *ioaddr)
+void eqos_disable_dma_irq(void __iomem *ioaddr)
 {
 	writel(0, ioaddr + DMA_CHAN_INTR_ENA(STMMAC_CHAN0));
 }
 
-int dwmac4_dma_interrupt(void __iomem *ioaddr,
+int eqos_dma_interrupt(void __iomem *ioaddr,
 			 struct stmmac_extra_stats *x)
 {
 	int ret = 0;
@@ -177,7 +177,7 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
 	return ret;
 }
 
-void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
+void stmmac_eqos_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
 				unsigned int high, unsigned int low)
 {
 	unsigned long data;
@@ -194,7 +194,7 @@ void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
 }
 
 /* Enable disable MAC RX/TX */
-void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable)
+void stmmac_eqos_set_mac(void __iomem *ioaddr, bool enable)
 {
 	u32 value = readl(ioaddr + GMAC_CONFIG);
 
@@ -206,7 +206,7 @@ void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable)
 	writel(value, ioaddr + GMAC_CONFIG);
 }
 
-void stmmac_dwmac4_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
+void stmmac_eqos_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
 				unsigned int high, unsigned int low)
 {
 	unsigned int hi_addr, lo_addr;
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc.h b/drivers/net/ethernet/stmicro/stmmac/mmc.h
index 38a1a56..4db02a5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/mmc.h
+++ b/drivers/net/ethernet/stmicro/stmmac/mmc.h
@@ -36,7 +36,7 @@
 #define MMC_CNTRL_PRESET		0x10
 #define MMC_CNTRL_FULL_HALF_PRESET	0x20
 
-#define MMC_GMAC4_OFFSET		0x700
+#define MMC_QOS_OFFSET		0x700
 #define MMC_GMAC3_X_OFFSET		0x100
 
 struct stmmac_counters {
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 322e5c6..4a22f8f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -263,7 +263,7 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
-	if (priv->plat->has_gmac || priv->plat->has_gmac4)
+	if (priv->plat->has_gmac || priv->plat->has_qos)
 		strlcpy(info->driver, GMAC_ETHTOOL_NAME, sizeof(info->driver));
 	else
 		strlcpy(info->driver, MAC100_ETHTOOL_NAME,
@@ -446,7 +446,7 @@ static void stmmac_ethtool_gregs(struct net_device *dev,
 
 	memset(reg_space, 0x0, REG_SPACE_SIZE);
 
-	if (!(priv->plat->has_gmac || priv->plat->has_gmac4)) {
+	if (!(priv->plat->has_gmac || priv->plat->has_qos)) {
 		/* MAC registers */
 		for (i = 0; i < 12; i++)
 			reg_space[i] = readl(priv->ioaddr + (i * 4));
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
index 10d6059..218cadc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
@@ -34,7 +34,7 @@ static void stmmac_config_hw_tstamping(void __iomem *ioaddr, u32 data)
 }
 
 static u32 stmmac_config_sub_second_increment(void __iomem *ioaddr,
-					      u32 ptp_clock, int gmac4)
+					      u32 ptp_clock, int qos)
 {
 	u32 value = readl(ioaddr + PTP_TCR);
 	unsigned long data;
@@ -54,8 +54,8 @@ static u32 stmmac_config_sub_second_increment(void __iomem *ioaddr,
 
 	data &= PTP_SSIR_SSINC_MASK;
 
-	if (gmac4)
-		data = data << GMAC4_PTP_SSIR_SSINC_SHIFT;
+	if (qos)
+		data = data << QOS_PTP_SSIR_SSINC_SHIFT;
 
 	writel(data, ioaddr + PTP_SSIR);
 
@@ -112,7 +112,7 @@ static int stmmac_config_addend(void __iomem *ioaddr, u32 addend)
 }
 
 static int stmmac_adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec,
-				 int add_sub, int gmac4)
+				 int add_sub, int qos)
 {
 	u32 value;
 	int limit;
@@ -122,7 +122,7 @@ static int stmmac_adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec,
 		 * the system time, then MAC_STSUR reg should be
 		 * programmed with (2^32 – <new_sec_value>)
 		 */
-		if (gmac4)
+		if (qos)
 			sec = (100000000ULL - sec);
 
 		value = readl(ioaddr + PTP_TCR);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 38e1fb7..d29b3d4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -398,8 +398,8 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p,
 
 	/* Check if timestamp is available */
 	if (!priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
-		/* For GMAC4, the valid timestamp is from CTX next desc. */
-		if (priv->plat->has_gmac4)
+		/* For eQOS, the valid timestamp is from CTX next desc. */
+		if (priv->plat->has_qos)
 			ns = priv->hw->desc->get_timestamp(np, priv->adv_ts);
 		else
 			ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
@@ -608,7 +608,7 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
 		/* program Sub Second Increment reg */
 		sec_inc = priv->hw->ptp->config_sub_second_increment(
 			priv->ptpaddr, priv->plat->clk_ptp_rate,
-			priv->plat->has_gmac4);
+			priv->plat->has_qos);
 		temp = div_u64(1000000000ULL, sec_inc);
 
 		/* calculate default added value:
@@ -647,7 +647,7 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
 
 	priv->adv_ts = 0;
 	/* Check if adv_ts can be enabled for dwmac 4.x core */
-	if (priv->plat->has_gmac4 && priv->dma_cap.atime_stamp)
+	if (priv->plat->has_qos && priv->dma_cap.atime_stamp)
 		priv->adv_ts = 1;
 	/* Dwmac 3.x core with extend_desc can support adv_ts */
 	else if (priv->extend_desc && priv->dma_cap.atime_stamp)
@@ -721,14 +721,14 @@ static void stmmac_adjust_link(struct net_device *dev)
 			switch (phydev->speed) {
 			case 1000:
 				if (likely((priv->plat->has_gmac) ||
-					   (priv->plat->has_gmac4)))
+					   (priv->plat->has_qos)))
 					ctrl &= ~priv->hw->link.port;
 				stmmac_hw_fix_mac_speed(priv);
 				break;
 			case 100:
 			case 10:
 				if (likely((priv->plat->has_gmac) ||
-					   (priv->plat->has_gmac4))) {
+					   (priv->plat->has_qos))) {
 					ctrl |= priv->hw->link.port;
 					if (phydev->speed == SPEED_100) {
 						ctrl |= priv->hw->link.speed;
@@ -1491,8 +1491,8 @@ static void stmmac_mmc_setup(struct stmmac_priv *priv)
 			    MMC_CNTRL_PRESET | MMC_CNTRL_FULL_HALF_PRESET;
 
 	if (priv->synopsys_id >= DWMAC_CORE_4_00) {
-		priv->ptpaddr = priv->ioaddr + PTP_GMAC4_OFFSET;
-		priv->mmcaddr = priv->ioaddr + MMC_GMAC4_OFFSET;
+		priv->ptpaddr = priv->ioaddr + PTP_QOS_OFFSET;
+		priv->mmcaddr = priv->ioaddr + MMC_QOS_OFFSET;
 	} else {
 		priv->ptpaddr = priv->ioaddr + PTP_GMAC3_X_OFFSET;
 		priv->mmcaddr = priv->ioaddr + MMC_GMAC3_X_OFFSET;
@@ -1715,7 +1715,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 
 	/* Enable the MAC Rx/Tx */
 	if (priv->synopsys_id >= DWMAC_CORE_4_00)
-		stmmac_dwmac4_set_mac(priv->ioaddr, true);
+		stmmac_eqos_set_mac(priv->ioaddr, true);
 	else
 		stmmac_set_mac(priv->ioaddr, true);
 
@@ -1979,7 +1979,7 @@ static void stmmac_tso_allocator(struct stmmac_priv *priv, unsigned int des,
  *  @skb : the socket buffer
  *  @dev : device pointer
  *  Description: this is the transmit function that is called on TSO frames
- *  (support available on GMAC4 and newer chips).
+ *  (support available on eQOS and newer chips).
  *  Diagram below show the ring programming in case of TSO frames:
  *
  *  First Descriptor
@@ -2187,7 +2187,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	unsigned int enh_desc;
 	unsigned int des;
 
-	/* Manage oversized TCP frames for GMAC4 device */
+	/* Manage oversized TCP frames for eQOS device */
 	if (skb_is_gso(skb) && priv->tso) {
 		if (ip_hdr(skb)->protocol == IPPROTO_TCP)
 			return stmmac_tso_xmit(skb, dev);
@@ -2584,10 +2584,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
 			}
 
 			/* The zero-copy is always used for all the sizes
-			 * in case of GMAC4 because it needs
+			 * in case of eQOS because it needs
 			 * to refill the used descriptors, always.
 			 */
-			if (unlikely(!priv->plat->has_gmac4 &&
+			if (unlikely(!priv->plat->has_qos &&
 				     ((frame_len < priv->rx_copybreak) ||
 				     stmmac_rx_threshold_count(priv)))) {
 				skb = netdev_alloc_skb_ip_align(priv->dev,
@@ -2822,7 +2822,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
 	}
 
 	/* To handle GMAC own interrupts */
-	if ((priv->plat->has_gmac) || (priv->plat->has_gmac4)) {
+	if ((priv->plat->has_gmac) || (priv->plat->has_qos)) {
 		int status = priv->hw->mac->host_irq_status(priv->hw,
 							    &priv->xstats);
 		if (unlikely(status)) {
@@ -3127,9 +3127,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 				      priv->plat->multicast_filter_bins,
 				      priv->plat->unicast_filter_entries,
 				      &priv->synopsys_id);
-	} else if (priv->plat->has_gmac4) {
+	} else if (priv->plat->has_qos) {
 		priv->dev->priv_flags |= IFF_UNICAST_FLT;
-		mac = dwmac4_setup(priv->ioaddr,
+		mac = eqos_setup(priv->ioaddr,
 				   priv->plat->multicast_filter_bins,
 				   priv->plat->unicast_filter_entries,
 				   &priv->synopsys_id);
@@ -3143,7 +3143,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 
 	/* To use the chained or ring mode */
 	if (priv->synopsys_id >= DWMAC_CORE_4_00) {
-		priv->hw->mode = &dwmac4_ring_mode_ops;
+		priv->hw->mode = &eqos_ring_mode_ops;
 	} else {
 		if (chain_mode) {
 			priv->hw->mode = &chain_mode_ops;
@@ -3176,7 +3176,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 		else
 			priv->plat->tx_coe = priv->dma_cap.tx_coe;
 
-		/* In case of GMAC4 rx_coe is from HW cap register. */
+		/* In case of eQOS rx_coe is from HW cap register. */
 		priv->plat->rx_coe = priv->dma_cap.rx_coe;
 
 		if (priv->dma_cap.rx_coe_type2)
@@ -3188,9 +3188,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 		dev_info(priv->device, "No HW DMA feature register supported\n");
 	}
 
-	/* To use alternate (extended), normal or GMAC4 descriptor structures */
+	/* To use alternate (extended), normal or eQOS descriptor structures */
 	if (priv->synopsys_id >= DWMAC_CORE_4_00)
-		priv->hw->desc = &dwmac4_desc_ops;
+		priv->hw->desc = &eqos_desc_ops;
 	else
 		stmmac_selec_desc_mode(priv);
 
@@ -3504,7 +3504,7 @@ int stmmac_resume(struct device *dev)
 	priv->dirty_tx = 0;
 	priv->cur_tx = 0;
 	/* reset private mss value to force mss context settings at
-	 * next tso xmit (only used for gmac4).
+	 * next tso xmit (only used for eQOS).
 	 */
 	priv->mss = 0;
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index b0344c2..cc7a29f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -37,10 +37,10 @@
 #define MII_BUSY 0x00000001
 #define MII_WRITE 0x00000002
 
-/* GMAC4 defines */
-#define MII_GMAC4_GOC_SHIFT		2
-#define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
-#define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
+/* QOS defines */
+#define MII_QOS_GOC_SHIFT		2
+#define MII_QOS_WRITE			(1 << MII_QOS_GOC_SHIFT)
+#define MII_QOS_READ			(3 << MII_QOS_GOC_SHIFT)
 
 static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
 {
@@ -83,8 +83,8 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
 	value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
 	value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift)
 		& priv->hw->mii.clk_csr_mask;
-	if (priv->plat->has_gmac4)
-		value |= MII_GMAC4_READ;
+	if (priv->plat->has_qos)
+		value |= MII_QOS_READ;
 
 	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
 		return -EBUSY;
@@ -124,8 +124,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
 
 	value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift)
 		& priv->hw->mii.clk_csr_mask;
-	if (priv->plat->has_gmac4)
-		value |= MII_GMAC4_WRITE;
+	if (priv->plat->has_qos)
+		value |= MII_QOS_WRITE;
 	else
 		value |= MII_WRITE;
 
@@ -198,10 +198,10 @@ int stmmac_mdio_reset(struct mii_bus *bus)
 
 	/* This is a workaround for problems with the STE101P PHY.
 	 * It doesn't complete its reset until at least one clock cycle
-	 * on MDC, so perform a dummy mdio read. To be upadted for GMAC4
+	 * on MDC, so perform a dummy mdio read. To be upadted for eQOS
 	 * if needed.
 	 */
-	if (!priv->plat->has_gmac4)
+	if (!priv->plat->has_qos)
 		writel(0, priv->ioaddr + mii_address);
 #endif
 	return 0;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 3da4737..24cade3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -47,6 +47,8 @@ struct stmmac_pci_info {
 	struct stmmac_pci_dmi_data *dmi;
 };
 
+static const u8 snps_dev_addr[6] = {0, 0x55, 0x7b, 0xb5, 0x7d, 0xf7};
+
 static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info)
 {
 	const char *name = dmi_get_system_info(DMI_BOARD_NAME);
@@ -72,10 +74,13 @@ static void stmmac_default_data(struct plat_stmmacenet_data *plat)
 {
 	plat->bus_id = 1;
 	plat->phy_addr = 0;
-	plat->interface = PHY_INTERFACE_MODE_GMII;
-	plat->clk_csr = 2;	/* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */
-	plat->has_gmac = 1;
-	plat->force_sf_dma_mode = 1;
+	plat->interface = PHY_INTERFACE_MODE_SGMII;
+	plat->clk_csr = 0x5;
+	plat->has_gmac = 0;
+	plat->has_qos = 1;
+	plat->force_sf_dma_mode = 0;
+	plat->rx_fifo_size = 8192;
+	plat->maxmtu = JUMBO_LEN;
 
 	plat->mdio_bus_data->phy_reset = NULL;
 	plat->mdio_bus_data->phy_mask = 0;
@@ -87,11 +92,11 @@ static void stmmac_default_data(struct plat_stmmacenet_data *plat)
 	/* Set default value for multicast hash bins */
 	plat->multicast_filter_bins = HASH_TABLE_SIZE;
 
+	plat->dma_cfg->fixed_burst = 0;
+	plat->dma_cfg->aal = 0;
+
 	/* Set default value for unicast filter entries */
 	plat->unicast_filter_entries = 1;
-
-	/* Set the maxmtu to a default of JUMBO_LEN */
-	plat->maxmtu = JUMBO_LEN;
 }
 
 static int quark_default_data(struct plat_stmmacenet_data *plat,
@@ -129,9 +134,6 @@ static int quark_default_data(struct plat_stmmacenet_data *plat,
 	/* Set default value for unicast filter entries */
 	plat->unicast_filter_entries = 1;
 
-	/* Set the maxmtu to a default of JUMBO_LEN */
-	plat->maxmtu = JUMBO_LEN;
-
 	return 0;
 }
 
@@ -220,13 +222,15 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 	} else
 		stmmac_default_data(plat);
 
-	pci_enable_msi(pdev);
+	/*pci_enable_msi(pdev);*/
 
 	memset(&res, 0, sizeof(res));
 	res.addr = pcim_iomap_table(pdev)[i];
 	res.wol_irq = pdev->irq;
 	res.irq = pdev->irq;
 
+	res.mac = snps_dev_addr;
+
 	return stmmac_dvr_probe(&pdev->dev, plat, &res);
 }
 
@@ -247,11 +251,15 @@ static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_suspend, stmmac_resume);
 #define STMMAC_VENDOR_ID 0x700
 #define STMMAC_QUARK_ID  0x0937
 #define STMMAC_DEVICE_ID 0x1108
+#define DEVICE_ID_HAPS_DX 0x7102
+#define DEVICE_ID_HAPS_6X 0x7101
 
 static const struct pci_device_id stmmac_id_table[] = {
 	{PCI_DEVICE(STMMAC_VENDOR_ID, STMMAC_DEVICE_ID)},
 	{PCI_DEVICE(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_MAC)},
 	{PCI_VDEVICE(INTEL, STMMAC_QUARK_ID), (kernel_ulong_t)&quark_pci_info},
+	{PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, DEVICE_ID_HAPS_DX)},
+	{PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, DEVICE_ID_HAPS_6X)},
 	{}
 };
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 460f94f..dc9646b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -302,7 +302,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
 
 	if (of_device_is_compatible(np, "snps,dwmac-4.00") ||
 	    of_device_is_compatible(np, "snps,dwmac-4.10a")) {
-		plat->has_gmac4 = 1;
+		plat->has_qos = 1;
 		plat->has_gmac = 0;
 		plat->pmt = 1;
 		plat->tso_en = of_property_read_bool(np, "snps,tso");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 3eb281d..9f335e0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -90,7 +90,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)
 	spin_lock_irqsave(&priv->ptp_lock, flags);
 
 	priv->hw->ptp->adjust_systime(priv->ptpaddr, sec, nsec, neg_adj,
-				      priv->plat->has_gmac4);
+				      priv->plat->has_qos);
 
 	spin_unlock_irqrestore(&priv->ptp_lock, flags);
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
index c06938c..ab96f3c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
@@ -25,7 +25,7 @@
 #ifndef	__STMMAC_PTP_H__
 #define	__STMMAC_PTP_H__
 
-#define	PTP_GMAC4_OFFSET	0xb00
+#define	PTP_QOS_OFFSET	0xb00
 #define	PTP_GMAC3_X_OFFSET	0x700
 
 /* IEEE 1588 PTP register offsets */
@@ -69,6 +69,6 @@
 
 /* SSIR defines */
 #define	PTP_SSIR_SSINC_MASK		0xff
-#define	GMAC4_PTP_SSIR_SSINC_SHIFT	16
+#define	QOS_PTP_SSIR_SSINC_SHIFT	16
 
 #endif	/* __STMMAC_PTP_H__ */
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index d76033d6..134f94d 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -144,7 +144,7 @@ struct plat_stmmacenet_data {
 	unsigned int clk_ptp_rate;
 	struct reset_control *stmmac_rst;
 	struct stmmac_axi *axi;
-	int has_gmac4;
+	int has_qos;
 	bool tso_en;
 	int mac_port_sel_speed;
 	bool en_tx_lpi_clockgating;
-- 
2.9.3

^ permalink raw reply related

* RE: [PATCH net-next V4] tc: flower: Refactor matching flags to be more user friendly
From: David Laight @ 2017-01-20 12:27 UTC (permalink / raw)
  To: 'Jiri Benc', Paul Blakey
  Cc: Stephen Hemminger, netdev@vger.kernel.org, Jiri Pirko, Or Gerlitz,
	Roi Dayan, Simon Horman
In-Reply-To: <20170119152218.61aa2fc4@griffin>

From: Of Jiri Benc
> Sent: 19 January 2017 14:22
> On Thu, 19 Jan 2017 16:17:48 +0200, Paul Blakey wrote:
> > +	while (token) {
> > +		if (!strncmp(token, "no", 2)) {
> > +			no = true;
> > +			token = strchr(token, '_') + 1;
> 
> This seems to still assume that "no" is followed by an underscore.
> What about a simple token += 2?

Actually it was rather worse than that and probably shows a
distinct lack of testing.
Consider what happened with "no", "nofubar" and "nofubar_baz",
all ought to be rejected.

Actually using strncmp() is also overkill.
Nothing wrong with:
	if (token[0] == 'n' && token[1] == 'o' && token[2]) {
		no = true;
		token += 2;
		if (token[0] == '_' && token[1])
			token++;
		...

or replace the last 3 lines with:
		token += 2 + (token[2] == '_' & token[3]);

	David

^ permalink raw reply

* [PATCH] net: sctp: fix array overrun read on sctp_timer_tbl
From: Colin King @ 2017-01-20 13:01 UTC (permalink / raw)
  To: Vlad Yasevich, Neil Horman, David S . Miller, linux-sctp, netdev
  Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The comparison on the timeout can lead to an array overrun
read on sctp_timer_tbl because of an off-by-one error. Fix
this by using < instead of <= and also compare to the array
size rather than SCTP_EVENT_TIMEOUT_MAX.

Fixes CoverityScan CID#1397639 ("Out-of-bounds read")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/sctp/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/debug.c b/net/sctp/debug.c
index 95d7b15..e371a0d 100644
--- a/net/sctp/debug.c
+++ b/net/sctp/debug.c
@@ -166,7 +166,7 @@ static const char *const sctp_timer_tbl[] = {
 /* Lookup timer debug name. */
 const char *sctp_tname(const sctp_subtype_t id)
 {
-	if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
+	if (id.timeout < ARRAY_SIZE(sctp_timer_tbl))
 		return sctp_timer_tbl[id.timeout];
 	return "unknown_timer";
 }
-- 
2.10.2

^ permalink raw reply related

* [PATCH] net: phy: micrel: add KSZ8795 ethernet switch
From: Sean Nyekjaer @ 2017-01-20 12:50 UTC (permalink / raw)
  To: netdev; +Cc: Sean Nyekjaer

This ethernet switch have unfortunately the same phy id as KSZ8051.

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
---
 drivers/net/phy/micrel.c   | 14 ++++++++++++++
 include/linux/micrel_phy.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index ea92d524d5a8..d47026c18974 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1014,6 +1014,20 @@ static struct phy_driver ksphy_driver[] = {
 	.get_stats	= kszphy_get_stats,
 	.suspend	= genphy_suspend,
 	.resume		= genphy_resume,
+}, {
+	.phy_id		= PHY_ID_KSZ8795,
+	.phy_id_mask	= MICREL_PHY_ID_MASK,
+	.name		= "Micrel KSZ8795 Switch",
+	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+	.config_init	= kszphy_config_init,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
+	.get_sset_count = kszphy_get_sset_count,
+	.get_strings	= kszphy_get_strings,
+	.get_stats	= kszphy_get_stats,
+	.suspend	= genphy_suspend,
+	.resume		= genphy_resume,
 } };
 
 module_phy_driver(ksphy_driver);
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 257173e0095e..f541da68d1e7 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -35,6 +35,8 @@
 #define PHY_ID_KSZ886X		0x00221430
 #define PHY_ID_KSZ8863		0x00221435
 
+#define PHY_ID_KSZ8795		0x00221550
+
 /* struct phy_device dev_flags definitions */
 #define MICREL_PHY_50MHZ_CLK	0x00000001
 #define MICREL_PHY_FXEN		0x00000002
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next] net: remove bh disabling around percpu_counter accesses
From: Eric Dumazet @ 2017-01-20 13:06 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

Shaohua Li made percpu_counter irq safe in commit 098faf5805c8
("percpu_counter: make APIs irq safe")

We can safely remove BH disable/enable sections around various
percpu_counter manipulations.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/dst_ops.h           |    9 +--------
 include/net/inet_frag.h         |    8 +-------
 net/ipv4/inet_connection_sock.c |    3 +--
 net/ipv4/proc.c                 |    2 --
 net/ipv4/tcp.c                  |    2 --
 net/ipv4/tcp_ipv4.c             |    2 --
 6 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index a0d443ca16fcca26b4925d477265935f5bdaf5bc..8a2b66d8d78de33f18f1343f97fd7d29e935fbfa 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -46,19 +46,12 @@ static inline int dst_entries_get_fast(struct dst_ops *dst)
 
 static inline int dst_entries_get_slow(struct dst_ops *dst)
 {
-	int res;
-
-	local_bh_disable();
-	res = percpu_counter_sum_positive(&dst->pcpuc_entries);
-	local_bh_enable();
-	return res;
+	return percpu_counter_sum_positive(&dst->pcpuc_entries);
 }
 
 static inline void dst_entries_add(struct dst_ops *dst, int val)
 {
-	local_bh_disable();
 	percpu_counter_add(&dst->pcpuc_entries, val);
-	local_bh_enable();
 }
 
 static inline int dst_entries_init(struct dst_ops *dst)
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 909972aa3acd7e4e3d865800f45056235efc7bef..5894730ec82a9fba3b9bca160de6e0db3a73024e 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -164,13 +164,7 @@ static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
 
 static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
 {
-	unsigned int res;
-
-	local_bh_disable();
-	res = percpu_counter_sum_positive(&nf->mem);
-	local_bh_enable();
-
-	return res;
+	return percpu_counter_sum_positive(&nf->mem);
 }
 
 /* RFC 3168 support :
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 096a085611ab8dc2b0666ed9859bf792f396dc43..c7f7c53353691070813eeb7ece86d1826f408fd5 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -836,9 +836,8 @@ void inet_csk_destroy_sock(struct sock *sk)
 
 	sk_refcnt_debug_release(sk);
 
-	local_bh_disable();
 	percpu_counter_dec(sk->sk_prot->orphan_count);
-	local_bh_enable();
+
 	sock_put(sk);
 }
 EXPORT_SYMBOL(inet_csk_destroy_sock);
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 0247ca0322327bc42273b675b769c1f176ba33f4..a9deeb90dd36e0a8f94596b4f563ad63925344cf 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -57,10 +57,8 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
 	unsigned int frag_mem;
 	int orphans, sockets;
 
-	local_bh_disable();
 	orphans = percpu_counter_sum_positive(&tcp_orphan_count);
 	sockets = proto_sockets_allocated_sum_positive(&tcp_prot);
-	local_bh_enable();
 
 	socket_seq_show(seq);
 	seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n",
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index aba6ea76338e35e36124580dcab3c80e3c638659..c43eb1a831d7a0a36b447421908a149b1808590b 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -420,9 +420,7 @@ void tcp_init_sock(struct sock *sk)
 	sk->sk_sndbuf = sysctl_tcp_wmem[1];
 	sk->sk_rcvbuf = sysctl_tcp_rmem[1];
 
-	local_bh_disable();
 	sk_sockets_allocated_inc(sk);
-	local_bh_enable();
 }
 EXPORT_SYMBOL(tcp_init_sock);
 
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 3644fc1176918d81c645e0e79c4ec3aec4216474..f7325b25b06e65581ecc496f95e819aa738c0987 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1887,9 +1887,7 @@ void tcp_v4_destroy_sock(struct sock *sk)
 	tcp_free_fastopen_req(tp);
 	tcp_saved_syn_free(tp);
 
-	local_bh_disable();
 	sk_sockets_allocated_dec(sk);
-	local_bh_enable();
 }
 EXPORT_SYMBOL(tcp_v4_destroy_sock);
 

^ permalink raw reply related

* Re: [PATCH] net: sctp: fix array overrun read on sctp_timer_tbl
From: Marcelo Ricardo Leitner @ 2017-01-20 13:10 UTC (permalink / raw)
  To: Colin King
  Cc: Vlad Yasevich, Neil Horman, David S . Miller, linux-sctp, netdev,
	linux-kernel, lucien.xin
In-Reply-To: <20170120130157.20034-1-colin.king@canonical.com>

On Fri, Jan 20, 2017 at 01:01:57PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The comparison on the timeout can lead to an array overrun
> read on sctp_timer_tbl because of an off-by-one error. Fix
> this by using < instead of <= and also compare to the array
> size rather than SCTP_EVENT_TIMEOUT_MAX.
> 
> Fixes CoverityScan CID#1397639 ("Out-of-bounds read")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  net/sctp/debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sctp/debug.c b/net/sctp/debug.c
> index 95d7b15..e371a0d 100644
> --- a/net/sctp/debug.c
> +++ b/net/sctp/debug.c
> @@ -166,7 +166,7 @@ static const char *const sctp_timer_tbl[] = {
>  /* Lookup timer debug name. */
>  const char *sctp_tname(const sctp_subtype_t id)
>  {
> -	if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
> +	if (id.timeout < ARRAY_SIZE(sctp_timer_tbl))
>  		return sctp_timer_tbl[id.timeout];

The issue exists but this is not the right fix.
Issue was introduced by 7b9438de0cd4 ("sctp: add stream reconf timer")
as it introduced a new timer but didn't add the timer name here, so the
fix should (also) include:

diff --git a/net/sctp/debug.c b/net/sctp/debug.c
index 95d7b15dad21..c5f4ed5242ac 100644
--- a/net/sctp/debug.c
+++ b/net/sctp/debug.c
@@ -159,6 +159,7 @@ static const char *const sctp_timer_tbl[] = {
 	"TIMEOUT_T4_RTO",
 	"TIMEOUT_T5_SHUTDOWN_GUARD",
 	"TIMEOUT_HEARTBEAT",
+	"TIMEOUT_RECONF",
 	"TIMEOUT_SACK",
 	"TIMEOUT_AUTOCLOSE",
 };

Thanks,
Marcelo

>  	return "unknown_timer";
>  }
> -- 
> 2.10.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply related

* Re: [PATCH] net: sctp: fix array overrun read on sctp_timer_tbl
From: Colin Ian King @ 2017-01-20 13:15 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: Vlad Yasevich, Neil Horman, David S . Miller, linux-sctp, netdev,
	linux-kernel, lucien.xin
In-Reply-To: <20170120131000.GR3781@localhost.localdomain>

On 20/01/17 13:10, Marcelo Ricardo Leitner wrote:
> On Fri, Jan 20, 2017 at 01:01:57PM +0000, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The comparison on the timeout can lead to an array overrun
>> read on sctp_timer_tbl because of an off-by-one error. Fix
>> this by using < instead of <= and also compare to the array
>> size rather than SCTP_EVENT_TIMEOUT_MAX.
>>
>> Fixes CoverityScan CID#1397639 ("Out-of-bounds read")
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  net/sctp/debug.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/sctp/debug.c b/net/sctp/debug.c
>> index 95d7b15..e371a0d 100644
>> --- a/net/sctp/debug.c
>> +++ b/net/sctp/debug.c
>> @@ -166,7 +166,7 @@ static const char *const sctp_timer_tbl[] = {
>>  /* Lookup timer debug name. */
>>  const char *sctp_tname(const sctp_subtype_t id)
>>  {
>> -	if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
>> +	if (id.timeout < ARRAY_SIZE(sctp_timer_tbl))
>>  		return sctp_timer_tbl[id.timeout];
> 
> The issue exists but this is not the right fix.
> Issue was introduced by 7b9438de0cd4 ("sctp: add stream reconf timer")
> as it introduced a new timer but didn't add the timer name here, so the
> fix should (also) include:
> 
> diff --git a/net/sctp/debug.c b/net/sctp/debug.c
> index 95d7b15dad21..c5f4ed5242ac 100644
> --- a/net/sctp/debug.c
> +++ b/net/sctp/debug.c
> @@ -159,6 +159,7 @@ static const char *const sctp_timer_tbl[] = {
>  	"TIMEOUT_T4_RTO",
>  	"TIMEOUT_T5_SHUTDOWN_GUARD",
>  	"TIMEOUT_HEARTBEAT",
> +	"TIMEOUT_RECONF",
>  	"TIMEOUT_SACK",
>  	"TIMEOUT_AUTOCLOSE",
>  };

Ah, OK, I can add that timeout into the the table, but perhaps it's
still prudent to check the index against the table size as well.

> 
> Thanks,
> Marcelo
> 
>>  	return "unknown_timer";
>>  }
>> -- 
>> 2.10.2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>

^ permalink raw reply

* [PATCH net-next] uapi: fix signess in ethtool_validate_speed()
From: Volodymyr Bendiuga @ 2017-01-20 13:20 UTC (permalink / raw)
  To: davem, mst, nikolay, netdev, volodymyr.bendiuga
  Cc: Jonas Johansson, Volodymyr Bendiuga

From: Jonas Johansson <jonas.johansson@westermo.se>

There is a comparison of speed  variable which
is unsigned, and SPEED_UNKNOWN which is signed.

Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se>
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
---
 include/uapi/linux/ethtool.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index f0db778..1ca4a77 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -1500,7 +1500,7 @@ enum ethtool_link_mode_bit_indices {
 
 #define SPEED_UNKNOWN		-1
 
-static inline int ethtool_validate_speed(__u32 speed)
+static inline int ethtool_validate_speed(__s32 speed)
 {
 	return speed <= INT_MAX || speed == SPEED_UNKNOWN;
 }
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH] net: sctp: fix array overrun read on sctp_timer_tbl
From: Marcelo Ricardo Leitner @ 2017-01-20 13:22 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Vlad Yasevich, Neil Horman, David S . Miller, linux-sctp, netdev,
	linux-kernel, lucien.xin
In-Reply-To: <4ba6d2eb-972d-4e2e-7876-7ecf3e29a438@canonical.com>

On Fri, Jan 20, 2017 at 01:15:18PM +0000, Colin Ian King wrote:
> On 20/01/17 13:10, Marcelo Ricardo Leitner wrote:
> > On Fri, Jan 20, 2017 at 01:01:57PM +0000, Colin King wrote:
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> The comparison on the timeout can lead to an array overrun
> >> read on sctp_timer_tbl because of an off-by-one error. Fix
> >> this by using < instead of <= and also compare to the array
> >> size rather than SCTP_EVENT_TIMEOUT_MAX.
> >>
> >> Fixes CoverityScan CID#1397639 ("Out-of-bounds read")
> >>
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >> ---
> >>  net/sctp/debug.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/net/sctp/debug.c b/net/sctp/debug.c
> >> index 95d7b15..e371a0d 100644
> >> --- a/net/sctp/debug.c
> >> +++ b/net/sctp/debug.c
> >> @@ -166,7 +166,7 @@ static const char *const sctp_timer_tbl[] = {
> >>  /* Lookup timer debug name. */
> >>  const char *sctp_tname(const sctp_subtype_t id)
> >>  {
> >> -	if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
> >> +	if (id.timeout < ARRAY_SIZE(sctp_timer_tbl))
> >>  		return sctp_timer_tbl[id.timeout];
> > 
> > The issue exists but this is not the right fix.
> > Issue was introduced by 7b9438de0cd4 ("sctp: add stream reconf timer")
> > as it introduced a new timer but didn't add the timer name here, so the
> > fix should (also) include:
> > 
> > diff --git a/net/sctp/debug.c b/net/sctp/debug.c
> > index 95d7b15dad21..c5f4ed5242ac 100644
> > --- a/net/sctp/debug.c
> > +++ b/net/sctp/debug.c
> > @@ -159,6 +159,7 @@ static const char *const sctp_timer_tbl[] = {
> >  	"TIMEOUT_T4_RTO",
> >  	"TIMEOUT_T5_SHUTDOWN_GUARD",
> >  	"TIMEOUT_HEARTBEAT",
> > +	"TIMEOUT_RECONF",
> >  	"TIMEOUT_SACK",
> >  	"TIMEOUT_AUTOCLOSE",
> >  };
> 
> Ah, OK, I can add that timeout into the the table, but perhaps it's
> still prudent to check the index against the table size as well.
> 

Yes, and/or a:
  BUILD_BUG_ON(SCTP_EVENT_TIMEOUT_MAX + 1 != ARRAY_SIZE(sctp_timer_tbl))
As then we would be sure to have the list right :-)
Otherwise we may not do wrong reads but may report the wrong timer name.

> > 
> > Thanks,
> > Marcelo
> > 
> >>  	return "unknown_timer";
> >>  }
> >> -- 
> >> 2.10.2
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants
From: Vlastimil Babka @ 2017-01-20 13:41 UTC (permalink / raw)
  To: Michal Hocko, Kees Cook
  Cc: Andrew Morton, David Rientjes, Mel Gorman, Johannes Weiner,
	Al Viro, Linux-MM, LKML, Martin Schwidefsky, Heiko Carstens,
	Herbert Xu, Anton Vorontsov, Colin Cross, Tony Luck,
	Rafael J. Wysocki, Ben Skeggs, Kent Overstreet, Santosh Raspatur,
	Hariprasad S, Tariq Toukan, Yishai Hadas, Dan Williams,
	Oleg Drokin, Andreas Dilger, Bor
In-Reply-To: <20170112173745.GC31509@dhcp22.suse.cz>

On 01/12/2017 06:37 PM, Michal Hocko wrote:
> On Thu 12-01-17 09:26:09, Kees Cook wrote:
>> On Thu, Jan 12, 2017 at 7:37 AM, Michal Hocko <mhocko@kernel.org> wrote:
> [...]
>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>> index 4f74511015b8..e6bbb33d2956 100644
>>> --- a/arch/s390/kvm/kvm-s390.c
>>> +++ b/arch/s390/kvm/kvm-s390.c
>>> @@ -1126,10 +1126,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
>>>         if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)
>>>                 return -EINVAL;
>>>
>>> -       keys = kmalloc_array(args->count, sizeof(uint8_t),
>>> -                            GFP_KERNEL | __GFP_NOWARN);
>>> -       if (!keys)
>>> -               keys = vmalloc(sizeof(uint8_t) * args->count);
>>> +       keys = kvmalloc(args->count * sizeof(uint8_t), GFP_KERNEL);
>>
>> Before doing this conversion, can we add a kvmalloc_array() API? This
>> conversion could allow for the reintroduction of integer overflow
>> flaws. (This particular situation isn't at risk since ->count is
>> checked, but I'd prefer we not create a risky set of examples for
>> using kvmalloc.)
> 
> Well, I am not opposed to kvmalloc_array but I would argue that this
> conversion cannot introduce new overflow issues. The code would have
> to be broken already because even though kmalloc_array checks for the
> overflow but vmalloc fallback doesn't...

Yeah I agree, but if some of the places were really wrong, after the
conversion we won't see them anymore.

> If there is a general interest for this API I can add it.

I think it would be better, yes.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* [PATCH][V2] net: sctp: fix array overrun read on sctp_timer_tbl
From: Colin King @ 2017-01-20 13:45 UTC (permalink / raw)
  To: Vlad Yasevich, Neil Horman, David S . Miller, linux-sctp, netdev
  Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Table sctp_timer_tbl is missing a TIMEOUT_RECONF string so
add this in. Also compare timeout with the size of the array
sctp_timer_tbl rather than SCTP_EVENT_TIMEOUT_MAX.  Also add
a build time check that SCTP_EVENT_TIMEOUT_MAX is correct
so we don't ever get this kind of mismatch between the table
and SCTP_EVENT_TIMEOUT_MAX in the future.

Kudos to Marcel Ricardo Leitner for spotting the missing string
and suggesting the build time sanity check.

Fixes CoverityScan CID#1397639 ("Out-of-bounds read")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/sctp/debug.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/sctp/debug.c b/net/sctp/debug.c
index 95d7b15..2e47eb2 100644
--- a/net/sctp/debug.c
+++ b/net/sctp/debug.c
@@ -159,6 +159,7 @@ static const char *const sctp_timer_tbl[] = {
 	"TIMEOUT_T4_RTO",
 	"TIMEOUT_T5_SHUTDOWN_GUARD",
 	"TIMEOUT_HEARTBEAT",
+	"TIMEOUT_RECONF",
 	"TIMEOUT_SACK",
 	"TIMEOUT_AUTOCLOSE",
 };
@@ -166,7 +167,9 @@ static const char *const sctp_timer_tbl[] = {
 /* Lookup timer debug name. */
 const char *sctp_tname(const sctp_subtype_t id)
 {
-	if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
+	BUILD_BUG_ON(SCTP_EVENT_TIMEOUT_MAX + 1 != ARRAY_SIZE(sctp_timer_tbl));
+
+	if (id.timeout < ARRAY_SIZE(sctp_timer_tbl))
 		return sctp_timer_tbl[id.timeout];
 	return "unknown_timer";
 }
-- 
2.10.2

^ permalink raw reply related

* Re: [PATCH net-next v4 2/2] net: stmmac: dwmac-meson8b: make the RGMII TX delay configurable
From: Martin Blumenstingl @ 2017-01-20 13:47 UTC (permalink / raw)
  To: David Miller
  Cc: mark.rutland, devicetree, alexandre.torgue, netdev,
	peppe.cavallaro, robh+dt, khilman, carlo, linux-amlogic,
	linux-arm-kernel
In-Reply-To: <CAFBinCDZ_mqt8q2rG6zDy8ke5sX6L+4sVYOOhWUdO3apwFiRYw@mail.gmail.com>

Hi David,

On Sun, Dec 18, 2016 at 5:13 PM, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
> On Sun, Dec 18, 2016 at 4:49 PM, David Miller <davem@davemloft.net> wrote:
>> From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>> Date: Sat, 17 Dec 2016 19:21:19 +0100
>>
>>> Prior to this patch we were using a hardcoded RGMII TX clock delay of
>>> 2ns (= 1/4 cycle of the 125MHz RGMII TX clock). This value works for
>>> many boards, but unfortunately not for all (due to the way the actual
>>> circuit is designed, sometimes because the TX delay is enabled in the
>>> PHY, etc.). Making the TX delay on the MAC side configurable allows us
>>> to support all possible hardware combinations.
>>>
>>> This allows fixing a compatibility issue on some boards, where the
>>> RTL8211F PHY is configured to generate the TX delay. We can now turn
>>> off the TX delay in the MAC, because otherwise we would be applying the
>>> delay twice (which results in non-working TX traffic).
>>>
>>> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>>> Tested-by: Neil Armstrong <narmstrong@baylibre.com>
>>
>> Is this really the safest thing to do?
>>
>> If you say the existing hard-coded setting of 1/4 cycle works on most
>> boards, and what you're trying to do is override it with an OF
>> property value for boards where the existing setting does not work,
>> then you _must_ use a default value that corresponds to what the
>> existing code does not when you don't see this new OF property.
> it's a bit more complicated in reality: 1/4 cycle works when the TX
> delay of the RTL8211F PHY is turned off (until recently it was always
> enabled for phy-mode RGMII).
>
>> So please retain the current behavior of the 1/4 cycle TX delay
>> setting when you don't see the amlogic,tx-delay-ns property.
>>
>> I really think you risk breaking existing boards by not doing so,
>> unless you can have this patch tested on every such board that exists
>> and I don't think you really can feasibly and rigorously do that.
> there's a patch in my follow-up series which adds the 2ns to the .dts
> for all RGMII based boards: [0] (and I would keep these even if we had
> a default value, just to make it explicit and thus easier to
> understand for other people).
> however, we can add the 2ns default back (I can do this if you want -
> Rob Herring was unhappy with the missing documentation of this default
> value [1] - so note to myself: take care of that as well). but then we
> have to decide when to apply this default value: only when we're in
> RGMII mode or also in any of the RGMII_*ID modes?
could you please let me know if I should add a a fallback (2ns which
was the old hardcoded value) to the driver or if I should simply leave
it out (that's the way it is right now).
I'm fine with either way, I would just like to avoid duplicate work.
So please let me know how you prefer it.


Regards,
Martin

^ permalink raw reply

* Re: [PATCH v6 13/13] net: ethernet: aquantia: Integrate AQtion 2.5/5 GB NIC driver
From: kbuild test robot @ 2017-01-20 13:49 UTC (permalink / raw)
  To: Alexander Loktionov
  Cc: kbuild-all, netdev, David VomLehn, David S . Miller,
	Simon Edelhaus, Alexander Loktionov, Dmitrii Tarakanov,
	Pavel Belous, Dmitry Bezrukov
In-Reply-To: <bfce3d39db5d3cf8cac5e1cf355ffe13c2a08b4c.1484788010.git.vomlehn@texas.net>

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

Hi David,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.10-rc4 next-20170120]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Alexander-Loktionov/net-ethernet-aquantia-Make-and-configuration-files/20170119-133339
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> ERROR: "__bad_udelay" [drivers/net/ethernet/aquantia/atlantic/atlantic.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 60360 bytes --]

^ permalink raw reply

* [PATCH] Bluetooth: hidp: might sleep error in hidp_session_thread
From: Jeffy Chen @ 2017-01-20 13:52 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Brian Norris, Douglas Anderson, Jeffy Chen, Johan Hedberg, netdev,
	linux-kernel, David S. Miller, Marcel Holtmann, Gustavo Padovan

[   39.044329] do not call blocking ops when !TASK_RUNNING; state=1 set
at [<ffffffbffc290358>] hidp_session_thread+0x110/0x568 [hidp]
...
[   40.159664] Call trace:
[   40.162122] [<ffffffc00024ae08>] __might_sleep+0x64/0x90
[   40.167443] [<ffffffc00080568c>] lock_sock_nested+0x30/0x78
[   40.173047] [<ffffffbffc1b3ca0>] l2cap_sock_sendmsg+0x90/0xf0
[bluetooth]
[   40.179842] [<ffffffc0008012c4>] sock_sendmsg+0x4c/0x68
[   40.185072] [<ffffffc000801414>] kernel_sendmsg+0x54/0x68
[   40.190477] [<ffffffbffc28f4d0>] hidp_send_frame+0x78/0xa0 [hidp]
[   40.196574] [<ffffffbffc28f53c>] hidp_process_transmit+0x44/0x98
[hidp]
[   40.203191] [<ffffffbffc2905ac>] hidp_session_thread+0x364/0x568
[hidp]

Following (https://lwn.net/Articles/628628/).

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

 net/bluetooth/hidp/core.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 0bec458..bfd3fb8 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -1180,7 +1180,9 @@ static void hidp_session_run(struct hidp_session *session)
 	struct sock *ctrl_sk = session->ctrl_sock->sk;
 	struct sock *intr_sk = session->intr_sock->sk;
 	struct sk_buff *skb;
+	DEFINE_WAIT_FUNC(wait, woken_wake_function);
 
+	add_wait_queue(sk_sleep(intr_sk), &wait);
 	for (;;) {
 		/*
 		 * This thread can be woken up two ways:
@@ -1188,12 +1190,10 @@ static void hidp_session_run(struct hidp_session *session)
 		 *    session->terminate flag and wakes this thread up.
 		 *  - Via modifying the socket state of ctrl/intr_sock. This
 		 *    thread is woken up by ->sk_state_changed().
-		 *
-		 * Note: set_current_state() performs any necessary
-		 * memory-barriers for us.
 		 */
-		set_current_state(TASK_INTERRUPTIBLE);
 
+		/* Ensure session->terminate is updated */
+		smp_mb__before_atomic();
 		if (atomic_read(&session->terminate))
 			break;
 
@@ -1227,11 +1227,14 @@ static void hidp_session_run(struct hidp_session *session)
 		hidp_process_transmit(session, &session->ctrl_transmit,
 				      session->ctrl_sock);
 
-		schedule();
+		wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
 	}
+	remove_wait_queue(sk_sleep(intr_sk), &wait);
 
 	atomic_inc(&session->terminate);
-	set_current_state(TASK_RUNNING);
+
+	/* Ensure session->terminate is updated */
+	smp_mb__after_atomic();
 }
 
 /*
-- 
2.1.4

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox