Start a new git repository

Your first instinct, when you start to do something new, should be git init. You’re starting to write a new paper, you’re writing a bit of code to do a computer simulation, you’re mucking around with some new data … anything: think git init.

A new repo from scratch

Say you’ve just got some data from a collaborator and are about to start exploring it.

  • Create a directory to contain the project.
  • Go into the new directory.
  • Type git init.
  • Write some code.
  • Type git add to add the files (see the typical use page).
  • Type git commit.

The first file to create (and add and commit) is probably a ReadMe file, either as plain text or with Markdown, describing the project.

Markdown allows you to add a bit of text markup, like hyperlinksbold/italics, or to indicate code with a monospace font. Markdown is easily converted to html for viewing in a web browser, and GitHub will do this for you automatically.

A new repo from an existing project

Say you’ve got an existing project that you want to start tracking with git.

  • Go into the directory containing the project.
  • Type git init.
  • Type git add to add all of the relevant files.
  • You’ll probably want to create a .gitignore file right away, to indicate all of the files you don’t want to track. Use git add .gitignore, too.
  • Type git commit.

Connect it to github

You’ve now got a local git repository. You can use git locally, like that, if you want. But if you want the thing to have a home on github, do the following.

  • Go to github.
  • Log in to your account.
  • Click the new repository button in the top-right. You’ll have an option there to initialize the repository with a README file, but I don’t.
  • Click the “Create repository” button.

Now, follow the second set of instructions, “Push an existing repository…”

$ git remote add origin git@github.com:username/new_repo
$ git push -u origin master

Actually, the first line of the instructions will say

$ git remote add origin https://github.com/username/new_repo

But I use git@github.com:username/new_repo rather than https://github.com/username/new_repo, as the former is for use with ssh (if you set up ssh as I mentioned in “Your first time”, then you won’t have to type your password every time you push things to github). If you use the latter construction, you’ll have to type your github password every time you push to github.

NextContribute to someone’s repository

 

Cited from: http://kbroman.org/github_tutorial/pages/init.html

Advertisements

git setup

1. Generating a new SSH key and adding it to the ssh-agent

Generating a new SSH key

  1. Open Terminal.
  2. Paste the text below, substituting in your GitHub email address.
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    

    This creates a new ssh key, using the provided email as a label.

    Generating public/private rsa key pair.
    
  3. When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.
    Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
    
  4. At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases”.
    Enter passphrase (empty for no passphrase): [Type a passphrase]
    Enter same passphrase again: [Type passphrase again]
    

Adding your SSH key to the ssh-agent

Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.

  1. Start the ssh-agent in the background.
    eval "$(ssh-agent -s)"
    Agent pid 59566
  2. Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
    ssh-add ~/.ssh/id_rsa
  3. Add the SSH key to your GitHub account.

2. Adding a new SSH key to your GitHub account

  1. Copy the SSH key to your clipboard.

    If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don’t add any newlines or whitespace.

    $ sudo apt-get install xclip
    # Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)
    
    $ xclip -sel clip < ~/.ssh/id_rsa.pub
    # Copies the contents of the id_rsa.pub file to your clipboard
    

    Tip: If xclip isn’t working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

  2. Settings icon in the user barIn the upper-right corner of any page, click your profile photo, then click Settings.
  3. Authentication keysIn the user settings sidebar, click SSH and GPG keys.
  4. SSH Key buttonClick New SSH key or Add SSH key.
  5. In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key “Personal MacBook Air”.
  6. The key fieldPaste your key into the “Key” field.
  7. The Add key buttonClick Add SSH key.
  8. Sudo mode dialogIf prompted, confirm your GitHub password.

 

 

###########################################################

3. Set git user name/email

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

4. Add git remote url

git remote set-url origin git://github.com/YourDirectory/YourProject.git
###########################################################

Problem may encounter

When using git, there is an error message saying:

X11 forwarding request failed on channel 0

Solution:

Look for ForwardX11 yes in ~/.ssh/config or /etc/ssh/ssh_config and set it to no. This will prevent ssh from attempting to use X11 forwarding for every connection.

Install gcc new version & set as default

Remove all update-alternatives

sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7

Default_Dedicated_bearer_Creation in LTE network

This document will explain about the new bearer allocation on top of default bearer.

First we will cover the default bearer creation and then we will cover the allocation of dedicated bearer.

Default Bearer Creation:

Here I will elaborate more on GTP perspective for creating default bearer. Please refer the following points when attach request initiated by UE,

  1. UE initiate a “Attach Request” towards eNB with the UE information such as IMSI, UE Core Network Capability, Attach Type, NAS information, RRC parameters etc.
  2. ENB derives MME from RRC parameter and forward the “Attach Request” i.e. S1-MME message (Initial UE Message) towards MME with the Selected Network, CSG ID (Common subscriber group), and TAI+ECGI information.
  3. MME will initiate a GTP-C signaling message towards S-GW to proceed with attach. This will help the EPS (Evolved Packet system) to create default bearer in the network. MME initiates Create Session Request with the following important information
    1. IMSI
    2. MME’s F-TEID for control plane (MME IP + TEID (Tunnel ID)). This will be used for future communication with MME.
    3. PGW’s G-TEID for Control plane (P-GW IP + TEID (here it will be zero)). This will be used by S-GW to communicate with P-GW.
    4. Bearer Context to be created. This is the bearer information to be created at MME. This will include the default bearer ID with TFT, QOS.
    5. APN
    6. Recovery
  4.   S-GW will process the “Create Session Request” initiated by MME and create the UE, eNB, and MME context and modify the Create session Request and send it to P-GW. Create session Request from S-GW will have the following important information
    1. IMSI
    2. S-GW’s F-TEID for control plane (S-GW IP + TEID (Tunnel ID)). This will be used for future communication with S-GW.
    3. Bearer Context to be created. This is the bearer information to be created at S-GW. This will include the default bearer ID with TFT, QOS, S-GW user plane F-TEID
    4. APN
    5. Recovery
  5.  Once P-GW receives “Create Session Request” , it will create UE, S-GW context and communicate with PCRF for QOS and APN resolve. If that succeed, P-GW will respond back with “Create Session Response” towards S-GW. The Create Session Response will have following information:
    1. Cause. This value will be used for Success/failure for the Create Session Request.
    2. P-GW’s F-TEID for control plane (P-GW’s IP + TEID ). This information will be used for future signaling message communication with P-GW.
    3. PAA (PDN Address Allocation).
    4. Bearer Contexts Created. This information element will have Default EPS bearer ID, P-GW user plane F-TEID, TFT, Bearer Qos, Charging ID.
    5. Charging GW
    6. Recovery
  6. Once S-GW receives “Create Session Response”, it will create P-GW context and forward/process the “Create Session Response “with the following information.
    1.  Cause. This value will be used for Success/failure for the Create Session Request.
    2. S-GW’s F-TEID for control plane (S-GW’s IP + TEID ). This information will be used for future signaling message communication with S-GW.
    3. PAA (PDN Address Allocation).
    4. Bearer Contexts Created. This information element will have Default EPS bearer ID, P-GW user plane F-TEID, TFT, Bearer Qos, Charging ID.
    5. Charging GW
    6. Recovery
  7. Now if downlink data comes from PDN it will get buffered in S-GW as user plane eNB information shared with S-GW.
  8. MME shares the eNB information as part of attach procedure with “Modify Bearer request” with the following information. (Bearer Contexts to be modified. This IE will have eNB’s user plane F-TEID.)
  9. Once S-GW receives the “Modify Bearer request” with eNB information.  It will respond back with “Modify bearer Response”.
  10. Now downlink data can be sent to eNB because S-GW has the information of eNB.
  11. But uplink data can possible after step 6.

Cited from:

http://lte-gtp.blogspot.com/2012/02/defaultdedicatedbearercreation-in-lte.html

Functionality of Different LTE Nodes

LTE Architecture
LTE network compromises of the following nodes:

  • UE (User Endpoint)
  • MME (Mobile Management Entity)
  • S-GW (Serving Gateway)
  • P-GW (PDN Gateway)
  • PDN (Packet Data Network or IP world)
  • PCRF (Policy and Charging Enforcement Function)
  • eNB (e Node B)
  • SGSN (Serving GPRS Support Node)
  • HSS (Home Subscriber SubSystem)
  • E-UTRAN (Collection of eNB)
  • EPC (Combination of MME, S-GWand P-GW)
The Architecture of LTE network look like this:
LTE Non-Roaming architecture
The communication between different nodes of LTE work like this:
We will go deeper to describe about the different interface between different nodes, functionality and the layering structure of LTE Nodes.
Interfaces between different Nodes:
Uu-Interface: This interface is in between UE and eNB. This is a radio/air interface and OFDMA (Orthogonal Frequency Division Multiple access) technology is used to send uplink packet and SC-FDMA technology is being used to send downlink packet.
X2-Interface: This interface is in between eNB and eNB. Under this interface the UDP being used as Transport protocol and GTP being used as Application protocol. Basically this interface is used for Handover.
S1-U Interface: This interface is in between eNB and S-GW and this interface will be used for data path communication. Under this interface  UDP will be used as Transport protocol and GTP-U protocol will be used for application protocol
S1-AP Interface: This interface is in between eNB and MME. This interface is used for sending signalling packet between eNB and MME. Under this interface SCTP will be used as transport protocol and S1-AP will be used as application protocol.
S11 Interface: This interface is in between MME and S-GW. this interface will be used for Signalling communication between MME and S-GW. Under this interface UDP will be used as transport protocol and GTP-C will be used as application protocol.
S5-C Interface: This interface is in between S-GW and P-GW. This interface will be used for signalling between S-GW and P-GW. Under this interface UDP will be used for transport protocol and GTP-C will be used for applicatio protocol.
S5-U Interface: This interface is in between S-GW and P-GW. This interface will be used for data path. Under this interface UDP will be used for transport protocol and GTP-U will be used for application protocol.

S6a Interface: This interface is in between MME and HSS. This interface will be used for Authentication, Authorization and Accounting. The SCTP will be used for transport protocol and Diameter will be used for application protocol.

Functionality of LTE Nodes:
eNodeB
The following functionality for eNodeB in LTE network:

–     Header compression and user plane ciphering;
–     MME selection when no routing to an MME can be determined from the information provided by the UE;
–     UL bearer level rate enforcement based on UE-AMBR and MBR via means of uplink scheduling
(e.g. by limiting the amount of UL resources granted per UE over time);
–     DL bearer level rate enforcement based on UE-AMBR;
–     UL and DL bearer level admission control;
–     Transport level packet marking in the uplink, e.g. setting the DiffServ Code Point, based on the QCI of the associated EPS bearer;
–     ECN-based congestion control.

MME
The different functionality of MME are:

–     NAS signalling;
–     NAS signalling security;
–     Inter CN node signalling for mobility between 3GPP access networks (terminating S3);
–     UE Reachability in ECM-IDLE state (including control and execution of paging retransmission);
–     Tracking Area list management;
–     Mapping from UE location (e.g. TAI) to time zone, and signalling a UE time zone change associated with mobility,
–     PDN GW and Serving GW selection;
–     MME selection for handovers with MME change;
–     SGSN selection for handovers to 2G or 3G 3GPP access networks;
–     Roaming (S6a towards home HSS);
–     Authentication;
–     Authorization;
–     Bearer management functions including dedicated bearer establishment;
–     Lawful Interception of signalling traffic;
–     Warning message transfer function (including selection of appropriate eNodeB);
–     UE Reachability procedures.
cited from:

GTP-C Overview

GTP-C tunnels are used between two nodes communicating over a GTP based interface, to separate traffic into different communication flows.

A GTP-C tunnel is identified in each node with a TEID, an IP address and a UDP port number.
Each node will be uniquly identified by F-TEID (Fully Qualified Tunnel identifier) in a global network. Each node will share their   TEID for both signalling and Data path.

There are different version of GTP-C. I will cover more on GTPv2.
In GTPv2-C protocol, three type of messages are there.

  1. Initial Message
  2. Triggered Message
  3. piggy backed message

Initial Message: As name says, who is initiating a request or Command is a Initial Message. e.g. Create Session Request, Bearer Resource Command etc. Always the Initial message will get forward to 2123 for GTP-C and 2152 for GTP-U

Triggered Message: This message is a response message of Initial Message. In Triggered message will use the port same as the source of Initial message. e.g Create Bearer request for Bearer resource Command.

Piggybacked Message: This message is a combination of two GTP-C message with one GTP-C header. e.g. Create Session Response will piggyback Create Bearer Request and same way Create Bearer Response will piggyback Modify Bearer Request.

The GTP-C message has the following format:

Bits
Octets 8 7 6 5 4 3 2 1
1 to m GTP-C header
m+1 to n Zero or more Information Element(s)

The GTP-C message is a combination of GTP-C header and zero or more Information Element.
The Format of GTP-C header is:

Bits
Octets 8 7 6 5 4 3 2 1
1 Version P T=1 Spare Spare Spare
2 Message Type
3 Message Length (1st Octet)
4 Message Length (2nd Octet)
5 Tunnel Endpoint Identifier (1st Octet)
6 Tunnel Endpoint Identifier (2nd Octet)
7 Tunnel Endpoint Identifier (3rd Octet)
8 Tunnel Endpoint Identifier (4th Octet)
9 Sequence Number (1st Octet)
10 Sequence Number (2nd Octet)
11 Sequence Number (3rd Octet)
12 Spare

1st Octet
The 4th bit of first octet is the ‘T’ bit means, If this flag is set then the 4 byte TEID will be available in the GTP-C  message.
The 5th bit of first octet is the ‘P’ bit means, if this bit is set then the message will be considered as piggybacked message.
The 6,7 and 8th bit is combination for version of GTP-C message.
2nd Octet
This octet is for message type of the GTP-C message.
3rd & 4th Octet
These octets are used for Message length of GTP-C header. The length of the message is from TEID field to the end of the message i.e excluding the 4 byte from the GTP-C message.
5th, 6th, 7th & 8th Octet
These octets are used for Tunnel identifier value. these octets will be absent if ‘T’ bit is set to 0.
9th, 10th and 11th Octet
These octets are used for sequence no of the GTP-C message.

The GTP-C messages are divided into two parts.
1. Path Management
2. Tunnel Management

 

Cited from: http://lte-gtp.blogspot.com/2011/07/gtp-c-overview.html

gcc compilation

  1. Preprocesser: replace include .h with the actual code, replace macro, remove comments.
  2. Compiler: compile .c file to assembly code. –> .s
  3. Assembler: convert assembly code .s to binary code .o
  4. Linker: combine binary code together
  5. Loader:

user program processing